@uxf/cms 11.36.0 → 11.37.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/cms",
3
- "version": "11.36.0",
3
+ "version": "11.37.0",
4
4
  "description": "UXF Cms",
5
5
  "author": "UXFans <dev@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/cms#readme",
@@ -32,11 +32,11 @@
32
32
  "@redux-devtools/extension": "3.3.0",
33
33
  "@uxf/core": "11.35.0",
34
34
  "@uxf/core-react": "11.36.0",
35
- "@uxf/data-grid": "11.36.0",
36
- "@uxf/form": "11.36.0",
35
+ "@uxf/data-grid": "11.37.0",
36
+ "@uxf/form": "11.37.0",
37
37
  "@uxf/router": "11.32.0",
38
- "@uxf/ui": "11.36.0",
39
- "@uxf/wysiwyg": "11.36.0",
38
+ "@uxf/ui": "11.37.0",
39
+ "@uxf/wysiwyg": "11.37.0",
40
40
  "axios": "1.7.5",
41
41
  "axios-hooks": "5.0.2",
42
42
  "es6-error": "4.1.1",
@@ -1,11 +1,14 @@
1
- import { FC, ReactNode } from "react";
1
+ import React, { Dispatch, ReactNode, SetStateAction } from "react";
2
2
  import { Control } from "react-hook-form";
3
+ import { ContentBuilderTabs } from "../constants";
3
4
  import { ContentBuilderConfig } from "../types";
4
5
  interface Props {
5
- config: ContentBuilderConfig<any>;
6
- id: number | null;
6
+ activeTab: ContentBuilderTabs;
7
7
  children?: ReactNode;
8
+ config: ContentBuilderConfig<any>;
8
9
  control: Control<any>;
10
+ id: number | null;
11
+ setActiveTab: Dispatch<SetStateAction<ContentBuilderTabs>>;
9
12
  }
10
- export declare const FormRootFields: FC<Props>;
13
+ export declare function FormRootFields(props: Props): React.JSX.Element;
11
14
  export {};
@@ -1,29 +1,10 @@
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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.FormRootFields = void 0;
6
+ exports.FormRootFields = FormRootFields;
7
+ const hide_1 = require("@uxf/core-react/components/hide");
27
8
  const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
28
9
  const checkbox_input_1 = require("@uxf/form/checkbox-input");
29
10
  const combobox_1 = require("@uxf/form/combobox/combobox");
@@ -34,57 +15,64 @@ const select_1 = require("@uxf/form/select");
34
15
  const text_input_1 = require("@uxf/form/text-input");
35
16
  const textarea_1 = require("@uxf/form/textarea");
36
17
  const tabs_1 = require("@uxf/ui/tabs");
37
- const react_1 = __importStar(require("react"));
18
+ const react_1 = __importDefault(require("react"));
38
19
  const api_1 = require("../../../api");
39
20
  const on_upload_file_1 = require("../../../forms/utils/on-upload-file");
21
+ const constants_1 = require("../constants");
40
22
  const options = [
41
23
  { id: "PRIVATE", label: "Privátní" },
42
24
  { id: "PUBLIC_WITHOUT_SITEMAP", label: "Veřejný bez sitemapy" },
43
25
  { id: "PUBLIC", label: "Veřejný" },
44
26
  ];
