@acorex/platform 20.9.9 → 20.9.11

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.
@@ -5,7 +5,7 @@ import { AXToastService } from '@acorex/components/toast';
5
5
  import * as i3$1 from '@acorex/core/translation';
6
6
  import { AXTranslationService, resolveMultiLanguageString, AXTranslationModule, translateSync } from '@acorex/core/translation';
7
7
  import * as i4$2 from '@acorex/platform/common';
8
- import { AXPNotFoundError, axpNavigateAppPath, AXPSettingsService, AXPCommonSettings, resolveEntityCreateListBehavior, AXPRefreshEvent, resolveEntityModifyPopupTitle, resolveSearchableText, evaluateEntityDisplayTemplate, AXPFilterOperatorMiddlewareService, AXPReloadEvent, axpRedirectToNotFound, AXP_ENTITY_DELETED_WORKFLOW_EVENT_TYPE, AXPCleanNestedFilters, AXPFileTypeProviderService, AXPFileStorageService, resolveEntityRowDisplayTitle, AXPFileActionsService, axpIsEntityRecordNotFound, AXPDefaultMultiLanguageConfigService, withDefaultMultiLanguageOnWidgetNodeTree, AXPWorkflowNavigateAction, axpIsEntityListPath, axpIsEntityDetailsPath, axpParseEntityListRoute, axpParseEntityDetailsRoute, axpSaveEntityListReturnUrl, AXP_NOT_FOUND_ROUTE, AXP_PROTECTED_ROUTE_GUARDS, AXPToastAction, AXP_SEARCH_DEFINITION_PROVIDER, AXP_SEARCH_DEFINITION_LAZY_RESOLVER, AXPMenuItemsDataSourceDefinition } from '@acorex/platform/common';
8
+ import { AXPNotFoundError, axpNavigateAppPath, AXPSettingsService, AXPCommonSettings, resolveEntityCreateListBehavior, AXPRefreshEvent, resolveEntityModifyPopupTitle, resolveSearchableText, evaluateEntityDisplayTemplate, AXPFilterOperatorMiddlewareService, AXPReloadEvent, axpRedirectToNotFound, AXP_ENTITY_DELETED_WORKFLOW_EVENT_TYPE, AXPCleanNestedFilters, AXPFileTypeProviderService, AXPFileStorageService, resolveEntityRowDisplayTitle, AXPFileActionsService, axpIsEntityRecordNotFound, coerceAXPSettingRawValueByKind, AXPDefaultMultiLanguageConfigService, withDefaultMultiLanguageOnWidgetNodeTree, AXPWorkflowNavigateAction, axpIsEntityListPath, axpIsEntityDetailsPath, axpParseEntityListRoute, axpParseEntityDetailsRoute, axpSaveEntityListReturnUrl, AXP_NOT_FOUND_ROUTE, AXP_PROTECTED_ROUTE_GUARDS, AXPToastAction, AXP_SEARCH_DEFINITION_PROVIDER, AXP_SEARCH_DEFINITION_LAZY_RESOLVER, AXPMenuItemsDataSourceDefinition } from '@acorex/platform/common';
9
9
  import * as i1$3 from '@acorex/platform/workflow';
10
10
  import { AXPWorkflowEventService, AXPWorkflowService, ofType, createWorkFlowEvent, AXPWorkflowAction, AXPWorkflowModule } from '@acorex/platform/workflow';
11
11
  import * as i0 from '@angular/core';
@@ -24285,6 +24285,68 @@ const columnWidthMiddlewareProvider = {
24285
24285
  };
24286
24286
  //#endregion
24287
24287
 
24288
+ const DEFAULT_APPLY_ORDERING = true;
24289
+ /**
24290
+ * Provides synchronous access to the ApplyLayoutOrdering setting.
24291
+ * Used by layout ordering middleware to avoid async in the modifier and prevent startup deadlocks.
24292
+ * Reads from the settings in-memory cache when available; refreshes entity definitions when the value changes.
24293
+ */
24294
+ class AXPLayoutOrderingConfigService {
24295
+ constructor() {
24296
+ this.settingsService = inject(AXPSettingsService);
24297
+ this.entityRegistry = inject(AXPEntityDefinitionRegistryService);
24298
+ this._applyOrdering = signal(DEFAULT_APPLY_ORDERING, ...(ngDevMode ? [{ debugName: "_applyOrdering" }] : /* istanbul ignore next */ []));
24299
+ this.asyncWarmupScheduled = false;
24300
+ this.settingsService.onLoaded.subscribe(() => void this.handleSettingsEvent());
24301
+ this.settingsService.onChanged.subscribe((event) => {
24302
+ if (event.keys.includes(AXPCommonSettings.ApplyLayoutOrdering)) {
24303
+ void this.handleSettingsEvent();
24304
+ }
24305
+ });
24306
+ }
24307
+ getApplyOrdering() {
24308
+ const cached = this.settingsService.peekCached(AXPCommonSettings.ApplyLayoutOrdering);
24309
+ if (cached !== undefined) {
24310
+ const value = coerceAXPSettingRawValueByKind(cached, 'boolean');
24311
+ this._applyOrdering.set(value);
24312
+ return value;
24313
+ }
24314
+ if (!this.asyncWarmupScheduled) {
24315
+ this.asyncWarmupScheduled = true;
24316
+ void this.handleSettingsEvent();
24317
+ }
24318
+ return this._applyOrdering();
24319
+ }
24320
+ async handleSettingsEvent() {
24321
+ const previous = this._applyOrdering();
24322
+ await this.syncFromSettings();
24323
+ const current = this._applyOrdering();
24324
+ if (previous !== current) {
24325
+ try {
24326
+ await this.entityRegistry.refresh();
24327
+ }
24328
+ catch (err) {
24329
+ console.error('[AXPLayoutOrderingConfigService] entity refresh failed:', err);
24330
+ }
24331
+ }
24332
+ }
24333
+ async syncFromSettings() {
24334
+ try {
24335
+ const value = await this.settingsService.get(AXPCommonSettings.ApplyLayoutOrdering);
24336
+ this._applyOrdering.set(value ?? DEFAULT_APPLY_ORDERING);
24337
+ }
24338
+ catch {
24339
+ this._applyOrdering.set(DEFAULT_APPLY_ORDERING);
24340
+ }
24341
+ }
24342
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutOrderingConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
24343
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutOrderingConfigService, providedIn: 'root' }); }
24344
+ }
24345
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutOrderingConfigService, decorators: [{
24346
+ type: Injectable,
24347
+ args: [{ providedIn: 'root' }]
24348
+ }], ctorParameters: () => [] });
24349
+
24288
24350
  //#region ---- Default Column Order ----
