Преглед изворни кода

Merged conflicts with Igor's code

master
Safet Purkovic пре 4 година
родитељ
комит
47b2b6a3dc

+ 2
- 1
src/parameters/contracts.js Прегледај датотеку

@@ -19,7 +19,8 @@ const contracts = () =>
new Param("br-headerfirstpageonly",["table"]),
new Param("br-landscapetable",["table"]),
new Param("br-transformrotate",["div", "table"]),
new Param("br-isolatedlandscape",["div", "table"])
new Param("br-isolatedlandscape",["div", "table"]),
new Param("br-hidechildren",["div"])
];
}


+ 5
- 0
src/transformations/hide-children/hide-child.css Прегледај датотеку

@@ -0,0 +1,5 @@
@media print{
.hide-child{
display: none !important;
}
}

+ 35
- 0
src/transformations/hide-children/hide-children.js Прегледај датотеку

@@ -0,0 +1,35 @@
import './hide-child.css';
import { Transform } from "../transform";
import $ from 'jquery';

export class Hidechildren extends Transform {
constructor(param) {
super(param);
this.object = param.object;
this.children = this.object.children;
this.class = null;
}

execute() {
for (var i = 0; i < this.children.length; i++) {
if (this.children[i].attributes.code) {
if (this.children[i].attributes.code.value !== "keep") {
$(this.children[i]).addClass('hide-child');
}
}else{
$(this.children[i]).addClass('hide-child');
}
}
this.class = this.object.parentElement.attributes.class.value;
$(this.object.parentElement).removeClass();
}

rolback() {
for (var i = 0; i < this.children.length; i++) {
$(this.children[i]).removeClass('hide-child');
if (this.class) {
$(this.object.parentElement).addClass(this.class);
}
}
}
}

+ 3
- 0
src/transforms-factory.js Прегледај датотеку

@@ -11,6 +11,7 @@ import { HeaderEveryPageTransform } from "./transformations/header-transformatio
import { HeaderFirstPageOnlyTransform } from "./transformations/header-transformations/header-first-page-only-transformation";
import { TransformRotate } from "./transformations/transform-rotate";
import { IsolatedLandscapeTransformation } from "./transformations/isolated-landscape-transformation";
import { Hidechildren } from "./transformations/hide-children/hide-children";

export class TransformsFactory {
produce(code, object, selectors) {
@@ -45,6 +46,8 @@ export class TransformsFactory {
return new TransformRotate(param);
case "br-isolatedlandscape":
return new IsolatedLandscapeTransformation(param);
case "br-hidechildren":
return new Hidechildren(param);
}

return null;

Loading…
Откажи
Сачувај