@acorex/platform 20.4.2 → 20.5.0-next.1

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.
Files changed (29) hide show
  1. package/common/index.d.ts +9 -1
  2. package/core/index.d.ts +405 -193
  3. package/fesm2022/acorex-platform-common.mjs +34 -11
  4. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  5. package/fesm2022/acorex-platform-core.mjs +638 -244
  6. package/fesm2022/acorex-platform-core.mjs.map +1 -1
  7. package/fesm2022/acorex-platform-layout-builder.mjs +417 -112
  8. package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
  9. package/fesm2022/acorex-platform-layout-components.mjs +614 -31
  10. package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
  11. package/fesm2022/acorex-platform-layout-entity.mjs +143 -511
  12. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  13. package/fesm2022/acorex-platform-layout-widget-core.mjs +70 -47
  14. package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
  15. package/fesm2022/acorex-platform-layout-widgets.mjs +2750 -1480
  16. package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
  17. package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-rdKxuMC_.mjs → acorex-platform-themes-default-entity-master-list-view.component-ccqB5ShI.mjs} +7 -1
  18. package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-rdKxuMC_.mjs.map → acorex-platform-themes-default-entity-master-list-view.component-ccqB5ShI.mjs.map} +1 -1
  19. package/fesm2022/acorex-platform-themes-default.mjs +8 -3
  20. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  21. package/fesm2022/acorex-platform-themes-shared.mjs +676 -271
  22. package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
  23. package/layout/builder/index.d.ts +127 -28
  24. package/layout/components/index.d.ts +245 -3
  25. package/layout/entity/index.d.ts +1 -59
  26. package/layout/widget-core/index.d.ts +20 -1
  27. package/layout/widgets/index.d.ts +396 -6
  28. package/package.json +6 -5
  29. package/themes/default/index.d.ts +1 -0
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { computed, signal, Injectable, InjectionToken, inject, ElementRef, effect, Injector, ChangeDetectorRef, ViewChild, Input, ChangeDetectionStrategy, Component, EventEmitter, Output, input, output, ViewContainerRef, Directive, Optional, Inject, NgModule, createComponent } from '@angular/core';
2
+ import { computed, signal, Injectable, InjectionToken, inject, ElementRef, effect, untracked, Injector, ChangeDetectorRef, ViewChild, Input, ChangeDetectionStrategy, Component, EventEmitter, Output, input, output, ViewContainerRef, Directive, Optional, Inject, NgModule, createComponent } from '@angular/core';
3
3
  import { convertArrayToDataSource, AXDataSource } from '@acorex/cdk/common';
4
4
  import { setSmart, AXPDataSourceDefinitionProviderService, extractValue, getSmart, AXPExpressionEvaluatorService } from '@acorex/platform/core';
5
5
  import { cloneDeep, isEqual, get, set, merge, isNil, isUndefined, isObjectLike, sum, isEmpty, isString } from 'lodash-es';
@@ -160,6 +160,9 @@ class AXPWidgetCoreElement {
160
160
  api() {
161
161
  return {};
162
162
  }
163
+ actions() {
164
+ return [];
165
+ }
163
166
  }
164
167
  class AXPWidgetCoreService {
165
168
  constructor() {
@@ -173,6 +176,7 @@ class AXPWidgetCoreService {
173
176
  this.isBusy = computed(() => {
174
177
  return [AXPPageStatus.Processing, AXPPageStatus.Submitting, AXPPageStatus.Rendering].includes(this.status());
175
178
  }, ...(ngDevMode ? [{ debugName: "isBusy" }] : []));
179
+ this.registeredWidgetsCount = signal(0, ...(ngDevMode ? [{ debugName: "registeredWidgetsCount" }] : []));
176
180
  }
177
181
  get variables() {
178
182
  return this.variables$();
@@ -182,6 +186,7 @@ class AXPWidgetCoreService {
182
186
  }
183
187
  updateStatus() {
184
188
  this.status$.update(() => this.detectStatus());
189
+ this.registeredWidgetsCount.set(this.widgets.size);
185
190
  }
186
191
  detectStatus() {
187
192
  const statuses = Array.from(this.widgets.values()).map((c) => c.status());
@@ -269,6 +274,12 @@ class AXPWidgetCoreService {
269
274
  }
270
275
  });
271
276
  }
277
+ /**
278
+ * Returns a list of registered widget ids (names).
279
+ */
280
+ listRegisteredWidgetNames() {
281
+ return Array.from(this.widgets.keys());
282
+ }
272
283
  ngOnDestroy() { }
273
284
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPWidgetCoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
274
285
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPWidgetCoreService }); }
@@ -377,6 +388,7 @@ const AXPWidgetsCatalog = {
377
388
  entityList: 'entity-list',
378
389
  documentUploader: 'document-uploader',
379
390
  signatureList: 'signature-list',
391
+ stepWizard: 'step-wizard',
380
392
  };
381
393
 
