@headless-adminapp/app 0.0.17-alpha.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/AppProvider.d.ts +0 -3
- package/app/AppProvider.js +10 -33
- package/app/AuthWrapper.d.ts +1 -1
- package/app/AuthWrapper.js +4 -1
- package/app/LayoutProvider.d.ts +8 -7
- package/app/LayoutProvider.js +28 -2
- package/app/context.d.ts +1 -1
- package/auth/AuthProvider.d.ts +1 -1
- package/auth/AuthProvider.js +30 -23
- package/auth/context.d.ts +2 -0
- package/auth/hooks/useIsSkipAuthCheck.d.ts +1 -0
- package/auth/hooks/useIsSkipAuthCheck.js +8 -0
- package/auth/hooks/useLogout.js +1 -1
- package/board/BoardColumnDataResolver.d.ts +1 -0
- package/board/BoardColumnDataResolver.js +64 -0
- package/board/BoardColumnProvider.d.ts +7 -0
- package/board/BoardColumnProvider.js +36 -0
- package/board/context.d.ts +19 -0
- package/board/context.js +6 -0
- package/board/hooks/index.d.ts +6 -0
- package/board/hooks/index.js +15 -0
- package/board/hooks/useBoardColumnConfig.d.ts +2 -0
- package/board/hooks/useBoardColumnConfig.js +8 -0
- package/board/hooks/useBoardColumnData.d.ts +3 -0
- package/board/hooks/useBoardColumnData.js +9 -0
- package/board/hooks/useBoardColumnDataState.d.ts +5 -0
- package/board/hooks/useBoardColumnDataState.js +9 -0
- package/board/hooks/useBoardConfig.d.ts +3 -0
- package/board/hooks/useBoardConfig.js +8 -0
- package/board/hooks/useBoardSchema.d.ts +2 -0
- package/board/hooks/useBoardSchema.js +7 -0
- package/board/hooks/useSearchText.d.ts +1 -0
- package/board/hooks/useSearchText.js +14 -0
- package/board/types.d.ts +47 -0
- package/board/utils.d.ts +3 -0
- package/board/utils.js +6 -0
- package/builders/CommandBuilder/DefaultCommandBuilder.d.ts +15 -6
- package/builders/CommandBuilder/DefaultCommandBuilder.js +42 -20
- package/builders/CommandBuilder/FormCommandBuilder.d.ts +14 -13
- package/builders/CommandBuilder/FormCommandBuilder.js +66 -52
- package/builders/CommandBuilder/SubgridCommandBuilder.d.ts +8 -27
- package/builders/CommandBuilder/SubgridCommandBuilder.js +115 -57
- package/builders/CommandBuilder/ViewCommandBuilder.js +32 -52
- package/builders/CommandBuilder/utils.js +1 -1
- package/builders/DefineFormExperience.d.ts +27 -0
- package/builders/DefineFormExperience.js +99 -0
- package/builders/DefineViewExperience.d.ts +13 -0
- package/builders/DefineViewExperience.js +33 -0
- package/builders/SchemaExperienceBuilder.d.ts +9 -7
- package/builders/SchemaExperienceBuilder.js +62 -40
- package/builders/utils.js +30 -44
- package/calendar/baseEventAttributes.d.ts +35 -0
- package/calendar/baseEventAttributes.js +38 -0
- package/calendar/context.d.ts +6 -0
- package/calendar/context.js +5 -0
- package/calendar/hooks/index.d.ts +1 -0
- package/{appearance → calendar}/hooks/index.js +1 -1
- package/calendar/hooks/useConfig.d.ts +3 -0
- package/calendar/hooks/useConfig.js +8 -0
- package/calendar/types.d.ts +41 -0
- package/calendar/types.js +2 -0
- package/calendar/utils.d.ts +3 -0
- package/calendar/utils.js +6 -0
- package/command/hooks/useBaseCommandHandlerContext.js +15 -6
- package/command/hooks/useCommands.js +1 -1
- package/command/utils/index.js +34 -9
- package/components/ScrollView/index.d.ts +1 -1
- package/components/ScrollView/index.js +2 -2
- package/components/ScrollbarWithMoreDataRequest/index.d.ts +9 -0
- package/components/ScrollbarWithMoreDataRequest/index.js +32 -0
- package/dataform/DataFormProvider/CustomHookExecuter.d.ts +5 -0
- package/dataform/DataFormProvider/CustomHookExecuter.js +14 -0
- package/dataform/DataFormProvider/DataResolver.d.ts +6 -4
- package/dataform/DataFormProvider/DataResolver.js +11 -94
- package/dataform/DataFormProvider/InitialValueResolver.js +3 -2
- package/dataform/DataFormProvider/ReadonlyInfoResolver.js +2 -3
- package/dataform/DataFormProvider/getRecord.d.ts +3 -0
- package/dataform/DataFormProvider/getRecord.js +56 -0
- package/dataform/DataFormProvider/index.d.ts +4 -0
- package/dataform/DataFormProvider/index.js +34 -12
- package/dataform/DataFormProvider/types.d.ts +13 -0
- package/dataform/DataFormProvider/types.js +2 -0
- package/dataform/DataFormProvider/utils.d.ts +23 -0
- package/dataform/DataFormProvider/utils.js +105 -0
- package/dataform/FormManager.d.ts +57 -0
- package/dataform/FormManager.js +247 -0
- package/dataform/constants.d.ts +1 -0
- package/dataform/constants.js +4 -0
- package/dataform/context.d.ts +26 -1
- package/dataform/hooks/index.d.ts +11 -0
- package/dataform/hooks/index.js +11 -0
- package/dataform/hooks/useContextKey.d.ts +1 -0
- package/dataform/hooks/useContextKey.js +8 -0
- package/dataform/hooks/useDisabledControlsManager.d.ts +6 -0
- package/dataform/hooks/useDisabledControlsManager.js +46 -0
- package/dataform/hooks/useEventManager.d.ts +1 -0
- package/dataform/hooks/useEventManager.js +8 -0
- package/dataform/hooks/useFormManager.d.ts +2 -0
- package/dataform/hooks/useFormManager.js +13 -0
- package/dataform/hooks/useFormNotifications.js +2 -2
- package/dataform/hooks/useFormSave.js +28 -31
- package/dataform/hooks/useHiddenControlsManager.d.ts +7 -0
- package/dataform/hooks/useHiddenControlsManager.js +50 -0
- package/dataform/hooks/useIsControlDisabled.d.ts +1 -0
- package/dataform/hooks/useIsControlDisabled.js +27 -0
- package/dataform/hooks/useIsControlHiddenByAttributeName.d.ts +1 -0
- package/dataform/hooks/useIsControlHiddenByAttributeName.js +17 -0
- package/dataform/hooks/useIsControlHiddenByKey.d.ts +1 -0
- package/dataform/hooks/useIsControlHiddenByKey.js +17 -0
- package/dataform/hooks/useIsFieldRequired.d.ts +1 -0
- package/dataform/hooks/useIsFieldRequired.js +25 -0
- package/dataform/hooks/useLoadFormGridPage.js +8 -17
- package/dataform/hooks/useMainFormCommands.d.ts +1 -12
- package/dataform/hooks/useMainFormCommands.js +13 -3
- package/dataform/hooks/useOnFieldValueChangeListener.d.ts +1 -0
- package/dataform/hooks/useOnFieldValueChangeListener.js +30 -0
- package/dataform/hooks/useProcessFlowSteps.d.ts +1 -0
- package/dataform/hooks/useProcessFlowSteps.js +45 -0
- package/dataform/hooks/useRecordTitle.d.ts +3 -1
- package/dataform/hooks/useRecordTitle.js +12 -5
- package/dataform/hooks/useRequiredFieldManager.d.ts +6 -0
- package/dataform/hooks/useRequiredFieldManager.js +49 -0
- package/dataform/test.d.ts +57 -0
- package/dataform/test.js +247 -0
- package/dataform/utils/defaultParameters.d.ts +6 -0
- package/dataform/utils/defaultParameters.js +54 -0
- package/dataform/utils/index.d.ts +6 -24
- package/dataform/utils/index.js +164 -190
- package/dataform/utils/saveRecord.d.ts +27 -0
- package/dataform/utils/saveRecord.js +163 -0
- package/datagrid/DataGridProvider/DataResolver.js +38 -109
- package/datagrid/DataGridProvider/index.d.ts +6 -0
- package/datagrid/DataGridProvider/index.js +18 -8
- package/datagrid/DataGridProvider/transformViewColumns.js +10 -2
- package/datagrid/DataGridProvider/utils.js +8 -8
- package/datagrid/column-filter/constants.js +38 -3
- package/datagrid/column-filter/utils.js +7 -1
- package/datagrid/context.d.ts +6 -0
- package/datagrid/hooks/useChangeView.js +1 -1
- package/datagrid/hooks/useGridColumnFilter.js +4 -1
- package/datagrid/hooks/useGridDisabled.d.ts +1 -0
- package/datagrid/hooks/useGridDisabled.js +8 -0
- package/datagrid/hooks/useLoadMainGridPage.js +1 -1
- package/datagrid/hooks/useMainGridCommands.js +23 -9
- package/datagrid/hooks/useOpenRecord.js +2 -2
- package/datagrid/hooks/useSubGridCommands.js +23 -45
- package/defaults.d.ts +2 -0
- package/defaults.js +5 -0
- package/dialog/hooks/useCloseDialog.js +17 -15
- package/dialog/hooks/useOpenAlertDialog.js +8 -3
- package/dialog/hooks/useOpenConfirmDialog.js +10 -4
- package/dialog/hooks/useOpenDialog.js +7 -5
- package/dialog/hooks/useOpenErrorDialog.js +8 -3
- package/dialog/hooks/useOpenPromptDialog.js +10 -4
- package/form/FormValidationStringContext.d.ts +1 -0
- package/form/FormValidationStringContext.js +1 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +3 -0
- package/hooks/useDebouncedValue.js +0 -1
- package/hooks/useElementLayout.js +1 -1
- package/hooks/useIsMobile.js +0 -1
- package/hooks/useItemsWithKey.d.ts +7 -0
- package/hooks/useItemsWithKey.js +13 -0
- package/hooks/useStorageState.js +1 -2
- package/hooks/useSystemColorScheme.d.ts +1 -1
- package/hooks/useSystemColorScheme.js +0 -1
- package/insights/InsightsProvider.d.ts +8 -0
- package/insights/InsightsProvider.js +27 -0
- package/locale/LocaleProvider.d.ts +2 -1
- package/locale/LocaleProvider.js +3 -3
- package/locale/index.d.ts +1 -0
- package/locale/index.js +1 -0
- package/locale/useCurrencySymbol.d.ts +1 -0
- package/locale/useCurrencySymbol.js +12 -0
- package/locale/utils.js +4 -2
- package/metadata/MetadataProvider.d.ts +8 -4
- package/metadata/MetadataProvider.js +23 -17
- package/metadata/context.d.ts +3 -2
- package/metadata/hooks/index.d.ts +1 -1
- package/metadata/hooks/index.js +1 -1
- package/metadata/hooks/useAppExperience.d.ts +1 -0
- package/metadata/hooks/useAppExperience.js +8 -0
- package/metadata/hooks/useAppStore.d.ts +1 -1
- package/metadata/hooks/useAppStore.js +3 -3
- package/metadata/hooks/useExperienceView.js +2 -11
- package/metadata/hooks/useExperienceViewCommands.d.ts +1 -1
- package/metadata/hooks/useExperienceViewCommands.js +5 -14
- package/metadata/hooks/useExperienceViewLookup.js +2 -11
- package/metadata/hooks/useExperienceViewSubgridCommands.d.ts +1 -1
- package/metadata/hooks/useExperienceViewSubgridCommands.js +5 -14
- package/metadata/hooks/useMetadata.d.ts +11 -10
- package/metadata/hooks/useMetadata.js +4 -16
- package/metadata/hooks/useSchema.d.ts +1 -1
- package/metadata/hooks/useSchema.js +3 -0
- package/mutable/context.d.ts +3 -0
- package/mutable/context.js +8 -0
- package/mutable/utils.js +5 -12
- package/navigation/hooks/useOpenForm.js +4 -0
- package/package.json +6 -10
- package/providers/PageEntityFormProvider/index.d.ts +5 -1
- package/providers/PageEntityFormProvider/index.js +2 -2
- package/recordset/hooks/useRecordSetResult.js +4 -14
- package/route/RouteProvider.d.ts +2 -2
- package/route/RouteProvider.js +4 -1
- package/store/ClientAppStore.js +7 -20
- package/store/ComponentStore.d.ts +1 -1
- package/store/ComponentStore.js +6 -12
- package/store/EventManager.d.ts +2 -2
- package/store/EventManager.js +13 -29
- package/store/SchemaExperienceStore.js +179 -215
- package/store/index.d.ts +0 -1
- package/store/index.js +0 -1
- package/toast-notification/hooks/useCloseToastNotification.js +17 -15
- package/toast-notification/hooks/useOpenToastNotification.js +7 -5
- package/transport/InMemoryDataService/index.js +54 -77
- package/transport/RestDataService/index.d.ts +3 -3
- package/transport/RestDataService/index.js +68 -91
- package/transport/context.d.ts +2 -1
- package/transport/context.js +7 -1
- package/transport/hooks/index.d.ts +1 -0
- package/transport/hooks/index.js +1 -0
- package/transport/hooks/useFileService.d.ts +1 -0
- package/transport/hooks/useFileService.js +9 -0
- package/transport/hooks/useRetriveRecords.d.ts +33 -0
- package/transport/hooks/useRetriveRecords.js +110 -0
- package/utils/calculateColumnWidths.js +1 -1
- package/utils/color.d.ts +1 -0
- package/utils/color.js +14 -0
- package/utils/getAttributeFormattedValue.d.ts +4 -1
- package/utils/getAttributeFormattedValue.js +109 -54
- package/utils/phone.d.ts +13 -0
- package/utils/phone.js +33 -0
- package/appearance/context.d.ts +0 -7
- package/appearance/context.js +0 -5
- package/appearance/hooks/index.d.ts +0 -1
- package/appearance/hooks/useAppearanceContext.d.ts +0 -1
- package/appearance/hooks/useAppearanceContext.js +0 -12
- package/appearance/index.d.ts +0 -2
- package/appearance/index.js +0 -20
- package/builders/CommandBuilder.d.ts +0 -176
- package/builders/CommandBuilder.js +0 -567
- package/locale/types.d.ts +0 -2
- /package/{locale → board}/types.js +0 -0
|
@@ -2,6 +2,8 @@ import { AsyncForm, AsyncQuickCreateForm, Form, FormExperience, QuickCreateForm
|
|
|
2
2
|
import { SchemaExperience } from '@headless-adminapp/core/experience/schema';
|
|
3
3
|
import { AsyncView, View, ViewExperience } from '@headless-adminapp/core/experience/view';
|
|
4
4
|
import { Schema, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
5
|
+
import { DefineFormExperience } from './DefineFormExperience';
|
|
6
|
+
import { DefineViewExperience } from './DefineViewExperience';
|
|
5
7
|
declare abstract class BaseSchemaExperienceBuilder<S extends SchemaAttributes> {
|
|
6
8
|
protected readonly logicalName: string;
|
|
7
9
|
protected views: View<S>[];
|
|
@@ -26,7 +28,6 @@ declare abstract class BaseSchemaExperienceBuilder<S extends SchemaAttributes> {
|
|
|
26
28
|
defaultQuickCreateFormId: string | null;
|
|
27
29
|
quickCreateForms: QuickCreateForm<S>[];
|
|
28
30
|
};
|
|
29
|
-
defineFormExperience(formExperience: FormExperience<S>): FormExperience<S>;
|
|
30
31
|
}
|
|
31
32
|
export interface SchemaExperienceBuilderDefaults {
|
|
32
33
|
localizedViewNames?: Record<string, string>;
|
|
@@ -34,14 +35,15 @@ export interface SchemaExperienceBuilderDefaults {
|
|
|
34
35
|
interface SchemaExperienceBuilderOptions {
|
|
35
36
|
}
|
|
36
37
|
export declare class SchemaExperienceBuilder<S extends SchemaAttributes = SchemaAttributes> extends BaseSchemaExperienceBuilder<S> {
|
|
37
|
-
private schema;
|
|
38
|
-
private defaults?;
|
|
39
|
-
private options?;
|
|
38
|
+
private readonly schema;
|
|
39
|
+
private readonly defaults?;
|
|
40
|
+
private readonly options?;
|
|
40
41
|
constructor(schema: Schema<S>, defaults?: SchemaExperienceBuilderDefaults | undefined, options?: SchemaExperienceBuilderOptions | undefined);
|
|
41
|
-
defineViewExperience(viewExperience: Pick<
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
defineViewExperience(viewExperience: Pick<DefineViewExperience.Experience<S>, 'filter' | 'defaultSorting'> & {
|
|
43
|
+
grid?: DefineViewExperience.Experience<S>['grid'];
|
|
44
|
+
card?: DefineViewExperience.Experience<S>['card'];
|
|
44
45
|
}): ViewExperience<S>;
|
|
46
|
+
defineFormExperience(formExperience: DefineFormExperience.Experience<S>): FormExperience<S>;
|
|
45
47
|
defineDefaultViewGrid(): ViewExperience<S>['grid'];
|
|
46
48
|
defineDefaultViewCard(): ViewExperience<S>['card'];
|
|
47
49
|
defineDefaultViewExperience(): ViewExperience<S>;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SchemaExperienceBuilder = void 0;
|
|
4
|
+
const DefineFormExperience_1 = require("./DefineFormExperience");
|
|
5
|
+
const DefineViewExperience_1 = require("./DefineViewExperience");
|
|
4
6
|
class BaseSchemaExperienceBuilder {
|
|
7
|
+
logicalName;
|
|
8
|
+
views = [];
|
|
9
|
+
forms = [];
|
|
10
|
+
lookups = [];
|
|
11
|
+
quickCreateForms = [];
|
|
12
|
+
defaultViewId = null;
|
|
13
|
+
defaultFormId = null;
|
|
14
|
+
defaultLookupId = null;
|
|
15
|
+
defaultQuickCreateFormId = null;
|
|
16
|
+
locked = false;
|
|
5
17
|
constructor(logicalName) {
|
|
6
18
|
this.logicalName = logicalName;
|
|
7
|
-
this.views = [];
|
|
8
|
-
this.forms = [];
|
|
9
|
-
this.lookups = [];
|
|
10
|
-
this.quickCreateForms = [];
|
|
11
|
-
this.defaultViewId = null;
|
|
12
|
-
this.defaultFormId = null;
|
|
13
|
-
this.defaultLookupId = null;
|
|
14
|
-
this.defaultQuickCreateFormId = null;
|
|
15
|
-
this.locked = false;
|
|
16
19
|
}
|
|
17
20
|
reset() {
|
|
18
21
|
this.views = [];
|
|
@@ -36,17 +39,17 @@ class BaseSchemaExperienceBuilder {
|
|
|
36
39
|
if (!this.defaultLookupId) {
|
|
37
40
|
throw new Error('Default lookup is required');
|
|
38
41
|
}
|
|
39
|
-
if (!this.views.find(v => v.id === this.defaultViewId)) {
|
|
42
|
+
if (!this.views.find((v) => v.id === this.defaultViewId)) {
|
|
40
43
|
throw new Error('Default view not found');
|
|
41
44
|
}
|
|
42
|
-
if (!this.forms.find(f => f.id === this.defaultFormId)) {
|
|
45
|
+
if (!this.forms.find((f) => f.id === this.defaultFormId)) {
|
|
43
46
|
throw new Error('Default form not found');
|
|
44
47
|
}
|
|
45
|
-
if (!this.lookups.find(l => l.id === this.defaultLookupId)) {
|
|
48
|
+
if (!this.lookups.find((l) => l.id === this.defaultLookupId)) {
|
|
46
49
|
throw new Error('Default lookup not found');
|
|
47
50
|
}
|
|
48
51
|
if (this.defaultQuickCreateFormId &&
|
|
49
|
-
!this.quickCreateForms.find(f => f.id === this.defaultQuickCreateFormId)) {
|
|
52
|
+
!this.quickCreateForms.find((f) => f.id === this.defaultQuickCreateFormId)) {
|
|
50
53
|
throw new Error('Default quick create form not found');
|
|
51
54
|
}
|
|
52
55
|
return {
|
|
@@ -61,11 +64,11 @@ class BaseSchemaExperienceBuilder {
|
|
|
61
64
|
quickCreateForms: this.quickCreateForms,
|
|
62
65
|
};
|
|
63
66
|
}
|
|
64
|
-
defineFormExperience(formExperience) {
|
|
65
|
-
return formExperience;
|
|
66
|
-
}
|
|
67
67
|
}
|
|
68
68
|
class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
69
|
+
schema;
|
|
70
|
+
defaults;
|
|
71
|
+
options;
|
|
69
72
|
constructor(schema, defaults, options) {
|
|
70
73
|
super(schema.logicalName);
|
|
71
74
|
this.schema = schema;
|
|
@@ -73,10 +76,16 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
73
76
|
this.options = options;
|
|
74
77
|
}
|
|
75
78
|
defineViewExperience(viewExperience) {
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
const cardView = viewExperience.card ?? this.defineDefaultViewCard();
|
|
80
|
+
const gridView = viewExperience.grid ?? this.defineDefaultViewGrid();
|
|
81
|
+
return DefineViewExperience_1.DefineViewExperience.resolveExperience({
|
|
82
|
+
...viewExperience,
|
|
83
|
+
grid: gridView,
|
|
84
|
+
card: cardView,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
defineFormExperience(formExperience) {
|
|
88
|
+
return DefineFormExperience_1.DefineFormExperience.resolveExperience(formExperience);
|
|
80
89
|
}
|
|
81
90
|
defineDefaultViewGrid() {
|
|
82
91
|
const columns = [];
|
|
@@ -155,16 +164,15 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
155
164
|
};
|
|
156
165
|
}
|
|
157
166
|
getLocalizedViewNames() {
|
|
158
|
-
var _a;
|
|
159
167
|
const langugesSet = new Set();
|
|
160
168
|
this.schema.localizedPluralLabels &&
|
|
161
|
-
Object.keys(this.schema.localizedPluralLabels).forEach(key => langugesSet.add(key));
|
|
162
|
-
|
|
163
|
-
Object.keys(this.defaults.localizedViewNames).forEach(key => langugesSet.add(key));
|
|
169
|
+
Object.keys(this.schema.localizedPluralLabels).forEach((key) => langugesSet.add(key));
|
|
170
|
+
this.defaults?.localizedViewNames &&
|
|
171
|
+
Object.keys(this.defaults.localizedViewNames).forEach((key) => langugesSet.add(key));
|
|
164
172
|
const localizedLabels = Array.from(langugesSet).reduce((acc, key) => {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const localizedPlaceholder =
|
|
173
|
+
const localizedPluralName = this.schema.localizedPluralLabels?.[key]?.toLowerCase() ??
|
|
174
|
+
this.schema.pluralLabel.toLowerCase();
|
|
175
|
+
const localizedPlaceholder = this.defaults?.localizedViewNames?.[key] ?? `All {label}`;
|
|
168
176
|
const localeName = localizedPlaceholder.replace('{label}', localizedPluralName);
|
|
169
177
|
acc[key] = localeName;
|
|
170
178
|
return acc;
|
|
@@ -178,18 +186,17 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
178
186
|
if (!defaultId) {
|
|
179
187
|
return data[0].id;
|
|
180
188
|
}
|
|
181
|
-
if (!data.find(x => x.id === defaultId)) {
|
|
189
|
+
if (!data.find((x) => x.id === defaultId)) {
|
|
182
190
|
return data[0].id;
|
|
183
191
|
}
|
|
184
192
|
return defaultId;
|
|
185
193
|
}
|
|
186
194
|
defineExperience(experience) {
|
|
187
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
188
195
|
let lookups = experience.lookups;
|
|
189
196
|
let views = experience.views;
|
|
190
197
|
let forms = experience.forms;
|
|
191
198
|
let associatedViews = experience.associatedViews;
|
|
192
|
-
if (!
|
|
199
|
+
if (!lookups?.length) {
|
|
193
200
|
lookups = [
|
|
194
201
|
{
|
|
195
202
|
id: 'default',
|
|
@@ -198,7 +205,7 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
198
205
|
},
|
|
199
206
|
];
|
|
200
207
|
}
|
|
201
|
-
if (!
|
|
208
|
+
if (!views?.length) {
|
|
202
209
|
views = [
|
|
203
210
|
{
|
|
204
211
|
id: 'default',
|
|
@@ -208,7 +215,7 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
208
215
|
},
|
|
209
216
|
];
|
|
210
217
|
}
|
|
211
|
-
if (!
|
|
218
|
+
if (!associatedViews?.length) {
|
|
212
219
|
associatedViews = [
|
|
213
220
|
{
|
|
214
221
|
id: 'default',
|
|
@@ -218,7 +225,7 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
218
225
|
},
|
|
219
226
|
];
|
|
220
227
|
}
|
|
221
|
-
if (!
|
|
228
|
+
if (!forms?.length) {
|
|
222
229
|
forms = [
|
|
223
230
|
{
|
|
224
231
|
id: 'default',
|
|
@@ -232,8 +239,8 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
232
239
|
const defaultLookupId = this.resolveDefaultId(lookups, experience.defaultLookupId);
|
|
233
240
|
const defaultAssociatedViewId = this.resolveDefaultId(associatedViews, experience.defaultAssociatedViewId);
|
|
234
241
|
let defaultQuickCreateFormId = null;
|
|
235
|
-
if (
|
|
236
|
-
defaultQuickCreateFormId = this.resolveDefaultId(
|
|
242
|
+
if (experience.quickCreateForms?.length) {
|
|
243
|
+
defaultQuickCreateFormId = this.resolveDefaultId(experience.quickCreateForms ?? [], experience.defaultQuickCreateFormId);
|
|
237
244
|
}
|
|
238
245
|
return {
|
|
239
246
|
logicalName: this.logicalName,
|
|
@@ -243,11 +250,26 @@ class SchemaExperienceBuilder extends BaseSchemaExperienceBuilder {
|
|
|
243
250
|
defaultViewId,
|
|
244
251
|
defaultLookupId,
|
|
245
252
|
defaultAssociatedViewId,
|
|
246
|
-
quickCreateForms:
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
253
|
+
quickCreateForms: experience.quickCreateForms?.map((x) => ({
|
|
254
|
+
...x,
|
|
255
|
+
logicalName: this.logicalName,
|
|
256
|
+
})) ?? [],
|
|
257
|
+
views: views.map((x) => ({
|
|
258
|
+
...x,
|
|
259
|
+
logicalName: this.logicalName,
|
|
260
|
+
})) ?? [],
|
|
261
|
+
forms: forms.map((x) => ({
|
|
262
|
+
...x,
|
|
263
|
+
logicalName: this.logicalName,
|
|
264
|
+
})) ?? [],
|
|
265
|
+
lookups: lookups.map((x) => ({
|
|
266
|
+
...x,
|
|
267
|
+
logicalName: this.logicalName,
|
|
268
|
+
})) ?? [],
|
|
269
|
+
associatedViews: associatedViews.map((x) => ({
|
|
270
|
+
...x,
|
|
271
|
+
logicalName: this.logicalName,
|
|
272
|
+
})) ?? [],
|
|
251
273
|
formCommands: experience.formCommands,
|
|
252
274
|
subgridCommands: experience.subgridCommands,
|
|
253
275
|
viewCommands: experience.viewCommands,
|
package/builders/utils.js
CHANGED
|
@@ -22,15 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
26
|
exports.exportRecordsXLS = exports.exportRecordsCSV = void 0;
|
|
36
27
|
exports.retriveRecords = retriveRecords;
|
|
@@ -38,14 +29,13 @@ const utils_1 = require("../datagrid/DataGridProvider/utils");
|
|
|
38
29
|
const utils_2 = require("../utils");
|
|
39
30
|
const getHeaders = (schema, gridColumns, schemaStore) => {
|
|
40
31
|
const headers = gridColumns.map((column) => {
|
|
41
|
-
var _a, _b, _c;
|
|
42
32
|
if (column.name.indexOf('.') !== -1) {
|
|
43
33
|
const [lookup, field] = column.name.split('.');
|
|
44
34
|
const entity = schema.attributes[lookup].entity;
|
|
45
35
|
const lookupSchema = schemaStore.getSchema(entity);
|
|
46
|
-
return `${
|
|
36
|
+
return `${lookupSchema.attributes[field]?.label} (${schema.attributes[lookup]?.label})`;
|
|
47
37
|
}
|
|
48
|
-
return
|
|
38
|
+
return schema.attributes[column.name]?.label;
|
|
49
39
|
});
|
|
50
40
|
return headers;
|
|
51
41
|
};
|
|
@@ -64,13 +54,12 @@ function getAttribute({ column, schema, schemaStore, }) {
|
|
|
64
54
|
return attribute;
|
|
65
55
|
}
|
|
66
56
|
function extractAttributeData({ column, record, schema, schemaStore, }) {
|
|
67
|
-
var _a, _b;
|
|
68
57
|
const attribute = getAttribute({ column, schema, schemaStore });
|
|
69
58
|
let value;
|
|
70
59
|
if (column.expandedKey) {
|
|
71
60
|
const lookup = column.name;
|
|
72
61
|
const field = column.expandedKey;
|
|
73
|
-
value =
|
|
62
|
+
value = record.$expand?.[lookup]?.[field];
|
|
74
63
|
}
|
|
75
64
|
else {
|
|
76
65
|
value = record[column.name];
|
|
@@ -80,12 +69,11 @@ function extractAttributeData({ column, record, schema, schemaStore, }) {
|
|
|
80
69
|
value,
|
|
81
70
|
};
|
|
82
71
|
}
|
|
83
|
-
const exportRecordsCSV =
|
|
84
|
-
const csvDownload =
|
|
72
|
+
const exportRecordsCSV = async ({ schema, records, gridColumns, schemaStore, fileName, }) => {
|
|
73
|
+
const csvDownload = await Promise.resolve().then(() => __importStar(require('json-to-csv-export')));
|
|
85
74
|
const headers = getHeaders(schema, gridColumns, schemaStore);
|
|
86
75
|
const cellData = records.map((record) => {
|
|
87
76
|
return gridColumns.map((column) => {
|
|
88
|
-
var _a, _b;
|
|
89
77
|
const { attribute, value } = extractAttributeData({
|
|
90
78
|
column,
|
|
91
79
|
record,
|
|
@@ -93,9 +81,9 @@ const exportRecordsCSV = (_a) => __awaiter(void 0, [_a], void 0, function* ({ sc
|
|
|
93
81
|
schemaStore,
|
|
94
82
|
});
|
|
95
83
|
if (attribute.type === 'money' || attribute.type === 'number') {
|
|
96
|
-
return
|
|
84
|
+
return value?.toString() ?? '';
|
|
97
85
|
}
|
|
98
|
-
return (
|
|
86
|
+
return (0, utils_2.getAttributeFormattedValue)(attribute, value) ?? '';
|
|
99
87
|
});
|
|
100
88
|
});
|
|
101
89
|
csvDownload.default({
|
|
@@ -104,10 +92,10 @@ const exportRecordsCSV = (_a) => __awaiter(void 0, [_a], void 0, function* ({ sc
|
|
|
104
92
|
delimiter: ',',
|
|
105
93
|
filename: fileName,
|
|
106
94
|
});
|
|
107
|
-
}
|
|
95
|
+
};
|
|
108
96
|
exports.exportRecordsCSV = exportRecordsCSV;
|
|
109
|
-
const exportRecordsXLS =
|
|
110
|
-
const ExcelJS =
|
|
97
|
+
const exportRecordsXLS = async ({ fileName, gridColumns, records, schema, schemaStore, }) => {
|
|
98
|
+
const ExcelJS = await Promise.resolve().then(() => __importStar(require('exceljs')));
|
|
111
99
|
const headers = getHeaders(schema, gridColumns, schemaStore);
|
|
112
100
|
const cellData = records.map((item) => {
|
|
113
101
|
return gridColumns.map((column) => {
|
|
@@ -120,7 +108,7 @@ const exportRecordsXLS = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fi
|
|
|
120
108
|
if (!value) {
|
|
121
109
|
return '';
|
|
122
110
|
}
|
|
123
|
-
switch (attribute
|
|
111
|
+
switch (attribute?.type) {
|
|
124
112
|
case 'money':
|
|
125
113
|
case 'number':
|
|
126
114
|
return value;
|
|
@@ -142,8 +130,8 @@ const exportRecordsXLS = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fi
|
|
|
142
130
|
gridColumns.forEach((column, index) => {
|
|
143
131
|
const attribute = getAttribute({ column, schema, schemaStore });
|
|
144
132
|
const sheetColumn = worksheet.getColumn(index + 1);
|
|
145
|
-
let formatFn = (value) =>
|
|
146
|
-
if (
|
|
133
|
+
let formatFn = (value) => (0, utils_2.getAttributeFormattedValue)(attribute, value) ?? '';
|
|
134
|
+
if (attribute?.type === 'money') {
|
|
147
135
|
sheetColumn.numFmt = '"₹" #,##0.00';
|
|
148
136
|
}
|
|
149
137
|
let maxLength = 0;
|
|
@@ -156,30 +144,28 @@ const exportRecordsXLS = (_a) => __awaiter(void 0, [_a], void 0, function* ({ fi
|
|
|
156
144
|
sheetColumn.width = Math.max(maxLength, 10) * 1.2;
|
|
157
145
|
});
|
|
158
146
|
// Generate the Excel file
|
|
159
|
-
const buffer =
|
|
160
|
-
|
|
147
|
+
const buffer = await workbook.xlsx.writeBuffer();
|
|
148
|
+
const blob = new Blob([buffer], {
|
|
161
149
|
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
162
150
|
});
|
|
163
|
-
|
|
151
|
+
const link = document.createElement('a');
|
|
164
152
|
link.href = window.URL.createObjectURL(blob);
|
|
165
153
|
link.download = fileName;
|
|
166
154
|
link.click();
|
|
167
|
-
}
|
|
155
|
+
};
|
|
168
156
|
exports.exportRecordsXLS = exportRecordsXLS;
|
|
169
|
-
function retriveRecords(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
sort: sorting,
|
|
182
|
-
});
|
|
183
|
-
return result;
|
|
157
|
+
async function retriveRecords({ gridColumns, dataService, schema, search, view, extraFilter, columnFilters, schemaStore, sorting, skip, limit, }) {
|
|
158
|
+
const expand = (0, utils_1.collectExpandedKeys)(gridColumns);
|
|
159
|
+
const columns = Array.from(new Set([...gridColumns.filter((x) => !x.expandedKey).map((x) => x.name)]));
|
|
160
|
+
const result = await dataService.retriveRecords({
|
|
161
|
+
logicalName: schema.logicalName,
|
|
162
|
+
search,
|
|
163
|
+
columns: columns,
|
|
164
|
+
expand,
|
|
165
|
+
filter: (0, utils_1.mergeConditions)(schema, view.experience.filter, extraFilter, columnFilters, schemaStore),
|
|
166
|
+
skip,
|
|
167
|
+
limit,
|
|
168
|
+
sort: sorting,
|
|
184
169
|
});
|
|
170
|
+
return result;
|
|
185
171
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const baseEventAttributes: {
|
|
2
|
+
id: {
|
|
3
|
+
type: "id";
|
|
4
|
+
label: string;
|
|
5
|
+
string: true;
|
|
6
|
+
};
|
|
7
|
+
title: {
|
|
8
|
+
type: "string";
|
|
9
|
+
format: "text";
|
|
10
|
+
label: string;
|
|
11
|
+
required: true;
|
|
12
|
+
};
|
|
13
|
+
start: {
|
|
14
|
+
type: "date";
|
|
15
|
+
format: "datetime";
|
|
16
|
+
label: string;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
end: {
|
|
20
|
+
type: "date";
|
|
21
|
+
format: "datetime";
|
|
22
|
+
label: string;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
allDay: {
|
|
26
|
+
type: "boolean";
|
|
27
|
+
label: string;
|
|
28
|
+
};
|
|
29
|
+
description: {
|
|
30
|
+
type: "string";
|
|
31
|
+
format: "textarea";
|
|
32
|
+
label: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export type BaseEventAttributes = typeof baseEventAttributes;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.baseEventAttributes = void 0;
|
|
4
|
+
const utils_1 = require("@headless-adminapp/core/schema/utils");
|
|
5
|
+
exports.baseEventAttributes = (0, utils_1.defineSchemaAttributes)({
|
|
6
|
+
id: {
|
|
7
|
+
type: 'id',
|
|
8
|
+
label: 'ID',
|
|
9
|
+
string: true,
|
|
10
|
+
},
|
|
11
|
+
title: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
format: 'text',
|
|
14
|
+
label: 'Title',
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
start: {
|
|
18
|
+
type: 'date',
|
|
19
|
+
format: 'datetime',
|
|
20
|
+
label: 'Start',
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
end: {
|
|
24
|
+
type: 'date',
|
|
25
|
+
format: 'datetime',
|
|
26
|
+
label: 'End',
|
|
27
|
+
required: true,
|
|
28
|
+
},
|
|
29
|
+
allDay: {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
label: 'All day',
|
|
32
|
+
},
|
|
33
|
+
description: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
format: 'textarea',
|
|
36
|
+
label: 'Description',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
+
import { CalendarConfig } from './types';
|
|
3
|
+
export interface CalendarContextState<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes> {
|
|
4
|
+
config: CalendarConfig<SA1, SA2, SA3>;
|
|
5
|
+
}
|
|
6
|
+
export declare const CalendarContext: import("react").Context<import("@headless-adminapp/app/mutable").ContextValue<CalendarContextState<SchemaAttributes, SchemaAttributes, SchemaAttributes>>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useConfig';
|
|
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
17
|
+
__exportStar(require("./useConfig"), exports);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
+
import { CalendarConfig } from '../types';
|
|
3
|
+
export declare function useConfig<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes>(): CalendarConfig<SA1, SA2, SA3>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useConfig = useConfig;
|
|
4
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
5
|
+
const context_1 = require("../context");
|
|
6
|
+
function useConfig() {
|
|
7
|
+
return (0, mutable_1.useContextSelector)(context_1.CalendarContext, (state) => state.config);
|
|
8
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { InferredSchemaType, SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
+
import { AuthSession } from '../auth';
|
|
3
|
+
export interface CalendarEvent {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
start?: Date | null;
|
|
7
|
+
end?: Date | null;
|
|
8
|
+
allDay?: boolean | null;
|
|
9
|
+
description?: string | null;
|
|
10
|
+
}
|
|
11
|
+
export type CalendarEventExtended<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes> = CalendarEvent & InferredSchemaType<SA1> & InferredSchemaType<SA2>;
|
|
12
|
+
export interface CalendarEventsResolverFnOptions<SA extends SchemaAttributes = SchemaAttributes> {
|
|
13
|
+
start: Date;
|
|
14
|
+
end: Date;
|
|
15
|
+
filter?: InferredSchemaType<SA>;
|
|
16
|
+
auth: AuthSession | null;
|
|
17
|
+
}
|
|
18
|
+
export type CalendarEventsResolverFn<SA extends SchemaAttributes = SchemaAttributes> = (options: CalendarEventsResolverFnOptions<SA>) => Promise<CalendarEvent[]>;
|
|
19
|
+
export type CalendarEventResolverFn<T extends CalendarEvent = CalendarEvent> = (id: string) => Promise<T>;
|
|
20
|
+
export type CalendarEventSaveData<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes> = Omit<CalendarEvent, 'id'> & {
|
|
21
|
+
id?: CalendarEvent['id'];
|
|
22
|
+
} & InferredSchemaType<SA1> & InferredSchemaType<SA2>;
|
|
23
|
+
export interface CalendarEventSaveFnOptions<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes> {
|
|
24
|
+
event: CalendarEventSaveData<SA1, SA2>;
|
|
25
|
+
modifiedValues: Partial<CalendarEventSaveData<SA1, SA2>>;
|
|
26
|
+
}
|
|
27
|
+
export type CalendarEventSaveFn<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes> = ({ event, modifiedValues, }: CalendarEventSaveFnOptions<SA1, SA2>) => Promise<void>;
|
|
28
|
+
export interface CalendarConfig<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes> {
|
|
29
|
+
eventsResolver: CalendarEventsResolverFn<SA3>;
|
|
30
|
+
eventResolver?: CalendarEventResolverFn;
|
|
31
|
+
saveEvent: CalendarEventSaveFn<SA1, SA2>;
|
|
32
|
+
beforeDescriptionAttributes?: SA1;
|
|
33
|
+
afterDescriptionAttributes?: SA2;
|
|
34
|
+
filterAttributes?: SA3;
|
|
35
|
+
defaultFilter?: InferredSchemaType<SA3>;
|
|
36
|
+
openRecord?: (id: string) => void;
|
|
37
|
+
deleteEvent: (id: string) => Promise<void>;
|
|
38
|
+
title: string;
|
|
39
|
+
description: string;
|
|
40
|
+
eventLabel: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
+
import { CalendarConfig } from './types';
|
|
3
|
+
export declare function defineCalendarConfig<SA1 extends SchemaAttributes = SchemaAttributes, SA2 extends SchemaAttributes = SchemaAttributes, SA3 extends SchemaAttributes = SchemaAttributes>(config: CalendarConfig<SA1, SA2, SA3>): CalendarConfig<SA1, SA2, SA3>;
|
|
@@ -4,6 +4,7 @@ exports.useUtility = useUtility;
|
|
|
4
4
|
exports.useBaseCommandHandlerContext = useBaseCommandHandlerContext;
|
|
5
5
|
const navigation_1 = require("@headless-adminapp/app/navigation");
|
|
6
6
|
const react_query_1 = require("@tanstack/react-query");
|
|
7
|
+
const react_1 = require("react");
|
|
7
8
|
const hooks_1 = require("../../dialog/hooks");
|
|
8
9
|
const locale_1 = require("../../locale");
|
|
9
10
|
const hooks_2 = require("../../metadata/hooks");
|
|
@@ -17,7 +18,7 @@ function useUtility() {
|
|
|
17
18
|
const openErrorDialog = (0, hooks_1.useOpenErrorDialog)();
|
|
18
19
|
const openPromptDialog = (0, hooks_1.useOpenPromptDialog)();
|
|
19
20
|
const openToastNotification = (0, useOpenToastNotification_1.useOpenToastNotification)();
|
|
20
|
-
return {
|
|
21
|
+
return (0, react_1.useMemo)(() => ({
|
|
21
22
|
hideProgressIndicator,
|
|
22
23
|
showProgressIndicator,
|
|
23
24
|
openAlertDialog,
|
|
@@ -25,13 +26,21 @@ function useUtility() {
|
|
|
25
26
|
openErrorDialog,
|
|
26
27
|
openPromptDialog,
|
|
27
28
|
showNotification: openToastNotification,
|
|
28
|
-
}
|
|
29
|
+
}), [
|
|
30
|
+
hideProgressIndicator,
|
|
31
|
+
openAlertDialog,
|
|
32
|
+
openConfirmDialog,
|
|
33
|
+
openErrorDialog,
|
|
34
|
+
openPromptDialog,
|
|
35
|
+
openToastNotification,
|
|
36
|
+
showProgressIndicator,
|
|
37
|
+
]);
|
|
29
38
|
}
|
|
30
39
|
function useNavigation() {
|
|
31
40
|
const openForm = (0, navigation_1.useOpenForm)();
|
|
32
|
-
return {
|
|
41
|
+
return (0, react_1.useMemo)(() => ({
|
|
33
42
|
openForm,
|
|
34
|
-
};
|
|
43
|
+
}), [openForm]);
|
|
35
44
|
}
|
|
36
45
|
function useBaseCommandHandlerContext() {
|
|
37
46
|
const dataService = (0, transport_1.useDataService)();
|
|
@@ -40,12 +49,12 @@ function useBaseCommandHandlerContext() {
|
|
|
40
49
|
const utility = useUtility();
|
|
41
50
|
const locale = (0, locale_1.useLocale)();
|
|
42
51
|
const navigation = useNavigation();
|
|
43
|
-
return {
|
|
52
|
+
return (0, react_1.useMemo)(() => ({
|
|
44
53
|
dataService,
|
|
45
54
|
queryClient,
|
|
46
55
|
utility,
|
|
47
56
|
stores,
|
|
48
57
|
locale,
|
|
49
58
|
navigation,
|
|
50
|
-
};
|
|
59
|
+
}), [dataService, queryClient, stores, utility, locale, navigation]);
|
|
51
60
|
}
|
|
@@ -11,6 +11,6 @@ function useCommands(commands, handlerContext, selector) {
|
|
|
11
11
|
const selectorRef = (0, react_1.useRef)(selector);
|
|
12
12
|
selectorRef.current = selector;
|
|
13
13
|
return (0, react_1.useMemo)(() => {
|
|
14
|
-
return (0, utils_1.transformCommadnGroups)(commands
|
|
14
|
+
return (0, utils_1.transformCommadnGroups)(commands ?? [], handlerContext, selectorRef.current);
|
|
15
15
|
}, [commands, handlerContext]);
|
|
16
16
|
}
|