@uxf/cms 14.0.0 → 14.3.1

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 (54) hide show
  1. package/api/index.d.ts +2 -0
  2. package/api/index.js +2 -2
  3. package/api/swr.js +71 -6
  4. package/content-builder/content-builder-header.js +42 -3
  5. package/content-builder/content-builder.js +140 -18
  6. package/content-builder/content-builder.stories.js +24 -5
  7. package/content-builder/forms/content-builder-basic-form.js +212 -25
  8. package/content-builder/forms/content-builder-seo-form.js +92 -8
  9. package/forms/change-password-form/change-password-form.js +152 -15
  10. package/forms/components/wysiwyg-input/wysiwyg-input.js +188 -50
  11. package/forms/components/wysiwyg-input/wysiwyg-input.stories.js +127 -22
  12. package/forms/forgotten-password-form/forgotten-password-form.js +119 -15
  13. package/forms/invite-user-form/invite-user-form.js +171 -13
  14. package/forms/login-form/login-form.js +122 -13
  15. package/forms/renew-password-form/renew-password-form.js +148 -16
  16. package/lib/api/create-axios-instance.d.ts +3 -1
  17. package/lib/api/create-axios-request.d.ts +3 -1
  18. package/lib/api/create-axios-request.js +9 -2
  19. package/lib/api/create-axios-request.test.d.ts +1 -0
  20. package/lib/api/create-axios-request.test.js +32 -0
  21. package/lib/layout/layout.js +126 -28
  22. package/lib/layout/sidebar.js +65 -26
  23. package/lib/menu/ui/sub-menu/sub-menu-mobile.js +62 -14
  24. package/lib/menu/ui/sub-menu/sub-menu.js +66 -14
  25. package/lib/menu/ui/sub-menu/use-sub-menu.js +137 -34
  26. package/lib/menu/ui/user-menu.js +178 -14
  27. package/package.json +20 -20
  28. package/pages/content-builder/components/form-content.js +189 -38
  29. package/pages/content-builder/components/form-root-fields.js +3 -3
  30. package/pages/content-builder/components/form.js +142 -27
  31. package/pages/content-builder/components/header.js +44 -5
  32. package/pages/content-builder/content/feature-section.js +67 -15
  33. package/pages/content-builder/content/gallery.js +38 -6
  34. package/pages/content-builder/content/hero-section.js +39 -6
  35. package/pages/content-builder/content/people.js +64 -13
  36. package/pages/content-builder/content/wysiwyg.js +60 -6
  37. package/pages/content-builder/content-builder-page.js +120 -48
  38. package/pages/content-builder/content-field.js +216 -35
  39. package/pages/content-builder/content-header.js +100 -53
  40. package/pages/content-builder/context/details-visibility-context.js +95 -17
  41. package/pages/forgotten-password-page/forgotten-password-page.js +29 -46
  42. package/pages/grid-page/grid-page.js +291 -75
  43. package/pages/grid-page/use-hidden-columns.js +29 -8
  44. package/pages/invite-user-page/invite-user-page.js +39 -16
  45. package/pages/login-page/login-page.js +44 -50
  46. package/pages/renew-password-page/renew-password-page.js +35 -43
  47. package/security/restricted-page.js +88 -10
  48. package/security/use-logged-user.js +33 -8
  49. package/ui/avatar/avatar.js +3 -2
  50. package/ui/copy-to-clipboard/copy-to-clipboard.js +57 -44
  51. package/ui/copy-to-clipboard-button/copy-to-clipboard-button.js +47 -46
  52. package/utils/remove-confirm-handler.js +80 -11
  53. package/utils/use-viewport-height.js +25 -7
  54. package/utils/use-visual-viewport-height.js +5 -2
package/api/index.d.ts CHANGED
@@ -149,6 +149,8 @@ export declare function autocomplete(ctx: any, path: {
149
149
  }, query: {
150
150
  term: string;
151
151
  limit?: number;
152
+ }, options?: {
153
+ signal?: AbortSignal;
152
154
  }): AxiosPromise<AutocompleteResultResponse[]>;
