@headless-adminapp/app 0.0.17-alpha.5 → 0.0.17-alpha.8
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/builders/CommandBuilder/CommandBuilder.d.ts +10 -0
- package/builders/CommandBuilder/CommandBuilder.js +14 -0
- package/builders/CommandBuilder/DefaultCommandBuilder.d.ts +79 -0
- package/builders/CommandBuilder/DefaultCommandBuilder.js +173 -0
- package/builders/CommandBuilder/FormCommandBuilder.d.ts +45 -0
- package/builders/CommandBuilder/FormCommandBuilder.js +145 -0
- package/builders/CommandBuilder/SubgridCommandBuilder.d.ts +64 -0
- package/builders/CommandBuilder/SubgridCommandBuilder.js +170 -0
- package/builders/CommandBuilder/ViewCommandBuilder.d.ts +63 -0
- package/builders/CommandBuilder/ViewCommandBuilder.js +250 -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/CommandBuilder.js +106 -13
- package/builders/SchemaExperienceBuilder.d.ts +2 -5
- package/builders/SchemaExperienceBuilder.js +16 -16
- 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 +9 -0
- package/command/hooks/useCommands.d.ts +1 -1
- package/command/hooks/useCommands.js +1 -1
- package/dataform/DataFormProvider/DataResolver.js +4 -4
- package/dataform/DataFormProvider/index.js +3 -3
- package/dataform/hooks/useFormSave.js +2 -2
- package/dataform/hooks/useLoadFormGridPage.js +7 -1
- package/dataform/utils/index.d.ts +4 -3
- package/dataform/utils/index.js +23 -23
- package/datagrid/DataGridProvider/DataResolver.js +3 -48
- package/datagrid/DataGridProvider/transformViewColumns.js +4 -4
- package/datagrid/DataGridProvider/utils.d.ts +7 -2
- package/datagrid/DataGridProvider/utils.js +52 -2
- package/datagrid/context.d.ts +4 -6
- package/datagrid/hooks/useGridCommands.d.ts +3 -0
- package/datagrid/hooks/useGridCommands.js +3 -0
- package/datagrid/hooks/useMainGridCommands.d.ts +1 -13
- package/datagrid/hooks/useMainGridCommands.js +23 -24
- package/datagrid/hooks/useOpenRecord.d.ts +1 -0
- package/datagrid/hooks/useOpenRecord.js +34 -0
- package/datagrid/hooks/useSubGridCommands.js +15 -27
- package/locale/LocaleProvider.js +1 -1
- package/locale/utils.d.ts +5 -0
- package/locale/utils.js +7 -0
- package/metadata/hooks/useExperienceViewCommands.d.ts +1 -1
- package/metadata/hooks/useExperienceViewCommands.js +7 -1
- package/metadata/hooks/useExperienceViewSubgridCommands.d.ts +1 -1
- package/metadata/hooks/useExperienceViewSubgridCommands.js +7 -1
- package/metadata/hooks/useMetadata.d.ts +1 -0
- package/metadata/hooks/useMetadata.js +2 -0
- package/metadata/hooks/useSchema.js +2 -2
- package/mutable/context.js +1 -1
- package/navigation/hooks/index.d.ts +1 -0
- package/navigation/hooks/index.js +17 -0
- package/navigation/hooks/useOpenForm.d.ts +2 -4
- package/navigation/hooks/useOpenForm.js +7 -3
- package/navigation/index.d.ts +1 -0
- package/navigation/index.js +17 -0
- package/package.json +4 -2
- package/recordset/RecordSetProvider.js +1 -1
- package/recordset/hooks/useRecordSetResult.js +1 -1
- package/store/SchemaExperienceStore.d.ts +3 -3
|
@@ -3,27 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useSubGridCommandHandlerContext = useSubGridCommandHandlerContext;
|
|
4
4
|
exports.useSubGridCommands = useSubGridCommands;
|
|
5
5
|
exports.useSubGridContextCommands = useSubGridContextCommands;
|
|
6
|
-
const
|
|
6
|
+
const app_1 = require("@headless-adminapp/app/app");
|
|
7
|
+
const mutable_1 = require("@headless-adminapp/app/mutable");
|
|
7
8
|
const react_1 = require("react");
|
|
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");
|
|
11
|
+
const context_1 = require("../context");
|
|
13
12
|
const useGridColumnFilter_1 = require("./useGridColumnFilter");
|
|
14
|
-
const useGridCommands_1 = require("./useGridCommands");
|
|
15
13
|
const useGridData_1 = require("./useGridData");
|
|
16
14
|
const useGridExtraFilter_1 = require("./useGridExtraFilter");
|
|
17
15
|
const useGridRefresh_1 = require("./useGridRefresh");
|
|
18
16
|
const useGridSchema_1 = require("./useGridSchema");
|
|
19
17
|
const useGridSelection_1 = require("./useGridSelection");
|
|
20
|
-
const useMainGridCommands_1 = require("./useMainGridCommands");
|
|
21
18
|
const useSearchText_1 = require("./useSearchText");
|
|
22
19
|
const useSelectedView_1 = require("./useSelectedView");
|
|
23
20
|
function useSubGridCommandHandlerContext() {
|
|
24
|
-
const
|
|
25
|
-
const queryClient = (0, react_query_1.useQueryClient)();
|
|
26
|
-
const { appStore, experienceStore, schemaStore } = (0, useMetadata_1.useMetadata)();
|
|
21
|
+
const baseHandlerContext = (0, command_1.useBaseCommandHandlerContext)();
|
|
27
22
|
const data = (0, useGridData_1.useGridData)();
|
|
28
23
|
const schema = (0, useGridSchema_1.useDataGridSchema)();
|
|
29
24
|
const view = (0, useSelectedView_1.useSelectedView)();
|
|
@@ -43,15 +38,8 @@ function useSubGridCommandHandlerContext() {
|
|
|
43
38
|
const [columnFilter] = (0, useGridColumnFilter_1.useGridColumnFilter)();
|
|
44
39
|
const extraFilter = (0, useGridExtraFilter_1.useGridExtraFilter)();
|
|
45
40
|
const refresh = (0, useGridRefresh_1.useGridRefresh)();
|
|
46
|
-
const utility = (0, useMainGridCommands_1.useUtility)();
|
|
47
|
-
const locale = (0, useLocale_1.useLocale)();
|
|
48
41
|
const mainFormHandlerContext = (0, useMainFormCommands_1.useMainFormCommandHandlerContext)();
|
|
49
|
-
return {
|
|
50
|
-
dataService,
|
|
51
|
-
queryClient,
|
|
52
|
-
utility,
|
|
53
|
-
primaryControl: mainFormHandlerContext.primaryControl,
|
|
54
|
-
secondaryControl: {
|
|
42
|
+
return Object.assign(Object.assign({}, baseHandlerContext), { primaryControl: mainFormHandlerContext.primaryControl, secondaryControl: {
|
|
55
43
|
data,
|
|
56
44
|
logicalName: schema.logicalName,
|
|
57
45
|
schema,
|
|
@@ -63,22 +51,22 @@ function useSubGridCommandHandlerContext() {
|
|
|
63
51
|
viewId: view.id,
|
|
64
52
|
columnFilter,
|
|
65
53
|
extraFilter,
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
54
|
+
} });
|
|
55
|
+
}
|
|
56
|
+
const emptyCommands = [];
|
|
57
|
+
function useGridCommands() {
|
|
58
|
+
var _a;
|
|
59
|
+
const commands = (0, mutable_1.useContextSelector)(context_1.GridContext, (state) => state.commands);
|
|
60
|
+
const { app: { subgridCommands: defaultCommands }, } = (0, app_1.useAppContext)();
|
|
61
|
+
return (_a = commands !== null && commands !== void 0 ? commands : defaultCommands) !== null && _a !== void 0 ? _a : emptyCommands;
|
|
74
62
|
}
|
|
75
63
|
function useSubGridCommands() {
|
|
76
|
-
const commands =
|
|
64
|
+
const commands = useGridCommands();
|
|
77
65
|
const handlerContext = useSubGridCommandHandlerContext();
|
|
78
66
|
return (0, command_1.useCommands)(commands, handlerContext);
|
|
79
67
|
}
|
|
80
68
|
function useSubGridContextCommands() {
|
|
81
|
-
const commands =
|
|
69
|
+
const commands = useGridCommands();
|
|
82
70
|
const handlerContext = useSubGridCommandHandlerContext();
|
|
83
71
|
return (0, command_1.useCommands)(commands, handlerContext, (command) => { var _a; return (_a = ('isContextMenu' in command && command.isContextMenu)) !== null && _a !== void 0 ? _a : false; });
|
|
84
72
|
}
|
package/locale/LocaleProvider.js
CHANGED
|
@@ -8,7 +8,7 @@ const context_1 = require("./context");
|
|
|
8
8
|
const LocaleProvider = ({ children, locale, options, }) => {
|
|
9
9
|
const localeState = (0, react_1.useMemo)(() => {
|
|
10
10
|
return (0, locale_1.getLocale)(locale, options);
|
|
11
|
-
}, [locale]);
|
|
11
|
+
}, [locale, 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/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
|
+
}
|
|
@@ -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 [];
|
|
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 [];
|
|
22
28
|
}),
|
|
23
29
|
initialData: [],
|
|
24
30
|
});
|
|
@@ -2,6 +2,7 @@ import { SchemaAttributes } from '@headless-adminapp/core/schema';
|
|
|
2
2
|
export declare function useMetadata(): {
|
|
3
3
|
schemas: Record<string, import("@headless-adminapp/core/schema").Schema<SchemaAttributes>>;
|
|
4
4
|
schemaLoading: boolean;
|
|
5
|
+
/*** @deprecated */
|
|
5
6
|
getSchema: <S extends SchemaAttributes = SchemaAttributes>(logicalName: string) => import("@headless-adminapp/core/schema").Schema<S>;
|
|
6
7
|
schemaStore: import("@headless-adminapp/core/store").ISchemaStore<SchemaAttributes>;
|
|
7
8
|
appStore: import("@headless-adminapp/core/store").IClientAppStore;
|
|
@@ -14,12 +14,14 @@ function useMetadata() {
|
|
|
14
14
|
// );
|
|
15
15
|
const schemaLoading = false;
|
|
16
16
|
const schemas = schemaStore.getAllSchema();
|
|
17
|
+
/*** @deprecated */
|
|
17
18
|
const getSchema = (0, react_1.useCallback)((logicalName) => {
|
|
18
19
|
return schemaStore.getSchema(logicalName);
|
|
19
20
|
}, [schemaStore]);
|
|
20
21
|
return {
|
|
21
22
|
schemas,
|
|
22
23
|
schemaLoading,
|
|
24
|
+
/*** @deprecated */
|
|
23
25
|
getSchema,
|
|
24
26
|
schemaStore,
|
|
25
27
|
appStore,
|
|
@@ -3,6 +3,6 @@ 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
|
-
return getSchema(logicalName);
|
|
6
|
+
const { schemaStore } = (0, useMetadata_1.useMetadata)();
|
|
7
|
+
return schemaStore.getSchema(logicalName);
|
|
8
8
|
}
|
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';
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./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;
|
|
@@ -8,9 +8,13 @@ const useRouteResolver_1 = require("../../route/hooks/useRouteResolver");
|
|
|
8
8
|
function useOpenForm() {
|
|
9
9
|
const routeResolver = (0, useRouteResolver_1.useRouteResolver)();
|
|
10
10
|
const router = (0, hooks_1.useRouter)();
|
|
11
|
-
return (0, react_1.useCallback)((
|
|
12
|
-
const path = routeResolver(
|
|
13
|
-
|
|
11
|
+
return (0, react_1.useCallback)((options) => {
|
|
12
|
+
const path = routeResolver({
|
|
13
|
+
logicalName: options.logicalName,
|
|
14
|
+
type: app_1.PageType.EntityForm,
|
|
15
|
+
id: options.id,
|
|
16
|
+
});
|
|
17
|
+
if (options.replace) {
|
|
14
18
|
router.replace(path);
|
|
15
19
|
}
|
|
16
20
|
else {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './hooks';
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./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.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -31,10 +31,12 @@
|
|
|
31
31
|
"@tanstack/react-query": "5.51.1",
|
|
32
32
|
"clsx": "2.1.1",
|
|
33
33
|
"dayjs": "^1.11.13",
|
|
34
|
+
"exceljs": "^4.4.0",
|
|
35
|
+
"json-to-csv-export": "^2.1.1",
|
|
34
36
|
"lodash": "^4.17.21",
|
|
35
37
|
"react-custom-scrollbars-2": "^4.5.0",
|
|
36
38
|
"react-hook-form": "7.52.2",
|
|
37
39
|
"yup": "^1.4.0"
|
|
38
40
|
},
|
|
39
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "0c369830a0ba4aa5744cc307f8947ae9660980c4"
|
|
40
42
|
}
|
|
@@ -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;
|
|
@@ -23,9 +23,9 @@ export declare class SchemaExperienceStore implements ISchemaExperienceStore {
|
|
|
23
23
|
getDefaultViewLookupId(logicalName: string): Promise<string>;
|
|
24
24
|
getForm<S extends SchemaAttributes = SchemaAttributes>(logicalName: string, formId: string): Promise<Form<S>>;
|
|
25
25
|
getQuickCreateForm<S extends SchemaAttributes = SchemaAttributes>(logicalName: string, formId: string): Promise<QuickCreateForm<S>>;
|
|
26
|
-
getViewCommands(logicalName: string): Promise<EntityMainGridCommandItemExperience[][]>;
|
|
27
|
-
getFormCommands(logicalName: string): Promise<EntityMainFormCommandItemExperience[][]>;
|
|
28
|
-
getSubgridCommands(logicalName: string): Promise<SubGridCommandItemExperience[][]>;
|
|
26
|
+
getViewCommands(logicalName: string): Promise<EntityMainGridCommandItemExperience[][] | undefined>;
|
|
27
|
+
getFormCommands(logicalName: string): Promise<EntityMainFormCommandItemExperience[][] | undefined>;
|
|
28
|
+
getSubgridCommands(logicalName: string): Promise<SubGridCommandItemExperience[][] | undefined>;
|
|
29
29
|
getSchemaMetadataList(): SchemaMetadata[];
|
|
30
30
|
getExperienceSchemaMetadatList(): Promise<SchemaExperienceMetadata[]>;
|
|
31
31
|
}
|