@headless-adminapp/app 0.0.17-alpha.3 → 0.0.17-alpha.32

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