153
155
  export declare function saveFormValues<T extends Record<string, any>>(ctx: any, path: {
154
156
  entityAlias: string;
package/api/index.js CHANGED
@@ -57,8 +57,8 @@ function getFormValues(ctx, path) {
57
57
  function login(ctx, body) {
58
58
  return axiosRequest(ctx, "/api/login", "post", body, null);
59
59
  }
60
- function autocomplete(ctx, path, query) {
61
- return axiosRequest(ctx, `/api/cms/autocomplete/${path.name}`, "get", null, query);
60
+ function autocomplete(ctx, path, query, options) {
61
+ return axiosRequest(ctx, `/api/cms/autocomplete/${path.name}`, "get", null, query, options);
62
62
  }
63
63
  function saveFormValues(ctx, path, body) {
64
64
  return path.id
package/api/swr.js CHANGED
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.useDatagridGetSchemaQuery = exports.useCmsTablesQuery = exports.useCmsMeQuery = exports.useCmsUserConfigUpdateMutation = exports.useCmsUserConfigQuery = exports._fetch = exports.ApiError = void 0;
7
+ const compiler_runtime_1 = require("react/compiler-runtime");
7
8
  const swr_1 = __importDefault(require("swr"));
8
9
  const mutation_1 = __importDefault(require("swr/mutation"));
9
10
  class ApiError extends Error {
@@ -19,7 +20,7 @@ const _fetch = (url, method = "GET", body = undefined) => {
19
20
  var _a;
20
21
  return fetch(((_a = process.env.API_URL) !== null && _a !== void 0 ? _a : "") + url, {
21
22
  method,
22
- body: typeof body !== "undefined" ? JSON.stringify(body) : undefined,
23
+ body: typeof body !== "undefined" ? JSON.stringify(body) : undefined
23
24
  }).then(async (res) => {
24
25
  const data = await res.json();
25
26
  if (!res.ok) {
@@ -29,15 +30,79 @@ const _fetch = (url, method = "GET", body = undefined) => {
29
30
  });
30
31
  };
31
32
  exports._fetch = _fetch;
32
- const useCmsUserConfigQuery = (config, options = {}) => (0, swr_1.default)(config.skip !== true ? `/api/cms/user-config/${config.path.name}` : null, options);
33
+ // UXF\CMS\Http\Request\Cms\SaveUserConfigRequestBody
34
+ // UXF\CMS\Http\Response\UserResponse
35
+ // UXF\Core\Contract\Metadata\Metadata
36
+ const useCmsUserConfigQuery = (config, t0) => {
37
+ const $ = (0, compiler_runtime_1.c)(2);
38
+ let t1;
39
+ if ($[0] !== t0) {
40
+ t1 = t0 === undefined ? {} : t0;
41
+ $[0] = t0;
42
+ $[1] = t1;
43
+ }
44
+ else {
45
+ t1 = $[1];
46
+ }
47
+ const options = t1;
48
+ return (0, swr_1.default)(config.skip !== true ? `/api/cms/user-config/${config.path.name}` : null, options);
49
+ };
33
50
  exports.useCmsUserConfigQuery = useCmsUserConfigQuery;
34
- const useCmsUserConfigUpdateMutation = (config, options = undefined) => (0, mutation_1.default)(`/api/cms/user-config/${config.path.name}`, (url, { arg: body }) => (0, exports._fetch)(url, "PUT", body), options);
51
+ const useCmsUserConfigUpdateMutation = (config, t0) => {
52
+ const options = t0 === undefined ? undefined : t0;
53
+ return (0, mutation_1.default)(`/api/cms/user-config/${config.path.name}`, _temp, options);
54
+ };
35
55
  exports.useCmsUserConfigUpdateMutation = useCmsUserConfigUpdateMutation;
36
- const useCmsMeQuery = (config = {}, options = {}) => (0, swr_1.default)(config.skip !== true ? `/api/cms/me` : null, options);
56
+ const useCmsMeQuery = (t0, t1) => {
57
+ const $ = (0, compiler_runtime_1.c)(2);
58
+ const config = t0 === undefined ? {} : t0;
59
+ let t2;
60
+ if ($[0] !== t1) {
61
+ t2 = t1 === undefined ? {} : t1;
62
+ $[0] = t1;
63
+ $[1] = t2;
64
+ }
65
+ else {
66
+ t2 = $[1];
67
+ }
68
+ const options = t2;
69
+ return (0, swr_1.default)(config.skip !== true ? "/api/cms/me" : null, options);
70
+ };
37
71
  exports.useCmsMeQuery = useCmsMeQuery;
38
72
  /** @deprecated will be removed - schemas are generated */
39
- const useCmsTablesQuery = (config = {}, options = {}) => (0, swr_1.default)(config.skip !== true ? `/api/cms/tables` : null, options);
73
+ const useCmsTablesQuery = (t0, t1) => {
74
+ const $ = (0, compiler_runtime_1.c)(2);
75
+ const config = t0 === undefined ? {} : t0;
76
+ let t2;
77
+ if ($[0] !== t1) {
78
+ t2 = t1 === undefined ? {} : t1;
79
+ $[0] = t1;
80
+ $[1] = t2;
81
+ }
82
+ else {
83
+ t2 = $[1];
84
+ }
85
+ const options = t2;
86
+ return (0, swr_1.default)(config.skip !== true ? "/api/cms/tables" : null, options);
87
+ };
40
88
  exports.useCmsTablesQuery = useCmsTablesQuery;
41
89
  /** @deprecated will be removed - schemas are generated */
42
- const useDatagridGetSchemaQuery = (config, options = {}) => (0, swr_1.default)(config.skip !== true ? `/api/cms/datagrid/schema/${config.path.name}` : null, options);
90
+ const useDatagridGetSchemaQuery = (config, t0) => {
91
+ const $ = (0, compiler_runtime_1.c)(2);
92
+ let t1;
93
+ if ($[0] !== t0) {
94
+ t1 = t0 === undefined ? {} : t0;
95
+ $[0] = t0;
96
+ $[1] = t1;
97
+ }
98
+ else {
99
+ t1 = $[1];
100
+ }
101
+ const options = t1;
102
+ return (0, swr_1.default)(config.skip !== true ? `/api/cms/datagrid/schema/${config.path.name}` : null, options);
103
+ };
43
104
  exports.useDatagridGetSchemaQuery = useDatagridGetSchemaQuery;
105
+ function _temp(url, t0) {
106
+ const { arg: body } = t0;
107
+ return (0, exports._fetch)(url, "PUT", body);
108
+ }
@@ -4,12 +4,51 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ContentBuilderHeader = ContentBuilderHeader;
7
+ const compiler_runtime_1 = require("react/compiler-runtime");
7
8
  const translations_1 = require("@uxf/core-react/translations");
8
9
  const button_1 = require("@uxf/ui/button");
9
10
  const react_1 = __importDefault(require("react"));
10
11
  function ContentBuilderHeader(props) {
12
+ const $ = (0, compiler_runtime_1.c)(9);
11
13
  const t = (0, translations_1.useUxfTranslation)();
12
- return (react_1.default.createElement("div", { className: "uxf-cb__header" },
13
- react_1.default.createElement("h1", { className: "uxg-cb__header-title uxf-typo-h5" }, props.title),
14
- react_1.default.createElement(button_1.Button, { type: "submit" }, t("uxf-cms-content-builder:header.save"))));
14
+ let t0;
15
+ if ($[0] !== props.title) {
16
+ t0 = react_1.default.createElement("h1", { className: "uxg-cb__header-title uxf-typo-h5" }, props.title);
17
+ $[0] = props.title;
18
+ $[1] = t0;
19
+ }
20
+ else {
21
+ t0 = $[1];
22
+ }
23
+ let t1;
24
+ if ($[2] !== t) {
25
+ t1 = t("uxf-cms-content-builder:header.save");
26
+ $[2] = t;
27
+ $[3] = t1;
28
+ }
29
+ else {
30
+ t1 = $[3];
31
+ }
32
+ let t2;
33
+ if ($[4] !== t1) {
34
+ t2 = react_1.default.createElement(button_1.Button, { type: "submit" }, t1);
35
+ $[4] = t1;
36
+ $[5] = t2;
37
+ }
38
+ else {
39
+ t2 = $[5];
40
+ }
41
+ let t3;
42
+ if ($[6] !== t0 || $[7] !== t2) {
43
+ t3 = react_1.default.createElement("div", { className: "uxf-cb__header" },
44
+ t0,
45
+ t2);
46
+ $[6] = t0;
47
+ $[7] = t2;
48
+ $[8] = t3;
49
+ }
50
+ else {
51
+ t3 = $[8];
52
+ }
53
+ return t3;
15
54
  }
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.ContentBuilder = ContentBuilder;
37
+ const compiler_runtime_1 = require("react/compiler-runtime");
37
38
  const translations_1 = require("@uxf/core-react/translations");
38
39
  const tabs_1 = require("@uxf/ui/tabs");
39
40
  const react_1 = __importStar(require("react"));
@@ -44,29 +45,150 @@ const content_builder_root_1 = require("./content-builder-root");
44
45
  const content_builder_sidebar_1 = require("./content-builder-sidebar");
45
46
  const content_builder_basic_form_1 = require("./forms/content-builder-basic-form");
46
47
  const content_builder_seo_form_1 = require("./forms/content-builder-seo-form");
47
- var TabName;
48
- (function (TabName) {
48
+ var TabName = /*#__PURE__*/ function (TabName) {
49
49
  TabName["Basic"] = "basic";
50
50
  TabName["Seo"] = "seo";
51
- })(TabName || (TabName = {}));
51
+ return TabName;
52
+ }(TabName || {});
52
53
  function ContentBuilder(props) {
53
54
  var _a, _b;
55
+ const $ = (0, compiler_runtime_1.c)(39);
54
56
  const generatedId = (0, react_1.useId)();
55
57
  const [activeTab, setActiveTab] = (0, react_1.useState)(TabName.Basic);
56
58
  const t = (0, translations_1.useUxfTranslation)();
57
- return (react_1.default.createElement(content_builder_root_1.ContentBuilderRoot, { formApi: props.formApi, id: (_a = props.id) !== null && _a !== void 0 ? _a : generatedId, onSubmit: props.onSubmit },
58
- react_1.default.createElement(content_builder_header_1.ContentBuilderHeader, { title: (_b = props.title) !== null && _b !== void 0 ? _b : t("uxf-cms-content-builder:settings.default-title") }),
59
- react_1.default.createElement(content_builder_body_1.ContentBuilderBody, null,
60
- react_1.default.createElement(content_builder_1.ContentField, { contentComponents: props.ContentComponents,
61
- // react-hook-form 7.85 přidalo do Control člen `_options.validate`, který je
62
- // kontravariantní v TFieldValues, takže konkrétní Control<ContentBuilderFormData>
63
- // už není přiřaditelný do volného Control<any>, na kterém stojí celý
64
- // content-builder plumbing (ContentProps, FormContent, FormRootFields).
65
- control: props.formApi.control, name: "content" }),
66
- react_1.default.createElement(content_builder_sidebar_1.ContentBuilderSidebar, { title: t("uxf-cms-content-builder:settings.settings") },
67
- react_1.default.createElement(tabs_1.Tabs, { onChange: setActiveTab, value: activeTab },
68
- react_1.default.createElement(tabs_1.Tabs.Panel, { isAlwaysMounted: true, label: t("uxf-cms-content-builder:settings.basic"), name: TabName.Basic },
69
- react_1.default.createElement(content_builder_basic_form_1.ContentBuilderBasicForm, { className: "space-y-8", fields: props.fields, formApi: props.formApi, uploadNamespace: props.uploadNamespace })),
70
- react_1.default.createElement(tabs_1.Tabs.Panel, { isAlwaysMounted: true, label: "SEO", name: TabName.Seo },
71
- react_1.default.createElement(content_builder_seo_form_1.ContentBuilderSeoForm, { className: "space-y-8", fields: props.fields, formApi: props.formApi, uploadNamespace: props.uploadNamespace })))))));
59
+ const t0 = props.formApi;
60
+ const t1 = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
61
+ const t2 = props.onSubmit;
62
+ let t3;
63
+ if ($[0] !== props.title || $[1] !== t) {
64
+ t3 = (_b = props.title) !== null && _b !== void 0 ? _b : t("uxf-cms-content-builder:settings.default-title");
65
+ $[0] = props.title;
66
+ $[1] = t;
67
+ $[2] = t3;
68
+ }
69
+ else {
70
+ t3 = $[2];
71
+ }
72
+ let t4;
73
+ if ($[3] !== t3) {
74
+ t4 = react_1.default.createElement(content_builder_header_1.ContentBuilderHeader, { title: t3 });
75
+ $[3] = t3;
76
+ $[4] = t4;
77
+ }
78
+ else {
79
+ t4 = $[4];
80
+ }
81
+ const t5 = props.formApi.control;
82
+ let t6;
83
+ if ($[5] !== props.ContentComponents || $[6] !== t5) {
84
+ t6 = react_1.default.createElement(content_builder_1.ContentField, { contentComponents: props.ContentComponents, control: t5, name: "content" });
85
+ $[5] = props.ContentComponents;
86
+ $[6] = t5;
87
+ $[7] = t6;
88
+ }
89
+ else {
90
+ t6 = $[7];
91
+ }
92
+ let t7;
93
+ if ($[8] !== t) {
94
+ t7 = t("uxf-cms-content-builder:settings.settings");
95
+ $[8] = t;
96
+ $[9] = t7;
97
+ }
98
+ else {
99
+ t7 = $[9];
100
+ }
101
+ let t8;
102
+ if ($[10] !== t) {
103
+ t8 = t("uxf-cms-content-builder:settings.basic");
104
+ $[10] = t;
105
+ $[11] = t8;
106
+ }
107
+ else {
108
+ t8 = $[11];
109
+ }
110
+ let t9;
111
+ if ($[12] !== props.fields || $[13] !== props.formApi || $[14] !== props.uploadNamespace) {
112
+ t9 = react_1.default.createElement(content_builder_basic_form_1.ContentBuilderBasicForm, { className: "space-y-8", fields: props.fields, formApi: props.formApi, uploadNamespace: props.uploadNamespace });
113
+ $[12] = props.fields;
114
+ $[13] = props.formApi;
115
+ $[14] = props.uploadNamespace;
116
+ $[15] = t9;
117
+ }
118
+ else {
119
+ t9 = $[15];
120
+ }
121
+ let t10;
122
+ if ($[16] !== t8 || $[17] !== t9) {
123
+ t10 = react_1.default.createElement(tabs_1.Tabs.Panel, { isAlwaysMounted: true, label: t8, name: TabName.Basic }, t9);
124
+ $[16] = t8;
125
+ $[17] = t9;
126
+ $[18] = t10;
127
+ }
128
+ else {
129
+ t10 = $[18];
130
+ }
131
+ let t11;
132
+ if ($[19] !== props.fields || $[20] !== props.formApi || $[21] !== props.uploadNamespace) {
133
+ t11 = react_1.default.createElement(tabs_1.Tabs.Panel, { isAlwaysMounted: true, label: "SEO", name: TabName.Seo },
134
+ react_1.default.createElement(content_builder_seo_form_1.ContentBuilderSeoForm, { className: "space-y-8", fields: props.fields, formApi: props.formApi, uploadNamespace: props.uploadNamespace }));
135
+ $[19] = props.fields;
136
+ $[20] = props.formApi;
137
+ $[21] = props.uploadNamespace;
138
+ $[22] = t11;
139
+ }
140
+ else {
141
+ t11 = $[22];
142
+ }
143
+ let t12;
144
+ if ($[23] !== activeTab || $[24] !== t10 || $[25] !== t11) {
145
+ t12 = react_1.default.createElement(tabs_1.Tabs, { onChange: setActiveTab, value: activeTab },
146
+ t10,
147
+ t11);
148
+ $[23] = activeTab;
149
+ $[24] = t10;
150
+ $[25] = t11;
151
+ $[26] = t12;
152
+ }
153
+ else {
154
+ t12 = $[26];
155
+ }
156
+ let t13;
157
+ if ($[27] !== t12 || $[28] !== t7) {
158
+ t13 = react_1.default.createElement(content_builder_sidebar_1.ContentBuilderSidebar, { title: t7 }, t12);
159
+ $[27] = t12;
160
+ $[28] = t7;
161
+ $[29] = t13;
162
+ }
163
+ else {
164
+ t13 = $[29];
165
+ }
166
+ let t14;
167
+ if ($[30] !== t13 || $[31] !== t6) {
168
+ t14 = react_1.default.createElement(content_builder_body_1.ContentBuilderBody, null,
169
+ t6,
170
+ t13);
171
+ $[30] = t13;
172
+ $[31] = t6;
173
+ $[32] = t14;
174
+ }
175
+ else {
176
+ t14 = $[32];
177
+ }
178
+ let t15;
179
+ if ($[33] !== props.formApi || $[34] !== props.onSubmit || $[35] !== t1 || $[36] !== t14 || $[37] !== t4) {
180
+ t15 = react_1.default.createElement(content_builder_root_1.ContentBuilderRoot, { formApi: t0, id: t1, onSubmit: t2 },
181
+ t4,
182
+ t14);
183
+ $[33] = props.formApi;
184
+ $[34] = props.onSubmit;
185
+ $[35] = t1;
186
+ $[36] = t14;
187
+ $[37] = t4;
188
+ $[38] = t15;
189
+ }
190
+ else {
191
+ t15 = $[38];
192
+ }
193
+ return t15;
72
194
  }
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Default = Default;
7
+ const compiler_runtime_1 = require("react/compiler-runtime");
7
8
  const react_1 = __importDefault(require("react"));
8
9
  const content_builder_1 = require("@uxf/cms/content-builder");
9
10
  const use_content_builder_form_api_1 = require("@uxf/cms/content-builder/use-content-builder-form-api");
@@ -11,9 +12,27 @@ const people_1 = require("@uxf/cms/pages/content-builder/content/people");
11
12
  const wysiwyg_1 = require("@uxf/cms/pages/content-builder/content/wysiwyg");
12
13
  const Contents = [wysiwyg_1.Wysiwyg, people_1.People];
13
14
  function Default() {
14
- const formApi = (0, use_content_builder_form_api_1.useContentBuilderFormApi)({
15
- defaultValues: (0, content_builder_1.mapContentResponseToFormData)(null),
16
- });
17
- return (react_1.default.createElement("div", { className: "bg-neutral-200" },
18
- react_1.default.createElement(content_builder_1.ContentBuilder, { ContentComponents: Contents, formApi: formApi, onSubmit: console.log })));
15
+ const $ = (0, compiler_runtime_1.c)(3);
16
+ let t0;
17
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
18
+ t0 = {
19
+ defaultValues: (0, content_builder_1.mapContentResponseToFormData)(null)
20
+ };
21
+ $[0] = t0;
22
+ }
23
+ else {
24
+ t0 = $[0];
25
+ }
26
+ const formApi = (0, use_content_builder_form_api_1.useContentBuilderFormApi)(t0);
27
+ let t1;
28
+ if ($[1] !== formApi) {
29
+ t1 = react_1.default.createElement("div", { className: "bg-neutral-200" },
30
+ react_1.default.createElement(content_builder_1.ContentBuilder, { ContentComponents: Contents, formApi: formApi, onSubmit: console.log }));
31
+ $[1] = formApi;
32
+ $[2] = t1;
33
+ }
34
+ else {
35
+ t1 = $[2];
36
+ }
37
+ return t1;
19
38
  }
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.ContentBuilderBasicForm = ContentBuilderBasicForm;
7
+ const compiler_runtime_1 = require("react/compiler-runtime");
7
8
  const is_empty_1 = require("@uxf/core/utils/is-empty");
8
9
  const is_nil_1 = require("@uxf/core/utils/is-nil");
9
10
  const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
@@ -19,32 +20,218 @@ const text_input_1 = require("@uxf/form/text-input");
19
20
  const textarea_1 = require("@uxf/form/textarea");
20
21
  const react_1 = __importDefault(require("react"));
21
22
  const api_1 = require("../../api");
22
- const visibilityLevelOptions = [
23
- { id: "PRIVATE", label: "Privátní" },
24
- { id: "PUBLIC_WITHOUT_SITEMAP", label: "Veřejný bez sitemapy" },
25
- { id: "PUBLIC", label: "Veřejný" },
26
- ];
23
+ const visibilityLevelOptions = [{
24
+ id: "PRIVATE",
25
+ label: "Privátní"
26
+ }, {
27
+ id: "PUBLIC_WITHOUT_SITEMAP",
28
+ label: "Veřejný bez sitemapy"
29
+ }, {
30
+ id: "PUBLIC",
31
+ label: "Veřejný"
32
+ }];
27
33
  // eslint-disable-next-line complexity
28
34
  function ContentBuilderBasicForm(props) {
29
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
30
- const seoName = props.formApi.watch("seo.name");
35
+ var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28;
36
+ const $ = (0, compiler_runtime_1.c)(66);
37
+ let t0;
38
+ if ($[0] !== props.formApi) {
39
+ t0 = props.formApi.watch("seo.name");
40
+ $[0] = props.formApi;
41
+ $[1] = t0;
42
+ }
43
+ else {
44
+ t0 = $[1];
45
+ }
46
+ const seoName = t0;
31
47
  const t = (0, translations_1.useUxfTranslation)();
32
- const onBlurName = (event) => {
33
- if ((0, is_nil_1.isNil)(seoName) || (0, is_empty_1.isEmpty)(seoName)) {
34
- props.formApi.setValue("seo.name", (0, slugify_1.slugify)(event.target.value));
35
- }
36
- };
37
- return (react_1.default.createElement("div", { className: props.className },
38
- ((_b = (_a = props.fields) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.options) && (react_1.default.createElement(select_1.Select, { control: props.formApi.control, isReadOnly: props.fields.type.isReadOnly, isRequired: true, label: "Typ", name: "type", options: props.fields.type.options })),
39
- react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, isRequired: true, label: t("uxf-cms-content-builder:basic-form.title"), name: "name", onBlur: onBlurName, type: "text" }),
40
- !((_d = (_c = props.fields) === null || _c === void 0 ? void 0 : _c.publishedAt) === null || _d === void 0 ? void 0 : _d.isHidden) && (react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { control: props.formApi.control, isRequired: true, label: t("uxf-cms-content-builder:basic-form.published-at"), name: "publishedAt" })),
41
- !((_f = (_e = props.fields) === null || _e === void 0 ? void 0 : _e.perex) === null || _f === void 0 ? void 0 : _f.isHidden) && (react_1.default.createElement(textarea_1.Textarea, { control: props.formApi.control, label: t("uxf-cms-content-builder:basic-form.perex"), name: "perex", rows: 3 })),
42
- ((_h = (_g = props.fields) === null || _g === void 0 ? void 0 : _g.authorText) === null || _h === void 0 ? void 0 : _h.isHidden) === false && (react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, label: t("uxf-cms-content-builder:basic-form.author"), name: "authorText" })),
43
- !((_k = (_j = props.fields) === null || _j === void 0 ? void 0 : _j.author) === null || _k === void 0 ? void 0 : _k.isHidden) && ((_m = (_l = props.fields) === null || _l === void 0 ? void 0 : _l.author) === null || _m === void 0 ? void 0 : _m.autocomplete) && (react_1.default.createElement(combobox_1.Combobox, { control: props.formApi.control, label: t("uxf-cms-content-builder:basic-form.author"), loadOptions: props.fields.author.autocomplete, name: "author" })),
44
- !((_p = (_o = props.fields) === null || _o === void 0 ? void 0 : _o.category) === null || _p === void 0 ? void 0 : _p.isHidden) && ((_r = (_q = props.fields) === null || _q === void 0 ? void 0 : _q.category) === null || _r === void 0 ? void 0 : _r.autocomplete) && (react_1.default.createElement(combobox_1.Combobox, { control: props.formApi.control, label: "Kategorie", loadOptions: props.fields.category.autocomplete, name: "category" })),
45
- !((_t = (_s = props.fields) === null || _s === void 0 ? void 0 : _s.tags) === null || _t === void 0 ? void 0 : _t.isHidden) && ((_v = (_u = props.fields) === null || _u === void 0 ? void 0 : _u.tags) === null || _v === void 0 ? void 0 : _v.autocomplete) && (react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: props.formApi.control, label: "Tagy", loadOptions: props.fields.tags.autocomplete, name: "tags" })),
46
- !((_x = (_w = props.fields) === null || _w === void 0 ? void 0 : _w.image) === null || _x === void 0 ? void 0 : _x.isHidden) && (react_1.default.createElement(file_input_1.FileInput, { control: props.formApi.control, id: "image", label: t("uxf-cms-content-builder:basic-form.main-image"), name: "image", onUploadFile: (file) => (0, api_1.uploadFile)(file, props.uploadNamespace) })),
47
- !((_z = (_y = props.fields) === null || _y === void 0 ? void 0 : _y.isActive) === null || _z === void 0 ? void 0 : _z.isHidden) && (react_1.default.createElement(checkbox_input_1.CheckboxInput, { control: props.formApi.control, label: t("uxf-cms-content-builder:basic-form.active"), name: "isActive" })),
48
- !((_1 = (_0 = props.fields) === null || _0 === void 0 ? void 0 : _0.visibilityLevel) === null || _1 === void 0 ? void 0 : _1.isHidden) && (react_1.default.createElement(select_1.Select, { control: props.formApi.control, isRequired: true, label: "Viditelnost", name: "visibilityLevel", options: visibilityLevelOptions })),
49
- (0, is_not_nil_1.isNotNil)((_3 = (_2 = props.fields) === null || _2 === void 0 ? void 0 : _2.parent) === null || _3 === void 0 ? void 0 : _3.autocomplete) && (react_1.default.createElement(combobox_1.Combobox, { control: props.formApi.control, label: t("uxf-cms-content-builder:basic-form.parent-article"), loadOptions: props.fields.parent.autocomplete, name: "parent" }))));
48
+ let t1;
49
+ if ($[2] !== props.formApi || $[3] !== seoName) {
50
+ t1 = event => {
51
+ if ((0, is_nil_1.isNil)(seoName) || (0, is_empty_1.isEmpty)(seoName)) {
52
+ props.formApi.setValue("seo.name", (0, slugify_1.slugify)(event.target.value));
53
+ }
54
+ };
55
+ $[2] = props.formApi;
56
+ $[3] = seoName;
57
+ $[4] = t1;
58
+ }
59
+ else {
60
+ t1 = $[4];
61
+ }
62
+ const onBlurName = t1;
63
+ const t2 = props.className;
64
+ let t3;
65
+ if ($[5] !== props.fields || $[6] !== props.formApi.control) {
66
+ t3 = ((_b = (_a = props.fields) === null || _a === void 0 ? void 0 : _a.type) === null || _b === void 0 ? void 0 : _b.options) && react_1.default.createElement(select_1.Select, { control: props.formApi.control, isReadOnly: props.fields.type.isReadOnly, isRequired: true, label: "Typ", name: "type", options: props.fields.type.options });
67
+ $[5] = props.fields;
68
+ $[6] = props.formApi.control;
69
+ $[7] = t3;
70
+ }
71
+ else {
72
+ t3 = $[7];
73
+ }
74
+ const t4 = props.formApi.control;
75
+ let t5;
76
+ if ($[8] !== t) {
77
+ t5 = t("uxf-cms-content-builder:basic-form.title");
78
+ $[8] = t;
79
+ $[9] = t5;
80
+ }
81
+ else {
82
+ t5 = $[9];
83
+ }
84
+ let t6;
85
+ if ($[10] !== onBlurName || $[11] !== props.formApi.control || $[12] !== t5) {
86
+ t6 = react_1.default.createElement(text_input_1.TextInput, { control: t4, isRequired: true, label: t5, name: "name", onBlur: onBlurName, type: "text" });
87
+ $[10] = onBlurName;
88
+ $[11] = props.formApi.control;
89
+ $[12] = t5;
90
+ $[13] = t6;
91
+ }
92
+ else {
93
+ t6 = $[13];
94
+ }
95
+ let t7;
96
+ if ($[14] !== ((_e = (_d = props.fields) === null || _d === void 0 ? void 0 : _d.publishedAt) === null || _e === void 0 ? void 0 : _e.isHidden) || $[15] !== props.formApi.control || $[16] !== t) {
97
+ t7 = !((_g = (_f = props.fields) === null || _f === void 0 ? void 0 : _f.publishedAt) === null || _g === void 0 ? void 0 : _g.isHidden) && react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { control: props.formApi.control, isRequired: true, label: t("uxf-cms-content-builder:basic-form.published-at"), name: "publishedAt" });
98
+ $[14] = (_j = (_h = props.fields) === null || _h === void 0 ? void 0 : _h.publishedAt) === null || _j === void 0 ? void 0 : _j.isHidden;
99
+ $[15] = props.formApi.control;
100
+ $[16] = t;
101
+ $[17] = t7;
102
+ }
103
+ else {
104
+ t7 = $[17];
105
+ }
106
+ let t8;
107
+ if ($[18] !== ((_l = (_k = props.fields) === null || _k === void 0 ? void 0 : _k.perex) === null || _l === void 0 ? void 0 : _l.isHidden) || $[19] !== props.formApi.control || $[20] !== t) {
108
+ t8 = !((_o = (_m = props.fields) === null || _m === void 0 ? void 0 : _m.perex) === null || _o === void 0 ? void 0 : _o.isHidden) && react_1.default.createElement(textarea_1.Textarea, { control: props.formApi.control, label: t("uxf-cms-content-builder:basic-form.perex"), name: "perex", rows: 3 });
109
+ $[18] = (_q = (_p = props.fields) === null || _p === void 0 ? void 0 : _p.perex) === null || _q === void 0 ? void 0 : _q.isHidden;
110
+ $[19] = props.formApi.control;
111
+ $[20] = t;
112
+ $[21] = t8;
113
+ }
114
+ else {
115
+ t8 = $[21];
116
+ }
117
+ let t9;
118
+ if ($[22] !== ((_s = (_r = props.fields) === null || _r === void 0 ? void 0 : _r.authorText) === null || _s === void 0 ? void 0 : _s.isHidden) || $[23] !== props.formApi.control || $[24] !== t) {
119
+ t9 = ((_u = (_t = props.fields) === null || _t === void 0 ? void 0 : _t.authorText) === null || _u === void 0 ? void 0 : _u.isHidden) === false && react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, label: t("uxf-cms-content-builder:basic-form.author"), name: "authorText" });
120
+ $[22] = (_w = (_v = props.fields) === null || _v === void 0 ? void 0 : _v.authorText) === null || _w === void 0 ? void 0 : _w.isHidden;
121
+ $[23] = props.formApi.control;
122
+ $[24] = t;
123
+ $[25] = t9;
124
+ }
125
+ else {
126
+ t9 = $[25];
127
+ }
128
+ let t10;
129
+ if ($[26] !== props.fields || $[27] !== props.formApi.control || $[28] !== t) {
130
+ t10 = !((_y = (_x = props.fields) === null || _x === void 0 ? void 0 : _x.author) === null || _y === void 0 ? void 0 : _y.isHidden) && ((_0 = (_z = props.fields) === null || _z === void 0 ? void 0 : _z.author) === null || _0 === void 0 ? void 0 : _0.autocomplete) && react_1.default.createElement(combobox_1.Combobox, { control: props.formApi.control, label: t("uxf-cms-content-builder:basic-form.author"), loadOptions: props.fields.author.autocomplete, name: "author" });
131
+ $[26] = props.fields;
132
+ $[27] = props.formApi.control;
133
+ $[28] = t;
134
+ $[29] = t10;
135
+ }
136
+ else {
137
+ t10 = $[29];
138
+ }
139
+ let t11;
140
+ if ($[30] !== props.fields || $[31] !== props.formApi.control) {
141
+ t11 = !((_2 = (_1 = props.fields) === null || _1 === void 0 ? void 0 : _1.category) === null || _2 === void 0 ? void 0 : _2.isHidden) && ((_4 = (_3 = props.fields) === null || _3 === void 0 ? void 0 : _3.category) === null || _4 === void 0 ? void 0 : _4.autocomplete) && react_1.default.createElement(combobox_1.Combobox, { control: props.formApi.control, label: "Kategorie", loadOptions: props.fields.category.autocomplete, name: "category" });
142
+ $[30] = props.fields;
143
+ $[31] = props.formApi.control;
144
+ $[32] = t11;
145
+ }
146
+ else {
147
+ t11 = $[32];
148
+ }
149
+ let t12;
150
+ if ($[33] !== props.fields || $[34] !== props.formApi.control) {
151
+ t12 = !((_6 = (_5 = props.fields) === null || _5 === void 0 ? void 0 : _5.tags) === null || _6 === void 0 ? void 0 : _6.isHidden) && ((_8 = (_7 = props.fields) === null || _7 === void 0 ? void 0 : _7.tags) === null || _8 === void 0 ? void 0 : _8.autocomplete) && react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: props.formApi.control, label: "Tagy", loadOptions: props.fields.tags.autocomplete, name: "tags" });
152
+ $[33] = props.fields;
153
+ $[34] = props.formApi.control;
154
+ $[35] = t12;
155
+ }
156
+ else {
157
+ t12 = $[35];
158
+ }
159
+ let t13;
160
+ if ($[36] !== ((_10 = (_9 = props.fields) === null || _9 === void 0 ? void 0 : _9.image) === null || _10 === void 0 ? void 0 : _10.isHidden) || $[37] !== props.formApi.control || $[38] !== props.uploadNamespace || $[39] !== t) {
161
+ t13 = !((_12 = (_11 = props.fields) === null || _11 === void 0 ? void 0 : _11.image) === null || _12 === void 0 ? void 0 : _12.isHidden) && react_1.default.createElement(file_input_1.FileInput, { control: props.formApi.control, id: "image", label: t("uxf-cms-content-builder:basic-form.main-image"), name: "image", onUploadFile: file => (0, api_1.uploadFile)(file, props.uploadNamespace) });
162
+ $[36] = (_14 = (_13 = props.fields) === null || _13 === void 0 ? void 0 : _13.image) === null || _14 === void 0 ? void 0 : _14.isHidden;
163
+ $[37] = props.formApi.control;
164
+ $[38] = props.uploadNamespace;
165
+ $[39] = t;
166
+ $[40] = t13;
167
+ }
168
+ else {
169
+ t13 = $[40];
170
+ }
171
+ let t14;
172
+ if ($[41] !== ((_16 = (_15 = props.fields) === null || _15 === void 0 ? void 0 : _15.isActive) === null || _16 === void 0 ? void 0 : _16.isHidden) || $[42] !== props.formApi.control || $[43] !== t) {
173
+ t14 = !((_18 = (_17 = props.fields) === null || _17 === void 0 ? void 0 : _17.isActive) === null || _18 === void 0 ? void 0 : _18.isHidden) && react_1.default.createElement(checkbox_input_1.CheckboxInput, { control: props.formApi.control, label: t("uxf-cms-content-builder:basic-form.active"), name: "isActive" });
174
+ $[41] = (_20 = (_19 = props.fields) === null || _19 === void 0 ? void 0 : _19.isActive) === null || _20 === void 0 ? void 0 : _20.isHidden;
175
+ $[42] = props.formApi.control;
176
+ $[43] = t;
177
+ $[44] = t14;
178
+ }
179
+ else {
180
+ t14 = $[44];
181
+ }
182
+ let t15;
183
+ if ($[45] !== ((_22 = (_21 = props.fields) === null || _21 === void 0 ? void 0 : _21.visibilityLevel) === null || _22 === void 0 ? void 0 : _22.isHidden) || $[46] !== props.formApi.control) {
184
+ t15 = !((_24 = (_23 = props.fields) === null || _23 === void 0 ? void 0 : _23.visibilityLevel) === null || _24 === void 0 ? void 0 : _24.isHidden) && react_1.default.createElement(select_1.Select, { control: props.formApi.control, isRequired: true, label: "Viditelnost", name: "visibilityLevel", options: visibilityLevelOptions });
185
+ $[45] = (_26 = (_25 = props.fields) === null || _25 === void 0 ? void 0 : _25.visibilityLevel) === null || _26 === void 0 ? void 0 : _26.isHidden;
186
+ $[46] = props.formApi.control;
187
+ $[47] = t15;
188
+ }
189
+ else {
190
+ t15 = $[47];
191
+ }
192
+ let t16;
193
+ if ($[48] !== props.fields || $[49] !== props.formApi.control || $[50] !== t) {
194
+ t16 = (0, is_not_nil_1.isNotNil)((_28 = (_27 = props.fields) === null || _27 === void 0 ? void 0 : _27.parent) === null || _28 === void 0 ? void 0 : _28.autocomplete) && react_1.default.createElement(combobox_1.Combobox, { control: props.formApi.control, label: t("uxf-cms-content-builder:basic-form.parent-article"), loadOptions: props.fields.parent.autocomplete, name: "parent" });
195
+ $[48] = props.fields;
196
+ $[49] = props.formApi.control;
197
+ $[50] = t;
198
+ $[51] = t16;
199
+ }
200
+ else {
201
+ t16 = $[51];
202
+ }
203
+ let t17;
204
+ if ($[52] !== props.className || $[53] !== t10 || $[54] !== t11 || $[55] !== t12 || $[56] !== t13 || $[57] !== t14 || $[58] !== t15 || $[59] !== t16 || $[60] !== t3 || $[61] !== t6 || $[62] !== t7 || $[63] !== t8 || $[64] !== t9) {
205
+ t17 = react_1.default.createElement("div", { className: t2 },
206
+ t3,
207
+ t6,
208
+ t7,
209
+ t8,
210
+ t9,
211
+ t10,
212
+ t11,
213
+ t12,
214
+ t13,
215
+ t14,
216
+ t15,
217
+ t16);
218
+ $[52] = props.className;
219
+ $[53] = t10;
220
+ $[54] = t11;
221
+ $[55] = t12;
222
+ $[56] = t13;
223
+ $[57] = t14;
224
+ $[58] = t15;
225
+ $[59] = t16;
226
+ $[60] = t3;
227
+ $[61] = t6;
228
+ $[62] = t7;
229
+ $[63] = t8;
230
+ $[64] = t9;
231
+ $[65] = t17;
232
+ }
233
+ else {
234
+ t17 = $[65];
235
+ }
236
+ return t17;
50
237
  }