@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.
@@ -5155,6 +5155,7 @@ class SmartformComponent {
5155
5155
  }
5156
5156
  refresh() {
5157
5157
  this.service.setValuesFromModel();
5158
+ this.service.applyConstraints();
5158
5159
  }
5159
5160
  constructForm() {
5160
5161
  if (!this.smartForm) {
@@ -13370,6 +13371,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13370
13371
  // Contained Widgets
13371
13372
  this.widgets = new WidgetMap();
13372
13373
  this.formWidgets = new WidgetMap();
13374
+ this.useQueryLists = false;
13373
13375
  this.detectChange.subscribe((change) => {
13374
13376
  this.handleChanges(change);
13375
13377
  });
@@ -13391,7 +13393,7 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13391
13393
  }
13392
13394
  this._uuid = uuid;
13393
13395
  if (uuid) {
13394
- this.widgets.widgets.forEach((ref, key) => {
13396
+ this.getWidgets().widgets.forEach((ref, key) => {
13395
13397
  if (ref instanceof SmartGridComponent) {
13396
13398
  ref.uuid = uuid;
13397
13399
  }
@@ -13443,6 +13445,23 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13443
13445
  this._destroy$.next();
13444
13446
  this._destroy$.complete();
13445
13447
  }
13448
+ getWidgets() {
13449
+ if (this.useQueryLists) {
13450
+ let widgets = new WidgetMap();
13451
+ if (this.getAllGridComponents()) {
13452
+ this.getAllGridComponents()
13453
+ .filter((grid) => (grid?.smartGrid?.gridIdentifier ? true : false))
13454
+ .forEach((grid) => widgets.addWidget(grid.smartGrid.gridIdentifier, grid));
13455
+ }
13456
+ if (this.getAllTreeComponents()) {
13457
+ this.getAllTreeComponents()
13458
+ .filter((tree) => (tree?.smartTreeModel?.identifier ? true : false))
13459
+ .forEach((tree) => widgets.addWidget(tree.smartTreeModel.identifier, tree));
13460
+ }
13461
+ return widgets;
13462
+ }
13463
+ return this.widgets;
13464
+ }
13446
13465
  initComponentByModel() {
13447
13466
  this.initData();
13448
13467
  this.initActions();
@@ -13452,6 +13471,18 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13452
13471
  if (this.model?.data) {
13453
13472
  this.data = this.model?.data;
13454
13473
  }
13474
+ if (this.useQueryLists) {
13475
+ this.getAllFormComponents()?.forEach((form) => {
13476
+ if (form.getForm()) {
13477
+ // FormGroup already created -> refresh
13478
+ form.refresh();
13479
+ }
13480
+ else if (form.smartForm) {
13481
+ // FormGroup not created yet -> construct
13482
+ form.constructForm();
13483
+ }
13484
+ });
13485
+ }
13455
13486
  }
13456
13487
  initActions() {
13457
13488
  if (this.model?.actions) {
@@ -13490,15 +13521,21 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13490
13521
  invalidFieldKeys: [],
13491
13522
  invalidFieldNames: [],
13492
13523
  };
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
- }
13524
+ if (this.useQueryLists) {
13525
+ this.getAllFormComponents()?.forEach((form) => this.validateForm(form, aggregatedInvalidFields));
13526
+ }
13527
+ else {
13528
+ this.formWidgets?.widgets?.forEach((form) => this.validateForm(form, aggregatedInvalidFields));
13499
13529
  }
13500
13530
  return aggregatedInvalidFields;
13501
13531
  }
13532
+ validateForm(form, aggregatedInvalidFields) {
13533
+ let invalidFieldsOfForm = form?.getInvalidFields();
13534
+ if (invalidFieldsOfForm) {
13535
+ invalidFieldsOfForm.invalidFieldKeys.forEach((key) => aggregatedInvalidFields.invalidFieldKeys.push(key));
13536
+ invalidFieldsOfForm.invalidFieldNames.forEach((key) => aggregatedInvalidFields.invalidFieldNames.push(key));
13537
+ }
13538
+ }
13502
13539
  //#region UseUiAction
13503
13540
  getAdditionalParams(uiAction) {
13504
13541
  return {
@@ -13557,9 +13594,12 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13557
13594
  * Submits all the registered forms in the SmartComponent
13558
13595
  */
13559
13596
  submitForms(validate) {
13560
- this.formWidgets?.widgets?.forEach((form) => {
13561
- form?.submitForm(validate);
13562
- });
13597
+ if (this.useQueryLists) {
13598
+ this.getAllFormComponents()?.forEach((form) => form?.submitForm(validate));
13599
+ }
13600
+ else {
13601
+ this.formWidgets?.widgets?.forEach((form) => form?.submitForm(validate));
13602
+ }
13563
13603
  }
13564
13604
  addGrid(smartGrid, options, useAsDefaultGrid, componentReference) {
13565
13605
  smartGrid.options = options;
@@ -13567,7 +13607,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13567
13607
  smartGrid.uiActionDescriptorService = this.uiActionDescriptorService;
13568
13608
  smartGrid.serviceToUse = this;
13569
13609
  smartGrid.viewContextService = this.viewContext;
13570
- this.widgets.addWidget(smartGrid.gridIdentifier, componentReference);
13610
+ if (!this.useQueryLists) {
13611
+ this.widgets.addWidget(smartGrid.gridIdentifier, componentReference);
13612
+ }
13571
13613
  if (useAsDefaultGrid) {
13572
13614
  this.smartGrid = smartGrid;
13573
13615
  return this.smartGrid;
@@ -13575,7 +13617,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13575
13617
  return smartGrid;
13576
13618
  }
13577
13619
  addForm(smartFormId, smartForm, componentReference) {
13578
- this.formWidgets.addWidget(smartFormId, componentReference);
13620
+ if (!this.useQueryLists) {
13621
+ this.formWidgets.addWidget(smartFormId, componentReference);
13622
+ }
13579
13623
  // if (this.sendDataChanges && componentReference) {
13580
13624
  // smartForm.useOnValueChangeEvent = true;
13581
13625
  // componentReference.sophisticatedValueChange
@@ -13587,12 +13631,13 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13587
13631
  return smartForm;
13588
13632
  }
13589
13633
  setUpDefaultTree(treeId) {
13590
- this.smartTreeService = new SmarttreeGenericService(this.inject, this.pageName, treeId);
13591
- this.widgets.addWidget(treeId, this.smartTreeService);
13634
+ this.smartTreeService = this.createTreeService(treeId);
13592
13635
  }
13593
13636
  createTreeService(treeId) {
13594
13637
  const treeService = new SmarttreeGenericService(this.inject, this.pageName, treeId);
13595
- this.widgets.addWidget(treeId, treeService);
13638
+ if (!this.useQueryLists) {
13639
+ this.widgets.addWidget(treeId, treeService);
13640
+ }
13596
13641
  return treeService;
13597
13642
  }
13598
13643
  addFileUploader(uiActionCode, fileFormats, maxSizeMb, isMultiple) {
@@ -13671,8 +13716,9 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13671
13716
  }
13672
13717
  }
13673
13718
  handleChangeWidgets(changedWidgets) {
13719
+ let widgets = this.getWidgets();
13674
13720
  changedWidgets.forEach((key) => {
13675
- const reference = this.widgets.get(key);
13721
+ const reference = widgets.get(key);
13676
13722
  if (reference instanceof SmartGridComponent) {
13677
13723
  reference.refresh();
13678
13724
  }
@@ -13708,14 +13754,19 @@ let SmartComponentApiClient = class SmartComponentApiClient {
13708
13754
  }
13709
13755
  handleDataChange(changes, changeKey) {
13710
13756
  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
- });
13757
+ if (this.useQueryLists) {
13758
+ this.getAllFormComponents()?.forEach((form) => form.refresh());
13759
+ }
13760
+ else {
13761
+ this.formWidgets.widgets.forEach((formComponent, key) => {
13762
+ if (formComponent === undefined) {
13763
+ console.error(`Provided form reference for ${key} is undefined.`);
13764
+ }
13765
+ else {
13766
+ formComponent.refresh();
13767
+ }
13768
+ });
13769
+ }
13719
13770
  }
13720
13771
  handleLayoutChange(changes, changeKey) {
13721
13772
  let layoutKey = changeKey.split('.')[1];
@@ -13775,9 +13826,18 @@ class SmartComponent extends SmartComponentApiClient {
13775
13826
  ngOnDestroy() {
13776
13827
  this._ngOnDestroy();
13777
13828
  }
13829
+ getAllFormComponents() {
13830
+ return this.formComponents;
13831
+ }
13832
+ getAllGridComponents() {
13833
+ return this.gridComponents;
13834
+ }
13835
+ getAllTreeComponents() {
13836
+ return this.treeComponents;
13837
+ }
13778
13838
  }
13779
13839
  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 });
13840
+ 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
13841
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartComponent, decorators: [{
13782
13842
  type: Component,
13783
13843
  args: [{
@@ -13789,7 +13849,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
13789
13849
  }] }, { type: undefined, decorators: [{
13790
13850
  type: Inject,
13791
13851
  args: ['pageName']
13792
- }] }]; } });
13852
+ }] }]; }, propDecorators: { formComponents: [{
13853
+ type: ViewChildren,
13854
+ args: [SmartformComponent]
13855
+ }], gridComponents: [{
13856
+ type: ViewChildren,
13857
+ args: [SmartGridComponent]
13858
+ }], treeComponents: [{
13859
+ type: ViewChildren,
13860
+ args: [SmarttreeGenericService]
13861
+ }] } });
13793
13862
 
