@headless-adminapp/app 0.0.17-alpha.5 → 0.0.17-alpha.52
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 +2 -1
- package/app/AuthWrapper.d.ts +1 -1
- package/app/AuthWrapper.js +4 -1
- package/app/LayoutProvider.d.ts +8 -7
- package/app/LayoutProvider.js +37 -2
- package/auth/AuthProvider.d.ts +1 -1
- package/auth/AuthProvider.js +23 -3
- package/auth/context.d.ts +1 -0
- package/auth/hooks/useIsSkipAuthCheck.d.ts +1 -0
- package/auth/hooks/useIsSkipAuthCheck.js +8 -0
- 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 +1 -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/CommandBuilder.d.ts +10 -0
- package/builders/CommandBuilder/CommandBuilder.js +14 -0
- package/builders/CommandBuilder/DefaultCommandBuilder.d.ts +88 -0
- package/builders/CommandBuilder/DefaultCommandBuilder.js +191 -0
- package/builders/CommandBuilder/FormCommandBuilder.d.ts +46 -0
- package/builders/CommandBuilder/FormCommandBuilder.js +171 -0
- package/builders/CommandBuilder/SubgridCommandBuilder.d.ts +45 -0
- package/builders/CommandBuilder/SubgridCommandBuilder.js +240 -0
- package/builders/CommandBuilder/ViewCommandBuilder.d.ts +63 -0
- package/builders/CommandBuilder/ViewCommandBuilder.js +242 -0
- package/builders/CommandBuilder/index.d.ts +1 -0
- package/builders/CommandBuilder/index.js +5 -0
- package/builders/CommandBuilder/utils.d.ts +3 -0
- package/builders/CommandBuilder/utils.js +21 -0
- package/builders/SchemaExperienceBuilder.d.ts +5 -8
- package/builders/SchemaExperienceBuilder.js +4 -4
- package/builders/index.d.ts +1 -1
- package/builders/index.js +1 -2
- package/builders/utils.d.ts +28 -0
- package/builders/utils.js +185 -0
- package/command/hooks/useBaseCommandHandlerContext.js +22 -4
- package/command/hooks/useCommands.d.ts +1 -1
- package/command/hooks/useCommands.js +1 -1
- package/components/ScrollbarWithMoreDataRequest/index.d.ts +9 -0
- package/components/ScrollbarWithMoreDataRequest/index.js +33 -0
- package/dataform/DataFormProvider/DataResolver.js +6 -6
- package/dataform/DataFormProvider/InitialValueResolver.js +4 -2
- package/dataform/DataFormProvider/index.js +3 -3
- package/dataform/hooks/index.d.ts +1 -0
- package/dataform/hooks/index.js +1 -0
- package/dataform/hooks/useFormSave.js +9 -2
- package/dataform/hooks/useLoadFormGridPage.js +8 -2
- package/dataform/hooks/useMainFormCommands.d.ts +1 -12
- package/dataform/hooks/useMainFormCommands.js +9 -1
- package/dataform/hooks/useProcessFlowSteps.d.ts +1 -0
- package/dataform/hooks/useProcessFlowSteps.js +44 -0
- package/dataform/hooks/useRecordTitle.d.ts +1 -1
- package/dataform/hooks/useRecordTitle.js +9 -2
- package/dataform/utils/defaultParameters.d.ts +3 -0
- package/dataform/utils/defaultParameters.js +37 -0
- package/dataform/utils/index.d.ts +3 -22
- package/dataform/utils/index.js +88 -134
- package/dataform/utils/saveRecord.d.ts +25 -0
- package/dataform/utils/saveRecord.js +167 -0
- package/datagrid/DataGridProvider/DataResolver.js +25 -149
- package/datagrid/DataGridProvider/index.d.ts +5 -0
- package/datagrid/DataGridProvider/index.js +8 -0
- package/datagrid/DataGridProvider/transformViewColumns.js +4 -4
- package/datagrid/DataGridProvider/utils.d.ts +7 -2
- package/datagrid/DataGridProvider/utils.js +52 -2
- package/datagrid/column-filter/constants.js +38 -3
- package/datagrid/context.d.ts +9 -6
- package/datagrid/hooks/useGridCommands.d.ts +3 -0
- package/datagrid/hooks/useGridCommands.js +3 -0
- package/datagrid/hooks/useLoadMainGridPage.js +1 -1
- package/datagrid/hooks/useMainGridCommands.d.ts +1 -13
- package/datagrid/hooks/useMainGridCommands.js +38 -26
- package/datagrid/hooks/useOpenRecord.d.ts +1 -0
- package/datagrid/hooks/useOpenRecord.js +34 -0
- package/datagrid/hooks/useSubGridCommands.js +25 -65
- package/defaults.d.ts +2 -0
- package/defaults.js +5 -0
- package/dialog/hooks/useCloseDialog.js +17 -15
- package/dialog/hooks/useOpenDialog.js +2 -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/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 +13 -0
- package/locale/utils.d.ts +5 -0
- package/locale/utils.js +7 -0
- package/metadata/MetadataProvider.d.ts +8 -4
- package/metadata/MetadataProvider.js +23 -16
- package/metadata/hooks/useExperienceViewCommands.js +7 -1
- package/metadata/hooks/useExperienceViewSubgridCommands.js +7 -1
- package/metadata/hooks/useMetadata.d.ts +2 -4
- package/metadata/hooks/useMetadata.js +2 -6
- package/metadata/hooks/useSchema.d.ts +1 -1
- package/metadata/hooks/useSchema.js +5 -2
- package/mutable/context.js +1 -1
- package/mutable/utils.js +5 -12
- package/navigation/hooks/index.d.ts +1 -0
- package/{appearance → navigation}/hooks/index.js +1 -1
- package/navigation/hooks/useOpenForm.d.ts +2 -4
- package/navigation/hooks/useOpenForm.js +11 -3
- package/navigation/index.d.ts +1 -0
- package/{appearance → navigation}/index.js +0 -3
- package/package.json +6 -2
- package/recordset/RecordSetProvider.js +1 -1
- package/recordset/hooks/useRecordSetResult.js +1 -1
- package/route/RouteProvider.d.ts +2 -2
- package/route/RouteProvider.js +4 -1
- package/store/ComponentStore.d.ts +1 -1
- package/store/ComponentStore.js +5 -9
- package/store/SchemaExperienceStore.d.ts +3 -3
- package/toast-notification/hooks/useCloseToastNotification.js +17 -15
- package/toast-notification/hooks/useOpenToastNotification.js +2 -4
- package/transport/RestDataService/index.d.ts +1 -1
- package/transport/RestDataService/index.js +17 -16
- package/transport/context.d.ts +3 -1
- package/transport/context.js +16 -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 +12 -0
- package/transport/hooks/useRetriveRecords.d.ts +32 -0
- package/transport/hooks/useRetriveRecords.js +120 -0
- package/utils/color.d.ts +1 -0
- package/utils/color.js +14 -0
- package/utils/getAttributeFormattedValue.d.ts +3 -1
- package/utils/getAttributeFormattedValue.js +108 -54
- 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/builders/CommandBuilder.d.ts +0 -176
- package/builders/CommandBuilder.js +0 -474
- package/locale/types.d.ts +0 -2
- /package/{locale → board}/types.js +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { EntityMainFormCommandItemExperience } from '@headless-adminapp/core/experience/form';
|
|
2
|
+
import { EntityMainGridCommandItemExperience, SubGridCommandItemExperience } from '@headless-adminapp/core/experience/view';
|
|
3
|
+
import { Localized } from '@headless-adminapp/core/types';
|
|
4
|
+
import { Icon } from '@headless-adminapp/icons';
|
|
5
|
+
import { FormCommandBuilder } from './FormCommandBuilder';
|
|
6
|
+
import { ViewCommandBuilder } from './ViewCommandBuilder';
|
|
7
|
+
export declare namespace DefaultCommandBuilder {
|
|
8
|
+
interface CreateDefaultViewCommandStrings {
|
|
9
|
+
new: string;
|
|
10
|
+
edit: string;
|
|
11
|
+
delete: string;
|
|
12
|
+
refresh: string;
|
|
13
|
+
export: string;
|
|
14
|
+
exportCsv: string;
|
|
15
|
+
exportExcel: string;
|
|
16
|
+
deleteRecordCommandStringSet: ViewCommandBuilder.DeleteRecordCommandStringSet;
|
|
17
|
+
}
|
|
18
|
+
export const defaultViewCommandStrings: CreateDefaultViewCommandStrings;
|
|
19
|
+
interface CreateDefaultViewCommandOptions {
|
|
20
|
+
icons: {
|
|
21
|
+
New: Icon;
|
|
22
|
+
Edit: Icon;
|
|
23
|
+
Delete: Icon;
|
|
24
|
+
Refresh: Icon;
|
|
25
|
+
Export: Icon;
|
|
26
|
+
ExportCsv: Icon;
|
|
27
|
+
ExportExcel: Icon;
|
|
28
|
+
};
|
|
29
|
+
strings?: CreateDefaultViewCommandStrings;
|
|
30
|
+
localizedSrings?: Localized<CreateDefaultViewCommandStrings>;
|
|
31
|
+
}
|
|
32
|
+
export function createDefaultViewCommands({ icons, strings, localizedSrings, }: CreateDefaultViewCommandOptions): EntityMainGridCommandItemExperience[][];
|
|
33
|
+
interface CreateDefaultFormCommandStrings {
|
|
34
|
+
save: string;
|
|
35
|
+
saveAndClose: string;
|
|
36
|
+
refresh: string;
|
|
37
|
+
delete: string;
|
|
38
|
+
deleteRecordCommandStringSet: FormCommandBuilder.DeleteRecordCommandStringSet;
|
|
39
|
+
}
|
|
40
|
+
interface CreateDefaultFormCommandOptions {
|
|
41
|
+
icons: {
|
|
42
|
+
Save: Icon;
|
|
43
|
+
SaveAndClose: Icon;
|
|
44
|
+
Refresh: Icon;
|
|
45
|
+
Delete: Icon;
|
|
46
|
+
};
|
|
47
|
+
strings?: CreateDefaultFormCommandStrings;
|
|
48
|
+
localizedSrings?: Localized<CreateDefaultFormCommandStrings>;
|
|
49
|
+
}
|
|
50
|
+
export const defaultFormCommandStrings: CreateDefaultFormCommandStrings;
|
|
51
|
+
export function createDefaultFormCommands({ icons, strings, localizedSrings, }: CreateDefaultFormCommandOptions): EntityMainFormCommandItemExperience[][];
|
|
52
|
+
interface CreateDefaultSubgridCommandStrings {
|
|
53
|
+
new: string;
|
|
54
|
+
edit: string;
|
|
55
|
+
delete: string;
|
|
56
|
+
refresh: string;
|
|
57
|
+
export: string;
|
|
58
|
+
exportCsv: string;
|
|
59
|
+
exportExcel: string;
|
|
60
|
+
deleteRecordCommandStringSet: ViewCommandBuilder.DeleteRecordCommandStringSet;
|
|
61
|
+
}
|
|
62
|
+
interface CreateDefaultSubgridCommandOptions {
|
|
63
|
+
icons: {
|
|
64
|
+
New: Icon;
|
|
65
|
+
Edit: Icon;
|
|
66
|
+
Delete: Icon;
|
|
67
|
+
Refresh: Icon;
|
|
68
|
+
Export: Icon;
|
|
69
|
+
ExportCsv: Icon;
|
|
70
|
+
ExportExcel: Icon;
|
|
71
|
+
};
|
|
72
|
+
strings?: CreateDefaultSubgridCommandStrings;
|
|
73
|
+
localizedSrings?: Localized<CreateDefaultSubgridCommandStrings>;
|
|
74
|
+
}
|
|
75
|
+
export function createDefaultSubgridCommands({ icons, strings, localizedSrings, }: CreateDefaultSubgridCommandOptions): SubGridCommandItemExperience[][];
|
|
76
|
+
type CreateDefaultCommandStrings = CreateDefaultViewCommandStrings & CreateDefaultFormCommandStrings & CreateDefaultSubgridCommandStrings;
|
|
77
|
+
interface CreateDefaultCommandOptions {
|
|
78
|
+
icons: CreateDefaultViewCommandOptions['icons'] & CreateDefaultFormCommandOptions['icons'] & CreateDefaultSubgridCommandOptions['icons'];
|
|
79
|
+
strings?: CreateDefaultCommandStrings;
|
|
80
|
+
localizedSrings?: Localized<CreateDefaultCommandStrings>;
|
|
81
|
+
}
|
|
82
|
+
export function createDefaultCommands({ icons, strings, localizedSrings, }: CreateDefaultCommandOptions): {
|
|
83
|
+
view: EntityMainGridCommandItemExperience[][];
|
|
84
|
+
form: EntityMainFormCommandItemExperience[][];
|
|
85
|
+
subgrid: SubGridCommandItemExperience[][];
|
|
86
|
+
};
|
|
87
|
+
export {};
|
|
88
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DefaultCommandBuilder = void 0;
|
|
4
|
+
const FormCommandBuilder_1 = require("./FormCommandBuilder");
|
|
5
|
+
const SubgridCommandBuilder_1 = require("./SubgridCommandBuilder");
|
|
6
|
+
const ViewCommandBuilder_1 = require("./ViewCommandBuilder");
|
|
7
|
+
var DefaultCommandBuilder;
|
|
8
|
+
(function (DefaultCommandBuilder) {
|
|
9
|
+
DefaultCommandBuilder.defaultViewCommandStrings = {
|
|
10
|
+
new: 'New',
|
|
11
|
+
edit: 'Edit',
|
|
12
|
+
delete: 'Delete',
|
|
13
|
+
deleteRecordCommandStringSet: ViewCommandBuilder_1.ViewCommandBuilder.defaultDeleteRecordStringSet,
|
|
14
|
+
refresh: 'Refresh',
|
|
15
|
+
export: 'Export',
|
|
16
|
+
exportCsv: 'CSV',
|
|
17
|
+
exportExcel: 'Excel',
|
|
18
|
+
};
|
|
19
|
+
function extractLocalizedStrings(localizedStrings, selector) {
|
|
20
|
+
if (!localizedStrings) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
return Object.keys(localizedStrings).reduce((p, key) => {
|
|
24
|
+
p[key] = selector(localizedStrings[key]);
|
|
25
|
+
return p;
|
|
26
|
+
}, {});
|
|
27
|
+
}
|
|
28
|
+
function createDefaultViewCommands({ icons, strings = DefaultCommandBuilder.defaultViewCommandStrings, localizedSrings, }) {
|
|
29
|
+
return [
|
|
30
|
+
[
|
|
31
|
+
ViewCommandBuilder_1.ViewCommandBuilder.createNewRecordCommand({
|
|
32
|
+
Icon: icons.New,
|
|
33
|
+
text: strings.new,
|
|
34
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.new),
|
|
35
|
+
}),
|
|
36
|
+
ViewCommandBuilder_1.ViewCommandBuilder.createEditRecordCommand({
|
|
37
|
+
Icon: icons.Edit,
|
|
38
|
+
text: strings.edit,
|
|
39
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.edit),
|
|
40
|
+
}),
|
|
41
|
+
ViewCommandBuilder_1.ViewCommandBuilder.createDeleteRecordCommand({
|
|
42
|
+
Icon: icons.Delete,
|
|
43
|
+
text: strings.delete,
|
|
44
|
+
localizedText: extractLocalizedStrings(localizedSrings, (x) => x.delete),
|
|
45
|
+
stringSet: strings.deleteRecordCommandStringSet,
|
|
46
|
+
localizedStringSet: extractLocalizedStrings(localizedSrings, (x) => x.deleteRecordCommandStringSet),
|
|
47
|
+
}),
|
|
48
|
+
ViewCommandBuilder_1.ViewCommandBuilder.createRefreshCommand({
|
|
49
|
+
Icon: icons.Refresh,
|
|
50
|
+
text: strings.refresh,
|
|
51
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.refresh),
|
|
52
|
+
}),
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
ViewCommandBuilder_1.ViewCommandBuilder.createExportCommand({
|
|
56
|
+
button: {
|
|
57
|
+
Icon: icons.Export,
|
|
58
|
+
text: strings.export,
|
|
59
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.export),
|
|
60
|
+
},
|
|
61
|
+
csv: {
|
|
62
|
+
Icon: icons.ExportCsv,
|
|
63
|
+
text: strings.exportCsv,
|
|
64
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.exportCsv),
|
|
65
|
+
},
|
|
66
|
+
excel: {
|
|
67
|
+
Icon: icons.ExportExcel,
|
|
68
|
+
text: strings.exportExcel,
|
|
69
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.exportExcel),
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
],
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
DefaultCommandBuilder.createDefaultViewCommands = createDefaultViewCommands;
|
|
76
|
+
DefaultCommandBuilder.defaultFormCommandStrings = {
|
|
77
|
+
save: 'Save',
|
|
78
|
+
saveAndClose: 'Save & Close',
|
|
79
|
+
refresh: 'Refresh',
|
|
80
|
+
delete: 'Delete',
|
|
81
|
+
deleteRecordCommandStringSet: FormCommandBuilder_1.FormCommandBuilder.defaultDeleteRecordStringSet,
|
|
82
|
+
};
|
|
83
|
+
function createDefaultFormCommands({ icons, strings = DefaultCommandBuilder.defaultFormCommandStrings, localizedSrings, }) {
|
|
84
|
+
return [
|
|
85
|
+
[
|
|
86
|
+
FormCommandBuilder_1.FormCommandBuilder.createSaveCommand({
|
|
87
|
+
Icon: icons.Save,
|
|
88
|
+
text: strings.save,
|
|
89
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.save),
|
|
90
|
+
}),
|
|
91
|
+
FormCommandBuilder_1.FormCommandBuilder.createSaveAndCloseCommand({
|
|
92
|
+
Icon: icons.SaveAndClose,
|
|
93
|
+
text: strings.saveAndClose,
|
|
94
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.saveAndClose),
|
|
95
|
+
}),
|
|
96
|
+
FormCommandBuilder_1.FormCommandBuilder.createRefreshCommand({
|
|
97
|
+
Icon: icons.Refresh,
|
|
98
|
+
text: strings.refresh,
|
|
99
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.refresh),
|
|
100
|
+
}),
|
|
101
|
+
FormCommandBuilder_1.FormCommandBuilder.createDeleteCommand({
|
|
102
|
+
Icon: icons.Delete,
|
|
103
|
+
text: 'Delete',
|
|
104
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.delete),
|
|
105
|
+
stringSet: strings.deleteRecordCommandStringSet,
|
|
106
|
+
localizedStringSet: extractLocalizedStrings(localizedSrings, (x) => x.deleteRecordCommandStringSet),
|
|
107
|
+
}),
|
|
108
|
+
],
|
|
109
|
+
];
|
|
110
|
+
}
|
|
111
|
+
DefaultCommandBuilder.createDefaultFormCommands = createDefaultFormCommands;
|
|
112
|
+
const defaultSubgridCommandStrings = {
|
|
113
|
+
new: 'New',
|
|
114
|
+
edit: 'Edit',
|
|
115
|
+
delete: 'Delete',
|
|
116
|
+
refresh: 'Refresh',
|
|
117
|
+
export: 'Export',
|
|
118
|
+
exportCsv: 'CSV',
|
|
119
|
+
exportExcel: 'Excel',
|
|
120
|
+
deleteRecordCommandStringSet: ViewCommandBuilder_1.ViewCommandBuilder.defaultDeleteRecordStringSet,
|
|
121
|
+
};
|
|
122
|
+
function createDefaultSubgridCommands({ icons, strings = defaultSubgridCommandStrings, localizedSrings, }) {
|
|
123
|
+
return [
|
|
124
|
+
[
|
|
125
|
+
SubgridCommandBuilder_1.SubgridCommandBuilder.createNewRecordCommand({
|
|
126
|
+
Icon: icons.New,
|
|
127
|
+
text: strings.new,
|
|
128
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.new),
|
|
129
|
+
}),
|
|
130
|
+
SubgridCommandBuilder_1.SubgridCommandBuilder.createEditRecordCommand({
|
|
131
|
+
Icon: icons.Edit,
|
|
132
|
+
text: strings.edit,
|
|
133
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.edit),
|
|
134
|
+
}),
|
|
135
|
+
SubgridCommandBuilder_1.SubgridCommandBuilder.createDeleteRecordCommand({
|
|
136
|
+
Icon: icons.Delete,
|
|
137
|
+
text: strings.delete,
|
|
138
|
+
localizedText: extractLocalizedStrings(localizedSrings, (x) => x.delete),
|
|
139
|
+
stringSet: strings.deleteRecordCommandStringSet,
|
|
140
|
+
localizedStringSet: extractLocalizedStrings(localizedSrings, (x) => x.deleteRecordCommandStringSet),
|
|
141
|
+
}),
|
|
142
|
+
SubgridCommandBuilder_1.SubgridCommandBuilder.createRefreshCommand({
|
|
143
|
+
Icon: icons.Refresh,
|
|
144
|
+
text: strings.refresh,
|
|
145
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.refresh),
|
|
146
|
+
}),
|
|
147
|
+
],
|
|
148
|
+
[
|
|
149
|
+
SubgridCommandBuilder_1.SubgridCommandBuilder.createExportCommand({
|
|
150
|
+
button: {
|
|
151
|
+
Icon: icons.Export,
|
|
152
|
+
text: strings.export,
|
|
153
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.export),
|
|
154
|
+
},
|
|
155
|
+
csv: {
|
|
156
|
+
Icon: icons.ExportCsv,
|
|
157
|
+
text: strings.exportCsv,
|
|
158
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.exportCsv),
|
|
159
|
+
},
|
|
160
|
+
excel: {
|
|
161
|
+
Icon: icons.ExportExcel,
|
|
162
|
+
text: strings.exportExcel,
|
|
163
|
+
localizedTexts: extractLocalizedStrings(localizedSrings, (x) => x.exportExcel),
|
|
164
|
+
},
|
|
165
|
+
}),
|
|
166
|
+
],
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
DefaultCommandBuilder.createDefaultSubgridCommands = createDefaultSubgridCommands;
|
|
170
|
+
const defaultCreateCommandStrings = Object.assign(Object.assign(Object.assign({}, DefaultCommandBuilder.defaultViewCommandStrings), DefaultCommandBuilder.defaultFormCommandStrings), defaultSubgridCommandStrings);
|
|
171
|
+
function createDefaultCommands({ icons, strings = defaultCreateCommandStrings, localizedSrings, }) {
|
|
172
|
+
return {
|
|
173
|
+
view: createDefaultViewCommands({
|
|
174
|
+
icons,
|
|
175
|
+
strings,
|
|
176
|
+
localizedSrings,
|
|
177
|
+
}),
|
|
178
|
+
form: createDefaultFormCommands({
|
|
179
|
+
icons,
|
|
180
|
+
strings,
|
|
181
|
+
localizedSrings,
|
|
182
|
+
}),
|
|
183
|
+
subgrid: createDefaultSubgridCommands({
|
|
184
|
+
icons,
|
|
185
|
+
strings,
|
|
186
|
+
localizedSrings,
|
|
187
|
+
}),
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
DefaultCommandBuilder.createDefaultCommands = createDefaultCommands;
|
|
191
|
+
})(DefaultCommandBuilder || (exports.DefaultCommandBuilder = DefaultCommandBuilder = {}));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EntityMainFormCommandItemExperience } from '@headless-adminapp/core/experience/form';
|
|
2
|
+
import { Localized } from '@headless-adminapp/core/types';
|
|
3
|
+
import { Icon } from '@headless-adminapp/icons';
|
|
4
|
+
export declare namespace FormCommandBuilder {
|
|
5
|
+
function createSaveCommand({ Icon, text, localizedTexts, }: {
|
|
6
|
+
Icon: Icon;
|
|
7
|
+
text: string;
|
|
8
|
+
localizedTexts?: Record<string, string>;
|
|
9
|
+
}): EntityMainFormCommandItemExperience;
|
|
10
|
+
function createSaveAndCloseCommand({ Icon, text, localizedTexts, }: {
|
|
11
|
+
Icon: Icon;
|
|
12
|
+
text: string;
|
|
13
|
+
localizedTexts?: Record<string, string>;
|
|
14
|
+
}): EntityMainFormCommandItemExperience;
|
|
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 createDeleteCommand({ Icon, text, localizedTexts, stringSet, localizedStringSet, }: {
|
|
35
|
+
Icon: Icon;
|
|
36
|
+
text: string;
|
|
37
|
+
localizedTexts?: Record<string, string>;
|
|
38
|
+
stringSet: DeleteRecordCommandStringSet;
|
|
39
|
+
localizedStringSet?: Localized<DeleteRecordCommandStringSet>;
|
|
40
|
+
}): EntityMainFormCommandItemExperience;
|
|
41
|
+
function createRefreshCommand({ Icon, text, localizedTexts, }: {
|
|
42
|
+
Icon: Icon;
|
|
43
|
+
text: string;
|
|
44
|
+
localizedTexts?: Record<string, string>;
|
|
45
|
+
}): EntityMainFormCommandItemExperience;
|
|
46
|
+
}
|
|
@@ -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
|
+
}
|