@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,567 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CommandBuilder = void 0;
|
|
13
|
-
exports.localizedLabel = localizedLabel;
|
|
14
|
-
exports.createLocalizedSelector = createLocalizedSelector;
|
|
15
|
-
const utils_1 = require("./utils");
|
|
16
|
-
function localizedLabel(language, value, fallback) {
|
|
17
|
-
var _a, _b, _c, _d, _e;
|
|
18
|
-
return ((_e = (_d = (_b = (_a = value.localizedLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : (_c = fallback === null || fallback === void 0 ? void 0 : fallback.localizedLabels) === null || _c === void 0 ? void 0 : _c[language]) !== null && _d !== void 0 ? _d : value.label) !== null && _e !== void 0 ? _e : fallback === null || fallback === void 0 ? void 0 : fallback.label);
|
|
19
|
-
}
|
|
20
|
-
function createLocalizedSelector(stringSet, localizedStringSet, language) {
|
|
21
|
-
return function selectLocalized(selector) {
|
|
22
|
-
if (localizedStringSet && localizedStringSet[language]) {
|
|
23
|
-
return selector(localizedStringSet[language]);
|
|
24
|
-
}
|
|
25
|
-
return selector(stringSet);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
var CommandBuilder;
|
|
29
|
-
(function (CommandBuilder) {
|
|
30
|
-
let View;
|
|
31
|
-
(function (View) {
|
|
32
|
-
let EnabledRules;
|
|
33
|
-
(function (EnabledRules) {
|
|
34
|
-
function HasCreatePermisssion(context) {
|
|
35
|
-
var _a;
|
|
36
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableCreate);
|
|
37
|
-
}
|
|
38
|
-
EnabledRules.HasCreatePermisssion = HasCreatePermisssion;
|
|
39
|
-
function HasUpdatePermission(context) {
|
|
40
|
-
var _a;
|
|
41
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableUpdate);
|
|
42
|
-
}
|
|
43
|
-
EnabledRules.HasUpdatePermission = HasUpdatePermission;
|
|
44
|
-
function HasDeletePermission(context) {
|
|
45
|
-
var _a;
|
|
46
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableDelete);
|
|
47
|
-
}
|
|
48
|
-
EnabledRules.HasDeletePermission = HasDeletePermission;
|
|
49
|
-
function HasSingleRecordSelected(context) {
|
|
50
|
-
return context.primaryControl.selectedIds.length === 1;
|
|
51
|
-
}
|
|
52
|
-
EnabledRules.HasSingleRecordSelected = HasSingleRecordSelected;
|
|
53
|
-
function HasAtLeastOneRecordSelected(context) {
|
|
54
|
-
return context.primaryControl.selectedIds.length > 0;
|
|
55
|
-
}
|
|
56
|
-
EnabledRules.HasAtLeastOneRecordSelected = HasAtLeastOneRecordSelected;
|
|
57
|
-
})(EnabledRules || (EnabledRules = {}));
|
|
58
|
-
function createNewRecordCommand({ Icon, text, localizedTexts, }) {
|
|
59
|
-
return {
|
|
60
|
-
type: 'button',
|
|
61
|
-
Icon,
|
|
62
|
-
text,
|
|
63
|
-
localizedText: localizedTexts,
|
|
64
|
-
onClick: (context) => {
|
|
65
|
-
context.navigation.openForm({
|
|
66
|
-
logicalName: context.primaryControl.schema.logicalName,
|
|
67
|
-
});
|
|
68
|
-
},
|
|
69
|
-
hidden: (context) => {
|
|
70
|
-
if (!EnabledRules.HasCreatePermisssion(context)) {
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
return false;
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
View.createNewRecordCommand = createNewRecordCommand;
|
|
78
|
-
function createEditRecordCommand({ Icon, text, localizedTexts, }) {
|
|
79
|
-
return {
|
|
80
|
-
type: 'button',
|
|
81
|
-
Icon,
|
|
82
|
-
text,
|
|
83
|
-
localizedText: localizedTexts,
|
|
84
|
-
isContextMenu: true,
|
|
85
|
-
onClick: (context) => {
|
|
86
|
-
context.primaryControl.openRecord(context.primaryControl.selectedIds[0]);
|
|
87
|
-
},
|
|
88
|
-
hidden: (context) => {
|
|
89
|
-
if (!EnabledRules.HasUpdatePermission(context)) {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
if (!EnabledRules.HasSingleRecordSelected(context)) {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
return false;
|
|
96
|
-
},
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
View.createEditRecordCommand = createEditRecordCommand;
|
|
100
|
-
function plurialize(count, singular, plural) {
|
|
101
|
-
if (Array.isArray(singular)) {
|
|
102
|
-
plural = singular[1];
|
|
103
|
-
singular = singular[0];
|
|
104
|
-
}
|
|
105
|
-
let msg = count === 1 ? singular : plural !== null && plural !== void 0 ? plural : singular;
|
|
106
|
-
msg = msg.replace('{count}', count.toString());
|
|
107
|
-
return msg;
|
|
108
|
-
}
|
|
109
|
-
View.defaultDeleteRecordStringSet = {
|
|
110
|
-
confirmation: {
|
|
111
|
-
text: [
|
|
112
|
-
'Are you sure you want to delete this record?',
|
|
113
|
-
'Are you sure you want to delete selected records?',
|
|
114
|
-
],
|
|
115
|
-
title: ['Delete record', 'Delete records'],
|
|
116
|
-
buttonConfirm: 'Delete',
|
|
117
|
-
buttonCancel: 'Cancel',
|
|
118
|
-
},
|
|
119
|
-
status: {
|
|
120
|
-
deleting: ['Deleting record', 'Deleting records'],
|
|
121
|
-
},
|
|
122
|
-
successNotification: {
|
|
123
|
-
title: ['Record deleted', 'Records deleted'],
|
|
124
|
-
text: ['Record deleted successfully', 'Records deleted successfully'],
|
|
125
|
-
},
|
|
126
|
-
errorNotification: {
|
|
127
|
-
title: 'Error',
|
|
128
|
-
},
|
|
129
|
-
};
|
|
130
|
-
function createDeleteRecordCommand({ Icon, localizedText, text, stringSet = View.defaultDeleteRecordStringSet, localizedStringSet, }) {
|
|
131
|
-
return {
|
|
132
|
-
type: 'button',
|
|
133
|
-
Icon,
|
|
134
|
-
text,
|
|
135
|
-
localizedText,
|
|
136
|
-
danger: true,
|
|
137
|
-
isContextMenu: true,
|
|
138
|
-
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
139
|
-
const recordIds = context.primaryControl.selectedIds;
|
|
140
|
-
if (!recordIds.length) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
const localizeSelector = createLocalizedSelector(stringSet, localizedStringSet, context.locale.language);
|
|
144
|
-
try {
|
|
145
|
-
const confirmResult = yield context.utility.openConfirmDialog({
|
|
146
|
-
title: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.title)),
|
|
147
|
-
text: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.text)),
|
|
148
|
-
cancelButtonLabel: localizeSelector((s) => s.confirmation.buttonCancel),
|
|
149
|
-
confirmButtonLabel: localizeSelector((s) => s.confirmation.buttonConfirm),
|
|
150
|
-
});
|
|
151
|
-
if (!(confirmResult === null || confirmResult === void 0 ? void 0 : confirmResult.confirmed)) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
context.utility.showProgressIndicator(plurialize(recordIds.length, localizeSelector((s) => s.status.deleting)) + '...');
|
|
155
|
-
for (const recordId of recordIds) {
|
|
156
|
-
yield context.dataService.deleteRecord(context.primaryControl.logicalName, recordId);
|
|
157
|
-
}
|
|
158
|
-
context.utility.showNotification({
|
|
159
|
-
title: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.title)),
|
|
160
|
-
text: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.text)),
|
|
161
|
-
type: 'success',
|
|
162
|
-
});
|
|
163
|
-
context.primaryControl.refresh();
|
|
164
|
-
}
|
|
165
|
-
catch (error) {
|
|
166
|
-
context.utility.showNotification({
|
|
167
|
-
title: localizeSelector((s) => s.errorNotification.title),
|
|
168
|
-
text: error.message,
|
|
169
|
-
type: 'error',
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
finally {
|
|
173
|
-
context.utility.hideProgressIndicator();
|
|
174
|
-
}
|
|
175
|
-
}),
|
|
176
|
-
hidden: [
|
|
177
|
-
(context) => !EnabledRules.HasAtLeastOneRecordSelected(context),
|
|
178
|
-
(context) => !EnabledRules.HasDeletePermission(context),
|
|
179
|
-
],
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
View.createDeleteRecordCommand = createDeleteRecordCommand;
|
|
183
|
-
function createRefreshCommand({ Icon, localizedTexts, text, }) {
|
|
184
|
-
return {
|
|
185
|
-
type: 'button',
|
|
186
|
-
Icon,
|
|
187
|
-
text,
|
|
188
|
-
localizedText: localizedTexts,
|
|
189
|
-
onClick: (context) => {
|
|
190
|
-
context.primaryControl.refresh();
|
|
191
|
-
},
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
View.createRefreshCommand = createRefreshCommand;
|
|
195
|
-
function createExportCommand({ button, csv, excel, }) {
|
|
196
|
-
return {
|
|
197
|
-
type: 'menu',
|
|
198
|
-
Icon: button.Icon,
|
|
199
|
-
text: button.text,
|
|
200
|
-
localizedTexts: button.localizedTexts,
|
|
201
|
-
items: [
|
|
202
|
-
[
|
|
203
|
-
{
|
|
204
|
-
Icon: excel.Icon,
|
|
205
|
-
text: excel.text,
|
|
206
|
-
localizedTexts: excel.localizedTexts,
|
|
207
|
-
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
208
|
-
context.utility.showProgressIndicator('Exporting to Excel...');
|
|
209
|
-
try {
|
|
210
|
-
const result = yield (0, utils_1.retriveRecords)({
|
|
211
|
-
columnFilters: context.primaryControl.columnFilter,
|
|
212
|
-
dataService: context.dataService,
|
|
213
|
-
gridColumns: context.primaryControl.gridColumns,
|
|
214
|
-
schema: context.primaryControl.schema,
|
|
215
|
-
schemaStore: context.stores.schemaStore,
|
|
216
|
-
view: context.primaryControl.view,
|
|
217
|
-
search: context.primaryControl.searchText,
|
|
218
|
-
extraFilter: context.primaryControl.extraFilter,
|
|
219
|
-
sorting: context.primaryControl.sorting,
|
|
220
|
-
skip: 0,
|
|
221
|
-
limit: 5000,
|
|
222
|
-
});
|
|
223
|
-
yield (0, utils_1.exportRecordsXLS)({
|
|
224
|
-
fileName: context.primaryControl.view.name + '.xlsx',
|
|
225
|
-
gridColumns: context.primaryControl.gridColumns,
|
|
226
|
-
records: result.records,
|
|
227
|
-
schema: context.primaryControl.schema,
|
|
228
|
-
schemaStore: context.stores.schemaStore,
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
finally {
|
|
232
|
-
context.utility.hideProgressIndicator();
|
|
233
|
-
}
|
|
234
|
-
}),
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
Icon: csv.Icon,
|
|
238
|
-
text: csv.text,
|
|
239
|
-
localizedTexts: csv.localizedTexts,
|
|
240
|
-
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
241
|
-
context.utility.showProgressIndicator('Exporting to Excel...');
|
|
242
|
-
try {
|
|
243
|
-
const result = yield (0, utils_1.retriveRecords)({
|
|
244
|
-
columnFilters: context.primaryControl.columnFilter,
|
|
245
|
-
dataService: context.dataService,
|
|
246
|
-
gridColumns: context.primaryControl.gridColumns,
|
|
247
|
-
schema: context.primaryControl.schema,
|
|
248
|
-
schemaStore: context.stores.schemaStore,
|
|
249
|
-
view: context.primaryControl.view,
|
|
250
|
-
search: context.primaryControl.searchText,
|
|
251
|
-
extraFilter: context.primaryControl.extraFilter,
|
|
252
|
-
sorting: context.primaryControl.sorting,
|
|
253
|
-
skip: 0,
|
|
254
|
-
limit: 5000,
|
|
255
|
-
});
|
|
256
|
-
yield (0, utils_1.exportRecordsCSV)({
|
|
257
|
-
fileName: context.primaryControl.view.name + '.csv',
|
|
258
|
-
gridColumns: context.primaryControl.gridColumns,
|
|
259
|
-
records: result.records,
|
|
260
|
-
schema: context.primaryControl.schema,
|
|
261
|
-
schemaStore: context.stores.schemaStore,
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
finally {
|
|
265
|
-
context.utility.hideProgressIndicator();
|
|
266
|
-
}
|
|
267
|
-
}),
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
],
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
View.createExportCommand = createExportCommand;
|
|
274
|
-
})(View = CommandBuilder.View || (CommandBuilder.View = {}));
|
|
275
|
-
let Form;
|
|
276
|
-
(function (Form) {
|
|
277
|
-
function createSaveCommand({ Icon, text, localizedTexts, }) {
|
|
278
|
-
return {
|
|
279
|
-
type: 'button',
|
|
280
|
-
Icon,
|
|
281
|
-
text,
|
|
282
|
-
localizedText: localizedTexts,
|
|
283
|
-
isQuickAction: true,
|
|
284
|
-
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
285
|
-
yield context.primaryControl.save('save');
|
|
286
|
-
}),
|
|
287
|
-
hidden: (context) => {
|
|
288
|
-
if (context.primaryControl.readonly) {
|
|
289
|
-
return true;
|
|
290
|
-
}
|
|
291
|
-
return false;
|
|
292
|
-
},
|
|
293
|
-
};
|
|
294
|
-
}
|
|
295
|
-
Form.createSaveCommand = createSaveCommand;
|
|
296
|
-
function createSaveAndCloseCommand({ Icon, text, localizedTexts, }) {
|
|
297
|
-
return {
|
|
298
|
-
type: 'button',
|
|
299
|
-
Icon,
|
|
300
|
-
text,
|
|
301
|
-
localizedText: localizedTexts,
|
|
302
|
-
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
303
|
-
yield context.primaryControl.save('saveandclose');
|
|
304
|
-
}),
|
|
305
|
-
hidden: (context) => {
|
|
306
|
-
if (context.primaryControl.readonly) {
|
|
307
|
-
return true;
|
|
308
|
-
}
|
|
309
|
-
return false;
|
|
310
|
-
},
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
Form.createSaveAndCloseCommand = createSaveAndCloseCommand;
|
|
314
|
-
Form.defaultDeleteRecordStringSet = {
|
|
315
|
-
confirmation: {
|
|
316
|
-
text: 'Are you sure you want to delete this record?',
|
|
317
|
-
title: 'Delete record',
|
|
318
|
-
buttonConfirm: 'Delete',
|
|
319
|
-
buttonCancel: 'Cancel',
|
|
320
|
-
},
|
|
321
|
-
status: {
|
|
322
|
-
deleting: 'Deleting record',
|
|
323
|
-
},
|
|
324
|
-
successNotification: {
|
|
325
|
-
title: 'Record deleted',
|
|
326
|
-
text: 'Record deleted successfully',
|
|
327
|
-
},
|
|
328
|
-
errorNotification: {
|
|
329
|
-
title: 'Error',
|
|
330
|
-
},
|
|
331
|
-
};
|
|
332
|
-
function createDeleteCommand({ Icon, text, localizedTexts, stringSet, }) {
|
|
333
|
-
return {
|
|
334
|
-
Icon: Icon,
|
|
335
|
-
type: 'button',
|
|
336
|
-
text,
|
|
337
|
-
localizedText: localizedTexts,
|
|
338
|
-
danger: true,
|
|
339
|
-
hidden: (context) => {
|
|
340
|
-
var _a;
|
|
341
|
-
if (!context.primaryControl.recordId) {
|
|
342
|
-
return true;
|
|
343
|
-
}
|
|
344
|
-
if ((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableDelete) {
|
|
345
|
-
return true;
|
|
346
|
-
}
|
|
347
|
-
return false;
|
|
348
|
-
},
|
|
349
|
-
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
350
|
-
const recordId = context.primaryControl.recordId;
|
|
351
|
-
if (!recordId) {
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
if (typeof stringSet === 'function') {
|
|
355
|
-
stringSet = stringSet(context);
|
|
356
|
-
}
|
|
357
|
-
try {
|
|
358
|
-
const confirmResult = yield context.utility.openConfirmDialog({
|
|
359
|
-
title: stringSet.confirmation.title,
|
|
360
|
-
text: stringSet.confirmation.text,
|
|
361
|
-
cancelButtonLabel: stringSet.confirmation.buttonCancel,
|
|
362
|
-
confirmButtonLabel: stringSet.confirmation.buttonConfirm,
|
|
363
|
-
});
|
|
364
|
-
if (!(confirmResult === null || confirmResult === void 0 ? void 0 : confirmResult.confirmed)) {
|
|
365
|
-
return;
|
|
366
|
-
}
|
|
367
|
-
context.utility.showProgressIndicator(stringSet.status.deleting + '...');
|
|
368
|
-
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
369
|
-
// await context.dataService.deleteRecord(
|
|
370
|
-
// context.primaryControl.logicalName,
|
|
371
|
-
// recordId
|
|
372
|
-
// );
|
|
373
|
-
context.utility.showNotification({
|
|
374
|
-
title: stringSet.successNotification.title,
|
|
375
|
-
text: stringSet.successNotification.text,
|
|
376
|
-
type: 'success',
|
|
377
|
-
});
|
|
378
|
-
// context.primaryControl.close();
|
|
379
|
-
}
|
|
380
|
-
catch (error) {
|
|
381
|
-
context.utility.showNotification({
|
|
382
|
-
title: stringSet.errorNotification.title,
|
|
383
|
-
text: error.message,
|
|
384
|
-
type: 'error',
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
finally {
|
|
388
|
-
context.utility.hideProgressIndicator();
|
|
389
|
-
}
|
|
390
|
-
}),
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
Form.createDeleteCommand = createDeleteCommand;
|
|
394
|
-
function createRefreshCommand({ Icon, text, localizedTexts, }) {
|
|
395
|
-
return {
|
|
396
|
-
Icon,
|
|
397
|
-
type: 'button',
|
|
398
|
-
text,
|
|
399
|
-
localizedText: localizedTexts,
|
|
400
|
-
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
401
|
-
yield context.primaryControl.refresh();
|
|
402
|
-
}),
|
|
403
|
-
hidden: (context) => !context.primaryControl.recordId,
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
Form.createRefreshCommand = createRefreshCommand;
|
|
407
|
-
})(Form = CommandBuilder.Form || (CommandBuilder.Form = {}));
|
|
408
|
-
let Subgrid;
|
|
409
|
-
(function (Subgrid) {
|
|
410
|
-
function createNewRecordCommand({ Icon, text, localizedTexts, }) {
|
|
411
|
-
return {
|
|
412
|
-
type: 'button',
|
|
413
|
-
Icon,
|
|
414
|
-
text,
|
|
415
|
-
localizedText: localizedTexts,
|
|
416
|
-
onClick: (context) => {
|
|
417
|
-
console.log('New record', context);
|
|
418
|
-
},
|
|
419
|
-
hidden: (context) => {
|
|
420
|
-
console.log(context);
|
|
421
|
-
// TODO: Implement logic to hide the button
|
|
422
|
-
return false;
|
|
423
|
-
},
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
Subgrid.createNewRecordCommand = createNewRecordCommand;
|
|
427
|
-
function createEditRecordCommand({ Icon, text, localizedTexts, }) {
|
|
428
|
-
return {
|
|
429
|
-
type: 'button',
|
|
430
|
-
Icon,
|
|
431
|
-
text,
|
|
432
|
-
localizedText: localizedTexts,
|
|
433
|
-
isContextMenu: true,
|
|
434
|
-
onClick: (context) => {
|
|
435
|
-
console.log('Edit record', context);
|
|
436
|
-
},
|
|
437
|
-
// hidden: (context) => context.secondaryControl.selectedIds.length !== 1, // TODO: check permissions
|
|
438
|
-
hidden: (context) => {
|
|
439
|
-
console.log('temp.', context);
|
|
440
|
-
return context.secondaryControl.selectedIds.length !== 1;
|
|
441
|
-
},
|
|
442
|
-
};
|
|
443
|
-
}
|
|
444
|
-
Subgrid.createEditRecordCommand = createEditRecordCommand;
|
|
445
|
-
function plurialize(count, singular, plural) {
|
|
446
|
-
if (Array.isArray(singular)) {
|
|
447
|
-
plural = singular[1];
|
|
448
|
-
singular = singular[0];
|
|
449
|
-
}
|
|
450
|
-
let msg = count === 1 ? singular : plural !== null && plural !== void 0 ? plural : singular;
|
|
451
|
-
msg = msg.replace('{count}', count.toString());
|
|
452
|
-
return msg;
|
|
453
|
-
}
|
|
454
|
-
Subgrid.defaultDeleteRecordStringSet = {
|
|
455
|
-
confirmation: {
|
|
456
|
-
text: [
|
|
457
|
-
'Are you sure you want to delete this record?',
|
|
458
|
-
'Are you sure you want to delete selected records?',
|
|
459
|
-
],
|
|
460
|
-
title: ['Delete record', 'Delete records'],
|
|
461
|
-
buttonConfirm: 'Delete',
|
|
462
|
-
buttonCancel: 'Cancel',
|
|
463
|
-
},
|
|
464
|
-
status: {
|
|
465
|
-
deleting: ['Deleting record', 'Deleting records'],
|
|
466
|
-
},
|
|
467
|
-
successNotification: {
|
|
468
|
-
title: ['Record deleted', 'Records deleted'],
|
|
469
|
-
text: ['Record deleted successfully', 'Records deleted successfully'],
|
|
470
|
-
},
|
|
471
|
-
errorNotification: {
|
|
472
|
-
title: 'Error',
|
|
473
|
-
},
|
|
474
|
-
};
|
|
475
|
-
function createDeleteRecordCommand({ Icon, localizedText, text, stringSet = Subgrid.defaultDeleteRecordStringSet, localizedStringSet, }) {
|
|
476
|
-
return {
|
|
477
|
-
type: 'button',
|
|
478
|
-
Icon,
|
|
479
|
-
text,
|
|
480
|
-
localizedText,
|
|
481
|
-
danger: true,
|
|
482
|
-
isContextMenu: true,
|
|
483
|
-
hidden: [
|
|
484
|
-
(context) => context.secondaryControl.selectedIds.length === 0,
|
|
485
|
-
], // TODO: check permissions
|
|
486
|
-
onClick: (context) => __awaiter(this, void 0, void 0, function* () {
|
|
487
|
-
const recordIds = context.secondaryControl.selectedIds;
|
|
488
|
-
if (!recordIds.length) {
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
|
-
const localizeSelector = createLocalizedSelector(stringSet, localizedStringSet, context.locale.language);
|
|
492
|
-
try {
|
|
493
|
-
const confirmResult = yield context.utility.openConfirmDialog({
|
|
494
|
-
title: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.title)),
|
|
495
|
-
text: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.text)),
|
|
496
|
-
cancelButtonLabel: localizeSelector((s) => s.confirmation.buttonCancel),
|
|
497
|
-
confirmButtonLabel: localizeSelector((s) => s.confirmation.buttonConfirm),
|
|
498
|
-
});
|
|
499
|
-
if (!(confirmResult === null || confirmResult === void 0 ? void 0 : confirmResult.confirmed)) {
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
502
|
-
context.utility.showProgressIndicator(plurialize(recordIds.length, localizeSelector((s) => s.status.deleting)) + '...');
|
|
503
|
-
yield new Promise((resolve) => setTimeout(resolve, 2000));
|
|
504
|
-
context.utility.showNotification({
|
|
505
|
-
title: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.title)),
|
|
506
|
-
text: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.text)),
|
|
507
|
-
type: 'success',
|
|
508
|
-
});
|
|
509
|
-
yield context.primaryControl.refresh();
|
|
510
|
-
}
|
|
511
|
-
catch (error) {
|
|
512
|
-
context.utility.showNotification({
|
|
513
|
-
title: localizeSelector((s) => s.errorNotification.title),
|
|
514
|
-
text: error.message,
|
|
515
|
-
type: 'error',
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
finally {
|
|
519
|
-
context.utility.hideProgressIndicator();
|
|
520
|
-
}
|
|
521
|
-
}),
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
Subgrid.createDeleteRecordCommand = createDeleteRecordCommand;
|
|
525
|
-
function createRefreshCommand({ Icon, localizedTexts, text, }) {
|
|
526
|
-
return {
|
|
527
|
-
type: 'button',
|
|
528
|
-
Icon,
|
|
529
|
-
text,
|
|
530
|
-
localizedText: localizedTexts,
|
|
531
|
-
onClick: (context) => {
|
|
532
|
-
context.secondaryControl.refresh();
|
|
533
|
-
},
|
|
534
|
-
};
|
|
535
|
-
}
|
|
536
|
-
Subgrid.createRefreshCommand = createRefreshCommand;
|
|
537
|
-
function createExportCommand({ button, csv, excel, }) {
|
|
538
|
-
return {
|
|
539
|
-
type: 'menu',
|
|
540
|
-
Icon: button.Icon,
|
|
541
|
-
text: button.text,
|
|
542
|
-
localizedTexts: button.localizedTexts,
|
|
543
|
-
items: [
|
|
544
|
-
[
|
|
545
|
-
{
|
|
546
|
-
Icon: excel.Icon,
|
|
547
|
-
text: excel.text,
|
|
548
|
-
localizedTexts: excel.localizedTexts,
|
|
549
|
-
onClick: (context) => {
|
|
550
|
-
console.log('Export to Excel', context);
|
|
551
|
-
},
|
|
552
|
-
},
|
|
553
|
-
{
|
|
554
|
-
Icon: csv.Icon,
|
|
555
|
-
text: csv.text,
|
|
556
|
-
localizedTexts: csv.localizedTexts,
|
|
557
|
-
onClick: (context) => {
|
|
558
|
-
console.log('Export to CSV', context);
|
|
559
|
-
},
|
|
560
|
-
},
|
|
561
|
-
],
|
|
562
|
-
],
|
|
563
|
-
};
|
|
564
|
-
}
|
|
565
|
-
Subgrid.createExportCommand = createExportCommand;
|
|
566
|
-
})(Subgrid = CommandBuilder.Subgrid || (CommandBuilder.Subgrid = {}));
|
|
567
|
-
})(CommandBuilder || (exports.CommandBuilder = CommandBuilder = {}));
|
package/locale/types.d.ts
DELETED
|
File without changes
|