382
394
  function cloneProperty(property, values) {
@@ -536,6 +548,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImpor
536
548
  type: Injectable
537
549
  }] });
538
550
  class AXPLayoutBaseWidgetComponent extends AXPBaseWidgetComponent {
551
+ //TODO change this approach
552
+ ngOnInit() {
553
+ if (this.name && !(this instanceof AXPValueWidgetComponent)) {
554
+ this.layoutService.registerWidget(this.name, this);
555
+ }
556
+ super.ngOnInit();
557
+ }
539
558
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPLayoutBaseWidgetComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
540
559
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: AXPLayoutBaseWidgetComponent }); }
541
560
  }
@@ -666,60 +685,64 @@ class AXPDataListWidgetComponent extends AXPValueWidgetComponent {
666
685
  this.rf = effect(async () => {
667
686
  const rawValue = this.options()['dataSource'];
668
687
  // static datasource class
669
- if (rawValue instanceof AXDataSource) {
670
- this.dataSource.set(rawValue);
671
- }
672
- // static array datasource
673
- else if (Array.isArray(rawValue)) {
674
- const ds = new AXDataSource({
675
- key: this.valueField(),
676
- pageSize: 10,
677
- load: async (e) => {
678
- const raw = this.options()['dataSource'];
679
- const skip = e.skip ?? 0;
680
- const take = e.take ?? raw.length;
681
- return {
682
- items: raw.slice(skip, skip + take),
683
- total: raw.length,
684
- };
685
- },
686
- byKey: (key) => {
687
- const raw = this.options()['dataSource'];
688
- const item = raw.filter((c) => c[this.valueField()] == key);
689
- return Promise.resolve(item[0]);
690
- },
691
- });
692
- this.dataSource.set(ds);
693
- }
694
- // resolve data source by name
695
- else if (rawValue && (typeof rawValue == 'string' || typeof rawValue == 'object')) {
696
- const id = typeof rawValue == 'object' ? rawValue['id'] : rawValue;
697
- const c = await this.dataService.get(id);
698
- if (this.mode == 'designer' && c?.samples?.length) {
699
- this.dataSource.set(convertArrayToDataSource(c.samples, {
700
- key: this.valueField(),
701
- pageSize: 500,
702
- }));
703
- }
704
- else {
705
- const ds = c?.source();
706
- if (ds && ds instanceof Promise) {
707
- const d = await ds;
708
- this.dataSource.set(d);
688
+ untracked(async () => {
689
+ if (!isEqual(this.options()['dataSource'].config, this.dataSource().config)) {
690
+ if (rawValue instanceof AXDataSource) {
691
+ this.dataSource.set(rawValue);
709
692
  }
710
- else if (ds) {
693
+ // static array datasource
694
+ else if (Array.isArray(rawValue)) {
695
+ const ds = new AXDataSource({
696
+ key: this.valueField(),
697
+ pageSize: 10,
698
+ load: async (e) => {
699
+ const raw = this.options()['dataSource'];
700
+ const skip = e.skip ?? 0;
701
+ const take = e.take ?? raw.length;
702
+ return {
703
+ items: raw.slice(skip, skip + take),
704
+ total: raw.length,
705
+ };
706
+ },
707
+ byKey: (key) => {
708
+ const raw = this.options()['dataSource'];
709
+ const item = raw.filter((c) => c[this.valueField()] == key);
710
+ return Promise.resolve(item[0]);
711
+ },
712
+ });
711
713
  this.dataSource.set(ds);
712
714
  }
715
+ // resolve data source by name
716
+ else if (rawValue && (typeof rawValue == 'string' || typeof rawValue == 'object')) {
717
+ const id = typeof rawValue == 'object' ? rawValue['id'] : rawValue;
718
+ const c = await this.dataService.get(id);
719
+ if (this.mode == 'designer' && c?.samples?.length) {
720
+ this.dataSource.set(convertArrayToDataSource(c.samples, {
721
+ key: this.valueField(),
722
+ pageSize: 500,
723
+ }));
724
+ }
725
+ else {
726
+ const ds = c?.source();
727
+ if (ds && ds instanceof Promise) {
728
+ const d = await ds;
729
+ this.dataSource.set(d);
730
+ }
731
+ else if (ds) {
732
+ this.dataSource.set(ds);
733
+ }
734
+ // empty datasource
735
+ else {
736
+ this.dataSource.set(convertArrayToDataSource([]));
737
+ }
738
+ }
739
+ }
713
740
  // empty datasource
714
741
  else {
715
742
  this.dataSource.set(convertArrayToDataSource([]));
716
743
  }
717
744
  }
718
- }
719
- // empty datasource
720
- else {
721
- this.dataSource.set(convertArrayToDataSource([]));
722
- }
745
+ });
723
746
  }, ...(ngDevMode ? [{ debugName: "rf" }] : []));
724
747
  this.effect2 = effect(async () => {
725
748
  const value = this.getValue();