@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.
- package/api/index.d.ts +2 -0
- package/api/index.js +2 -2
- package/api/swr.js +71 -6
- package/content-builder/content-builder-header.js +42 -3
- package/content-builder/content-builder.js +140 -18
- package/content-builder/content-builder.stories.js +24 -5
- package/content-builder/forms/content-builder-basic-form.js +212 -25
- package/content-builder/forms/content-builder-seo-form.js +92 -8
- package/forms/change-password-form/change-password-form.js +152 -15
- package/forms/components/wysiwyg-input/wysiwyg-input.js +188 -50
- package/forms/components/wysiwyg-input/wysiwyg-input.stories.js +127 -22
- package/forms/forgotten-password-form/forgotten-password-form.js +119 -15
- package/forms/invite-user-form/invite-user-form.js +171 -13
- package/forms/login-form/login-form.js +122 -13
- package/forms/renew-password-form/renew-password-form.js +148 -16
- package/lib/api/create-axios-instance.d.ts +3 -1
- package/lib/api/create-axios-request.d.ts +3 -1
- package/lib/api/create-axios-request.js +9 -2
- package/lib/api/create-axios-request.test.d.ts +1 -0
- package/lib/api/create-axios-request.test.js +32 -0
- package/lib/layout/layout.js +126 -28
- package/lib/layout/sidebar.js +65 -26
- package/lib/menu/ui/sub-menu/sub-menu-mobile.js +62 -14
- package/lib/menu/ui/sub-menu/sub-menu.js +66 -14
- package/lib/menu/ui/sub-menu/use-sub-menu.js +137 -34
- package/lib/menu/ui/user-menu.js +178 -14
- package/package.json +20 -20
- package/pages/content-builder/components/form-content.js +189 -38
- package/pages/content-builder/components/form-root-fields.js +3 -3
- package/pages/content-builder/components/form.js +142 -27
- package/pages/content-builder/components/header.js +44 -5
- package/pages/content-builder/content/feature-section.js +67 -15
- package/pages/content-builder/content/gallery.js +38 -6
- package/pages/content-builder/content/hero-section.js +39 -6
- package/pages/content-builder/content/people.js +64 -13
- package/pages/content-builder/content/wysiwyg.js +60 -6
- package/pages/content-builder/content-builder-page.js +120 -48
- package/pages/content-builder/content-field.js +216 -35
- package/pages/content-builder/content-header.js +100 -53
- package/pages/content-builder/context/details-visibility-context.js +95 -17
- package/pages/forgotten-password-page/forgotten-password-page.js +29 -46
- package/pages/grid-page/grid-page.js +291 -75
- package/pages/grid-page/use-hidden-columns.js +29 -8
- package/pages/invite-user-page/invite-user-page.js +39 -16
- package/pages/login-page/login-page.js +44 -50
- package/pages/renew-password-page/renew-password-page.js +35 -43
- package/security/restricted-page.js +88 -10
- package/security/use-logged-user.js +33 -8
- package/ui/avatar/avatar.js +3 -2
- package/ui/copy-to-clipboard/copy-to-clipboard.js +57 -44
- package/ui/copy-to-clipboard-button/copy-to-clipboard-button.js +47 -46
- package/utils/remove-confirm-handler.js +80 -11
- package/utils/use-viewport-height.js +25 -7
- package/utils/use-visual-viewport-height.js +5 -2
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Gallery = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const upload_file_1 = require("@uxf/core/api/upload-file");
|
|
8
9
|
const dropzone_input_1 = require("@uxf/form/dropzone/dropzone-input");
|
|
9
10
|
const dropzone_list_1 = require("@uxf/form/dropzone/dropzone-list");
|
|
@@ -12,18 +13,49 @@ const remove_confirm_handler_1 = require("../../../utils/remove-confirm-handler"
|
|
|
12
13
|
const content_header_1 = require("../content-header");
|
|
13
14
|
const details_visibility_context_1 = require("../context/details-visibility-context");
|
|
14
15
|
const fileUploadHandler = (0, upload_file_1.createUploadHandler)("default");
|
|
15
|
-
const Gallery =
|
|
16
|
+
const Gallery = props => {
|
|
17
|
+
const $ = (0, compiler_runtime_1.c)(9);
|
|
16
18
|
const [visibility] = (0, details_visibility_context_1.useDetailsVisibilityForSection)(props.id);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
let t0;
|
|
20
|
+
if ($[0] !== props) {
|
|
21
|
+
t0 = react_1.default.createElement(content_header_1.ContentHeader, { ...props });
|
|
22
|
+
$[0] = props;
|
|
23
|
+
$[1] = t0;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
t0 = $[1];
|
|
27
|
+
}
|
|
28
|
+
let t1;
|
|
29
|
+
if ($[2] !== props.control || $[3] !== props.name || $[4] !== visibility) {
|
|
30
|
+
t1 = visibility && react_1.default.createElement("div", { className: "p-4" },
|
|
20
31
|
react_1.default.createElement(dropzone_input_1.DropzoneInput, { control: props.control, name: `${props.name}.images`, onUploadFile: fileUploadHandler }),
|
|
21
|
-
react_1.default.createElement(dropzone_list_1.DropzoneList, { className: "mt-4", control: props.control, name: `${props.name}.images`, onRemoveConfirm: remove_confirm_handler_1.removeConfirmHandler }))
|
|
32
|
+
react_1.default.createElement(dropzone_list_1.DropzoneList, { className: "mt-4", control: props.control, name: `${props.name}.images`, onRemoveConfirm: remove_confirm_handler_1.removeConfirmHandler }));
|
|
33
|
+
$[2] = props.control;
|
|
34
|
+
$[3] = props.name;
|
|
35
|
+
$[4] = visibility;
|
|
36
|
+
$[5] = t1;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
t1 = $[5];
|
|
40
|
+
}
|
|
41
|
+
let t2;
|
|
42
|
+
if ($[6] !== t0 || $[7] !== t1) {
|
|
43
|
+
t2 = react_1.default.createElement("div", { className: "divide-lightBorder dark:divide-darkBorder divide-y" },
|
|
44
|
+
t0,
|
|
45
|
+
t1);
|
|
46
|
+
$[6] = t0;
|
|
47
|
+
$[7] = t1;
|
|
48
|
+
$[8] = t2;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
t2 = $[8];
|
|
52
|
+
}
|
|
53
|
+
return t2;
|
|
22
54
|
};
|
|
23
55
|
exports.Gallery = Gallery;
|
|
24
56
|
exports.Gallery.getConfig = () => {
|
|
25
57
|
return {
|
|
26
58
|
type: "gallery",
|
|
27
|
-
label: "Galerie"
|
|
59
|
+
label: "Galerie"
|
|
28
60
|
};
|
|
29
61
|
};
|
|
@@ -4,18 +4,29 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.HeroSection = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const translations_1 = require("@uxf/core-react/translations");
|
|
8
9
|
const text_input_1 = require("@uxf/form/text-input");
|
|
9
10
|
const react_1 = __importDefault(require("react"));
|
|
10
11
|
const wysiwyg_input_1 = require("../../../forms/components/wysiwyg-input");
|
|
11
12
|
const content_header_1 = require("../content-header");
|
|
12
13
|
const details_visibility_context_1 = require("../context/details-visibility-context");
|
|
13
|
-
const HeroSection =
|
|
14
|
+
const HeroSection = props => {
|
|
15
|
+
const $ = (0, compiler_runtime_1.c)(10);
|
|
14
16
|
const [visibility] = (0, details_visibility_context_1.useDetailsVisibilityForSection)(props.id);
|
|
15
17
|
const t = (0, translations_1.useUxfTranslation)();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
let t0;
|
|
19
|
+
if ($[0] !== props) {
|
|
20
|
+
t0 = react_1.default.createElement(content_header_1.ContentHeader, { ...props });
|
|
21
|
+
$[0] = props;
|
|
22
|
+
$[1] = t0;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
t0 = $[1];
|
|
26
|
+
}
|
|
27
|
+
let t1;
|
|
28
|
+
if ($[2] !== props.control || $[3] !== props.name || $[4] !== t || $[5] !== visibility) {
|
|
29
|
+
t1 = visibility && react_1.default.createElement("div", { className: "p-4" },
|
|
19
30
|
react_1.default.createElement("div", { className: "mt-2 grid grid-cols-12 gap-4" },
|
|
20
31
|
react_1.default.createElement("div", { className: "col-span-12 sm:col-span-6" },
|
|
21
32
|
react_1.default.createElement(text_input_1.TextInput, { control: props.control, isRequired: true, label: t("uxf-cms-pages-content-builder:content.hero-section.title"), name: `${props.name}.title` })),
|
|
@@ -24,12 +35,34 @@ const HeroSection = (props) => {
|
|
|
24
35
|
react_1.default.createElement("div", { className: "col-span-12" },
|
|
25
36
|
react_1.default.createElement(wysiwyg_input_1.WysiwygInput, { control: props.control, name: `${props.name}.text` })),
|
|
26
37
|
react_1.default.createElement("div", { className: "col-span-12" },
|
|
27
|
-
react_1.default.createElement(text_input_1.TextInput, { control: props.control, label: "CTA url", name: `${props.name}.ctaUrl` }))))
|
|
38
|
+
react_1.default.createElement(text_input_1.TextInput, { control: props.control, label: "CTA url", name: `${props.name}.ctaUrl` }))));
|
|
39
|
+
$[2] = props.control;
|
|
40
|
+
$[3] = props.name;
|
|
41
|
+
$[4] = t;
|
|
42
|
+
$[5] = visibility;
|
|
43
|
+
$[6] = t1;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
t1 = $[6];
|
|
47
|
+
}
|
|
48
|
+
let t2;
|
|
49
|
+
if ($[7] !== t0 || $[8] !== t1) {
|
|
50
|
+
t2 = react_1.default.createElement("div", { className: "divide-lightBorder dark:divide-darkBorder divide-y" },
|
|
51
|
+
t0,
|
|
52
|
+
t1);
|
|
53
|
+
$[7] = t0;
|
|
54
|
+
$[8] = t1;
|
|
55
|
+
$[9] = t2;
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
t2 = $[9];
|
|
59
|
+
}
|
|
60
|
+
return t2;
|
|
28
61
|
};
|
|
29
62
|
exports.HeroSection = HeroSection;
|
|
30
63
|
exports.HeroSection.getConfig = () => {
|
|
31
64
|
return {
|
|
32
65
|
type: "heroSection",
|
|
33
|
-
label: "Hero sekce"
|
|
66
|
+
label: "Hero sekce"
|
|
34
67
|
};
|
|
35
68
|
};
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.People = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const upload_file_1 = require("@uxf/core/api/upload-file");
|
|
8
9
|
const translations_1 = require("@uxf/core-react/translations");
|
|
9
10
|
const file_input_1 = require("@uxf/form/file-input");
|
|
@@ -15,27 +16,50 @@ const react_hook_form_1 = require("react-hook-form");
|
|
|
15
16
|
const content_header_1 = require("../content-header");
|
|
16
17
|
const details_visibility_context_1 = require("../context/details-visibility-context");
|
|
17
18
|
const fileUploadHandler = (0, upload_file_1.createUploadHandler)("default");
|
|
18
|
-
const People =
|
|
19
|
+
const People = props => {
|
|
20
|
+
const $ = (0, compiler_runtime_1.c)(16);
|
|
19
21
|
const [visibility] = (0, details_visibility_context_1.useDetailsVisibilityForSection)(props.id);
|
|
20
22
|
const t = (0, translations_1.useUxfTranslation)();
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
const t0 = `${props.name}.people`;
|
|
24
|
+
let t1;
|
|
25
|
+
if ($[0] !== props.control || $[1] !== t0) {
|
|
26
|
+
t1 = {
|
|
27
|
+
control: props.control,
|
|
28
|
+
name: t0
|
|
29
|
+
};
|
|
30
|
+
$[0] = props.control;
|
|
31
|
+
$[1] = t0;
|
|
32
|
+
$[2] = t1;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
t1 = $[2];
|
|
36
|
+
}
|
|
37
|
+
const { fields, remove, append } = (0, react_hook_form_1.useFieldArray)(t1);
|
|
38
|
+
let t2;
|
|
39
|
+
if ($[3] !== props) {
|
|
40
|
+
t2 = react_1.default.createElement(content_header_1.ContentHeader, { ...props });
|
|
41
|
+
$[3] = props;
|
|
42
|
+
$[4] = t2;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
t2 = $[4];
|
|
46
|
+
}
|
|
47
|
+
let t3;
|
|
48
|
+
if ($[5] !== append || $[6] !== fields || $[7] !== props.control || $[8] !== props.name || $[9] !== remove || $[10] !== t || $[11] !== visibility) {
|
|
49
|
+
t3 = visibility && react_1.default.createElement("div", { className: "p-4" },
|
|
25
50
|
fields.map((field, index) => {
|
|
26
51
|
const handleRemove = () => {
|
|
27
|
-
// eslint-disable-next-line no-alert
|
|
28
52
|
if (confirm(t("uxf-cms-pages-content-builder:content.people.confirm-delete-person"))) {
|
|
29
53
|
remove(index);
|
|
30
54
|
}
|
|
31
55
|
};
|
|
32
|
-
return
|
|
56
|
+
return react_1.default.createElement("div", { className: "border-primary mb-8 border-l-2 pl-8", key: field.id },
|
|
33
57
|
react_1.default.createElement("div", { className: "flex justify-between" },
|
|
34
58
|
react_1.default.createElement("h4", { className: "uxf-typo-h6 mb-3 pt-1" }, t("uxf-cms-pages-content-builder:content.people.person-title", {
|
|
35
|
-
index: index + 1
|
|
59
|
+
index: index + 1
|
|
36
60
|
})),
|
|
37
|
-
index > 0 ?
|
|
38
|
-
react_1.default.createElement(button_1.Button, { onClick: handleRemove, size: "sm", variant: "secondary" }, t("uxf-cms-pages-content-builder:content.people.delete-person")))
|
|
61
|
+
index > 0 ? react_1.default.createElement("div", null,
|
|
62
|
+
react_1.default.createElement(button_1.Button, { onClick: handleRemove, size: "sm", variant: "secondary" }, t("uxf-cms-pages-content-builder:content.people.delete-person"))) : react_1.default.createElement("div", null)),
|
|
39
63
|
react_1.default.createElement("div", { className: "mt-2 grid grid-cols-12 gap-4" },
|
|
40
64
|
react_1.default.createElement("div", { className: "col-span-12 sm:col-span-6" },
|
|
41
65
|
react_1.default.createElement(text_input_1.TextInput, { control: props.control, isRequired: true, label: t("uxf-cms-pages-content-builder:content.people.name"), name: `${props.name}.people.${index}.name` })),
|
|
@@ -48,14 +72,41 @@ const People = (props) => {
|
|
|
48
72
|
react_1.default.createElement("div", { className: "col-span-6" },
|
|
49
73
|
react_1.default.createElement(text_input_1.TextInput, { control: props.control, label: t("uxf-cms-pages-content-builder:content.people.phone"), name: `${props.name}.people.${index}.phone`, type: "tel" })),
|
|
50
74
|
react_1.default.createElement("div", { className: "col-span-6" },
|
|
51
|
-
react_1.default.createElement(text_input_1.TextInput, { control: props.control, label: "E-mail", name: `${props.name}.people.${index}.email`, type: "email" }))))
|
|
75
|
+
react_1.default.createElement(text_input_1.TextInput, { control: props.control, label: "E-mail", name: `${props.name}.people.${index}.email`, type: "email" }))));
|
|
52
76
|
}),
|
|
53
|
-
react_1.default.createElement(button_1.Button, { onClick: () => append({
|
|
77
|
+
react_1.default.createElement(button_1.Button, { onClick: () => append({
|
|
78
|
+
name: ""
|
|
79
|
+
}), size: "sm", variant: "secondary" }, t("uxf-cms-pages-content-builder:content.people.add-person")));
|
|
80
|
+
$[5] = append;
|
|
81
|
+
$[6] = fields;
|
|
82
|
+
$[7] = props.control;
|
|
83
|
+
$[8] = props.name;
|
|
84
|
+
$[9] = remove;
|
|
85
|
+
$[10] = t;
|
|
86
|
+
$[11] = visibility;
|
|
87
|
+
$[12] = t3;
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
t3 = $[12];
|
|
91
|
+
}
|
|
92
|
+
let t4;
|
|
93
|
+
if ($[13] !== t2 || $[14] !== t3) {
|
|
94
|
+
t4 = react_1.default.createElement("div", { className: "divide-lightBorder dark:divide-darkBorder divide-y" },
|
|
95
|
+
t2,
|
|
96
|
+
t3);
|
|
97
|
+
$[13] = t2;
|
|
98
|
+
$[14] = t3;
|
|
99
|
+
$[15] = t4;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
t4 = $[15];
|
|
103
|
+
}
|
|
104
|
+
return t4;
|
|
54
105
|
};
|
|
55
106
|
exports.People = People;
|
|
56
107
|
exports.People.getConfig = () => {
|
|
57
108
|
return {
|
|
58
109
|
type: "people",
|
|
59
|
-
label: "Lidé"
|
|
110
|
+
label: "Lidé"
|
|
60
111
|
};
|
|
61
112
|
};
|
|
@@ -4,28 +4,82 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Wysiwyg = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const translations_1 = require("@uxf/core-react/translations");
|
|
8
9
|
const react_1 = __importDefault(require("react"));
|
|
9
10
|
const wysiwyg_input_1 = require("../../../forms/components/wysiwyg-input");
|
|
10
11
|
const content_header_1 = require("../content-header");
|
|
11
12
|
const details_visibility_context_1 = require("../context/details-visibility-context");
|
|
12
|
-
const Wysiwyg =
|
|
13
|
+
const Wysiwyg = props => {
|
|
14
|
+
const $ = (0, compiler_runtime_1.c)(19);
|
|
13
15
|
const [visibility] = (0, details_visibility_context_1.useDetailsVisibilityForSection)(props.id);
|
|
14
16
|
const t = (0, translations_1.useUxfTranslation)();
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
let t0;
|
|
18
|
+
if ($[0] !== props.TypeInputProps || $[1] !== props.control || $[2] !== props.id || $[3] !== props.index || $[4] !== props.name || $[5] !== props.onRemove || $[6] !== props.title) {
|
|
19
|
+
t0 = react_1.default.createElement(content_header_1.ContentHeader, { TypeInputProps: props.TypeInputProps, control: props.control, id: props.id, index: props.index, name: props.name, onRemove: props.onRemove, title: props.title });
|
|
20
|
+
$[0] = props.TypeInputProps;
|
|
21
|
+
$[1] = props.control;
|
|
22
|
+
$[2] = props.id;
|
|
23
|
+
$[3] = props.index;
|
|
24
|
+
$[4] = props.name;
|
|
25
|
+
$[5] = props.onRemove;
|
|
26
|
+
$[6] = props.title;
|
|
27
|
+
$[7] = t0;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
t0 = $[7];
|
|
31
|
+
}
|
|
32
|
+
let t1;
|
|
33
|
+
if ($[8] !== props.allPluginsOptions || $[9] !== props.control || $[10] !== props.editorProps || $[11] !== props.name || $[12] !== props.plugins || $[13] !== t || $[14] !== visibility) {
|
|
34
|
+
t1 = visibility && react_1.default.createElement(wysiwyg_input_1.WysiwygInput, { allPluginsOptions: props.allPluginsOptions, className: "p-4", control: props.control, editorProps: props.editorProps, isRequired: true, label: t("uxf-cms-pages-content-builder:content.wysiwyg.text"), name: `${props.name}.content`, placeholder: t("uxf-cms-pages-content-builder:content.wysiwyg.placeholder"), plugins: props.plugins });
|
|
35
|
+
$[8] = props.allPluginsOptions;
|
|
36
|
+
$[9] = props.control;
|
|
37
|
+
$[10] = props.editorProps;
|
|
38
|
+
$[11] = props.name;
|
|
39
|
+
$[12] = props.plugins;
|
|
40
|
+
$[13] = t;
|
|
41
|
+
$[14] = visibility;
|
|
42
|
+
$[15] = t1;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
t1 = $[15];
|
|
46
|
+
}
|
|
47
|
+
let t2;
|
|
48
|
+
if ($[16] !== t0 || $[17] !== t1) {
|
|
49
|
+
t2 = react_1.default.createElement("div", { className: "divide-lightBorder dark:divide-darkBorder divide-y" },
|
|
50
|
+
t0,
|
|
51
|
+
t1);
|
|
52
|
+
$[16] = t0;
|
|
53
|
+
$[17] = t1;
|
|
54
|
+
$[18] = t2;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
t2 = $[18];
|
|
58
|
+
}
|
|
59
|
+
return t2;
|
|
18
60
|
};
|
|
19
61
|
exports.Wysiwyg = Wysiwyg;
|
|
20
62
|
const defaultGetConfig = () => {
|
|
21
63
|
return {
|
|
22
64
|
type: "wysiwyg",
|
|
23
|
-
label: "Strukturovaný text"
|
|
65
|
+
label: "Strukturovaný text"
|
|
24
66
|
};
|
|
25
67
|
};
|
|
26
68
|
exports.Wysiwyg.create = (config = {}) => {
|
|
27
69
|
const { editorProps, allPluginsOptions, plugins } = config;
|
|
28
|
-
const Component =
|
|
70
|
+
const Component = props => {
|
|
71
|
+
const $ = (0, compiler_runtime_1.c)(2);
|
|
72
|
+
let t0;
|
|
73
|
+
if ($[0] !== props) {
|
|
74
|
+
t0 = react_1.default.createElement(exports.Wysiwyg, { allPluginsOptions: allPluginsOptions, plugins: plugins, ...props, editorProps: editorProps });
|
|
75
|
+
$[0] = props;
|
|
76
|
+
$[1] = t0;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
t0 = $[1];
|
|
80
|
+
}
|
|
81
|
+
return t0;
|
|
82
|
+
};
|
|
29
83
|
Component.getConfig = defaultGetConfig;
|
|
30
84
|
return Component;
|
|
31
85
|
};
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.ContentBuilderPage = void 0;
|
|
37
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
38
|
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
38
39
|
const router_1 = require("@uxf/router");
|
|
39
40
|
const router_2 = require("next/router");
|
|
@@ -43,74 +44,145 @@ const config_1 = require("../../config");
|
|
|
43
44
|
const restricted_page_1 = require("../../security/restricted-page");
|
|
44
45
|
const form_1 = require("./components/form");
|
|
45
46
|
const mapper_1 = require("./mapper");
|
|
46
|
-
const DefaultLayout =
|
|
47
|
+
const DefaultLayout = props => {
|
|
48
|
+
"use no memo";
|
|
49
|
+
return react_1.default.createElement("div", { ...props });
|
|
50
|
+
};
|
|
47
51
|
const defaultInitialValues = async (id) => {
|
|
48
52
|
const date = new Date();
|
|
49
53
|
date.setHours(0);
|
|
50
54
|
date.setMinutes(0);
|
|
51
55
|
date.setMilliseconds(0);
|
|
52
|
-
return id
|
|
53
|
-
|
|
54
|
-
:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
tags: [],
|
|
77
|
-
};
|
|
56
|
+
return id ? await (0, api_1.contentGet)(null, id).then(r => (0, mapper_1.mapResponseToFormData)(r.data)) : {
|
|
57
|
+
name: "",
|
|
58
|
+
type: null,
|
|
59
|
+
author: null,
|
|
60
|
+
category: null,
|
|
61
|
+
content: {
|
|
62
|
+
data: [],
|
|
63
|
+
search: ""
|
|
64
|
+
},
|
|
65
|
+
perex: "",
|
|
66
|
+
visibilityLevel: "PRIVATE",
|
|
67
|
+
seo: {
|
|
68
|
+
name: null,
|
|
69
|
+
title: "",
|
|
70
|
+
ogTitle: "",
|
|
71
|
+
ogDescription: "",
|
|
72
|
+
description: "",
|
|
73
|
+
ogImage: null
|
|
74
|
+
},
|
|
75
|
+
image: null,
|
|
76
|
+
publishedAt: date.toISOString(),
|
|
77
|
+
active: true,
|
|
78
|
+
tags: []
|
|
79
|
+
};
|
|
78
80
|
};
|
|
79
81
|
const defaultOnSubmit = async (id, values) => {
|
|
80
|
-
return id
|
|
81
|
-
? (0, api_1.contentUpdate)(null, id, (0, mapper_1.mapFormDataToRequest)(values)).then((r) => r.data)
|
|
82
|
-
: (0, api_1.contentCreate)(null, (0, mapper_1.mapFormDataToRequest)(values)).then((r) => r.data);
|
|
82
|
+
return id ? (0, api_1.contentUpdate)(null, id, (0, mapper_1.mapFormDataToRequest)(values)).then(r => r.data) : (0, api_1.contentCreate)(null, (0, mapper_1.mapFormDataToRequest)(values)).then(r => r.data);
|
|
83
83
|
};
|
|
84
84
|
const defaultOnSubmitSuccess = async (id) => {
|
|
85
85
|
config_1.container.get("service.notification").success(id ? "Změny uloženy" : "Článek vytvořen");
|
|
86
86
|
};
|
|
87
|
-
const ContentBuilderPageComponent =
|
|
88
|
-
var _a, _b,
|
|
87
|
+
const ContentBuilderPageComponent = props => {
|
|
88
|
+
var _a, _b, _d;
|
|
89
|
+
const $ = (0, compiler_runtime_1.c)(13);
|
|
89
90
|
const Layout = (_a = props.config.ui.Layout) !== null && _a !== void 0 ? _a : DefaultLayout;
|
|
90
91
|
const onSubmit = (_b = props.config.onSubmit) !== null && _b !== void 0 ? _b : defaultOnSubmit;
|
|
91
|
-
const onSubmitSuccess = (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
const onSubmitSuccess = (_d = props.config.onSubmitSuccess) !== null && _d !== void 0 ? _d : defaultOnSubmitSuccess;
|
|
93
|
+
let t0;
|
|
94
|
+
if ($[0] !== onSubmit || $[1] !== onSubmitSuccess || $[2] !== props.config.type || $[3] !== props.id) {
|
|
95
|
+
t0 = async (values) => {
|
|
96
|
+
const preparedValues = props.config.type ? {
|
|
97
|
+
...values,
|
|
98
|
+
type: props.config.type
|
|
99
|
+
} : values;
|
|
100
|
+
const response = await onSubmit(props.id, preparedValues);
|
|
101
|
+
await onSubmitSuccess(props.id, preparedValues, response);
|
|
102
|
+
};
|
|
103
|
+
$[0] = onSubmit;
|
|
104
|
+
$[1] = onSubmitSuccess;
|
|
105
|
+
$[2] = props.config.type;
|
|
106
|
+
$[3] = props.id;
|
|
107
|
+
$[4] = t0;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
t0 = $[4];
|
|
111
|
+
}
|
|
112
|
+
const handleSubmit = t0;
|
|
113
|
+
let t1;
|
|
114
|
+
if ($[5] !== handleSubmit || $[6] !== props.config || $[7] !== props.id || $[8] !== props.initialValues) {
|
|
115
|
+
t1 = react_1.default.createElement("div", { className: "-mx-4 md:-mx-10" },
|
|
116
|
+
react_1.default.createElement(form_1.Form, { config: props.config, defaultValues: props.initialValues, id: props.id, onSubmit: handleSubmit }));
|
|
117
|
+
$[5] = handleSubmit;
|
|
118
|
+
$[6] = props.config;
|
|
119
|
+
$[7] = props.id;
|
|
120
|
+
$[8] = props.initialValues;
|
|
121
|
+
$[9] = t1;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
t1 = $[9];
|
|
125
|
+
}
|
|
126
|
+
let t2;
|
|
127
|
+
if ($[10] !== Layout || $[11] !== t1) {
|
|
128
|
+
t2 = react_1.default.createElement(Layout, null, t1);
|
|
129
|
+
$[10] = Layout;
|
|
130
|
+
$[11] = t1;
|
|
131
|
+
$[12] = t2;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
t2 = $[12];
|
|
135
|
+
}
|
|
136
|
+
return t2;
|
|
100
137
|
};
|
|
101
138
|
ContentBuilderPageComponent.displayName = "ContentBuilderComponent";
|
|
102
139
|
/** @deprecated use ContentBuilder from @uxf/cms/content-builder */
|
|
103
|
-
const ContentBuilderPage =
|
|
140
|
+
const ContentBuilderPage = config => {
|
|
104
141
|
const Page = () => {
|
|
105
142
|
var _a;
|
|
143
|
+
const $ = (0, compiler_runtime_1.c)(8);
|
|
106
144
|
const router = (0, router_2.useRouter)();
|
|
107
|
-
|
|
145
|
+
let t0;
|
|
146
|
+
if ($[0] !== router.query.id) {
|
|
147
|
+
t0 = (_a = (0, router_1.queryParamToNumber)(router.query.id)) !== null && _a !== void 0 ? _a : null;
|
|
148
|
+
$[0] = router.query.id;
|
|
149
|
+
$[1] = t0;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
t0 = $[1];
|
|
153
|
+
}
|
|
154
|
+
const id = t0;
|
|
108
155
|
const [initialValues, setInitialValues] = (0, react_1.useState)(null);
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
156
|
+
let t1;
|
|
157
|
+
let t2;
|
|
158
|
+
if ($[2] !== id) {
|
|
159
|
+
t1 = () => {
|
|
160
|
+
defaultInitialValues(id).then(r => setInitialValues(r));
|
|
161
|
+
};
|
|
162
|
+
t2 = [id];
|
|
163
|
+
$[2] = id;
|
|
164
|
+
$[3] = t1;
|
|
165
|
+
$[4] = t2;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
t1 = $[3];
|
|
169
|
+
t2 = $[4];
|
|
170
|
+
}
|
|
171
|
+
(0, react_1.useEffect)(t1, t2);
|
|
172
|
+
let t3;
|
|
173
|
+
if ($[5] !== id || $[6] !== initialValues) {
|
|
174
|
+
t3 = (0, is_not_nil_1.isNotNil)(initialValues) && react_1.default.createElement(ContentBuilderPageComponent, { config: config, id: id, initialValues: initialValues, key: id });
|
|
175
|
+
$[5] = id;
|
|
176
|
+
$[6] = initialValues;
|
|
177
|
+
$[7] = t3;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
t3 = $[7];
|
|
181
|
+
}
|
|
182
|
+
return t3;
|
|
113
183
|
};
|
|
114
|
-
return (0, restricted_page_1.restrictedPage)(Page, {
|
|
184
|
+
return (0, restricted_page_1.restrictedPage)(Page, {
|
|
185
|
+
allowedRole: config.allowedRoles || ["ROLE_ROOT"]
|
|
186
|
+
});
|
|
115
187
|
};
|
|
116
188
|
exports.ContentBuilderPage = ContentBuilderPage;
|