45
- const FormRootFields = (props) => {
27
+ function FormRootFields(props) {
46
28
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
47
- // eslint-disable-next-line react/destructuring-assignment
48
- const { children, config, id, control } = props;
49
- const [activeTab, setActiveTab] = (0, react_1.useState)("basic");
50
29
  return (react_1.default.createElement("div", { className: "pb-2 pt-4" },
51
- react_1.default.createElement(tabs_1.Tabs, { onChange: setActiveTab, value: activeTab },
52
- react_1.default.createElement(tabs_1.Tabs.Panel, { label: "Z\u00E1kladn\u00ED", name: "basic" },
30
+ react_1.default.createElement(tabs_1.Tabs, { onChange: props.setActiveTab, value: props.activeTab },
31
+ react_1.default.createElement(tabs_1.Tabs.Panel, { isAlwaysMounted: true, label: "Z\u00E1kladn\u00ED", name: constants_1.ContentBuilderTabs.Basic },
53
32
  react_1.default.createElement("div", { className: "space-y-8 px-4 pb-4" },
54
- config.allowedTypes && (react_1.default.createElement("div", null,
55
- react_1.default.createElement(select_1.Select, { control: control, isReadOnly: (0, is_not_nil_1.isNotNil)(id), isRequired: true, label: "Typ", name: "type", options: config.allowedTypes }))),
33
+ props.config.allowedTypes && (react_1.default.createElement("div", null,
34
+ react_1.default.createElement(select_1.Select, { control: props.control, isReadOnly: (0, is_not_nil_1.isNotNil)(props.id), isRequired: true, label: "Typ", name: "type", options: props.config.allowedTypes }))),
56
35
  react_1.default.createElement("div", null,
57
- react_1.default.createElement(text_input_1.TextInput, { control: control, isRequired: true, label: "Nadpis", name: "name" })),
58
- !((_a = config.hide) === null || _a === void 0 ? void 0 : _a.publishedAt) && (react_1.default.createElement("div", null,
59
- react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { control: control, isRequired: true, label: "Datum publikace", name: "publishedAt" }))),
60
- !((_b = config.hide) === null || _b === void 0 ? void 0 : _b.perex) && (react_1.default.createElement("div", null,
61
- react_1.default.createElement(textarea_1.Textarea, { control: control, label: "Perex", name: "perex", rows: 3 }))),
62
- !((_c = config.hide) === null || _c === void 0 ? void 0 : _c.author) && (react_1.default.createElement("div", null,
63
- react_1.default.createElement(combobox_1.Combobox, { control: control, label: "Autor", loadOptions: (term) => (0, api_1.autocomplete)(null, { name: "content-author" }, { term }).then((r) => r.data), name: "author" }))),
64
- !((_d = config.hide) === null || _d === void 0 ? void 0 : _d.category) && (react_1.default.createElement("div", null,
65
- react_1.default.createElement(combobox_1.Combobox, { control: control, label: "Kategorie", loadOptions: (term) => (0, api_1.autocomplete)(null, { name: "content-category" }, { term }).then((r) => r.data), name: "category" }))),
36
+ react_1.default.createElement(text_input_1.TextInput, { control: props.control, isRequired: true, label: "Nadpis", name: "name", type: "text" })),
37
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_a = props.config.hide) === null || _a === void 0 ? void 0 : _a.publishedAt) },
38
+ react_1.default.createElement("div", null,
39
+ react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { control: props.control, isRequired: true, label: "Datum publikace", name: "publishedAt" }))),
40
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_b = props.config.hide) === null || _b === void 0 ? void 0 : _b.perex) },
41
+ react_1.default.createElement("div", null,
42
+ react_1.default.createElement(textarea_1.Textarea, { control: props.control, label: "Perex", name: "perex", rows: 3 }))),
43
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_c = props.config.hide) === null || _c === void 0 ? void 0 : _c.author) },
44
+ react_1.default.createElement("div", null,
45
+ react_1.default.createElement(combobox_1.Combobox, { control: props.control, label: "Autor", loadOptions: (term) => (0, api_1.autocomplete)(null, { name: "content-author" }, { term }).then((r) => r.data), name: "author" }))),
46
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_d = props.config.hide) === null || _d === void 0 ? void 0 : _d.category) },
47
+ react_1.default.createElement("div", null,
48
+ react_1.default.createElement(combobox_1.Combobox, { control: props.control, label: "Kategorie", loadOptions: (term) => (0, api_1.autocomplete)(null, { name: "content-category" }, { term }).then((r) => r.data), name: "category" }))),
66
49
  react_1.default.createElement("div", null,
67
- react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: control, label: "Tagy", loadOptions: (term) => (0, api_1.autocomplete)(null, { name: "content-tag" }, { term }).then((r) => r.data), name: "tags" })),
68
- !((_e = config.hide) === null || _e === void 0 ? void 0 : _e.image) && (react_1.default.createElement("div", null,
69
- react_1.default.createElement(file_input_1.FileInput, { control: control, id: "image", label: "Hlavn\u00ED obr\u00E1zek", name: "image", onUploadFile: on_upload_file_1.onUploadFile }))),
50
+ react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: props.control, label: "Tagy", loadOptions: (term) => (0, api_1.autocomplete)(null, { name: "content-tag" }, { term }).then((r) => r.data), name: "tags" })),
51
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_e = props.config.hide) === null || _e === void 0 ? void 0 : _e.image) },
52
+ react_1.default.createElement("div", null,
53
+ react_1.default.createElement(file_input_1.FileInput, { control: props.control, id: "image", label: "Hlavn\u00ED obr\u00E1zek", name: "image", onUploadFile: on_upload_file_1.onUploadFile }))),
70
54
  react_1.default.createElement("div", null,
71
- react_1.default.createElement(checkbox_input_1.CheckboxInput, { control: control, label: "Aktivn\u00ED", name: "active" })),
55
+ react_1.default.createElement(checkbox_input_1.CheckboxInput, { control: props.control, label: "Aktivn\u00ED", name: "active" })),
72
56
  react_1.default.createElement("div", null,
73
- react_1.default.createElement(select_1.Select, { control: control, isRequired: true, label: "Viditelnost", name: "visibilityLevel", options: options })))),
74
- react_1.default.createElement(tabs_1.Tabs.Panel, { label: "SEO", name: "seo" },
57
+ react_1.default.createElement(select_1.Select, { control: props.control, isRequired: true, label: "Viditelnost", name: "visibilityLevel", options: options })))),
58
+ react_1.default.createElement(tabs_1.Tabs.Panel, { isAlwaysMounted: true, label: "SEO", name: constants_1.ContentBuilderTabs.Seo },
75
59
  react_1.default.createElement("div", { className: "space-y-8 px-4 pb-4" },
76
60
  react_1.default.createElement("div", null,
77
- react_1.default.createElement(text_input_1.TextInput, { control: control, helperText: "Slug = unik\u00E1tn\u00ED koncovka URL adresy", label: "Slug", name: "seo.name" })),
78
- !((_g = (_f = config.hide) === null || _f === void 0 ? void 0 : _f.seo) === null || _g === void 0 ? void 0 : _g.title) && (react_1.default.createElement("div", null,
79
- react_1.default.createElement(text_input_1.TextInput, { control: control, label: "Nadpis", name: "seo.title" }))),
80
- !((_j = (_h = config.hide) === null || _h === void 0 ? void 0 : _h.seo) === null || _j === void 0 ? void 0 : _j.description) && (react_1.default.createElement("div", null,
81
- react_1.default.createElement(text_input_1.TextInput, { control: control, label: "Popis", name: "seo.description" }))),
82
- !((_l = (_k = config.hide) === null || _k === void 0 ? void 0 : _k.seo) === null || _l === void 0 ? void 0 : _l.ogTitle) && (react_1.default.createElement("div", null,
83
- react_1.default.createElement(text_input_1.TextInput, { control: control, helperText: "Nadpis kter\u00FD bude zobrazen p\u0159i sd\u00EDlen\u00ED na Facebooku, ...", label: "OG nadpis", name: "seo.ogTitle" }))),
84
- !((_o = (_m = config.hide) === null || _m === void 0 ? void 0 : _m.seo) === null || _o === void 0 ? void 0 : _o.ogDescription) && (react_1.default.createElement("div", null,
85
- react_1.default.createElement(text_input_1.TextInput, { control: control, helperText: "Popis kter\u00FD bude zobrazen p\u0159i sd\u00EDlen\u00ED na Facebooku, ...", label: "OG popis", name: "seo.ogDescription" }))),
86
- !((_q = (_p = config.hide) === null || _p === void 0 ? void 0 : _p.seo) === null || _q === void 0 ? void 0 : _q.ogImage) && (react_1.default.createElement("div", null,
87
- react_1.default.createElement(file_input_1.FileInput, { control: control, helperText: "Obr\u00E1zek kter\u00FD bude zobrazen p\u0159i sd\u00EDlen\u00ED na Facebooku, ...", id: "seo.ogImage", label: "OG obr\u00E1zek", name: "seo.ogImage", onUploadFile: on_upload_file_1.onUploadFile })))))),
88
- children));
89
- };
90
- exports.FormRootFields = FormRootFields;
61
+ react_1.default.createElement(text_input_1.TextInput, { control: props.control, helperText: "Slug = unik\u00E1tn\u00ED koncovka URL adresy", isRequired: true, label: "Slug", name: "seo.name", type: "text" })),
62
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_g = (_f = props.config.hide) === null || _f === void 0 ? void 0 : _f.seo) === null || _g === void 0 ? void 0 : _g.title) },
63
+ react_1.default.createElement("div", null,
64
+ react_1.default.createElement(text_input_1.TextInput, { control: props.control, label: "Nadpis", name: "seo.title", type: "text" }))),
65
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_j = (_h = props.config.hide) === null || _h === void 0 ? void 0 : _h.seo) === null || _j === void 0 ? void 0 : _j.description) },
66
+ react_1.default.createElement("div", null,
67
+ react_1.default.createElement(text_input_1.TextInput, { control: props.control, label: "Popis", name: "seo.description", type: "text" }))),
68
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_l = (_k = props.config.hide) === null || _k === void 0 ? void 0 : _k.seo) === null || _l === void 0 ? void 0 : _l.ogTitle) },
69
+ react_1.default.createElement("div", null,
70
+ react_1.default.createElement(text_input_1.TextInput, { control: props.control, helperText: "Nadpis kter\u00FD bude zobrazen p\u0159i sd\u00EDlen\u00ED na Facebooku, ...", label: "OG nadpis", name: "seo.ogTitle", type: "text" }))),
71
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_o = (_m = props.config.hide) === null || _m === void 0 ? void 0 : _m.seo) === null || _o === void 0 ? void 0 : _o.ogDescription) },
72
+ react_1.default.createElement("div", null,
73
+ react_1.default.createElement(text_input_1.TextInput, { control: props.control, helperText: "Popis kter\u00FD bude zobrazen p\u0159i sd\u00EDlen\u00ED na Facebooku, ...", label: "OG popis", name: "seo.ogDescription", type: "text" }))),
74
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_q = (_p = props.config.hide) === null || _p === void 0 ? void 0 : _p.seo) === null || _q === void 0 ? void 0 : _q.ogImage) },
75
+ react_1.default.createElement("div", null,
76
+ react_1.default.createElement(file_input_1.FileInput, { control: props.control, helperText: "Obr\u00E1zek kter\u00FD bude zobrazen p\u0159i sd\u00EDlen\u00ED na Facebooku, ...", id: "seo.ogImage", label: "OG obr\u00E1zek", name: "seo.ogImage", onUploadFile: on_upload_file_1.onUploadFile })))))),
77
+ props.children));
78
+ }
@@ -1,10 +1,10 @@
1
1
  import { FormProps as UXFFormProps } from "@uxf/form/form";
