@smartbit4all/ng-client 3.3.124 → 3.3.126

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.
@@ -70,6 +70,7 @@ import { MatPaginatorModule } from '@angular/material/paginator';
70
70
  import { FlatTreeControl, NestedTreeControl } from '@angular/cdk/tree';
71
71
  import * as i10 from '@angular/material/tree';
72
72
  import { MatTreeFlattener, MatTreeFlatDataSource, MatTreeModule, MatTreeNestedDataSource } from '@angular/material/tree';
73
+ import structuredClone from '@ungap/structured-clone';
73
74
  import * as i1$5 from '@angular/material/toolbar';
74
75
  import { MatToolbarModule } from '@angular/material/toolbar';
75
76
  import { MatBadgeModule } from '@angular/material/badge';
@@ -12894,6 +12895,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
12894
12895
  * Public API Surface of smart-grid
12895
12896
  */
12896
12897
 
12898
+ class SmartComponentLayoutUtility {
12899
+ static setParent(layout, parent) {
12900
+ layout.parentComponent = parent;
12901
+ layout.components?.forEach((l) => this.setParent(l, parent));
12902
+ }
12903
+ static equals(layout1, layout2) {
12904
+ if ((layout1 && !layout2) || (layout2 && !layout1)) {
12905
+ return false;
12906
+ }
12907
+ if (!layout1 && !layout2) {
12908
+ return true;
12909
+ }
12910
+ // both layout1 and layout2 exists
12911
+ let l1 = structuredClone(layout1);
12912
+ this.setParent(l1, null);
12913
+ let l2 = structuredClone(layout1);
12914
+ this.setParent(l2, null);
12915
+ return deepEqual(l1, l2);
12916
+ }
12917
+ static getForms(comp) {
12918
+ let result = [];
12919
+ if (comp.components) {
12920
+ const children = comp.components
12921
+ .map((c) => this.getForms(c))
12922
+ .reduce((acc, value) => acc.concat(value), []);
12923
+ result.push(...children);
12924
+ }
12925
+ const expandable = this.getExpandableComponent(comp);
12926
+ if (expandable) {
12927
+ result.push(...this.getForms(expandable));
12928
+ }
12929
+ if (comp.smartFormComponent) {
12930
+ result.push(comp.smartFormComponent);
12931
+ }
12932
+ return result;
12933
+ }
12934
+ static getGrids(comp) {
12935
+ let result = [];
12936
+ if (comp.components) {
12937
+ const children = comp.components
12938
+ .map((c) => this.getGrids(c))
12939
+ .reduce((acc, value) => acc.concat(value), []);
12940
+ result.push(...children);
12941
+ }
12942
+ const expandable = this.getExpandableComponent(comp);
12943
+ if (expandable) {
12944
+ result.push(...this.getGrids(expandable));
12945
+ }
12946
+ if (comp.smartGridComponent) {
12947
+ result.push(comp.smartGridComponent);
12948
+ }
12949
+ return result;
12950
+ }
12951
+ static getTrees(comp) {
12952
+ let result = [];
12953
+ if (comp.components) {
12954
+ const children = comp.components
12955
+ ?.map((c) => this.getTrees(c))
12956
+ .reduce((acc, value) => acc.concat(value), []);
12957
+ result.push(...children);
12958
+ }
12959
+ const expandable = this.getExpandableComponent(comp);
12960
+ if (expandable) {
12961
+ result.push(...this.getTrees(expandable));
12962
+ }
12963
+ if (comp.treeService) {
12964
+ result.push(comp.treeService);
12965
+ }
12966
+ return result;
12967
+ }
12968
+ static getToolbars(comp) {
12969
+ let result = [];
12970
+ if (comp.components) {
12971
+ const children = comp.components
12972
+ .map((c) => this.getToolbars(c))
12973
+ .reduce((acc, value) => acc.concat(value), []);
12974
+ result.push(...children);
12975
+ }
12976
+ const expandable = this.getExpandableComponent(comp);
12977
+ if (expandable) {
12978
+ result.push(...this.getToolbars(expandable));
12979
+ }
12980
+ if (comp.toolbar) {
12981
+ result.push(comp.toolbar);
12982
+ }
12983
+ return result;
12984
+ }
12985
+ static getExpandableComponent(comp) {
12986
+ return comp.expandableComponents?.first?.componentRef?.instance;
12987
+ }
12988
+ }
12989
+
12897
12990
  class SmartComponentLayoutComponent {
12898
12991
  constructor(layoutService) {
12899
12992
  this.layoutService = layoutService;
@@ -12941,7 +13034,12 @@ class SmartComponentLayoutComponent {
12941
13034
  this._destroy$.complete();
12942
13035
  }
12943
13036
  ngOnChanges(changes) {
12944
- this.smartComponentLayout = changes['smartComponentLayout'].currentValue;
13037
+ let newLayout = changes['smartComponentLayout'].currentValue;
13038
+ if (SmartComponentLayoutUtility.equals(this.smartComponentLayout, newLayout)) {
13039
+ // no change in layout, don't setup again
13040
+ return;
13041
+ }
13042
+ this.smartComponentLayout = newLayout;
12945
13043
  if (this.smartComponentLayout) {
12946
13044
  this.setUp();
12947
13045
  }
@@ -12962,7 +13060,8 @@ class SmartComponentLayoutComponent {
12962
13060
  this.constructGrid();
12963
13061
  }
12964
13062
  else if (this.smartComponentLayout.widget?.type === ComponentWidgetType.FILTER) {
12965
- this.constructFilter();
13063
+ console.warn('ComponentWidgetType.FILTER is not supported');
13064
+ // this.constructFilter();
12966
13065
  }
12967
13066
  else if (this.smartComponentLayout.widget?.type === ComponentWidgetType.TREE) {
12968
13067
  this.constructTree();
@@ -13012,6 +13111,9 @@ class SmartComponentLayoutComponent {
13012
13111
  }
13013
13112
  }
13014
13113
  bindForm() {
13114
+ if (this.parent?.useQueryLists) {
13115
+ return;
13116
+ }
13015
13117
  if (this.smartForm && this.smartFormComponent) {
13016
13118
  this.parent?.addForm(
13017
13119
  // unique identifier for the form
@@ -13050,6 +13152,9 @@ class SmartComponentLayoutComponent {
13050
13152
  }
13051
13153
  }
13052
13154
  bindGrid() {
13155
+ if (this.parent?.useQueryLists) {
13156
+ return;
13157
+ }
13053
13158
  if (this.smartGrid && this.smartGridComponent) {
13054
13159
  this.smartGrid = this.parent?.addGrid(this.smartGrid, {
13055
13160
  rowUiActionType: GridUiActionType.POPUP_MENU,
@@ -13059,13 +13164,22 @@ class SmartComponentLayoutComponent {
13059
13164
  setToolbarComponent(comp) {
13060
13165
  this.toolbar = comp;
13061
13166
  }
13062
- constructFilter() {
13063
- this.smartFilter = this.smartComponentLayout.parentComponent.addFilter(`filter_${this.makeid(5)}`, this.smartComponentLayout?.widget?.filterExpressionFieldList, this.smartComponentLayout?.widget?.filterType, this.smartFilterComponent);
13064
- }
13167
+ // NOT USED, DOESN'T WORK
13168
+ // constructFilter(): void {
13169
+ // this.smartFilter = (this.smartComponentLayout!.parentComponent as any).addFilter(
13170
+ // `filter_${this.makeid(5)}`,
13171
+ // this.smartComponentLayout?.widget?.filterExpressionFieldList,
13172
+ // this.smartComponentLayout?.widget?.filterType,
13173
+ // this.smartFilterComponent
13174
+ // );
13175
+ // }
13065
13176
  bindFilter() {
13066
13177
  // TODO
13067
13178
  }
13068
13179
  constructTree() {
13180
+ if (this.parent?.useQueryLists) {
13181
+ return;
13182
+ }
13069
13183
  this.parent.setUpDefaultTree(this.smartComponentLayout?.widget?.identifier);
13070
13184
  this.treeService?.initialize();
13071
13185
  }
@@ -14435,84 +14549,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
14435
14549
  * Public API Surface of smarttree
14436
14550
  */
14437
14551
 
14438
- class SmartComponentLayoutUtility {
14439
- static setParent(layout, parent) {
14440
- layout.parentComponent = parent;
14441
- layout.components?.forEach((l) => this.setParent(l, parent));
14442
- }
14443
- static getForms(comp) {
14444
- let result = [];
14445
- if (comp.components) {
14446
- const children = comp.components
14447
- .map((c) => this.getForms(c))
14448
- .reduce((acc, value) => acc.concat(value), []);
14449
- result.push(...children);
14450
- }
14451
- const expandable = this.getExpandableComponent(comp);
14452
- if (expandable) {
14453
- result.push(...this.getForms(expandable));
14454
- }
14455
- if (comp.smartFormComponent) {
14456
- result.push(comp.smartFormComponent);
14457
- }
14458
- return result;
14459
- }
14460
- static getGrids(comp) {
14461
- let result = [];
14462
- if (comp.components) {
14463
- const children = comp.components
14464
- .map((c) => this.getGrids(c))
14465
- .reduce((acc, value) => acc.concat(value), []);
14466
- result.push(...children);
14467
- }
14468
- const expandable = this.getExpandableComponent(comp);
14469
- if (expandable) {
14470
- result.push(...this.getGrids(expandable));
14471
- }
14472
- if (comp.smartGridComponent) {
14473
- result.push(comp.smartGridComponent);
14474
- }
14475
- return result;
14476
- }
14477
- static getTrees(comp) {
14478
- let result = [];
14479
- if (comp.components) {
14480
- const children = comp.components
14481
- ?.map((c) => this.getTrees(c))
14482
- .reduce((acc, value) => acc.concat(value), []);
14483
- result.push(...children);
14484
- }
14485
- const expandable = this.getExpandableComponent(comp);
14486
- if (expandable) {
14487
- result.push(...this.getTrees(expandable));
14488
- }
14489
- if (comp.treeService) {
14490
- result.push(comp.treeService);
14491
- }
14492
- return result;
14493
- }
14494
- static getToolbars(comp) {
14495
- let result = [];
14496
- if (comp.components) {
14497
- const children = comp.components
14498
- .map((c) => this.getToolbars(c))
14499
- .reduce((acc, value) => acc.concat(value), []);
14500
- result.push(...children);
14501
- }
14502
- const expandable = this.getExpandableComponent(comp);
14503
- if (expandable) {
14504
- result.push(...this.getToolbars(expandable));
14505
- }
14506
- if (comp.toolbar) {
14507
- result.push(comp.toolbar);
14508
- }
14509
- return result;
14510
- }
14511
- static getExpandableComponent(comp) {
14512
- return comp.expandableComponents?.first?.componentRef?.instance;
14513
- }
14514
- }
14515
-
14516
14552
  /*
14517
14553
  * Public API Surface of smart-component-layout
14518
14554
  */