| @@ -19,6 +19,7 @@ const contracts = () => | |||
| new Param("br-headerfirstpageonly",["table"]), | |||
| new Param("br-landscapetable",["table"]), | |||
| new Param("br-transformrotate",["div", "table"]), | |||
| new Param("br-hidechildren",["div"]) | |||
| ]; | |||
| } | |||
| @@ -0,0 +1,5 @@ | |||
| @media print{ | |||
| .hide-child{ | |||
| display: none !important; | |||
| } | |||
| } | |||
| @@ -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); | |||
| } | |||
| } | |||
| } | |||
| } | |||
| @@ -10,6 +10,7 @@ import { LandscapeTableTransform } from "./transformations/layout-table-transfor | |||
| import { HeaderEveryPageTransform } from "./transformations/header-transformations/header-every-page-transformation"; | |||
| import { HeaderFirstPageOnlyTransform } from "./transformations/header-transformations/header-first-page-only-transformation"; | |||
| import { TransformRotate } from "./transformations/transform-rotate"; | |||
| import { Hidechildren } from "./transformations/hide-children/hide-children"; | |||
| export class TransformsFactory { | |||
| produce(code, object, selectors) { | |||
| @@ -42,6 +43,8 @@ export class TransformsFactory { | |||
| return new HeaderFirstPageOnlyTransform(param); | |||
| case "br-transformrotate": | |||
| return new TransformRotate(param); | |||
| case "br-hidechildren": | |||
| return new Hidechildren(param); | |||
| } | |||
| return null; | |||