2
- import { FC } from "react";
2
+ import React from "react";
3
3
  import { DefaultValues } from "react-hook-form";
4
4
  import { ContentBuilderConfig, RootContent } from "../types";
5
- export interface FormProps extends Omit<UXFFormProps<RootContent<any>>, "children" | "formApi" | "id" | "omitSubmitInput"> {
5
+ export interface FormProps extends Omit<UXFFormProps<RootContent<any>>, "children" | "formApi" | "id" | "shouldOmitSubmitInput"> {
6
6
  config: ContentBuilderConfig<any>;
7
7
  id: number | null;
8
8
  defaultValues?: DefaultValues<any>;
9
9
  }
10
- export declare const Form: FC<FormProps>;
10
+ export declare function Form(props: FormProps): React.JSX.Element;
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Form = void 0;
26
+ exports.Form = Form;
27
27
  const form_1 = require("@uxf/form/form");
28
28
  const rem_1 = require("@uxf/styles/units/rem");
29
29
  const react_1 = __importStar(require("react"));
@@ -33,10 +33,28 @@ const constants_1 = require("../constants");
33
33
  const content_field_1 = require("../content-field");
34
34
  const details_visibility_context_1 = require("../context/details-visibility-context");
35
35
  const form_root_fields_1 = require("./form-root-fields");
36
- const Form = (props) => {
37
- const formApi = (0, react_hook_form_1.useForm)({ defaultValues: props.defaultValues });
36
+ // TODO: Mapování inputů na taby, asi by šlo udělat lépe
37
+ const INPUT_TAB_MAP = {
38
+ active: constants_1.ContentBuilderTabs.Basic,
39
+ author: constants_1.ContentBuilderTabs.Basic,
40
+ category: constants_1.ContentBuilderTabs.Basic,
41
+ content: constants_1.ContentBuilderTabs.Basic,
42
+ image: constants_1.ContentBuilderTabs.Basic,
43
+ name: constants_1.ContentBuilderTabs.Basic,
44
+ perex: constants_1.ContentBuilderTabs.Basic,
45
+ publishedAt: constants_1.ContentBuilderTabs.Basic,
46
+ seo: constants_1.ContentBuilderTabs.Seo,
47
+ tags: constants_1.ContentBuilderTabs.Basic,
48
+ type: constants_1.ContentBuilderTabs.Basic,
49
+ visibilityLevel: constants_1.ContentBuilderTabs.Basic,
50
+ };
51
+ function Form(props) {
52
+ const formApi = (0, react_hook_form_1.useForm)({
53
+ defaultValues: props.defaultValues,
54
+ });
38
55
  const viewportHeight = (0, use_viewport_height_1.useViewportHeight)(true);
39
56
  const [headerHeight, setHeaderHeight] = (0, react_1.useState)(0);
57
+ const [activeTab, setActiveTab] = (0, react_1.useState)(constants_1.ContentBuilderTabs.Basic);
40
58
  (0, react_1.useEffect)(() => {
41
59
  const header = document.getElementById(constants_1.CONTENT_BUILDER_PAGE_HEADER_ID);
42
60
  if (header) {
@@ -44,12 +62,20 @@ const Form = (props) => {
44
62
  }
45
63
  }, []);
46
64
  const height = viewportHeight === "100vh" ? viewportHeight : (0, rem_1.rem)(viewportHeight);
47
- return (react_1.default.createElement(form_1.Form, { formApi: formApi, id: constants_1.CONTENT_BUILDER_FORM_ID, onSubmit: props.onSubmit },
65
+ const handleError = (errors) => {
66
+ //TODO: přepnutí na tab s chybou, asi by šlo udělat lépe
67
+ for (const inputName in errors) {
68
+ if (inputName in INPUT_TAB_MAP) {
69
+ setActiveTab(INPUT_TAB_MAP[inputName]);
70
+ break;
71
+ }
72
+ }
73
+ };
74
+ return (react_1.default.createElement(form_1.Form, { formApi: formApi, id: constants_1.CONTENT_BUILDER_FORM_ID, onError: handleError, onSubmit: props.onSubmit },
48
75
  react_1.default.createElement("div", { className: "flex flex-col-reverse overflow-hidden xl:h-[calc(var(--viewport-height)-var(--header-height))] xl:flex-row", style: { "--viewport-height": height, "--header-height": (0, rem_1.rem)(headerHeight) } },
49
76
  react_1.default.createElement(details_visibility_context_1.DetailsVisibilityProvider, null,
50
77
  react_1.default.createElement(content_field_1.ContentField, { contentComponents: props.config.contentComponents, control: formApi.control, name: "content" })),
51
- react_1.default.createElement("div", { className: "basis-[500px] bg-white px-4 pb-8 xl:overflow-y-auto dark:bg-gray-950" },
78
+ react_1.default.createElement("div", { className: "shrink-0 basis-[500px] bg-white px-4 pb-8 xl:overflow-y-auto dark:bg-gray-950" },
52
79
  react_1.default.createElement("h2", { className: "uxf-typo-h5 px-4 pb-4 pt-6" }, "Nastaven\u00ED"),
53
- react_1.default.createElement(form_root_fields_1.FormRootFields, { config: props.config, control: formApi.control, id: props.id })))));
54
- };
55
- exports.Form = Form;
80
+ react_1.default.createElement(form_root_fields_1.FormRootFields, { activeTab: activeTab, config: props.config, control: formApi.control, id: props.id, setActiveTab: setActiveTab })))));
81
+ }
@@ -1,6 +1,6 @@
1
- import { FC } from "react";
1
+ import React from "react";
2
2
  interface HeaderProps {
3
3
  title: string;
4
4
  }
5
- export declare const Header: FC<HeaderProps>;
5
+ export declare function Header(props: HeaderProps): React.JSX.Element;
6
6
  export {};
@@ -1,44 +1,16 @@
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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
4
  };
