@smartbit4all/ng-client 3.1.79 → 3.1.80

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.
@@ -13370,6 +13370,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13370
13370
  // Contained Widgets
13371
13371
  this.widgets = new WidgetMap();
13372
13372
  this.formWidgets = new WidgetMap();
13373
+ this.useQueryLists = false;
13373
13374
  this.detectChange.subscribe((change) => {
13374
13375
  this.handleChanges(change);
13375
13376
  });
@@ -13391,7 +13392,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13391
13392
  }
13392
13393
  this._uuid = uuid;
13393
13394
  if (uuid) {
13394
- this.widgets.widgets.forEach((ref, key) => {
13395
+ this.getWidgets().widgets.forEach((ref, key) => {
13395
13396
  if (ref instanceof SmartGridComponent) {
13396
13397
  ref.uuid = uuid;
13397
13398
  }
@@ -13443,6 +13444,23 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13443
13444
  this._destroy$.next();
13444
13445
  this._destroy$.complete();
13445
13446
  }
13447
+ getWidgets() {
13448
+ if (this.useQueryLists) {
13449
+ let widgets = new WidgetMap();
13450
+ if (this.getAllGridComponents()) {
13451
+ this.getAllGridComponents()
13452
+ .filter((grid) => (grid?.smartGrid?.gridIdentifier ? true : false))
13453
+ .forEach((grid) => widgets.addWidget(grid.smartGrid.gridIdentifier, grid));
13454
+ }
13455
+ if (this.getAllTreeComponents()) {
13456
+ this.getAllTreeComponents()
13457
+ .filter((tree) => (tree?.smartTreeModel?.identifier ? true : false))
13458
+ .forEach((tree) => widgets.addWidget(tree.smartTreeModel.identifier, tree));
13459
+ }
13460
+ return widgets;
13461
+ }
13462
+ return this.widgets;
13463
+ }
13446
13464
  initComponentByModel() {
13447
13465
  this.initData();
13448
13466
  this.initActions();
@@ -13490,15 +13508,21 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13490
13508
  invalidFieldKeys: [],
13491
13509
  invalidFieldNames: [],
13492
13510
  };
13493
- for (let entry of this.formWidgets.widgets) {
13494
- let invalidFieldsOfForm = entry[1]?.getInvalidFields();
13495
- if (invalidFieldsOfForm) {
13496
- invalidFieldsOfForm.invalidFieldKeys.forEach((key) => aggregatedInvalidFields.invalidFieldKeys.push(key));
13497
- invalidFieldsOfForm.invalidFieldNames.forEach((key) => aggregatedInvalidFields.invalidFieldNames.push(key));
13498
- }
13511
+ if (this.useQueryLists) {
13512
+ this.getAllFormComponents()?.forEach((form) => this.validateForm(form, aggregatedInvalidFields));
13513
+ }
13514
+ else {
13515
+ this.formWidgets?.widgets?.forEach((form) => this.validateForm(form, aggregatedInvalidFields));
13499
13516
  }
13500
13517
  return aggregatedInvalidFields;
13501
13518
  }
13519
+ validateForm(form, aggregatedInvalidFields) {
13520
+ let invalidFieldsOfForm = form?.getInvalidFields();
13521
+ if (invalidFieldsOfForm) {
13522
+ invalidFieldsOfForm.invalidFieldKeys.forEach((key) => aggregatedInvalidFields.invalidFieldKeys.push(key));
13523
+ invalidFieldsOfForm.invalidFieldNames.forEach((key) => aggregatedInvalidFields.invalidFieldNames.push(key));
13524
+ }
13525
+ }
13502
13526
  //#region UseUiAction
13503
13527
  getAdditionalParams(uiAction) {
13504
13528
  return {
@@ -13557,9 +13581,12 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13557
13581
  * Submits all the registered forms in the SmartComponent
13558
13582
  */
13559
13583
  submitForms(validate) {
13560
- this.formWidgets?.widgets?.forEach((form) => {
13561
- form?.submitForm(validate);
13562
- });
13584
+ if (this.useQueryLists) {
13585
+ this.getAllFormComponents()?.forEach((form) => form?.submitForm(validate));
13586
+ }
13587
+ else {
13588
+ this.formWidgets?.widgets?.forEach((form) => form?.submitForm(validate));
13589
+ }
13563
13590
  }
13564
13591
  addGrid(smartGrid, options, useAsDefaultGrid, componentReference) {
13565
13592
  smartGrid.options = options;
@@ -13567,7 +13594,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13567
13594
  smartGrid.uiActionDescriptorService = this.uiActionDescriptorService;
13568
13595
  smartGrid.serviceToUse = this;
13569
13596
  smartGrid.viewContextService = this.viewContext;
13570
- this.widgets.addWidget(smartGrid.gridIdentifier, componentReference);
13597
+ if (!this.useQueryLists) {
13598
+ this.widgets.addWidget(smartGrid.gridIdentifier, componentReference);
13599
+ }
13571
13600
  if (useAsDefaultGrid) {
13572
13601
  this.smartGrid = smartGrid;
13573
13602
  return this.smartGrid;
@@ -13575,7 +13604,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13575
13604
  return smartGrid;
13576
13605
  }
13577
13606
  addForm(smartFormId, smartForm, componentReference) {
13578
- this.formWidgets.addWidget(smartFormId, componentReference);
13607
+ if (!this.useQueryLists) {
13608
+ this.formWidgets.addWidget(smartFormId, componentReference);
13609
+ }
13579
13610
  // if (this.sendDataChanges && componentReference) {
13580
13611
  // smartForm.useOnValueChangeEvent = true;
13581
13612
  // componentReference.sophisticatedValueChange
@@ -13587,12 +13618,13 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13587
13618
  return smartForm;
13588
13619
  }
13589
13620
  setUpDefaultTree(treeId) {
13590
- this.smartTreeService = new SmarttreeGenericService(this.inject, this.pageName, treeId);
13591
- this.widgets.addWidget(treeId, this.smartTreeService);
13621
+ this.smartTreeService = this.createTreeService(treeId);
13592
13622
  }
13593
13623
  createTreeService(treeId) {
13594
13624
  const treeService = new SmarttreeGenericService(this.inject, this.pageName, treeId);
13595
- this.widgets.addWidget(treeId, treeService);
13625
+ if (!this.useQueryLists) {
13626
+ this.widgets.addWidget(treeId, treeService);
13627
+ }
13596
13628
  return treeService;
13597
13629
  }
13598
13630
  addFileUploader(uiActionCode, fileFormats, maxSizeMb, isMultiple) {
@@ -13671,8 +13703,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13671
13703
  }
13672
13704
  }
13673
13705
  handleChangeWidgets(changedWidgets) {
13706
+ let widgets = this.getWidgets();
13674
13707
  changedWidgets.forEach((key) => {
13675
- const reference = this.widgets.get(key);
13708
+ const reference = widgets.get(key);
13676
13709
  if (reference instanceof SmartGridComponent) {
13677
13710
  reference.refresh();
13678
13711
  }
@@ -13708,14 +13741,19 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13708
13741
  }
13709
13742
  handleDataChange(changes, changeKey) {
13710
13743
  this.setValueDeeply(this.model, changeKey, changes[changeKey]);
13711
- this.formWidgets.widgets.forEach((formComponent, key) => {
13712
- if (formComponent === undefined) {
13713
- console.error(`Provided form reference for ${key} is undefined.`);
13714
- }
13715
- else {
13716
- formComponent.refresh();
13717
- }
13718
- });
13744
+ if (this.useQueryLists) {
13745
+ this.getAllFormComponents()?.forEach((form) => form.refresh());
13746
+ }
13747
+ else {
13748
+ this.formWidgets.widgets.forEach((formComponent, key) => {
13749
+ if (formComponent === undefined) {
13750
+ console.error(`Provided form reference for ${key} is undefined.`);
13751
+ }
13752
+ else {
13753
+ formComponent.refresh();
13754
+ }
13755
+ });
13756
+ }
13719
13757
  }
13720
13758
  handleLayoutChange(changes, changeKey) {
13721
13759
  let layoutKey = changeKey.split('.')[1];
@@ -13775,9 +13813,18 @@ class SmartComponent extends SmartComponentApiClient {
13775
13813
  ngOnDestroy() {
13776
13814
  this._ngOnDestroy();
13777
13815
  }
13816
+ getAllFormComponents() {
13817
+ return this.formComponents;
13818
+ }
13819
+ getAllGridComponents() {
13820
+ return this.gridComponents;
13821
+ }
13822
+ getAllTreeComponents() {
13823
+ return this.treeComponents;
13824
+ }
13778
13825
  }
13779
13826
  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 });
13780
- SmartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: SmartComponent, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
13827
+ 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 });
13781
13828
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartComponent, decorators: [{
13782
13829
  type: Component,
13783
13830
  args: [{
@@ -13789,7 +13836,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
13789
13836
  }] }, { type: undefined, decorators: [{
13790
13837
  type: Inject,
13791
13838
  args: ['pageName']
13792
- }] }]; } });
13839
+ }] }]; }, propDecorators: { formComponents: [{
13840
+ type: ViewChildren,
13841
+ args: [SmartformComponent]
13842
+ }], gridComponents: [{
13843
+ type: ViewChildren,
13844
+ args: [SmartGridComponent]
13845
+ }], treeComponents: [{
13846
+ type: ViewChildren,
13847
+ args: [SmarttreeGenericService]
13848
+ }] } });
13793
13849
 
