@acorex/platform 21.0.0-next.70 → 21.0.0-next.71
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/fesm2022/acorex-platform-common.mjs +11 -0
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-core.mjs +332 -76
- package/fesm2022/acorex-platform-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-builder.mjs +563 -44
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-components.mjs +83 -67
- package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +543 -237
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-views.mjs +319 -66
- package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widget-core.mjs +54 -6
- package/fesm2022/acorex-platform-layout-widget-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-widgets.mjs +198 -91
- package/fesm2022/acorex-platform-layout-widgets.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-default.mjs +13 -14
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-shared.mjs +50 -30
- package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
- package/package.json +1 -1
- package/types/acorex-platform-common.d.ts +11 -0
- package/types/acorex-platform-core.d.ts +137 -47
- package/types/acorex-platform-layout-builder.d.ts +90 -13
- package/types/acorex-platform-layout-components.d.ts +21 -17
- package/types/acorex-platform-layout-entity.d.ts +63 -10
- package/types/acorex-platform-layout-views.d.ts +68 -6
- package/types/acorex-platform-layout-widget-core.d.ts +43 -8
- package/types/acorex-platform-layout-widgets.d.ts +21 -6
- package/types/acorex-platform-themes-default.d.ts +24 -4
- package/types/acorex-platform-themes-shared.d.ts +6 -0
- package/types/acorex-platform-workflow.d.ts +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, inject, Injectable, Directive, computed, Injector, ChangeDetectionStrategy, Component, input, ElementRef, ViewContainerRef, signal, effect, runInInjectionContext, Optional, Inject, NgModule, EventEmitter, HostListener, Output, provideAppInitializer, Pipe } from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';
|
|
4
|
+
import { AXDataSource } from '@acorex/cdk/common';
|
|
5
|
+
import { get, isPlainObject, set, isNil, isEmpty, isArray, merge, isObjectLike, transform, isEqual, differenceWith, union, cloneDeep, isObject, has, sortBy, isUndefined, endsWith, startsWith, includes, lte, gte, lt, gt, orderBy } from 'lodash-es';
|
|
4
6
|
import { signalStore, withState, withComputed, withMethods, patchState } from '@ngrx/signals';
|
|
5
7
|
import * as i1 from '@acorex/components/skeleton';
|
|
6
8
|
import { AXSkeletonModule } from '@acorex/components/skeleton';
|
|
7
9
|
import { Subject, interval, fromEvent } from 'rxjs';
|
|
8
|
-
import { AXDataSource } from '@acorex/cdk/common';
|
|
9
|
-
import { AXTranslationService, resolveMultiLanguageString } from '@acorex/core/translation';
|
|
10
10
|
import { AXCalendarService } from '@acorex/core/date-time';
|
|
11
11
|
import { startWith, map, debounceTime } from 'rxjs/operators';
|
|
12
12
|
|
|
@@ -32,6 +32,184 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
|
|
|
32
32
|
class AXPActivityLogProvider {
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
//#region ---- Catalog scope definition ----
|
|
36
|
+
//#endregion
|
|
37
|
+
|
|
38
|
+
//#region ---- Provider contract ----
|
|
39
|
+
const AXP_CATALOG_SCOPE_DEFINITION_PROVIDER = new InjectionToken('AXP_CATALOG_SCOPE_DEFINITION_PROVIDER');
|
|
40
|
+
//#endregion
|
|
41
|
+
|
|
42
|
+
//#region ---- Imports ----
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region ---- Aggregator service ----
|
|
45
|
+
/**
|
|
46
|
+
* Collects {@link AXPCatalogScopeDefinition} entries from all registered providers.
|
|
47
|
+
*/
|
|
48
|
+
class AXPCatalogScopeDefinitionProviderService {
|
|
49
|
+
constructor() {
|
|
50
|
+
//#region ---- Services & Dependencies ----
|
|
51
|
+
this.providers = inject(AXP_CATALOG_SCOPE_DEFINITION_PROVIDER, { optional: true });
|
|
52
|
+
this.translation = inject(AXTranslationService);
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region ---- Public API ----
|
|
56
|
+
async items() {
|
|
57
|
+
const merged = [];
|
|
58
|
+
const seen = new Set();
|
|
59
|
+
if (!Array.isArray(this.providers)) {
|
|
60
|
+
return merged;
|
|
61
|
+
}
|
|
62
|
+
for (const raw of this.providers) {
|
|
63
|
+
const provider = await Promise.resolve(raw);
|
|
64
|
+
if (!provider || typeof provider.items !== 'function') {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
for (const item of await provider.items()) {
|
|
68
|
+
const name = item.name?.trim();
|
|
69
|
+
if (!name) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (seen.has(name)) {
|
|
73
|
+
throw new Error(`Duplicate catalog scope definition: "${name}"`);
|
|
74
|
+
}
|
|
75
|
+
seen.add(name);
|
|
76
|
+
merged.push(item);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return merged.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
80
|
+
}
|
|
81
|
+
async get(name) {
|
|
82
|
+
const key = name?.trim();
|
|
83
|
+
if (!key) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
return (await this.items()).find((d) => d.name === key);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Scopes applicable to the given entity ref (`Module.Entity`).
|
|
90
|
+
*/
|
|
91
|
+
async byTarget(entityRef) {
|
|
92
|
+
const target = entityRef?.trim();
|
|
93
|
+
if (!target) {
|
|
94
|
+
return [];
|
|
95
|
+
}
|
|
96
|
+
return (await this.items()).filter((d) => d.targets?.some((t) => t === target));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Resolves display title for a scope key (active locale).
|
|
100
|
+
*/
|
|
101
|
+
resolveTitle(definition) {
|
|
102
|
+
const locale = this.translation.getActiveLang() ?? 'en-US';
|
|
103
|
+
if (typeof definition.title === 'string') {
|
|
104
|
+
const title = definition.title.trim();
|
|
105
|
+
if (title.startsWith('@')) {
|
|
106
|
+
return this.translation.translateSync(title) || title;
|
|
107
|
+
}
|
|
108
|
+
return title;
|
|
109
|
+
}
|
|
110
|
+
return resolveMultiLanguageString(definition.title, locale) || definition.name;
|
|
111
|
+
}
|
|
112
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPCatalogScopeDefinitionProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
113
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPCatalogScopeDefinitionProviderService, providedIn: 'root' }); }
|
|
114
|
+
}
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXPCatalogScopeDefinitionProviderService, decorators: [{
|
|
116
|
+
type: Injectable,
|
|
117
|
+
args: [{ providedIn: 'root' }]
|
|
118
|
+
}] });
|
|
119
|
+
|
|
120
|
+
//#region ---- Imports ----
|
|
121
|
+
//#endregion
|
|
122
|
+
//#region ---- Constants ----
|
|
123
|
+
/** Data source name for select widgets listing registered catalog scopes. */
|
|
124
|
+
const PLATFORM_CATALOG_SCOPES_DATASOURCE_NAME = 'platform-catalog-scopes';
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region ---- Data source definition ----
|
|
127
|
+
/**
|
|
128
|
+
* Registered catalog scopes for select / selection-list widgets via {@link PLATFORM_CATALOG_SCOPES_DATASOURCE_NAME}.
|
|
129
|
+
*/
|
|
130
|
+
class AXPCatalogScopeDefinitionsDataSourceDefinition {
|
|
131
|
+
constructor() {
|
|
132
|
+
//#region ---- Services & Dependencies ----
|
|
133
|
+
this.catalogScopeRegistry = inject(AXPCatalogScopeDefinitionProviderService);
|
|
134
|
+
//#endregion
|
|
135
|
+
}
|
|
136
|
+
//#endregion
|
|
137
|
+
//#region ---- Public API ----
|
|
138
|
+
async items() {
|
|
139
|
+
return [
|
|
140
|
+
{
|
|
141
|
+
name: PLATFORM_CATALOG_SCOPES_DATASOURCE_NAME,
|
|
142
|
+
title: 'Catalog scopes',
|
|
143
|
+
source: () => new AXDataSource({
|
|
144
|
+
key: 'name',
|
|
145
|
+
pageSize: 500,
|
|
146
|
+
load: async (e) => {
|
|
147
|
+
const all = await this.catalogScopeRegistry.items();
|
|
148
|
+
const localeFilter = this.readTargetFilter(e?.filter);
|
|
149
|
+
const items = all
|
|
150
|
+
.filter((scope) => !localeFilter || scope.targets?.includes(localeFilter))
|
|
151
|
+
.map((scope) => ({
|
|
152
|
+
name: scope.name,
|
|
153
|
+
title: this.catalogScopeRegistry.resolveTitle(scope),
|
|
154
|
+
description: scope.description,
|
|
155
|
+
targets: scope.targets,
|
|
156
|
+
icon: scope.icon,
|
|
157
|
+
cssClass: scope.cssClass,
|
|
158
|
+
}));
|
|
159
|
+
return { items, total: items.length };
|
|
160
|
+
},
|
|
161
|
+
byKey: async (key) => {
|
|
162
|
+
const name = String(key ?? '').trim();
|
|
163
|
+
if (!name) {
|
|
164
|
+
return undefined;
|
|
165
|
+
}
|
|
166
|
+
const scope = await this.catalogScopeRegistry.get(name);
|
|
167
|
+
if (!scope) {
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
return {
|
|
171
|
+
name: scope.name,
|
|
172
|
+
title: this.catalogScopeRegistry.resolveTitle(scope),
|
|
173
|
+
description: scope.description,
|
|
174
|
+
targets: scope.targets,
|
|
175
|
+
icon: scope.icon,
|
|
176
|
+
cssClass: scope.cssClass,
|
|
177
|
+
};
|
|
178
|
+
},
|
|
179
|
+
}),
|
|
180
|
+
columns: [
|
|
181
|
+
{ name: 'name', title: 'Name', datatype: 'string', type: 'text-editor' },
|
|
182
|
+
{ name: 'title', title: 'Title', datatype: 'string', type: 'text-editor' },
|
|
183
|
+
],
|
|
184
|
+
filters: [
|
|
185
|
+
{
|
|
186
|
+
field: 'targets',
|
|
187
|
+
title: 'Target entity',
|
|
188
|
+
operator: { type: 'contains' },
|
|
189
|
+
widget: { type: 'text-editor' },
|
|
190
|
+
filterType: { advance: false, inline: false },
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
textField: { name: 'title', title: 'Title' },
|
|
194
|
+
valueField: { name: 'name', title: 'Name' },
|
|
195
|
+
},
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region ---- Helpers ----
|
|
200
|
+
readTargetFilter(filter) {
|
|
201
|
+
if (!filter || typeof filter !== 'object') {
|
|
202
|
+
return undefined;
|
|
203
|
+
}
|
|
204
|
+
const f = filter;
|
|
205
|
+
if (f.field === 'targets' && typeof f.value === 'string' && f.value.trim()) {
|
|
206
|
+
return f.value.trim();
|
|
207
|
+
}
|
|
208
|
+
return undefined;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
//#endregion
|
|
212
|
+
|
|
35
213
|
//#region ---- Color Palette Provider ----
|
|
36
214
|
/**
|
|
37
215
|
* Abstract class for color palette providers
|
|
@@ -789,6 +967,20 @@ function getEnumValues(enumType) {
|
|
|
789
967
|
return Object.entries(enumType).map(([key, value]) => ({ id: value, title: key }));
|
|
790
968
|
}
|
|
791
969
|
|
|
970
|
+
/**
|
|
971
|
+
* Returns whether `current` differs from the saved/clean `baseline` snapshot.
|
|
972
|
+
* Used by entity details pages, layout-builder dialogs, and {@link AXPContextStore}.
|
|
973
|
+
*/
|
|
974
|
+
function isFormContextDirty(current, baseline) {
|
|
975
|
+
return !isEqual(current, baseline);
|
|
976
|
+
}
|
|
977
|
+
/**
|
|
978
|
+
* Clones a context object for use as a dirty-tracking baseline.
|
|
979
|
+
*/
|
|
980
|
+
function captureFormContextBaseline(context) {
|
|
981
|
+
return cloneDeep(context);
|
|
982
|
+
}
|
|
983
|
+
|
|
792
984
|
class AXPContextChangeEvent {
|
|
793
985
|
}
|
|
794
986
|
//#endregion
|
|
@@ -801,33 +993,56 @@ withState(() => ({
|
|
|
801
993
|
state: 'initiated', // Current state
|
|
802
994
|
initialSnapshot: {}, // Snapshot of the first initialized state
|
|
803
995
|
previousSnapshot: {}, // Snapshot of the previous state
|
|
996
|
+
userDirtyPaths: [], // Paths changed by user interaction
|
|
804
997
|
lastChange: {
|
|
805
998
|
state: 'initiated',
|
|
806
999
|
}, // Last change event
|
|
807
1000
|
})),
|
|
808
1001
|
// Computed Signals
|
|
809
|
-
withComputed(({ data, state, lastChange, initialSnapshot, previousSnapshot }) => ({
|
|
1002
|
+
withComputed(({ data, state, lastChange, initialSnapshot, previousSnapshot, userDirtyPaths }) => ({
|
|
810
1003
|
isChanged: computed(() => state() === 'changed'),
|
|
811
1004
|
isReset: computed(() => state() === 'restored'),
|
|
812
1005
|
isInitiated: computed(() => state() === 'initiated'),
|
|
813
1006
|
isEmpty: computed(() => Object.keys(data()).length === 0),
|
|
814
|
-
isDirty: computed(() =>
|
|
1007
|
+
isDirty: computed(() => isFormContextDirty(data(), initialSnapshot())),
|
|
1008
|
+
isUserDirty: computed(() => userDirtyPaths().length > 0),
|
|
815
1009
|
snapshot: computed(() => cloneDeep(data())), // Current data snapshot
|
|
816
1010
|
initial: computed(() => cloneDeep(initialSnapshot())), // Initial snapshot
|
|
817
1011
|
previous: computed(() => cloneDeep(previousSnapshot())), // Previous snapshot
|
|
818
1012
|
changeEvent: computed(() => lastChange()), // Reactive last change event
|
|
819
1013
|
})),
|
|
820
1014
|
// Methods for State Management
|
|
821
|
-
withMethods((store) =>
|
|
822
|
-
|
|
823
|
-
|
|
1015
|
+
withMethods((store) => {
|
|
1016
|
+
const markUserDirtyPath = (path) => {
|
|
1017
|
+
const normalized = path?.trim();
|
|
1018
|
+
if (!normalized) {
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
const current = store.userDirtyPaths();
|
|
1022
|
+
if (current.includes(normalized)) {
|
|
1023
|
+
return;
|
|
1024
|
+
}
|
|
1025
|
+
patchState(store, { userDirtyPaths: [...current, normalized] });
|
|
1026
|
+
};
|
|
1027
|
+
const clearUserDirtyPaths = () => {
|
|
1028
|
+
if (store.userDirtyPaths().length === 0) {
|
|
1029
|
+
return;
|
|
1030
|
+
}
|
|
1031
|
+
patchState(store, { userDirtyPaths: [] });
|
|
1032
|
+
};
|
|
1033
|
+
const resolvePatchOptions = (second) => {
|
|
1034
|
+
if (typeof second === 'boolean') {
|
|
1035
|
+
return { skipDirtyTracking: second };
|
|
1036
|
+
}
|
|
1037
|
+
return second ?? {};
|
|
1038
|
+
};
|
|
1039
|
+
const updateValue = (path, value, options) => {
|
|
824
1040
|
const currentData = cloneDeep(store.data());
|
|
825
1041
|
const oldValue = getSmart(currentData, path);
|
|
826
|
-
// Skip if the value hasn't changed
|
|
827
1042
|
if (isEqual(oldValue, value)) {
|
|
828
1043
|
return;
|
|
829
1044
|
}
|
|
830
|
-
|
|
1045
|
+
const origin = options?.origin ?? 'system';
|
|
831
1046
|
const updatedData = setSmart(currentData, path, value);
|
|
832
1047
|
const changeEvent = {
|
|
833
1048
|
oldValue,
|
|
@@ -835,78 +1050,119 @@ withMethods((store) => ({
|
|
|
835
1050
|
path,
|
|
836
1051
|
state: 'changed',
|
|
837
1052
|
data: updatedData,
|
|
1053
|
+
origin,
|
|
838
1054
|
};
|
|
839
|
-
// Patch the state
|
|
840
|
-
patchState(store, {
|
|
841
|
-
previousSnapshot: store.snapshot(), // Save the previous state
|
|
842
|
-
data: updatedData,
|
|
843
|
-
state: 'changed',
|
|
844
|
-
lastChange: changeEvent,
|
|
845
|
-
});
|
|
846
|
-
},
|
|
847
|
-
patch(context, skipDirtyTracking = false) {
|
|
848
|
-
const currentData = cloneDeep(store.data());
|
|
849
|
-
// Update the value and prepare the change event
|
|
850
|
-
const updatedData = { ...currentData, ...context };
|
|
851
|
-
const changeEvent = {
|
|
852
|
-
state: 'patch',
|
|
853
|
-
data: updatedData,
|
|
854
|
-
};
|
|
855
|
-
// Patch the state
|
|
856
1055
|
patchState(store, {
|
|
857
|
-
|
|
1056
|
+
previousSnapshot: store.snapshot(),
|
|
858
1057
|
data: updatedData,
|
|
859
1058
|
state: 'changed',
|
|
860
1059
|
lastChange: changeEvent,
|
|
861
1060
|
});
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
reset() {
|
|
865
|
-
const initialData = store.initial();
|
|
866
|
-
const changeEvent = {
|
|
867
|
-
oldValue: cloneDeep(store.data()), // Current data becomes old value
|
|
868
|
-
newValue: cloneDeep(initialData), // Reset to the initial state
|
|
869
|
-
path: '',
|
|
870
|
-
state: 'restored',
|
|
871
|
-
data: initialData,
|
|
872
|
-
};
|
|
873
|
-
patchState(store, {
|
|
874
|
-
previousSnapshot: store.snapshot(), // Save the previous state
|
|
875
|
-
data: initialData,
|
|
876
|
-
state: 'restored',
|
|
877
|
-
lastChange: changeEvent,
|
|
878
|
-
});
|
|
879
|
-
},
|
|
880
|
-
// Initialize the state
|
|
881
|
-
set(initialData) {
|
|
882
|
-
const currentData = store.data();
|
|
883
|
-
if (isEqual(currentData, initialData)) {
|
|
884
|
-
return; // Skip if the current state matches the initial state
|
|
1061
|
+
if (origin === 'user') {
|
|
1062
|
+
markUserDirtyPath(path);
|
|
885
1063
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
path:
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
1064
|
+
};
|
|
1065
|
+
const applyObjectPaths = (obj, options, prefix = '') => {
|
|
1066
|
+
for (const [key, value] of Object.entries(obj ?? {})) {
|
|
1067
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
1068
|
+
if (value !== null && isObject(value) && !Array.isArray(value)) {
|
|
1069
|
+
applyObjectPaths(value, options, path);
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
updateValue(path, value, options);
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
};
|
|
1076
|
+
return {
|
|
1077
|
+
// Update a specific value
|
|
1078
|
+
update(path, value, options) {
|
|
1079
|
+
updateValue(path, value, options);
|
|
1080
|
+
},
|
|
1081
|
+
applyObjectPaths,
|
|
1082
|
+
patch(context, second) {
|
|
1083
|
+
const options = resolvePatchOptions(second);
|
|
1084
|
+
const currentData = cloneDeep(store.data());
|
|
1085
|
+
const updatedData = { ...currentData, ...context };
|
|
1086
|
+
const origin = options.origin ?? 'system';
|
|
1087
|
+
const changeEvent = {
|
|
1088
|
+
state: 'patch',
|
|
1089
|
+
data: updatedData,
|
|
1090
|
+
origin,
|
|
1091
|
+
};
|
|
1092
|
+
const syncedSnapshot = cloneDeep(updatedData);
|
|
1093
|
+
patchState(store, {
|
|
1094
|
+
...(options.skipDirtyTracking
|
|
1095
|
+
? { initialSnapshot: syncedSnapshot, previousSnapshot: syncedSnapshot }
|
|
1096
|
+
: { previousSnapshot: store.snapshot() }),
|
|
1097
|
+
data: updatedData,
|
|
1098
|
+
state: 'changed',
|
|
1099
|
+
lastChange: changeEvent,
|
|
1100
|
+
});
|
|
1101
|
+
if (!options.skipDirtyTracking && origin === 'user') {
|
|
1102
|
+
Object.keys(context).forEach((key) => markUserDirtyPath(key));
|
|
1103
|
+
}
|
|
1104
|
+
},
|
|
1105
|
+
// Reset to the initial state
|
|
1106
|
+
reset() {
|
|
1107
|
+
const initialData = store.initial();
|
|
1108
|
+
const changeEvent = {
|
|
1109
|
+
oldValue: cloneDeep(store.data()), // Current data becomes old value
|
|
1110
|
+
newValue: cloneDeep(initialData), // Reset to the initial state
|
|
1111
|
+
path: '',
|
|
1112
|
+
state: 'restored',
|
|
1113
|
+
data: initialData,
|
|
1114
|
+
};
|
|
1115
|
+
patchState(store, {
|
|
1116
|
+
previousSnapshot: store.snapshot(), // Save the previous state
|
|
1117
|
+
data: initialData,
|
|
1118
|
+
state: 'restored',
|
|
1119
|
+
lastChange: changeEvent,
|
|
1120
|
+
userDirtyPaths: [],
|
|
1121
|
+
});
|
|
1122
|
+
},
|
|
1123
|
+
// Initialize the state
|
|
1124
|
+
set(initialData) {
|
|
1125
|
+
const currentData = store.data();
|
|
1126
|
+
if (isEqual(currentData, initialData)) {
|
|
1127
|
+
return; // Skip if the current state matches the initial state
|
|
1128
|
+
}
|
|
1129
|
+
const changeEvent = {
|
|
1130
|
+
oldValue: null,
|
|
1131
|
+
newValue: cloneDeep(initialData),
|
|
1132
|
+
path: '',
|
|
1133
|
+
state: 'initiated',
|
|
1134
|
+
data: initialData,
|
|
1135
|
+
};
|
|
1136
|
+
patchState(store, {
|
|
1137
|
+
initialSnapshot: cloneDeep(initialData), // Save the initial state
|
|
1138
|
+
previousSnapshot: store.snapshot(), // Save the current state as the previous
|
|
1139
|
+
data: initialData,
|
|
1140
|
+
state: 'initiated',
|
|
1141
|
+
lastChange: changeEvent,
|
|
1142
|
+
userDirtyPaths: [],
|
|
1143
|
+
});
|
|
1144
|
+
},
|
|
1145
|
+
// Get a specific value
|
|
1146
|
+
getValue(path) {
|
|
1147
|
+
return getSmart(store.data(), path);
|
|
1148
|
+
},
|
|
1149
|
+
// Check if a path exists in the context
|
|
1150
|
+
hasValue(path) {
|
|
1151
|
+
return has(store.data(), path);
|
|
1152
|
+
},
|
|
1153
|
+
/** Marks the current data as the clean baseline (after init/normalization settles). */
|
|
1154
|
+
commitBaseline() {
|
|
1155
|
+
const snapshot = cloneDeep(store.data());
|
|
1156
|
+
patchState(store, {
|
|
1157
|
+
initialSnapshot: snapshot,
|
|
1158
|
+
previousSnapshot: snapshot,
|
|
1159
|
+
state: 'initiated',
|
|
1160
|
+
userDirtyPaths: [],
|
|
1161
|
+
});
|
|
1162
|
+
},
|
|
1163
|
+
clearUserDirtyPaths,
|
|
1164
|
+
};
|
|
1165
|
+
}));
|
|
910
1166
|
//#endregion
|
|
911
1167
|
|
|
912
1168
|
class AXPExpressionEvaluatorScopeProviderContext {
|
|
@@ -4468,5 +4724,5 @@ function generateKebabCase(title) {
|
|
|
4468
4724
|
* Generated bundle index. Do not edit.
|
|
4469
4725
|
*/
|
|
4470
4726
|
|
|
4471
|
-
export { AXHighlightService, AXPActivityLogProvider, AXPActivityLogService, AXPAppStartUpProvider, AXPAppStartUpService, AXPBroadcastEventService, AXPColorPaletteProvider, AXPColorPaletteService, AXPColumnWidthService, AXPComponentLogoConfig, AXPComponentSlot, AXPComponentSlotDirective, AXPComponentSlotModule, AXPComponentSlotRegistryService, AXPContentCheckerDirective, AXPContextChangeEvent, AXPContextDefinitionProviderService, AXPContextStore, AXPCountdownPipe, AXPDataGenerator, AXPDataSourceDefinitionProviderService, AXPDblClickDirective, AXPDefaultColorPalettesProvider, AXPDeviceService, AXPDeviceType, AXPDistributedEventListenerService, AXPElementDataDirective, AXPExportTemplateToken, AXPExpressionEvaluatorScopeProviderContext, AXPExpressionEvaluatorScopeProviderService, AXPExpressionEvaluatorService, AXPFeatureDefinitionProviderContext, AXPGridLayoutDirective, AXPHookService, AXPIconLogoConfig, AXPImageUrlLogoConfig, AXPModuleManifestModule, AXPModuleManifestRegistry, AXPModuleManifestsDataSourceDefinition, AXPPlatformScope, AXPScreenSize, AXPSystemActionType, AXPSystemActions, AXPTagProvider, AXPTagService, AXP_ACTIVITY_LOG_PROVIDER, AXP_COLOR_PALETTE_PROVIDER, AXP_COLUMN_WIDTH_PROVIDER, AXP_CONTEXT_DEFINITION_PROVIDER, AXP_DATASOURCE_DEFINITION_PROVIDER, AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, AXP_FEATURE_DEFINITION_PROVIDER, AXP_MODULE_MANIFEST_PROVIDER, AXP_SESSION_SERVICE, AXP_TAG_PROVIDER, MODULE_MANIFESTS_DATASOURCE_NAME, applyFilterArray, applyPagination, applyQueryArray, applySortArray, applySystemActionDefault, cleanDeep, coerceUnknownToBoolean, coerceUnknownToDate, coerceUnknownToFiniteNumber, coerceUnknownToTrimmedString, compareMultiLanguageStrings, containsHtmlMarkup, createProviderWithInjectionContext, defaultColumnWidthProvider, extractNestedFieldsWildcard, extractTextFromHtml, extractValue, generateKebabCase, getActionButton, getChangedPaths, getDetailedChanges, getEnumValues, getNestedKeys, getSmart, getSystemActions, normalizeDefinitionCategories, objectKeyValueTransforms, provideLazyProvider, resolveActionLook, resolvePlatformScopeKey, resolvePlatformScopeName, searchInMultiLanguageString, setSmart, sortByMultiLanguageString, unwrapValueProperty };
|
|
4727
|
+
export { AXHighlightService, AXPActivityLogProvider, AXPActivityLogService, AXPAppStartUpProvider, AXPAppStartUpService, AXPBroadcastEventService, AXPCatalogScopeDefinitionProviderService, AXPCatalogScopeDefinitionsDataSourceDefinition, AXPColorPaletteProvider, AXPColorPaletteService, AXPColumnWidthService, AXPComponentLogoConfig, AXPComponentSlot, AXPComponentSlotDirective, AXPComponentSlotModule, AXPComponentSlotRegistryService, AXPContentCheckerDirective, AXPContextChangeEvent, AXPContextDefinitionProviderService, AXPContextStore, AXPCountdownPipe, AXPDataGenerator, AXPDataSourceDefinitionProviderService, AXPDblClickDirective, AXPDefaultColorPalettesProvider, AXPDeviceService, AXPDeviceType, AXPDistributedEventListenerService, AXPElementDataDirective, AXPExportTemplateToken, AXPExpressionEvaluatorScopeProviderContext, AXPExpressionEvaluatorScopeProviderService, AXPExpressionEvaluatorService, AXPFeatureDefinitionProviderContext, AXPGridLayoutDirective, AXPHookService, AXPIconLogoConfig, AXPImageUrlLogoConfig, AXPModuleManifestModule, AXPModuleManifestRegistry, AXPModuleManifestsDataSourceDefinition, AXPPlatformScope, AXPScreenSize, AXPSystemActionType, AXPSystemActions, AXPTagProvider, AXPTagService, AXP_ACTIVITY_LOG_PROVIDER, AXP_CATALOG_SCOPE_DEFINITION_PROVIDER, AXP_COLOR_PALETTE_PROVIDER, AXP_COLUMN_WIDTH_PROVIDER, AXP_CONTEXT_DEFINITION_PROVIDER, AXP_DATASOURCE_DEFINITION_PROVIDER, AXP_DISTRIBUTED_EVENT_LISTENER_PROVIDER, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, AXP_FEATURE_DEFINITION_PROVIDER, AXP_MODULE_MANIFEST_PROVIDER, AXP_SESSION_SERVICE, AXP_TAG_PROVIDER, MODULE_MANIFESTS_DATASOURCE_NAME, PLATFORM_CATALOG_SCOPES_DATASOURCE_NAME, applyFilterArray, applyPagination, applyQueryArray, applySortArray, applySystemActionDefault, captureFormContextBaseline, cleanDeep, coerceUnknownToBoolean, coerceUnknownToDate, coerceUnknownToFiniteNumber, coerceUnknownToTrimmedString, compareMultiLanguageStrings, containsHtmlMarkup, createProviderWithInjectionContext, defaultColumnWidthProvider, extractNestedFieldsWildcard, extractTextFromHtml, extractValue, generateKebabCase, getActionButton, getChangedPaths, getDetailedChanges, getEnumValues, getNestedKeys, getSmart, getSystemActions, isFormContextDirty, normalizeDefinitionCategories, objectKeyValueTransforms, provideLazyProvider, resolveActionLook, resolvePlatformScopeKey, resolvePlatformScopeName, searchInMultiLanguageString, setSmart, sortByMultiLanguageString, unwrapValueProperty };
|
|
4472
4728
|
//# sourceMappingURL=acorex-platform-core.mjs.map
|