25
5
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Header = void 0;
27
- const button_1 = require("@uxf/ui/button");
28
- const button_group_1 = require("@uxf/ui/button-group");
29
- const react_1 = __importStar(require("react"));
6
+ exports.Header = Header;
7
+ const react_1 = __importDefault(require("react"));
30
8
  const layout_container_1 = require("../../../lib/layout/layout-container");
31
9
  const constants_1 = require("../constants");
32
- const Header = (props) => {
33
- const [language, setLanguage] = (0, react_1.useState)("cs");
10
+ function Header(props) {
34
11
  return (react_1.default.createElement("div", { className: "sticky top-0 z-10 bg-white shadow-md dark:bg-gray-950", id: constants_1.CONTENT_BUILDER_PAGE_HEADER_ID },
35
12
  react_1.default.createElement(layout_container_1.LayoutContainer, { className: "flex items-center justify-between py-4" },
36
13
  react_1.default.createElement("h1", { className: "uxf-typo-h5" }, props.title),
37
- react_1.default.createElement("div", { className: "flex space-x-4" },
38
- react_1.default.createElement(button_group_1.ButtonGroup, null,
39
- react_1.default.createElement(button_1.Button, { onClick: () => setLanguage("cs"), size: "sm", variant: language === "cs" ? "default" : "secondary" }, "CS"),
40
- react_1.default.createElement(button_1.Button, { onClick: () => setLanguage("en"), size: "sm", variant: language === "en" ? "default" : "secondary" }, "EN"),
41
- react_1.default.createElement(button_1.Button, { onClick: () => setLanguage("de"), size: "sm", variant: language === "de" ? "default" : "secondary" }, "DE")),
42
- react_1.default.createElement("button", { className: "uxf-button uxf-button--color-default uxf-button--size-default uxf-button--variant-default is-hoverable", form: constants_1.CONTENT_BUILDER_FORM_ID, type: "submit" }, "Ulo\u017Eit")))));
43
- };
44
- exports.Header = Header;
14
+ " ",
15
+ react_1.default.createElement("button", { className: "uxf-button uxf-button--color-default uxf-button--size-default uxf-button--variant-default is-hoverable", form: constants_1.CONTENT_BUILDER_FORM_ID, type: "submit" }, "Ulo\u017Eit"))));
16
+ }
@@ -1,2 +1,6 @@
1
1
  export declare const CONTENT_BUILDER_FORM_ID = "content-builder-form";
