@smartbit4all/ng-client 3.3.128 → 3.3.130

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.
@@ -12894,101 +12894,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
12894
12894
  * Public API Surface of smart-grid
12895
12895
  */
12896
12896
 
12897
- class SmartComponentLayoutUtility {
12898
- static setParent(layout, parent) {
12899
- layout.parentComponent = parent;
12900
- layout.components?.forEach((l) => this.setParent(l, parent));
12901
- }
12902
- static equals(layout1, layout2) {
12903
- if ((layout1 && !layout2) || (layout2 && !layout1)) {
12904
- return false;
12905
- }
12906
- if (!layout1 && !layout2) {
12907
- return true;
12908
- }
12909
- // both layout1 and layout2 exists
12910
- let parent1 = layout1.parentComponent;
12911
- let parent2 = layout1.parentComponent;
12912
- this.setParent(layout1, null);
12913
- this.setParent(layout2, null);
12914
- const result = deepEqual(layout1, layout2);
12915
- this.setParent(layout1, parent1);
12916
- this.setParent(layout2, parent2);
12917
- return result;
12918
- }
12919
- static getForms(comp) {
12920
- let result = [];
12921
- if (comp.components) {
12922
- const children = comp.components
12923
- .map((c) => this.getForms(c))
12924
- .reduce((acc, value) => acc.concat(value), []);
12925
- result.push(...children);
12926
- }
12927
- const expandable = this.getExpandableComponent(comp);
12928
- if (expandable) {
12929
- result.push(...this.getForms(expandable));
12930
- }
12931
- if (comp.smartFormComponent) {
12932
- result.push(comp.smartFormComponent);
12933
- }
12934
- return result;
12935
- }
12936
- static getGrids(comp) {
12937
- let result = [];
12938
- if (comp.components) {
12939
- const children = comp.components
12940
- .map((c) => this.getGrids(c))
12941
- .reduce((acc, value) => acc.concat(value), []);
12942
- result.push(...children);
12943
- }
12944
- const expandable = this.getExpandableComponent(comp);
12945
- if (expandable) {
12946
- result.push(...this.getGrids(expandable));
12947
- }
12948
- if (comp.smartGridComponent) {
12949
- result.push(comp.smartGridComponent);
12950
- }
12951
- return result;
12952
- }
12953
- static getTrees(comp) {
12954
- let result = [];
12955
- if (comp.components) {
12956
- const children = comp.components
12957
- ?.map((c) => this.getTrees(c))
12958
- .reduce((acc, value) => acc.concat(value), []);
12959
- result.push(...children);
12960
- }
12961
- const expandable = this.getExpandableComponent(comp);
12962
- if (expandable) {
12963
- result.push(...this.getTrees(expandable));
12964
- }
12965
- if (comp.treeService) {
12966
- result.push(comp.treeService);
12967
- }
12968
- return result;
12969
- }
12970
- static getToolbars(comp) {
12971
- let result = [];
12972
- if (comp.components) {
12973
- const children = comp.components
12974
- .map((c) => this.getToolbars(c))
12975
- .reduce((acc, value) => acc.concat(value), []);
12976
- result.push(...children);
12977
- }
12978
- const expandable = this.getExpandableComponent(comp);
12979
- if (expandable) {
12980
- result.push(...this.getToolbars(expandable));
12981
- }
12982
- if (comp.toolbar) {
12983
- result.push(comp.toolbar);
12984
- }
12985
- return result;
12986
- }
12987
- static getExpandableComponent(comp) {
12988
- return comp.expandableComponents?.first?.componentRef?.instance;
12989
- }
12990
- }
12991
-
12992
12897
  class SmartComponentLayoutComponent {
12993
12898
  constructor(layoutService) {
12994
12899
  this.layoutService = layoutService;
@@ -13036,20 +12941,20 @@ class SmartComponentLayoutComponent {
13036
12941
  this._destroy$.complete();
13037
12942
  }
13038
12943
  ngOnChanges(changes) {
13039
- let newLayout = changes['smartComponentLayout'].currentValue;
13040
- if (SmartComponentLayoutUtility.equals(this.smartComponentLayout, newLayout)) {
13041
- // no change in layout, don't setup again
13042
- return;
12944
+ if (deepEqual(this.smartComponentLayout, this.currentLayout)) {
12945
+ // no layout change, keep current state
13043
12946
  }
13044
- this.smartComponentLayout = newLayout;
13045
- if (this.smartComponentLayout) {
13046
- this.setUp();
12947
+ else {
12948
+ // layout changed, render
12949
+ this.currentLayout = JSON.parse(JSON.stringify(this.smartComponentLayout));
12950
+ if (this.smartComponentLayout) {
12951
+ this.setUp();
12952
+ }
13047
12953
  }
13048
12954
  }
13049
12955
  setUp() {
13050
- this.parent = this.smartComponentLayout?.parentComponent;
13051
- this.uuid = this.parent.uuid;
13052
- this.treeService = this.parent.smartTreeService;
12956
+ this.uuid = this.parentSmartComponent.uuid;
12957
+ this.treeService = this.parentSmartComponent.smartTreeService;
13053
12958
  this.smartComponentLayout?.direction;
13054
12959
  if (this.smartComponentLayout?.expandable) {
13055
12960
  this.constructExpandableSection();
@@ -13071,7 +12976,10 @@ class SmartComponentLayoutComponent {
13071
12976
  else if (this.smartComponentLayout.widget?.type === ComponentWidgetType.TOOLBAR) {
13072
12977
  this.constructToolbar();
13073
12978
  }
13074
- this.parent.initActions();
12979
+ if (!this.parentLayoutComponent) {
12980
+ // only top level component should call init actions
12981
+ this.parentSmartComponent.initActions();
12982
+ }
13075
12983
  }
13076
12984
  }
13077
12985
  type() {
@@ -13093,7 +13001,7 @@ class SmartComponentLayoutComponent {
13093
13001
  });
13094
13002
  this.smartForm = {
13095
13003
  direction: this.getFormLayout(),
13096
- componentModel: this.parent?.model,
13004
+ componentModel: this.parentSmartComponent?.model,
13097
13005
  widgets,
13098
13006
  };
13099
13007
  this.bindForm();
@@ -13113,11 +13021,11 @@ class SmartComponentLayoutComponent {
13113
13021
  }
13114
13022
  }
13115
13023
  bindForm() {
13116
- if (this.parent?.useQueryLists) {
13024
+ if (this.parentSmartComponent?.useQueryLists) {
13117
13025
  return;
13118
13026
  }
13119
13027
  if (this.smartForm && this.smartFormComponent) {
13120
- this.parent?.addForm(
13028
+ this.parentSmartComponent?.addForm(
13121
13029
  // unique identifier for the form
13122
13030
  `form_${this.makeid(5)}`, this.smartForm, this.smartFormComponent);
13123
13031
  }
@@ -13154,11 +13062,11 @@ class SmartComponentLayoutComponent {
13154
13062
  }
13155
13063
  }
13156
13064
  bindGrid() {
13157
- if (this.parent?.useQueryLists) {
13065
+ if (this.parentSmartComponent?.useQueryLists) {
13158
13066
  return;
13159
13067
  }
13160
13068
  if (this.smartGrid && this.smartGridComponent) {
13161
- this.smartGrid = this.parent?.addGrid(this.smartGrid, {
13069
+ this.smartGrid = this.parentSmartComponent?.addGrid(this.smartGrid, {
13162
13070
  rowUiActionType: GridUiActionType.POPUP_MENU,
13163
13071
  }, false, this.smartGridComponent);
13164
13072
  }
@@ -13179,10 +13087,10 @@ class SmartComponentLayoutComponent {
13179
13087
  // TODO
13180
13088
  }
13181
13089
  constructTree() {
13182
- if (this.parent?.useQueryLists) {
13090
+ if (this.parentSmartComponent?.useQueryLists) {
13183
13091
  return;
13184
13092
  }
13185
- this.parent.setUpDefaultTree(this.smartComponentLayout?.widget?.identifier);
13093
+ this.parentSmartComponent.setUpDefaultTree(this.smartComponentLayout?.widget?.identifier);
13186
13094
  this.treeService?.initialize();
13187
13095
  }
13188
13096
  constructToolbar() {
@@ -13193,12 +13101,16 @@ class SmartComponentLayoutComponent {
13193
13101
  }
13194
13102
  }
13195
13103
  SmartComponentLayoutComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartComponentLayoutComponent, deps: [{ token: SmartformLayoutDefinitionService }], target: i0.ɵɵFactoryTarget.Component });
13196
- SmartComponentLayoutComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SmartComponentLayoutComponent, selector: "smart-component-layout", inputs: { smartComponentLayout: "smartComponentLayout" }, 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 [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"] }, { 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"] }] });
13104
+ 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"] }] });
13197
13105
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartComponentLayoutComponent, decorators: [{
13198
13106
  type: Component,
13199
- 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 [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"] }]
13107
+ 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"] }]
13200
13108
  }], ctorParameters: function () { return [{ type: SmartformLayoutDefinitionService }]; }, propDecorators: { smartComponentLayout: [{
13201
13109
  type: Input
13110
+ }], parentLayoutComponent: [{
13111
+ type: Input
13112
+ }], parentSmartComponent: [{
13113
+ type: Input
13202
13114
  }], smartFormList: [{
13203
13115
  type: ViewChildren,
13204
13116
  args: ['form']
@@ -14551,6 +14463,80 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
14551
14463
  * Public API Surface of smarttree
14552
14464
  */
14553
14465
 
14466
+ class SmartComponentLayoutUtility {
14467
+ static getForms(comp) {
14468
+ let result = [];
14469
+ if (comp.components) {
14470
+ const children = comp.components
14471
+ .map((c) => this.getForms(c))
14472
+ .reduce((acc, value) => acc.concat(value), []);
14473
+ result.push(...children);
14474
+ }
14475
+ const expandable = this.getExpandableComponent(comp);
14476
+ if (expandable) {
14477
+ result.push(...this.getForms(expandable));
14478
+ }
14479
+ if (comp.smartFormComponent) {
14480
+ result.push(comp.smartFormComponent);
14481
+ }
14482
+ return result;
14483
+ }
14484
+ static getGrids(comp) {
14485
+ let result = [];
14486
+ if (comp.components) {
14487
+ const children = comp.components
14488
+ .map((c) => this.getGrids(c))
14489
+ .reduce((acc, value) => acc.concat(value), []);
14490
+ result.push(...children);
14491
+ }
14492
+ const expandable = this.getExpandableComponent(comp);
14493
+ if (expandable) {
14494
+ result.push(...this.getGrids(expandable));
14495
+ }
14496
+ if (comp.smartGridComponent) {
14497
+ result.push(comp.smartGridComponent);
14498
+ }
14499
+ return result;
14500
+ }
14501
+ static getTrees(comp) {
14502
+ let result = [];
14503
+ if (comp.components) {
14504
+ const children = comp.components
14505
+ ?.map((c) => this.getTrees(c))
14506
+ .reduce((acc, value) => acc.concat(value), []);
14507
+ result.push(...children);
14508
+ }
14509
+ const expandable = this.getExpandableComponent(comp);
14510
+ if (expandable) {
14511
+ result.push(...this.getTrees(expandable));
14512
+ }
14513
+ if (comp.treeService) {
14514
+ result.push(comp.treeService);
14515
+ }
14516
+ return result;
14517
+ }
14518
+ static getToolbars(comp) {
14519
+ let result = [];
14520
+ if (comp.components) {
14521
+ const children = comp.components
14522
+ .map((c) => this.getToolbars(c))
14523
+ .reduce((acc, value) => acc.concat(value), []);
14524
+ result.push(...children);
14525
+ }
14526
+ const expandable = this.getExpandableComponent(comp);
14527
+ if (expandable) {
14528
+ result.push(...this.getToolbars(expandable));
14529
+ }
14530
+ if (comp.toolbar) {
14531
+ result.push(comp.toolbar);
14532
+ }
14533
+ return result;
14534
+ }
14535
+ static getExpandableComponent(comp) {
14536
+ return comp.expandableComponents?.first?.componentRef?.instance;
14537
+ }
14538
+ }
14539
+
14554
14540
  /*
14555
14541
  * Public API Surface of smart-component-layout
14556
14542
  */
@@ -15017,8 +15003,6 @@ class SmartComponentApiClient {
15017
15003
  else {
15018
15004
  this.handleQueryList(this.getSmartComponentLayoutsQL(), (comp) => {
15019
15005
  if (comp.smartComponentLayout) {
15020
- // TODO maybe we should set comp.parent, not comp.smartComponentLayout.parentComponent..
15021
- SmartComponentLayoutUtility.setParent(comp.smartComponentLayout, this);
15022
15006
  this.initActions();
15023
15007
  }
15024
15008
  if (this.uuid && this.uuid !== comp.uuid)