@acorex/platform 19.3.8 → 19.4.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.
- package/auth/lib/permission/permission-definition.builder.d.ts +2 -2
- package/auth/lib/permission/permission.types.d.ts +1 -1
- package/common/index.d.ts +0 -1
- package/common/lib/layout/index.d.ts +0 -2
- package/common/lib/layout/menu/badge-helper.d.ts +2 -2
- package/core/index.d.ts +8 -1
- package/core/lib/context/context-store.service.d.ts +37 -0
- package/core/lib/directives/content-checker.directive.d.ts +10 -0
- package/core/lib/directives/index.d.ts +1 -0
- package/core/lib/expression-evaluator/expression-evaluator-scope-provider.service.d.ts +23 -0
- package/core/lib/expression-evaluator/expression-evaluator.service.d.ts +2 -0
- package/core/lib/expression-evaluator/index.d.ts +1 -0
- package/core/lib/types/interactive.types.d.ts +1 -0
- package/domain/README.md +3 -0
- package/domain/index.d.ts +2 -0
- package/domain/lib/domain.module.d.ts +8 -0
- package/domain/lib/provide-entity-crud-commands.d.ts +4 -0
- package/fesm2022/acorex-platform-auth.mjs.map +1 -1
- package/fesm2022/acorex-platform-common.mjs +2 -202
- package/fesm2022/acorex-platform-common.mjs.map +1 -1
- package/fesm2022/acorex-platform-core.mjs +312 -127
- package/fesm2022/acorex-platform-core.mjs.map +1 -1
- package/fesm2022/acorex-platform-domain.mjs +71 -0
- package/fesm2022/acorex-platform-domain.mjs.map +1 -0
- package/fesm2022/acorex-platform-layout-builder.mjs +5 -1
- package/fesm2022/acorex-platform-layout-builder.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-components.mjs +667 -3
- package/fesm2022/acorex-platform-layout-components.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-entity.mjs +53 -4
- package/fesm2022/acorex-platform-layout-entity.mjs.map +1 -1
- package/fesm2022/acorex-platform-layout-views.mjs +442 -3
- package/fesm2022/acorex-platform-layout-views.mjs.map +1 -1
- package/fesm2022/acorex-platform-runtime.mjs +448 -0
- package/fesm2022/acorex-platform-runtime.mjs.map +1 -0
- package/fesm2022/{acorex-platform-themes-default-details-view.component-w1GLOu_c.mjs → acorex-platform-themes-default-details-view.component-DXwO-Euo.mjs} +7 -8
- package/fesm2022/acorex-platform-themes-default-details-view.component-DXwO-Euo.mjs.map +1 -0
- package/fesm2022/{acorex-platform-themes-default-entity-master-list-view.component-C8rL7vLD.mjs → acorex-platform-themes-default-entity-master-list-view.component-C0aVy6kW.mjs} +15 -13
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-C0aVy6kW.mjs.map +1 -0
- package/fesm2022/{acorex-platform-themes-default-entity-master-single-view.component-qu3j-fxn.mjs → acorex-platform-themes-default-entity-master-single-view.component-WYpSnpSx.mjs} +34 -13
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-WYpSnpSx.mjs.map +1 -0
- package/fesm2022/acorex-platform-themes-default.mjs +48 -285
- package/fesm2022/acorex-platform-themes-default.mjs.map +1 -1
- package/fesm2022/acorex-platform-themes-shared.mjs +8 -415
- package/fesm2022/acorex-platform-themes-shared.mjs.map +1 -1
- package/fesm2022/{acorex-platform-widgets-button-widget-designer.component-i8FcuktZ.mjs → acorex-platform-widgets-button-widget-designer.component-BWZ0L--k.mjs} +4 -4
- package/fesm2022/acorex-platform-widgets-button-widget-designer.component-BWZ0L--k.mjs.map +1 -0
- package/fesm2022/{acorex-platform-widgets-checkbox-widget-column.component-BQcHI7vG.mjs → acorex-platform-widgets-checkbox-widget-column.component-Bq8dCQJb.mjs} +3 -3
- package/fesm2022/acorex-platform-widgets-checkbox-widget-column.component-Bq8dCQJb.mjs.map +1 -0
- package/fesm2022/acorex-platform-widgets.mjs +529 -118
- package/fesm2022/acorex-platform-widgets.mjs.map +1 -1
- package/fesm2022/acorex-platform-workflow.mjs +22 -3
- package/fesm2022/acorex-platform-workflow.mjs.map +1 -1
- package/layout/builder/lib/builder/widget-base.component.d.ts +1 -0
- package/layout/builder/lib/builder/widget-map.d.ts +1 -0
- package/layout/components/index.d.ts +3 -0
- package/{common/lib/layout/task-badge → layout/components/lib/badge}/index.d.ts +1 -0
- package/{themes/shared/lib/components/layout-elements → layout/components/lib/blocks}/index.d.ts +1 -0
- package/layout/components/lib/blocks/layout-blocks.component.d.ts +8 -0
- package/layout/components/lib/blocks/layout-container.component.d.ts +13 -0
- package/{common/lib/layout → layout/components/lib}/component-slot/component-slot-loader.service.d.ts +5 -4
- package/{common/lib/layout → layout/components/lib}/component-slot/component-slot.directive.d.ts +5 -5
- package/layout/components/lib/component-slot/component-slot.types.d.ts +22 -0
- package/layout/entity/lib/entity-master-list.viewmodel.d.ts +4 -2
- package/layout/entity/lib/widgets/lookup-widget/lookup-widget-column.component.d.ts +1 -1
- package/layout/entity/lib/workflows/modify-entity.workflow.d.ts +6 -0
- package/layout/views/index.d.ts +2 -1
- package/layout/views/lib/layouts/index.d.ts +2 -0
- package/layout/views/lib/layouts/page/index.d.ts +3 -0
- package/{themes/default/lib/layouts/base/base-page.component.d.ts → layout/views/lib/layouts/page/page-layout-base.component.d.ts} +6 -4
- package/{themes/default/lib/layouts/base/base-page.types.d.ts → layout/views/lib/layouts/page/page-layout.base.d.ts} +1 -1
- package/{themes/default/lib/layouts/base/page-layout → layout/views/lib/layouts/page}/page-layout.component.d.ts +4 -2
- package/layout/views/lib/layouts/popup/index.d.ts +3 -0
- package/layout/views/lib/layouts/popup/popup-layout-base.component.d.ts +98 -0
- package/layout/views/lib/layouts/popup/popup-layout.base.d.ts +14 -0
- package/layout/views/lib/layouts/popup/popup-layout.component.d.ts +76 -0
- package/layout/views/lib/{details-view → views/details-view}/details-view.adapter.d.ts +1 -1
- package/layout/views/lib/views/index.d.ts +1 -0
- package/package.json +15 -7
- package/runtime/README.md +3 -0
- package/runtime/index.d.ts +17 -0
- package/runtime/lib/commands/command.extension.token.d.ts +7 -0
- package/runtime/lib/commands/command.interface.d.ts +3 -0
- package/runtime/lib/commands/command.middleware.d.ts +2 -0
- package/runtime/lib/commands/command.registry.d.ts +16 -0
- package/runtime/lib/commands/provide-command-middleware.d.ts +9 -0
- package/runtime/lib/commands/provide-command-setups.d.ts +9 -0
- package/runtime/lib/policy/policy-middleware-provider.d.ts +9 -0
- package/runtime/lib/policy/policy.directive.d.ts +9 -0
- package/runtime/lib/policy/policy.extension.token.d.ts +7 -0
- package/runtime/lib/policy/policy.interface.d.ts +17 -0
- package/runtime/lib/policy/policy.middleware.d.ts +3 -0
- package/runtime/lib/policy/policy.registry.d.ts +19 -0
- package/runtime/lib/policy/policy.service.d.ts +8 -0
- package/runtime/lib/policy/policy.types.d.ts +7 -0
- package/runtime/lib/queries/provide-query-middleware.d.ts +9 -0
- package/runtime/lib/queries/provide-query-setups.d.ts +9 -0
- package/runtime/lib/queries/query.extension.token.d.ts +7 -0
- package/runtime/lib/queries/query.interface.d.ts +3 -0
- package/runtime/lib/queries/query.middleware.d.ts +2 -0
- package/runtime/lib/queries/query.registry.d.ts +15 -0
- package/runtime/lib/runtime.module.d.ts +12 -0
- package/themes/default/index.d.ts +0 -1
- package/themes/default/lib/layouts/details-view/details-view.component.d.ts +2 -2
- package/themes/default/lib/layouts/entity-layouts/entity-master-list-view/entity-master-list-view.component.d.ts +2 -2
- package/themes/default/lib/layouts/entity-layouts/entity-master-single-view/entity-master-single-view.component.d.ts +29 -2
- package/themes/default/lib/layouts/root-layout/components/horizontal-menu/horizontal-menu.component.d.ts +2 -1
- package/themes/default/lib/layouts/root-layout/components/side-menu/side-menu.component.d.ts +2 -1
- package/themes/default/lib/layouts/root-layout/root-layout.component.d.ts +1 -0
- package/themes/shared/index.d.ts +1 -3
- package/themes/shared/lib/shared.module.d.ts +1 -1
- package/themes/shared/lib/{components/slots → slots}/theme-slot.component.d.ts +9 -9
- package/widgets/lib/widgets/advance/avatar/avatar-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/advance/cron-job/cron-job-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/advance/file-uploader/file-uploader-widget-column.component.d.ts +6 -0
- package/widgets/lib/widgets/advance/file-uploader/file-uploader-widget-edit.component.d.ts +33 -0
- package/widgets/lib/widgets/advance/file-uploader/file-uploader-widget-filter.component.d.ts +6 -0
- package/widgets/lib/widgets/advance/file-uploader/file-uploader-widget-print.component.d.ts +6 -0
- package/widgets/lib/widgets/advance/file-uploader/file-uploader-widget-view.component.d.ts +31 -0
- package/widgets/lib/widgets/advance/file-uploader/file-uploader-widget.config.d.ts +7 -0
- package/widgets/lib/widgets/advance/file-uploader/file-uploader-widget.service.d.ts +12 -0
- package/widgets/lib/widgets/advance/file-uploader/index.d.ts +7 -0
- package/widgets/lib/widgets/editors/checkbox/checkbox-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/color/color-box-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/contact/contact-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/date-time/date-time-box-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/email/email-box-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/large-text/large-text-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/link/link-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/meta-data/meta-data-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/number/number-box-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/number-unit/number-unit-box-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/password/password-box-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/phone/phone-box-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/rich-text/rich-text-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/select/select-box-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/selection-list/selection-list-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/tabular-data/tabular-data-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/text/text-box-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/time-duration/time-duration-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/editors/toggle/toggle-widget-column.component.d.ts +1 -1
- package/widgets/lib/widgets/index.d.ts +1 -0
- package/workflow/lib/slots/workflow-action-bar/workflow-action-bar.component.d.ts +36 -0
- package/workflow/lib/workflow-evaluator-scope.provider.d.ts +4 -0
- package/common/lib/layout/beardcrumb.type.d.ts +0 -6
- package/common/lib/layout/component-slot/component-slot.types.d.ts +0 -15
- package/core/lib/index.d.ts +0 -7
- package/fesm2022/acorex-platform-themes-default-details-view.component-w1GLOu_c.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-list-view.component-C8rL7vLD.mjs.map +0 -1
- package/fesm2022/acorex-platform-themes-default-entity-master-single-view.component-qu3j-fxn.mjs.map +0 -1
- package/fesm2022/acorex-platform-widgets-button-widget-designer.component-i8FcuktZ.mjs.map +0 -1
- package/fesm2022/acorex-platform-widgets-checkbox-widget-column.component-BQcHI7vG.mjs.map +0 -1
- package/themes/default/lib/layouts/base/index.d.ts +0 -3
- package/themes/default/lib/layouts/base/page-layout/index.d.ts +0 -1
- package/themes/shared/lib/components/layout-elements/layout-blocks.component.d.ts +0 -8
- /package/{themes/shared/lib/components → layout/components/lib}/badge/badge.directive.d.ts +0 -0
- /package/{common/lib/layout/task-badge → layout/components/lib/badge}/task-badge.service.d.ts +0 -0
- /package/{common/lib/layout/task-badge → layout/components/lib/badge}/task-badge.type.d.ts +0 -0
- /package/{themes/shared/lib/components/layout-elements → layout/components/lib/blocks}/layout-actions.component.d.ts +0 -0
- /package/{themes/shared/lib/components/layout-elements → layout/components/lib/blocks}/layout-footer.component.d.ts +0 -0
- /package/{themes/shared/lib/components/layout-elements → layout/components/lib/blocks}/layout-header.component.d.ts +0 -0
- /package/{themes/shared/lib/components/layout-elements → layout/components/lib/blocks}/layout-list.component.d.ts +0 -0
- /package/{themes/shared/lib/components/layout-elements → layout/components/lib/blocks}/layout-section.component.d.ts +0 -0
- /package/{themes/shared/lib/components/layout-elements → layout/components/lib/blocks}/layout-side.component.d.ts +0 -0
- /package/{themes/shared/lib/components/layout-elements → layout/components/lib/blocks}/layout-tool-bar.component.d.ts +0 -0
- /package/{common/lib/layout → layout/components/lib}/component-slot/component-slot-registery.service.d.ts +0 -0
- /package/{common/lib/layout → layout/components/lib}/component-slot/component-slot.module.d.ts +0 -0
- /package/{common/lib/layout → layout/components/lib}/component-slot/index.d.ts +0 -0
- /package/layout/views/lib/{details-view → views/details-view}/details-view-route.resolver.d.ts +0 -0
- /package/layout/views/lib/{details-view → views/details-view}/details-view.viewmodel.d.ts +0 -0
- /package/layout/views/lib/{details-view → views/details-view}/index.d.ts +0 -0
- /package/layout/views/lib/{details-view → views/details-view}/sample.d.ts +0 -0
|
@@ -1,10 +1,245 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { signalStore, withState, withComputed, withMethods, patchState } from '@ngrx/signals';
|
|
2
|
+
import { get, isPlainObject, set, isArray, merge, isNil, isObjectLike, transform, isEmpty, cloneDeep, isEqual, isUndefined, endsWith, startsWith, includes, lte, gte, lt, gt, orderBy } from 'lodash-es';
|
|
2
3
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, inject, Injectable, input, effect, Directive, EventEmitter, HostListener, Output, signal, Pipe, provideAppInitializer } from '@angular/core';
|
|
4
|
+
import { computed, InjectionToken, inject, Injectable, input, effect, Directive, EventEmitter, HostListener, Output, ViewContainerRef, ElementRef, signal, Pipe, provideAppInitializer } from '@angular/core';
|
|
4
5
|
import { Subject, interval } from 'rxjs';
|
|
5
6
|
import { AXCalendarService } from '@acorex/core/date-time';
|
|
6
7
|
import { startWith, map } from 'rxjs/operators';
|
|
7
8
|
|
|
9
|
+
function extractNestedFieldsWildcard(obj, basePath, fields) {
|
|
10
|
+
const result = {};
|
|
11
|
+
if (fields.length === 1 && fields[0] === '*') {
|
|
12
|
+
const fullObj = get(obj, basePath);
|
|
13
|
+
return isPlainObject(fullObj) ? fullObj : {};
|
|
14
|
+
}
|
|
15
|
+
for (const field of fields) {
|
|
16
|
+
const fullPath = basePath ? `${basePath}.${field}` : field;
|
|
17
|
+
const value = get(obj, fullPath);
|
|
18
|
+
set(result, field, value);
|
|
19
|
+
}
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
function setSmart(obj, smartPath, value) {
|
|
23
|
+
const pathParts = smartPath.split('.');
|
|
24
|
+
const lastPart = pathParts[pathParts.length - 1];
|
|
25
|
+
const fieldMatch = lastPart.match(/^\{(.+)\}$/);
|
|
26
|
+
if (!fieldMatch) {
|
|
27
|
+
set(obj, smartPath, value);
|
|
28
|
+
return obj;
|
|
29
|
+
}
|
|
30
|
+
const fields = fieldMatch[1].split(',').map((f) => f.trim());
|
|
31
|
+
const basePath = pathParts.slice(0, -1).join('.');
|
|
32
|
+
const [arrayKey, ...restPath] = basePath.split('.');
|
|
33
|
+
// Make sure the array exists
|
|
34
|
+
if (!obj[arrayKey])
|
|
35
|
+
obj[arrayKey] = [];
|
|
36
|
+
// 🟡 Case A: value is array (normal set)
|
|
37
|
+
if (isArray(value)) {
|
|
38
|
+
for (let i = 0; i < value.length; i++) {
|
|
39
|
+
const item = value[i];
|
|
40
|
+
const targetItem = obj[arrayKey][i] ?? {};
|
|
41
|
+
const nested = {};
|
|
42
|
+
if (restPath.length > 0) {
|
|
43
|
+
const picked = extractNestedFieldsWildcard(item, restPath.join('.'), fields);
|
|
44
|
+
set(nested, restPath.join('.'), picked);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const picked = extractNestedFieldsWildcard(item, '', fields);
|
|
48
|
+
Object.assign(nested, picked);
|
|
49
|
+
}
|
|
50
|
+
obj[arrayKey][i] = merge({}, targetItem, nested);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// 🟢 Case B: value is a single value → broadcast
|
|
54
|
+
else {
|
|
55
|
+
for (let i = 0; i < obj[arrayKey].length; i++) {
|
|
56
|
+
const targetItem = obj[arrayKey][i] ?? {};
|
|
57
|
+
const nested = {};
|
|
58
|
+
if (restPath.length > 0) {
|
|
59
|
+
for (const field of fields) {
|
|
60
|
+
set(nested, `${restPath.join('.')}.${field}`, value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
for (const field of fields) {
|
|
65
|
+
set(nested, field, value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
obj[arrayKey][i] = merge({}, targetItem, nested);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
function extractFieldsFromPath(obj, basePath, fields) {
|
|
74
|
+
if (fields.length === 1 && fields[0] === '*') {
|
|
75
|
+
const fullObj = basePath ? get(obj, basePath) : obj;
|
|
76
|
+
return isPlainObject(fullObj) ? fullObj : {};
|
|
77
|
+
}
|
|
78
|
+
const result = {};
|
|
79
|
+
for (const field of fields) {
|
|
80
|
+
const fullPath = basePath ? `${basePath}.${field}` : field;
|
|
81
|
+
const val = get(obj, fullPath);
|
|
82
|
+
if (val !== undefined) {
|
|
83
|
+
result[field] = val;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
function getSmart(obj, smartPath) {
|
|
89
|
+
const pathParts = smartPath.split('.');
|
|
90
|
+
const lastPart = pathParts[pathParts.length - 1];
|
|
91
|
+
const fieldMatch = lastPart.match(/^\{(.+)\}$/);
|
|
92
|
+
// Simple get (no fields)
|
|
93
|
+
if (!fieldMatch) {
|
|
94
|
+
return get(obj, smartPath);
|
|
95
|
+
}
|
|
96
|
+
const fields = fieldMatch[1].split(',').map((f) => f.trim());
|
|
97
|
+
const basePath = pathParts.slice(0, -1).join('.');
|
|
98
|
+
const items = get(obj, basePath);
|
|
99
|
+
if (!isArray(items))
|
|
100
|
+
return [];
|
|
101
|
+
const nestedPath = basePath.includes('.') ? basePath.split('.').slice(1).join('.') : '';
|
|
102
|
+
return items.map((item) => {
|
|
103
|
+
return extractFieldsFromPath(item, nestedPath, fields);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function extractValue(value, key = 'id') {
|
|
107
|
+
if (isNil(value)) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
;
|
|
111
|
+
return isObjectLike(value) ? get(value, key) : value;
|
|
112
|
+
}
|
|
113
|
+
function cleanDeep(obj) {
|
|
114
|
+
return transform(obj, (result, value, key) => {
|
|
115
|
+
if (isObjectLike(value)) {
|
|
116
|
+
const cleaned = cleanDeep(value);
|
|
117
|
+
if (!isEmpty(cleaned)) {
|
|
118
|
+
result[key] = cleaned;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else if (!isNil(value) && // not null or undefined
|
|
122
|
+
!(typeof value === 'string' && value.trim() === '') && // not empty string
|
|
123
|
+
!(Array.isArray(value) && value.length === 0) // not empty array
|
|
124
|
+
) {
|
|
125
|
+
result[key] = value;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
class AXPContextChangeEvent {
|
|
131
|
+
}
|
|
132
|
+
const AXPContextStore = signalStore({
|
|
133
|
+
providedIn: 'root',
|
|
134
|
+
},
|
|
135
|
+
// Initial State
|
|
136
|
+
withState(() => ({
|
|
137
|
+
data: {}, // Shared context data
|
|
138
|
+
state: 'initiated', // Current state
|
|
139
|
+
initialSnapshot: {}, // Snapshot of the first initialized state
|
|
140
|
+
previousSnapshot: {}, // Snapshot of the previous state
|
|
141
|
+
lastChange: {
|
|
142
|
+
state: 'initiated',
|
|
143
|
+
}, // Last change event
|
|
144
|
+
})),
|
|
145
|
+
// Computed Signals
|
|
146
|
+
withComputed(({ data, state, lastChange, initialSnapshot, previousSnapshot }) => ({
|
|
147
|
+
isChanged: computed(() => state() === 'changed'),
|
|
148
|
+
isReset: computed(() => state() === 'restored'),
|
|
149
|
+
isInitiated: computed(() => state() === 'initiated'),
|
|
150
|
+
isEmpty: computed(() => Object.keys(data()).length === 0),
|
|
151
|
+
snapshot: computed(() => cloneDeep(data())), // Current data snapshot
|
|
152
|
+
initial: computed(() => cloneDeep(initialSnapshot())), // Initial snapshot
|
|
153
|
+
previous: computed(() => cloneDeep(previousSnapshot())), // Previous snapshot
|
|
154
|
+
changeEvent: computed(() => lastChange()), // Reactive last change event
|
|
155
|
+
})),
|
|
156
|
+
// Methods for State Management
|
|
157
|
+
withMethods((store) => ({
|
|
158
|
+
// Update a specific value
|
|
159
|
+
update(path, value) {
|
|
160
|
+
const currentData = cloneDeep(store.data());
|
|
161
|
+
const oldValue = getSmart(currentData, path);
|
|
162
|
+
// Skip if the value hasn't changed
|
|
163
|
+
if (isEqual(oldValue, value)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
// Update the value and prepare the change event
|
|
167
|
+
const updatedData = setSmart(currentData, path, value);
|
|
168
|
+
const changeEvent = {
|
|
169
|
+
oldValue,
|
|
170
|
+
newValue: value,
|
|
171
|
+
path,
|
|
172
|
+
state: 'changed',
|
|
173
|
+
data: updatedData,
|
|
174
|
+
};
|
|
175
|
+
// Patch the state
|
|
176
|
+
patchState(store, {
|
|
177
|
+
previousSnapshot: store.snapshot(), // Save the previous state
|
|
178
|
+
data: updatedData,
|
|
179
|
+
state: 'changed',
|
|
180
|
+
lastChange: changeEvent,
|
|
181
|
+
});
|
|
182
|
+
},
|
|
183
|
+
patch(context) {
|
|
184
|
+
const currentData = cloneDeep(store.data());
|
|
185
|
+
// Update the value and prepare the change event
|
|
186
|
+
const updatedData = { ...currentData, ...context };
|
|
187
|
+
const changeEvent = {
|
|
188
|
+
state: 'patch',
|
|
189
|
+
data: updatedData,
|
|
190
|
+
};
|
|
191
|
+
// Patch the state
|
|
192
|
+
patchState(store, {
|
|
193
|
+
previousSnapshot: store.snapshot(), // Save the previous state
|
|
194
|
+
data: updatedData,
|
|
195
|
+
state: 'changed',
|
|
196
|
+
lastChange: changeEvent,
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
// Reset to the initial state
|
|
200
|
+
reset() {
|
|
201
|
+
const initialData = store.initial();
|
|
202
|
+
const changeEvent = {
|
|
203
|
+
oldValue: cloneDeep(store.data()), // Current data becomes old value
|
|
204
|
+
newValue: cloneDeep(initialData), // Reset to the initial state
|
|
205
|
+
path: '',
|
|
206
|
+
state: 'restored',
|
|
207
|
+
data: initialData,
|
|
208
|
+
};
|
|
209
|
+
patchState(store, {
|
|
210
|
+
previousSnapshot: store.snapshot(), // Save the previous state
|
|
211
|
+
data: initialData,
|
|
212
|
+
state: 'restored',
|
|
213
|
+
lastChange: changeEvent,
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
// Initialize the state
|
|
217
|
+
set(initialData) {
|
|
218
|
+
const currentData = store.data();
|
|
219
|
+
if (isEqual(currentData, initialData)) {
|
|
220
|
+
return; // Skip if the current state matches the initial state
|
|
221
|
+
}
|
|
222
|
+
const changeEvent = {
|
|
223
|
+
oldValue: null,
|
|
224
|
+
newValue: cloneDeep(initialData),
|
|
225
|
+
path: '',
|
|
226
|
+
state: 'initiated',
|
|
227
|
+
data: initialData,
|
|
228
|
+
};
|
|
229
|
+
patchState(store, {
|
|
230
|
+
initialSnapshot: cloneDeep(initialData), // Save the initial state
|
|
231
|
+
previousSnapshot: store.snapshot(), // Save the current state as the previous
|
|
232
|
+
data: initialData,
|
|
233
|
+
state: 'initiated',
|
|
234
|
+
lastChange: changeEvent,
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
// Get a specific value
|
|
238
|
+
getValue(path) {
|
|
239
|
+
return getSmart(store.data(), path);
|
|
240
|
+
},
|
|
241
|
+
})));
|
|
242
|
+
|
|
8
243
|
class AXPDataGenerator {
|
|
9
244
|
static uuid() {
|
|
10
245
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (char) => {
|
|
@@ -175,127 +410,6 @@ class AXPDataGenerator {
|
|
|
175
410
|
}
|
|
176
411
|
}
|
|
177
412
|
|
|
178
|
-
function extractNestedFieldsWildcard(obj, basePath, fields) {
|
|
179
|
-
const result = {};
|
|
180
|
-
if (fields.length === 1 && fields[0] === '*') {
|
|
181
|
-
const fullObj = get(obj, basePath);
|
|
182
|
-
return isPlainObject(fullObj) ? fullObj : {};
|
|
183
|
-
}
|
|
184
|
-
for (const field of fields) {
|
|
185
|
-
const fullPath = basePath ? `${basePath}.${field}` : field;
|
|
186
|
-
const value = get(obj, fullPath);
|
|
187
|
-
set(result, field, value);
|
|
188
|
-
}
|
|
189
|
-
return result;
|
|
190
|
-
}
|
|
191
|
-
function setSmart(obj, smartPath, value) {
|
|
192
|
-
const pathParts = smartPath.split('.');
|
|
193
|
-
const lastPart = pathParts[pathParts.length - 1];
|
|
194
|
-
const fieldMatch = lastPart.match(/^\{(.+)\}$/);
|
|
195
|
-
if (!fieldMatch) {
|
|
196
|
-
set(obj, smartPath, value);
|
|
197
|
-
return obj;
|
|
198
|
-
}
|
|
199
|
-
const fields = fieldMatch[1].split(',').map((f) => f.trim());
|
|
200
|
-
const basePath = pathParts.slice(0, -1).join('.');
|
|
201
|
-
const [arrayKey, ...restPath] = basePath.split('.');
|
|
202
|
-
// Make sure the array exists
|
|
203
|
-
if (!obj[arrayKey])
|
|
204
|
-
obj[arrayKey] = [];
|
|
205
|
-
// 🟡 Case A: value is array (normal set)
|
|
206
|
-
if (isArray(value)) {
|
|
207
|
-
for (let i = 0; i < value.length; i++) {
|
|
208
|
-
const item = value[i];
|
|
209
|
-
const targetItem = obj[arrayKey][i] ?? {};
|
|
210
|
-
const nested = {};
|
|
211
|
-
if (restPath.length > 0) {
|
|
212
|
-
const picked = extractNestedFieldsWildcard(item, restPath.join('.'), fields);
|
|
213
|
-
set(nested, restPath.join('.'), picked);
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
const picked = extractNestedFieldsWildcard(item, '', fields);
|
|
217
|
-
Object.assign(nested, picked);
|
|
218
|
-
}
|
|
219
|
-
obj[arrayKey][i] = merge({}, targetItem, nested);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
// 🟢 Case B: value is a single value → broadcast
|
|
223
|
-
else {
|
|
224
|
-
for (let i = 0; i < obj[arrayKey].length; i++) {
|
|
225
|
-
const targetItem = obj[arrayKey][i] ?? {};
|
|
226
|
-
const nested = {};
|
|
227
|
-
if (restPath.length > 0) {
|
|
228
|
-
for (const field of fields) {
|
|
229
|
-
set(nested, `${restPath.join('.')}.${field}`, value);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
else {
|
|
233
|
-
for (const field of fields) {
|
|
234
|
-
set(nested, field, value);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
obj[arrayKey][i] = merge({}, targetItem, nested);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return obj;
|
|
241
|
-
}
|
|
242
|
-
function extractFieldsFromPath(obj, basePath, fields) {
|
|
243
|
-
if (fields.length === 1 && fields[0] === '*') {
|
|
244
|
-
const fullObj = basePath ? get(obj, basePath) : obj;
|
|
245
|
-
return isPlainObject(fullObj) ? fullObj : {};
|
|
246
|
-
}
|
|
247
|
-
const result = {};
|
|
248
|
-
for (const field of fields) {
|
|
249
|
-
const fullPath = basePath ? `${basePath}.${field}` : field;
|
|
250
|
-
const val = get(obj, fullPath);
|
|
251
|
-
if (val !== undefined) {
|
|
252
|
-
result[field] = val;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
return result;
|
|
256
|
-
}
|
|
257
|
-
function getSmart(obj, smartPath) {
|
|
258
|
-
const pathParts = smartPath.split('.');
|
|
259
|
-
const lastPart = pathParts[pathParts.length - 1];
|
|
260
|
-
const fieldMatch = lastPart.match(/^\{(.+)\}$/);
|
|
261
|
-
// Simple get (no fields)
|
|
262
|
-
if (!fieldMatch) {
|
|
263
|
-
return get(obj, smartPath);
|
|
264
|
-
}
|
|
265
|
-
const fields = fieldMatch[1].split(',').map((f) => f.trim());
|
|
266
|
-
const basePath = pathParts.slice(0, -1).join('.');
|
|
267
|
-
const items = get(obj, basePath);
|
|
268
|
-
if (!isArray(items))
|
|
269
|
-
return [];
|
|
270
|
-
const nestedPath = basePath.includes('.') ? basePath.split('.').slice(1).join('.') : '';
|
|
271
|
-
return items.map((item) => {
|
|
272
|
-
return extractFieldsFromPath(item, nestedPath, fields);
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
function extractValue(value, key = 'id') {
|
|
276
|
-
if (isNil(value)) {
|
|
277
|
-
return null;
|
|
278
|
-
}
|
|
279
|
-
;
|
|
280
|
-
return isObjectLike(value) ? get(value, key) : value;
|
|
281
|
-
}
|
|
282
|
-
function cleanDeep(obj) {
|
|
283
|
-
return transform(obj, (result, value, key) => {
|
|
284
|
-
if (isObjectLike(value)) {
|
|
285
|
-
const cleaned = cleanDeep(value);
|
|
286
|
-
if (!isEmpty(cleaned)) {
|
|
287
|
-
result[key] = cleaned;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
else if (!isNil(value) && // not null or undefined
|
|
291
|
-
!(typeof value === 'string' && value.trim() === '') && // not empty string
|
|
292
|
-
!(Array.isArray(value) && value.length === 0) // not empty array
|
|
293
|
-
) {
|
|
294
|
-
result[key] = value;
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
|
|
299
413
|
function objectKeyValueTransforms(keyName) {
|
|
300
414
|
return {
|
|
301
415
|
getter: (value) => {
|
|
@@ -469,6 +583,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
|
469
583
|
}]
|
|
470
584
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }] });
|
|
471
585
|
|
|
586
|
+
// src/app/directives/grid-layout.directive.ts
|
|
587
|
+
class AXPContentCheckerDirective {
|
|
588
|
+
constructor() {
|
|
589
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
|
590
|
+
this.elementRef = inject((ElementRef));
|
|
591
|
+
this.isEmpty = computed(() => this.viewContainerRef.length === 0);
|
|
592
|
+
}
|
|
593
|
+
ngAfterViewInit() {
|
|
594
|
+
setTimeout(() => {
|
|
595
|
+
console.log(this.elementRef.nativeElement.childNodes);
|
|
596
|
+
}, 1000);
|
|
597
|
+
}
|
|
598
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPContentCheckerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
599
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.10", type: AXPContentCheckerDirective, isStandalone: true, selector: "[axp-content-checker]", exportAs: ["checker"], ngImport: i0 }); }
|
|
600
|
+
}
|
|
601
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPContentCheckerDirective, decorators: [{
|
|
602
|
+
type: Directive,
|
|
603
|
+
args: [{
|
|
604
|
+
selector: '[axp-content-checker]',
|
|
605
|
+
standalone: true,
|
|
606
|
+
exportAs: 'checker'
|
|
607
|
+
}]
|
|
608
|
+
}] });
|
|
609
|
+
|
|
472
610
|
class AXPBroadcastEventService {
|
|
473
611
|
constructor() {
|
|
474
612
|
this.eventSubjects = new Map();
|
|
@@ -583,10 +721,51 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
|
|
|
583
721
|
}]
|
|
584
722
|
}], ctorParameters: () => [] });
|
|
585
723
|
|
|
724
|
+
class AXPExpressionEvaluatorScopeProviderContext {
|
|
725
|
+
constructor() {
|
|
726
|
+
this.scopes = {};
|
|
727
|
+
}
|
|
728
|
+
addScope(namespace, functions) {
|
|
729
|
+
this.scopes[namespace] = { ...this.scopes[namespace], ...functions };
|
|
730
|
+
}
|
|
731
|
+
getScopes() {
|
|
732
|
+
return this.scopes;
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
const AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER = new InjectionToken('AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER');
|
|
736
|
+
class AXPExpressionEvaluatorScopeProviderService {
|
|
737
|
+
constructor() {
|
|
738
|
+
this.providers = inject(AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, { optional: true });
|
|
739
|
+
this.cache = null;
|
|
740
|
+
}
|
|
741
|
+
async load() {
|
|
742
|
+
if (this.cache)
|
|
743
|
+
return;
|
|
744
|
+
const context = new AXPExpressionEvaluatorScopeProviderContext();
|
|
745
|
+
if (Array.isArray(this.providers)) {
|
|
746
|
+
for (const provider of this.providers) {
|
|
747
|
+
await provider.provide(context);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
this.cache = context.getScopes();
|
|
751
|
+
}
|
|
752
|
+
async getScopesAsync() {
|
|
753
|
+
await this.load();
|
|
754
|
+
return this.cache || {};
|
|
755
|
+
}
|
|
756
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPExpressionEvaluatorScopeProviderService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
757
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPExpressionEvaluatorScopeProviderService, providedIn: 'root' }); }
|
|
758
|
+
}
|
|
759
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: AXPExpressionEvaluatorScopeProviderService, decorators: [{
|
|
760
|
+
type: Injectable,
|
|
761
|
+
args: [{ providedIn: 'root' }]
|
|
762
|
+
}] });
|
|
763
|
+
|
|
586
764
|
class AXPExpressionEvaluatorService {
|
|
587
765
|
constructor() {
|
|
588
766
|
// Memoization cache for compiled expressions
|
|
589
767
|
this.expressionCache = new Map();
|
|
768
|
+
this.providerService = inject(AXPExpressionEvaluatorScopeProviderService);
|
|
590
769
|
}
|
|
591
770
|
getOrCompileFunction(expression) {
|
|
592
771
|
if (!this.expressionCache.has(expression)) {
|
|
@@ -595,15 +774,21 @@ class AXPExpressionEvaluatorService {
|
|
|
595
774
|
}
|
|
596
775
|
return this.expressionCache.get(expression);
|
|
597
776
|
}
|
|
777
|
+
async getMergedScope(userScope) {
|
|
778
|
+
const pluginScopes = await this.providerService.getScopesAsync();
|
|
779
|
+
// Merge pluginScopes and userScope (userScope takes precedence)
|
|
780
|
+
return { ...pluginScopes, ...userScope };
|
|
781
|
+
}
|
|
598
782
|
async evaluate(source, scope) {
|
|
599
783
|
try {
|
|
784
|
+
const mergedScope = await this.getMergedScope(scope);
|
|
600
785
|
if (typeof source === 'string' && source.includes('{{')) {
|
|
601
|
-
return await this.evaluateStringExpression(source,
|
|
786
|
+
return await this.evaluateStringExpression(source, mergedScope);
|
|
602
787
|
}
|
|
603
788
|
else if (Array.isArray(source)) {
|
|
604
789
|
const evaluatedArray = [];
|
|
605
790
|
for (const item of source) {
|
|
606
|
-
evaluatedArray.push(await this.evaluate(item,
|
|
791
|
+
evaluatedArray.push(await this.evaluate(item, mergedScope));
|
|
607
792
|
}
|
|
608
793
|
return evaluatedArray;
|
|
609
794
|
}
|
|
@@ -611,7 +796,7 @@ class AXPExpressionEvaluatorService {
|
|
|
611
796
|
const evaluatedObject = {};
|
|
612
797
|
for (const key in source) {
|
|
613
798
|
if (source.hasOwnProperty(key)) {
|
|
614
|
-
evaluatedObject[key] = await this.evaluate(source[key],
|
|
799
|
+
evaluatedObject[key] = await this.evaluate(source[key], mergedScope);
|
|
615
800
|
}
|
|
616
801
|
}
|
|
617
802
|
return evaluatedObject;
|
|
@@ -1368,5 +1553,5 @@ const AXPAppStartUpProvider = provideAppInitializer(() => {
|
|
|
1368
1553
|
* Generated bundle index. Do not edit.
|
|
1369
1554
|
*/
|
|
1370
1555
|
|
|
1371
|
-
export { AXHighlightService, AXPAppStartUpProvider, AXPAppStartUpService, AXPBroadcastEventService, AXPComponentLogoConfig, AXPCountdownPipe, AXPDataGenerator, AXPDataSourceDefinitionProviderService, AXPDblClickDirective, AXPElementDataDirective, AXPExpressionEvaluatorService, AXPGridLayoutDirective, AXPImageUrlLogoConfig, AXPPlatformScope, AXPSystemActions, AXP_DATASOURCE_DEFINITION_PROVIDER, applyFilterArray, applyPagination, applyQueryArray, applySortArray, cleanDeep, extractNestedFieldsWildcard, extractValue, getNestedKeys, getSmart, objectKeyValueTransforms, resolvePlatformScopeKey, resolvePlatformScopeName, setSmart };
|
|
1556
|
+
export { AXHighlightService, AXPAppStartUpProvider, AXPAppStartUpService, AXPBroadcastEventService, AXPComponentLogoConfig, AXPContentCheckerDirective, AXPContextChangeEvent, AXPContextStore, AXPCountdownPipe, AXPDataGenerator, AXPDataSourceDefinitionProviderService, AXPDblClickDirective, AXPElementDataDirective, AXPExpressionEvaluatorScopeProviderContext, AXPExpressionEvaluatorScopeProviderService, AXPExpressionEvaluatorService, AXPGridLayoutDirective, AXPImageUrlLogoConfig, AXPPlatformScope, AXPSystemActions, AXP_DATASOURCE_DEFINITION_PROVIDER, AXP_EXPRESSION_EVALUATOR_SCOPE_PROVIDER, applyFilterArray, applyPagination, applyQueryArray, applySortArray, cleanDeep, extractNestedFieldsWildcard, extractValue, getNestedKeys, getSmart, objectKeyValueTransforms, resolvePlatformScopeKey, resolvePlatformScopeName, setSmart };
|
|
1372
1557
|
//# sourceMappingURL=acorex-platform-core.mjs.map
|