@smartbit4all/ng-client 3.3.136 → 3.3.137

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12900,9 +12900,104 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
12900
12900
  * Public API Surface of smart-grid
12901
12901
  */
12902
12902
 
12903
+ class SmartComponentLayoutUtility {
12904
+ static getForms(comp) {
12905
+ let result = [];
12906
+ if (comp.components) {
12907
+ const children = comp.components
12908
+ .map((c) => this.getForms(c))
12909
+ .reduce((acc, value) => acc.concat(value), []);
12910
+ result.push(...children);
12911
+ }
12912
+ const expandable = this.getExpandableComponent(comp);
12913
+ if (expandable) {
12914
+ result.push(...this.getForms(expandable));
12915
+ }
12916
+ if (comp.smartFormComponent) {
12917
+ result.push(comp.smartFormComponent);
12918
+ }
12919
+ return result;
12920
+ }
12921
+ static getGrids(comp) {
12922
+ let result = [];
12923
+ if (comp.components) {
12924
+ const children = comp.components
12925
+ .map((c) => this.getGrids(c))
12926
+ .reduce((acc, value) => acc.concat(value), []);
12927
+ result.push(...children);
12928
+ }
12929
+ const expandable = this.getExpandableComponent(comp);
12930
+ if (expandable) {
12931
+ result.push(...this.getGrids(expandable));
12932
+ }
12933
+ if (comp.smartGridComponent) {
12934
+ result.push(comp.smartGridComponent);
12935
+ }
12936
+ return result;
12937
+ }
12938
+ static getTrees(comp) {
12939
+ let result = [];
12940
+ if (comp.components) {
12941
+ const children = comp.components
12942
+ ?.map((c) => this.getTrees(c))
12943
+ .reduce((acc, value) => acc.concat(value), []);
12944
+ result.push(...children);
12945
+ }
12946
+ const expandable = this.getExpandableComponent(comp);
12947
+ if (expandable) {
12948
+ result.push(...this.getTrees(expandable));
12949
+ }
12950
+ if (comp.treeService) {
12951
+ result.push(comp.treeService);
12952
+ }
12953
+ return result;
12954
+ }
12955
+ static getToolbars(comp) {
12956
+ let result = [];
12957
+ if (comp.components) {
12958
+ const children = comp.components
12959
+ .map((c) => this.getToolbars(c))
12960
+ .reduce((acc, value) => acc.concat(value), []);
12961
+ result.push(...children);
12962
+ }
12963
+ const expandable = this.getExpandableComponent(comp);
12964
+ if (expandable) {
12965
+ result.push(...this.getToolbars(expandable));
12966
+ }
12967
+ if (comp.toolbar) {
12968
+ result.push(comp.toolbar);
12969
+ }
12970
+ return result;
12971
+ }
12972
+ static getExpandableComponent(comp) {
12973
+ return comp.expandableComponents?.first?.componentRef?.instance;
12974
+ }
12975
+ static applyStyle(style, elementRef, renderer) {
12976
+ if (style && elementRef && renderer) {
12977
+ let element = elementRef.nativeElement;
12978
+ // css style properties
12979
+ if (style.style) {
12980
+ Object.entries(style.style).forEach(([key, value]) => {
12981
+ renderer.setStyle(element, key, value, RendererStyleFlags2.Important);
12982
+ });
12983
+ }
12984
+ // add classes
12985
+ if (style.classesToAdd) {
12986
+ style.classesToAdd.forEach((cl) => renderer.addClass(element, cl));
12987
+ }
12988
+ // remove classes
12989
+ if (style.classesToRemove) {
12990
+ style.classesToRemove.forEach((cl) => renderer.removeClass(element, cl));
12991
+ }
12992
+ }
12993
+ }
12994
+ }
12995
+
12903
12996
  class SmartComponentLayoutComponent {
12904
- constructor(layoutService) {
12997
+ constructor(layoutService, element, renderer) {
12905
12998
  this.layoutService = layoutService;
12999
+ this.element = element;
13000
+ this.renderer = renderer;
12906
13001
  this._destroy$ = new Subject();
12907
13002
  }
12908
13003
  ngAfterViewInit() {
@@ -12987,6 +13082,7 @@ class SmartComponentLayoutComponent {
12987
13082
  this.parentSmartComponent.initActions();
12988
13083
  }
12989
13084
  }
13085
+ SmartComponentLayoutUtility.applyStyle(this.smartComponentLayout.style, this.element, this.renderer);
12990
13086
  }
12991
13087
  type() {
12992
13088
  return ComponentType;
@@ -13109,12 +13205,12 @@ class SmartComponentLayoutComponent {
13109
13205
  }
13110
13206
  }
13111
13207
  }