24289
24351
  /**
24290
24352
  * Default order for common list view columns.
@@ -24333,6 +24395,10 @@ const DEFAULT_COLUMN_ORDER = {
24333
24395
  * Similar to layout-ordering for sections/properties, but for list columns.
24334
24396
  */
24335
24397
  const columnOrderingMiddleware = (context) => {
24398
+ const configService = inject(AXPLayoutOrderingConfigService);
24399
+ if (!configService.getApplyOrdering()) {
24400
+ return;
24401
+ }
24336
24402
  const columns = context.columns.list();
24337
24403
  if (!columns || columns.length === 0) {
24338
24404
  return;
@@ -24352,6 +24418,10 @@ const columnOrderingMiddleware = (context) => {
24352
24418
  const createColumnOrderingMiddlewareProvider = (columnOrder = {}, entityName = '*') => ({
24353
24419
  entityName,
24354
24420
  modifier: (context) => {
24421
+ const configService = inject(AXPLayoutOrderingConfigService);
24422
+ if (!configService.getApplyOrdering()) {
24423
+ return;
24424
+ }
24355
24425
  const columns = context.columns.list();
24356
24426
  if (!columns || columns.length === 0)
24357
24427
  return;
@@ -24373,47 +24443,6 @@ const columnOrderingMiddlewareProvider = {
24373
24443
  };
24374
24444
  //#endregion
24375
24445
 
24376
- const DEFAULT_APPLY_ORDERING = true;
24377
- /**
24378
- * Provides synchronous access to the ApplyLayoutOrdering setting.
24379
- * Used by layout ordering middleware to avoid async in the modifier and prevent startup deadlocks.
24380
- * Value is updated on onLoaded/onChanged; first read can trigger a one-time background get (no await).
24381
- */
24382
- class AXPLayoutOrderingConfigService {
24383
- constructor() {
24384
- this.settingsService = inject(AXPSettingsService);
24385
- this._applyOrdering = signal(DEFAULT_APPLY_ORDERING, ...(ngDevMode ? [{ debugName: "_applyOrdering" }] : /* istanbul ignore next */ []));
24386
- this.syncScheduled = false;
24387
- this.settingsService.onLoaded.subscribe(() => this.syncFromSettings());
24388
- this.settingsService.onChanged.subscribe(() => this.syncFromSettings());
24389
- }
24390
- getApplyOrdering() {
24391
- if (!this.syncScheduled) {
24392
- this.syncScheduled = true;
24393
- this.settingsService
24394
- .get(AXPCommonSettings.ApplyLayoutOrdering)
24395
- .then((value) => this._applyOrdering.set(value ?? DEFAULT_APPLY_ORDERING))
24396
- .catch(() => this._applyOrdering.set(DEFAULT_APPLY_ORDERING));
24397
- }
24398
- return this._applyOrdering();
24399
- }
24400
- async syncFromSettings() {
24401
- try {
24402
- const value = await this.settingsService.get(AXPCommonSettings.ApplyLayoutOrdering);
24403
- this._applyOrdering.set(value ?? DEFAULT_APPLY_ORDERING);
24404
- }
24405
- catch {
24406
- this._applyOrdering.set(DEFAULT_APPLY_ORDERING);
24407
- }
24408
- }
24409
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutOrderingConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
24410
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutOrderingConfigService, providedIn: 'root' }); }
24411
- }
24412
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPLayoutOrderingConfigService, decorators: [{
24413
- type: Injectable,
24414
- args: [{ providedIn: 'root' }]
24415
- }], ctorParameters: () => [] });
24416
-
24417
24446
  /**
24418
24447
  * Default shipped rules: narrow identifier + wider title on `md` / `lg`.
24419
24448
  */
@@ -24657,11 +24686,7 @@ const createLayoutOrderingMiddlewareProvider = (config = {}, entityName = '*') =
24657
24686
  modifier: layoutOrderingMiddlewareFactory({
24658
24687
  sections: { ...DEFAULT_SECTION_ORDER, ...config.sections },
24659
24688
  properties: { ...DEFAULT_PROPERTY_ORDER, ...config.properties },
24660
- pairSpanRules: config.pairSpanRules === false
24661
- ? false
24662
- : config.pairSpanRules !== undefined
24663
- ? config.pairSpanRules
24664
- : undefined,
24689
+ pairSpanRules: config.pairSpanRules === false ? false : config.pairSpanRules !== undefined ? config.pairSpanRules : undefined,
24665
24690
  }),
24666
24691
  });
24667
24692
  const layoutOrderingMiddlewareProvider = createLayoutOrderingMiddlewareProvider();