@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,22 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataGridProvider = DataGridProvider;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useLocale_1 = require("../../locale/useLocale");
|
|
7
|
+
const useMetadata_1 = require("../../metadata/hooks/useMetadata");
|
|
8
|
+
const context_1 = require("../../mutable/context");
|
|
9
|
+
const context_2 = require("../context");
|
|
10
|
+
const DataResolver_1 = require("./DataResolver");
|
|
11
|
+
const transformViewColumns_1 = require("./transformViewColumns");
|
|
12
|
+
function DataGridProvider(props) {
|
|
13
|
+
const onChangeViewRef = (0, react_1.useRef)(props.onChangeView);
|
|
12
14
|
onChangeViewRef.current = props.onChangeView;
|
|
13
|
-
const { schemaStore } = useMetadata();
|
|
14
|
-
const { language } = useLocale();
|
|
15
|
-
const handleViewChange = useCallback((viewId) => {
|
|
16
|
-
|
|
17
|
-
(_a = onChangeViewRef.current) === null || _a === void 0 ? void 0 : _a.call(onChangeViewRef, viewId);
|
|
15
|
+
const { schemaStore } = (0, useMetadata_1.useMetadata)();
|
|
16
|
+
const { language } = (0, useLocale_1.useLocale)();
|
|
17
|
+
const handleViewChange = (0, react_1.useCallback)((viewId) => {
|
|
18
|
+
onChangeViewRef.current?.(viewId);
|
|
18
19
|
}, []);
|
|
19
|
-
const contextValue = useCreateContextStore({
|
|
20
|
+
const contextValue = (0, context_1.useCreateContextStore)({
|
|
20
21
|
schema: props.schema,
|
|
21
22
|
columnFilters: {},
|
|
22
23
|
data: {
|
|
@@ -26,10 +27,10 @@ export function DataGridProvider(props) {
|
|
|
26
27
|
},
|
|
27
28
|
searchText: '',
|
|
28
29
|
selectedIds: [],
|
|
29
|
-
sorting:
|
|
30
|
+
sorting: props.view.experience.defaultSorting ?? [],
|
|
30
31
|
view: props.view,
|
|
31
32
|
commands: props.commands,
|
|
32
|
-
columns: transformViewColumns(props.view.logicalName, props.view.experience.grid.columns, schemaStore, language),
|
|
33
|
+
columns: (0, transformViewColumns_1.transformViewColumns)(props.view.logicalName, props.view.experience.grid.columns, schemaStore, language),
|
|
33
34
|
viewLookup: props.views,
|
|
34
35
|
extraFilter: props.extraFilter,
|
|
35
36
|
dataState: {
|
|
@@ -39,45 +40,43 @@ export function DataGridProvider(props) {
|
|
|
39
40
|
},
|
|
40
41
|
fetchNextPage: () => { },
|
|
41
42
|
onChangeView: handleViewChange,
|
|
42
|
-
isSubGrid:
|
|
43
|
-
allowViewSelection:
|
|
43
|
+
isSubGrid: props.isSubGrid ?? false,
|
|
44
|
+
allowViewSelection: props.allowViewSelection ?? false,
|
|
44
45
|
maxRecords: props.maxRecords,
|
|
45
46
|
associated: props.associated,
|
|
46
47
|
});
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
var _a;
|
|
48
|
+
(0, react_1.useEffect)(() => {
|
|
49
49
|
contextValue.setValue({
|
|
50
50
|
view: props.view,
|
|
51
51
|
searchText: '',
|
|
52
52
|
selectedIds: [],
|
|
53
|
-
sorting:
|
|
54
|
-
columns: transformViewColumns(props.view.logicalName, props.view.experience.grid.columns, schemaStore, language),
|
|
53
|
+
sorting: props.view.experience.defaultSorting ?? [],
|
|
54
|
+
columns: (0, transformViewColumns_1.transformViewColumns)(props.view.logicalName, props.view.experience.grid.columns, schemaStore, language),
|
|
55
55
|
maxRecords: props.maxRecords,
|
|
56
56
|
});
|
|
57
57
|
}, [props.view, props.maxRecords, contextValue, schemaStore, language]);
|
|
58
|
-
useEffect(() => {
|
|
58
|
+
(0, react_1.useEffect)(() => {
|
|
59
59
|
contextValue.setValue({
|
|
60
60
|
schema: props.schema,
|
|
61
61
|
searchText: '',
|
|
62
62
|
selectedIds: [],
|
|
63
63
|
});
|
|
64
64
|
}, [props.schema, contextValue]);
|
|
65
|
-
useEffect(() => {
|
|
65
|
+
(0, react_1.useEffect)(() => {
|
|
66
66
|
contextValue.setValue({
|
|
67
67
|
extraFilter: props.extraFilter,
|
|
68
68
|
});
|
|
69
69
|
}, [props.extraFilter, contextValue]);
|
|
70
|
-
useEffect(() => {
|
|
70
|
+
(0, react_1.useEffect)(() => {
|
|
71
71
|
contextValue.setValue({
|
|
72
72
|
commands: props.commands,
|
|
73
73
|
});
|
|
74
74
|
}, [props.commands, contextValue]);
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
var _a;
|
|
75
|
+
(0, react_1.useEffect)(() => {
|
|
77
76
|
contextValue.setValue({
|
|
78
|
-
isSubGrid:
|
|
77
|
+
isSubGrid: props.isSubGrid ?? false,
|
|
79
78
|
associated: props.associated,
|
|
80
79
|
});
|
|
81
80
|
}, [props.isSubGrid, props.associated, contextValue]);
|
|
82
|
-
return (
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)(context_2.GridContext.Provider, { value: contextValue, children: [(0, jsx_runtime_1.jsx)(DataResolver_1.DataResolver, {}), props.children] }));
|
|
83
82
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformViewColumns = transformViewColumns;
|
|
4
|
+
const utils_1 = require("../../locale/utils");
|
|
5
|
+
function transformViewColumns(logicalName, columns, schemaStore, language) {
|
|
3
6
|
const schema = schemaStore.getSchema(logicalName);
|
|
4
7
|
return columns
|
|
5
8
|
.map(column => {
|
|
@@ -7,7 +10,7 @@ export function transformViewColumns(logicalName, columns, schemaStore, language
|
|
|
7
10
|
if (!attribute) {
|
|
8
11
|
return null;
|
|
9
12
|
}
|
|
10
|
-
const label = localizedLabel(language, attribute);
|
|
13
|
+
const label = (0, utils_1.localizedLabel)(language, attribute);
|
|
11
14
|
if (column.expandedKey) {
|
|
12
15
|
if (attribute.type !== 'lookup') {
|
|
13
16
|
return null;
|
|
@@ -17,10 +20,18 @@ export function transformViewColumns(logicalName, columns, schemaStore, language
|
|
|
17
20
|
if (!lookupAttribute) {
|
|
18
21
|
return null;
|
|
19
22
|
}
|
|
20
|
-
const lookupLabel = localizedLabel(language, lookupAttribute);
|
|
21
|
-
return
|
|
23
|
+
const lookupLabel = (0, utils_1.localizedLabel)(language, lookupAttribute);
|
|
24
|
+
return {
|
|
25
|
+
...column,
|
|
26
|
+
id: `${column.name}.${column.expandedKey}`,
|
|
27
|
+
label: `${lookupLabel} (${label})`,
|
|
28
|
+
};
|
|
22
29
|
}
|
|
23
|
-
return
|
|
30
|
+
return {
|
|
31
|
+
...column,
|
|
32
|
+
id: column.name,
|
|
33
|
+
label: label,
|
|
34
|
+
};
|
|
24
35
|
})
|
|
25
36
|
.filter(Boolean);
|
|
26
37
|
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transformColumnFilter = transformColumnFilter;
|
|
7
|
+
exports.mergeConditions = mergeConditions;
|
|
8
|
+
exports.collectExpandedKeys = collectExpandedKeys;
|
|
9
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
10
|
+
function transformColumnFilter(filter, schema, schemaStore) {
|
|
3
11
|
const transformedResult = Object.entries(filter).reduce((acc, [id, value]) => {
|
|
4
12
|
const [key, extendedKey] = id.split('.');
|
|
5
13
|
let attribute = schema.attributes[key];
|
|
@@ -38,7 +46,7 @@ export function transformColumnFilter(filter, schema, schemaStore) {
|
|
|
38
46
|
case 'on':
|
|
39
47
|
case 'on-or-after':
|
|
40
48
|
case 'on-or-before':
|
|
41
|
-
transformedValue =
|
|
49
|
+
transformedValue = (0, dayjs_1.default)(value.value[0]).format('YYYY-MM-DD');
|
|
42
50
|
break;
|
|
43
51
|
case 'in':
|
|
44
52
|
case 'not-in':
|
|
@@ -66,7 +74,7 @@ export function transformColumnFilter(filter, schema, schemaStore) {
|
|
|
66
74
|
}
|
|
67
75
|
return transformedResult;
|
|
68
76
|
}
|
|
69
|
-
|
|
77
|
+
function mergeConditions(schema, filter, extraFilter, columnFilters, schemaStore) {
|
|
70
78
|
const filters = [];
|
|
71
79
|
if (filter) {
|
|
72
80
|
filters.push(filter);
|
|
@@ -101,7 +109,7 @@ export function mergeConditions(schema, filter, extraFilter, columnFilters, sche
|
|
|
101
109
|
filters: filters,
|
|
102
110
|
};
|
|
103
111
|
}
|
|
104
|
-
|
|
112
|
+
function collectExpandedKeys(columns) {
|
|
105
113
|
return columns
|
|
106
114
|
.filter((x) => x.expandedKey)
|
|
107
115
|
.reduce((acc, x) => {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.operatorOptions = exports.defaultOperatorStrings = void 0;
|
|
4
|
+
exports.defaultOperatorStrings = {
|
|
2
5
|
equals: 'Equals',
|
|
3
6
|
doesNotEqual: 'Does not equal',
|
|
4
7
|
contains: 'Contains',
|
|
@@ -496,7 +499,7 @@ const mixedOperatorOptions = [
|
|
|
496
499
|
controls: [],
|
|
497
500
|
},
|
|
498
501
|
];
|
|
499
|
-
|
|
502
|
+
exports.operatorOptions = {
|
|
500
503
|
id: idOperatorOptions,
|
|
501
504
|
boolean: booleanOperatorOptions,
|
|
502
505
|
choice: choiceOperatorOptions,
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultOperatorStrings = exports.getLocalizedOperatorOptions = void 0;
|
|
4
|
+
var utils_1 = require("./utils");
|
|
5
|
+
Object.defineProperty(exports, "getLocalizedOperatorOptions", { enumerable: true, get: function () { return utils_1.getLocalizedOperatorOptions; } });
|
|
6
|
+
var constants_1 = require("./constants");
|
|
7
|
+
Object.defineProperty(exports, "defaultOperatorStrings", { enumerable: true, get: function () { return constants_1.defaultOperatorStrings; } });
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getLocalizedOperatorOptions = void 0;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const getLocalizedOperatorOptions = (strings) => {
|
|
6
|
+
return Object.entries(constants_1.operatorOptions).reduce((acc, [key, value]) => ({
|
|
7
|
+
...acc,
|
|
8
|
+
[key]: value.map((option) => ({
|
|
9
|
+
...option,
|
|
10
|
+
label: strings[option.labelKey],
|
|
11
|
+
})),
|
|
12
|
+
}), {});
|
|
4
13
|
};
|
|
14
|
+
exports.getLocalizedOperatorOptions = getLocalizedOperatorOptions;
|
package/datagrid/context.d.ts
CHANGED
|
@@ -33,4 +33,4 @@ export interface GridContextState<S extends SchemaAttributes = SchemaAttributes,
|
|
|
33
33
|
isSubGrid: boolean;
|
|
34
34
|
allowViewSelection: boolean;
|
|
35
35
|
}
|
|
36
|
-
export declare const GridContext: import("react").Context<import("../mutable").ContextValue<GridContextState<SchemaAttributes, EntityMainGridCommandContext>>>;
|
|
36
|
+
export declare const GridContext: import("react").Context<import("../mutable/context").ContextValue<GridContextState<SchemaAttributes, EntityMainGridCommandContext>>>;
|
package/datagrid/context.js
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GridContext = void 0;
|
|
4
|
+
const context_1 = require("../mutable/context");
|
|
5
|
+
exports.GridContext = (0, context_1.createContext)();
|
package/datagrid/hooks/index.js
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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("./useChangeView"), exports);
|
|
18
|
+
__exportStar(require("./useGridColumnFilter"), exports);
|
|
19
|
+
__exportStar(require("./useGridColumns"), exports);
|
|
20
|
+
__exportStar(require("./useGridCommands"), exports);
|
|
21
|
+
__exportStar(require("./useGridData"), exports);
|
|
22
|
+
__exportStar(require("./useGridDataState"), exports);
|
|
23
|
+
__exportStar(require("./useGridExtraFilter"), exports);
|
|
24
|
+
__exportStar(require("./useGridOptions"), exports);
|
|
25
|
+
__exportStar(require("./useGridPagination"), exports);
|
|
26
|
+
__exportStar(require("./useGridRefresh"), exports);
|
|
27
|
+
__exportStar(require("./useGridSchema"), exports);
|
|
28
|
+
__exportStar(require("./useGridSelection"), exports);
|
|
29
|
+
__exportStar(require("./useGridSorting"), exports);
|
|
30
|
+
__exportStar(require("./useGridViewLookupData"), exports);
|
|
31
|
+
__exportStar(require("./useMainGridCommands"), exports);
|
|
32
|
+
__exportStar(require("./useMaxRecords"), exports);
|
|
33
|
+
__exportStar(require("./useSearchText"), exports);
|
|
34
|
+
__exportStar(require("./useSelectedView"), exports);
|
|
35
|
+
__exportStar(require("./useSubGridCommands"), exports);
|
|
36
|
+
__exportStar(require("./useLoadMainGridPage"), exports);
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useChangeView = useChangeView;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../../mutable/context");
|
|
6
|
+
const context_2 = require("../context");
|
|
7
|
+
function useChangeView() {
|
|
8
|
+
const onChangeView = (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.onChangeView);
|
|
9
|
+
return (0, react_1.useCallback)((viewId) => {
|
|
10
|
+
onChangeView?.(viewId);
|
|
8
11
|
}, [onChangeView]);
|
|
9
12
|
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGridColumnFilter = useGridColumnFilter;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../../mutable/context");
|
|
6
|
+
const context_2 = require("../context");
|
|
7
|
+
function useGridColumnFilter() {
|
|
8
|
+
const columnFilters = (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.columnFilters);
|
|
9
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.GridContext);
|
|
10
|
+
const setColumnFilter = (0, react_1.useCallback)((columnName, value) => {
|
|
8
11
|
setValue((state) => ({
|
|
9
|
-
columnFilters:
|
|
12
|
+
columnFilters: {
|
|
13
|
+
...state.columnFilters,
|
|
14
|
+
[columnName]: value,
|
|
15
|
+
},
|
|
10
16
|
}));
|
|
11
17
|
}, [setValue]);
|
|
12
18
|
return [columnFilters, setColumnFilter];
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGridColumns = useGridColumns;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useGridColumns() {
|
|
7
|
+
return (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.columns);
|
|
5
8
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGridCommands = useGridCommands;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
3
6
|
/**
|
|
4
7
|
* @deprecated
|
|
5
8
|
*/
|
|
6
|
-
|
|
7
|
-
const commands = useContextSelector(GridContext, (state) => state.commands);
|
|
9
|
+
function useGridCommands() {
|
|
10
|
+
const commands = (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.commands);
|
|
8
11
|
return commands;
|
|
9
12
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGridData = useGridData;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useGridData() {
|
|
7
|
+
const data = (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.data);
|
|
5
8
|
return data;
|
|
6
9
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGridDataState = useGridDataState;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useGridDataState() {
|
|
7
|
+
const data = (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.dataState);
|
|
5
8
|
return data;
|
|
6
9
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGridExtraFilter = useGridExtraFilter;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useGridExtraFilter() {
|
|
7
|
+
return (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.extraFilter);
|
|
5
8
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGridRefresh = useGridRefresh;
|
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useGridSchema_1 = require("./useGridSchema");
|
|
7
|
+
function useGridRefresh() {
|
|
8
|
+
const queryClient = (0, react_query_1.useQueryClient)();
|
|
9
|
+
const schema = (0, useGridSchema_1.useDataGridSchema)();
|
|
10
|
+
const refresh = (0, react_1.useCallback)(() => {
|
|
8
11
|
queryClient
|
|
9
12
|
.resetQueries({
|
|
10
13
|
queryKey: ['data', 'retriveRecords', schema.logicalName],
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDataGridSchema = useDataGridSchema;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useDataGridSchema() {
|
|
7
|
+
return (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.schema);
|
|
5
8
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGridSelection = useGridSelection;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../../mutable/context");
|
|
6
|
+
const context_2 = require("../context");
|
|
7
|
+
function useGridSelection() {
|
|
8
|
+
const selecteIds = (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.selectedIds);
|
|
9
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.GridContext);
|
|
10
|
+
const setSelectedIds = (0, react_1.useCallback)((selectedIds) => {
|
|
8
11
|
if (typeof selectedIds === 'function') {
|
|
9
12
|
setValue((state) => ({
|
|
10
13
|
selectedIds: selectedIds(state.selectedIds),
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGridSorting = useGridSorting;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const context_1 = require("../../mutable/context");
|
|
6
|
+
const context_2 = require("../context");
|
|
7
|
+
function useGridSorting() {
|
|
8
|
+
const sorting = (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.sorting);
|
|
9
|
+
const setValue = (0, context_1.useContextSetValue)(context_2.GridContext);
|
|
10
|
+
const setSorting = (0, react_1.useCallback)((value) => {
|
|
8
11
|
setValue({ sorting: value });
|
|
9
12
|
}, [setValue]);
|
|
10
13
|
return [sorting, setSorting];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGridViewLookupData = useGridViewLookupData;
|
|
4
|
+
const context_1 = require("../../mutable/context");
|
|
5
|
+
const context_2 = require("../context");
|
|
6
|
+
function useGridViewLookupData() {
|
|
7
|
+
const viewLookup = (0, context_1.useContextSelector)(context_2.GridContext, (state) => state.viewLookup);
|
|
5
8
|
return viewLookup;
|
|
6
9
|
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useLoadMainGridPage = useLoadMainGridPage;
|
|
4
|
+
const useExperienceView_1 = require("../../metadata/hooks/useExperienceView");
|
|
5
|
+
const useExperienceViewCommands_1 = require("../../metadata/hooks/useExperienceViewCommands");
|
|
6
|
+
const useExperienceViewLookup_1 = require("../../metadata/hooks/useExperienceViewLookup");
|
|
7
|
+
const useSchema_1 = require("../../metadata/hooks/useSchema");
|
|
8
|
+
function useLoadMainGridPage(logicalName, viewId) {
|
|
9
|
+
const schema = (0, useSchema_1.useSchema)(logicalName);
|
|
10
|
+
const { viewLookup } = (0, useExperienceViewLookup_1.useExperienceViewLookup)(logicalName);
|
|
11
|
+
const { commands } = (0, useExperienceViewCommands_1.useExperienceViewCommands)(logicalName);
|
|
12
|
+
const { view, isLoadingView } = (0, useExperienceView_1.useExperienceView)(logicalName, viewId);
|
|
10
13
|
if (!schema) {
|
|
11
14
|
return {
|
|
12
15
|
loading: false,
|