@headless-adminapp/app 0.0.17-alpha.54 → 0.0.17-alpha.55
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/app/AppProvider.js +24 -32
- package/app/AuthWrapper.js +13 -9
- package/app/LayoutProvider.js +34 -39
- package/app/context.js +5 -2
- package/app/hooks/index.js +17 -1
- package/app/hooks/useAppContext.js +7 -4
- package/app/index.js +11 -4
- package/auth/AuthProvider.js +27 -36
- package/auth/context.d.ts +1 -1
- package/auth/context.js +5 -2
- package/auth/hooks/index.js +18 -2
- package/auth/hooks/useAuthSession.js +7 -4
- package/auth/hooks/useIsSkipAuthCheck.js +7 -4
- package/auth/hooks/useLogout.js +11 -8
- package/auth/index.js +23 -4
- package/auth/types.js +2 -1
- package/board/BoardColumnDataResolver.js +23 -20
- package/board/BoardColumnProvider.js +14 -10
- package/board/context.d.ts +2 -2
- package/board/context.js +6 -3
- package/board/hooks/index.js +15 -6
- package/board/hooks/useBoardColumnConfig.js +7 -4
- package/board/hooks/useBoardColumnData.d.ts +3 -1
- package/board/hooks/useBoardColumnData.js +7 -4
- package/board/hooks/useBoardColumnDataState.js +7 -4
- package/board/hooks/useBoardConfig.js +7 -4
- package/board/hooks/useBoardSchema.js +6 -3
- package/board/hooks/useSearchText.js +10 -7
- package/board/types.js +2 -1
- package/board/utils.js +4 -1
- package/builders/CommandBuilder/CommandBuilder.js +13 -10
- package/builders/CommandBuilder/DefaultCommandBuilder.js +30 -23
- package/builders/CommandBuilder/FormCommandBuilder.js +29 -38
- package/builders/CommandBuilder/SubgridCommandBuilder.js +27 -36
- package/builders/CommandBuilder/ViewCommandBuilder.js +29 -38
- package/builders/CommandBuilder/index.js +5 -1
- package/builders/CommandBuilder/utils.js +7 -3
- package/builders/SchemaExperienceBuilder.js +55 -31
- package/builders/index.js +7 -2
- package/builders/utils.js +59 -44
- package/command/hooks/index.js +18 -2
- package/command/hooks/useBaseCommandHandlerContext.js +29 -25
- package/command/hooks/useCommands.js +9 -6
- package/command/index.js +18 -2
- package/command/types.js +2 -1
- package/command/utils/index.js +41 -13
- package/components/ScrollView/index.js +11 -4
- package/components/ScrollbarWithMoreDataRequest/index.js +14 -11
- package/dataform/DataFormProvider/DataResolver.js +81 -89
- package/dataform/DataFormProvider/InitialValueResolver.js +22 -20
- package/dataform/DataFormProvider/ReadonlyInfoResolver.js +14 -12
- package/dataform/DataFormProvider/index.js +26 -32
- package/dataform/context.js +5 -2
- package/dataform/hooks/index.js +29 -13
- package/dataform/hooks/useFormInstance.js +6 -3
- package/dataform/hooks/useFormIsDirty.js +6 -3
- package/dataform/hooks/useFormIsReadonly.js +7 -4
- package/dataform/hooks/useFormNotifications.js +12 -9
- package/dataform/hooks/useFormRecord.js +7 -4
- package/dataform/hooks/useFormSave.js +40 -46
- package/dataform/hooks/useFormSchema.js +7 -4
- package/dataform/hooks/useLoadFormGridPage.js +19 -25
- package/dataform/hooks/useMainFormCommands.js +37 -30
- package/dataform/hooks/useProcessFlowSteps.js +27 -23
- package/dataform/hooks/useRecordId.js +7 -4
- package/dataform/hooks/useRecordTitle.js +12 -9
- package/dataform/hooks/useSelectedForm.js +7 -4
- package/dataform/index.js +23 -4
- package/dataform/utils/defaultParameters.js +16 -6
- package/dataform/utils/index.js +90 -56
- package/dataform/utils/saveRecord.js +99 -104
- package/datagrid/DataGridProvider/DataResolver.js +36 -34
- package/datagrid/DataGridProvider/index.js +31 -32
- package/datagrid/DataGridProvider/transformViewColumns.js +17 -6
- package/datagrid/DataGridProvider/utils.js +13 -5
- package/datagrid/column-filter/constants.js +5 -2
- package/datagrid/column-filter/index.js +7 -2
- package/datagrid/column-filter/types.js +2 -1
- package/datagrid/column-filter/utils.js +13 -3
- package/datagrid/context.d.ts +1 -1
- package/datagrid/context.js +5 -2
- package/datagrid/hooks/index.js +36 -20
- package/datagrid/hooks/useChangeView.js +10 -7
- package/datagrid/hooks/useGridColumnFilter.js +14 -8
- package/datagrid/hooks/useGridColumns.js +7 -4
- package/datagrid/hooks/useGridCommands.js +7 -4
- package/datagrid/hooks/useGridData.js +7 -4
- package/datagrid/hooks/useGridDataState.js +7 -4
- package/datagrid/hooks/useGridExtraFilter.js +7 -4
- package/datagrid/hooks/useGridOptions.js +4 -1
- package/datagrid/hooks/useGridPagination.js +4 -1
- package/datagrid/hooks/useGridRefresh.js +10 -7
- package/datagrid/hooks/useGridSchema.js +7 -4
- package/datagrid/hooks/useGridSelection.js +10 -7
- package/datagrid/hooks/useGridSorting.js +10 -7
- package/datagrid/hooks/useGridViewLookupData.js +7 -4
- package/datagrid/hooks/useLoadMainGridPage.js +12 -9
- package/datagrid/hooks/useMainGridCommands.js +62 -54
- package/datagrid/hooks/useMaxRecords.js +7 -4
- package/datagrid/hooks/useOpenRecord.js +20 -17
- package/datagrid/hooks/useSearchText.js +10 -7
- package/datagrid/hooks/useSelectedView.js +7 -4
- package/datagrid/hooks/useSubGridCommands.js +34 -23
- package/datagrid/index.js +27 -5
- package/defaults.js +5 -2
- package/dialog/DialogProvider.js +10 -6
- package/dialog/context.d.ts +1 -1
- package/dialog/context.js +5 -2
- package/dialog/hooks/index.js +24 -8
- package/dialog/hooks/useCloseDialog.js +10 -7
- package/dialog/hooks/useDialogItem.d.ts +1 -1
- package/dialog/hooks/useDialogItem.js +7 -4
- package/dialog/hooks/useDialogItems.d.ts +1 -1
- package/dialog/hooks/useDialogItems.js +7 -4
- package/dialog/hooks/useOpenAlertDialog.js +16 -8
- package/dialog/hooks/useOpenConfirmDialog.js +18 -9
- package/dialog/hooks/useOpenDialog.js +18 -11
- package/dialog/hooks/useOpenErrorDialog.js +16 -8
- package/dialog/hooks/useOpenPromptDialog.js +18 -9
- package/dialog/index.js +22 -3
- package/form/FormValidationStringContext.js +9 -5
- package/form/index.js +7 -1
- package/hooks/index.js +24 -6
- package/hooks/useDebouncedValue.js +11 -8
- package/hooks/useElementLayout.js +7 -4
- package/hooks/useIsMobile.js +12 -6
- package/hooks/useItemsWithKey.js +8 -5
- package/hooks/useStorageState.js +7 -5
- package/hooks/useSystemColorScheme.js +7 -4
- package/insights/InsightsProvider.js +13 -10
- package/insights/context.d.ts +1 -1
- package/insights/context.js +5 -2
- package/insights/hooks/index.js +7 -4
- package/insights/index.js +20 -2
- package/locale/LocaleProvider.js +12 -8
- package/locale/context.js +5 -2
- package/locale/index.js +23 -4
- package/locale/useCurrencySymbol.js +10 -8
- package/locale/useLocale.js +7 -4
- package/locale/utils.js +8 -3
- package/metadata/MetadataProvider.js +21 -17
- package/metadata/context.d.ts +1 -1
- package/metadata/context.js +5 -2
- package/metadata/hooks/index.js +24 -8
- package/metadata/hooks/useAppStore.js +7 -4
- package/metadata/hooks/useExperienceStore.js +7 -4
- package/metadata/hooks/useExperienceView.js +11 -17
- package/metadata/hooks/useExperienceViewCommands.js +14 -20
- package/metadata/hooks/useExperienceViewLookup.js +10 -16
- package/metadata/hooks/useExperienceViewSubgridCommands.js +14 -20
- package/metadata/hooks/useMetadata.js +11 -8
- package/metadata/hooks/useSchema.js +6 -3
- package/metadata/index.js +22 -3
- package/mutable/context.js +25 -17
- package/mutable/index.js +27 -3
- package/mutable/state.js +10 -6
- package/mutable/type.js +2 -1
- package/mutable/utils.js +12 -8
- package/navigation/hooks/index.js +17 -1
- package/navigation/hooks/useOpenForm.js +14 -11
- package/navigation/index.js +17 -1
- package/package.json +4 -12
- package/progress-indicator/ProgressIndicatorProvider.js +16 -12
- package/progress-indicator/context.js +5 -2
- package/progress-indicator/hooks/index.js +17 -1
- package/progress-indicator/hooks/useProgressIndicator.d.ts +1 -1
- package/progress-indicator/hooks/useProgressIndicator.js +7 -4
- package/progress-indicator/index.js +22 -3
- package/providers/PageEntityFormProvider/index.js +7 -4
- package/providers/PageEntityViewProvider/index.js +7 -4
- package/recordset/RecordSetProvider.js +16 -12
- package/recordset/context.d.ts +1 -1
- package/recordset/context.js +5 -2
- package/recordset/hooks/index.js +19 -3
- package/recordset/hooks/useRecordSetResult.js +22 -29
- package/recordset/hooks/useRecordSetSetter.js +9 -6
- package/recordset/hooks/useRecordSetVisibility.js +10 -7
- package/recordset/index.js +22 -3
- package/route/RouteProvider.js +18 -14
- package/route/context.js +9 -6
- package/route/hooks/index.js +22 -6
- package/route/hooks/useBasePath.js +7 -4
- package/route/hooks/useIsRouteActive.js +7 -4
- package/route/hooks/usePathname.js +7 -4
- package/route/hooks/useRouteResolver.js +7 -4
- package/route/hooks/useRouter.js +7 -4
- package/route/hooks/useSearchParams.js +7 -4
- package/route/index.js +20 -2
- package/route/types.js +2 -1
- package/store/ClientAppStore.js +12 -21
- package/store/ComponentStore.js +6 -4
- package/store/EventManager.js +20 -32
- package/store/SchemaExperienceStore.js +186 -217
- package/store/index.js +20 -4
- package/toast-notification/ToastNotificationProvider.js +10 -6
- package/toast-notification/context.d.ts +1 -1
- package/toast-notification/context.js +5 -2
- package/toast-notification/hooks/index.js +19 -3
- package/toast-notification/hooks/useCloseToastNotification.js +10 -7
- package/toast-notification/hooks/useOpenToastNotification.js +18 -11
- package/toast-notification/hooks/useToastNotificationItems.d.ts +1 -1
- package/toast-notification/hooks/useToastNotificationItems.js +7 -4
- package/toast-notification/index.js +22 -3
- package/transport/InMemoryDataService/index.js +59 -78
- package/transport/RestDataService/index.d.ts +2 -2
- package/transport/RestDataService/index.js +72 -91
- package/transport/context.js +9 -15
- package/transport/hooks/index.js +18 -2
- package/transport/hooks/useDataService.js +7 -4
- package/transport/hooks/useFileService.js +7 -4
- package/transport/hooks/useRetriveRecords.d.ts +1 -1
- package/transport/hooks/useRetriveRecords.js +25 -31
- package/transport/index.js +20 -2
- package/utils/calculateColumnWidths.js +5 -2
- package/utils/color.js +4 -1
- package/utils/getAttributeFormattedValue.js +38 -40
- package/utils/index.js +18 -2
- package/widget/context.js +5 -2
- package/widget/hooks/index.js +7 -4
- package/widget/index.js +5 -1
package/store/ClientAppStore.js
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export class ClientAppStore {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.apps = {};
|
|
13
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientAppStore = void 0;
|
|
4
|
+
class ClientAppStore {
|
|
5
|
+
apps = {};
|
|
14
6
|
register(app) {
|
|
15
7
|
this.apps[app.id] = app;
|
|
16
8
|
}
|
|
17
|
-
getApp(id) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return app;
|
|
24
|
-
});
|
|
9
|
+
async getApp(id) {
|
|
10
|
+
const app = this.apps[id];
|
|
11
|
+
if (!app) {
|
|
12
|
+
throw new Error(`App Experience for ${id} not found`);
|
|
13
|
+
}
|
|
14
|
+
return app;
|
|
25
15
|
}
|
|
26
16
|
}
|
|
17
|
+
exports.ClientAppStore = ClientAppStore;
|
package/store/ComponentStore.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ComponentStore = void 0;
|
|
4
|
+
class ComponentStore {
|
|
5
|
+
components = {};
|
|
5
6
|
registerComponent(name, component) {
|
|
6
7
|
this.components[name] = component;
|
|
7
8
|
}
|
|
@@ -13,3 +14,4 @@ export class ComponentStore {
|
|
|
13
14
|
return self.components[name];
|
|
14
15
|
}
|
|
15
16
|
}
|
|
17
|
+
exports.ComponentStore = ComponentStore;
|
package/store/EventManager.js
CHANGED
|
@@ -1,38 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
constructor() {
|
|
12
|
-
this.handlers = {};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EventManager = void 0;
|
|
4
|
+
class EventManager {
|
|
5
|
+
handlers = {};
|
|
6
|
+
async on(key, handler) {
|
|
7
|
+
if (!this.handlers[key]) {
|
|
8
|
+
this.handlers[key] = [];
|
|
9
|
+
}
|
|
10
|
+
this.handlers[key].push(handler);
|
|
13
11
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
off(key, handler) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
if (!this.handlers[key]) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
this.handlers[key] = this.handlers[key].filter((h) => h !== handler);
|
|
28
|
-
if (this.handlers[key].length === 0) {
|
|
29
|
-
delete this.handlers[key];
|
|
30
|
-
}
|
|
31
|
-
});
|
|
12
|
+
async off(key, handler) {
|
|
13
|
+
if (!this.handlers[key]) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
this.handlers[key] = this.handlers[key].filter((h) => h !== handler);
|
|
17
|
+
if (this.handlers[key].length === 0) {
|
|
18
|
+
delete this.handlers[key];
|
|
19
|
+
}
|
|
32
20
|
}
|
|
33
21
|
emit(key, ...args) {
|
|
34
|
-
|
|
35
|
-
const handlers = ((_a = this.handlers[key]) !== null && _a !== void 0 ? _a : []);
|
|
22
|
+
const handlers = (this.handlers[key] ?? []);
|
|
36
23
|
return handlers.map((handler) => handler(...args));
|
|
37
24
|
}
|
|
38
25
|
}
|
|
26
|
+
exports.EventManager = EventManager;
|
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export function getDefaultCardView(schema) {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchemaExperienceStore = void 0;
|
|
4
|
+
exports.getDefaultCardView = getDefaultCardView;
|
|
5
|
+
function getDefaultCardView(schema) {
|
|
11
6
|
return {
|
|
12
7
|
primaryColumn: schema.primaryAttribute,
|
|
13
8
|
};
|
|
14
9
|
}
|
|
15
|
-
|
|
10
|
+
class SchemaExperienceStore {
|
|
11
|
+
options;
|
|
12
|
+
experiences = {};
|
|
16
13
|
constructor(options) {
|
|
17
14
|
this.options = options;
|
|
18
|
-
this.experiences = {};
|
|
19
15
|
}
|
|
20
16
|
register(experience) {
|
|
21
17
|
for (const view of Object.values(experience.views)) {
|
|
@@ -31,209 +27,183 @@ export class SchemaExperienceStore {
|
|
|
31
27
|
}
|
|
32
28
|
this.experiences[experience.logicalName] = experience;
|
|
33
29
|
}
|
|
34
|
-
getExperience(logicalName) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return experience;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
getPublicViewLookup(logicalName, viewIds) {
|
|
44
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
-
const experience = yield this.getExperience(logicalName);
|
|
46
|
-
let views = experience.views;
|
|
47
|
-
if (viewIds === null || viewIds === void 0 ? void 0 : viewIds.length) {
|
|
48
|
-
views = views.filter((view) => viewIds.includes(view.id));
|
|
49
|
-
}
|
|
50
|
-
if (!views.length) {
|
|
51
|
-
views = experience.views.filter((x) => x.id === experience.defaultViewId);
|
|
52
|
-
}
|
|
53
|
-
return views.map((view) => ({
|
|
54
|
-
id: view.id,
|
|
55
|
-
name: view.name,
|
|
56
|
-
localizedNames: view.localizedNames,
|
|
57
|
-
}));
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
getAssociatedViewLookup(logicalName, viewIds) {
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
const experience = yield this.getExperience(logicalName);
|
|
63
|
-
let associatedViews = experience.associatedViews;
|
|
64
|
-
if (viewIds === null || viewIds === void 0 ? void 0 : viewIds.length) {
|
|
65
|
-
associatedViews = associatedViews.filter((view) => viewIds.includes(view.id));
|
|
66
|
-
}
|
|
67
|
-
if (!associatedViews.length) {
|
|
68
|
-
associatedViews = experience.associatedViews.filter((x) => x.id === experience.defaultAssociatedViewId);
|
|
69
|
-
}
|
|
70
|
-
return associatedViews.map((view) => ({
|
|
71
|
-
id: view.id,
|
|
72
|
-
name: view.name,
|
|
73
|
-
localizedNames: view.localizedNames,
|
|
74
|
-
}));
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
getPublicView(logicalName, viewId, viewIds) {
|
|
78
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
const experience = yield this.getExperience(logicalName);
|
|
80
|
-
const availableViewLookup = yield this.getPublicViewLookup(logicalName, viewIds);
|
|
81
|
-
let validViewIds = availableViewLookup.map((x) => x.id);
|
|
82
|
-
if (!validViewIds.length) {
|
|
83
|
-
validViewIds = [experience.defaultViewId];
|
|
84
|
-
}
|
|
85
|
-
if (!viewId) {
|
|
86
|
-
viewId = experience.defaultViewId;
|
|
87
|
-
}
|
|
88
|
-
if (!validViewIds.includes(viewId)) {
|
|
89
|
-
viewId = validViewIds[0];
|
|
90
|
-
}
|
|
91
|
-
let view = experience.views.find((v) => v.id === viewId);
|
|
92
|
-
if (!view) {
|
|
93
|
-
throw new Error(`View ${viewId} not found`);
|
|
94
|
-
}
|
|
95
|
-
let viewExperience = view.experience;
|
|
96
|
-
if (typeof viewExperience === 'function') {
|
|
97
|
-
viewExperience = yield viewExperience();
|
|
98
|
-
}
|
|
99
|
-
if (!viewExperience.card) {
|
|
100
|
-
viewExperience.card = getDefaultCardView(this.options.schemaStore.getSchema(logicalName));
|
|
101
|
-
}
|
|
102
|
-
return {
|
|
103
|
-
id: view.id,
|
|
104
|
-
name: view.name,
|
|
105
|
-
logicalName: view.logicalName,
|
|
106
|
-
localizedNames: view.localizedNames,
|
|
107
|
-
experience: viewExperience,
|
|
108
|
-
};
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
getAssociatedView(logicalName, viewId, viewIds) {
|
|
112
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
-
const experience = yield this.getExperience(logicalName);
|
|
114
|
-
const availableViewLookup = yield this.getAssociatedViewLookup(logicalName, viewIds);
|
|
115
|
-
let validViewIds = availableViewLookup.map((x) => x.id);
|
|
116
|
-
if (!validViewIds.length) {
|
|
117
|
-
validViewIds = [experience.defaultViewId];
|
|
118
|
-
}
|
|
119
|
-
if (!viewId) {
|
|
120
|
-
viewId = experience.defaultAssociatedViewId;
|
|
121
|
-
}
|
|
122
|
-
if (!validViewIds.includes(viewId)) {
|
|
123
|
-
viewId = validViewIds[0];
|
|
124
|
-
}
|
|
125
|
-
let view = experience.associatedViews.find((v) => v.id === viewId);
|
|
126
|
-
if (!view) {
|
|
127
|
-
throw new Error(`View ${viewId} not found`);
|
|
128
|
-
}
|
|
129
|
-
let viewExperience = view.experience;
|
|
130
|
-
if (typeof viewExperience === 'function') {
|
|
131
|
-
viewExperience = yield viewExperience();
|
|
132
|
-
}
|
|
133
|
-
if (!viewExperience.card) {
|
|
134
|
-
viewExperience.card = getDefaultCardView(this.options.schemaStore.getSchema(logicalName));
|
|
135
|
-
}
|
|
136
|
-
return {
|
|
137
|
-
id: view.id,
|
|
138
|
-
name: view.name,
|
|
139
|
-
logicalName: view.logicalName,
|
|
140
|
-
localizedNames: view.localizedNames,
|
|
141
|
-
experience: viewExperience,
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
getViewLookupV2(logicalName, viewId) {
|
|
146
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
-
const experience = yield this.getExperience(logicalName);
|
|
148
|
-
if (!viewId) {
|
|
149
|
-
viewId = experience.defaultViewId;
|
|
150
|
-
}
|
|
151
|
-
const view = experience.lookups.find((v) => v.id === viewId);
|
|
152
|
-
if (!view) {
|
|
153
|
-
throw new Error(`Lookup ${viewId} not found`);
|
|
154
|
-
}
|
|
155
|
-
let viewExperience = view.experience;
|
|
156
|
-
if (typeof viewExperience === 'function') {
|
|
157
|
-
viewExperience = yield viewExperience();
|
|
158
|
-
}
|
|
159
|
-
return {
|
|
160
|
-
id: view.id,
|
|
161
|
-
name: view.name,
|
|
162
|
-
logicalName: view.logicalName,
|
|
163
|
-
experience: viewExperience,
|
|
164
|
-
};
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
getDefaultViewId(logicalName) {
|
|
168
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
-
const experience = yield this.getExperience(logicalName);
|
|
170
|
-
return experience.defaultViewId;
|
|
171
|
-
});
|
|
30
|
+
async getExperience(logicalName) {
|
|
31
|
+
const experience = this.experiences[logicalName];
|
|
32
|
+
if (!experience) {
|
|
33
|
+
throw new Error(`Experience for ${logicalName} not found`);
|
|
34
|
+
}
|
|
35
|
+
return experience;
|
|
172
36
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
37
|
+
async getPublicViewLookup(logicalName, viewIds) {
|
|
38
|
+
const experience = await this.getExperience(logicalName);
|
|
39
|
+
let views = experience.views;
|
|
40
|
+
if (viewIds?.length) {
|
|
41
|
+
views = views.filter((view) => viewIds.includes(view.id));
|
|
42
|
+
}
|
|
43
|
+
if (!views.length) {
|
|
44
|
+
views = experience.views.filter((x) => x.id === experience.defaultViewId);
|
|
45
|
+
}
|
|
46
|
+
return views.map((view) => ({
|
|
47
|
+
id: view.id,
|
|
48
|
+
name: view.name,
|
|
49
|
+
localizedNames: view.localizedNames,
|
|
50
|
+
}));
|
|
178
51
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return {
|
|
194
|
-
id: form.id,
|
|
195
|
-
name: form.name,
|
|
196
|
-
logicalName: form.logicalName,
|
|
197
|
-
experience: formExperience,
|
|
198
|
-
};
|
|
199
|
-
});
|
|
52
|
+
async getAssociatedViewLookup(logicalName, viewIds) {
|
|
53
|
+
const experience = await this.getExperience(logicalName);
|
|
54
|
+
let associatedViews = experience.associatedViews;
|
|
55
|
+
if (viewIds?.length) {
|
|
56
|
+
associatedViews = associatedViews.filter((view) => viewIds.includes(view.id));
|
|
57
|
+
}
|
|
58
|
+
if (!associatedViews.length) {
|
|
59
|
+
associatedViews = experience.associatedViews.filter((x) => x.id === experience.defaultAssociatedViewId);
|
|
60
|
+
}
|
|
61
|
+
return associatedViews.map((view) => ({
|
|
62
|
+
id: view.id,
|
|
63
|
+
name: view.name,
|
|
64
|
+
localizedNames: view.localizedNames,
|
|
65
|
+
}));
|
|
200
66
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
67
|
+
async getPublicView(logicalName, viewId, viewIds) {
|
|
68
|
+
const experience = await this.getExperience(logicalName);
|
|
69
|
+
const availableViewLookup = await this.getPublicViewLookup(logicalName, viewIds);
|
|
70
|
+
let validViewIds = availableViewLookup.map((x) => x.id);
|
|
71
|
+
if (!validViewIds.length) {
|
|
72
|
+
validViewIds = [experience.defaultViewId];
|
|
73
|
+
}
|
|
74
|
+
if (!viewId) {
|
|
75
|
+
viewId = experience.defaultViewId;
|
|
76
|
+
}
|
|
77
|
+
if (!validViewIds.includes(viewId)) {
|
|
78
|
+
viewId = validViewIds[0];
|
|
79
|
+
}
|
|
80
|
+
let view = experience.views.find((v) => v.id === viewId);
|
|
81
|
+
if (!view) {
|
|
82
|
+
throw new Error(`View ${viewId} not found`);
|
|
83
|
+
}
|
|
84
|
+
let viewExperience = view.experience;
|
|
85
|
+
if (typeof viewExperience === 'function') {
|
|
86
|
+
viewExperience = await viewExperience();
|
|
87
|
+
}
|
|
88
|
+
if (!viewExperience.card) {
|
|
89
|
+
viewExperience.card = getDefaultCardView(this.options.schemaStore.getSchema(logicalName));
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
id: view.id,
|
|
93
|
+
name: view.name,
|
|
94
|
+
logicalName: view.logicalName,
|
|
95
|
+
localizedNames: view.localizedNames,
|
|
96
|
+
experience: viewExperience,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async getAssociatedView(logicalName, viewId, viewIds) {
|
|
100
|
+
const experience = await this.getExperience(logicalName);
|
|
101
|
+
const availableViewLookup = await this.getAssociatedViewLookup(logicalName, viewIds);
|
|
102
|
+
let validViewIds = availableViewLookup.map((x) => x.id);
|
|
103
|
+
if (!validViewIds.length) {
|
|
104
|
+
validViewIds = [experience.defaultViewId];
|
|
105
|
+
}
|
|
106
|
+
if (!viewId) {
|
|
107
|
+
viewId = experience.defaultAssociatedViewId;
|
|
108
|
+
}
|
|
109
|
+
if (!validViewIds.includes(viewId)) {
|
|
110
|
+
viewId = validViewIds[0];
|
|
111
|
+
}
|
|
112
|
+
let view = experience.associatedViews.find((v) => v.id === viewId);
|
|
113
|
+
if (!view) {
|
|
114
|
+
throw new Error(`View ${viewId} not found`);
|
|
115
|
+
}
|
|
116
|
+
let viewExperience = view.experience;
|
|
117
|
+
if (typeof viewExperience === 'function') {
|
|
118
|
+
viewExperience = await viewExperience();
|
|
119
|
+
}
|
|
120
|
+
if (!viewExperience.card) {
|
|
121
|
+
viewExperience.card = getDefaultCardView(this.options.schemaStore.getSchema(logicalName));
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
id: view.id,
|
|
125
|
+
name: view.name,
|
|
126
|
+
logicalName: view.logicalName,
|
|
127
|
+
localizedNames: view.localizedNames,
|
|
128
|
+
experience: viewExperience,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
async getViewLookupV2(logicalName, viewId) {
|
|
132
|
+
const experience = await this.getExperience(logicalName);
|
|
133
|
+
if (!viewId) {
|
|
134
|
+
viewId = experience.defaultViewId;
|
|
135
|
+
}
|
|
136
|
+
const view = experience.lookups.find((v) => v.id === viewId);
|
|
137
|
+
if (!view) {
|
|
138
|
+
throw new Error(`Lookup ${viewId} not found`);
|
|
139
|
+
}
|
|
140
|
+
let viewExperience = view.experience;
|
|
141
|
+
if (typeof viewExperience === 'function') {
|
|
142
|
+
viewExperience = await viewExperience();
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
id: view.id,
|
|
146
|
+
name: view.name,
|
|
147
|
+
logicalName: view.logicalName,
|
|
148
|
+
experience: viewExperience,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
async getDefaultViewId(logicalName) {
|
|
152
|
+
const experience = await this.getExperience(logicalName);
|
|
153
|
+
return experience.defaultViewId;
|
|
154
|
+
}
|
|
155
|
+
async getDefaultViewLookupId(logicalName) {
|
|
156
|
+
const experience = await this.getExperience(logicalName);
|
|
157
|
+
return experience.defaultLookupId;
|
|
158
|
+
}
|
|
159
|
+
async getForm(logicalName, formId) {
|
|
160
|
+
const experience = await this.getExperience(logicalName);
|
|
161
|
+
if (!formId) {
|
|
162
|
+
formId = experience.defaultFormId;
|
|
163
|
+
}
|
|
164
|
+
const form = experience.forms.find((f) => f.id === formId);
|
|
165
|
+
if (!form) {
|
|
166
|
+
throw new Error(`Form ${formId} not found`);
|
|
167
|
+
}
|
|
168
|
+
let formExperience = form.experience;
|
|
169
|
+
if (typeof formExperience === 'function') {
|
|
170
|
+
formExperience = await formExperience();
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
id: form.id,
|
|
174
|
+
name: form.name,
|
|
175
|
+
logicalName: form.logicalName,
|
|
176
|
+
experience: formExperience,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
async getQuickCreateForm(logicalName, formId) {
|
|
180
|
+
const experience = await this.getExperience(logicalName);
|
|
181
|
+
const form = experience.quickCreateForms.find((f) => f.id === formId);
|
|
182
|
+
if (!form) {
|
|
183
|
+
throw new Error(`Quick create form ${formId} not found`);
|
|
184
|
+
}
|
|
185
|
+
let formExperience = form.experience;
|
|
186
|
+
if (typeof formExperience === 'function') {
|
|
187
|
+
formExperience = await formExperience();
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
id: form.id,
|
|
191
|
+
name: form.name,
|
|
192
|
+
logicalName: form.logicalName,
|
|
193
|
+
experience: formExperience,
|
|
194
|
+
};
|
|
219
195
|
}
|
|
220
|
-
getViewCommands(logicalName) {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return experience.viewCommands;
|
|
224
|
-
});
|
|
196
|
+
async getViewCommands(logicalName) {
|
|
197
|
+
const experience = await this.getExperience(logicalName);
|
|
198
|
+
return experience.viewCommands;
|
|
225
199
|
}
|
|
226
|
-
getFormCommands(logicalName) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return experience.formCommands;
|
|
230
|
-
});
|
|
200
|
+
async getFormCommands(logicalName) {
|
|
201
|
+
const experience = await this.getExperience(logicalName);
|
|
202
|
+
return experience.formCommands;
|
|
231
203
|
}
|
|
232
|
-
getSubgridCommands(logicalName) {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
return experience.subgridCommands;
|
|
236
|
-
});
|
|
204
|
+
async getSubgridCommands(logicalName) {
|
|
205
|
+
const experience = await this.getExperience(logicalName);
|
|
206
|
+
return experience.subgridCommands;
|
|
237
207
|
}
|
|
238
208
|
getSchemaMetadataList() {
|
|
239
209
|
const schemas = this.options.schemaStore.getAllSchema();
|
|
@@ -247,13 +217,12 @@ export class SchemaExperienceStore {
|
|
|
247
217
|
localizedPluralLabels: schema.localizedPluralLabels,
|
|
248
218
|
}));
|
|
249
219
|
}
|
|
250
|
-
getExperienceSchemaMetadatList() {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
});
|
|
257
|
-
});
|
|
220
|
+
async getExperienceSchemaMetadatList() {
|
|
221
|
+
const schemaMetadatas = this.getSchemaMetadataList();
|
|
222
|
+
return schemaMetadatas.map((schemaMetadata) => ({
|
|
223
|
+
...schemaMetadata,
|
|
224
|
+
icon: this.experiences[schemaMetadata.logicalName]?.icon,
|
|
225
|
+
}));
|
|
258
226
|
}
|
|
259
227
|
}
|
|
228
|
+
exports.SchemaExperienceStore = SchemaExperienceStore;
|
package/store/index.js
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ClientAppStore"), exports);
|
|
18
|
+
__exportStar(require("./ComponentStore"), exports);
|
|
19
|
+
__exportStar(require("./EventManager"), exports);
|
|
20
|
+
__exportStar(require("./SchemaExperienceStore"), exports);
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToastNotificationProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const context_1 = require("../mutable/context");
|
|
6
|
+
const context_2 = require("./context");
|
|
7
|
+
const ToastNotificationProvider = ({ children }) => {
|
|
8
|
+
const contextState = (0, context_1.useCreateContextStore)({
|
|
6
9
|
items: [],
|
|
7
10
|
});
|
|
8
|
-
return (
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(context_2.ToastNotificationContext.Provider, { value: contextState, children: children }));
|
|
9
12
|
};
|
|
13
|
+
exports.ToastNotificationProvider = ToastNotificationProvider;
|
|
@@ -12,4 +12,4 @@ export interface ToastNotificationItem {
|
|
|
12
12
|
export interface ToastNotificationContextState {
|
|
13
13
|
items: ToastNotificationItem[];
|
|
14
14
|
}
|
|
15
|
-
export declare const ToastNotificationContext: import("react").Context<import("../mutable").ContextValue<ToastNotificationContextState>>;
|
|
15
|
+
export declare const ToastNotificationContext: import("react").Context<import("../mutable/context").ContextValue<ToastNotificationContextState>>;
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToastNotificationContext = void 0;
|
|
4
|
+
const context_1 = require("../mutable/context");
|
|
5
|
+
exports.ToastNotificationContext = (0, context_1.createContext)();
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useCloseToastNotification"), exports);
|
|
18
|
+
__exportStar(require("./useOpenToastNotification"), exports);
|
|
19
|
+
__exportStar(require("./useToastNotificationItems"), exports);
|