@uxf/cms 13.0.3 → 14.1.0

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.
Files changed (69) hide show
  1. package/README.md +1 -1
  2. package/api/index.d.ts +2 -0
  3. package/api/index.js +2 -2
  4. package/api/swr.js +71 -6
  5. package/content-builder/content-builder-header.js +42 -3
  6. package/content-builder/content-builder.js +140 -18
  7. package/content-builder/content-builder.stories.js +24 -5
  8. package/content-builder/forms/content-builder-basic-form.js +212 -25
  9. package/content-builder/forms/content-builder-seo-form.js +92 -8
  10. package/forms/change-password-form/change-password-form.js +152 -15
  11. package/forms/components/wysiwyg-input/wysiwyg-input.js +188 -50
  12. package/forms/components/wysiwyg-input/wysiwyg-input.stories.js +127 -22
  13. package/forms/forgotten-password-form/forgotten-password-form.js +119 -15
  14. package/forms/invite-user-form/invite-user-form.js +171 -13
  15. package/forms/login-form/login-form.js +122 -13
  16. package/forms/renew-password-form/renew-password-form.js +148 -16
  17. package/lib/api/create-axios-instance.d.ts +3 -1
  18. package/lib/api/create-axios-request.d.ts +3 -1
  19. package/lib/api/create-axios-request.js +9 -2
  20. package/lib/api/create-axios-request.test.d.ts +1 -0
  21. package/lib/api/create-axios-request.test.js +32 -0
  22. package/lib/layout/layout.js +126 -28
  23. package/lib/layout/sidebar.js +69 -38
  24. package/lib/menu/ui/menu-item.js +5 -2
  25. package/lib/menu/ui/sub-menu/sub-menu-mobile.js +62 -14
  26. package/lib/menu/ui/sub-menu/sub-menu.js +66 -14
  27. package/lib/menu/ui/sub-menu/use-sub-menu.js +137 -34
  28. package/lib/menu/ui/user-menu.js +178 -14
  29. package/package.json +21 -21
  30. package/pages/content-builder/components/form-content.js +189 -38
  31. package/pages/content-builder/components/form-root-fields.js +3 -3
  32. package/pages/content-builder/components/form.js +142 -27
  33. package/pages/content-builder/components/header.js +44 -5
  34. package/pages/content-builder/content/feature-section.js +67 -15
  35. package/pages/content-builder/content/gallery.js +38 -6
  36. package/pages/content-builder/content/hero-section.js +39 -6
  37. package/pages/content-builder/content/people.js +64 -13
  38. package/pages/content-builder/content/wysiwyg.js +60 -6
  39. package/pages/content-builder/content-builder-page.js +120 -48
  40. package/pages/content-builder/content-field.js +216 -35
  41. package/pages/content-builder/content-header-behaviour.spec.d.ts +1 -0
  42. package/pages/content-builder/content-header-behaviour.spec.js +22 -0
  43. package/pages/content-builder/content-header.js +100 -53
  44. package/pages/content-builder/context/details-visibility-context.js +96 -18
  45. package/pages/forgotten-password-page/forgotten-password-page.js +29 -46
  46. package/pages/grid-page/grid-page.js +292 -76
  47. package/pages/grid-page/history-pathname.d.ts +6 -0
  48. package/pages/grid-page/history-pathname.js +11 -0
  49. package/pages/grid-page/history-pathname.test.d.ts +1 -0
  50. package/pages/grid-page/history-pathname.test.js +11 -0
  51. package/pages/grid-page/use-hidden-columns.js +29 -8
  52. package/pages/invite-user-page/invite-user-page.js +39 -16
  53. package/pages/login-page/login-page.js +44 -50
  54. package/pages/renew-password-page/renew-password-page.js +35 -43
  55. package/pages/translations.d.ts +3 -0
  56. package/pages/translations.js +3 -0
  57. package/security/restricted-page.js +88 -10
  58. package/security/use-logged-user.js +33 -8
  59. package/translations/cs.json +2 -1
  60. package/translations/translations.d.ts +3 -0
  61. package/ui/avatar/avatar.js +3 -2
  62. package/ui/copy-to-clipboard/copy-to-clipboard.js +57 -44
  63. package/ui/copy-to-clipboard-button/copy-to-clipboard-button.js +47 -46
  64. package/utils/remove-confirm-handler.js +80 -11
  65. package/utils/use-viewport-height.js +26 -20
  66. package/utils/use-viewport-height.test.d.ts +1 -0
  67. package/utils/use-viewport-height.test.js +37 -0
  68. package/utils/use-visual-viewport-height.d.ts +2 -0
  69. package/utils/use-visual-viewport-height.js +26 -0