2
2
  export declare const CONTENT_BUILDER_PAGE_HEADER_ID = "content-builder-page-header";
3
+ export declare enum ContentBuilderTabs {
4
+ Basic = "basic",
5
+ Seo = "seo"
6
+ }
@@ -1,5 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONTENT_BUILDER_PAGE_HEADER_ID = exports.CONTENT_BUILDER_FORM_ID = void 0;
3
+ exports.ContentBuilderTabs = exports.CONTENT_BUILDER_PAGE_HEADER_ID = exports.CONTENT_BUILDER_FORM_ID = void 0;
4
4
  exports.CONTENT_BUILDER_FORM_ID = "content-builder-form";
5
5
  exports.CONTENT_BUILDER_PAGE_HEADER_ID = "content-builder-page-header";
6
+ var ContentBuilderTabs;
7
+ (function (ContentBuilderTabs) {
8
+ ContentBuilderTabs["Basic"] = "basic";
9
+ ContentBuilderTabs["Seo"] = "seo";
10
+ })(ContentBuilderTabs || (exports.ContentBuilderTabs = ContentBuilderTabs = {}));
@@ -8,7 +8,7 @@ const dropzone_input_1 = require("@uxf/form/dropzone/dropzone-input");
8
8
  const dropzone_list_1 = require("@uxf/form/dropzone/dropzone-list");