13794
13850
  class SmartService extends SmartComponentApiClient {
13795
13851
  constructor(inject, auth, pageName) {
@@ -13801,6 +13857,15 @@ class SmartService extends SmartComponentApiClient {
13801
13857
  ngOnDestroy() {
13802
13858
  this._ngOnDestroy();
13803
13859
  }
13860
+ getAllFormComponents() {
13861
+ return this.formComponents;
13862
+ }
13863
+ getAllGridComponents() {
13864
+ return this.gridComponents;
13865
+ }
13866
+ getAllTreeComponents() {
13867
+ return this.treeComponents;
13868
+ }
13804
13869
  }
13805
13870
  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 });
13806
13871
  SmartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartService, providedIn: 'root' });
@@ -13815,7 +13880,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
13815
13880
  }] }, { type: undefined, decorators: [{
13816
13881
  type: Inject,
13817
13882
  args: ['pageName']
13818
- }] }]; } });
13883
+ }] }]; }, propDecorators: { formComponents: [{
13884
+ type: ViewChildren,
13885
+ args: [SmartformComponent]
13886
+ }], gridComponents: [{
13887
+ type: ViewChildren,
13888
+ args: [SmartGridComponent]
13889
+ }], treeComponents: [{
13890
+ type: ViewChildren,
13891
+ args: [SmarttreeGenericService]
13892
+ }] } });
13819
13893
 
13820
13894
  class SmartComponentLayoutUtility {
13821
13895
  static setParent(layout, parent) {