@@ -1,59 +1,42 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
35
5
  Object.defineProperty(exports, "__esModule", { value: true });
36
6
  exports.ForgottenPasswordPage = void 0;
37
- const react_1 = __importStar(require("react"));
7
+ const compiler_runtime_1 = require("react/compiler-runtime");
8
+ const react_1 = __importDefault(require("react"));
38
9
  const forgotten_password_form_1 = require("../../forms/forgotten-password-form");
39
10
  const login_layout_1 = require("../../lib/login-layout");
40
11
  const INITIAL_VALUES = {
41
- username: "",
12
+ username: ""
42
13
  };
43
- const ForgottenPasswordPage = (config) => {
14
+ const ForgottenPasswordPage = config => {
44
15
  const Component = () => {
45
16
  var _a;
46
- const onSubmit = (0, react_1.useCallback)(async (values) => {
47
- try {
48
- await config.onSubmit(values.username);
49
- }
50
- catch (e) {
51
- config.handleError(e);
52
- }
53
- }, []);
54
- return (react_1.default.createElement(login_layout_1.LoginLayout, { Logo: (_a = config.ui) === null || _a === void 0 ? void 0 : _a.Logo, pageTitle: config.pageTitle, title: config.title },
55
- react_1.default.createElement(forgotten_password_form_1.ForgottenPasswordForm, { defaultValues: INITIAL_VALUES, onLogin: config.onLogin, onSubmit: onSubmit })));
17
+ const $ = (0, compiler_runtime_1.c)(1);
18
+ const onSubmit = _temp;
19
+ let t0;
20
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
21
+ t0 = react_1.default.createElement(login_layout_1.LoginLayout, { Logo: (_a = config.ui) === null || _a === void 0 ? void 0 : _a.Logo, pageTitle: config.pageTitle, title: config.title },
22
+ react_1.default.createElement(forgotten_password_form_1.ForgottenPasswordForm, { defaultValues: INITIAL_VALUES, onLogin: config.onLogin, onSubmit: onSubmit }));
23
+ $[0] = t0;
24
+ }
25
+ else {
26
+ t0 = $[0];
27
+ }
28
+ return t0;
56
29
  };
57
30
  return Component;
58
31
  };
59
32
  exports.ForgottenPasswordPage = ForgottenPasswordPage;
33
+ async function _temp(values) {
34
+ ;
35
+ try {
36
+ await config.onSubmit(values.username);
37
+ }
38
+ catch (t0) {
39
+ const e = t0;
40
+ config.handleError(e);
41
+ }
42
+ }
@@ -37,6 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.GridPage = exports.dataGridLoader = void 0;
40
+ const compiler_runtime_1 = require("react/compiler-runtime");
40
41
  const empty_array_1 = require("@uxf/core/constants/empty-array");
41
42
  const build_array_1 = require("@uxf/core/utils/build-array");
42
43
  const is_nil_1 = require("@uxf/core/utils/is-nil");
@@ -52,120 +53,335 @@ const icon_1 = require("@uxf/ui/icon");
52
53
  const loader_1 = require("@uxf/ui/loader");
53
54
  const link_1 = __importDefault(require("next/link"));
54
55
  const router_2 = __importStar(require("next/router"));
55
- const react_1 = __importStar(require("react"));
56
- const url_1 = require("url");
56
+ const react_1 = __importDefault(require("react"));
57
57
  const swr_1 = require("../../api/swr");
58
58
  const api_1 = require("../../lib/api");
59
59
  const restricted_page_1 = require("../../security/restricted-page");
60
+ const history_pathname_1 = require("./history-pathname");
60
61
  // TODO use swr
61
62
  const { axiosRequest } = (0, api_1.createAxiosInstance)("");
62
63
  const dataGridLoader = (gridName, request) => {
63
- return axiosRequest(null, `/api/cms/datagrid/${gridName}`, "get", null, request).then((r) => r.data);
64
+ return axiosRequest(null, `/api/cms/datagrid/${gridName}`, "get", null, request).then(r => r.data);
64
65
  };
65
66
  exports.dataGridLoader = dataGridLoader;
66
- const DefaultLayout = (props) => react_1.default.createElement("div", { ...props });
67
+ const DefaultLayout = props => {
68
+ "use no memo";
69
+ return react_1.default.createElement("div", { ...props });
70
+ };
67
71
  // eslint-disable-next-line complexity
