@uxf/cms 11.1.0 → 11.2.2
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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@uxf/cms",
|
3
|
-
"version": "11.
|
3
|
+
"version": "11.2.2",
|
4
4
|
"description": "UXF Cms",
|
5
5
|
"author": "UXFans <dev@uxf.cz>",
|
6
6
|
"homepage": "https://gitlab.com/uxf-npm/cms#readme",
|
@@ -31,11 +31,11 @@
|
|
31
31
|
"@floating-ui/react": "0.26.0",
|
32
32
|
"@redux-devtools/extension": "3.2.5",
|
33
33
|
"@uxf/core": "10.10.1",
|
34
|
-
"@uxf/data-grid": "11.1.
|
34
|
+
"@uxf/data-grid": "11.1.1",
|
35
35
|
"@uxf/form": "11.1.0",
|
36
36
|
"@uxf/router": "10.0.0",
|
37
37
|
"@uxf/ui": "11.1.0",
|
38
|
-
"@uxf/wysiwyg": "11.1.
|
38
|
+
"@uxf/wysiwyg": "11.1.1",
|
39
39
|
"axios": "1.5.1",
|
40
40
|
"axios-hooks": "5.0.0",
|
41
41
|
"es6-error": "4.1.1",
|
@@ -51,13 +51,14 @@ const dataGridLoader = (gridName, request) => {
|
|
51
51
|
exports.dataGridLoader = dataGridLoader;
|
52
52
|
const DefaultLayout = (props) => react_1.default.createElement("div", { ...props });
|
53
53
|
const GridPageComponent = (props) => {
|
54
|
-
var _a, _b, _c, _d, _e, _f, _g
|
54
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
55
55
|
// eslint-disable-next-line react/destructuring-assignment
|
56
56
|
const { query, AddIcon = react_1.default.createElement(icon_1.Icon, { name: "plus" }), onAddTitle = "Přidat záznam" } = props;
|
57
57
|
const Layout = (_b = (_a = props.ui) === null || _a === void 0 ? void 0 : _a.Layout) !== null && _b !== void 0 ? _b : DefaultLayout;
|
58
58
|
const { state, actions } = (0, use_data_grid_control_1.useDataGridControl)({
|
59
59
|
schema: props.gridSchema,
|
60
60
|
initialState: query.filter ? (0, router_1.queryParamToString)(query.filter) : undefined,
|
61
|
+
initialUserConfig: props.initialUserConfig,
|
61
62
|
});
|
62
63
|
const universalLoader = (0, react_1.useCallback)((gridName, request, encodedRequest) => {
|
63
64
|
var _a, _b;
|
@@ -71,7 +72,7 @@ const GridPageComponent = (props) => {
|
|
71
72
|
const { data, isLoading, error, onReload } = (0, use_data_grid_fetching_1.useDataGridFetching)({
|
72
73
|
loader: (_c = props.loader) !== null && _c !== void 0 ? _c : universalLoader,
|
73
74
|
schema: props.gridSchema,
|
74
|
-
gridName:
|
75
|
+
gridName: props.entityAlias,
|
75
76
|
state,
|
76
77
|
});
|
77
78
|
const actionsBag = (0, react_1.useMemo)(() => ({
|
@@ -79,7 +80,7 @@ const GridPageComponent = (props) => {
|
|
79
80
|
}), [onReload]);
|
80
81
|
const hasOnAdd = props.onAdd && (!props.metaSchema || props.metaSchema.actions.includes("add"));
|
81
82
|
const cActions = [
|
82
|
-
...((
|
83
|
+
...((_d = props.customActions) !== null && _d !== void 0 ? _d : []),
|
83
84
|
hasOnAdd
|
84
85
|
? {
|
85
86
|
label: (react_1.default.createElement(react_1.default.Fragment, null,
|
@@ -123,14 +124,14 @@ const GridPageComponent = (props) => {
|
|
123
124
|
},
|
124
125
|
}
|
125
126
|
: undefined;
|
126
|
-
return (react_1.default.createElement(Layout, { key: props.entityAlias, title: (
|
127
|
+
return (react_1.default.createElement(Layout, { key: props.entityAlias, title: (_g = (_e = props.title) !== null && _e !== void 0 ? _e : (_f = props.metaSchema) === null || _f === void 0 ? void 0 : _f.title) !== null && _g !== void 0 ? _g : "" },
|
127
128
|
react_1.default.createElement("div", { className: "mb-10" },
|
128
129
|
react_1.default.createElement(data_grid_1.DataGrid, { state: state, actions: actions, data: data, isLoading: isLoading, error: error, onReload: onReload, noBorder: true, actionCell: actionCell, schema: props.gridSchema, gridName: props.entityAlias, rowHeight: props.rowHeight, customActions: cActions, onCsvDownload: (r) => window.open(`/api/cms/datagrid/export/${props.entityAlias}?${(0, qs_1.stringify)(r)}`), isRowSelectable: props.selectable }))));
|
129
130
|
};
|
130
131
|
GridPageComponent.displayName = "GridPageComponent";
|
131
132
|
const GridPage = (config) => {
|
132
133
|
const Component = (props) => {
|
133
|
-
return (react_1.default.createElement(GridPageComponent, { ...props, AddIcon: config.AddIcon, customActions: config.customActions, getEditUrl: config.getEditUrl, getOpenUrl: config.getOpenUrl, loader: config.loader, onAdd: config.onAdd, onAddTitle: config.onAddTitle, onEdit: config.onEdit, onOpen: config.onOpen, onRemove: config.onRemove, rowHeight: config.rowHeight, selectable: config.selectable, title: config.title, ui: config.ui }));
|
134
|
+
return (react_1.default.createElement(GridPageComponent, { ...props, AddIcon: config.AddIcon, customActions: config.customActions, getEditUrl: config.getEditUrl, getOpenUrl: config.getOpenUrl, loader: config.loader, onAdd: config.onAdd, onAddTitle: config.onAddTitle, onEdit: config.onEdit, onOpen: config.onOpen, onRemove: config.onRemove, rowHeight: config.rowHeight, selectable: config.selectable, title: config.title, ui: config.ui, initialUserConfig: config.initialUserConfig }));
|
134
135
|
};
|
135
136
|
Component.getInitialProps = async (ctx) => {
|
136
137
|
const entityAlias = typeof config.entityAlias === "function" ? config.entityAlias(ctx) : config.entityAlias;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
import {
|
2
|
+
import { Nullish } from "@uxf/core/types";
|
3
|
+
import { DataGridProps, DataGridUserConfig, Loader, Schema } from "@uxf/data-grid";
|
3
4
|
import { NextPageContext } from "next";
|
4
5
|
import { ParsedUrlQuery } from "querystring";
|
5
6
|
import { FC, ReactElement } from "react";
|
@@ -29,6 +30,7 @@ export type GridPageComponentProps = {
|
|
29
30
|
onAddTitle?: string;
|
30
31
|
selectable?: boolean;
|
31
32
|
customActions?: DataGridProps<any, any>["customActions"];
|
33
|
+
initialUserConfig?: DataGridUserConfig | Nullish;
|
32
34
|
};
|
33
35
|
export type EntityAliasExtractor = (ctx: NextPageContext) => string;
|
34
36
|
type UIComponents = {
|
@@ -55,5 +57,6 @@ export type GridPageConfig<T extends object = any> = {
|
|
55
57
|
onAddTitle?: string;
|
56
58
|
selectable?: boolean;
|
57
59
|
customActions?: DataGridProps<any, any>["customActions"];
|
60
|
+
initialUserConfig?: DataGridUserConfig | Nullish;
|
58
61
|
};
|
59
62
|
export {};
|