@headless-adminapp/app 0.0.17-alpha.5 → 0.0.17-alpha.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/AppProvider.js +2 -1
- package/app/AuthWrapper.d.ts +1 -1
- package/app/AuthWrapper.js +4 -1
- package/app/LayoutProvider.d.ts +8 -7
- package/app/LayoutProvider.js +37 -2
- package/auth/AuthProvider.d.ts +1 -1
- package/auth/AuthProvider.js +23 -3
- package/auth/context.d.ts +1 -0
- package/auth/hooks/useIsSkipAuthCheck.d.ts +1 -0
- package/auth/hooks/useIsSkipAuthCheck.js +8 -0
- package/board/BoardColumnDataResolver.d.ts +1 -0
- package/board/BoardColumnDataResolver.js +64 -0
- package/board/BoardColumnProvider.d.ts +7 -0
- package/board/BoardColumnProvider.js +36 -0
- package/board/context.d.ts +19 -0
- package/board/context.js +6 -0
- package/board/hooks/index.d.ts +6 -0
- package/board/hooks/index.js +15 -0
- package/board/hooks/useBoardColumnConfig.d.ts +2 -0
- package/board/hooks/useBoardColumnConfig.js +8 -0
- package/board/hooks/useBoardColumnData.d.ts +1 -0
- package/board/hooks/useBoardColumnData.js +9 -0
- package/board/hooks/useBoardColumnDataState.d.ts +5 -0
- package/board/hooks/useBoardColumnDataState.js +9 -0
- package/board/hooks/useBoardConfig.d.ts +3 -0
- package/board/hooks/useBoardConfig.js +8 -0
- package/board/hooks/useBoardSchema.d.ts +2 -0
- package/board/hooks/useBoardSchema.js +7 -0
- package/board/hooks/useSearchText.d.ts +1 -0
- package/board/hooks/useSearchText.js +14 -0
- package/board/types.d.ts +47 -0
- package/board/utils.d.ts +3 -0
- package/board/utils.js +6 -0
- package/builders/CommandBuilder/CommandBuilder.d.ts +10 -0
- package/builders/CommandBuilder/CommandBuilder.js +14 -0
- package/builders/CommandBuilder/DefaultCommandBuilder.d.ts +88 -0
- package/builders/CommandBuilder/DefaultCommandBuilder.js +191 -0
- package/builders/CommandBuilder/FormCommandBuilder.d.ts +46 -0
- package/builders/CommandBuilder/FormCommandBuilder.js +171 -0
- package/builders/CommandBuilder/SubgridCommandBuilder.d.ts +45 -0
- package/builders/CommandBuilder/SubgridCommandBuilder.js +240 -0
- package/builders/CommandBuilder/ViewCommandBuilder.d.ts +63 -0
- package/builders/CommandBuilder/ViewCommandBuilder.js +242 -0
- package/builders/CommandBuilder/index.d.ts +1 -0
- package/builders/CommandBuilder/index.js +5 -0
- package/builders/CommandBuilder/utils.d.ts +3 -0
- package/builders/CommandBuilder/utils.js +21 -0
- package/builders/SchemaExperienceBuilder.d.ts +5 -8
- package/builders/SchemaExperienceBuilder.js +4 -4
- package/builders/index.d.ts +1 -1
- package/builders/index.js +1 -2
- package/builders/utils.d.ts +28 -0
- package/builders/utils.js +185 -0
- package/command/hooks/useBaseCommandHandlerContext.js +22 -4
- package/command/hooks/useCommands.d.ts +1 -1
- package/command/hooks/useCommands.js +1 -1
- package/components/ScrollbarWithMoreDataRequest/index.d.ts +9 -0
- package/components/ScrollbarWithMoreDataRequest/index.js +33 -0
- package/dataform/DataFormProvider/DataResolver.js +6 -6
- package/dataform/DataFormProvider/InitialValueResolver.js +4 -2
- package/dataform/DataFormProvider/index.js +3 -3
- package/dataform/hooks/index.d.ts +1 -0
- package/dataform/hooks/index.js +1 -0
- package/dataform/hooks/useFormSave.js +9 -2
- package/dataform/hooks/useLoadFormGridPage.js +8 -2
- package/dataform/hooks/useMainFormCommands.d.ts +1 -12
- package/dataform/hooks/useMainFormCommands.js +9 -1
- package/dataform/hooks/useProcessFlowSteps.d.ts +1 -0
- package/dataform/hooks/useProcessFlowSteps.js +44 -0
- package/dataform/hooks/useRecordTitle.d.ts +1 -1
- package/dataform/hooks/useRecordTitle.js +9 -2
- package/dataform/utils/defaultParameters.d.ts +3 -0
- package/dataform/utils/defaultParameters.js +37 -0
- package/dataform/utils/index.d.ts +3 -22
- package/dataform/utils/index.js +88 -134
- package/dataform/utils/saveRecord.d.ts +25 -0
- package/dataform/utils/saveRecord.js +167 -0
- package/datagrid/DataGridProvider/DataResolver.js +25 -149
- package/datagrid/DataGridProvider/index.d.ts +5 -0
- package/datagrid/DataGridProvider/index.js +8 -0
- package/datagrid/DataGridProvider/transformViewColumns.js +4 -4
- package/datagrid/DataGridProvider/utils.d.ts +7 -2
- package/datagrid/DataGridProvider/utils.js +52 -2
- package/datagrid/column-filter/constants.js +38 -3
- package/datagrid/context.d.ts +9 -6
- package/datagrid/hooks/useGridCommands.d.ts +3 -0
- package/datagrid/hooks/useGridCommands.js +3 -0
- package/datagrid/hooks/useLoadMainGridPage.js +1 -1
- package/datagrid/hooks/useMainGridCommands.d.ts +1 -13
- package/datagrid/hooks/useMainGridCommands.js +38 -26
- package/datagrid/hooks/useOpenRecord.d.ts +1 -0
- package/datagrid/hooks/useOpenRecord.js +34 -0
- package/datagrid/hooks/useSubGridCommands.js +25 -65
- package/defaults.d.ts +2 -0
- package/defaults.js +5 -0
- package/dialog/hooks/useCloseDialog.js +17 -15
- package/form/FormValidationStringContext.d.ts +1 -0
- package/form/FormValidationStringContext.js +1 -0
- package/hooks/useDebouncedValue.js +0 -1
- package/hooks/useElementLayout.js +1 -1
- package/hooks/useIsMobile.js +0 -1
- package/hooks/useSystemColorScheme.d.ts +1 -1
- package/hooks/useSystemColorScheme.js +0 -1
- package/insights/InsightsProvider.d.ts +8 -0
- package/insights/InsightsProvider.js +27 -0
- package/locale/LocaleProvider.d.ts +2 -1
- package/locale/LocaleProvider.js +3 -3
- package/locale/index.d.ts +1 -0
- package/locale/index.js +1 -0
- package/locale/useCurrencySymbol.d.ts +1 -0
- package/locale/useCurrencySymbol.js +13 -0
- package/locale/utils.d.ts +5 -0
- package/locale/utils.js +7 -0
- package/metadata/MetadataProvider.d.ts +8 -4
- package/metadata/MetadataProvider.js +23 -16
- package/metadata/hooks/useExperienceViewCommands.js +7 -1
- package/metadata/hooks/useExperienceViewSubgridCommands.js +7 -1
- package/metadata/hooks/useMetadata.d.ts +2 -4
- package/metadata/hooks/useMetadata.js +2 -6
- package/metadata/hooks/useSchema.d.ts +1 -1
- package/metadata/hooks/useSchema.js +5 -2
- package/mutable/context.js +1 -1
- package/navigation/hooks/index.d.ts +1 -0
- package/{appearance → navigation}/hooks/index.js +1 -1
- package/navigation/hooks/useOpenForm.d.ts +2 -4
- package/navigation/hooks/useOpenForm.js +11 -3
- package/navigation/index.d.ts +1 -0
- package/{appearance → navigation}/index.js +0 -3
- package/package.json +5 -2
- package/recordset/RecordSetProvider.js +1 -1
- package/recordset/hooks/useRecordSetResult.js +1 -1
- package/route/RouteProvider.d.ts +2 -2
- package/route/RouteProvider.js +4 -1
- package/store/ComponentStore.d.ts +1 -1
- package/store/ComponentStore.js +5 -9
- package/store/SchemaExperienceStore.d.ts +3 -3
- package/toast-notification/hooks/useCloseToastNotification.js +17 -15
- package/transport/RestDataService/index.d.ts +1 -1
- package/transport/RestDataService/index.js +17 -16
- package/transport/context.d.ts +3 -1
- package/transport/context.js +16 -1
- package/transport/hooks/index.d.ts +1 -0
- package/transport/hooks/index.js +1 -0
- package/transport/hooks/useFileService.d.ts +1 -0
- package/transport/hooks/useFileService.js +12 -0
- package/transport/hooks/useRetriveRecords.d.ts +32 -0
- package/transport/hooks/useRetriveRecords.js +120 -0
- package/utils/color.d.ts +1 -0
- package/utils/color.js +14 -0
- package/utils/getAttributeFormattedValue.d.ts +3 -1
- package/utils/getAttributeFormattedValue.js +108 -54
- package/appearance/context.d.ts +0 -7
- package/appearance/context.js +0 -5
- package/appearance/hooks/index.d.ts +0 -1
- package/appearance/hooks/useAppearanceContext.d.ts +0 -1
- package/appearance/hooks/useAppearanceContext.js +0 -12
- package/appearance/index.d.ts +0 -2
- package/builders/CommandBuilder.d.ts +0 -176
- package/builders/CommandBuilder.js +0 -474
- package/locale/types.d.ts +0 -2
- /package/{locale → board}/types.js +0 -0
|
@@ -3,82 +3,42 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useSubGridCommandHandlerContext = useSubGridCommandHandlerContext;
|
|
4
4
|
exports.useSubGridCommands = useSubGridCommands;
|
|
5
5
|
exports.useSubGridContextCommands = useSubGridContextCommands;
|
|
6
|
-
const
|
|
7
|
-
const
|
|
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");
|
|
8
9
|
const command_1 = require("../../command");
|
|
9
10
|
const useMainFormCommands_1 = require("../../dataform/hooks/useMainFormCommands");
|
|
10
|
-
const
|
|
11
|
-
const useMetadata_1 = require("../../metadata/hooks/useMetadata");
|
|
12
|
-
const transport_1 = require("../../transport");
|
|
13
|
-
const useGridColumnFilter_1 = require("./useGridColumnFilter");
|
|
14
|
-
const useGridCommands_1 = require("./useGridCommands");
|
|
15
|
-
const useGridData_1 = require("./useGridData");
|
|
16
|
-
const useGridExtraFilter_1 = require("./useGridExtraFilter");
|
|
17
|
-
const useGridRefresh_1 = require("./useGridRefresh");
|
|
18
|
-
const useGridSchema_1 = require("./useGridSchema");
|
|
19
|
-
const useGridSelection_1 = require("./useGridSelection");
|
|
11
|
+
const context_1 = require("../context");
|
|
20
12
|
const useMainGridCommands_1 = require("./useMainGridCommands");
|
|
21
|
-
const useSearchText_1 = require("./useSearchText");
|
|
22
|
-
const useSelectedView_1 = require("./useSelectedView");
|
|
23
13
|
function useSubGridCommandHandlerContext() {
|
|
24
|
-
const
|
|
25
|
-
const queryClient = (0, react_query_1.useQueryClient)();
|
|
26
|
-
const { appStore, experienceStore, schemaStore } = (0, useMetadata_1.useMetadata)();
|
|
27
|
-
const data = (0, useGridData_1.useGridData)();
|
|
28
|
-
const schema = (0, useGridSchema_1.useDataGridSchema)();
|
|
29
|
-
const view = (0, useSelectedView_1.useSelectedView)();
|
|
30
|
-
const [searchText] = (0, useSearchText_1.useSearchText)();
|
|
31
|
-
const [selectedIds] = (0, useGridSelection_1.useGridSelection)();
|
|
32
|
-
const selectedIdsObj = (0, react_1.useMemo)(() => {
|
|
33
|
-
const obj = {};
|
|
34
|
-
selectedIds.forEach((id) => {
|
|
35
|
-
obj[id] = true;
|
|
36
|
-
});
|
|
37
|
-
return obj;
|
|
38
|
-
}, [selectedIds]);
|
|
39
|
-
const selectedRecords = (0, react_1.useMemo)(() => {
|
|
40
|
-
var _a;
|
|
41
|
-
return ((_a = data === null || data === void 0 ? void 0 : data.records) !== null && _a !== void 0 ? _a : []).filter((record) => selectedIdsObj[record[schema.idAttribute]]);
|
|
42
|
-
}, [data, schema, selectedIdsObj]);
|
|
43
|
-
const [columnFilter] = (0, useGridColumnFilter_1.useGridColumnFilter)();
|
|
44
|
-
const extraFilter = (0, useGridExtraFilter_1.useGridExtraFilter)();
|
|
45
|
-
const refresh = (0, useGridRefresh_1.useGridRefresh)();
|
|
46
|
-
const utility = (0, useMainGridCommands_1.useUtility)();
|
|
47
|
-
const locale = (0, useLocale_1.useLocale)();
|
|
14
|
+
const baseHandlerContext = (0, command_1.useBaseCommandHandlerContext)();
|
|
48
15
|
const mainFormHandlerContext = (0, useMainFormCommands_1.useMainFormCommandHandlerContext)();
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
stores: {
|
|
68
|
-
appStore,
|
|
69
|
-
experienceStore,
|
|
70
|
-
schemaStore,
|
|
71
|
-
},
|
|
72
|
-
locale,
|
|
73
|
-
};
|
|
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 Object.assign(Object.assign({}, baseHandlerContext), { primaryControl: mainFormHandlerContext.primaryControl, secondaryControl: Object.assign(Object.assign({}, gridControl), { associated: !associated
|
|
20
|
+
? false
|
|
21
|
+
: {
|
|
22
|
+
id: associated.id,
|
|
23
|
+
logicalName: associated.logicalName,
|
|
24
|
+
name: recordTitle,
|
|
25
|
+
refAttributeName: associated.refAttributeName,
|
|
26
|
+
} }) });
|
|
27
|
+
}
|
|
28
|
+
const emptyCommands = [];
|
|
29
|
+
function useGridCommands() {
|
|
30
|
+
var _a;
|
|
31
|
+
const commands = (0, mutable_1.useContextSelector)(context_1.GridContext, (state) => state.commands);
|
|
32
|
+
const { app: { subgridCommands: defaultCommands }, } = (0, app_1.useAppContext)();
|
|
33
|
+
return (_a = commands !== null && commands !== void 0 ? commands : defaultCommands) !== null && _a !== void 0 ? _a : emptyCommands;
|
|
74
34
|
}
|
|
75
35
|
function useSubGridCommands() {
|
|
76
|
-
const commands =
|
|
36
|
+
const commands = useGridCommands();
|
|
77
37
|
const handlerContext = useSubGridCommandHandlerContext();
|
|
78
38
|
return (0, command_1.useCommands)(commands, handlerContext);
|
|
79
39
|
}
|
|
80
40
|
function useSubGridContextCommands() {
|
|
81
|
-
const commands =
|
|
41
|
+
const commands = useGridCommands();
|
|
82
42
|
const handlerContext = useSubGridCommandHandlerContext();
|
|
83
43
|
return (0, command_1.useCommands)(commands, handlerContext, (command) => { var _a; return (_a = ('isContextMenu' in command && command.isContextMenu)) !== null && _a !== void 0 ? _a : false; });
|
|
84
44
|
}
|
package/defaults.d.ts
ADDED
package/defaults.js
ADDED
|
@@ -4,26 +4,28 @@ exports.useCloseDialog = useCloseDialog;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const context_1 = require("../../mutable/context");
|
|
6
6
|
const context_2 = require("../context");
|
|
7
|
+
function markDialogAsClosed(items, id) {
|
|
8
|
+
return items.map((item) => {
|
|
9
|
+
if (item.id === id) {
|
|
10
|
+
return Object.assign(Object.assign({}, item), { isOpen: false });
|
|
11
|
+
}
|
|
12
|
+
return item;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function excludeDialogItemById(items, id) {
|
|
16
|
+
return items.filter((item) => item.id !== id);
|
|
17
|
+
}
|
|
7
18
|
function useCloseDialog() {
|
|
8
19
|
const setValue = (0, context_1.useContextSetValue)(context_2.DialogContext);
|
|
9
20
|
const closeDialog = (0, react_1.useCallback)((id) => {
|
|
10
|
-
setValue((state) => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (item.id === id) {
|
|
14
|
-
return Object.assign(Object.assign({}, item), { isOpen: false });
|
|
15
|
-
}
|
|
16
|
-
return item;
|
|
17
|
-
}),
|
|
18
|
-
};
|
|
19
|
-
});
|
|
21
|
+
setValue((state) => ({
|
|
22
|
+
items: markDialogAsClosed(state.items, id),
|
|
23
|
+
}));
|
|
20
24
|
// Simulate a delay to show the dialog closing animation
|
|
21
25
|
setTimeout(() => {
|
|
22
|
-
setValue((state) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
});
|
|
26
|
+
setValue((state) => ({
|
|
27
|
+
items: excludeDialogItemById(state.items, id),
|
|
28
|
+
}));
|
|
27
29
|
}, 1000);
|
|
28
30
|
}, [setValue]);
|
|
29
31
|
return closeDialog;
|
|
@@ -6,6 +6,7 @@ export interface FormValidationStringSet {
|
|
|
6
6
|
invalidEmail: string;
|
|
7
7
|
invalidPhoneNumber: string;
|
|
8
8
|
atLeastOneRowRequired: string;
|
|
9
|
+
fileSizeExceeded: string;
|
|
9
10
|
}
|
|
10
11
|
export declare const defaultFormValidationStrings: FormValidationStringSet;
|
|
11
12
|
export declare const FormValidationStringContext: import("react").Context<FormValidationStringSet>;
|
|
@@ -11,6 +11,7 @@ exports.defaultFormValidationStrings = {
|
|
|
11
11
|
invalidEmail: 'Invalid email.',
|
|
12
12
|
invalidPhoneNumber: 'Invalid phone number.',
|
|
13
13
|
atLeastOneRowRequired: 'At least one row required.',
|
|
14
|
+
fileSizeExceeded: 'File size exceeded.',
|
|
14
15
|
};
|
|
15
16
|
exports.FormValidationStringContext = (0, react_1.createContext)(exports.defaultFormValidationStrings);
|
|
16
17
|
function useFormValidationStrings() {
|
|
@@ -4,7 +4,7 @@ exports.useElementSize = useElementSize;
|
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
function useElementSize(elementRef, interval) {
|
|
6
6
|
const [size, setSize] = (0, react_1.useState)({ width: 0, height: 0 });
|
|
7
|
-
(0, react_1.
|
|
7
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
8
8
|
function updateSize() {
|
|
9
9
|
if (elementRef.current) {
|
|
10
10
|
const element = elementRef.current;
|
package/hooks/useIsMobile.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useSystemColorScheme(): "
|
|
1
|
+
export declare function useSystemColorScheme(): "dark" | "light";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { InsightExpereince, InsightLookup } from '@headless-adminapp/core/experience/insights';
|
|
2
|
+
import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
3
|
+
import { PropsWithChildren } from 'react';
|
|
4
|
+
export declare function InsightsProvider<SA extends SchemaAttributes = SchemaAttributes>({ children, experience, insightLookup, onInsightSelect, }: PropsWithChildren<{
|
|
5
|
+
experience: InsightExpereince<SA>;
|
|
6
|
+
insightLookup: InsightLookup[];
|
|
7
|
+
onInsightSelect: (id: string) => void;
|
|
8
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InsightsProvider = InsightsProvider;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const mutable_1 = require("../mutable");
|
|
7
|
+
const context_1 = require("./context");
|
|
8
|
+
function InsightsProvider({ children, experience, insightLookup, onInsightSelect, }) {
|
|
9
|
+
const onInsightSelectRef = (0, react_1.useRef)(onInsightSelect);
|
|
10
|
+
onInsightSelectRef.current = onInsightSelect;
|
|
11
|
+
const onInsightSelectInternal = (0, react_1.useCallback)((id) => {
|
|
12
|
+
onInsightSelectRef.current(id);
|
|
13
|
+
}, [onInsightSelectRef]);
|
|
14
|
+
const insightsValues = (0, mutable_1.useCreateContextStore)({
|
|
15
|
+
experience,
|
|
16
|
+
data: experience.defaultData,
|
|
17
|
+
insightLookup: insightLookup,
|
|
18
|
+
onInsightSelect: onInsightSelectInternal,
|
|
19
|
+
});
|
|
20
|
+
(0, react_1.useEffect)(() => {
|
|
21
|
+
insightsValues.setValue({
|
|
22
|
+
experience,
|
|
23
|
+
data: experience.defaultData,
|
|
24
|
+
});
|
|
25
|
+
}, [experience, insightsValues]);
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(context_1.InsightsContext.Provider, { value: insightsValues, children: children }));
|
|
27
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Locale } from '@headless-adminapp/core/experience/locale';
|
|
2
2
|
import { FC, PropsWithChildren } from 'react';
|
|
3
3
|
export interface LocaleProviderProps {
|
|
4
|
-
locale
|
|
4
|
+
locale?: string;
|
|
5
|
+
timezone?: string;
|
|
5
6
|
options?: {
|
|
6
7
|
direction?: Locale['direction'];
|
|
7
8
|
dateFormats?: Locale['dateFormats'];
|
package/locale/LocaleProvider.js
CHANGED
|
@@ -5,10 +5,10 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const locale_1 = require("@headless-adminapp/core/experience/locale");
|
|
6
6
|
const react_1 = require("react");
|
|
7
7
|
const context_1 = require("./context");
|
|
8
|
-
const LocaleProvider = ({ children, locale, options, }) => {
|
|
8
|
+
const LocaleProvider = ({ children, locale = 'en-US', timezone = 'UTC', options, }) => {
|
|
9
9
|
const localeState = (0, react_1.useMemo)(() => {
|
|
10
|
-
return (0, locale_1.getLocale)(locale, options);
|
|
11
|
-
}, [locale]);
|
|
10
|
+
return (0, locale_1.getLocale)(locale, timezone, options);
|
|
11
|
+
}, [locale, timezone, options]);
|
|
12
12
|
return ((0, jsx_runtime_1.jsx)(context_1.LocaleContext.Provider, { value: localeState, children: children }));
|
|
13
13
|
};
|
|
14
14
|
exports.LocaleProvider = LocaleProvider;
|
package/locale/index.d.ts
CHANGED
package/locale/index.js
CHANGED
|
@@ -18,5 +18,6 @@ exports.LocaleProvider = exports.LocaleContext = void 0;
|
|
|
18
18
|
var context_1 = require("./context");
|
|
19
19
|
Object.defineProperty(exports, "LocaleContext", { enumerable: true, get: function () { return context_1.LocaleContext; } });
|
|
20
20
|
__exportStar(require("./useLocale"), exports);
|
|
21
|
+
__exportStar(require("./useCurrencySymbol"), exports);
|
|
21
22
|
var LocaleProvider_1 = require("./LocaleProvider");
|
|
22
23
|
Object.defineProperty(exports, "LocaleProvider", { enumerable: true, get: function () { return LocaleProvider_1.LocaleProvider; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useCurrencySymbol(): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCurrencySymbol = useCurrencySymbol;
|
|
4
|
+
const utils_1 = require("@headless-adminapp/core/experience/locale/utils");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const useLocale_1 = require("./useLocale");
|
|
7
|
+
function useCurrencySymbol() {
|
|
8
|
+
const locale = (0, useLocale_1.useLocale)();
|
|
9
|
+
return (0, react_1.useMemo)(() => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (0, utils_1.getCurrencySymbol)(locale.locale, (_a = locale.currency.currency) !== null && _a !== void 0 ? _a : 'USD');
|
|
12
|
+
}, [locale]);
|
|
13
|
+
}
|
package/locale/utils.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.localizedLabel = localizedLabel;
|
|
4
|
+
function localizedLabel(language, value, fallback) {
|
|
5
|
+
var _a, _b, _c, _d, _e;
|
|
6
|
+
return ((_e = (_d = (_b = (_a = value.localizedLabels) === null || _a === void 0 ? void 0 : _a[language]) !== null && _b !== void 0 ? _b : (_c = fallback === null || fallback === void 0 ? void 0 : fallback.localizedLabels) === null || _c === void 0 ? void 0 : _c[language]) !== null && _d !== void 0 ? _d : value.label) !== null && _e !== void 0 ? _e : fallback === null || fallback === void 0 ? void 0 : fallback.label);
|
|
7
|
+
}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { IClientAppStore, ISchemaExperienceStore, ISchemaStore } from '@headless-adminapp/core/store';
|
|
1
|
+
import { IClientAppStore, ISchemaExperienceStore, ISchemaStore, SchemaStore } from '@headless-adminapp/core/store';
|
|
2
2
|
import { FC, PropsWithChildren } from 'react';
|
|
3
|
+
import { ClientAppStore, SchemaExperienceStore } from '../store';
|
|
3
4
|
export interface MetadataProviderProps {
|
|
4
|
-
schemaStore
|
|
5
|
-
experienceStore
|
|
6
|
-
appStore
|
|
5
|
+
schemaStore?: ISchemaStore;
|
|
6
|
+
experienceStore?: ISchemaExperienceStore;
|
|
7
|
+
appStore?: IClientAppStore;
|
|
7
8
|
}
|
|
9
|
+
export declare const defaultAppStore: ClientAppStore;
|
|
10
|
+
export declare const defaultSchemaStore: SchemaStore<import("@headless-adminapp/core/schema").SchemaAttributes>;
|
|
11
|
+
export declare const defaultExperienceStore: SchemaExperienceStore;
|
|
8
12
|
export declare const MetadataProvider: FC<PropsWithChildren<MetadataProviderProps>>;
|
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MetadataProvider = void 0;
|
|
3
|
+
exports.MetadataProvider = exports.defaultExperienceStore = exports.defaultSchemaStore = exports.defaultAppStore = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const app_1 = require("@headless-adminapp/core/experience/app");
|
|
6
|
+
const store_1 = require("@headless-adminapp/core/store");
|
|
7
|
+
const icons_1 = require("@headless-adminapp/icons");
|
|
5
8
|
const context_1 = require("../mutable/context");
|
|
9
|
+
const store_2 = require("../store");
|
|
6
10
|
const context_2 = require("./context");
|
|
7
|
-
|
|
11
|
+
exports.defaultAppStore = new store_2.ClientAppStore();
|
|
12
|
+
exports.defaultSchemaStore = new store_1.SchemaStore();
|
|
13
|
+
exports.defaultExperienceStore = new store_2.SchemaExperienceStore({
|
|
14
|
+
schemaStore: exports.defaultSchemaStore,
|
|
15
|
+
});
|
|
16
|
+
exports.defaultAppStore.register({
|
|
17
|
+
id: 'default',
|
|
18
|
+
title: 'Demo App',
|
|
19
|
+
navItems: [],
|
|
20
|
+
defaultPage: {
|
|
21
|
+
label: 'Home',
|
|
22
|
+
link: '/home',
|
|
23
|
+
type: app_1.PageType.Custom,
|
|
24
|
+
icon: icons_1.IconPlaceholder,
|
|
25
|
+
},
|
|
26
|
+
logo: {},
|
|
27
|
+
});
|
|
28
|
+
const MetadataProvider = ({ children, experienceStore = exports.defaultExperienceStore, schemaStore = exports.defaultSchemaStore, appStore = exports.defaultAppStore, }) => {
|
|
8
29
|
const contextValue = (0, context_1.useCreateContextStore)({
|
|
9
|
-
// schemas: {},
|
|
10
|
-
// schemaLoading: true,
|
|
11
30
|
experienceStore,
|
|
12
31
|
schemaStore,
|
|
13
32
|
appStore,
|
|
14
33
|
});
|
|
15
|
-
// const [loading, setLoading] = useState(true);
|
|
16
|
-
// useEffect(() => {
|
|
17
|
-
// const schemas = schemaStore.getSchemas();
|
|
18
|
-
// contextValue.setValue({
|
|
19
|
-
// schemas,
|
|
20
|
-
// schemaLoading: false,
|
|
21
|
-
// });
|
|
22
|
-
// setLoading(false);
|
|
23
|
-
// }, [contextValue, schemaStore]);
|
|
24
|
-
// if (loading) {
|
|
25
|
-
// return null;
|
|
26
|
-
// }
|
|
27
34
|
return ((0, jsx_runtime_1.jsx)(context_2.MetadataContext.Provider, { value: contextValue, children: children }));
|
|
28
35
|
};
|
|
29
36
|
exports.MetadataProvider = MetadataProvider;
|
|
@@ -10,15 +10,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.useExperienceViewCommands = useExperienceViewCommands;
|
|
13
|
+
const app_1 = require("@headless-adminapp/app/app");
|
|
13
14
|
const react_query_1 = require("@tanstack/react-query");
|
|
14
15
|
const useExperienceStore_1 = require("./useExperienceStore");
|
|
15
16
|
/** @todo move in different dir */
|
|
16
17
|
function useExperienceViewCommands(logicalName) {
|
|
17
18
|
const experienceStore = (0, useExperienceStore_1.useExperienceStore)();
|
|
19
|
+
const { app: { viewCommands }, } = (0, app_1.useAppContext)();
|
|
18
20
|
const { data: commands } = (0, react_query_1.useQuery)({
|
|
19
21
|
queryKey: ['experience-schema-view-commands', logicalName],
|
|
20
22
|
queryFn: () => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
|
|
23
|
+
let commands = yield experienceStore.getViewCommands(logicalName);
|
|
24
|
+
if (!commands) {
|
|
25
|
+
commands = viewCommands;
|
|
26
|
+
}
|
|
27
|
+
return commands !== null && commands !== void 0 ? commands : [];
|
|
22
28
|
}),
|
|
23
29
|
initialData: [],
|
|
24
30
|
});
|
|
@@ -10,15 +10,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.useExperienceViewSubgridCommands = useExperienceViewSubgridCommands;
|
|
13
|
+
const app_1 = require("@headless-adminapp/app/app");
|
|
13
14
|
const react_query_1 = require("@tanstack/react-query");
|
|
14
15
|
const useExperienceStore_1 = require("./useExperienceStore");
|
|
15
16
|
/** @todo move in different dir */
|
|
16
17
|
function useExperienceViewSubgridCommands(logicalName) {
|
|
17
18
|
const experienceStore = (0, useExperienceStore_1.useExperienceStore)();
|
|
19
|
+
const { app: { subgridCommands }, } = (0, app_1.useAppContext)();
|
|
18
20
|
const { data: commands } = (0, react_query_1.useQuery)({
|
|
19
21
|
queryKey: ['experience-schema-view-subgrid-commands', logicalName],
|
|
20
22
|
queryFn: () => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
|
|
23
|
+
let commands = yield experienceStore.getSubgridCommands(logicalName);
|
|
24
|
+
if (!commands) {
|
|
25
|
+
commands = subgridCommands;
|
|
26
|
+
}
|
|
27
|
+
return commands !== null && commands !== void 0 ? commands : [];
|
|
22
28
|
}),
|
|
23
29
|
initialData: [],
|
|
24
30
|
});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
1
|
export declare function useMetadata(): {
|
|
3
|
-
schemas: Record<string, import("@headless-adminapp/core/schema").Schema<SchemaAttributes>>;
|
|
2
|
+
schemas: Record<string, import("@headless-adminapp/core/schema").Schema<import("@headless-adminapp/core/schema").SchemaAttributes>>;
|
|
4
3
|
schemaLoading: boolean;
|
|
5
|
-
|
|
6
|
-
schemaStore: import("@headless-adminapp/core/store").ISchemaStore<SchemaAttributes>;
|
|
4
|
+
schemaStore: import("@headless-adminapp/core/store").ISchemaStore<import("@headless-adminapp/core/schema").SchemaAttributes>;
|
|
7
5
|
appStore: import("@headless-adminapp/core/store").IClientAppStore;
|
|
8
6
|
experienceStore: import("@headless-adminapp/core/store").ISchemaExperienceStore;
|
|
9
7
|
};
|
|
@@ -14,15 +14,11 @@ function useMetadata() {
|
|
|
14
14
|
// );
|
|
15
15
|
const schemaLoading = false;
|
|
16
16
|
const schemas = schemaStore.getAllSchema();
|
|
17
|
-
|
|
18
|
-
return schemaStore.getSchema(logicalName);
|
|
19
|
-
}, [schemaStore]);
|
|
20
|
-
return {
|
|
17
|
+
return (0, react_1.useMemo)(() => ({
|
|
21
18
|
schemas,
|
|
22
19
|
schemaLoading,
|
|
23
|
-
getSchema,
|
|
24
20
|
schemaStore,
|
|
25
21
|
appStore,
|
|
26
22
|
experienceStore,
|
|
27
|
-
};
|
|
23
|
+
}), [schemas, schemaLoading, schemaStore, appStore, experienceStore]);
|
|
28
24
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
2
|
-
export declare function useSchema<S extends SchemaAttributes = SchemaAttributes>(logicalName: string): import("@headless-adminapp/core/schema").Schema<S
|
|
2
|
+
export declare function useSchema<S extends SchemaAttributes = SchemaAttributes>(logicalName: string): import("@headless-adminapp/core/schema").Schema<S> | null;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useSchema = useSchema;
|
|
4
4
|
const useMetadata_1 = require("./useMetadata");
|
|
5
5
|
function useSchema(logicalName) {
|
|
6
|
-
const {
|
|
7
|
-
|
|
6
|
+
const { schemaStore } = (0, useMetadata_1.useMetadata)();
|
|
7
|
+
if (!schemaStore.hasSchema(logicalName)) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
return schemaStore.getSchema(logicalName);
|
|
8
11
|
}
|
package/mutable/context.js
CHANGED
|
@@ -41,6 +41,6 @@ function useContextValueSetter(context, setter) {
|
|
|
41
41
|
setterRef.current = setter;
|
|
42
42
|
const setterWrapper = (0, react_1.useCallback)((...args) => {
|
|
43
43
|
return setterRef.current(contextValue.setValue)(...args);
|
|
44
|
-
}, []);
|
|
44
|
+
}, [contextValue.setValue]);
|
|
45
45
|
return setterWrapper;
|
|
46
46
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useOpenForm';
|
|
@@ -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("./useOpenForm"), exports);
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function useOpenForm(): (
|
|
3
|
-
replace?: boolean;
|
|
4
|
-
}) => void;
|
|
1
|
+
import { OpenFormOptions } from '@headless-adminapp/core/experience/command';
|
|
2
|
+
export declare function useOpenForm(): (options: OpenFormOptions) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useOpenForm = useOpenForm;
|
|
4
|
+
const defaultParameters_1 = require("@headless-adminapp/app/dataform/utils/defaultParameters");
|
|
4
5
|
const app_1 = require("@headless-adminapp/core/experience/app");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const hooks_1 = require("../../route/hooks/");
|
|
@@ -8,9 +9,16 @@ const useRouteResolver_1 = require("../../route/hooks/useRouteResolver");
|
|
|
8
9
|
function useOpenForm() {
|
|
9
10
|
const routeResolver = (0, useRouteResolver_1.useRouteResolver)();
|
|
10
11
|
const router = (0, hooks_1.useRouter)();
|
|
11
|
-
return (0, react_1.useCallback)((
|
|
12
|
-
const path = routeResolver(
|
|
13
|
-
|
|
12
|
+
return (0, react_1.useCallback)((options) => {
|
|
13
|
+
const path = routeResolver({
|
|
14
|
+
logicalName: options.logicalName,
|
|
15
|
+
type: app_1.PageType.EntityForm,
|
|
16
|
+
id: options.id,
|
|
17
|
+
});
|
|
18
|
+
if (options.parameters) {
|
|
19
|
+
(0, defaultParameters_1.setFormDefaultParameters)(options.logicalName, options.parameters);
|
|
20
|
+
}
|
|
21
|
+
if (options.replace) {
|
|
14
22
|
router.replace(path);
|
|
15
23
|
}
|
|
16
24
|
else {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hooks';
|
|
@@ -14,7 +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
|
-
exports.AppearanceContext = void 0;
|
|
18
|
-
var context_1 = require("./context");
|
|
19
|
-
Object.defineProperty(exports, "AppearanceContext", { enumerable: true, get: function () { return context_1.AppearanceContext; } });
|
|
20
17
|
__exportStar(require("./hooks"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-adminapp/app",
|
|
3
|
-
"version": "0.0.17-alpha.
|
|
3
|
+
"version": "0.0.17-alpha.50",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsc",
|
|
21
|
+
"clean": "rm -rf dist && rm -f tsconfig.tsbuildinfo",
|
|
21
22
|
"ts-check": "tsc --noEmit",
|
|
22
23
|
"copy-files": "cp package.json dist && cp src/index.css dist",
|
|
23
24
|
"prepublishOnly": "pnpm run build && pnpm run copy-files",
|
|
@@ -31,10 +32,12 @@
|
|
|
31
32
|
"@tanstack/react-query": "5.51.1",
|
|
32
33
|
"clsx": "2.1.1",
|
|
33
34
|
"dayjs": "^1.11.13",
|
|
35
|
+
"exceljs": "^4.4.0",
|
|
36
|
+
"json-to-csv-export": "^2.1.1",
|
|
34
37
|
"lodash": "^4.17.21",
|
|
35
38
|
"react-custom-scrollbars-2": "^4.5.0",
|
|
36
39
|
"react-hook-form": "7.52.2",
|
|
37
40
|
"yup": "^1.4.0"
|
|
38
41
|
},
|
|
39
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "aaa62f2c8f6edb9dad521d9bb254a3c1811b5aff"
|
|
40
43
|
}
|
|
@@ -26,7 +26,7 @@ function useRecordSetResult() {
|
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
28
|
return schemaStore.getSchema(context.logicalName);
|
|
29
|
-
}, [context.logicalName]);
|
|
29
|
+
}, [context.logicalName, schemaStore]);
|
|
30
30
|
const cardView = context.cardView;
|
|
31
31
|
const columns = (0, react_1.useMemo)(() => {
|
|
32
32
|
var _a;
|
package/route/RouteProvider.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface RouteProviderProps {
|
|
|
7
7
|
pathname: string;
|
|
8
8
|
searchParams: ReadonlyURLSearchParams;
|
|
9
9
|
basePath?: string;
|
|
10
|
-
routeResolver
|
|
11
|
-
isRouteActive
|
|
10
|
+
routeResolver?: RouteResolver;
|
|
11
|
+
isRouteActive?: IsRouteActive;
|
|
12
12
|
}
|
|
13
13
|
export declare const RouteProvider: FC<PropsWithChildren<RouteProviderProps>>;
|