9
9
  const react_1 = __importDefault(require("react"));
10
10
  const on_upload_dropzone_file_1 = require("../../../forms/utils/on-upload-dropzone-file");
11
- const on_remove_confirm_1 = require("../../../utils/on-remove-confirm");
11
+ const remove_confirm_handler_1 = require("../../../utils/remove-confirm-handler");
12
12
  const content_header_1 = require("../content-header");
13
13
  const details_visibility_context_1 = require("../context/details-visibility-context");
14
14
  const Gallery = (props) => {
@@ -17,7 +17,7 @@ const Gallery = (props) => {
17
17
  react_1.default.createElement(content_header_1.ContentHeader, { ...props }),
18
18
  visibility && (react_1.default.createElement("div", { className: "p-4" },
19
19
  react_1.default.createElement(dropzone_input_1.DropzoneInput, { control: props.control, name: `${props.name}.images`, onUploadFile: on_upload_dropzone_file_1.onUploadDropzoneFile }),
20
- react_1.default.createElement(dropzone_list_1.DropzoneList, { control: props.control, name: `${props.name}.images`, onRemoveConfirm: on_remove_confirm_1.onRemoveConfirm })))));
20
+ react_1.default.createElement(dropzone_list_1.DropzoneList, { className: "mt-4", control: props.control, name: `${props.name}.images`, onRemoveConfirm: remove_confirm_handler_1.removeConfirmHandler })))));
21
21
  };
22
22
  exports.Gallery = Gallery;
