@acorex/platform 20.8.7 → 20.8.8
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.
- package/common/index.d.ts +46 -44
- package/fesm2022/acorex-platform-common.mjs +60 -22
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-core.mjs +5 -4
- package/fesm2022/acorex-platform-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widget-core.mjs +2 -2
- package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
- package/layout/entity/index.d.ts +1 -1
- package/package.json +17 -17
package/common/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { AXDataSourceOperator, AXStyleColorType, AXDataSourceFilterOption } from
|
|
|
4
4
|
import * as i2 from '@acorex/components/popup';
|
|
5
5
|
import { AXPopupSizeType, AXPopupService } from '@acorex/components/popup';
|
|
6
6
|
import * as i5 from '@acorex/platform/core';
|
|
7
|
-
import { AXPValueTransformerFunctions, AXPOptionsData, AXPExpression, AXPFilterDefinition, AXPMetaData, AXPSystemActionType, AXPValidationRules, AXPGridLayoutOptions, AXPLogoConfig, AXPFileListItem, AXPNavigateActionCommand, AXPExecuteCommand, AXPApplicationUserReference, AXPEntityReference, AXPPlatformScopeKey,
|
|
7
|
+
import { AXPValueTransformerFunctions, AXPOptionsData, AXPExpression, AXPFilterDefinition, AXPMetaData, AXPSystemActionType, AXPValidationRules, AXPGridLayoutOptions, AXPLogoConfig, AXPFileListItem, AXPNavigateActionCommand, AXPExecuteCommand, AXPApplicationUserReference, AXPEntityReference, AXPPlatformScopeKey, AXPWidgetTriggers, AXPPlatformScope, AXPExpressionEvaluatorScopeProvider, AXPExpressionEvaluatorScopeProviderContext } from '@acorex/platform/core';
|
|
8
8
|
import { AXPWidgetTypesMap, AXPMetaDataDefinition, AXPWidgetNode } from '@acorex/platform/layout/widget-core';
|
|
9
9
|
import * as i6 from '@angular/router';
|
|
10
10
|
import { Route, Routes } from '@angular/router';
|
|
@@ -1749,6 +1749,49 @@ declare abstract class AXPLockService {
|
|
|
1749
1749
|
static ɵprov: i0.ɵɵInjectableDeclaration<AXPLockService>;
|
|
1750
1750
|
}
|
|
1751
1751
|
|
|
1752
|
+
declare class AXPSettingDefinitionProviderContext {
|
|
1753
|
+
private rootGroups;
|
|
1754
|
+
private groupMap;
|
|
1755
|
+
addGroup(name: string, title: string, description?: string, icon?: string): AXPSettingDefinitionGroupBuilder;
|
|
1756
|
+
group(name: string): AXPSettingDefinitionGroupBuilder | null;
|
|
1757
|
+
getGroups(): AXPSettingDefinitionGroup[];
|
|
1758
|
+
hasGroup(name: string): boolean;
|
|
1759
|
+
getGroup(name: string): AXPSettingDefinitionGroup | undefined;
|
|
1760
|
+
}
|
|
1761
|
+
declare class AXPSettingDefinitionGroupBuilder {
|
|
1762
|
+
private context;
|
|
1763
|
+
private group;
|
|
1764
|
+
constructor(context: AXPSettingDefinitionProviderContext, group: AXPSettingDefinitionGroup);
|
|
1765
|
+
addSection(name: string, title: string, description?: string): AXPSettingDefinitionSectionBuilder;
|
|
1766
|
+
section(name: string): AXPSettingDefinitionSectionBuilder | null;
|
|
1767
|
+
addGroup(name: string, title: string, description?: string, icon?: string): AXPSettingDefinitionGroupBuilder;
|
|
1768
|
+
endGroup(): AXPSettingDefinitionProviderContext;
|
|
1769
|
+
}
|
|
1770
|
+
declare class AXPSettingDefinitionSectionBuilder {
|
|
1771
|
+
private groupBuilder;
|
|
1772
|
+
private section;
|
|
1773
|
+
constructor(groupBuilder: AXPSettingDefinitionGroupBuilder, section: AXPSettingDefinitionSection);
|
|
1774
|
+
addSetting(setting: {
|
|
1775
|
+
key: string;
|
|
1776
|
+
title: string;
|
|
1777
|
+
scope: AXPPlatformScopeKey;
|
|
1778
|
+
widget: {
|
|
1779
|
+
type: AXPWidgetTypesMap[keyof AXPWidgetTypesMap] | string;
|
|
1780
|
+
options?: AXPOptionsData;
|
|
1781
|
+
triggers?: AXPWidgetTriggers;
|
|
1782
|
+
layout?: AXPGridLayoutOptions;
|
|
1783
|
+
};
|
|
1784
|
+
description?: string;
|
|
1785
|
+
isRequired?: boolean;
|
|
1786
|
+
isInherited?: boolean;
|
|
1787
|
+
isEncrypted?: boolean;
|
|
1788
|
+
defaultValue?: unknown;
|
|
1789
|
+
valueTransforms?: AXPValueTransformerFunctions;
|
|
1790
|
+
validationRules?: AXPValidationRules;
|
|
1791
|
+
}): this;
|
|
1792
|
+
endSection(): AXPSettingDefinitionGroupBuilder;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1752
1795
|
interface AXPSettingValueProvider {
|
|
1753
1796
|
get scope(): AXPPlatformScope;
|
|
1754
1797
|
load(): Promise<AXPSettingValue[]>;
|
|
@@ -1812,49 +1855,6 @@ interface AXPGroupSearchResult {
|
|
|
1812
1855
|
groups: AXPSettingDefinitionGroup[] | null;
|
|
1813
1856
|
}
|
|
1814
1857
|
|
|
1815
|
-
declare class AXPSettingDefinitionProviderContext {
|
|
1816
|
-
private rootGroups;
|
|
1817
|
-
private groupMap;
|
|
1818
|
-
addGroup(name: string, title: string, description?: string, icon?: string): AXPSettingDefinitionGroupBuilder;
|
|
1819
|
-
group(name: string): AXPSettingDefinitionGroupBuilder | null;
|
|
1820
|
-
getGroups(): AXPSettingDefinitionGroup[];
|
|
1821
|
-
hasGroup(name: string): boolean;
|
|
1822
|
-
getGroup(name: string): AXPSettingDefinitionGroup | undefined;
|
|
1823
|
-
}
|
|
1824
|
-
declare class AXPSettingDefinitionGroupBuilder {
|
|
1825
|
-
private context;
|
|
1826
|
-
private group;
|
|
1827
|
-
constructor(context: AXPSettingDefinitionProviderContext, group: AXPSettingDefinitionGroup);
|
|
1828
|
-
addSection(name: string, title: string, description?: string): AXPSettingDefinitionSectionBuilder;
|
|
1829
|
-
section(name: string): AXPSettingDefinitionSectionBuilder | null;
|
|
1830
|
-
addGroup(name: string, title: string, description?: string, icon?: string): AXPSettingDefinitionGroupBuilder;
|
|
1831
|
-
endGroup(): AXPSettingDefinitionProviderContext;
|
|
1832
|
-
}
|
|
1833
|
-
declare class AXPSettingDefinitionSectionBuilder {
|
|
1834
|
-
private groupBuilder;
|
|
1835
|
-
private section;
|
|
1836
|
-
constructor(groupBuilder: AXPSettingDefinitionGroupBuilder, section: AXPSettingDefinitionSection);
|
|
1837
|
-
addSetting(setting: {
|
|
1838
|
-
key: string;
|
|
1839
|
-
title: string;
|
|
1840
|
-
scope: AXPPlatformScopeKey;
|
|
1841
|
-
widget: {
|
|
1842
|
-
type: AXPWidgetTypesMap[keyof AXPWidgetTypesMap] | string;
|
|
1843
|
-
options?: AXPOptionsData;
|
|
1844
|
-
triggers?: AXPWidgetTriggers;
|
|
1845
|
-
layout?: AXPGridLayoutOptions;
|
|
1846
|
-
};
|
|
1847
|
-
description?: string;
|
|
1848
|
-
isRequired?: boolean;
|
|
1849
|
-
isInherited?: boolean;
|
|
1850
|
-
isEncrypted?: boolean;
|
|
1851
|
-
defaultValue?: unknown;
|
|
1852
|
-
valueTransforms?: AXPValueTransformerFunctions;
|
|
1853
|
-
validationRules?: AXPValidationRules;
|
|
1854
|
-
}): this;
|
|
1855
|
-
endSection(): AXPSettingDefinitionGroupBuilder;
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
1858
|
interface AXPSettingDefinitionProvider {
|
|
1859
1859
|
provide(context: AXPSettingDefinitionProviderContext): Promise<void>;
|
|
1860
1860
|
}
|
|
@@ -1867,6 +1867,7 @@ declare class AXPSettingDefinitionProviderService {
|
|
|
1867
1867
|
getListAsync(scope: AXPPlatformScopeKey): Promise<AXPSettingDefinitionGroup[]>;
|
|
1868
1868
|
getList(scope: AXPPlatformScopeKey): AXPSettingDefinitionGroup[];
|
|
1869
1869
|
defaultValues(): Promise<Record<string, unknown>>;
|
|
1870
|
+
settingScopeByKey(): Promise<Record<string, AXPPlatformScope>>;
|
|
1870
1871
|
findGroup(scope: AXPPlatformScopeKey, groupName: string): AXPGroupSearchResult;
|
|
1871
1872
|
private searchRecursive;
|
|
1872
1873
|
static ɵfac: i0.ɵɵFactoryDeclaration<AXPSettingDefinitionProviderService, never>;
|
|
@@ -1904,6 +1905,7 @@ declare class AXPSettingsService implements AXPSettingsServiceInterface {
|
|
|
1904
1905
|
defaultValues(scope: AXPPlatformScope): Promise<Record<string, unknown>>;
|
|
1905
1906
|
scope(scope: AXPPlatformScope): ScopedSettingService;
|
|
1906
1907
|
invokeChangeEvent(event: AXPSettingChangedEvent): void;
|
|
1908
|
+
private seedMissingDefaults;
|
|
1907
1909
|
static ɵfac: i0.ɵɵFactoryDeclaration<AXPSettingsService, never>;
|
|
1908
1910
|
static ɵprov: i0.ɵɵInjectableDeclaration<AXPSettingsService>;
|
|
1909
1911
|
}
|
|
@@ -363,7 +363,8 @@ class AXPSettingDefinitionProviderService {
|
|
|
363
363
|
return groups
|
|
364
364
|
.map((group) => ({
|
|
365
365
|
...group,
|
|
366
|
-
sections: group.sections
|
|
366
|
+
sections: group.sections
|
|
367
|
+
.map((section) => ({
|
|
367
368
|
...section,
|
|
368
369
|
settings: section.settings.filter((setting) => {
|
|
369
370
|
const settingScopeIndex = scopeOrder.indexOf(setting.scope);
|
|
@@ -380,7 +381,8 @@ class AXPSettingDefinitionProviderService {
|
|
|
380
381
|
// 3. Exclude settings with a lower or irrelevant scope.
|
|
381
382
|
return false;
|
|
382
383
|
}),
|
|
383
|
-
}))
|
|
384
|
+
}))
|
|
385
|
+
.filter((section) => section.settings.length > 0), // Keep only sections with settings
|
|
384
386
|
groups: filterByScope(group.groups, currentScope), // Recursively filter nested groups
|
|
385
387
|
}))
|
|
386
388
|
.filter((group) => group.sections.length > 0 || group.groups.length > 0); // Keep groups with valid sections or nested groups
|
|
@@ -407,12 +409,33 @@ class AXPSettingDefinitionProviderService {
|
|
|
407
409
|
collectDefaults(this.cache);
|
|
408
410
|
return defaults;
|
|
409
411
|
}
|
|
412
|
+
async settingScopeByKey() {
|
|
413
|
+
const scopes = {};
|
|
414
|
+
const collect = (groups) => {
|
|
415
|
+
groups.forEach((group) => {
|
|
416
|
+
group.sections.forEach((section) => {
|
|
417
|
+
section.settings.forEach((setting) => {
|
|
418
|
+
scopes[setting.name] = setting.scope;
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
collect(group.groups);
|
|
422
|
+
});
|
|
423
|
+
};
|
|
424
|
+
if (!this.cache) {
|
|
425
|
+
await this.load();
|
|
426
|
+
}
|
|
427
|
+
collect(this.cache);
|
|
428
|
+
return scopes;
|
|
429
|
+
}
|
|
410
430
|
findGroup(scope, groupName) {
|
|
411
431
|
return this.searchRecursive(this.getList(scope), groupName, []); // Initialize with an empty breadcrumb
|
|
412
432
|
}
|
|
413
433
|
searchRecursive(groups, groupName, breadcrumb) {
|
|
414
434
|
for (const group of groups) {
|
|
415
|
-
const currentBreadcrumb = [
|
|
435
|
+
const currentBreadcrumb = [
|
|
436
|
+
...breadcrumb,
|
|
437
|
+
{ name: group.name, title: group.title, description: group.description },
|
|
438
|
+
];
|
|
416
439
|
// If the group name matches, return its details
|
|
417
440
|
if (group.name === groupName) {
|
|
418
441
|
return {
|
|
@@ -431,7 +454,7 @@ class AXPSettingDefinitionProviderService {
|
|
|
431
454
|
return {
|
|
432
455
|
breadcrumb: [],
|
|
433
456
|
groups: [],
|
|
434
|
-
sections: []
|
|
457
|
+
sections: [],
|
|
435
458
|
};
|
|
436
459
|
}
|
|
437
460
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXPSettingDefinitionProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
@@ -482,9 +505,9 @@ const AXP_SETTING_VALUE_PROVIDER = new InjectionToken('AXP_SETTING_VALUE_PROVIDE
|
|
|
482
505
|
return [
|
|
483
506
|
new AXPSettingValueProviderDefault(AXPPlatformScope.Platform, injector),
|
|
484
507
|
new AXPSettingValueProviderDefault(AXPPlatformScope.Tenant, injector),
|
|
485
|
-
new AXPSettingValueProviderDefault(AXPPlatformScope.User, injector)
|
|
508
|
+
new AXPSettingValueProviderDefault(AXPPlatformScope.User, injector),
|
|
486
509
|
];
|
|
487
|
-
}
|
|
510
|
+
},
|
|
488
511
|
});
|
|
489
512
|
class AXPSettingValueProviderDefault {
|
|
490
513
|
constructor(_scope, injector) {
|
|
@@ -524,7 +547,7 @@ class AXPSettingValueProviderDefault {
|
|
|
524
547
|
Object.entries(parsedSettings).forEach(([key, value]) => {
|
|
525
548
|
this.cache.set(key, value);
|
|
526
549
|
});
|
|
527
|
-
return Promise.resolve(Array.from(this.cache.entries()).map(c => ({ key: c[0], value: c[1] })));
|
|
550
|
+
return Promise.resolve(Array.from(this.cache.entries()).map((c) => ({ key: c[0], value: c[1] })));
|
|
528
551
|
}
|
|
529
552
|
return Promise.resolve([]);
|
|
530
553
|
}
|
|
@@ -569,11 +592,7 @@ class AXPSettingsService {
|
|
|
569
592
|
this.onChanged = new Subject();
|
|
570
593
|
this.onLoaded = new Subject();
|
|
571
594
|
// Initialize scoped caches for dynamic scopes
|
|
572
|
-
const staticScopes = [
|
|
573
|
-
AXPPlatformScope.Platform,
|
|
574
|
-
AXPPlatformScope.Tenant,
|
|
575
|
-
AXPPlatformScope.User,
|
|
576
|
-
];
|
|
595
|
+
const staticScopes = [AXPPlatformScope.Platform, AXPPlatformScope.Tenant, AXPPlatformScope.User];
|
|
577
596
|
staticScopes.forEach((scope) => {
|
|
578
597
|
if (!this.scopedSettingsCache.has(scope)) {
|
|
579
598
|
this.scopedSettingsCache.set(scope, new Map());
|
|
@@ -608,6 +627,7 @@ class AXPSettingsService {
|
|
|
608
627
|
});
|
|
609
628
|
settingsList.push(...providerSettings);
|
|
610
629
|
}
|
|
630
|
+
await this.seedMissingDefaults();
|
|
611
631
|
this.onLoaded.next();
|
|
612
632
|
return settingsList;
|
|
613
633
|
}
|
|
@@ -620,11 +640,7 @@ class AXPSettingsService {
|
|
|
620
640
|
if (this.scopedSettingsCache.size === 0) {
|
|
621
641
|
await this.load();
|
|
622
642
|
}
|
|
623
|
-
const scopeOrder = [
|
|
624
|
-
AXPPlatformScope.User,
|
|
625
|
-
AXPPlatformScope.Tenant,
|
|
626
|
-
AXPPlatformScope.Platform,
|
|
627
|
-
];
|
|
643
|
+
const scopeOrder = [AXPPlatformScope.User, AXPPlatformScope.Tenant, AXPPlatformScope.Platform];
|
|
628
644
|
for (const scope of scopeOrder) {
|
|
629
645
|
const scopeCache = this.scopedSettingsCache.get(scope);
|
|
630
646
|
if (scopeCache && scopeCache.has(key)) {
|
|
@@ -638,11 +654,7 @@ class AXPSettingsService {
|
|
|
638
654
|
return get(defaults, key); // Fallback if no value is found
|
|
639
655
|
}
|
|
640
656
|
async defaultValues(scope) {
|
|
641
|
-
let scopeOrder = [
|
|
642
|
-
AXPPlatformScope.Platform,
|
|
643
|
-
AXPPlatformScope.Tenant,
|
|
644
|
-
AXPPlatformScope.User,
|
|
645
|
-
].reverse();
|
|
657
|
+
let scopeOrder = [AXPPlatformScope.Platform, AXPPlatformScope.Tenant, AXPPlatformScope.User].reverse();
|
|
646
658
|
const scopeIndex = scopeOrder.indexOf(scope);
|
|
647
659
|
if (scopeIndex === -1) {
|
|
648
660
|
throw new Error(`Invalid scope: ${scope}`);
|
|
@@ -676,6 +688,32 @@ class AXPSettingsService {
|
|
|
676
688
|
this.onChanged.next(event);
|
|
677
689
|
this.eventService.publish('AXPSettingChangedEvent', event);
|
|
678
690
|
}
|
|
691
|
+
async seedMissingDefaults() {
|
|
692
|
+
const definitionService = this.injector.get(AXPSettingDefinitionProviderService);
|
|
693
|
+
const aggregator = this.injector.get(AXPSettingDefaultValuesAggregatorService);
|
|
694
|
+
const [defaults, scopeByKey] = await Promise.all([
|
|
695
|
+
aggregator.getDefaults(),
|
|
696
|
+
definitionService.settingScopeByKey(),
|
|
697
|
+
]);
|
|
698
|
+
const persistedKeysByScope = new Map(await Promise.all(this.providers.map(async (provider) => {
|
|
699
|
+
const stored = await provider.load();
|
|
700
|
+
return [provider.scope, new Set(stored.map((s) => s.key))];
|
|
701
|
+
})));
|
|
702
|
+
const toPersist = {};
|
|
703
|
+
for (const [key, value] of Object.entries(defaults)) {
|
|
704
|
+
const scope = scopeByKey[key];
|
|
705
|
+
if (!scope || value === undefined || persistedKeysByScope.get(scope)?.has(key)) {
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
toPersist[scope] ??= {};
|
|
709
|
+
toPersist[scope][key] = value;
|
|
710
|
+
}
|
|
711
|
+
for (const [scope, values] of Object.entries(toPersist)) {
|
|
712
|
+
if (Object.keys(values).length > 0) {
|
|
713
|
+
await this.scope(scope).set(values);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
679
717
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXPSettingsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
680
718
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: AXPSettingsService, providedIn: 'root' }); }
|
|
681
719
|
}
|