68
72
  function GridPageComponent(props) {
69
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
70
- // eslint-disable-next-line react/destructuring-assignment
71
- const { query, AddIcon = react_1.default.createElement(icon_1.Icon, { name: "plus" }), onAddTitle = "Přidat záznam" } = props;
72
- const Layout = (_b = (_a = props.ui) === null || _a === void 0 ? void 0 : _a.Layout) !== null && _b !== void 0 ? _b : DefaultLayout;
73
- const { state, actions } = (0, use_data_grid_control_1.useDataGridControl)({
74
- schema: props.gridSchema,
75
- initialState: query.filter ? (0, router_1.queryParamToString)(query.filter) : undefined,
76
- initialUserConfig: props.initialUserConfig,
77
- });
78
- const universalLoader = (0, react_1.useCallback)((gridName, request, encodedRequest) => {
79
- var _a, _b;
80
- const response = (0, exports.dataGridLoader)(gridName !== null && gridName !== void 0 ? gridName : "", request);
81
- // save filter to url
82
- const newQuery = { ...query, filter: encodedRequest };
83
- // TODO @vejvis - dodělat vlastní router a tuhle magii smazat!
84
- router_2.default.replace(`${(0, url_1.parse)(((_a = window.history.state) === null || _a === void 0 ? void 0 : _a.url) || "").pathname}?${(0, qs_1.stringify)(newQuery)}`, `${(0, url_1.parse)(((_b = window.history.state) === null || _b === void 0 ? void 0 : _b.as) || "").pathname}?${(0, qs_1.stringify)(newQuery)}`, { shallow: true });
85
- return response;
86
- }, [query]);
87
- const { data, isLoading, error, reload } = (0, use_data_grid_fetching_1.useDataGridFetching)({
88
- loader: (_c = props.loader) !== null && _c !== void 0 ? _c : universalLoader,
89
- schema: props.gridSchema,
90
- state,
91
- });
92
- const actionsBag = (0, react_1.useMemo)(() => ({
93
- reload,
94
- }), [reload]);
95
- const hasOnAdd = props.onAdd && (!props.metaSchema || props.metaSchema.actions.includes("add"));
96
- const cActions = [
97
- ...((_d = props.customActions) !== null && _d !== void 0 ? _d : empty_array_1.EMPTY_ARRAY),
98
- hasOnAdd
99
- ? {
100
- label: (react_1.default.createElement(react_1.default.Fragment, null,
101
- AddIcon,
102
- "\u00A0",
103
- onAddTitle)),
104
- onClick: () => { var _a; return (_a = props.onAdd) === null || _a === void 0 ? void 0 : _a.call(props, props.entityAlias, actionsBag); },
105
- }
106
- : undefined,
107
- ].filter(Boolean);
108
- const actionColumnButtonsCount = (props.onEdit || props.getEditUrl ? 1 : 0) +
109
- (props.onOpen || props.getOpenUrl ? 1 : 0) +
110
- (props.onRemove ? 1 : 0);
111
- // typing not done -> will be deleted completely soon!
112
- const actionCell = (_f = (_e = props.ui) === null || _e === void 0 ? void 0 : _e.actionCell) !== null && _f !== void 0 ? _f : (actionColumnButtonsCount > 0
113
- ? {
73
+ var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
74
+ const $ = (0, compiler_runtime_1.c)(58);
75
+ const query = props.query;
76
+ let t0;
77
+ if ($[0] !== props.AddIcon) {
78
+ t0 = (_a = props.AddIcon) !== null && _a !== void 0 ? _a : react_1.default.createElement(icon_1.Icon, { name: "plus" });
79
+ $[0] = props.AddIcon;
80
+ $[1] = t0;
81
+ }
82
+ else {
83
+ t0 = $[1];
84
+ }
85
+ const AddIcon = t0;
86
+ const onAddTitle = (_b = props.onAddTitle) !== null && _b !== void 0 ? _b : "P\u0159idat z\xE1znam";
87
+ const Layout = (_e = (_d = props.ui) === null || _d === void 0 ? void 0 : _d.Layout) !== null && _e !== void 0 ? _e : DefaultLayout;
88
+ let t1;
89
+ if ($[2] !== query.filter) {
90
+ t1 = query.filter ? (0, router_1.queryParamToString)(query.filter) : undefined;
91
+ $[2] = query.filter;
92
+ $[3] = t1;
93
+ }
94
+ else {
95
+ t1 = $[3];
96
+ }
97
+ let t2;
98
+ if ($[4] !== props.gridSchema || $[5] !== props.initialUserConfig || $[6] !== t1) {
99
+ t2 = {
100
+ schema: props.gridSchema,
101
+ initialState: t1,
102
+ initialUserConfig: props.initialUserConfig
103
+ };
104
+ $[4] = props.gridSchema;
105
+ $[5] = props.initialUserConfig;
106
+ $[6] = t1;
107
+ $[7] = t2;
108
+ }
109
+ else {
110
+ t2 = $[7];
111
+ }
112
+ const { state, actions } = (0, use_data_grid_control_1.useDataGridControl)(t2);
113
+ let t3;
114
+ if ($[8] !== query) {
115
+ t3 = (gridName, request, encodedRequest) => {
116
+ var _a, _b;
117
+ const response = (0, exports.dataGridLoader)(gridName !== null && gridName !== void 0 ? gridName : "", request);
118
+ const newQuery = {
119
+ ...query,
120
+ filter: encodedRequest
121
+ };
122
+ router_2.default.replace(`${(0, history_pathname_1.historyPathname)((_a = window.history.state) === null || _a === void 0 ? void 0 : _a.url)}?${(0, qs_1.stringify)(newQuery)}`, `${(0, history_pathname_1.historyPathname)((_b = window.history.state) === null || _b === void 0 ? void 0 : _b.as)}?${(0, qs_1.stringify)(newQuery)}`, {
123
+ shallow: true
124
+ });
125
+ return response;
126
+ };
127
+ $[8] = query;
128
+ $[9] = t3;
129
+ }
130
+ else {
131
+ t3 = $[9];
132
+ }
133
+ const universalLoader = t3;
134
+ const t4 = (_f = props.loader) !== null && _f !== void 0 ? _f : universalLoader;
135
+ let t5;
136
+ if ($[10] !== props.gridSchema || $[11] !== state || $[12] !== t4) {
137
+ t5 = {
138
+ loader: t4,
139
+ schema: props.gridSchema,
140
+ state
141
+ };
142
+ $[10] = props.gridSchema;
143
+ $[11] = state;
144
+ $[12] = t4;
145
+ $[13] = t5;
146
+ }
147
+ else {
148
+ t5 = $[13];
149
+ }
150
+ const { data, isLoading, error, reload } = (0, use_data_grid_fetching_1.useDataGridFetching)(t5);
151
+ let t6;
152
+ if ($[14] !== reload) {
153
+ t6 = {
154
+ reload
155
+ };
156
+ $[14] = reload;
157
+ $[15] = t6;
158
+ }
159
+ else {
160
+ t6 = $[15];
161
+ }
162
+ const actionsBag = t6;
163
+ let t7;
164
+ if ($[16] !== props.metaSchema || $[17] !== props.onAdd) {
165
+ t7 = props.onAdd && (!props.metaSchema || props.metaSchema.actions.includes("add"));
166
+ $[16] = props.metaSchema;
167
+ $[17] = props.onAdd;
168
+ $[18] = t7;
169
+ }
170
+ else {
171
+ t7 = $[18];
172
+ }
173
+ const hasOnAdd = t7;
174
+ const t8 = (_g = props.customActions) !== null && _g !== void 0 ? _g : empty_array_1.EMPTY_ARRAY;
175
+ let t9;
176
+ if ($[19] !== AddIcon || $[20] !== actionsBag || $[21] !== hasOnAdd || $[22] !== onAddTitle || $[23] !== props) {
177
+ t9 = hasOnAdd ? {
178
+ label: react_1.default.createElement(react_1.default.Fragment, null,
179
+ AddIcon,
180
+ "\u00A0",
181
+ onAddTitle),
182
+ onClick: () => { var _a; return (_a = props.onAdd) === null || _a === void 0 ? void 0 : _a.call(props, props.entityAlias, actionsBag); }
183
+ } : undefined;
184
+ $[19] = AddIcon;
185
+ $[20] = actionsBag;
186
+ $[21] = hasOnAdd;
187
+ $[22] = onAddTitle;
188
+ $[23] = props;
189
+ $[24] = t9;
190
+ }
191
+ else {
192
+ t9 = $[24];
193
+ }
194
+ let t10;
195
+ if ($[25] !== t8 || $[26] !== t9) {
196
+ t10 = [...t8, t9].filter(Boolean);
197
+ $[25] = t8;
198
+ $[26] = t9;
199
+ $[27] = t10;
200
+ }
201
+ else {
202
+ t10 = $[27];
203
+ }
204
+ const cActions = t10;
205
+ const actionColumnButtonsCount = (props.onEdit || props.getEditUrl ? 1 : 0) + (props.onOpen || props.getOpenUrl ? 1 : 0) + (props.onRemove ? 1 : 0);
206
+ let t11;
207
+ if ($[28] !== actionColumnButtonsCount || $[29] !== actionsBag || $[30] !== props) {
208
+ t11 = (_j = (_h = props.ui) === null || _h === void 0 ? void 0 : _h.actionCell) !== null && _j !== void 0 ? _j : (actionColumnButtonsCount > 0 ? {
114
209
  width: actionColumnButtonsCount * 40 + 8,
115
- Component: (actionCellProps) => {
116
- var _a, _b, _c, _d, _e, _f;
117
- const buttons = (0, build_array_1.buildArray)()
118
- .when((0, is_not_nil_1.isNotNil)((_a = props.onOpen) !== null && _a !== void 0 ? _a : props.getOpenUrl), {
210
+ Component: actionCellProps => {
211
+ var _a, _b, _d, _e, _f, _g;
212
+ const buttons = (0, build_array_1.buildArray)().when((0, is_not_nil_1.isNotNil)((_a = props.onOpen) !== null && _a !== void 0 ? _a : props.getOpenUrl), {
119
213
  icon: "circle-info",
120
214
  onClick: () => { var _a; return (_a = props.onOpen) === null || _a === void 0 ? void 0 : _a.call(props, props.entityAlias, actionCellProps.row, actionsBag); },
121
215
  as: props.getOpenUrl ? link_1.default : undefined,
122
- href: (_c = (_b = props.getOpenUrl) === null || _b === void 0 ? void 0 : _b.call(props, props.entityAlias, actionCellProps.row)) !== null && _c !== void 0 ? _c : undefined,
216
+ href: (_d = (_b = props.getOpenUrl) === null || _b === void 0 ? void 0 : _b.call(props, props.entityAlias, actionCellProps.row)) !== null && _d !== void 0 ? _d : undefined,
123
217
  isIconButton: true,
124
- title: "Detail",
125
- })
126
- .when((0, is_not_nil_1.isNotNil)((_d = props.onEdit) !== null && _d !== void 0 ? _d : props.getEditUrl), {
218
+ title: "Detail"
219
+ }).when((0, is_not_nil_1.isNotNil)((_e = props.onEdit) !== null && _e !== void 0 ? _e : props.getEditUrl), {
127
220
  icon: "pen",
128
221
  onClick: () => { var _a; return (_a = props.onEdit) === null || _a === void 0 ? void 0 : _a.call(props, props.entityAlias, actionCellProps.row, actionsBag); },
129
222
  as: props.getEditUrl ? link_1.default : undefined,
130
- href: (_f = (_e = props.getEditUrl) === null || _e === void 0 ? void 0 : _e.call(props, props.entityAlias, actionCellProps.row)) !== null && _f !== void 0 ? _f : undefined,
223
+ href: (_g = (_f = props.getEditUrl) === null || _f === void 0 ? void 0 : _f.call(props, props.entityAlias, actionCellProps.row)) !== null && _g !== void 0 ? _g : undefined,
131
224
  isIconButton: true,
132
- title: "Upravit",
133
- })
134
- .when((0, is_not_nil_1.isNotNil)(props.onRemove), {
225
+ title: "Upravit"
226
+ }).when((0, is_not_nil_1.isNotNil)(props.onRemove), {
135
227
  icon: "trash",
136
228
  onClick: () => { var _a; return (_a = props.onRemove) === null || _a === void 0 ? void 0 : _a.call(props, props.entityAlias, actionCellProps.row, actionsBag); },
137
229
  isIconButton: true,
138
- title: "Smazat",
230
+ title: "Smazat"
139
231
  });
140
232
  return react_1.default.createElement(action_cell_1.ActionCell, { buttons: buttons, visibleButtonsCount: 3 });
141
- },
142
- }
143
- : undefined);
144
- return (react_1.default.createElement(Layout, { appName: (_g = props.appName) !== null && _g !== void 0 ? _g : "", key: props.entityAlias, title: (_k = (_h = props.title) !== null && _h !== void 0 ? _h : (_j = props.metaSchema) === null || _j === void 0 ? void 0 : _j.title) !== null && _k !== void 0 ? _k : "" },
145
- react_1.default.createElement("div", { className: "mb-10" },
146
- react_1.default.createElement(data_grid_1.DataGrid, { NoRowsFallback: (_l = props.ui) === null || _l === void 0 ? void 0 : _l.NoRowsFallback, SelectedRowsToolbarActions: (_m = props.ui) === null || _m === void 0 ? void 0 : _m.SelectedRowsToolbarActions, actionCell: actionCell, actions: actions, bodyCells: (_o = props.ui) === null || _o === void 0 ? void 0 : _o.BodyCells, customActions: cActions, data: data, error: error, filterHandlers: (_p = props.ui) === null || _p === void 0 ? void 0 : _p.FilterHandlers, getCsvDownloadUrl: (r) => `/api/cms/datagrid/export/${props.entityAlias}?${(0, qs_1.stringify)(r)}`, gridName: props.entityAlias, isLoading: isLoading, isRowsSelectable: props.selectable, reload: reload, rowHeight: props.rowHeight, schema: props.gridSchema, state: state }))));
233
+ }
234
+ } : undefined);
235
+ $[28] = actionColumnButtonsCount;
236
+ $[29] = actionsBag;
237
+ $[30] = props;
238
+ $[31] = t11;
239
+ }
240
+ else {
241
+ t11 = $[31];
242
+ }
243
+ const actionCell = t11;
244
+ const t12 = (_k = props.appName) !== null && _k !== void 0 ? _k : "";
245
+ const t13 = (_o = (_l = props.title) !== null && _l !== void 0 ? _l : (_m = props.metaSchema) === null || _m === void 0 ? void 0 : _m.title) !== null && _o !== void 0 ? _o : "";
246
+ const t14 = (_p = props.ui) === null || _p === void 0 ? void 0 : _p.NoRowsFallback;
247
+ const t15 = (_q = props.ui) === null || _q === void 0 ? void 0 : _q.SelectedRowsToolbarActions;
248
+ const t16 = (_r = props.ui) === null || _r === void 0 ? void 0 : _r.BodyCells;
249
+ const t17 = (_s = props.ui) === null || _s === void 0 ? void 0 : _s.FilterHandlers;
250
+ let t18;
251
+ if ($[32] !== props.entityAlias) {
252
+ t18 = r => `/api/cms/datagrid/export/${props.entityAlias}?${(0, qs_1.stringify)(r)}`;
253
+ $[32] = props.entityAlias;
254
+ $[33] = t18;
255
+ }
256
+ else {
257
+ t18 = $[33];
258
+ }
259
+ let t19;
260
+ if ($[34] !== actionCell || $[35] !== actions || $[36] !== cActions || $[37] !== data || $[38] !== error || $[39] !== isLoading || $[40] !== props.entityAlias || $[41] !== props.gridSchema || $[42] !== props.rowHeight || $[43] !== props.selectable || $[44] !== reload || $[45] !== state || $[46] !== t14 || $[47] !== t15 || $[48] !== t16 || $[49] !== t17 || $[50] !== t18) {
261
+ t19 = react_1.default.createElement("div", { className: "mb-10" },
262
+ react_1.default.createElement(data_grid_1.DataGrid, { NoRowsFallback: t14, SelectedRowsToolbarActions: t15, actionCell: actionCell, actions: actions, bodyCells: t16, customActions: cActions, data: data, error: error, filterHandlers: t17, getCsvDownloadUrl: t18, gridName: props.entityAlias, isLoading: isLoading, isRowsSelectable: props.selectable, reload: reload, rowHeight: props.rowHeight, schema: props.gridSchema, state: state }));
263
+ $[34] = actionCell;
264
+ $[35] = actions;
265
+ $[36] = cActions;
266
+ $[37] = data;
267
+ $[38] = error;
268
+ $[39] = isLoading;
269
+ $[40] = props.entityAlias;
270
+ $[41] = props.gridSchema;
271
+ $[42] = props.rowHeight;
272
+ $[43] = props.selectable;
273
+ $[44] = reload;
274
+ $[45] = state;
275
+ $[46] = t14;
276
+ $[47] = t15;
277
+ $[48] = t16;
278
+ $[49] = t17;
279
+ $[50] = t18;
280
+ $[51] = t19;
281
+ }
282
+ else {
283
+ t19 = $[51];
284
+ }
285
+ let t20;
286
+ if ($[52] !== Layout || $[53] !== props.entityAlias || $[54] !== t12 || $[55] !== t13 || $[56] !== t19) {
287
+ t20 = react_1.default.createElement(Layout, { appName: t12, key: props.entityAlias, title: t13 }, t19);
288
+ $[52] = Layout;
289
+ $[53] = props.entityAlias;
290
+ $[54] = t12;
291
+ $[55] = t13;
292
+ $[56] = t19;
293
+ $[57] = t20;
294
+ }
295
+ else {
296
+ t20 = $[57];
297
+ }
298
+ return t20;
147
299
  }
148
300
  GridPageComponent.displayName = "GridPageComponent";
149
301
  /** @deprecated - use custom DataGrid on project */
150
- const GridPage = (config) => {
302
+ const GridPage = config => {
151
303
  var _a;
152
304
  function Component() {
153
305
  var _a, _b;
306
+ const $ = (0, compiler_runtime_1.c)(11);
154
307
  const router = (0, router_2.useRouter)();
155
- const userConfigQuery = (0, swr_1.useCmsUserConfigQuery)({ path: { name: `v1--hidden-columns--${config.entityAlias}` } });
308
+ let t0;
309
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
310
+ t0 = {
311
+ path: {
312
+ name: `v1--hidden-columns--${config.entityAlias}`
313
+ }
314
+ };
315
+ $[0] = t0;
316
+ }
317
+ else {
318
+ t0 = $[0];
319
+ }
320
+ const userConfigQuery = (0, swr_1.useCmsUserConfigQuery)(t0);
156
321
  const cmsTablesQuery = (0, swr_1.useCmsTablesQuery)();
157
- const dataGridSchemaQuery = (0, swr_1.useDatagridGetSchemaQuery)({ path: { name: config.entityAlias } });
322
+ let t1;
323
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
324
+ t1 = {
325
+ path: {
326
+ name: config.entityAlias
327
+ }
328
+ };
329
+ $[1] = t1;
330
+ }
331
+ else {
332
+ t1 = $[1];
333
+ }
334
+ const dataGridSchemaQuery = (0, swr_1.useDatagridGetSchemaQuery)(t1);
158
335
  if (cmsTablesQuery.isLoading || dataGridSchemaQuery.isLoading || is_server_1.isServer) {
159
- return (react_1.default.createElement("div", { className: "flex min-h-screen w-full items-center justify-center" },
160
- react_1.default.createElement(loader_1.Loader, null)));
336
+ let t2;
337
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
338
+ t2 = react_1.default.createElement("div", { className: "flex min-h-screen w-full items-center justify-center" },
339
+ react_1.default.createElement(loader_1.Loader, null));
340
+ $[2] = t2;
341
+ }
342
+ else {
343
+ t2 = $[2];
344
+ }
345
+ return t2;
161
346
  }
162
347
  const metadata = (_a = cmsTablesQuery.data) === null || _a === void 0 ? void 0 : _a[config.entityAlias];
163
348
  const schema = dataGridSchemaQuery.data;
164
349
  if ((0, is_nil_1.isNil)(schema) || (0, is_nil_1.isNil)(metadata)) {
165
- return react_1.default.createElement("div", null, "Omlouv\u00E1me se, n\u011Bco se pokazilo.");
350
+ let t2;
351
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
352
+ t2 = react_1.default.createElement("div", null, "Omlouv\u00E1me se, n\u011Bco se pokazilo.");
353
+ $[3] = t2;
354
+ }
355
+ else {
356
+ t2 = $[3];
357
+ }
358
+ return t2;
359
+ }
360
+ let t2;
361
+ if ($[4] !== userConfigQuery.data) {
362
+ t2 = (_b = userConfigQuery.data) !== null && _b !== void 0 ? _b : [];
363
+ $[4] = userConfigQuery.data;
364
+ $[5] = t2;
365
+ }
366
+ else {
367
+ t2 = $[5];
166
368
  }
167
- return (react_1.default.createElement(GridPageComponent, { AddIcon: config.AddIcon, appName: config.appName, customActions: config.customActions, entityAlias: config.entityAlias, getEditUrl: config.getEditUrl, getOpenUrl: config.getOpenUrl, gridSchema: schema, initialHiddenColumns: (_b = userConfigQuery.data) !== null && _b !== void 0 ? _b : [], initialUserConfig: config.initialUserConfig, loader: config.loader, metaSchema: metadata, onAdd: config.onAdd, onAddTitle: config.onAddTitle, onEdit: config.onEdit, onOpen: config.onOpen, onRemove: config.onRemove, query: router.query, rowHeight: config.rowHeight, selectable: config.selectable, title: config.title, ui: config.ui }));
369
+ let t3;
370
+ if ($[6] !== metadata || $[7] !== router.query || $[8] !== schema || $[9] !== t2) {
371
+ t3 = react_1.default.createElement(GridPageComponent, { AddIcon: config.AddIcon, appName: config.appName, customActions: config.customActions, entityAlias: config.entityAlias, getEditUrl: config.getEditUrl, getOpenUrl: config.getOpenUrl, gridSchema: schema, initialHiddenColumns: t2, initialUserConfig: config.initialUserConfig, loader: config.loader, metaSchema: metadata, onAdd: config.onAdd, onAddTitle: config.onAddTitle, onEdit: config.onEdit, onOpen: config.onOpen, onRemove: config.onRemove, query: router.query, rowHeight: config.rowHeight, selectable: config.selectable, title: config.title, ui: config.ui });
372
+ $[6] = metadata;
373
+ $[7] = router.query;
374
+ $[8] = schema;
375
+ $[9] = t2;
376
+ $[10] = t3;
377
+ }
378
+ else {
379
+ t3 = $[10];
380
+ }
381
+ return t3;
168
382
  }
