@headless-adminapp/app 0.0.17-alpha.8 → 1.0.0
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.d.ts +0 -3
- package/app/AppProvider.js +10 -33
- package/app/AuthWrapper.d.ts +1 -1
- package/app/AuthWrapper.js +4 -1
- package/app/LayoutProvider.d.ts +8 -7
- package/app/LayoutProvider.js +28 -2
- package/app/context.d.ts +1 -1
- package/auth/AuthProvider.d.ts +1 -1
- package/auth/AuthProvider.js +30 -23
- package/auth/context.d.ts +2 -0
- package/auth/hooks/useIsSkipAuthCheck.d.ts +1 -0
- package/auth/hooks/useIsSkipAuthCheck.js +8 -0
- package/auth/hooks/useLogout.js +1 -1
- package/board/BoardColumnDataResolver.d.ts +1 -0
- package/board/BoardColumnDataResolver.js +64 -0
- package/board/BoardColumnProvider.d.ts +7 -0
- package/board/BoardColumnProvider.js +36 -0
- package/board/context.d.ts +19 -0
- package/board/context.js +6 -0
- package/board/hooks/index.d.ts +6 -0
- package/board/hooks/index.js +15 -0
- package/board/hooks/useBoardColumnConfig.d.ts +2 -0
- package/board/hooks/useBoardColumnConfig.js +8 -0
- package/board/hooks/useBoardColumnData.d.ts +3 -0
- package/board/hooks/useBoardColumnData.js +9 -0
- package/board/hooks/useBoardColumnDataState.d.ts +5 -0
- package/board/hooks/useBoardColumnDataState.js +9 -0
- package/board/hooks/useBoardConfig.d.ts +3 -0
- package/board/hooks/useBoardConfig.js +8 -0
- package/board/hooks/useBoardSchema.d.ts +2 -0
- package/board/hooks/useBoardSchema.js +7 -0
- package/board/hooks/useSearchText.d.ts +1 -0
- package/board/hooks/useSearchText.js +14 -0
- package/board/types.d.ts +47 -0
- package/board/utils.d.ts +3 -0
- package/board/utils.js +6 -0
- package/builders/CommandBuilder/DefaultCommandBuilder.d.ts +15 -6
- package/builders/CommandBuilder/DefaultCommandBuilder.js +42 -20
- package/builders/CommandBuilder/FormCommandBuilder.d.ts +14 -13
- package/builders/CommandBuilder/FormCommandBuilder.js +66 -52
- package/builders/CommandBuilder/SubgridCommandBuilder.d.ts +8 -27
- package/builders/CommandBuilder/SubgridCommandBuilder.js +115 -57
- package/builders/CommandBuilder/ViewCommandBuilder.js +32 -52
- package/builders/CommandBuilder/utils.js +1 -1
- package/builders/DefineFormExperience.d.ts +27 -0
- package/builders/DefineFormExperience.js +99 -0
- package/builders/DefineViewExperience.d.ts +13 -0
- package/builders/DefineViewExperience.js +33 -0
- package/builders/SchemaExperienceBuilder.d.ts +9 -7
- package/builders/SchemaExperienceBuilder.js +62 -40
- package/builders/utils.js +30 -44
- package/calendar/baseEventAttributes.d.ts +35 -0
- package/calendar/baseEventAttributes.js +38 -0
- package/calendar/context.d.ts +6 -0
- package/calendar/context.js +5 -0
- package/calendar/hooks/index.d.ts +1 -0
- package/{appearance → calendar}/hooks/index.js +1 -1
- package/calendar/hooks/useConfig.d.ts +3 -0
- package/calendar/hooks/useConfig.js +8 -0
- package/calendar/types.d.ts +41 -0
- package/calendar/types.js +2 -0
- package/calendar/utils.d.ts +3 -0
- package/calendar/utils.js +6 -0
- package/command/hooks/useBaseCommandHandlerContext.js +15 -6
- package/command/hooks/useCommands.js +1 -1
- package/command/utils/index.js +34 -9
- package/components/ScrollView/index.d.ts +1 -1
- package/components/ScrollView/index.js +2 -2
- package/components/ScrollbarWithMoreDataRequest/index.d.ts +9 -0
- package/components/ScrollbarWithMoreDataRequest/index.js +32 -0
- package/dataform/DataFormProvider/CustomHookExecuter.d.ts +5 -0
- package/dataform/DataFormProvider/CustomHookExecuter.js +14 -0
- package/dataform/DataFormProvider/DataResolver.d.ts +6 -4
- package/dataform/DataFormProvider/DataResolver.js +11 -94
- package/dataform/DataFormProvider/InitialValueResolver.js +3 -2
- package/dataform/DataFormProvider/ReadonlyInfoResolver.js +2 -3
- package/dataform/DataFormProvider/getRecord.d.ts +3 -0
- package/dataform/DataFormProvider/getRecord.js +56 -0
- package/dataform/DataFormProvider/index.d.ts +4 -0
- package/dataform/DataFormProvider/index.js +34 -12
- package/dataform/DataFormProvider/types.d.ts +13 -0
- package/dataform/DataFormProvider/types.js +2 -0
- package/dataform/DataFormProvider/utils.d.ts +23 -0
- package/dataform/DataFormProvider/utils.js +105 -0
- package/dataform/FormManager.d.ts +57 -0
- package/dataform/FormManager.js +247 -0
- package/dataform/constants.d.ts +1 -0
- package/dataform/constants.js +4 -0
- package/dataform/context.d.ts +26 -1
- package/dataform/hooks/index.d.ts +11 -0
- package/dataform/hooks/index.js +11 -0
- package/dataform/hooks/useContextKey.d.ts +1 -0
- package/dataform/hooks/useContextKey.js +8 -0
- package/dataform/hooks/useDisabledControlsManager.d.ts +6 -0
- package/dataform/hooks/useDisabledControlsManager.js +46 -0
- package/dataform/hooks/useEventManager.d.ts +1 -0
- package/dataform/hooks/useEventManager.js +8 -0
- package/dataform/hooks/useFormManager.d.ts +2 -0
- package/dataform/hooks/useFormManager.js +13 -0
- package/dataform/hooks/useFormNotifications.js +2 -2
- package/dataform/hooks/useFormSave.js +28 -31
- package/dataform/hooks/useHiddenControlsManager.d.ts +7 -0
- package/dataform/hooks/useHiddenControlsManager.js +50 -0
- package/dataform/hooks/useIsControlDisabled.d.ts +1 -0
- package/dataform/hooks/useIsControlDisabled.js +27 -0
- package/dataform/hooks/useIsControlHiddenByAttributeName.d.ts +1 -0
- package/dataform/hooks/useIsControlHiddenByAttributeName.js +17 -0
- package/dataform/hooks/useIsControlHiddenByKey.d.ts +1 -0
- package/dataform/hooks/useIsControlHiddenByKey.js +17 -0
- package/dataform/hooks/useIsFieldRequired.d.ts +1 -0
- package/dataform/hooks/useIsFieldRequired.js +25 -0
- package/dataform/hooks/useLoadFormGridPage.js +8 -17
- package/dataform/hooks/useMainFormCommands.d.ts +1 -12
- package/dataform/hooks/useMainFormCommands.js +13 -3
- package/dataform/hooks/useOnFieldValueChangeListener.d.ts +1 -0
- package/dataform/hooks/useOnFieldValueChangeListener.js +30 -0
- package/dataform/hooks/useProcessFlowSteps.d.ts +1 -0
- package/dataform/hooks/useProcessFlowSteps.js +45 -0
- package/dataform/hooks/useRecordTitle.d.ts +3 -1
- package/dataform/hooks/useRecordTitle.js +12 -5
- package/dataform/hooks/useRequiredFieldManager.d.ts +6 -0
- package/dataform/hooks/useRequiredFieldManager.js +49 -0
- package/dataform/test.d.ts +57 -0
- package/dataform/test.js +247 -0
- package/dataform/utils/defaultParameters.d.ts +6 -0
- package/dataform/utils/defaultParameters.js +54 -0
- package/dataform/utils/index.d.ts +6 -24
- package/dataform/utils/index.js +164 -190
- package/dataform/utils/saveRecord.d.ts +27 -0
- package/dataform/utils/saveRecord.js +163 -0
- package/datagrid/DataGridProvider/DataResolver.js +38 -109
- package/datagrid/DataGridProvider/index.d.ts +6 -0
- package/datagrid/DataGridProvider/index.js +18 -8
- package/datagrid/DataGridProvider/transformViewColumns.js +10 -2
- package/datagrid/DataGridProvider/utils.js +8 -8
- package/datagrid/column-filter/constants.js +38 -3
- package/datagrid/column-filter/utils.js +7 -1
- package/datagrid/context.d.ts +6 -0
- package/datagrid/hooks/useChangeView.js +1 -1
- package/datagrid/hooks/useGridColumnFilter.js +4 -1
- package/datagrid/hooks/useGridDisabled.d.ts +1 -0
- package/datagrid/hooks/useGridDisabled.js +8 -0
- package/datagrid/hooks/useLoadMainGridPage.js +1 -1
- package/datagrid/hooks/useMainGridCommands.js +23 -9
- package/datagrid/hooks/useOpenRecord.js +2 -2
- package/datagrid/hooks/useSubGridCommands.js +23 -45
- package/defaults.d.ts +2 -0
- package/defaults.js +5 -0
- package/dialog/hooks/useCloseDialog.js +17 -15
- package/dialog/hooks/useOpenAlertDialog.js +8 -3
- package/dialog/hooks/useOpenConfirmDialog.js +10 -4
- package/dialog/hooks/useOpenDialog.js +7 -5
- package/dialog/hooks/useOpenErrorDialog.js +8 -3
- package/dialog/hooks/useOpenPromptDialog.js +10 -4
- package/form/FormValidationStringContext.d.ts +1 -0
- package/form/FormValidationStringContext.js +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +3 -0
- package/hooks/useDebouncedValue.js +0 -1
- package/hooks/useElementLayout.js +1 -1
- package/hooks/useIsMobile.js +0 -1
- package/hooks/useItemsWithKey.d.ts +7 -0
- package/hooks/useItemsWithKey.js +13 -0
- package/hooks/useStorageState.js +1 -2
- package/hooks/useSystemColorScheme.d.ts +1 -1
- package/hooks/useSystemColorScheme.js +0 -1
- package/insights/InsightsProvider.d.ts +8 -0
- package/insights/InsightsProvider.js +27 -0
- package/locale/LocaleProvider.d.ts +2 -1
- package/locale/LocaleProvider.js +3 -3
- package/locale/index.d.ts +1 -0
- package/locale/index.js +1 -0
- package/locale/useCurrencySymbol.d.ts +1 -0
- package/locale/useCurrencySymbol.js +12 -0
- package/locale/utils.js +4 -2
- package/metadata/MetadataProvider.d.ts +8 -4
- package/metadata/MetadataProvider.js +23 -17
- package/metadata/context.d.ts +3 -2
- package/metadata/hooks/index.d.ts +1 -1
- package/metadata/hooks/index.js +1 -1
- package/metadata/hooks/useAppExperience.d.ts +1 -0
- package/metadata/hooks/useAppExperience.js +8 -0
- package/metadata/hooks/useAppStore.d.ts +1 -1
- package/metadata/hooks/useAppStore.js +3 -3
- package/metadata/hooks/useExperienceView.js +2 -11
- package/metadata/hooks/useExperienceViewCommands.d.ts +1 -1
- package/metadata/hooks/useExperienceViewCommands.js +5 -14
- package/metadata/hooks/useExperienceViewLookup.js +2 -11
- package/metadata/hooks/useExperienceViewSubgridCommands.d.ts +1 -1
- package/metadata/hooks/useExperienceViewSubgridCommands.js +5 -14
- package/metadata/hooks/useMetadata.d.ts +11 -10
- package/metadata/hooks/useMetadata.js +4 -16
- package/metadata/hooks/useSchema.d.ts +1 -1
- package/metadata/hooks/useSchema.js +3 -0
- package/mutable/context.d.ts +3 -0
- package/mutable/context.js +8 -0
- package/mutable/utils.js +5 -12
- package/navigation/hooks/useOpenForm.js +4 -0
- package/package.json +6 -10
- package/providers/PageEntityFormProvider/index.d.ts +5 -1
- package/providers/PageEntityFormProvider/index.js +2 -2
- package/recordset/hooks/useRecordSetResult.js +4 -14
- package/route/RouteProvider.d.ts +2 -2
- package/route/RouteProvider.js +4 -1
- package/store/ClientAppStore.js +7 -20
- package/store/ComponentStore.d.ts +1 -1
- package/store/ComponentStore.js +6 -12
- package/store/EventManager.d.ts +2 -2
- package/store/EventManager.js +13 -29
- package/store/SchemaExperienceStore.js +179 -215
- package/store/index.d.ts +0 -1
- package/store/index.js +0 -1
- package/toast-notification/hooks/useCloseToastNotification.js +17 -15
- package/toast-notification/hooks/useOpenToastNotification.js +7 -5
- package/transport/InMemoryDataService/index.js +54 -77
- package/transport/RestDataService/index.d.ts +3 -3
- package/transport/RestDataService/index.js +68 -91
- package/transport/context.d.ts +2 -1
- package/transport/context.js +7 -1
- package/transport/hooks/index.d.ts +1 -0
- package/transport/hooks/index.js +1 -0
- package/transport/hooks/useFileService.d.ts +1 -0
- package/transport/hooks/useFileService.js +9 -0
- package/transport/hooks/useRetriveRecords.d.ts +33 -0
- package/transport/hooks/useRetriveRecords.js +110 -0
- package/utils/calculateColumnWidths.js +1 -1
- package/utils/color.d.ts +1 -0
- package/utils/color.js +14 -0
- package/utils/getAttributeFormattedValue.d.ts +4 -1
- package/utils/getAttributeFormattedValue.js +109 -54
- package/utils/phone.d.ts +13 -0
- package/utils/phone.js +33 -0
- package/appearance/context.d.ts +0 -7
- package/appearance/context.js +0 -5
- package/appearance/hooks/index.d.ts +0 -1
- package/appearance/hooks/useAppearanceContext.d.ts +0 -1
- package/appearance/hooks/useAppearanceContext.js +0 -12
- package/appearance/index.d.ts +0 -2
- package/appearance/index.js +0 -20
- package/builders/CommandBuilder.d.ts +0 -176
- package/builders/CommandBuilder.js +0 -567
- package/locale/types.d.ts +0 -2
- /package/{locale → board}/types.js +0 -0
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.SubgridCommandBuilder = void 0;
|
|
13
|
-
const utils_1 = require("
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
6
|
+
const ViewCommandBuilder_1 = require("./ViewCommandBuilder");
|
|
7
|
+
var EnabledRules;
|
|
8
|
+
(function (EnabledRules) {
|
|
9
|
+
function HasCreatePermisssion(context) {
|
|
10
|
+
return !context.secondaryControl.schema.restrictions?.disableCreate;
|
|
11
|
+
}
|
|
12
|
+
EnabledRules.HasCreatePermisssion = HasCreatePermisssion;
|
|
13
|
+
function HasUpdatePermission(context) {
|
|
14
|
+
return !context.secondaryControl.schema.restrictions?.disableUpdate;
|
|
15
|
+
}
|
|
16
|
+
EnabledRules.HasUpdatePermission = HasUpdatePermission;
|
|
17
|
+
function HasDeletePermission(context) {
|
|
18
|
+
return !context.secondaryControl.schema.restrictions?.disableDelete;
|
|
19
|
+
}
|
|
20
|
+
EnabledRules.HasDeletePermission = HasDeletePermission;
|
|
21
|
+
function HasSingleRecordSelected(context) {
|
|
22
|
+
return context.secondaryControl.selectedIds.length === 1;
|
|
23
|
+
}
|
|
24
|
+
EnabledRules.HasSingleRecordSelected = HasSingleRecordSelected;
|
|
25
|
+
function HasAtLeastOneRecordSelected(context) {
|
|
26
|
+
return context.secondaryControl.selectedIds.length > 0;
|
|
27
|
+
}
|
|
28
|
+
EnabledRules.HasAtLeastOneRecordSelected = HasAtLeastOneRecordSelected;
|
|
29
|
+
})(EnabledRules || (EnabledRules = {}));
|
|
14
30
|
var SubgridCommandBuilder;
|
|
15
31
|
(function (SubgridCommandBuilder) {
|
|
16
32
|
function createNewRecordCommand({ Icon, text, localizedTexts, }) {
|
|
@@ -20,13 +36,25 @@ var SubgridCommandBuilder;
|
|
|
20
36
|
text,
|
|
21
37
|
localizedText: localizedTexts,
|
|
22
38
|
onClick: (context) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
if (context.secondaryControl.associated) {
|
|
40
|
+
context.navigation.openForm({
|
|
41
|
+
logicalName: context.secondaryControl.schema.logicalName,
|
|
42
|
+
parameters: {
|
|
43
|
+
[context.secondaryControl.associated.refAttributeName]: {
|
|
44
|
+
id: context.secondaryControl.associated.id,
|
|
45
|
+
logicalName: context.secondaryControl.associated.logicalName,
|
|
46
|
+
name: context.secondaryControl.associated.name,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
context.navigation.openForm({
|
|
53
|
+
logicalName: context.secondaryControl.schema.logicalName,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
29
56
|
},
|
|
57
|
+
hidden: (context) => !EnabledRules.HasCreatePermisssion(context),
|
|
30
58
|
};
|
|
31
59
|
}
|
|
32
60
|
SubgridCommandBuilder.createNewRecordCommand = createNewRecordCommand;
|
|
@@ -38,13 +66,9 @@ var SubgridCommandBuilder;
|
|
|
38
66
|
localizedText: localizedTexts,
|
|
39
67
|
isContextMenu: true,
|
|
40
68
|
onClick: (context) => {
|
|
41
|
-
|
|
42
|
-
},
|
|
43
|
-
// hidden: (context) => context.secondaryControl.selectedIds.length !== 1, // TODO: check permissions
|
|
44
|
-
hidden: (context) => {
|
|
45
|
-
console.log('temp.', context);
|
|
46
|
-
return context.secondaryControl.selectedIds.length !== 1;
|
|
69
|
+
context.secondaryControl.openRecord(context.secondaryControl.selectedIds[0]);
|
|
47
70
|
},
|
|
71
|
+
hidden: [(context) => !EnabledRules.HasSingleRecordSelected(context)],
|
|
48
72
|
};
|
|
49
73
|
}
|
|
50
74
|
SubgridCommandBuilder.createEditRecordCommand = createEditRecordCommand;
|
|
@@ -53,32 +77,11 @@ var SubgridCommandBuilder;
|
|
|
53
77
|
plural = singular[1];
|
|
54
78
|
singular = singular[0];
|
|
55
79
|
}
|
|
56
|
-
let msg = count === 1 ? singular : plural
|
|
80
|
+
let msg = count === 1 ? singular : plural ?? singular;
|
|
57
81
|
msg = msg.replace('{count}', count.toString());
|
|
58
82
|
return msg;
|
|
59
83
|
}
|
|
60
|
-
|
|
61
|
-
confirmation: {
|
|
62
|
-
text: [
|
|
63
|
-
'Are you sure you want to delete this record?',
|
|
64
|
-
'Are you sure you want to delete selected records?',
|
|
65
|
-
],
|
|
66
|
-
title: ['Delete record', 'Delete records'],
|
|
67
|
-
buttonConfirm: 'Delete',
|
|
68
|
-
buttonCancel: 'Cancel',
|
|
69
|
-
},
|
|
70
|
-
status: {
|
|
71
|
-
deleting: ['Deleting record', 'Deleting records'],
|
|
72
|
-
},
|
|
73
|
-
successNotification: {
|
|
74
|
-
title: ['Record deleted', 'Records deleted'],
|
|
75
|
-
text: ['Record deleted successfully', 'Records deleted successfully'],
|
|
76
|
-
},
|
|
77
|
-
errorNotification: {
|
|
78
|
-
title: 'Error',
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
function createDeleteRecordCommand({ Icon, localizedText, text, stringSet = SubgridCommandBuilder.defaultDeleteRecordStringSet, localizedStringSet, }) {
|
|
84
|
+
function createDeleteRecordCommand({ Icon, localizedText, text, stringSet = ViewCommandBuilder_1.ViewCommandBuilder.defaultDeleteRecordStringSet, localizedStringSet, }) {
|
|
82
85
|
return {
|
|
83
86
|
type: 'button',
|
|
84
87
|
Icon,
|
|
@@ -86,31 +89,32 @@ var SubgridCommandBuilder;
|
|
|
86
89
|
localizedText,
|
|
87
90
|
danger: true,
|
|
88
91
|
isContextMenu: true,
|
|
89
|
-
|
|
90
|
-
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
onClick: async (context) => {
|
|
91
93
|
const recordIds = context.secondaryControl.selectedIds;
|
|
92
94
|
if (!recordIds.length) {
|
|
93
95
|
return;
|
|
94
96
|
}
|
|
95
|
-
const localizeSelector = (0,
|
|
97
|
+
const localizeSelector = (0, utils_2.createLocalizedSelector)(stringSet, localizedStringSet, context.locale.language);
|
|
96
98
|
try {
|
|
97
|
-
const confirmResult =
|
|
99
|
+
const confirmResult = await context.utility.openConfirmDialog({
|
|
98
100
|
title: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.title)),
|
|
99
101
|
text: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.text)),
|
|
100
102
|
cancelButtonLabel: localizeSelector((s) => s.confirmation.buttonCancel),
|
|
101
103
|
confirmButtonLabel: localizeSelector((s) => s.confirmation.buttonConfirm),
|
|
102
104
|
});
|
|
103
|
-
if (!
|
|
105
|
+
if (!confirmResult?.confirmed) {
|
|
104
106
|
return;
|
|
105
107
|
}
|
|
106
108
|
context.utility.showProgressIndicator(plurialize(recordIds.length, localizeSelector((s) => s.status.deleting)) + '...');
|
|
107
|
-
|
|
109
|
+
for (const recordId of recordIds) {
|
|
110
|
+
await context.dataService.deleteRecord(context.secondaryControl.logicalName, recordId);
|
|
111
|
+
}
|
|
108
112
|
context.utility.showNotification({
|
|
109
113
|
title: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.title)),
|
|
110
114
|
text: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.text)),
|
|
111
115
|
type: 'success',
|
|
112
116
|
});
|
|
113
|
-
|
|
117
|
+
context.secondaryControl.refresh();
|
|
114
118
|
}
|
|
115
119
|
catch (error) {
|
|
116
120
|
context.utility.showNotification({
|
|
@@ -122,7 +126,11 @@ var SubgridCommandBuilder;
|
|
|
122
126
|
finally {
|
|
123
127
|
context.utility.hideProgressIndicator();
|
|
124
128
|
}
|
|
125
|
-
}
|
|
129
|
+
},
|
|
130
|
+
hidden: [
|
|
131
|
+
(context) => !EnabledRules.HasAtLeastOneRecordSelected(context),
|
|
132
|
+
(context) => !EnabledRules.HasDeletePermission(context),
|
|
133
|
+
],
|
|
126
134
|
};
|
|
127
135
|
}
|
|
128
136
|
SubgridCommandBuilder.createDeleteRecordCommand = createDeleteRecordCommand;
|
|
@@ -150,16 +158,66 @@ var SubgridCommandBuilder;
|
|
|
150
158
|
Icon: excel.Icon,
|
|
151
159
|
text: excel.text,
|
|
152
160
|
localizedTexts: excel.localizedTexts,
|
|
153
|
-
onClick: (context) => {
|
|
154
|
-
|
|
161
|
+
onClick: async (context) => {
|
|
162
|
+
context.utility.showProgressIndicator('Exporting to Excel...');
|
|
163
|
+
try {
|
|
164
|
+
const result = await (0, utils_1.retriveRecords)({
|
|
165
|
+
columnFilters: context.secondaryControl.columnFilter,
|
|
166
|
+
dataService: context.dataService,
|
|
167
|
+
gridColumns: context.secondaryControl.gridColumns,
|
|
168
|
+
schema: context.secondaryControl.schema,
|
|
169
|
+
schemaStore: context.stores.schemaStore,
|
|
170
|
+
view: context.secondaryControl.view,
|
|
171
|
+
search: context.secondaryControl.searchText,
|
|
172
|
+
extraFilter: context.secondaryControl.extraFilter,
|
|
173
|
+
sorting: context.secondaryControl.sorting,
|
|
174
|
+
skip: 0,
|
|
175
|
+
limit: 5000,
|
|
176
|
+
});
|
|
177
|
+
await (0, utils_1.exportRecordsXLS)({
|
|
178
|
+
fileName: context.secondaryControl.view.name + '.xlsx',
|
|
179
|
+
gridColumns: context.secondaryControl.gridColumns,
|
|
180
|
+
records: result.records,
|
|
181
|
+
schema: context.secondaryControl.schema,
|
|
182
|
+
schemaStore: context.stores.schemaStore,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
context.utility.hideProgressIndicator();
|
|
187
|
+
}
|
|
155
188
|
},
|
|
156
189
|
},
|
|
157
190
|
{
|
|
158
191
|
Icon: csv.Icon,
|
|
159
192
|
text: csv.text,
|
|
160
193
|
localizedTexts: csv.localizedTexts,
|
|
161
|
-
onClick: (context) => {
|
|
162
|
-
|
|
194
|
+
onClick: async (context) => {
|
|
195
|
+
context.utility.showProgressIndicator('Exporting to CSV...');
|
|
196
|
+
try {
|
|
197
|
+
const result = await (0, utils_1.retriveRecords)({
|
|
198
|
+
columnFilters: context.secondaryControl.columnFilter,
|
|
199
|
+
dataService: context.dataService,
|
|
200
|
+
gridColumns: context.secondaryControl.gridColumns,
|
|
201
|
+
schema: context.secondaryControl.schema,
|
|
202
|
+
schemaStore: context.stores.schemaStore,
|
|
203
|
+
view: context.secondaryControl.view,
|
|
204
|
+
search: context.secondaryControl.searchText,
|
|
205
|
+
extraFilter: context.secondaryControl.extraFilter,
|
|
206
|
+
sorting: context.secondaryControl.sorting,
|
|
207
|
+
skip: 0,
|
|
208
|
+
limit: 5000,
|
|
209
|
+
});
|
|
210
|
+
await (0, utils_1.exportRecordsCSV)({
|
|
211
|
+
fileName: context.secondaryControl.view.name + '.csv',
|
|
212
|
+
gridColumns: context.secondaryControl.gridColumns,
|
|
213
|
+
records: result.records,
|
|
214
|
+
schema: context.secondaryControl.schema,
|
|
215
|
+
schemaStore: context.stores.schemaStore,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
finally {
|
|
219
|
+
context.utility.hideProgressIndicator();
|
|
220
|
+
}
|
|
163
221
|
},
|
|
164
222
|
},
|
|
165
223
|
],
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.ViewCommandBuilder = void 0;
|
|
13
4
|
const utils_1 = require("../utils");
|
|
@@ -15,18 +6,15 @@ const utils_2 = require("./utils");
|
|
|
15
6
|
var EnabledRules;
|
|
16
7
|
(function (EnabledRules) {
|
|
17
8
|
function HasCreatePermisssion(context) {
|
|
18
|
-
|
|
19
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableCreate);
|
|
9
|
+
return !context.primaryControl.schema.restrictions?.disableCreate;
|
|
20
10
|
}
|
|
21
11
|
EnabledRules.HasCreatePermisssion = HasCreatePermisssion;
|
|
22
12
|
function HasUpdatePermission(context) {
|
|
23
|
-
|
|
24
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableUpdate);
|
|
13
|
+
return !context.primaryControl.schema.restrictions?.disableUpdate;
|
|
25
14
|
}
|
|
26
15
|
EnabledRules.HasUpdatePermission = HasUpdatePermission;
|
|
27
16
|
function HasDeletePermission(context) {
|
|
28
|
-
|
|
29
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableDelete);
|
|
17
|
+
return !context.primaryControl.schema.restrictions?.disableDelete;
|
|
30
18
|
}
|
|
31
19
|
EnabledRules.HasDeletePermission = HasDeletePermission;
|
|
32
20
|
function HasSingleRecordSelected(context) {
|
|
@@ -46,12 +34,12 @@ var ViewCommandBuilder;
|
|
|
46
34
|
Icon,
|
|
47
35
|
text,
|
|
48
36
|
localizedText: localizedTexts,
|
|
49
|
-
onClick: context => {
|
|
37
|
+
onClick: (context) => {
|
|
50
38
|
context.navigation.openForm({
|
|
51
39
|
logicalName: context.primaryControl.schema.logicalName,
|
|
52
40
|
});
|
|
53
41
|
},
|
|
54
|
-
hidden: context => {
|
|
42
|
+
hidden: (context) => {
|
|
55
43
|
if (!EnabledRules.HasCreatePermisssion(context)) {
|
|
56
44
|
return true;
|
|
57
45
|
}
|
|
@@ -67,18 +55,10 @@ var ViewCommandBuilder;
|
|
|
67
55
|
text,
|
|
68
56
|
localizedText: localizedTexts,
|
|
69
57
|
isContextMenu: true,
|
|
70
|
-
onClick: context => {
|
|
58
|
+
onClick: (context) => {
|
|
71
59
|
context.primaryControl.openRecord(context.primaryControl.selectedIds[0]);
|
|
72
60
|
},
|
|
73
|
-
hidden: context =>
|
|
74
|
-
if (!EnabledRules.HasUpdatePermission(context)) {
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
if (!EnabledRules.HasSingleRecordSelected(context)) {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
return false;
|
|
81
|
-
},
|
|
61
|
+
hidden: [(context) => !EnabledRules.HasSingleRecordSelected(context)],
|
|
82
62
|
};
|
|
83
63
|
}
|
|
84
64
|
ViewCommandBuilder.createEditRecordCommand = createEditRecordCommand;
|
|
@@ -111,36 +91,36 @@ var ViewCommandBuilder;
|
|
|
111
91
|
localizedText,
|
|
112
92
|
danger: true,
|
|
113
93
|
isContextMenu: true,
|
|
114
|
-
onClick: (context) =>
|
|
94
|
+
onClick: async (context) => {
|
|
115
95
|
const recordIds = context.primaryControl.selectedIds;
|
|
116
96
|
if (!recordIds.length) {
|
|
117
97
|
return;
|
|
118
98
|
}
|
|
119
99
|
const localizeSelector = (0, utils_2.createLocalizedSelector)(stringSet, localizedStringSet, context.locale.language);
|
|
120
100
|
try {
|
|
121
|
-
const confirmResult =
|
|
122
|
-
title: (0, utils_2.plurialize)(recordIds.length, localizeSelector(s => s.confirmation.title)),
|
|
123
|
-
text: (0, utils_2.plurialize)(recordIds.length, localizeSelector(s => s.confirmation.text)),
|
|
124
|
-
cancelButtonLabel: localizeSelector(s => s.confirmation.buttonCancel),
|
|
125
|
-
confirmButtonLabel: localizeSelector(s => s.confirmation.buttonConfirm),
|
|
101
|
+
const confirmResult = await context.utility.openConfirmDialog({
|
|
102
|
+
title: (0, utils_2.plurialize)(recordIds.length, localizeSelector((s) => s.confirmation.title)),
|
|
103
|
+
text: (0, utils_2.plurialize)(recordIds.length, localizeSelector((s) => s.confirmation.text)),
|
|
104
|
+
cancelButtonLabel: localizeSelector((s) => s.confirmation.buttonCancel),
|
|
105
|
+
confirmButtonLabel: localizeSelector((s) => s.confirmation.buttonConfirm),
|
|
126
106
|
});
|
|
127
|
-
if (!
|
|
107
|
+
if (!confirmResult?.confirmed) {
|
|
128
108
|
return;
|
|
129
109
|
}
|
|
130
|
-
context.utility.showProgressIndicator((0, utils_2.plurialize)(recordIds.length, localizeSelector(s => s.status.deleting)) + '...');
|
|
110
|
+
context.utility.showProgressIndicator((0, utils_2.plurialize)(recordIds.length, localizeSelector((s) => s.status.deleting)) + '...');
|
|
131
111
|
for (const recordId of recordIds) {
|
|
132
|
-
|
|
112
|
+
await context.dataService.deleteRecord(context.primaryControl.logicalName, recordId);
|
|
133
113
|
}
|
|
134
114
|
context.utility.showNotification({
|
|
135
|
-
title: (0, utils_2.plurialize)(recordIds.length, localizeSelector(s => s.successNotification.title)),
|
|
136
|
-
text: (0, utils_2.plurialize)(recordIds.length, localizeSelector(s => s.successNotification.text)),
|
|
115
|
+
title: (0, utils_2.plurialize)(recordIds.length, localizeSelector((s) => s.successNotification.title)),
|
|
116
|
+
text: (0, utils_2.plurialize)(recordIds.length, localizeSelector((s) => s.successNotification.text)),
|
|
137
117
|
type: 'success',
|
|
138
118
|
});
|
|
139
119
|
context.primaryControl.refresh();
|
|
140
120
|
}
|
|
141
121
|
catch (error) {
|
|
142
122
|
context.utility.showNotification({
|
|
143
|
-
title: localizeSelector(s => s.errorNotification.title),
|
|
123
|
+
title: localizeSelector((s) => s.errorNotification.title),
|
|
144
124
|
text: error.message,
|
|
145
125
|
type: 'error',
|
|
146
126
|
});
|
|
@@ -148,10 +128,10 @@ var ViewCommandBuilder;
|
|
|
148
128
|
finally {
|
|
149
129
|
context.utility.hideProgressIndicator();
|
|
150
130
|
}
|
|
151
|
-
}
|
|
131
|
+
},
|
|
152
132
|
hidden: [
|
|
153
|
-
context => !EnabledRules.HasAtLeastOneRecordSelected(context),
|
|
154
|
-
context => !EnabledRules.HasDeletePermission(context),
|
|
133
|
+
(context) => !EnabledRules.HasAtLeastOneRecordSelected(context),
|
|
134
|
+
(context) => !EnabledRules.HasDeletePermission(context),
|
|
155
135
|
],
|
|
156
136
|
};
|
|
157
137
|
}
|
|
@@ -162,7 +142,7 @@ var ViewCommandBuilder;
|
|
|
162
142
|
Icon,
|
|
163
143
|
text,
|
|
164
144
|
localizedText: localizedTexts,
|
|
165
|
-
onClick: context => {
|
|
145
|
+
onClick: (context) => {
|
|
166
146
|
context.primaryControl.refresh();
|
|
167
147
|
},
|
|
168
148
|
};
|
|
@@ -180,10 +160,10 @@ var ViewCommandBuilder;
|
|
|
180
160
|
Icon: excel.Icon,
|
|
181
161
|
text: excel.text,
|
|
182
162
|
localizedTexts: excel.localizedTexts,
|
|
183
|
-
onClick: (context) =>
|
|
163
|
+
onClick: async (context) => {
|
|
184
164
|
context.utility.showProgressIndicator('Exporting to Excel...');
|
|
185
165
|
try {
|
|
186
|
-
const result =
|
|
166
|
+
const result = await (0, utils_1.retriveRecords)({
|
|
187
167
|
columnFilters: context.primaryControl.columnFilter,
|
|
188
168
|
dataService: context.dataService,
|
|
189
169
|
gridColumns: context.primaryControl.gridColumns,
|
|
@@ -196,7 +176,7 @@ var ViewCommandBuilder;
|
|
|
196
176
|
skip: 0,
|
|
197
177
|
limit: 5000,
|
|
198
178
|
});
|
|
199
|
-
|
|
179
|
+
await (0, utils_1.exportRecordsXLS)({
|
|
200
180
|
fileName: context.primaryControl.view.name + '.xlsx',
|
|
201
181
|
gridColumns: context.primaryControl.gridColumns,
|
|
202
182
|
records: result.records,
|
|
@@ -207,16 +187,16 @@ var ViewCommandBuilder;
|
|
|
207
187
|
finally {
|
|
208
188
|
context.utility.hideProgressIndicator();
|
|
209
189
|
}
|
|
210
|
-
}
|
|
190
|
+
},
|
|
211
191
|
},
|
|
212
192
|
{
|
|
213
193
|
Icon: csv.Icon,
|
|
214
194
|
text: csv.text,
|
|
215
195
|
localizedTexts: csv.localizedTexts,
|
|
216
|
-
onClick: (context) =>
|
|
217
|
-
context.utility.showProgressIndicator('Exporting to
|
|
196
|
+
onClick: async (context) => {
|
|
197
|
+
context.utility.showProgressIndicator('Exporting to CSV...');
|
|
218
198
|
try {
|
|
219
|
-
const result =
|
|
199
|
+
const result = await (0, utils_1.retriveRecords)({
|
|
220
200
|
columnFilters: context.primaryControl.columnFilter,
|
|
221
201
|
dataService: context.dataService,
|
|
222
202
|
gridColumns: context.primaryControl.gridColumns,
|
|
@@ -229,7 +209,7 @@ var ViewCommandBuilder;
|
|
|
229
209
|
skip: 0,
|
|
230
210
|
limit: 5000,
|
|
231
211
|
});
|
|
232
|
-
|
|
212
|
+
await (0, utils_1.exportRecordsCSV)({
|
|
233
213
|
fileName: context.primaryControl.view.name + '.csv',
|
|
234
214
|
gridColumns: context.primaryControl.gridColumns,
|
|
235
215
|
records: result.records,
|
|
@@ -240,7 +220,7 @@ var ViewCommandBuilder;
|
|
|
240
220
|
finally {
|
|
241
221
|
context.utility.hideProgressIndicator();
|
|
242
222
|
}
|
|
243
|
-
}
|
|
223
|
+
},
|
|
244
224
|
},
|
|
245
225
|
],
|
|
246
226
|
],
|
|
@@ -15,7 +15,7 @@ function plurialize(count, singular, plural) {
|
|
|
15
15
|
plural = singular[1];
|
|
16
16
|
singular = singular[0];
|
|
17
17
|
}
|
|
18
|
-
let msg = count === 1 ? singular : plural
|
|
18
|
+
let msg = count === 1 ? singular : plural ?? singular;
|
|
19
19
|
msg = msg.replace('{count}', count.toString());
|
|
20
20
|
return msg;
|
|
21
21
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FormExperience as $FormExperience, Section as $Section } from '@headless-adminapp/core/experience/form';
|
|
2
|
+
import type { SectionControl as $SectionControl } from '@headless-adminapp/core/experience/form/SectionControl';
|
|
3
|
+
import type { Tab as $Tab } from '@headless-adminapp/core/experience/form/Tab';
|
|
4
|
+
import type { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
5
|
+
export declare namespace DefineFormExperience {
|
|
6
|
+
export type Experience<S extends SchemaAttributes = SchemaAttributes> = (Pick<$FormExperience<S>, 'useHookFn' | 'relatedItems' | 'processFlow' | 'cloneAttributes' | 'defaultValues' | 'includeAttributes' | 'headerControls'> & {
|
|
7
|
+
tabs: Tab<S>[];
|
|
8
|
+
}) | (keyof S)[];
|
|
9
|
+
export function resolveExperience<S extends SchemaAttributes = SchemaAttributes>(v: Experience<S>): $FormExperience<S>;
|
|
10
|
+
type Tab<S extends SchemaAttributes = SchemaAttributes> = Pick<$Tab<S>, 'label' | 'localizedLabels' | 'name'> & ({
|
|
11
|
+
tabColumns: TabColumn<S>[];
|
|
12
|
+
columnCount?: $Tab<S>['columnCount'];
|
|
13
|
+
columnWidths?: $Tab<S>['columnWidths'];
|
|
14
|
+
} | {
|
|
15
|
+
sections: Section<S>[];
|
|
16
|
+
} | {
|
|
17
|
+
controls: SectionControl<S>[];
|
|
18
|
+
});
|
|
19
|
+
type TabColumn<S extends SchemaAttributes = SchemaAttributes> = {
|
|
20
|
+
sections: Section<S>[];
|
|
21
|
+
};
|
|
22
|
+
type Section<S extends SchemaAttributes = SchemaAttributes> = Pick<$Section<S>, 'label' | 'columnCount' | 'labelPosition' | 'name' | 'localizedLabels' | 'hidden' | 'hideLabel' | 'noPadding'> & {
|
|
23
|
+
controls: SectionControl<S>[];
|
|
24
|
+
};
|
|
25
|
+
export type SectionControl<S extends SchemaAttributes = SchemaAttributes> = $SectionControl<S> | keyof S;
|
|
26
|
+
export {};
|
|
27
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefineFormExperience = void 0;
|
|
4
|
+
var DefineFormExperience;
|
|
5
|
+
(function (DefineFormExperience) {
|
|
6
|
+
function resolveExperience(v) {
|
|
7
|
+
if (Array.isArray(v)) {
|
|
8
|
+
return {
|
|
9
|
+
tabs: [
|
|
10
|
+
{
|
|
11
|
+
label: 'General',
|
|
12
|
+
name: 'general',
|
|
13
|
+
columnCount: 2,
|
|
14
|
+
tabColumns: [
|
|
15
|
+
{
|
|
16
|
+
sections: [
|
|
17
|
+
{
|
|
18
|
+
label: 'General',
|
|
19
|
+
name: 'general',
|
|
20
|
+
hideLabel: true,
|
|
21
|
+
controls: v.map(resolveSectionControl),
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
return {
|
|
32
|
+
...v,
|
|
33
|
+
tabs: v.tabs.map(resolveTab),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
DefineFormExperience.resolveExperience = resolveExperience;
|
|
38
|
+
function resolveTab(v) {
|
|
39
|
+
const tab = {
|
|
40
|
+
label: v.label,
|
|
41
|
+
name: v.name,
|
|
42
|
+
localizedLabels: v.localizedLabels,
|
|
43
|
+
};
|
|
44
|
+
if ('tabColumns' in v) {
|
|
45
|
+
tab.columnCount = v.columnCount ?? 2;
|
|
46
|
+
tab.columnWidths = v.columnWidths;
|
|
47
|
+
tab.tabColumns = v.tabColumns.map(resolveTabColumn);
|
|
48
|
+
}
|
|
49
|
+
else if ('sections' in v) {
|
|
50
|
+
tab.columnCount = 2;
|
|
51
|
+
tab.tabColumns = [
|
|
52
|
+
{
|
|
53
|
+
sections: v.sections.map(resolveSection),
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
else if ('controls' in v) {
|
|
58
|
+
tab.columnCount = 2;
|
|
59
|
+
tab.tabColumns = [
|
|
60
|
+
{
|
|
61
|
+
sections: [
|
|
62
|
+
{
|
|
63
|
+
label: 'General',
|
|
64
|
+
name: 'general',
|
|
65
|
+
hideLabel: true,
|
|
66
|
+
controls: v.controls.map(resolveSectionControl),
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
throw new Error('Invalid tab');
|
|
74
|
+
}
|
|
75
|
+
return tab;
|
|
76
|
+
}
|
|
77
|
+
function resolveTabColumn(v) {
|
|
78
|
+
return {
|
|
79
|
+
sections: v.sections.map(resolveSection),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function resolveSection(v) {
|
|
83
|
+
return {
|
|
84
|
+
...v,
|
|
85
|
+
controls: v.controls.map(resolveSectionControl),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function resolveSectionControl(v) {
|
|
89
|
+
if (typeof v === 'string') {
|
|
90
|
+
return {
|
|
91
|
+
type: 'standard',
|
|
92
|
+
attributeName: v,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return v;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
})(DefineFormExperience || (exports.DefineFormExperience = DefineFormExperience = {}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ViewColumn as $ViewColumn, ViewExperience as $ViewExperience } from '@headless-adminapp/core/experience/view';
|
|
2
|
+
import type { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
3
|
+
export declare namespace DefineViewExperience {
|
|
4
|
+
export type Experience<S extends SchemaAttributes = SchemaAttributes> = Pick<$ViewExperience<S>, 'filter' | 'defaultSorting' | 'card'> & {
|
|
5
|
+
grid: GridView<S>;
|
|
6
|
+
};
|
|
7
|
+
type GridView<S extends SchemaAttributes = SchemaAttributes> = {
|
|
8
|
+
columns: ViewColumn<S>[];
|
|
9
|
+
} | ViewColumn<S>[];
|
|
10
|
+
type ViewColumn<S extends SchemaAttributes = SchemaAttributes> = $ViewColumn<S> | keyof S;
|
|
11
|
+
export function resolveExperience<S extends SchemaAttributes = SchemaAttributes>(v: Experience<S>): $ViewExperience<S>;
|
|
12
|
+
export {};
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefineViewExperience = void 0;
|
|
4
|
+
var DefineViewExperience;
|
|
5
|
+
(function (DefineViewExperience) {
|
|
6
|
+
function resolveExperience(v) {
|
|
7
|
+
return {
|
|
8
|
+
...v,
|
|
9
|
+
grid: resolveGridView(v.grid),
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
DefineViewExperience.resolveExperience = resolveExperience;
|
|
13
|
+
function resolveGridView(v) {
|
|
14
|
+
if (Array.isArray(v)) {
|
|
15
|
+
return {
|
|
16
|
+
columns: v.map(resolveViewColumn),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
columns: v.columns.map(resolveViewColumn),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function resolveViewColumn(v) {
|
|
24
|
+
if (typeof v === 'string') {
|
|
25
|
+
return {
|
|
26
|
+
name: v,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return v;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
})(DefineViewExperience || (exports.DefineViewExperience = DefineViewExperience = {}));
|