13112
- SmartComponentLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartComponentLayoutComponent, deps: [{ token: SmartformLayoutDefinitionService }], target: i0.ɵɵFactoryTarget.Component });
13208
+ SmartComponentLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartComponentLayoutComponent, deps: [{ token: SmartformLayoutDefinitionService }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
13113
13209
  SmartComponentLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SmartComponentLayoutComponent, selector: "smart-component-layout", inputs: { smartComponentLayout: "smartComponentLayout", parentLayoutComponent: "parentLayoutComponent", parentSmartComponent: "parentSmartComponent" }, viewQueries: [{ propertyName: "smartFormList", predicate: ["form"], descendants: true }, { propertyName: "smartGridList", predicate: ["grid"], descendants: true }, { propertyName: "smartFilterList", predicate: ["filter"], descendants: true }, { propertyName: "toolbarList", predicate: ["toolbar"], descendants: true }, { propertyName: "expandableComponents", predicate: ExpandableSectionComponent, descendants: true }, { propertyName: "components", predicate: SmartComponentLayoutComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"smartComponentLayout?.expandable; then expandable; else normal\"> </div>\r\n\r\n<ng-template #expandable>\r\n <smart-expandable-section\r\n *ngIf=\"expandableSection\"\r\n [data]=\"expandableSection\"\r\n ></smart-expandable-section>\r\n</ng-template>\r\n\r\n<ng-template #normal>\r\n <div\r\n *ngIf=\"smartComponentLayout?.type === type().CONTAINER\"\r\n [ngClass]=\"smartComponentLayout?.direction ?? 'vertical'\"\r\n >\r\n <smart-component-layout\r\n *ngFor=\"let layout of smartComponentLayout?.components\"\r\n [parentSmartComponent]=\"parentSmartComponent\"\r\n [parentLayoutComponent]=\"this\"\r\n [smartComponentLayout]=\"layout\"\r\n ></smart-component-layout>\r\n </div>\r\n <smartform *ngIf=\"smartForm\" #form [smartForm]=\"smartForm\"></smartform>\r\n <smart-grid *ngIf=\"smartGrid\" #grid [smartGrid]=\"smartGrid\" [uuid]=\"uuid!\"></smart-grid>\r\n <!-- <smart-filter #filter [filter]=\"smartFilter\"></smart-filter> -->\r\n <smart-tree *ngIf=\"treeService\" [treeService]=\"treeService!\"></smart-tree>\r\n <smart-ui-action-toolbar *ngIf=\"!!toolbarId\" #toolbar [id]=\"toolbarId\"></smart-ui-action-toolbar>\r\n</ng-template>\r\n", styles: [".horizontal{display:flex;flex-direction:row}.vertical{display:flex;flex-direction:column}\n"], components: [{ type: ExpandableSectionComponent, selector: "smart-expandable-section", inputs: ["data", "index"] }, { type: SmartComponentLayoutComponent, selector: "smart-component-layout", inputs: ["smartComponentLayout", "parentLayoutComponent", "parentSmartComponent"] }, { type: SmartformComponent, selector: "smartform", inputs: ["smartForm"] }, { type: SmartGridComponent, selector: "smart-grid", inputs: ["smartGrid", "uuid", "dev"] }, { type: SmartTreeComponent, selector: "smart-tree", inputs: ["treeStyle", "treeService"] }, { type: UiActionToolbarComponent, selector: "smart-ui-action-toolbar", inputs: ["uiActionModels", "uiActionDescriptorService", "id"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }] });
13114
13210
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartComponentLayoutComponent, decorators: [{
13115
13211
  type: Component,
13116
13212
  args: [{ selector: 'smart-component-layout', template: "<div *ngIf=\"smartComponentLayout?.expandable; then expandable; else normal\"> </div>\r\n\r\n<ng-template #expandable>\r\n <smart-expandable-section\r\n *ngIf=\"expandableSection\"\r\n [data]=\"expandableSection\"\r\n ></smart-expandable-section>\r\n</ng-template>\r\n\r\n<ng-template #normal>\r\n <div\r\n *ngIf=\"smartComponentLayout?.type === type().CONTAINER\"\r\n [ngClass]=\"smartComponentLayout?.direction ?? 'vertical'\"\r\n >\r\n <smart-component-layout\r\n *ngFor=\"let layout of smartComponentLayout?.components\"\r\n [parentSmartComponent]=\"parentSmartComponent\"\r\n [parentLayoutComponent]=\"this\"\r\n [smartComponentLayout]=\"layout\"\r\n ></smart-component-layout>\r\n </div>\r\n <smartform *ngIf=\"smartForm\" #form [smartForm]=\"smartForm\"></smartform>\r\n <smart-grid *ngIf=\"smartGrid\" #grid [smartGrid]=\"smartGrid\" [uuid]=\"uuid!\"></smart-grid>\r\n <!-- <smart-filter #filter [filter]=\"smartFilter\"></smart-filter> -->\r\n <smart-tree *ngIf=\"treeService\" [treeService]=\"treeService!\"></smart-tree>\r\n <smart-ui-action-toolbar *ngIf=\"!!toolbarId\" #toolbar [id]=\"toolbarId\"></smart-ui-action-toolbar>\r\n</ng-template>\r\n", styles: [".horizontal{display:flex;flex-direction:row}.vertical{display:flex;flex-direction:column}\n"] }]
13117
- }], ctorParameters: function () { return [{ type: SmartformLayoutDefinitionService }]; }, propDecorators: { smartComponentLayout: [{
13213
+ }], ctorParameters: function () { return [{ type: SmartformLayoutDefinitionService }, { type: i0.ElementRef }, { type: i0.Renderer2 }]; }, propDecorators: { smartComponentLayout: [{
13118
13214
  type: Input
13119
13215
  }], parentLayoutComponent: [{
13120
13216
  type: Input
@@ -14472,80 +14568,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
14472
14568
  * Public API Surface of smarttree
14473
14569
  */
14474
14570
 
14475
- class SmartComponentLayoutUtility {
14476
- static getForms(comp) {
14477
- let result = [];
14478
- if (comp.components) {
14479
- const children = comp.components
14480
- .map((c) => this.getForms(c))
14481
- .reduce((acc, value) => acc.concat(value), []);
14482
- result.push(...children);
14483
- }
14484
- const expandable = this.getExpandableComponent(comp);
14485
- if (expandable) {
14486
- result.push(...this.getForms(expandable));
14487
- }
14488
- if (comp.smartFormComponent) {
14489
- result.push(comp.smartFormComponent);
14490
- }
14491
- return result;
14492
- }
14493
- static getGrids(comp) {
14494
- let result = [];
14495
- if (comp.components) {
14496
- const children = comp.components
14497
- .map((c) => this.getGrids(c))
14498
- .reduce((acc, value) => acc.concat(value), []);
14499
- result.push(...children);
14500
- }
14501
- const expandable = this.getExpandableComponent(comp);
14502
- if (expandable) {
14503
- result.push(...this.getGrids(expandable));
14504
- }
14505
- if (comp.smartGridComponent) {
14506
- result.push(comp.smartGridComponent);
14507
- }
14508
- return result;
14509
- }
14510
- static getTrees(comp) {
14511
- let result = [];
14512
- if (comp.components) {
14513
- const children = comp.components
14514
- ?.map((c) => this.getTrees(c))
14515
- .reduce((acc, value) => acc.concat(value), []);
14516
- result.push(...children);
14517
- }
14518
- const expandable = this.getExpandableComponent(comp);
14519
- if (expandable) {
14520
- result.push(...this.getTrees(expandable));
14521
- }
14522
- if (comp.treeService) {
14523
- result.push(comp.treeService);
14524
- }
14525
- return result;
14526
- }
14527
- static getToolbars(comp) {
14528
- let result = [];
14529
- if (comp.components) {
14530
- const children = comp.components
14531
- .map((c) => this.getToolbars(c))
14532
- .reduce((acc, value) => acc.concat(value), []);
14533
- result.push(...children);
14534
- }
14535
- const expandable = this.getExpandableComponent(comp);
14536
- if (expandable) {
14537
- result.push(...this.getToolbars(expandable));
14538
- }
14539
- if (comp.toolbar) {
14540
- result.push(comp.toolbar);
14541
- }
14542
- return result;
14543
- }
14544
- static getExpandableComponent(comp) {
14545
- return comp.expandableComponents?.first?.componentRef?.instance;
14546
- }
14547
- }
14548
-
14549
14571
  /*
14550
14572
  * Public API Surface of smart-component-layout
14551
14573
  */
@@ -15095,7 +15117,7 @@ class SmartComponentApiClient {
15095
15117
  return this.widgets;
15096
15118
  }
15097
15119
  initComponentByModel() {
15098
- this.initStyle();
15120
+ SmartComponentLayoutUtility.applyStyle(this.model?.style, this.element, this.renderer);
15099
15121
  this.initData();
15100
15122
  this.initActions();
15101
15123
  if (this.useQueryLists) {
@@ -15109,26 +15131,6 @@ class SmartComponentApiClient {
15109
15131
  }
15110
15132
  // TODO: layout, widgets
15111
15133
  }
15112
- initStyle() {
15113
- if (this.model?.style && this.element && this.renderer) {
15114
- let styleData = this.model.style;
15115
- let element = this.element.nativeElement;
15116
- // css style properties
15117
- if (styleData.style) {
15118
- Object.entries(styleData.style).forEach(([key, value]) => {
15119
- this.renderer.setStyle(element, key, value, RendererStyleFlags2.Important);
15120
- });
15121
- }
15122
- // add classes
15123
- if (styleData.classesToAdd) {
15124
- styleData.classesToAdd.forEach((cl) => this.renderer.addClass(element, cl));
15125
- }
15126
- // remove classes
15127
- if (styleData.classesToRemove) {
15128
- styleData.classesToRemove.forEach((cl) => this.renderer.removeClass(element, cl));
15129
- }
15130
- }
15131
- }
15132
15134
  getAllSmartFormComponents() {
15133
15135
  let forms = this.getSmartFormsQL()?.toArray() ?? [];
15134
15136
  this.getSmartComponentLayoutsQL()?.forEach((comp) => {