169
- return (0, restricted_page_1.restrictedPage)(Component, { allowedRole: (_a = config.allowedRoles) !== null && _a !== void 0 ? _a : ["ROLE_ROOT"] });
383
+ return (0, restricted_page_1.restrictedPage)(Component, {
384
+ allowedRole: (_a = config.allowedRoles) !== null && _a !== void 0 ? _a : ["ROLE_ROOT"]
385
+ });
170
386
  };
171
387
  exports.GridPage = GridPage;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The pathname of a URL kept in Next.js's `history.state` (`url` or `as`), resolved against the current page.
3
+ * Node's legacy `url.parse` used to do this: it is deprecated (DEP0169), dragged a `url` polyfill into the
4
+ * browser bundle, and for a missing URL returned `null`, which ended up in the address as "null?…".
5
+ */
6
+ export declare function historyPathname(url: string | undefined): string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.historyPathname = historyPathname;
4
+ /**
5
+ * The pathname of a URL kept in Next.js's `history.state` (`url` or `as`), resolved against the current page.
6
+ * Node's legacy `url.parse` used to do this: it is deprecated (DEP0169), dragged a `url` polyfill into the
7
+ * browser bundle, and for a missing URL returned `null`, which ended up in the address as "null?…".
8
+ */
9
+ function historyPathname(url) {
10
+ return new URL(url !== null && url !== void 0 ? url : "", window.location.href).pathname;
11
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const history_pathname_1 = require("./history-pathname");
4
+ test("takes the pathname of a history-state URL", () => {
5
+ expect((0, history_pathname_1.historyPathname)("/cms/grid/[entity]?entity=user&filter=abc")).toBe("/cms/grid/[entity]");
6
+ });
7
+ test("falls back to the current page when history state has no URL", () => {
8
+ window.history.replaceState(null, "", "/cms/grid/user?x=1");
9
+ expect((0, history_pathname_1.historyPathname)(undefined)).toBe("/cms/grid/user");
10
+ expect((0, history_pathname_1.historyPathname)("")).toBe("/cms/grid/user");
11
+ });
@@ -1,17 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useHiddenColumns = void 0;
4
+ const compiler_runtime_1 = require("react/compiler-runtime");
4
5
  const react_1 = require("react");
5
6
  const api_1 = require("../../api");
6
7
  const useHiddenColumns = (entityAlias, initialHiddenColumns) => {
8
+ const $ = (0, compiler_runtime_1.c)(5);
7
9
  const [hiddenColumns, setHiddenColumns] = (0, react_1.useState)(initialHiddenColumns);
8
- const onChangeHiddenColumns = (0, react_1.useCallback)((columns) => {
9
- setHiddenColumns(columns);
10
- (0, api_1.userConfigSave)(`v1--hidden-columns--${entityAlias}`, columns);
11
- }, [entityAlias]);
12
- return {
13
- hiddenColumns,
14
- onChangeHiddenColumns,
15
- };
10
+ let t0;
11
+ if ($[0] !== entityAlias) {
12
+ t0 = columns => {
13
+ setHiddenColumns(columns);
14
+ (0, api_1.userConfigSave)(`v1--hidden-columns--${entityAlias}`, columns);
15
+ };
16
+ $[0] = entityAlias;
17
+ $[1] = t0;
18
+ }
19
+ else {
20
+ t0 = $[1];
21
+ }
22
+ const onChangeHiddenColumns = t0;
23
+ let t1;
24
+ if ($[2] !== hiddenColumns || $[3] !== onChangeHiddenColumns) {
25
+ t1 = {
26
+ hiddenColumns,
27
+ onChangeHiddenColumns
28
+ };
29
+ $[2] = hiddenColumns;
30
+ $[3] = onChangeHiddenColumns;
31
+ $[4] = t1;
32
+ }
33
+ else {
34
+ t1 = $[4];
35
+ }
36
+ return t1;
16
37
  };
17
38
  exports.useHiddenColumns = useHiddenColumns;