@acorex/platform 20.8.4 → 20.8.6

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 (20) hide show
  1. package/common/index.d.ts +17 -2
  2. package/fesm2022/{acorex-platform-common-common-settings.provider-41RhWqb4.mjs → acorex-platform-common-common-settings.provider-DqdSjjp6.mjs} +15 -1
  3. package/fesm2022/acorex-platform-common-common-settings.provider-DqdSjjp6.mjs.map +1 -0
  4. package/fesm2022/acorex-platform-common.mjs +3 -2
  5. package/fesm2022/acorex-platform-common.mjs.map +1 -1
  6. package/fesm2022/acorex-platform-layout-entity.mjs +100 -2
  7. package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
  8. package/fesm2022/acorex-platform-layout-widget-core.mjs +70 -4
  9. package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
  10. package/fesm2022/acorex-platform-layout-widgets.mjs +50 -7
  11. package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
  12. package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-CLDoygoI.mjs → acorex-platform-themes-default-entity-master-list-view.component-DZeByyDy.mjs} +3 -3
  13. package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-CLDoygoI.mjs.map → acorex-platform-themes-default-entity-master-list-view.component-DZeByyDy.mjs.map} +1 -1
  14. package/fesm2022/acorex-platform-themes-default.mjs +5 -4
  15. package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
  16. package/layout/entity/index.d.ts +27 -0
  17. package/layout/widget-core/index.d.ts +15 -0
  18. package/layout/widgets/index.d.ts +5 -2
  19. package/package.json +5 -5
  20. package/fesm2022/acorex-platform-common-common-settings.provider-41RhWqb4.mjs.map +0 -1