23
23
  exports.Gallery.getConfig = () => ({
@@ -25,16 +25,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.ContentHeader = void 0;
27
27
  const use_clickable_props_1 = require("@uxf/core-react/hooks/use-clickable-props");
28
- const button_1 = require("@uxf/ui/button");
29
- const datetime_picker_input_1 = require("@uxf/ui/datetime-picker-input");
30
28
  const icon_1 = require("@uxf/ui/icon");
31
- const modal_service_1 = require("@uxf/ui/modal/modal-service");
32
- const paper_1 = require("@uxf/ui/paper/paper");
29
+ const icon_button_1 = require("@uxf/ui/icon-button");
33
30
  const react_1 = __importStar(require("react"));
34
31
  const details_visibility_context_1 = require("./context/details-visibility-context");
35
32
  const ContentHeader = (props) => {
36
- const [validityFrom, setValidityFrom] = (0, react_1.useState)(null);
37
- const [validityTo, setValidityTo] = (0, react_1.useState)(null);
38
33
  const [visibility, toggleVisibility] = (0, details_visibility_context_1.useDetailsVisibilityForSection)(props.id);
39
34
  const removeHandler = (0, react_1.useCallback)((event) => {
40
35
  event.stopPropagation();
@@ -49,23 +44,10 @@ const ContentHeader = (props) => {
49
44
  className: "flex w-full cursor-pointer flex-row items-center justify-between p-4",
50
45
  onClick: toggleVisibility,
51
46
  });
52
- const setVisibilityHandler = (event) => {
53
- event.stopPropagation();
54
- (0, modal_service_1.openModal)({
55
- children: (react_1.default.createElement(paper_1.Paper, { className: "space-y-4 p-4 dark:bg-gray-950" },
56
- react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { label: "Platnost od", name: "visibilityFrom", onChange: (value) => setValidityFrom(value), value: validityFrom }),
57
- react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { label: "Platnost do", name: "visibilityTo", onChange: (value) => setValidityTo(value), value: validityTo }))),
58
- width: "sm",
59
- });
60
- };
61
47
  return (react_1.default.createElement("div", { ...clickableProps },
62
48
  react_1.default.createElement("h3", { className: "uxf-typo-h6" }, props.title),
63
49
  react_1.default.createElement("div", { className: "flex items-center space-x-4" },
64
- react_1.default.createElement("div", { className: "flex space-x-2" },
65
- react_1.default.createElement(button_1.Button, { isIconButton: true, onClick: (event) => setVisibilityHandler(event), size: "sm", variant: "secondary" },
66
- react_1.default.createElement(icon_1.Icon, { name: "calendar" })),
67
- react_1.default.createElement(button_1.Button, { isIconButton: true, onClick: (event) => removeHandler(event), size: "sm", variant: "secondary" },
68
- react_1.default.createElement(icon_1.Icon, { name: "delete" }))),
50
+ react_1.default.createElement(icon_button_1.IconButton, { iconName: "delete", label: "d", onClick: removeHandler, size: "sm", variant: "secondary" }),
69
51
  react_1.default.createElement(icon_1.Icon, { name: `${visibility ? "chevronUp" : "chevronDown"}`, size: 16 }))));
70
52
  };
71
53
  exports.ContentHeader = ContentHeader;
@@ -23,7 +23,7 @@ const react_1 = __importDefault(require("react"));
23
23
  const api_1 = require("../../api");
24
24
  const on_upload_dropzone_file_1 = require("../../forms/utils/on-upload-dropzone-file");
25
25
  const on_upload_file_1 = require("../../forms/utils/on-upload-file");
26
- const on_remove_confirm_1 = require("../../utils/on-remove-confirm");
26
+ const remove_confirm_handler_1 = require("../../utils/remove-confirm-handler");
27
27
  const field_array_1 = require("./field-array"); // eslint-disable-line import/no-cycle
28
28
  const content_1 = require("./field/content");
29
29
  // eslint-disable-next-line complexity
@@ -58,7 +58,7 @@ const BaseField = (props) => {
58
58
  react_1.default.createElement(label_1.Label, null, label),
59
59
  react_1.default.createElement("div", { className: "mb-3" },
60
60
  react_1.default.createElement(dropzone_input_1.DropzoneInput, { control: control, label: label, name: fieldName, onUploadFile: on_upload_dropzone_file_1.onUploadDropzoneFile })),
61
- react_1.default.createElement(dropzone_list_1.DropzoneList, { control: control, errorText: "Soubor se nepoda\u0159ilo nahr\u00E1t.", name: fieldName, onRemoveConfirm: on_remove_confirm_1.onRemoveConfirm })));
61
+ react_1.default.createElement(dropzone_list_1.DropzoneList, { control: control, errorText: "Soubor se nepoda\u0159ilo nahr\u00E1t.", name: fieldName, onRemoveConfirm: remove_confirm_handler_1.removeConfirmHandler })));
62
62
  case "manyToMany":
63
63
  return (react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: control, isDisabled: disabled, isRequired: required, label: label, loadOptions: (term) => { var _a; return (0, api_1.autocomplete)(null, { name: (_a = fieldSchema.autocomplete) !== null && _a !== void 0 ? _a : "" }, { term }).then((r) => r.data); }, name: fieldName }));
64
64
  case "manyToOne":
