@headless-adminapp/app 0.0.17-alpha.5 → 0.0.17-alpha.8

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.
Files changed (63) hide show
  1. package/builders/CommandBuilder/CommandBuilder.d.ts +10 -0
  2. package/builders/CommandBuilder/CommandBuilder.js +14 -0
  3. package/builders/CommandBuilder/DefaultCommandBuilder.d.ts +79 -0
  4. package/builders/CommandBuilder/DefaultCommandBuilder.js +173 -0
  5. package/builders/CommandBuilder/FormCommandBuilder.d.ts +45 -0
  6. package/builders/CommandBuilder/FormCommandBuilder.js +145 -0
  7. package/builders/CommandBuilder/SubgridCommandBuilder.d.ts +64 -0
  8. package/builders/CommandBuilder/SubgridCommandBuilder.js +170 -0
  9. package/builders/CommandBuilder/ViewCommandBuilder.d.ts +63 -0
  10. package/builders/CommandBuilder/ViewCommandBuilder.js +250 -0
  11. package/builders/CommandBuilder/index.d.ts +1 -0
  12. package/builders/CommandBuilder/index.js +5 -0
  13. package/builders/CommandBuilder/utils.d.ts +3 -0
  14. package/builders/CommandBuilder/utils.js +21 -0
  15. package/builders/CommandBuilder.js +106 -13
  16. package/builders/SchemaExperienceBuilder.d.ts +2 -5
  17. package/builders/SchemaExperienceBuilder.js +16 -16
  18. package/builders/index.d.ts +1 -1
  19. package/builders/index.js +1 -2
  20. package/builders/utils.d.ts +28 -0
  21. package/builders/utils.js +185 -0
  22. package/command/hooks/useBaseCommandHandlerContext.js +9 -0
  23. package/command/hooks/useCommands.d.ts +1 -1
  24. package/command/hooks/useCommands.js +1 -1
  25. package/dataform/DataFormProvider/DataResolver.js +4 -4
  26. package/dataform/DataFormProvider/index.js +3 -3
  27. package/dataform/hooks/useFormSave.js +2 -2
  28. package/dataform/hooks/useLoadFormGridPage.js +7 -1
  29. package/dataform/utils/index.d.ts +4 -3
  30. package/dataform/utils/index.js +23 -23
  31. package/datagrid/DataGridProvider/DataResolver.js +3 -48
  32. package/datagrid/DataGridProvider/transformViewColumns.js +4 -4
  33. package/datagrid/DataGridProvider/utils.d.ts +7 -2
  34. package/datagrid/DataGridProvider/utils.js +52 -2
  35. package/datagrid/context.d.ts +4 -6
  36. package/datagrid/hooks/useGridCommands.d.ts +3 -0
  37. package/datagrid/hooks/useGridCommands.js +3 -0
  38. package/datagrid/hooks/useMainGridCommands.d.ts +1 -13
  39. package/datagrid/hooks/useMainGridCommands.js +23 -24
  40. package/datagrid/hooks/useOpenRecord.d.ts +1 -0
  41. package/datagrid/hooks/useOpenRecord.js +34 -0
  42. package/datagrid/hooks/useSubGridCommands.js +15 -27
  43. package/locale/LocaleProvider.js +1 -1
  44. package/locale/utils.d.ts +5 -0
  45. package/locale/utils.js +7 -0
  46. package/metadata/hooks/useExperienceViewCommands.d.ts +1 -1
  47. package/metadata/hooks/useExperienceViewCommands.js +7 -1
  48. package/metadata/hooks/useExperienceViewSubgridCommands.d.ts +1 -1
  49. package/metadata/hooks/useExperienceViewSubgridCommands.js +7 -1
  50. package/metadata/hooks/useMetadata.d.ts +1 -0
  51. package/metadata/hooks/useMetadata.js +2 -0
  52. package/metadata/hooks/useSchema.js +2 -2
  53. package/mutable/context.js +1 -1
  54. package/navigation/hooks/index.d.ts +1 -0
  55. package/navigation/hooks/index.js +17 -0
  56. package/navigation/hooks/useOpenForm.d.ts +2 -4
  57. package/navigation/hooks/useOpenForm.js +7 -3
  58. package/navigation/index.d.ts +1 -0
  59. package/navigation/index.js +17 -0
  60. package/package.json +4 -2
  61. package/recordset/RecordSetProvider.js +1 -1
  62. package/recordset/hooks/useRecordSetResult.js +1 -1
  63. package/store/SchemaExperienceStore.d.ts +3 -3
