@smartbit4all/ng-client 3.1.79 → 3.1.81

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.
@@ -5121,6 +5121,7 @@ class SmartformComponent {
5121
5121
  }
5122
5122
  refresh() {
5123
5123
  this.service.setValuesFromModel();
5124
+ this.service.applyConstraints();
5124
5125
  }
5125
5126
  constructForm() {
5126
5127
  if (!this.smartForm) {
@@ -13515,6 +13516,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13515
13516
  // Contained Widgets
13516
13517
  this.widgets = new WidgetMap();
13517
13518
  this.formWidgets = new WidgetMap();
13519
+ this.useQueryLists = false;
13518
13520
  this.detectChange.subscribe((change) => {
13519
13521
  this.handleChanges(change);
13520
13522
  });
@@ -13536,7 +13538,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13536
13538
  }
13537
13539
  this._uuid = uuid;
13538
13540
  if (uuid) {
13539
- this.widgets.widgets.forEach((ref, key) => {
13541
+ this.getWidgets().widgets.forEach((ref, key) => {
13540
13542
  if (ref instanceof SmartGridComponent) {
13541
13543
  ref.uuid = uuid;
13542
13544
  }
@@ -13588,16 +13590,45 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13588
13590
  this._destroy$.next();
13589
13591
  this._destroy$.complete();
13590
13592
  }
13593
+ getWidgets() {
13594
+ if (this.useQueryLists) {
13595
+ let widgets = new WidgetMap();
13596
+ if (this.getAllGridComponents()) {
13597
+ this.getAllGridComponents()
13598
+ .filter((grid) => { var _a; return (((_a = grid === null || grid === void 0 ? void 0 : grid.smartGrid) === null || _a === void 0 ? void 0 : _a.gridIdentifier) ? true : false); })
13599
+ .forEach((grid) => widgets.addWidget(grid.smartGrid.gridIdentifier, grid));
13600
+ }
13601
+ if (this.getAllTreeComponents()) {
13602
+ this.getAllTreeComponents()
13603
+ .filter((tree) => { var _a; return (((_a = tree === null || tree === void 0 ? void 0 : tree.smartTreeModel) === null || _a === void 0 ? void 0 : _a.identifier) ? true : false); })
13604
+ .forEach((tree) => widgets.addWidget(tree.smartTreeModel.identifier, tree));
13605
+ }
13606
+ return widgets;
13607
+ }
13608
+ return this.widgets;
13609
+ }
13591
13610
  initComponentByModel() {
13592
13611
  this.initData();
13593
13612
  this.initActions();
13594
13613
  // TODO: layout, valueSet, widgets
13595
13614
  }
13596
13615
  initData() {
13597
- var _a, _b;
13616
+ var _a, _b, _c;
13598
13617
  if ((_a = this.model) === null || _a === void 0 ? void 0 : _a.data) {
13599
13618
  this.data = (_b = this.model) === null || _b === void 0 ? void 0 : _b.data;
13600
13619
  }
13620
+ if (this.useQueryLists) {
13621
+ (_c = this.getAllFormComponents()) === null || _c === void 0 ? void 0 : _c.forEach((form) => {
13622
+ if (form.getForm()) {
13623
+ // FormGroup already created -> refresh
13624
+ form.refresh();
13625
+ }
13626
+ else if (form.smartForm) {
13627
+ // FormGroup not created yet -> construct
13628
+ form.constructForm();
13629
+ }
13630
+ });
13631
+ }
13601
13632
  }
13602
13633
  initActions() {
13603
13634
  var _a, _b;
@@ -13637,20 +13668,26 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13637
13668
  });
13638
13669
  }
13639
13670
  getInvalidFields() {
13640
- var _a;
13671
+ var _a, _b, _c;
13641
13672
  let aggregatedInvalidFields = {
13642
13673
  invalidFieldKeys: [],
13643
13674
  invalidFieldNames: [],
13644
13675
  };
13645
- for (let entry of this.formWidgets.widgets) {
13646
- let invalidFieldsOfForm = (_a = entry[1]) === null || _a === void 0 ? void 0 : _a.getInvalidFields();
13647
- if (invalidFieldsOfForm) {
13648
- invalidFieldsOfForm.invalidFieldKeys.forEach((key) => aggregatedInvalidFields.invalidFieldKeys.push(key));
13649
- invalidFieldsOfForm.invalidFieldNames.forEach((key) => aggregatedInvalidFields.invalidFieldNames.push(key));
13650
- }
13676
+ if (this.useQueryLists) {
13677
+ (_a = this.getAllFormComponents()) === null || _a === void 0 ? void 0 : _a.forEach((form) => this.validateForm(form, aggregatedInvalidFields));
13678
+ }
13679
+ else {
13680
+ (_c = (_b = this.formWidgets) === null || _b === void 0 ? void 0 : _b.widgets) === null || _c === void 0 ? void 0 : _c.forEach((form) => this.validateForm(form, aggregatedInvalidFields));
13651
13681
  }
13652
13682
  return aggregatedInvalidFields;
13653
13683
  }
13684
+ validateForm(form, aggregatedInvalidFields) {
13685
+ let invalidFieldsOfForm = form === null || form === void 0 ? void 0 : form.getInvalidFields();
13686
+ if (invalidFieldsOfForm) {
13687
+ invalidFieldsOfForm.invalidFieldKeys.forEach((key) => aggregatedInvalidFields.invalidFieldKeys.push(key));
13688
+ invalidFieldsOfForm.invalidFieldNames.forEach((key) => aggregatedInvalidFields.invalidFieldNames.push(key));
13689
+ }
13690
+ }
13654
13691
  //#region UseUiAction
13655
13692
  getAdditionalParams(uiAction) {
13656
13693
  return {
@@ -13711,10 +13748,13 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13711
13748
  * Submits all the registered forms in the SmartComponent
13712
13749
  */
13713
13750
  submitForms(validate) {
13714
- var _a, _b;
13715
- (_b = (_a = this.formWidgets) === null || _a === void 0 ? void 0 : _a.widgets) === null || _b === void 0 ? void 0 : _b.forEach((form) => {
13716
- form === null || form === void 0 ? void 0 : form.submitForm(validate);
13717
- });
13751
+ var _a, _b, _c;
13752
+ if (this.useQueryLists) {
13753
+ (_a = this.getAllFormComponents()) === null || _a === void 0 ? void 0 : _a.forEach((form) => form === null || form === void 0 ? void 0 : form.submitForm(validate));
13754
+ }
13755
+ else {
13756
+ (_c = (_b = this.formWidgets) === null || _b === void 0 ? void 0 : _b.widgets) === null || _c === void 0 ? void 0 : _c.forEach((form) => form === null || form === void 0 ? void 0 : form.submitForm(validate));
13757
+ }
13718
13758
  }
13719
13759
  addGrid(smartGrid, options, useAsDefaultGrid, componentReference) {
13720
13760
  smartGrid.options = options;
@@ -13722,7 +13762,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13722
13762
  smartGrid.uiActionDescriptorService = this.uiActionDescriptorService;
13723
13763
  smartGrid.serviceToUse = this;
13724
13764
  smartGrid.viewContextService = this.viewContext;
13725
- this.widgets.addWidget(smartGrid.gridIdentifier, componentReference);
13765
+ if (!this.useQueryLists) {
13766
+ this.widgets.addWidget(smartGrid.gridIdentifier, componentReference);
13767
+ }
13726
13768
  if (useAsDefaultGrid) {
13727
13769
  this.smartGrid = smartGrid;
13728
13770
  return this.smartGrid;
@@ -13730,7 +13772,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13730
13772
  return smartGrid;
13731
13773
  }
13732
13774
  addForm(smartFormId, smartForm, componentReference) {
13733
- this.formWidgets.addWidget(smartFormId, componentReference);
13775
+ if (!this.useQueryLists) {
13776
+ this.formWidgets.addWidget(smartFormId, componentReference);
13777
+ }
13734
13778
  // if (this.sendDataChanges && componentReference) {
13735
13779
  // smartForm.useOnValueChangeEvent = true;
13736
13780
  // componentReference.sophisticatedValueChange
@@ -13742,12 +13786,13 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13742
13786
  return smartForm;
13743
13787
  }
13744
13788
  setUpDefaultTree(treeId) {
13745
- this.smartTreeService = new SmarttreeGenericService(this.inject, this.pageName, treeId);
13746
- this.widgets.addWidget(treeId, this.smartTreeService);
13789
+ this.smartTreeService = this.createTreeService(treeId);
13747
13790
  }
13748
13791
  createTreeService(treeId) {
13749
13792
  const treeService = new SmarttreeGenericService(this.inject, this.pageName, treeId);
13750
- this.widgets.addWidget(treeId, treeService);
13793
+ if (!this.useQueryLists) {
13794
+ this.widgets.addWidget(treeId, treeService);
13795
+ }
13751
13796
  return treeService;
13752
13797
  }
13753
13798
  addFileUploader(uiActionCode, fileFormats, maxSizeMb, isMultiple) {
@@ -13827,8 +13872,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13827
13872
  }
13828
13873
  }
13829
13874
  handleChangeWidgets(changedWidgets) {
13875
+ let widgets = this.getWidgets();
13830
13876
  changedWidgets.forEach((key) => {
13831
- const reference = this.widgets.get(key);
13877
+ const reference = widgets.get(key);
13832
13878
  if (reference instanceof SmartGridComponent) {
13833
13879
  reference.refresh();
13834
13880
  }
@@ -13863,15 +13909,21 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13863
13909
  }
13864
13910
  }
13865
13911
  handleDataChange(changes, changeKey) {
13912
+ var _a;
13866
13913
  this.setValueDeeply(this.model, changeKey, changes[changeKey]);
13867
- this.formWidgets.widgets.forEach((formComponent, key) => {
13868
- if (formComponent === undefined) {
13869
- console.error(`Provided form reference for ${key} is undefined.`);
13870
- }
13871
- else {
13872
- formComponent.refresh();
13873
- }
13874
- });
13914
+ if (this.useQueryLists) {
13915
+ (_a = this.getAllFormComponents()) === null || _a === void 0 ? void 0 : _a.forEach((form) => form.refresh());
13916
+ }
13917
+ else {
13918
+ this.formWidgets.widgets.forEach((formComponent, key) => {
13919
+ if (formComponent === undefined) {
13920
+ console.error(`Provided form reference for ${key} is undefined.`);
13921
+ }
13922
+ else {
13923
+ formComponent.refresh();
13924
+ }
13925
+ });
13926
+ }
13875
13927
  }
13876
13928
  handleLayoutChange(changes, changeKey) {
13877
13929
  let layoutKey = changeKey.split('.')[1];
@@ -13931,9 +13983,18 @@ class SmartComponent extends SmartComponentApiClient {
13931
13983
  ngOnDestroy() {
13932
13984
  this._ngOnDestroy();
13933
13985
  }
13986
+ getAllFormComponents() {
13987
+ return this.formComponents;
13988
+ }
13989
+ getAllGridComponents() {
13990
+ return this.gridComponents;
13991
+ }
13992
+ getAllTreeComponents() {
13993
+ return this.treeComponents;
13994
+ }
13934
13995
  }
13935
13996
  SmartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartComponent, deps: [{ token: i0.Injector }, { token: SmartAuthService }, { token: 'pageName' }], target: i0.ɵɵFactoryTarget.Component });
13936
- SmartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SmartComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
13997
+ SmartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SmartComponent, selector: "ng-component", viewQueries: [{ propertyName: "formComponents", predicate: SmartformComponent, descendants: true }, { propertyName: "gridComponents", predicate: SmartGridComponent, descendants: true }, { propertyName: "treeComponents", predicate: SmarttreeGenericService, descendants: true }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
13937
13998
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartComponent, decorators: [{
13938
13999
  type: Component,
13939
14000
  args: [{
@@ -13947,7 +14008,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
13947
14008
  type: Inject,
13948
14009
  args: ['pageName']
13949
14010
  }] }];
13950
- } });
14011
+ }, propDecorators: { formComponents: [{
14012
+ type: ViewChildren,
14013
+ args: [SmartformComponent]
14014
+ }], gridComponents: [{
14015
+ type: ViewChildren,
14016
+ args: [SmartGridComponent]
14017
+ }], treeComponents: [{
14018
+ type: ViewChildren,
14019
+ args: [SmarttreeGenericService]
14020
+ }] } });
13951
14021
 
13952
14022
  class SmartService extends SmartComponentApiClient {
13953
14023
  constructor(inject, auth, pageName) {
@@ -13959,6 +14029,15 @@ class SmartService extends SmartComponentApiClient {
13959
14029
  ngOnDestroy() {
13960
14030
  this._ngOnDestroy();
13961
14031
  }
14032
+ getAllFormComponents() {
14033
+ return this.formComponents;
14034
+ }
14035
+ getAllGridComponents() {
14036
+ return this.gridComponents;
14037
+ }
14038
+ getAllTreeComponents() {
14039
+ return this.treeComponents;
14040
+ }
13962
14041
  }
13963
14042
  SmartService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartService, deps: [{ token: i0.Injector }, { token: SmartAuthService }, { token: 'pageName' }], target: i0.ɵɵFactoryTarget.Injectable });
13964
14043
  SmartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartService, providedIn: 'root' });
@@ -13975,7 +14054,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
13975
14054
  type: Inject,
13976
14055
  args: ['pageName']
13977
14056
  }] }];
13978
- } });
14057
+ }, propDecorators: { formComponents: [{
14058
+ type: ViewChildren,
14059
+ args: [SmartformComponent]
14060
+ }], gridComponents: [{
14061
+ type: ViewChildren,
14062
+ args: [SmartGridComponent]
14063
+ }], treeComponents: [{
14064
+ type: ViewChildren,
14065
+ args: [SmarttreeGenericService]
14066
+ }] } });
13979
14067
 
13980
14068
  class SmartComponentLayoutUtility {
13981
14069
  static setParent(layout, parent) {