13794
13863
  class SmartService extends SmartComponentApiClient {
13795
13864
  constructor(inject, auth, pageName) {
@@ -13801,6 +13870,15 @@ class SmartService extends SmartComponentApiClient {
13801
13870
  ngOnDestroy() {
13802
13871
  this._ngOnDestroy();
13803
13872
  }
13873
+ getAllFormComponents() {
13874
+ return this.formComponents;
13875
+ }
13876
+ getAllGridComponents() {
13877
+ return this.gridComponents;
13878
+ }
13879
+ getAllTreeComponents() {
13880
+ return this.treeComponents;
13881
+ }
13804
13882
  }
13805
13883
  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
13884
  SmartService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: SmartService, providedIn: 'root' });
@@ -13815,7 +13893,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImpor
13815
13893
  }] }, { type: undefined, decorators: [{
13816
13894
  type: Inject,
13817
13895
  args: ['pageName']
13818
- }] }]; } });
13896
+ }] }]; }, propDecorators: { formComponents: [{
13897
+ type: ViewChildren,
13898
+ args: [SmartformComponent]
13899
+ }], gridComponents: [{
13900
+ type: ViewChildren,
13901
+ args: [SmartGridComponent]
13902
+ }], treeComponents: [{
13903
+ type: ViewChildren,
13904
+ args: [SmarttreeGenericService]
13905
+ }] } });
13819
13906
 
13820
13907
  class SmartComponentLayoutUtility {
13821
13908
  static setParent(layout, parent) {