@headless-adminapp/app 0.0.17-alpha.54 → 0.0.17-alpha.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/AppProvider.js +24 -32
- package/app/AuthWrapper.js +13 -9
- package/app/LayoutProvider.js +34 -39
- package/app/context.js +5 -2
- package/app/hooks/index.js +17 -1
- package/app/hooks/useAppContext.js +7 -4
- package/app/index.js +11 -4
- package/auth/AuthProvider.js +27 -36
- package/auth/context.d.ts +1 -1
- package/auth/context.js +5 -2
- package/auth/hooks/index.js +18 -2
- package/auth/hooks/useAuthSession.js +7 -4
- package/auth/hooks/useIsSkipAuthCheck.js +7 -4
- package/auth/hooks/useLogout.js +11 -8
- package/auth/index.js +23 -4
- package/auth/types.js +2 -1
- package/board/BoardColumnDataResolver.js +23 -20
- package/board/BoardColumnProvider.js +14 -10
- package/board/context.d.ts +2 -2
- package/board/context.js +6 -3
- package/board/hooks/index.js +15 -6
- package/board/hooks/useBoardColumnConfig.js +7 -4
- package/board/hooks/useBoardColumnData.d.ts +3 -1
- package/board/hooks/useBoardColumnData.js +7 -4
- package/board/hooks/useBoardColumnDataState.js +7 -4
- package/board/hooks/useBoardConfig.js +7 -4
- package/board/hooks/useBoardSchema.js +6 -3
- package/board/hooks/useSearchText.js +10 -7
- package/board/types.js +2 -1
- package/board/utils.js +4 -1
- package/builders/CommandBuilder/CommandBuilder.js +13 -10
- package/builders/CommandBuilder/DefaultCommandBuilder.js +30 -23
- package/builders/CommandBuilder/FormCommandBuilder.js +29 -38
- package/builders/CommandBuilder/SubgridCommandBuilder.js +27 -36
- package/builders/CommandBuilder/ViewCommandBuilder.js +29 -38
- package/builders/CommandBuilder/index.js +5 -1
- package/builders/CommandBuilder/utils.js +7 -3
- package/builders/SchemaExperienceBuilder.js +55 -31
- package/builders/index.js +7 -2
- package/builders/utils.js +59 -44
- package/command/hooks/index.js +18 -2
- package/command/hooks/useBaseCommandHandlerContext.js +29 -25
- package/command/hooks/useCommands.js +9 -6
- package/command/index.js +18 -2
- package/command/types.js +2 -1
- package/command/utils/index.js +41 -13
- package/components/ScrollView/index.js +11 -4
- package/components/ScrollbarWithMoreDataRequest/index.js +14 -11
- package/dataform/DataFormProvider/DataResolver.js +81 -89
- package/dataform/DataFormProvider/InitialValueResolver.js +22 -20
- package/dataform/DataFormProvider/ReadonlyInfoResolver.js +14 -12
- package/dataform/DataFormProvider/index.js +26 -32
- package/dataform/context.js +5 -2
- package/dataform/hooks/index.js +29 -13
- package/dataform/hooks/useFormInstance.js +6 -3
- package/dataform/hooks/useFormIsDirty.js +6 -3
- package/dataform/hooks/useFormIsReadonly.js +7 -4
- package/dataform/hooks/useFormNotifications.js +12 -9
- package/dataform/hooks/useFormRecord.js +7 -4
- package/dataform/hooks/useFormSave.js +40 -46
- package/dataform/hooks/useFormSchema.js +7 -4
- package/dataform/hooks/useLoadFormGridPage.js +19 -25
- package/dataform/hooks/useMainFormCommands.js +37 -30
- package/dataform/hooks/useProcessFlowSteps.js +27 -23
- package/dataform/hooks/useRecordId.js +7 -4
- package/dataform/hooks/useRecordTitle.js +12 -9
- package/dataform/hooks/useSelectedForm.js +7 -4
- package/dataform/index.js +23 -4
- package/dataform/utils/defaultParameters.js +16 -6
- package/dataform/utils/index.js +90 -56
- package/dataform/utils/saveRecord.js +99 -104
- package/datagrid/DataGridProvider/DataResolver.js +36 -34
- package/datagrid/DataGridProvider/index.js +31 -32
- package/datagrid/DataGridProvider/transformViewColumns.js +17 -6
- package/datagrid/DataGridProvider/utils.js +13 -5
- package/datagrid/column-filter/constants.js +5 -2
- package/datagrid/column-filter/index.js +7 -2
- package/datagrid/column-filter/types.js +2 -1
- package/datagrid/column-filter/utils.js +13 -3
- package/datagrid/context.d.ts +1 -1
- package/datagrid/context.js +5 -2
- package/datagrid/hooks/index.js +36 -20
- package/datagrid/hooks/useChangeView.js +10 -7
- package/datagrid/hooks/useGridColumnFilter.js +14 -8
- package/datagrid/hooks/useGridColumns.js +7 -4
- package/datagrid/hooks/useGridCommands.js +7 -4
- package/datagrid/hooks/useGridData.js +7 -4
- package/datagrid/hooks/useGridDataState.js +7 -4
- package/datagrid/hooks/useGridExtraFilter.js +7 -4
- package/datagrid/hooks/useGridOptions.js +4 -1
- package/datagrid/hooks/useGridPagination.js +4 -1
- package/datagrid/hooks/useGridRefresh.js +10 -7
- package/datagrid/hooks/useGridSchema.js +7 -4
- package/datagrid/hooks/useGridSelection.js +10 -7
- package/datagrid/hooks/useGridSorting.js +10 -7
- package/datagrid/hooks/useGridViewLookupData.js +7 -4
- package/datagrid/hooks/useLoadMainGridPage.js +12 -9
- package/datagrid/hooks/useMainGridCommands.js +62 -54
- package/datagrid/hooks/useMaxRecords.js +7 -4
- package/datagrid/hooks/useOpenRecord.js +20 -17
- package/datagrid/hooks/useSearchText.js +10 -7
- package/datagrid/hooks/useSelectedView.js +7 -4
- package/datagrid/hooks/useSubGridCommands.js +34 -23
- package/datagrid/index.js +27 -5
- package/defaults.js +5 -2
- package/dialog/DialogProvider.js +10 -6
- package/dialog/context.d.ts +1 -1
- package/dialog/context.js +5 -2
- package/dialog/hooks/index.js +24 -8
- package/dialog/hooks/useCloseDialog.js +10 -7
- package/dialog/hooks/useDialogItem.d.ts +1 -1
- package/dialog/hooks/useDialogItem.js +7 -4
- package/dialog/hooks/useDialogItems.d.ts +1 -1
- package/dialog/hooks/useDialogItems.js +7 -4
- package/dialog/hooks/useOpenAlertDialog.js +16 -8
- package/dialog/hooks/useOpenConfirmDialog.js +18 -9
- package/dialog/hooks/useOpenDialog.js +18 -11
- package/dialog/hooks/useOpenErrorDialog.js +16 -8
- package/dialog/hooks/useOpenPromptDialog.js +18 -9
- package/dialog/index.js +22 -3
- package/form/FormValidationStringContext.js +9 -5
- package/form/index.js +7 -1
- package/hooks/index.js +24 -6
- package/hooks/useDebouncedValue.js +11 -8
- package/hooks/useElementLayout.js +7 -4
- package/hooks/useIsMobile.js +12 -6
- package/hooks/useItemsWithKey.js +8 -5
- package/hooks/useStorageState.js +7 -5
- package/hooks/useSystemColorScheme.js +7 -4
- package/insights/InsightsProvider.js +13 -10
- package/insights/context.d.ts +1 -1
- package/insights/context.js +5 -2
- package/insights/hooks/index.js +7 -4
- package/insights/index.js +20 -2
- package/locale/LocaleProvider.js +12 -8
- package/locale/context.js +5 -2
- package/locale/index.js +23 -4
- package/locale/useCurrencySymbol.js +10 -8
- package/locale/useLocale.js +7 -4
- package/locale/utils.js +8 -3
- package/metadata/MetadataProvider.js +21 -17
- package/metadata/context.d.ts +1 -1
- package/metadata/context.js +5 -2
- package/metadata/hooks/index.js +24 -8
- package/metadata/hooks/useAppStore.js +7 -4
- package/metadata/hooks/useExperienceStore.js +7 -4
- package/metadata/hooks/useExperienceView.js +11 -17
- package/metadata/hooks/useExperienceViewCommands.js +14 -20
- package/metadata/hooks/useExperienceViewLookup.js +10 -16
- package/metadata/hooks/useExperienceViewSubgridCommands.js +14 -20
- package/metadata/hooks/useMetadata.js +11 -8
- package/metadata/hooks/useSchema.js +6 -3
- package/metadata/index.js +22 -3
- package/mutable/context.js +25 -17
- package/mutable/index.js +27 -3
- package/mutable/state.js +10 -6
- package/mutable/type.js +2 -1
- package/mutable/utils.js +12 -8
- package/navigation/hooks/index.js +17 -1
- package/navigation/hooks/useOpenForm.js +14 -11
- package/navigation/index.js +17 -1
- package/package.json +4 -12
- package/progress-indicator/ProgressIndicatorProvider.js +16 -12
- package/progress-indicator/context.js +5 -2
- package/progress-indicator/hooks/index.js +17 -1
- package/progress-indicator/hooks/useProgressIndicator.d.ts +1 -1
- package/progress-indicator/hooks/useProgressIndicator.js +7 -4
- package/progress-indicator/index.js +22 -3
- package/providers/PageEntityFormProvider/index.js +7 -4
- package/providers/PageEntityViewProvider/index.js +7 -4
- package/recordset/RecordSetProvider.js +16 -12
- package/recordset/context.d.ts +1 -1
- package/recordset/context.js +5 -2
- package/recordset/hooks/index.js +19 -3
- package/recordset/hooks/useRecordSetResult.js +22 -29
- package/recordset/hooks/useRecordSetSetter.js +9 -6
- package/recordset/hooks/useRecordSetVisibility.js +10 -7
- package/recordset/index.js +22 -3
- package/route/RouteProvider.js +18 -14
- package/route/context.js +9 -6
- package/route/hooks/index.js +22 -6
- package/route/hooks/useBasePath.js +7 -4
- package/route/hooks/useIsRouteActive.js +7 -4
- package/route/hooks/usePathname.js +7 -4
- package/route/hooks/useRouteResolver.js +7 -4
- package/route/hooks/useRouter.js +7 -4
- package/route/hooks/useSearchParams.js +7 -4
- package/route/index.js +20 -2
- package/route/types.js +2 -1
- package/store/ClientAppStore.js +12 -21
- package/store/ComponentStore.js +6 -4
- package/store/EventManager.js +20 -32
- package/store/SchemaExperienceStore.js +186 -217
- package/store/index.js +20 -4
- package/toast-notification/ToastNotificationProvider.js +10 -6
- package/toast-notification/context.d.ts +1 -1
- package/toast-notification/context.js +5 -2
- package/toast-notification/hooks/index.js +19 -3
- package/toast-notification/hooks/useCloseToastNotification.js +10 -7
- package/toast-notification/hooks/useOpenToastNotification.js +18 -11
- package/toast-notification/hooks/useToastNotificationItems.d.ts +1 -1
- package/toast-notification/hooks/useToastNotificationItems.js +7 -4
- package/toast-notification/index.js +22 -3
- package/transport/InMemoryDataService/index.js +59 -78
- package/transport/RestDataService/index.d.ts +2 -2
- package/transport/RestDataService/index.js +72 -91
- package/transport/context.js +9 -15
- package/transport/hooks/index.js +18 -2
- package/transport/hooks/useDataService.js +7 -4
- package/transport/hooks/useFileService.js +7 -4
- package/transport/hooks/useRetriveRecords.d.ts +1 -1
- package/transport/hooks/useRetriveRecords.js +25 -31
- package/transport/index.js +20 -2
- package/utils/calculateColumnWidths.js +5 -2
- package/utils/color.js +4 -1
- package/utils/getAttributeFormattedValue.js +38 -40
- package/utils/index.js +18 -2
- package/widget/context.js +5 -2
- package/widget/hooks/index.js +7 -4
- package/widget/index.js +5 -1
|
@@ -1,29 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useUtility = useUtility;
|
|
4
|
+
exports.useGridControlContext = useGridControlContext;
|
|
5
|
+
exports.useMainGridCommandHandlerContext = useMainGridCommandHandlerContext;
|
|
6
|
+
exports.useMainGridCommands = useMainGridCommands;
|
|
7
|
+
exports.useMainGridContextCommands = useMainGridContextCommands;
|
|
8
|
+
const app_1 = require("@headless-adminapp/app/app");
|
|
9
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const command_1 = require("../../command");
|
|
12
|
+
const hooks_1 = require("../../dialog/hooks");
|
|
13
|
+
const useProgressIndicator_1 = require("../../progress-indicator/hooks/useProgressIndicator");
|
|
14
|
+
const useOpenToastNotification_1 = require("../../toast-notification/hooks/useOpenToastNotification");
|
|
15
|
+
const context_1 = require("../context");
|
|
16
|
+
const useGridColumnFilter_1 = require("./useGridColumnFilter");
|
|
17
|
+
const useGridColumns_1 = require("./useGridColumns");
|
|
18
|
+
const useGridData_1 = require("./useGridData");
|
|
19
|
+
const useGridExtraFilter_1 = require("./useGridExtraFilter");
|
|
20
|
+
const useGridRefresh_1 = require("./useGridRefresh");
|
|
21
|
+
const useGridSchema_1 = require("./useGridSchema");
|
|
22
|
+
const useGridSelection_1 = require("./useGridSelection");
|
|
23
|
+
const useGridSorting_1 = require("./useGridSorting");
|
|
24
|
+
const useOpenRecord_1 = require("./useOpenRecord");
|
|
25
|
+
const useSearchText_1 = require("./useSearchText");
|
|
26
|
+
const useSelectedView_1 = require("./useSelectedView");
|
|
27
|
+
function useUtility() {
|
|
28
|
+
const { hideProgressIndicator, showProgressIndicator } = (0, useProgressIndicator_1.useProgressIndicator)();
|
|
29
|
+
const openAlertDialog = (0, hooks_1.useOpenAlertDialog)();
|
|
30
|
+
const openConfirmDialog = (0, hooks_1.useOpenConfirmDialog)();
|
|
31
|
+
const openErrorDialog = (0, hooks_1.useOpenErrorDialog)();
|
|
32
|
+
const openPromptDialog = (0, hooks_1.useOpenPromptDialog)();
|
|
33
|
+
const openToastNotification = (0, useOpenToastNotification_1.useOpenToastNotification)();
|
|
27
34
|
return {
|
|
28
35
|
hideProgressIndicator,
|
|
29
36
|
showProgressIndicator,
|
|
@@ -34,30 +41,29 @@ export function useUtility() {
|
|
|
34
41
|
showNotification: openToastNotification,
|
|
35
42
|
};
|
|
36
43
|
}
|
|
37
|
-
|
|
38
|
-
const data = useGridData();
|
|
39
|
-
const schema = useDataGridSchema();
|
|
40
|
-
const view = useSelectedView();
|
|
41
|
-
const [searchText] = useSearchText();
|
|
42
|
-
const [selectedIds] = useGridSelection();
|
|
43
|
-
const [columnFilter] = useGridColumnFilter();
|
|
44
|
-
const extraFilter = useGridExtraFilter();
|
|
45
|
-
const refresh = useGridRefresh();
|
|
46
|
-
const openRecord = useOpenRecord();
|
|
47
|
-
const gridColumns = useGridColumns();
|
|
48
|
-
const [sorting] = useGridSorting();
|
|
49
|
-
const selectedIdsObj = useMemo(() => {
|
|
44
|
+
function useGridControlContext() {
|
|
45
|
+
const data = (0, useGridData_1.useGridData)();
|
|
46
|
+
const schema = (0, useGridSchema_1.useDataGridSchema)();
|
|
47
|
+
const view = (0, useSelectedView_1.useSelectedView)();
|
|
48
|
+
const [searchText] = (0, useSearchText_1.useSearchText)();
|
|
49
|
+
const [selectedIds] = (0, useGridSelection_1.useGridSelection)();
|
|
50
|
+
const [columnFilter] = (0, useGridColumnFilter_1.useGridColumnFilter)();
|
|
51
|
+
const extraFilter = (0, useGridExtraFilter_1.useGridExtraFilter)();
|
|
52
|
+
const refresh = (0, useGridRefresh_1.useGridRefresh)();
|
|
53
|
+
const openRecord = (0, useOpenRecord_1.useOpenRecord)();
|
|
54
|
+
const gridColumns = (0, useGridColumns_1.useGridColumns)();
|
|
55
|
+
const [sorting] = (0, useGridSorting_1.useGridSorting)();
|
|
56
|
+
const selectedIdsObj = (0, react_1.useMemo)(() => {
|
|
50
57
|
const obj = {};
|
|
51
58
|
selectedIds.forEach((id) => {
|
|
52
59
|
obj[id] = true;
|
|
53
60
|
});
|
|
54
61
|
return obj;
|
|
55
62
|
}, [selectedIds]);
|
|
56
|
-
const selectedRecords = useMemo(() => {
|
|
57
|
-
|
|
58
|
-
return ((_a = data === null || data === void 0 ? void 0 : data.records) !== null && _a !== void 0 ? _a : []).filter((record) => selectedIdsObj[record[schema.idAttribute]]);
|
|
63
|
+
const selectedRecords = (0, react_1.useMemo)(() => {
|
|
64
|
+
return (data?.records ?? []).filter((record) => selectedIdsObj[record[schema.idAttribute]]);
|
|
59
65
|
}, [data, schema, selectedIdsObj]);
|
|
60
|
-
return useMemo(() => ({
|
|
66
|
+
return (0, react_1.useMemo)(() => ({
|
|
61
67
|
data,
|
|
62
68
|
logicalName: schema.logicalName,
|
|
63
69
|
schema,
|
|
@@ -87,25 +93,27 @@ export function useGridControlContext() {
|
|
|
87
93
|
view,
|
|
88
94
|
]);
|
|
89
95
|
}
|
|
90
|
-
|
|
91
|
-
const baseHandlerContext = useBaseCommandHandlerContext();
|
|
96
|
+
function useMainGridCommandHandlerContext() {
|
|
97
|
+
const baseHandlerContext = (0, command_1.useBaseCommandHandlerContext)();
|
|
92
98
|
const primaryControl = useGridControlContext();
|
|
93
|
-
return useMemo(() => (
|
|
99
|
+
return (0, react_1.useMemo)(() => ({
|
|
100
|
+
...baseHandlerContext,
|
|
101
|
+
primaryControl,
|
|
102
|
+
}), [baseHandlerContext, primaryControl]);
|
|
94
103
|
}
|
|
95
104
|
const emptyCommands = [];
|
|
96
105
|
function useGridCommands() {
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
return (_a = commands !== null && commands !== void 0 ? commands : defaultCommands) !== null && _a !== void 0 ? _a : emptyCommands;
|
|
106
|
+
const commands = (0, mutable_1.useContextSelector)(context_1.GridContext, (state) => state.commands);
|
|
107
|
+
const { app: { viewCommands: defaultCommands }, } = (0, app_1.useAppContext)();
|
|
108
|
+
return commands ?? defaultCommands ?? emptyCommands;
|
|
101
109
|
}
|
|
102
|
-
|
|
110
|
+
function useMainGridCommands() {
|
|
103
111
|
const commands = useGridCommands();
|
|
104
112
|
const handlerContext = useMainGridCommandHandlerContext();
|
|
105
|
-
return useCommands(commands, handlerContext);
|
|
113
|
+
return (0, command_1.useCommands)(commands, handlerContext);
|
|
106
114
|
}
|
|
107
|
-
|
|
115
|
+
function useMainGridContextCommands() {
|
|
108
116
|
const commands = useGridCommands();
|
|
109
117
|
const handlerContext = useMainGridCommandHandlerContext();
|
|
110
|
-
return useCommands(commands, handlerContext, (command) =>
|
|
118
|
+
return (0, command_1.useCommands)(commands, handlerContext, (command) => ('isContextMenu' in command && command.isContextMenu) ?? false);
|
|
111
119
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMaxRecords = useMaxRecords;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useMaxRecords() {
|
|
7
|
+
return (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.maxRecords);
|
|
5
8
|
}
|
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOpenRecord = useOpenRecord;
|
|
4
|
+
const recordset_1 = require("@headless-adminapp/app/recordset");
|
|
5
|
+
const route_1 = require("@headless-adminapp/app/route");
|
|
6
|
+
const app_1 = require("@headless-adminapp/core/experience/app");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const useGridData_1 = require("./useGridData");
|
|
9
|
+
const useGridSchema_1 = require("./useGridSchema");
|
|
10
|
+
function useOpenRecord() {
|
|
11
|
+
const data = (0, useGridData_1.useGridData)();
|
|
12
|
+
const schema = (0, useGridSchema_1.useDataGridSchema)();
|
|
13
|
+
const routeResolver = (0, route_1.useRouteResolver)();
|
|
14
|
+
const router = (0, route_1.useRouter)();
|
|
15
|
+
const recordSetSetter = (0, recordset_1.useRecordSetSetter)();
|
|
16
|
+
const dataRef = (0, react_1.useRef)(data);
|
|
14
17
|
dataRef.current = data;
|
|
15
|
-
return useCallback((id) => {
|
|
16
|
-
var _a, _b;
|
|
18
|
+
return (0, react_1.useCallback)((id) => {
|
|
17
19
|
const path = routeResolver({
|
|
18
20
|
logicalName: schema.logicalName,
|
|
19
|
-
type: PageType.EntityForm,
|
|
21
|
+
type: app_1.PageType.EntityForm,
|
|
20
22
|
id,
|
|
21
23
|
});
|
|
22
|
-
recordSetSetter(schema.logicalName,
|
|
24
|
+
recordSetSetter(schema.logicalName, dataRef.current?.records.map((x) => x[schema.idAttribute]) ??
|
|
25
|
+
[]);
|
|
23
26
|
router.push(path);
|
|
24
27
|
}, [
|
|
25
28
|
recordSetSetter,
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSearchText = useSearchText;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../../mutable/context");
|
|
6
|
+
const context_2 = require("../context");
|
|
7
|
+
function useSearchText() {
|
|
8
|
+
const searchText = (0, context_1.useContextSelector)(context_2.GridContext, (context) => context.searchText);
|
|
9
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.GridContext);
|
|
10
|
+
const setSearchText = (0, react_1.useCallback)((value) => {
|
|
8
11
|
setValue({ searchText: value });
|
|
9
12
|
}, [setValue]);
|
|
10
13
|
return [searchText, setSearchText];
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSelectedView = useSelectedView;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useSelectedView() {
|
|
7
|
+
return (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.view);
|
|
5
8
|
}
|
|
@@ -1,39 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSubGridCommandHandlerContext = useSubGridCommandHandlerContext;
|
|
4
|
+
exports.useSubGridCommands = useSubGridCommands;
|
|
5
|
+
exports.useSubGridContextCommands = useSubGridContextCommands;
|
|
6
|
+
const app_1 = require("@headless-adminapp/app/app");
|
|
7
|
+
const dataform_1 = require("@headless-adminapp/app/dataform");
|
|
8
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
9
|
+
const command_1 = require("../../command");
|
|
10
|
+
const useMainFormCommands_1 = require("../../dataform/hooks/useMainFormCommands");
|
|
11
|
+
const context_1 = require("../context");
|
|
12
|
+
const useMainGridCommands_1 = require("./useMainGridCommands");
|
|
13
|
+
function useSubGridCommandHandlerContext() {
|
|
14
|
+
const baseHandlerContext = (0, command_1.useBaseCommandHandlerContext)();
|
|
15
|
+
const mainFormHandlerContext = (0, useMainFormCommands_1.useMainFormCommandHandlerContext)();
|
|
16
|
+
const gridControl = (0, useMainGridCommands_1.useGridControlContext)();
|
|
17
|
+
const associated = (0, mutable_1.useContextSelector)(context_1.GridContext, (state) => state.associated);
|
|
18
|
+
const [recordTitle] = (0, dataform_1.useRecordTitle)();
|
|
19
|
+
return {
|
|
20
|
+
...baseHandlerContext,
|
|
21
|
+
primaryControl: mainFormHandlerContext.primaryControl,
|
|
22
|
+
secondaryControl: {
|
|
23
|
+
...gridControl,
|
|
24
|
+
associated: !associated
|
|
15
25
|
? false
|
|
16
26
|
: {
|
|
17
27
|
id: associated.id,
|
|
18
28
|
logicalName: associated.logicalName,
|
|
19
29
|
name: recordTitle,
|
|
20
30
|
refAttributeName: associated.refAttributeName,
|
|
21
|
-
}
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
22
34
|
}
|
|
23
35
|
const emptyCommands = [];
|
|
24
36
|
function useGridCommands() {
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
return (_a = commands !== null && commands !== void 0 ? commands : defaultCommands) !== null && _a !== void 0 ? _a : emptyCommands;
|
|
37
|
+
const commands = (0, mutable_1.useContextSelector)(context_1.GridContext, (state) => state.commands);
|
|
38
|
+
const { app: { subgridCommands: defaultCommands }, } = (0, app_1.useAppContext)();
|
|
39
|
+
return commands ?? defaultCommands ?? emptyCommands;
|
|
29
40
|
}
|
|
30
|
-
|
|
41
|
+
function useSubGridCommands() {
|
|
31
42
|
const commands = useGridCommands();
|
|
32
43
|
const handlerContext = useSubGridCommandHandlerContext();
|
|
33
|
-
return useCommands(commands, handlerContext);
|
|
44
|
+
return (0, command_1.useCommands)(commands, handlerContext);
|
|
34
45
|
}
|
|
35
|
-
|
|
46
|
+
function useSubGridContextCommands() {
|
|
36
47
|
const commands = useGridCommands();
|
|
37
48
|
const handlerContext = useSubGridCommandHandlerContext();
|
|
38
|
-
return useCommands(commands, handlerContext, (command) =>
|
|
49
|
+
return (0, command_1.useCommands)(commands, handlerContext, (command) => ('isContextMenu' in command && command.isContextMenu) ?? false);
|
|
39
50
|
}
|
package/datagrid/index.js
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.transformViewColumns = exports.DataGridProvider = exports.getLocalizedOperatorOptions = exports.defaultOperatorStrings = exports.GridContext = void 0;
|
|
18
|
+
var context_1 = require("./context");
|
|
19
|
+
Object.defineProperty(exports, "GridContext", { enumerable: true, get: function () { return context_1.GridContext; } });
|
|
20
|
+
__exportStar(require("./hooks"), exports);
|
|
21
|
+
var column_filter_1 = require("./column-filter");
|
|
22
|
+
Object.defineProperty(exports, "defaultOperatorStrings", { enumerable: true, get: function () { return column_filter_1.defaultOperatorStrings; } });
|
|
23
|
+
Object.defineProperty(exports, "getLocalizedOperatorOptions", { enumerable: true, get: function () { return column_filter_1.getLocalizedOperatorOptions; } });
|
|
24
|
+
var DataGridProvider_1 = require("./DataGridProvider");
|
|
25
|
+
Object.defineProperty(exports, "DataGridProvider", { enumerable: true, get: function () { return DataGridProvider_1.DataGridProvider; } });
|
|
26
|
+
var transformViewColumns_1 = require("./DataGridProvider/transformViewColumns");
|
|
27
|
+
Object.defineProperty(exports, "transformViewColumns", { enumerable: true, get: function () { return transformViewColumns_1.transformViewColumns; } });
|
package/defaults.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryClient = void 0;
|
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
+
exports.queryClient = new react_query_1.QueryClient();
|
package/dialog/DialogProvider.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DialogProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const context_1 = require("../mutable/context");
|
|
6
|
+
const context_2 = require("./context");
|
|
7
|
+
const DialogProvider = ({ children, }) => {
|
|
8
|
+
const contextState = (0, context_1.useCreateContextStore)({
|
|
6
9
|
items: [],
|
|
7
10
|
});
|
|
8
|
-
return (
|
|
11
|
+
return ((0, jsx_runtime_1.jsx)(context_2.DialogContext.Provider, { value: contextState, children: children }));
|
|
9
12
|
};
|
|
13
|
+
exports.DialogProvider = DialogProvider;
|
package/dialog/context.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export type DialogItemState = BasicDialogProps & DialogOptions;
|
|
|
3
3
|
export interface DialogContextState {
|
|
4
4
|
items: DialogItemState[];
|
|
5
5
|
}
|
|
6
|
-
export declare const DialogContext: import("react").Context<import("../mutable").ContextValue<DialogContextState>>;
|
|
6
|
+
export declare const DialogContext: import("react").Context<import("../mutable/context").ContextValue<DialogContextState>>;
|
package/dialog/context.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DialogContext = void 0;
|
|
4
|
+
const context_1 = require("../mutable/context");
|
|
5
|
+
exports.DialogContext = (0, context_1.createContext)();
|
package/dialog/hooks/index.js
CHANGED
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useCloseDialog"), exports);
|
|
18
|
+
__exportStar(require("./useDialogItem"), exports);
|
|
19
|
+
__exportStar(require("./useDialogItems"), exports);
|
|
20
|
+
__exportStar(require("./useOpenAlertDialog"), exports);
|
|
21
|
+
__exportStar(require("./useOpenConfirmDialog"), exports);
|
|
22
|
+
__exportStar(require("./useOpenDialog"), exports);
|
|
23
|
+
__exportStar(require("./useOpenErrorDialog"), exports);
|
|
24
|
+
__exportStar(require("./useOpenPromptDialog"), exports);
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCloseDialog = useCloseDialog;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../../mutable/context");
|
|
6
|
+
const context_2 = require("../context");
|
|
4
7
|
function markDialogAsClosed(items, id) {
|
|
5
8
|
return items.map((item) => {
|
|
6
9
|
if (item.id === id) {
|
|
7
|
-
return
|
|
10
|
+
return { ...item, isOpen: false };
|
|
8
11
|
}
|
|
9
12
|
return item;
|
|
10
13
|
});
|
|
@@ -12,9 +15,9 @@ function markDialogAsClosed(items, id) {
|
|
|
12
15
|
function excludeDialogItemById(items, id) {
|
|
13
16
|
return items.filter((item) => item.id !== id);
|
|
14
17
|
}
|
|
15
|
-
|
|
16
|
-
const setValue = useContextSetValue(DialogContext);
|
|
17
|
-
const closeDialog = useCallback((id) => {
|
|
18
|
+
function useCloseDialog() {
|
|
19
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.DialogContext);
|
|
20
|
+
const closeDialog = (0, react_1.useCallback)((id) => {
|
|
18
21
|
setValue((state) => ({
|
|
19
22
|
items: markDialogAsClosed(state.items, id),
|
|
20
23
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useDialogItem(id: string): import("
|
|
1
|
+
export declare function useDialogItem(id: string): import("../context").DialogItemState | undefined;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDialogItem = useDialogItem;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useDialogItem(id) {
|
|
7
|
+
return (0, context_1.useContextSelector)(context_2.DialogContext, (state) => state.items.find((item) => item.id === id));
|
|
5
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useDialogItems(): import("
|
|
1
|
+
export declare function useDialogItems(): import("../context").DialogItemState[];
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDialogItems = useDialogItems;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useDialogItems() {
|
|
7
|
+
return (0, context_1.useContextSelector)(context_2.DialogContext, (state) => state.items);
|
|
5
8
|
}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOpenAlertDialog = useOpenAlertDialog;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useOpenDialog_1 = require("./useOpenDialog");
|
|
6
|
+
function useOpenAlertDialog() {
|
|
7
|
+
const openDialog = (0, useOpenDialog_1.useOpenDialog)();
|
|
8
|
+
const openAlertDialog = (0, react_1.useCallback)((options) => {
|
|
6
9
|
return new Promise((resolve) => {
|
|
7
|
-
const { close } = openDialog(
|
|
10
|
+
const { close } = openDialog({
|
|
11
|
+
type: 'alert',
|
|
12
|
+
...options,
|
|
13
|
+
onDismiss: () => {
|
|
8
14
|
close();
|
|
9
15
|
resolve();
|
|
10
|
-
},
|
|
16
|
+
},
|
|
17
|
+
onConfirm: () => {
|
|
11
18
|
close();
|
|
12
19
|
resolve();
|
|
13
|
-
}
|
|
20
|
+
},
|
|
21
|
+
});
|
|
14
22
|
});
|
|
15
23
|
}, [openDialog]);
|
|
16
24
|
return openAlertDialog;
|
|
@@ -1,22 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOpenConfirmDialog = useOpenConfirmDialog;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const useOpenDialog_1 = require("./useOpenDialog");
|
|
6
|
+
function useOpenConfirmDialog() {
|
|
7
|
+
const openDialog = (0, useOpenDialog_1.useOpenDialog)();
|
|
8
|
+
const openConfirmDialog = (0, react_1.useCallback)((options) => {
|
|
6
9
|
return new Promise((resolve) => {
|
|
7
|
-
const { close } = openDialog(
|
|
10
|
+
const { close } = openDialog({
|
|
11
|
+
type: 'confirm',
|
|
12
|
+
...options,
|
|
13
|
+
onDismiss: () => {
|
|
8
14
|
if (!options.allowDismiss) {
|
|
9
15
|
return;
|
|
10
16
|
}
|
|
11
17
|
close();
|
|
12
18
|
resolve(null);
|
|
13
|
-
},
|
|
19
|
+
},
|
|
20
|
+
onConfirm: () => {
|
|
14
21
|
close();
|
|
15
22
|
resolve({ confirmed: true });
|
|
16
|
-
},
|
|
23
|
+
},
|
|
24
|
+
onCancel: () => {
|
|
17
25
|
close();
|
|
18
26
|
resolve({ confirmed: false });
|
|
19
|
-
}
|
|
27
|
+
},
|
|
28
|
+
});
|
|
20
29
|
});
|
|
21
30
|
}, [openDialog]);
|
|
22
31
|
return openConfirmDialog;
|