@@ -111,6 +111,28 @@ const AXP_ENTITY_ACTION_PLUGIN = new InjectionToken('AXP_ENTITY_ACTION_PLUGIN');
111
111
  function createModifierContext(entity) {
112
112
  const ctx = {
113
113
  entity,
114
+ plugins: {
115
+ list: () => entity.plugins ?? [],
116
+ add: (...items) => {
117
+ entity.plugins ??= [];
118
+ entity.plugins.push(...items);
119
+ return ctx;
120
+ },
121
+ remove: (predicate) => {
122
+ if (entity.plugins)
123
+ entity.plugins = entity.plugins.filter((p) => !predicate(p));
124
+ return ctx;
125
+ },
126
+ find: (name) => ({
127
+ get: () => entity.plugins?.find((p) => p.name === name),
128
+ update: (updater) => {
129
+ const index = entity.plugins?.findIndex((p) => p.name === name);
130
+ if (index !== undefined && index !== -1 && entity.plugins)
131
+ entity.plugins[index] = updater(entity.plugins[index]);
132
+ return ctx;
133
+ },
134
+ }),
135
+ },
114
136
  title: {
115
137
  get: () => entity.title,
116
138
  set: (newTitle) => {
@@ -2980,6 +3002,11 @@ class AXPEntityDetailListViewModel {
2980
3002
  this.filterOperatorMiddleware = this.injector.get(AXPFilterOperatorMiddlewareService);
2981
3003
  this.expressionEvaluator = this.injector.get(AXPExpressionEvaluatorService);
2982
3004
  this.queryExecutor = this.injector.get(AXPQueryExecutor);
3005
+ this.settingsService = this.injector.get(AXPSettingsService);
3006
+ this.destroyed = new Subject();
3007
+ this.showRowIndexColumnEnabled = signal(false, ...(ngDevMode ? [{ debugName: "showRowIndexColumnEnabled" }] : []));
3008
+ /** Whether the row index column is shown (user setting). */
3009
+ this.showIndexColumn = computed(() => this.showRowIndexColumnEnabled(), ...(ngDevMode ? [{ debugName: "showIndexColumn" }] : []));
2983
3010
  this.dataSource = new AXDataSource({
2984
3011
  byKey: async (key) => {
2985
3012
  const execute = this.detailEntity()?.queries?.byKey?.execute;
@@ -3119,8 +3146,28 @@ class AXPEntityDetailListViewModel {
3119
3146
  };
3120
3147
  return await this.expressionEvaluator.evaluate(actionData, scope);
3121
3148
  };
3149
+ void this.syncShowRowIndexColumnSetting();
3150
+ this.settingsService.onLoaded.pipe(takeUntil(this.destroyed)).subscribe(() => {
3151
+ void this.syncShowRowIndexColumnSetting();
3152
+ });
3153
+ this.settingsService.onChanged.pipe(takeUntil(this.destroyed)).subscribe(() => {
3154
+ void this.syncShowRowIndexColumnSetting();
3155
+ });
3122
3156
  this.initialize();
3123
3157
  }
3158
+ async syncShowRowIndexColumnSetting() {
3159
+ try {
3160
+ const value = await this.settingsService.get(AXPCommonSettings.ShowRowIndexColumn);
3161
+ this.showRowIndexColumnEnabled.set(value ?? false);
3162
+ }
3163
+ catch {
3164
+ this.showRowIndexColumnEnabled.set(false);
3165
+ }
3166
+ }
3167
+ destroy() {
3168
+ this.destroyed.next();
3169
+ this.destroyed.complete();
3170
+ }
3124
3171
  async initialize() {
3125
3172
  const entityResolver = this.injector.get(AXPEntityDefinitionRegistryService);
3126
3173
  const [moduleName, entityName] = this.detailEntityConfig.entity.split('.');
@@ -3599,6 +3646,18 @@ class AXPEntityMasterListViewModel {
3599
3646
  });
3600
3647
  }, ...(ngDevMode ? [{ debugName: "views" }] : []));
3601
3648
  this.view = signal(this.views()[0], ...(ngDevMode ? [{ debugName: "view" }] : []));
3649
+ this.showRowIndexColumnEnabled = signal(false, ...(ngDevMode ? [{ debugName: "showRowIndexColumnEnabled" }] : []));
3650
+ /**
3651
+ * Row index column: if the list view defines `indexCol` (true/false), that overrides the user setting;
3652
+ * if `indexCol` is omitted, visibility follows {@link AXPCommonSettings.ShowRowIndexColumn}.
3653
+ */
3654
+ this.showIndexColumn = computed(() => {
3655
+ const indexCol = this.view().indexCol;
3656
+ if (indexCol !== undefined) {
3657
+ return indexCol;
3658
+ }
3659
+ return this.showRowIndexColumnEnabled();
3660
+ }, ...(ngDevMode ? [{ debugName: "showIndexColumn" }] : []));
3602
3661
  this.dataSource = new AXDataSource({
3603
3662
  byKey: async (key) => {
3604
3663
  const execute = this.entityDef.queries?.byKey?.execute;
@@ -3753,6 +3812,23 @@ class AXPEntityMasterListViewModel {
3753
3812
  }
3754
3813
  });
3755
3814
  this.sortedFields.set(this.sortableFields());
3815
+ void this.syncShowRowIndexColumnSetting();
3816
+ this.settings.onLoaded.pipe(takeUntil(this.destroyed)).subscribe(() => {
3817
+ void this.syncShowRowIndexColumnSetting();
3818
+ });
3819
+ this.settings.onChanged.pipe(takeUntil(this.destroyed)).subscribe(() => {
3820
+ void this.syncShowRowIndexColumnSetting();
3821
+ });
3822
+ }
3823
+ async syncShowRowIndexColumnSetting() {
3824
+ try {
3825
+ const value = await this.settings.get(AXPCommonSettings.ShowRowIndexColumn);
3826
+ this.showRowIndexColumnEnabled.set(value ?? false);
3827
+ }
3828
+ catch {
3829
+ console.log('catch');
3830
+ this.showRowIndexColumnEnabled.set(false);
3831
+ }
3756
3832
  }
3757
3833
  async applySettings() {
3758
3834
  this.saveSettings('view');
@@ -11447,6 +11523,7 @@ class AXPEntityListTableService {
11447
11523
  this.workflow = inject(AXPWorkflowService);
11448
11524
  this.commandService = inject(AXPCommandService);
11449
11525
  this.expressionEvaluator = inject(AXPExpressionEvaluatorService);
11526
+ this.settings = inject(AXPSettingsService);
11450
11527
  this.evaluateExpressions = async (options, data) => {
11451
11528
  if (!options) {
11452
11529
  return {};
@@ -11467,6 +11544,20 @@ class AXPEntityListTableService {
11467
11544
  * Convert Entity to List Widget Options
11468
11545
  */
11469
11546
  async convertEntityToListOptions(entity, options, allActions) {
11547
+ const viewIndexCol = entity.interfaces?.master?.list?.views?.[0]?.indexCol;
11548
+ let showIndex = false;
11549
+ if (viewIndexCol !== undefined) {
11550
+ showIndex = viewIndexCol;
11551
+ }
11552
+ else {
11553
+ try {
11554
+ const fromSetting = await this.settings.get(AXPCommonSettings.ShowRowIndexColumn);
11555
+ showIndex = fromSetting ?? false;
11556
+ }
11557
+ catch {
11558
+ showIndex = false;
11559
+ }
11560
+ }
11470
11561
  const listOptions = {
11471
11562
  // 📊 Data Source
11472
11563
  dataSource: this.createDataSource(entity),
@@ -11476,7 +11567,7 @@ class AXPEntityListTableService {
11476
11567
  primaryCommands: this.createRowCommands(allActions, 'primary'),
11477
11568
  secondaryCommands: this.createRowCommands(allActions, 'secondary'),
11478
11569
  // ⚙️ Table Features
11479
- showIndex: entity.interfaces?.master?.list?.views?.[0]?.indexCol ?? false,
11570
+ showIndex,
11480
11571
  allowSelection: this.hasSelectedScopeActions(entity),
11481
11572
  paging: true,
11482
11573
  showHeader: true,
@@ -11493,7 +11584,6 @@ class AXPEntityListTableService {
11493
11584
  // 🎪 Events
11494
11585
  ...this.createDefaultEvents(entity, allActions),
11495
11586
  };
11496
- console.log('listOptions', listOptions);
11497
11587
  return listOptions;
11498
11588
  }
11499
11589
  //#endregion
@@ -13741,6 +13831,14 @@ class AXPLookupWidgetEditComponent extends AXPValueWidgetComponent {
13741
13831
  this.contextService.patch(itemToExpose, true);
13742
13832
  });
13743
13833
  }
13834
+ outputs() {
13835
+ return [
13836
+ {
13837
+ name: 'selectedItems',
13838
+ value: this.selectedItems(),
13839
+ },
13840
+ ];
13841
+ }
13744
13842
  singleOrMultiple(values) {
13745
13843
  return this.multiple() ? values : values[0];
13746
13844
  }