@@ -129,7 +129,7 @@ const GridPageComponent = (props) => {
129
129
  : undefined);
130
130
  return (react_1.default.createElement(Layout, { key: props.entityAlias, title: (_j = (_g = props.title) !== null && _g !== void 0 ? _g : (_h = props.metaSchema) === null || _h === void 0 ? void 0 : _h.title) !== null && _j !== void 0 ? _j : "" },
131
131
  react_1.default.createElement("div", { className: "mb-10" },
132
- react_1.default.createElement(data_grid_1.DataGrid, { NoRowsFallback: (_k = props.ui) === null || _k === void 0 ? void 0 : _k.NoRowsFallback, SelectedRowsToolbarActions: (_l = props.ui) === null || _l === void 0 ? void 0 : _l.SelectedRowsToolbarActions, actionCell: actionCell, actions: actions, bodyCells: (_m = props.ui) === null || _m === void 0 ? void 0 : _m.BodyCells, customActions: cActions, data: data, error: error, filterHandlers: (_o = props.ui) === null || _o === void 0 ? void 0 : _o.FilterHandlers, gridName: props.entityAlias, isLoading: isLoading, isRowSelectable: props.selectable, noBorder: true, onCsvDownload: (r) => window.open(`/api/cms/datagrid/export/${props.entityAlias}?${(0, qs_1.stringify)(r)}`), onReload: onReload, rowHeight: props.rowHeight, schema: props.gridSchema, state: state }))));
132
+ react_1.default.createElement(data_grid_1.DataGrid, { NoRowsFallback: (_k = props.ui) === null || _k === void 0 ? void 0 : _k.NoRowsFallback, SelectedRowsToolbarActions: (_l = props.ui) === null || _l === void 0 ? void 0 : _l.SelectedRowsToolbarActions, actionCell: actionCell, actions: actions, bodyCells: (_m = props.ui) === null || _m === void 0 ? void 0 : _m.BodyCells, customActions: cActions, data: data, error: error, filterHandlers: (_o = props.ui) === null || _o === void 0 ? void 0 : _o.FilterHandlers, gridName: props.entityAlias, isLoading: isLoading, isRowSelectable: props.selectable, onCsvDownload: (r) => window.open(`/api/cms/datagrid/export/${props.entityAlias}?${(0, qs_1.stringify)(r)}`), onReload: onReload, rowHeight: props.rowHeight, schema: props.gridSchema, state: state }))));
133
133
  };
134
134
  GridPageComponent.displayName = "GridPageComponent";
135
135
  const GridPage = (config) => {
@@ -0,0 +1 @@
1
+ export declare function removeConfirmHandler(): Promise<boolean>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.removeConfirmHandler = removeConfirmHandler;
7
+ const button_1 = require("@uxf/ui/button");
8
+ const modal_1 = require("@uxf/ui/modal");
9
+ const modal_dialog_1 = require("@uxf/ui/modal-dialog/modal-dialog");
10
+ const react_1 = __importDefault(require("react"));
11
+ function removeConfirmHandler() {
12
+ return new Promise((resolve) => {
13
+ (0, modal_1.openModal)({
14
+ disableBackdropClose: true,
15
+ children: (react_1.default.createElement(modal_dialog_1.ModalDialog, { footer: react_1.default.createElement(react_1.default.Fragment, null,
16
+ react_1.default.createElement(button_1.Button, { onClick: () => {
17
+ resolve(false);
18
+ (0, modal_1.closeModal)();
19
+ } }, "Zru\u0161it"),
20
+ react_1.default.createElement(button_1.Button, { color: "negative", onClick: () => {
21
+ resolve(true);
22
+ (0, modal_1.closeModal)();
23
+ } }, "Ano, smazat")), title: "Opravdu chcete smazat tento soubor?" })),
24
+ width: "sm",
25
+ });
26
+ });
27
+ }
@@ -1 +0,0 @@
1
- export declare function onRemoveConfirm(): Promise<boolean>;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.onRemoveConfirm = onRemoveConfirm;
4
- const message_1 = require("@uxf/ui/message");
5
- function onRemoveConfirm() {
6
- return new Promise((resolve) => {
7
- message_1.MessageService.openConfirm({
8
- acceptLabel: "Yes, delete",
9
- cancelLabel: "Cancel",
10
- title: "Do you want to delete the file?",
11
- color: "error",
12
- variant: "centered",
13
- onAccept: () => resolve(true),
14
- onCancel: () => resolve(false),
15
- CustomIconComponent: null,
16
- });
17
- });
18
- }