@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
|
@@ -1,30 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { exportRecordsCSV, exportRecordsXLS, retriveRecords } from '../utils';
|
|
11
|
-
import { createLocalizedSelector } from './utils';
|
|
12
|
-
import { ViewCommandBuilder } from './ViewCommandBuilder';
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubgridCommandBuilder = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
6
|
+
const ViewCommandBuilder_1 = require("./ViewCommandBuilder");
|
|
13
7
|
var EnabledRules;
|
|
14
8
|
(function (EnabledRules) {
|
|
15
9
|
function HasCreatePermisssion(context) {
|
|
16
|
-
|
|
17
|
-
return !((_a = context.secondaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableCreate);
|
|
10
|
+
return !context.secondaryControl.schema.restrictions?.disableCreate;
|
|
18
11
|
}
|
|
19
12
|
EnabledRules.HasCreatePermisssion = HasCreatePermisssion;
|
|
20
13
|
function HasUpdatePermission(context) {
|
|
21
|
-
|
|
22
|
-
return !((_a = context.secondaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableUpdate);
|
|
14
|
+
return !context.secondaryControl.schema.restrictions?.disableUpdate;
|
|
23
15
|
}
|
|
24
16
|
EnabledRules.HasUpdatePermission = HasUpdatePermission;
|
|
25
17
|
function HasDeletePermission(context) {
|
|
26
|
-
|
|
27
|
-
return !((_a = context.secondaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableDelete);
|
|
18
|
+
return !context.secondaryControl.schema.restrictions?.disableDelete;
|
|
28
19
|
}
|
|
29
20
|
EnabledRules.HasDeletePermission = HasDeletePermission;
|
|
30
21
|
function HasSingleRecordSelected(context) {
|
|
@@ -36,7 +27,7 @@ var EnabledRules;
|
|
|
36
27
|
}
|
|
37
28
|
EnabledRules.HasAtLeastOneRecordSelected = HasAtLeastOneRecordSelected;
|
|
38
29
|
})(EnabledRules || (EnabledRules = {}));
|
|
39
|
-
|
|
30
|
+
var SubgridCommandBuilder;
|
|
40
31
|
(function (SubgridCommandBuilder) {
|
|
41
32
|
function createNewRecordCommand({ Icon, text, localizedTexts, }) {
|
|
42
33
|
return {
|
|
@@ -86,11 +77,11 @@ export var SubgridCommandBuilder;
|
|
|
86
77
|
plural = singular[1];
|
|
87
78
|
singular = singular[0];
|
|
88
79
|
}
|
|
89
|
-
let msg = count === 1 ? singular : plural
|
|
80
|
+
let msg = count === 1 ? singular : plural ?? singular;
|
|
90
81
|
msg = msg.replace('{count}', count.toString());
|
|
91
82
|
return msg;
|
|
92
83
|
}
|
|
93
|
-
function createDeleteRecordCommand({ Icon, localizedText, text, stringSet = ViewCommandBuilder.defaultDeleteRecordStringSet, localizedStringSet, }) {
|
|
84
|
+
function createDeleteRecordCommand({ Icon, localizedText, text, stringSet = ViewCommandBuilder_1.ViewCommandBuilder.defaultDeleteRecordStringSet, localizedStringSet, }) {
|
|
94
85
|
return {
|
|
95
86
|
type: 'button',
|
|
96
87
|
Icon,
|
|
@@ -98,25 +89,25 @@ export var SubgridCommandBuilder;
|
|
|
98
89
|
localizedText,
|
|
99
90
|
danger: true,
|
|
100
91
|
isContextMenu: true,
|
|
101
|
-
onClick: (context) =>
|
|
92
|
+
onClick: async (context) => {
|
|
102
93
|
const recordIds = context.secondaryControl.selectedIds;
|
|
103
94
|
if (!recordIds.length) {
|
|
104
95
|
return;
|
|
105
96
|
}
|
|
106
|
-
const localizeSelector = createLocalizedSelector(stringSet, localizedStringSet, context.locale.language);
|
|
97
|
+
const localizeSelector = (0, utils_2.createLocalizedSelector)(stringSet, localizedStringSet, context.locale.language);
|
|
107
98
|
try {
|
|
108
|
-
const confirmResult =
|
|
99
|
+
const confirmResult = await context.utility.openConfirmDialog({
|
|
109
100
|
title: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.title)),
|
|
110
101
|
text: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.text)),
|
|
111
102
|
cancelButtonLabel: localizeSelector((s) => s.confirmation.buttonCancel),
|
|
112
103
|
confirmButtonLabel: localizeSelector((s) => s.confirmation.buttonConfirm),
|
|
113
104
|
});
|
|
114
|
-
if (!
|
|
105
|
+
if (!confirmResult?.confirmed) {
|
|
115
106
|
return;
|
|
116
107
|
}
|
|
117
108
|
context.utility.showProgressIndicator(plurialize(recordIds.length, localizeSelector((s) => s.status.deleting)) + '...');
|
|
118
109
|
for (const recordId of recordIds) {
|
|
119
|
-
|
|
110
|
+
await context.dataService.deleteRecord(context.secondaryControl.logicalName, recordId);
|
|
120
111
|
}
|
|
121
112
|
context.utility.showNotification({
|
|
122
113
|
title: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.title)),
|
|
@@ -135,7 +126,7 @@ export var SubgridCommandBuilder;
|
|
|
135
126
|
finally {
|
|
136
127
|
context.utility.hideProgressIndicator();
|
|
137
128
|
}
|
|
138
|
-
}
|
|
129
|
+
},
|
|
139
130
|
hidden: [
|
|
140
131
|
(context) => !EnabledRules.HasAtLeastOneRecordSelected(context),
|
|
141
132
|
(context) => !EnabledRules.HasDeletePermission(context),
|
|
@@ -167,10 +158,10 @@ export var SubgridCommandBuilder;
|
|
|
167
158
|
Icon: excel.Icon,
|
|
168
159
|
text: excel.text,
|
|
169
160
|
localizedTexts: excel.localizedTexts,
|
|
170
|
-
onClick: (context) =>
|
|
161
|
+
onClick: async (context) => {
|
|
171
162
|
context.utility.showProgressIndicator('Exporting to Excel...');
|
|
172
163
|
try {
|
|
173
|
-
const result =
|
|
164
|
+
const result = await (0, utils_1.retriveRecords)({
|
|
174
165
|
columnFilters: context.secondaryControl.columnFilter,
|
|
175
166
|
dataService: context.dataService,
|
|
176
167
|
gridColumns: context.secondaryControl.gridColumns,
|
|
@@ -183,7 +174,7 @@ export var SubgridCommandBuilder;
|
|
|
183
174
|
skip: 0,
|
|
184
175
|
limit: 5000,
|
|
185
176
|
});
|
|
186
|
-
|
|
177
|
+
await (0, utils_1.exportRecordsXLS)({
|
|
187
178
|
fileName: context.secondaryControl.view.name + '.xlsx',
|
|
188
179
|
gridColumns: context.secondaryControl.gridColumns,
|
|
189
180
|
records: result.records,
|
|
@@ -194,16 +185,16 @@ export var SubgridCommandBuilder;
|
|
|
194
185
|
finally {
|
|
195
186
|
context.utility.hideProgressIndicator();
|
|
196
187
|
}
|
|
197
|
-
}
|
|
188
|
+
},
|
|
198
189
|
},
|
|
199
190
|
{
|
|
200
191
|
Icon: csv.Icon,
|
|
201
192
|
text: csv.text,
|
|
202
193
|
localizedTexts: csv.localizedTexts,
|
|
203
|
-
onClick: (context) =>
|
|
194
|
+
onClick: async (context) => {
|
|
204
195
|
context.utility.showProgressIndicator('Exporting to CSV...');
|
|
205
196
|
try {
|
|
206
|
-
const result =
|
|
197
|
+
const result = await (0, utils_1.retriveRecords)({
|
|
207
198
|
columnFilters: context.secondaryControl.columnFilter,
|
|
208
199
|
dataService: context.dataService,
|
|
209
200
|
gridColumns: context.secondaryControl.gridColumns,
|
|
@@ -216,7 +207,7 @@ export var SubgridCommandBuilder;
|
|
|
216
207
|
skip: 0,
|
|
217
208
|
limit: 5000,
|
|
218
209
|
});
|
|
219
|
-
|
|
210
|
+
await (0, utils_1.exportRecordsCSV)({
|
|
220
211
|
fileName: context.secondaryControl.view.name + '.csv',
|
|
221
212
|
gridColumns: context.secondaryControl.gridColumns,
|
|
222
213
|
records: result.records,
|
|
@@ -227,11 +218,11 @@ export var SubgridCommandBuilder;
|
|
|
227
218
|
finally {
|
|
228
219
|
context.utility.hideProgressIndicator();
|
|
229
220
|
}
|
|
230
|
-
}
|
|
221
|
+
},
|
|
231
222
|
},
|
|
232
223
|
],
|
|
233
224
|
],
|
|
234
225
|
};
|
|
235
226
|
}
|
|
236
227
|
SubgridCommandBuilder.createExportCommand = createExportCommand;
|
|
237
|
-
})(SubgridCommandBuilder || (SubgridCommandBuilder = {}));
|
|
228
|
+
})(SubgridCommandBuilder || (exports.SubgridCommandBuilder = SubgridCommandBuilder = {}));
|
|
@@ -1,29 +1,20 @@
|
|
|
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
|
-
import { exportRecordsCSV, exportRecordsXLS, retriveRecords } from '../utils';
|
|
11
|
-
import { createLocalizedSelector, plurialize } from './utils';
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ViewCommandBuilder = void 0;
|
|
4
|
+
const utils_1 = require("../utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
12
6
|
var EnabledRules;
|
|
13
7
|
(function (EnabledRules) {
|
|
14
8
|
function HasCreatePermisssion(context) {
|
|
15
|
-
|
|
16
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableCreate);
|
|
9
|
+
return !context.primaryControl.schema.restrictions?.disableCreate;
|
|
17
10
|
}
|
|
18
11
|
EnabledRules.HasCreatePermisssion = HasCreatePermisssion;
|
|
19
12
|
function HasUpdatePermission(context) {
|
|
20
|
-
|
|
21
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableUpdate);
|
|
13
|
+
return !context.primaryControl.schema.restrictions?.disableUpdate;
|
|
22
14
|
}
|
|
23
15
|
EnabledRules.HasUpdatePermission = HasUpdatePermission;
|
|
24
16
|
function HasDeletePermission(context) {
|
|
25
|
-
|
|
26
|
-
return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableDelete);
|
|
17
|
+
return !context.primaryControl.schema.restrictions?.disableDelete;
|
|
27
18
|
}
|
|
28
19
|
EnabledRules.HasDeletePermission = HasDeletePermission;
|
|
29
20
|
function HasSingleRecordSelected(context) {
|
|
@@ -35,7 +26,7 @@ var EnabledRules;
|
|
|
35
26
|
}
|
|
36
27
|
EnabledRules.HasAtLeastOneRecordSelected = HasAtLeastOneRecordSelected;
|
|
37
28
|
})(EnabledRules || (EnabledRules = {}));
|
|
38
|
-
|
|
29
|
+
var ViewCommandBuilder;
|
|
39
30
|
(function (ViewCommandBuilder) {
|
|
40
31
|
function createNewRecordCommand({ Icon, text, localizedTexts, }) {
|
|
41
32
|
return {
|
|
@@ -100,29 +91,29 @@ export var ViewCommandBuilder;
|
|
|
100
91
|
localizedText,
|
|
101
92
|
danger: true,
|
|
102
93
|
isContextMenu: true,
|
|
103
|
-
onClick: (context) =>
|
|
94
|
+
onClick: async (context) => {
|
|
104
95
|
const recordIds = context.primaryControl.selectedIds;
|
|
105
96
|
if (!recordIds.length) {
|
|
106
97
|
return;
|
|
107
98
|
}
|
|
108
|
-
const localizeSelector = createLocalizedSelector(stringSet, localizedStringSet, context.locale.language);
|
|
99
|
+
const localizeSelector = (0, utils_2.createLocalizedSelector)(stringSet, localizedStringSet, context.locale.language);
|
|
109
100
|
try {
|
|
110
|
-
const confirmResult =
|
|
111
|
-
title: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.title)),
|
|
112
|
-
text: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.text)),
|
|
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)),
|
|
113
104
|
cancelButtonLabel: localizeSelector((s) => s.confirmation.buttonCancel),
|
|
114
105
|
confirmButtonLabel: localizeSelector((s) => s.confirmation.buttonConfirm),
|
|
115
106
|
});
|
|
116
|
-
if (!
|
|
107
|
+
if (!confirmResult?.confirmed) {
|
|
117
108
|
return;
|
|
118
109
|
}
|
|
119
|
-
context.utility.showProgressIndicator(plurialize(recordIds.length, localizeSelector((s) => s.status.deleting)) + '...');
|
|
110
|
+
context.utility.showProgressIndicator((0, utils_2.plurialize)(recordIds.length, localizeSelector((s) => s.status.deleting)) + '...');
|
|
120
111
|
for (const recordId of recordIds) {
|
|
121
|
-
|
|
112
|
+
await context.dataService.deleteRecord(context.primaryControl.logicalName, recordId);
|
|
122
113
|
}
|
|
123
114
|
context.utility.showNotification({
|
|
124
|
-
title: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.title)),
|
|
125
|
-
text: 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)),
|
|
126
117
|
type: 'success',
|
|
127
118
|
});
|
|
128
119
|
context.primaryControl.refresh();
|
|
@@ -137,7 +128,7 @@ export var ViewCommandBuilder;
|
|
|
137
128
|
finally {
|
|
138
129
|
context.utility.hideProgressIndicator();
|
|
139
130
|
}
|
|
140
|
-
}
|
|
131
|
+
},
|
|
141
132
|
hidden: [
|
|
142
133
|
(context) => !EnabledRules.HasAtLeastOneRecordSelected(context),
|
|
143
134
|
(context) => !EnabledRules.HasDeletePermission(context),
|
|
@@ -169,10 +160,10 @@ export var ViewCommandBuilder;
|
|
|
169
160
|
Icon: excel.Icon,
|
|
170
161
|
text: excel.text,
|
|
171
162
|
localizedTexts: excel.localizedTexts,
|
|
172
|
-
onClick: (context) =>
|
|
163
|
+
onClick: async (context) => {
|
|
173
164
|
context.utility.showProgressIndicator('Exporting to Excel...');
|
|
174
165
|
try {
|
|
175
|
-
const result =
|
|
166
|
+
const result = await (0, utils_1.retriveRecords)({
|
|
176
167
|
columnFilters: context.primaryControl.columnFilter,
|
|
177
168
|
dataService: context.dataService,
|
|
178
169
|
gridColumns: context.primaryControl.gridColumns,
|
|
@@ -185,7 +176,7 @@ export var ViewCommandBuilder;
|
|
|
185
176
|
skip: 0,
|
|
186
177
|
limit: 5000,
|
|
187
178
|
});
|
|
188
|
-
|
|
179
|
+
await (0, utils_1.exportRecordsXLS)({
|
|
189
180
|
fileName: context.primaryControl.view.name + '.xlsx',
|
|
190
181
|
gridColumns: context.primaryControl.gridColumns,
|
|
191
182
|
records: result.records,
|
|
@@ -196,16 +187,16 @@ export var ViewCommandBuilder;
|
|
|
196
187
|
finally {
|
|
197
188
|
context.utility.hideProgressIndicator();
|
|
198
189
|
}
|
|
199
|
-
}
|
|
190
|
+
},
|
|
200
191
|
},
|
|
201
192
|
{
|
|
202
193
|
Icon: csv.Icon,
|
|
203
194
|
text: csv.text,
|
|
204
195
|
localizedTexts: csv.localizedTexts,
|
|
205
|
-
onClick: (context) =>
|
|
196
|
+
onClick: async (context) => {
|
|
206
197
|
context.utility.showProgressIndicator('Exporting to CSV...');
|
|
207
198
|
try {
|
|
208
|
-
const result =
|
|
199
|
+
const result = await (0, utils_1.retriveRecords)({
|
|
209
200
|
columnFilters: context.primaryControl.columnFilter,
|
|
210
201
|
dataService: context.dataService,
|
|
211
202
|
gridColumns: context.primaryControl.gridColumns,
|
|
@@ -218,7 +209,7 @@ export var ViewCommandBuilder;
|
|
|
218
209
|
skip: 0,
|
|
219
210
|
limit: 5000,
|
|
220
211
|
});
|
|
221
|
-
|
|
212
|
+
await (0, utils_1.exportRecordsCSV)({
|
|
222
213
|
fileName: context.primaryControl.view.name + '.csv',
|
|
223
214
|
gridColumns: context.primaryControl.gridColumns,
|
|
224
215
|
records: result.records,
|
|
@@ -229,11 +220,11 @@ export var ViewCommandBuilder;
|
|
|
229
220
|
finally {
|
|
230
221
|
context.utility.hideProgressIndicator();
|
|
231
222
|
}
|
|
232
|
-
}
|
|
223
|
+
},
|
|
233
224
|
},
|
|
234
225
|
],
|
|
235
226
|
],
|
|
236
227
|
};
|
|
237
228
|
}
|
|
238
229
|
ViewCommandBuilder.createExportCommand = createExportCommand;
|
|
239
|
-
})(ViewCommandBuilder || (ViewCommandBuilder = {}));
|
|
230
|
+
})(ViewCommandBuilder || (exports.ViewCommandBuilder = ViewCommandBuilder = {}));
|
|
@@ -1 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandBuilder = void 0;
|
|
4
|
+
var CommandBuilder_1 = require("./CommandBuilder");
|
|
5
|
+
Object.defineProperty(exports, "CommandBuilder", { enumerable: true, get: function () { return CommandBuilder_1.CommandBuilder; } });
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createLocalizedSelector = createLocalizedSelector;
|
|
4
|
+
exports.plurialize = plurialize;
|
|
5
|
+
function createLocalizedSelector(stringSet, localizedStringSet, language) {
|
|
2
6
|
return function selectLocalized(selector) {
|
|
3
7
|
if (localizedStringSet && localizedStringSet[language]) {
|
|
4
8
|
return selector(localizedStringSet[language]);
|
|
@@ -6,12 +10,12 @@ export function createLocalizedSelector(stringSet, localizedStringSet, language)
|
|
|
6
10
|
return selector(stringSet);
|
|
7
11
|
};
|
|
8
12
|
}
|
|
9
|
-
|
|
13
|
+
function plurialize(count, singular, plural) {
|
|
10
14
|
if (Array.isArray(singular)) {
|
|
11
15
|
plural = singular[1];
|
|
12
16
|
singular = singular[0];
|
|
13
17
|
}
|
|
14
|
-
let msg = count === 1 ? singular : plural
|
|
18
|
+
let msg = count === 1 ? singular : plural ?? singular;
|
|
15
19
|
msg = msg.replace('{count}', count.toString());
|
|
16
20
|
return msg;
|
|
17
21
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchemaExperienceBuilder = void 0;
|
|
1
4
|
class BaseSchemaExperienceBuilder {
|
|
5
|
+
logicalName;
|
|
6
|
+
views = [];
|
|
7
|
+
forms = [];
|
|
8
|
+
lookups = [];
|
|
9
|
+
quickCreateForms = [];
|
|
10
|
+
defaultViewId = null;
|
|
11
|
+
defaultFormId = null;
|
|
12
|
+
defaultLookupId = null;
|
|
13
|
+
defaultQuickCreateFormId = null;
|
|
14
|
+
locked = false;
|
|
2
15
|
constructor(logicalName) {
|
|
3
16
|
this.logicalName = logicalName;
|
|
4
|
-
this.views = [];
|
|
5
|
-
this.forms = [];
|
|
6
|
-
this.lookups = [];
|
|
7
|
-
this.quickCreateForms = [];
|
|
8
|
-
this.defaultViewId = null;
|
|
9
|
-
this.defaultFormId = null;
|
|
10
|
-
this.defaultLookupId = null;
|
|
11
|
-
this.defaultQuickCreateFormId = null;
|
|
12
|
-
this.locked = false;
|
|
13
17
|
}
|
|
14
18
|
reset() {
|
|
15
19
|
this.views = [];
|
|
@@ -62,7 +66,10 @@ class BaseSchemaExperienceBuilder {
|
|
|
62
66
|
return formExperience;
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
|
-
|
|
69
|
+
class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
70
|
+
schema;
|
|
71
|
+
defaults;
|
|
72
|
+
options;
|
|
66
73
|
constructor(schema, defaults, options) {
|
|
67
74
|
super(schema.logicalName);
|
|
68
75
|
this.schema = schema;
|
|
@@ -70,10 +77,13 @@ export class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
70
77
|
this.options = options;
|
|
71
78
|
}
|
|
72
79
|
defineViewExperience(viewExperience) {
|
|
73
|
-
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
const cardView = viewExperience.card ?? this.defineDefaultViewCard();
|
|
81
|
+
const gridView = viewExperience.grid ?? this.defineDefaultViewGrid();
|
|
82
|
+
return {
|
|
83
|
+
...viewExperience,
|
|
84
|
+
grid: gridView,
|
|
85
|
+
card: cardView,
|
|
86
|
+
};
|
|
77
87
|
}
|
|
78
88
|
defineDefaultViewGrid() {
|
|
79
89
|
const columns = [];
|
|
@@ -152,16 +162,15 @@ export class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
152
162
|
};
|
|
153
163
|
}
|
|
154
164
|
getLocalizedViewNames() {
|
|
155
|
-
var _a;
|
|
156
165
|
const langugesSet = new Set();
|
|
157
166
|
this.schema.localizedPluralLabels &&
|
|
158
167
|
Object.keys(this.schema.localizedPluralLabels).forEach((key) => langugesSet.add(key));
|
|
159
|
-
|
|
168
|
+
this.defaults?.localizedViewNames &&
|
|
160
169
|
Object.keys(this.defaults.localizedViewNames).forEach((key) => langugesSet.add(key));
|
|
161
170
|
const localizedLabels = Array.from(langugesSet).reduce((acc, key) => {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const localizedPlaceholder =
|
|
171
|
+
const localizedPluralName = this.schema.localizedPluralLabels?.[key]?.toLowerCase() ??
|
|
172
|
+
this.schema.pluralLabel.toLowerCase();
|
|
173
|
+
const localizedPlaceholder = this.defaults?.localizedViewNames?.[key] ?? `All {label}`;
|
|
165
174
|
const localeName = localizedPlaceholder.replace('{label}', localizedPluralName);
|
|
166
175
|
acc[key] = localeName;
|
|
167
176
|
return acc;
|
|
@@ -181,12 +190,11 @@ export class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
181
190
|
return defaultId;
|
|
182
191
|
}
|
|
183
192
|
defineExperience(experience) {
|
|
184
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
185
193
|
let lookups = experience.lookups;
|
|
186
194
|
let views = experience.views;
|
|
187
195
|
let forms = experience.forms;
|
|
188
196
|
let associatedViews = experience.associatedViews;
|
|
189
|
-
if (!
|
|
197
|
+
if (!lookups?.length) {
|
|
190
198
|
lookups = [
|
|
191
199
|
{
|
|
192
200
|
id: 'default',
|
|
@@ -195,7 +203,7 @@ export class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
195
203
|
},
|
|
196
204
|
];
|
|
197
205
|
}
|
|
198
|
-
if (!
|
|
206
|
+
if (!views?.length) {
|
|
199
207
|
views = [
|
|
200
208
|
{
|
|
201
209
|
id: 'default',
|
|
@@ -205,7 +213,7 @@ export class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
205
213
|
},
|
|
206
214
|
];
|
|
207
215
|
}
|
|
208
|
-
if (!
|
|
216
|
+
if (!associatedViews?.length) {
|
|
209
217
|
associatedViews = [
|
|
210
218
|
{
|
|
211
219
|
id: 'default',
|
|
@@ -215,7 +223,7 @@ export class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
215
223
|
},
|
|
216
224
|
];
|
|
217
225
|
}
|
|
218
|
-
if (!
|
|
226
|
+
if (!forms?.length) {
|
|
219
227
|
forms = [
|
|
220
228
|
{
|
|
221
229
|
id: 'default',
|
|
@@ -229,8 +237,8 @@ export class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
229
237
|
const defaultLookupId = this.resolveDefaultId(lookups, experience.defaultLookupId);
|
|
230
238
|
const defaultAssociatedViewId = this.resolveDefaultId(associatedViews, experience.defaultAssociatedViewId);
|
|
231
239
|
let defaultQuickCreateFormId = null;
|
|
232
|
-
if (
|
|
233
|
-
defaultQuickCreateFormId = this.resolveDefaultId(
|
|
240
|
+
if (experience.quickCreateForms?.length) {
|
|
241
|
+
defaultQuickCreateFormId = this.resolveDefaultId(experience.quickCreateForms ?? [], experience.defaultQuickCreateFormId);
|
|
234
242
|
}
|
|
235
243
|
return {
|
|
236
244
|
logicalName: this.logicalName,
|
|
@@ -240,14 +248,30 @@ export class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
240
248
|
defaultViewId,
|
|
241
249
|
defaultLookupId,
|
|
242
250
|
defaultAssociatedViewId,
|
|
243
|
-
quickCreateForms:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
quickCreateForms: experience.quickCreateForms?.map((x) => ({
|
|
252
|
+
...x,
|
|
253
|
+
logicalName: this.logicalName,
|
|
254
|
+
})) ?? [],
|
|
255
|
+
views: views.map((x) => ({
|
|
256
|
+
...x,
|
|
257
|
+
logicalName: this.logicalName,
|
|
258
|
+
})) ?? [],
|
|
259
|
+
forms: forms.map((x) => ({
|
|
260
|
+
...x,
|
|
261
|
+
logicalName: this.logicalName,
|
|
262
|
+
})) ?? [],
|
|
263
|
+
lookups: lookups.map((x) => ({
|
|
264
|
+
...x,
|
|
265
|
+
logicalName: this.logicalName,
|
|
266
|
+
})) ?? [],
|
|
267
|
+
associatedViews: associatedViews.map((x) => ({
|
|
268
|
+
...x,
|
|
269
|
+
logicalName: this.logicalName,
|
|
270
|
+
})) ?? [],
|
|
248
271
|
formCommands: experience.formCommands,
|
|
249
272
|
subgridCommands: experience.subgridCommands,
|
|
250
273
|
viewCommands: experience.viewCommands,
|
|
251
274
|
};
|
|
252
275
|
}
|
|
253
276
|
}
|
|
277
|
+
exports.SchemaExperienceBuilder = SchemaExperienceBuilder;
|
package/builders/index.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommandBuilder = exports.SchemaExperienceBuilder = void 0;
|
|
4
|
+
var SchemaExperienceBuilder_1 = require("./SchemaExperienceBuilder");
|
|
5
|
+
Object.defineProperty(exports, "SchemaExperienceBuilder", { enumerable: true, get: function () { return SchemaExperienceBuilder_1.SchemaExperienceBuilder; } });
|
|
6
|
+
var CommandBuilder_1 = require("./CommandBuilder");
|
|
7
|
+
Object.defineProperty(exports, "CommandBuilder", { enumerable: true, get: function () { return CommandBuilder_1.CommandBuilder; } });
|