@@ -0,0 +1,170 @@
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.SubgridCommandBuilder = void 0;
13
+ const utils_1 = require("./utils");
14
+ var SubgridCommandBuilder;
15
+ (function (SubgridCommandBuilder) {
16
+ function createNewRecordCommand({ Icon, text, localizedTexts, }) {
17
+ return {
18
+ type: 'button',
19
+ Icon,
20
+ text,
21
+ localizedText: localizedTexts,
22
+ onClick: (context) => {
23
+ console.log('New record', context);
24
+ },
25
+ hidden: (context) => {
26
+ console.log(context);
27
+ // TODO: Implement logic to hide the button
28
+ return false;
29
+ },
30
+ };
31
+ }
32
+ SubgridCommandBuilder.createNewRecordCommand = createNewRecordCommand;
33
+ function createEditRecordCommand({ Icon, text, localizedTexts, }) {
34
+ return {
35
+ type: 'button',
36
+ Icon,
37
+ text,
38
+ localizedText: localizedTexts,
39
+ isContextMenu: true,
40
+ onClick: (context) => {
41
+ console.log('Edit record', context);
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;
47
+ },
48
+ };
49
+ }
50
+ SubgridCommandBuilder.createEditRecordCommand = createEditRecordCommand;
51
+ function plurialize(count, singular, plural) {
52
+ if (Array.isArray(singular)) {
53
+ plural = singular[1];
54
+ singular = singular[0];
55
+ }
56
+ let msg = count === 1 ? singular : plural !== null && plural !== void 0 ? plural : singular;
57
+ msg = msg.replace('{count}', count.toString());
58
+ return msg;
59
+ }
60
+ SubgridCommandBuilder.defaultDeleteRecordStringSet = {
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, }) {
82
+ return {
83
+ type: 'button',
84
+ Icon,
85
+ text,
86
+ localizedText,
87
+ danger: true,
88
+ isContextMenu: true,
89
+ hidden: [(context) => context.secondaryControl.selectedIds.length === 0], // TODO: check permissions
90
+ onClick: (context) => __awaiter(this, void 0, void 0, function* () {
91
+ const recordIds = context.secondaryControl.selectedIds;
92
+ if (!recordIds.length) {
93
+ return;
94
+ }
95
+ const localizeSelector = (0, utils_1.createLocalizedSelector)(stringSet, localizedStringSet, context.locale.language);
96
+ try {
97
+ const confirmResult = yield context.utility.openConfirmDialog({
98
+ title: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.title)),
99
+ text: plurialize(recordIds.length, localizeSelector((s) => s.confirmation.text)),
100
+ cancelButtonLabel: localizeSelector((s) => s.confirmation.buttonCancel),
101
+ confirmButtonLabel: localizeSelector((s) => s.confirmation.buttonConfirm),
102
+ });
103
+ if (!(confirmResult === null || confirmResult === void 0 ? void 0 : confirmResult.confirmed)) {
104
+ return;
105
+ }
106
+ context.utility.showProgressIndicator(plurialize(recordIds.length, localizeSelector((s) => s.status.deleting)) + '...');
107
+ yield new Promise((resolve) => setTimeout(resolve, 2000));
108
+ context.utility.showNotification({
109
+ title: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.title)),
110
+ text: plurialize(recordIds.length, localizeSelector((s) => s.successNotification.text)),
111
+ type: 'success',
112
+ });
113
+ yield context.primaryControl.refresh();
114
+ }
115
+ catch (error) {
116
+ context.utility.showNotification({
117
+ title: localizeSelector((s) => s.errorNotification.title),
118
+ text: error.message,
119
+ type: 'error',
120
+ });
121
+ }
122
+ finally {
123
+ context.utility.hideProgressIndicator();
124
+ }
125
+ }),
126
+ };
127
+ }
128
+ SubgridCommandBuilder.createDeleteRecordCommand = createDeleteRecordCommand;
129
+ function createRefreshCommand({ Icon, localizedTexts, text, }) {
130
+ return {
131
+ type: 'button',
132
+ Icon,
133
+ text,
134
+ localizedText: localizedTexts,
135
+ onClick: (context) => {
136
+ context.secondaryControl.refresh();
137
+ },
138
+ };
139
+ }
140
+ SubgridCommandBuilder.createRefreshCommand = createRefreshCommand;
141
+ function createExportCommand({ button, csv, excel, }) {
142
+ return {
143
+ type: 'menu',
144
+ Icon: button.Icon,
145
+ text: button.text,
146
+ localizedTexts: button.localizedTexts,
147
+ items: [
148
+ [
149
+ {
150
+ Icon: excel.Icon,
151
+ text: excel.text,
152
+ localizedTexts: excel.localizedTexts,
153
+ onClick: (context) => {
154
+ console.log('Export to Excel', context);
155
+ },
156
+ },
157
+ {
158
+ Icon: csv.Icon,
159
+ text: csv.text,
160
+ localizedTexts: csv.localizedTexts,
161
+ onClick: (context) => {
162
+ console.log('Export to CSV', context);
163
+ },
164
+ },
165
+ ],
166
+ ],
167
+ };
168
+ }
169
+ SubgridCommandBuilder.createExportCommand = createExportCommand;
170
+ })(SubgridCommandBuilder || (exports.SubgridCommandBuilder = SubgridCommandBuilder = {}));
@@ -0,0 +1,63 @@
1
+ import { EntityMainGridCommandItemExperience } from '@headless-adminapp/core/experience/view';
2
+ import { Localized } from '@headless-adminapp/core/types';
3
+ import { Icon } from '@headless-adminapp/icons';
4
+ export declare namespace ViewCommandBuilder {
5
+ function createNewRecordCommand({ Icon, text, localizedTexts, }: {
6
+ Icon: Icon;
7
+ text: string;
8
+ localizedTexts?: Record<string, string>;
9
+ }): EntityMainGridCommandItemExperience;
10
+ function createEditRecordCommand({ Icon, text, localizedTexts, }: {
11
+ Icon: Icon;
12
+ text: string;
13
+ localizedTexts?: Record<string, string>;
14
+ }): EntityMainGridCommandItemExperience;
15
+ interface DeleteRecordCommandStringSet {
16
+ confirmation: {
17
+ title: string | [string, string];
18
+ text: string | [string, string];
19
+ buttonCancel: string;
20
+ buttonConfirm: string;
21
+ };
22
+ status: {
23
+ deleting: string | [string, string];
24
+ };
25
+ successNotification: {
26
+ title: string | [string, string];
27
+ text: string | [string, string];
28
+ };
29
+ errorNotification: {
30
+ title: string;
31
+ };
32
+ }
33
+ const defaultDeleteRecordStringSet: DeleteRecordCommandStringSet;
34
+ function createDeleteRecordCommand({ Icon, localizedText, text, stringSet, localizedStringSet, }: {
35
+ Icon: Icon;
36
+ text: string;
37
+ localizedText?: Record<string, string>;
38
+ stringSet?: DeleteRecordCommandStringSet;
39
+ localizedStringSet?: Localized<DeleteRecordCommandStringSet>;
40
+ }): EntityMainGridCommandItemExperience;
41
+ function createRefreshCommand({ Icon, localizedTexts, text, }: {
42
+ Icon: Icon;
43
+ text: string;
44
+ localizedTexts?: Record<string, string>;
45
+ }): EntityMainGridCommandItemExperience;
46
+ function createExportCommand({ button, csv, excel, }: {
47
+ button: {
48
+ Icon: Icon;
49
+ text: string;
50
+ localizedTexts?: Record<string, string>;
51
+ };
52
+ excel: {
53
+ Icon: Icon;
54
+ text: string;
55
+ localizedTexts?: Record<string, string>;
56
+ };
57
+ csv: {
58
+ Icon: Icon;
59
+ text: string;
60
+ localizedTexts?: Record<string, string>;
61
+ };
62
+ }): EntityMainGridCommandItemExperience;
63
+ }
@@ -0,0 +1,250 @@
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.ViewCommandBuilder = void 0;
13
+ const utils_1 = require("../utils");
14
+ const utils_2 = require("./utils");
15
+ var EnabledRules;
16
+ (function (EnabledRules) {
17
+ function HasCreatePermisssion(context) {
18
+ var _a;
19
+ return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableCreate);
20
+ }
21
+ EnabledRules.HasCreatePermisssion = HasCreatePermisssion;
22
+ function HasUpdatePermission(context) {
23
+ var _a;
24
+ return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableUpdate);
25
+ }
26
+ EnabledRules.HasUpdatePermission = HasUpdatePermission;
27
+ function HasDeletePermission(context) {
28
+ var _a;
29
+ return !((_a = context.primaryControl.schema.restrictions) === null || _a === void 0 ? void 0 : _a.disableDelete);
30
+ }
31
+ EnabledRules.HasDeletePermission = HasDeletePermission;
32
+ function HasSingleRecordSelected(context) {
33
+ return context.primaryControl.selectedIds.length === 1;
34
+ }
35
+ EnabledRules.HasSingleRecordSelected = HasSingleRecordSelected;
36
+ function HasAtLeastOneRecordSelected(context) {
37
+ return context.primaryControl.selectedIds.length > 0;
38
+ }
39
+ EnabledRules.HasAtLeastOneRecordSelected = HasAtLeastOneRecordSelected;
40
+ })(EnabledRules || (EnabledRules = {}));
41
+ var ViewCommandBuilder;
42
+ (function (ViewCommandBuilder) {
43
+ function createNewRecordCommand({ Icon, text, localizedTexts, }) {
44
+ return {
45
+ type: 'button',
46
+ Icon,
47
+ text,
48
+ localizedText: localizedTexts,
49
+ onClick: context => {
50
+ context.navigation.openForm({
51
+ logicalName: context.primaryControl.schema.logicalName,
52
+ });
53
+ },
54
+ hidden: context => {
55
+ if (!EnabledRules.HasCreatePermisssion(context)) {
56
+ return true;
57
+ }
58
+ return false;
59
+ },
60
+ };
61
+ }
62
+ ViewCommandBuilder.createNewRecordCommand = createNewRecordCommand;
63
+ function createEditRecordCommand({ Icon, text, localizedTexts, }) {
64
+ return {
65
+ type: 'button',
66
+ Icon,
67
+ text,
68
+ localizedText: localizedTexts,
69
+ isContextMenu: true,
70
+ onClick: context => {
71
+ context.primaryControl.openRecord(context.primaryControl.selectedIds[0]);
72
+ },
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
+ },
82
+ };
83
+ }
84
+ ViewCommandBuilder.createEditRecordCommand = createEditRecordCommand;
85
+ ViewCommandBuilder.defaultDeleteRecordStringSet = {
86
+ confirmation: {
87
+ text: [
88
+ 'Are you sure you want to delete this record?',
89
+ 'Are you sure you want to delete selected records?',
90
+ ],
91
+ title: ['Delete record', 'Delete records'],
92
+ buttonConfirm: 'Delete',
93
+ buttonCancel: 'Cancel',
94
+ },
95
+ status: {
96
+ deleting: ['Deleting record', 'Deleting records'],
97
+ },
98
+ successNotification: {
99
+ title: ['Record deleted', 'Records deleted'],
100
+ text: ['Record deleted successfully', 'Records deleted successfully'],
101
+ },
102
+ errorNotification: {
103
+ title: 'Error',
104
+ },
105
+ };
106
+ function createDeleteRecordCommand({ Icon, localizedText, text, stringSet = ViewCommandBuilder.defaultDeleteRecordStringSet, localizedStringSet, }) {
107
+ return {
108
+ type: 'button',
109
+ Icon,
110
+ text,
111
+ localizedText,
112
+ danger: true,
113
+ isContextMenu: true,
114
+ onClick: (context) => __awaiter(this, void 0, void 0, function* () {
115
+ const recordIds = context.primaryControl.selectedIds;
116
+ if (!recordIds.length) {
117
+ return;
118
+ }
119
+ const localizeSelector = (0, utils_2.createLocalizedSelector)(stringSet, localizedStringSet, context.locale.language);
120
+ try {
121
+ const confirmResult = yield context.utility.openConfirmDialog({
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),
126
+ });
127
+ if (!(confirmResult === null || confirmResult === void 0 ? void 0 : confirmResult.confirmed)) {
128
+ return;
129
+ }
130
+ context.utility.showProgressIndicator((0, utils_2.plurialize)(recordIds.length, localizeSelector(s => s.status.deleting)) + '...');
131
+ for (const recordId of recordIds) {
132
+ yield context.dataService.deleteRecord(context.primaryControl.logicalName, recordId);
133
+ }
134
+ 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)),
137
+ type: 'success',
138
+ });
139
+ context.primaryControl.refresh();
140
+ }
141
+ catch (error) {
142
+ context.utility.showNotification({
143
+ title: localizeSelector(s => s.errorNotification.title),
144
+ text: error.message,
145
+ type: 'error',
146
+ });
147
+ }
148
+ finally {
149
+ context.utility.hideProgressIndicator();
150
+ }
151
+ }),
152
+ hidden: [
153
+ context => !EnabledRules.HasAtLeastOneRecordSelected(context),
154
+ context => !EnabledRules.HasDeletePermission(context),
155
+ ],
156
+ };
157
+ }
158
+ ViewCommandBuilder.createDeleteRecordCommand = createDeleteRecordCommand;
159
+ function createRefreshCommand({ Icon, localizedTexts, text, }) {
160
+ return {
161
+ type: 'button',
162
+ Icon,
163
+ text,
164
+ localizedText: localizedTexts,
165
+ onClick: context => {
166
+ context.primaryControl.refresh();
167
+ },
168
+ };
169
+ }
170
+ ViewCommandBuilder.createRefreshCommand = createRefreshCommand;
171
+ function createExportCommand({ button, csv, excel, }) {
172
+ return {
173
+ type: 'menu',
174
+ Icon: button.Icon,
175
+ text: button.text,
176
+ localizedTexts: button.localizedTexts,
177
+ items: [
178
+ [
179
+ {
180
+ Icon: excel.Icon,
181
+ text: excel.text,
182
+ localizedTexts: excel.localizedTexts,
183
+ onClick: (context) => __awaiter(this, void 0, void 0, function* () {
184
+ context.utility.showProgressIndicator('Exporting to Excel...');
185
+ try {
186
+ const result = yield (0, utils_1.retriveRecords)({
187
+ columnFilters: context.primaryControl.columnFilter,
188
+ dataService: context.dataService,
189
+ gridColumns: context.primaryControl.gridColumns,
190
+ schema: context.primaryControl.schema,
191
+ schemaStore: context.stores.schemaStore,
192
+ view: context.primaryControl.view,
193
+ search: context.primaryControl.searchText,
194
+ extraFilter: context.primaryControl.extraFilter,
195
+ sorting: context.primaryControl.sorting,
196
+ skip: 0,
197
+ limit: 5000,
198
+ });
199
+ yield (0, utils_1.exportRecordsXLS)({
200
+ fileName: context.primaryControl.view.name + '.xlsx',
201
+ gridColumns: context.primaryControl.gridColumns,
202
+ records: result.records,
203
+ schema: context.primaryControl.schema,
204
+ schemaStore: context.stores.schemaStore,
205
+ });
206
+ }
207
+ finally {
208
+ context.utility.hideProgressIndicator();
209
+ }
210
+ }),
211
+ },
212
+ {
213
+ Icon: csv.Icon,
214
+ text: csv.text,
215
+ localizedTexts: csv.localizedTexts,
216
+ onClick: (context) => __awaiter(this, void 0, void 0, function* () {
217
+ context.utility.showProgressIndicator('Exporting to Excel...');
218
+ try {
219
+ const result = yield (0, utils_1.retriveRecords)({
220
+ columnFilters: context.primaryControl.columnFilter,
221
+ dataService: context.dataService,
222
+ gridColumns: context.primaryControl.gridColumns,
223
+ schema: context.primaryControl.schema,
224
+ schemaStore: context.stores.schemaStore,
225
+ view: context.primaryControl.view,
226
+ search: context.primaryControl.searchText,
227
+ extraFilter: context.primaryControl.extraFilter,
228
+ sorting: context.primaryControl.sorting,
229
+ skip: 0,
230
+ limit: 5000,
231
+ });
232
+ yield (0, utils_1.exportRecordsCSV)({
233
+ fileName: context.primaryControl.view.name + '.csv',
234
+ gridColumns: context.primaryControl.gridColumns,
235
+ records: result.records,
236
+ schema: context.primaryControl.schema,
237
+ schemaStore: context.stores.schemaStore,
238
+ });
239
+ }
240
+ finally {
241
+ context.utility.hideProgressIndicator();
242
+ }
243
+ }),
244
+ },
245
+ ],
246
+ ],
247
+ };
248
+ }
249
+ ViewCommandBuilder.createExportCommand = createExportCommand;
250
+ })(ViewCommandBuilder || (exports.ViewCommandBuilder = ViewCommandBuilder = {}));
@@ -0,0 +1 @@
1
+ export { CommandBuilder } from './CommandBuilder';
@@ -0,0 +1,5 @@
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; } });
@@ -0,0 +1,3 @@
1
+ import { Localized } from '@headless-adminapp/core/types';
2
+ export declare function createLocalizedSelector<T>(stringSet: T, localizedStringSet: Localized<T> | undefined, language: string): <U>(selector: (stringSet: T) => U) => U;
3
+ export declare function plurialize(count: number, singular: string | [string, string], plural?: string): string;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createLocalizedSelector = createLocalizedSelector;
4
+ exports.plurialize = plurialize;
5
+ function createLocalizedSelector(stringSet, localizedStringSet, language) {
6
+ return function selectLocalized(selector) {
7
+ if (localizedStringSet && localizedStringSet[language]) {
8
+ return selector(localizedStringSet[language]);
9
+ }
10
+ return selector(stringSet);
11
+ };
12
+ }
13
+ function plurialize(count, singular, plural) {
14
+ if (Array.isArray(singular)) {
15
+ plural = singular[1];
16
+ singular = singular[0];
17
+ }
18
+ let msg = count === 1 ? singular : plural !== null && plural !== void 0 ? plural : singular;
19
+ msg = msg.replace('{count}', count.toString());
20
+ return msg;
21
+ }