@uxf/cms 11.41.4 → 11.42.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { SubmitHandler, UseFormReturn } from "react-hook-form";
3
+ import { ContentComponent } from "../pages/content-builder";
4
+ import { ContentBuilderFormData, FieldsConfiguration } from "./types";
5
+ interface ContentBuilderProps {
6
+ id?: string;
7
+ formApi: UseFormReturn<ContentBuilderFormData>;
8
+ onSubmit: SubmitHandler<ContentBuilderFormData>;
9
+ ContentComponents: ContentComponent<any>[];
10
+ uploadNamespace?: string;
11
+ fields?: FieldsConfiguration;
12
+ }
13
+ export declare function ContentBuilder(props: ContentBuilderProps): React.JSX.Element;
14
+ export {};
@@ -0,0 +1,51 @@
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;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ContentBuilder = ContentBuilder;
27
+ const tabs_1 = require("@uxf/ui/tabs");
28
+ const react_1 = __importStar(require("react"));
29
+ const content_builder_1 = require("../pages/content-builder");
30
+ const form_wrapper_1 = require("./form-wrapper");
31
+ const content_builder_basic_form_1 = require("./forms/content-builder-basic-form");
32
+ const content_builder_seo_form_1 = require("./forms/content-builder-seo-form");
33
+ const sidebar_1 = require("./sidebar");
34
+ var TabName;
35
+ (function (TabName) {
36
+ TabName["Basic"] = "basic";
37
+ TabName["Seo"] = "seo";
38
+ })(TabName || (TabName = {}));
39
+ function ContentBuilder(props) {
40
+ var _a;
41
+ const generatedId = (0, react_1.useId)();
42
+ const [activeTab, setActiveTab] = (0, react_1.useState)(TabName.Basic);
43
+ return (react_1.default.createElement(form_wrapper_1.FormWrapper, { formApi: props.formApi, id: (_a = props.id) !== null && _a !== void 0 ? _a : generatedId, onSubmit: props.onSubmit },
44
+ react_1.default.createElement(content_builder_1.ContentField, { contentComponents: props.ContentComponents, control: props.formApi.control, name: "content" }),
45
+ react_1.default.createElement(sidebar_1.Sidebar, { title: "Nastaven\u00ED" },
46
+ react_1.default.createElement(tabs_1.Tabs, { onChange: setActiveTab, value: activeTab },
47
+ react_1.default.createElement(tabs_1.Tabs.Panel, { isAlwaysMounted: true, label: "Z\u00E1kladn\u00ED", name: TabName.Basic },
48
+ react_1.default.createElement(content_builder_basic_form_1.ContentBuilderBasicForm, { className: "space-y-8", fields: props.fields, formApi: props.formApi, uploadNamespace: props.uploadNamespace })),
49
+ react_1.default.createElement(tabs_1.Tabs.Panel, { isAlwaysMounted: true, label: "SEO", name: TabName.Seo },
50
+ react_1.default.createElement(content_builder_seo_form_1.ContentBuilderSeoForm, { className: "space-y-8", fields: props.fields, formApi: props.formApi, uploadNamespace: props.uploadNamespace }))))));
51
+ }
@@ -0,0 +1,11 @@
1
+ import React, { ReactNode } from "react";
2
+ import { FieldValues, SubmitErrorHandler, SubmitHandler, UseFormReturn } from "react-hook-form";
3
+ interface Props<FormData extends FieldValues> {
4
+ id: string;
5
+ children: ReactNode;
6
+ formApi: UseFormReturn<FormData>;
7
+ onSubmit: SubmitHandler<FormData>;
8
+ onError?: SubmitErrorHandler<FormData>;
9
+ }
10
+ export declare function FormWrapper<FormData extends FieldValues>(props: Props<FormData>): React.JSX.Element;
11
+ export {};
@@ -0,0 +1,47 @@
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;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.FormWrapper = FormWrapper;
27
+ const form_1 = require("@uxf/form/form");
28
+ const rem_1 = require("@uxf/styles/units/rem");
29
+ const react_1 = __importStar(require("react"));
30
+ const constants_1 = require("../pages/content-builder/constants");
31
+ const details_visibility_context_1 = require("../pages/content-builder/context/details-visibility-context");
32
+ const use_viewport_height_1 = require("../utils/use-viewport-height");
33
+ function FormWrapper(props) {
34
+ const [headerHeight, setHeaderHeight] = (0, react_1.useState)(0);
35
+ const viewportHeight = (0, use_viewport_height_1.useViewportHeight)(true);
36
+ const height = viewportHeight === "100vh" ? viewportHeight : (0, rem_1.rem)(viewportHeight);
37
+ (0, react_1.useEffect)(() => {
38
+ const header = document.getElementById(constants_1.CONTENT_BUILDER_PAGE_HEADER_ID);
39
+ if (header) {
40
+ setHeaderHeight(header.offsetHeight);
41
+ }
42
+ }, []);
43
+ return (react_1.default.createElement(form_1.Form, { formApi: props.formApi, id: props.id, onError: props.onError, onSubmit: props.onSubmit },
44
+ 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) } },
45
+ react_1.default.createElement(details_visibility_context_1.DetailsVisibilityProvider, null, props.children),
46
+ " ")));
47
+ }
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { UseFormReturn } from "react-hook-form";
3
+ import { ContentBuilderFormData, FieldsConfiguration } from "../types";
4
+ export interface ContentBuilderBasicFormProps {
5
+ formApi: UseFormReturn<ContentBuilderFormData>;
6
+ className?: string;
7
+ uploadNamespace?: string;
8
+ fields?: FieldsConfiguration;
9
+ }
10
+ export declare function ContentBuilderBasicForm(props: ContentBuilderBasicFormProps): React.JSX.Element;
@@ -0,0 +1,46 @@
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.ContentBuilderBasicForm = ContentBuilderBasicForm;
7
+ const is_empty_1 = require("@uxf/core/utils/is-empty");
8
+ const is_nil_1 = require("@uxf/core/utils/is-nil");
9
+ const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
10
+ const slugify_1 = require("@uxf/core/utils/slugify");
11
+ const checkbox_input_1 = require("@uxf/form/checkbox-input");
12
+ const combobox_1 = require("@uxf/form/combobox");
13
+ const datetime_picker_input_1 = require("@uxf/form/datetime-picker-input");
14
+ const file_input_1 = require("@uxf/form/file-input");
15
+ const multi_combobox_1 = require("@uxf/form/multi-combobox");
16
+ const select_1 = require("@uxf/form/select");
17
+ const text_input_1 = require("@uxf/form/text-input");
18
+ const textarea_1 = require("@uxf/form/textarea");
19
+ const react_1 = __importDefault(require("react"));
20
+ const api_1 = require("../../api");
21
+ const visibilityLevelOptions = [
22
+ { id: "PRIVATE", label: "Privátní" },
23
+ { id: "PUBLIC_WITHOUT_SITEMAP", label: "Veřejný bez sitemapy" },
24
+ { id: "PUBLIC", label: "Veřejný" },
25
+ ];
26
+ function ContentBuilderBasicForm(props) {
27
+ 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;
28
+ const seoName = props.formApi.watch("seo.name");
29
+ const onBlurName = (event) => {
30
+ if ((0, is_nil_1.isNil)(seoName) || (0, is_empty_1.isEmpty)(seoName)) {
31
+ props.formApi.setValue("seo.name", (0, slugify_1.slugify)(event.target.value));
32
+ }
33
+ };
34
+ return (react_1.default.createElement("div", { className: props.className },
35
+ ((_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 })),
36
+ react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, isRequired: true, label: "Nadpis", name: "name", onBlur: onBlurName, type: "text" }),
37
+ !((_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: "Datum publikace", name: "publishedAt" })),
38
+ !((_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: "Perex", name: "perex", rows: 3 })),
39
+ !((_h = (_g = props.fields) === null || _g === void 0 ? void 0 : _g.author) === null || _h === void 0 ? void 0 : _h.isHidden) && ((_k = (_j = props.fields) === null || _j === void 0 ? void 0 : _j.author) === null || _k === void 0 ? void 0 : _k.autocomplete) && (react_1.default.createElement(combobox_1.Combobox, { control: props.formApi.control, label: "Autor", loadOptions: props.fields.author.autocomplete, name: "author" })),
40
+ !((_m = (_l = props.fields) === null || _l === void 0 ? void 0 : _l.category) === null || _m === void 0 ? void 0 : _m.isHidden) && ((_p = (_o = props.fields) === null || _o === void 0 ? void 0 : _o.category) === null || _p === void 0 ? void 0 : _p.autocomplete) && (react_1.default.createElement(combobox_1.Combobox, { control: props.formApi.control, label: "Kategorie", loadOptions: props.fields.category.autocomplete, name: "category" })),
41
+ !((_r = (_q = props.fields) === null || _q === void 0 ? void 0 : _q.tags) === null || _r === void 0 ? void 0 : _r.isHidden) && ((_t = (_s = props.fields) === null || _s === void 0 ? void 0 : _s.tags) === null || _t === void 0 ? void 0 : _t.autocomplete) && (react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: props.formApi.control, label: "Tagy", loadOptions: props.fields.tags.autocomplete, name: "tags" })),
42
+ !((_v = (_u = props.fields) === null || _u === void 0 ? void 0 : _u.image) === null || _v === void 0 ? void 0 : _v.isHidden) && (react_1.default.createElement(file_input_1.FileInput, { control: props.formApi.control, id: "image", label: "Hlavn\u00ED obr\u00E1zek", name: "image", onUploadFile: (file) => (0, api_1.uploadFile)(file, props.uploadNamespace) })),
43
+ !((_x = (_w = props.fields) === null || _w === void 0 ? void 0 : _w.isActive) === null || _x === void 0 ? void 0 : _x.isHidden) && (react_1.default.createElement(checkbox_input_1.CheckboxInput, { control: props.formApi.control, label: "Aktivn\u00ED", name: "isActive" })),
44
+ !((_z = (_y = props.fields) === null || _y === void 0 ? void 0 : _y.visibilityLevel) === null || _z === void 0 ? void 0 : _z.isHidden) && (react_1.default.createElement(select_1.Select, { control: props.formApi.control, isRequired: true, label: "Viditelnost", name: "visibilityLevel", options: visibilityLevelOptions })),
45
+ (0, is_not_nil_1.isNotNil)((_1 = (_0 = props.fields) === null || _0 === void 0 ? void 0 : _0.parent) === null || _1 === void 0 ? void 0 : _1.autocomplete) && (react_1.default.createElement(combobox_1.Combobox, { control: props.formApi.control, label: "Nad\u0159azen\u00FD \u010Dl\u00E1nek", loadOptions: props.fields.parent.autocomplete, name: "parent" }))));
46
+ }
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { UseFormReturn } from "react-hook-form";
3
+ import { ContentBuilderFormData, FieldsConfiguration } from "../types";
4
+ export interface ContentBuilderSeoFormProps {
5
+ formApi: UseFormReturn<ContentBuilderFormData>;
6
+ className?: string;
7
+ uploadNamespace?: string;
8
+ fields?: FieldsConfiguration;
9
+ }
10
+ export declare function ContentBuilderSeoForm(props: ContentBuilderSeoFormProps): React.JSX.Element;
@@ -0,0 +1,20 @@
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.ContentBuilderSeoForm = ContentBuilderSeoForm;
7
+ const file_input_1 = require("@uxf/form/file-input");
8
+ const text_input_1 = require("@uxf/form/text-input");
9
+ const react_1 = __importDefault(require("react"));
10
+ const api_1 = require("../../api");
11
+ function ContentBuilderSeoForm(props) {
12
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
13
+ return (react_1.default.createElement("div", { className: props.className },
14
+ !((_c = (_b = (_a = props.fields) === null || _a === void 0 ? void 0 : _a.seo) === null || _b === void 0 ? void 0 : _b.name) === null || _c === void 0 ? void 0 : _c.isHidden) && (react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, helperText: "Slug = unik\u00E1tn\u00ED koncovka URL adresy", isRequired: true, label: "Slug", name: "seo.name", type: "text" })),
15
+ !((_f = (_e = (_d = props.fields) === null || _d === void 0 ? void 0 : _d.seo) === null || _e === void 0 ? void 0 : _e.title) === null || _f === void 0 ? void 0 : _f.isHidden) && (react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, label: "Nadpis", name: "seo.title", type: "text" })),
16
+ !((_j = (_h = (_g = props.fields) === null || _g === void 0 ? void 0 : _g.seo) === null || _h === void 0 ? void 0 : _h.description) === null || _j === void 0 ? void 0 : _j.isHidden) && (react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, label: "Popis", name: "seo.description", type: "text" })),
17
+ !((_m = (_l = (_k = props.fields) === null || _k === void 0 ? void 0 : _k.seo) === null || _l === void 0 ? void 0 : _l.ogTitle) === null || _m === void 0 ? void 0 : _m.isHidden) && (react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, helperText: "Nadpis kter\u00FD bude zobrazen p\u0159i sd\u00EDlen\u00ED na Facebooku, ...", label: "OG nadpis", name: "seo.ogTitle", type: "text" })),
18
+ !((_q = (_p = (_o = props.fields) === null || _o === void 0 ? void 0 : _o.seo) === null || _p === void 0 ? void 0 : _p.ogDescription) === null || _q === void 0 ? void 0 : _q.isHidden) && (react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, helperText: "Popis kter\u00FD bude zobrazen p\u0159i sd\u00EDlen\u00ED na Facebooku, ...", label: "OG popis", name: "seo.ogDescription", type: "text" })),
19
+ !((_t = (_s = (_r = props.fields) === null || _r === void 0 ? void 0 : _r.seo) === null || _s === void 0 ? void 0 : _s.ogImage) === null || _t === void 0 ? void 0 : _t.isHidden) && (react_1.default.createElement(file_input_1.FileInput, { control: props.formApi.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: (file) => (0, api_1.uploadFile)(file, props.uploadNamespace) }))));
20
+ }
@@ -0,0 +1,4 @@
1
+ export * from "./content-builder";
2
+ export * from "./form-wrapper";
3
+ export * from "./map-content-response-to-form-data";
4
+ export * from "./map-form-data-to-content-request";
@@ -0,0 +1,20 @@
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./content-builder"), exports);
18
+ __exportStar(require("./form-wrapper"), exports);
19
+ __exportStar(require("./map-content-response-to-form-data"), exports);
20
+ __exportStar(require("./map-form-data-to-content-request"), exports);
@@ -0,0 +1,3 @@
1
+ import { Nullish } from "@uxf/core/types";
2
+ import { ContentBuilderFormData, ContentResponse } from "./types";
3
+ export declare function mapContentResponseToFormData(content: ContentResponse | Nullish): ContentBuilderFormData;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapContentResponseToFormData = mapContentResponseToFormData;
4
+ function mapContentResponseToFormData(content) {
5
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
6
+ return {
7
+ name: (_a = content === null || content === void 0 ? void 0 : content.name) !== null && _a !== void 0 ? _a : "",
8
+ visibilityLevel: (_b = content === null || content === void 0 ? void 0 : content.visibilityLevel) !== null && _b !== void 0 ? _b : null,
9
+ author: (content === null || content === void 0 ? void 0 : content.author)
10
+ ? {
11
+ id: content.author.id,
12
+ label: `${content.author.firstName} ${content.author.surname}`,
13
+ }
14
+ : null,
15
+ image: (_c = content === null || content === void 0 ? void 0 : content.image) !== null && _c !== void 0 ? _c : null,
16
+ publishedAt: (_d = content === null || content === void 0 ? void 0 : content.publishedAt) !== null && _d !== void 0 ? _d : null,
17
+ type: (_e = content === null || content === void 0 ? void 0 : content.type) !== null && _e !== void 0 ? _e : null,
18
+ category: (content === null || content === void 0 ? void 0 : content.category)
19
+ ? {
20
+ id: content.category.id,
21
+ label: content.category.name,
22
+ }
23
+ : null,
24
+ parent: (_f = content === null || content === void 0 ? void 0 : content.parent) !== null && _f !== void 0 ? _f : null,
25
+ isActive: !(content === null || content === void 0 ? void 0 : content.hidden),
26
+ perex: (_g = content === null || content === void 0 ? void 0 : content.perex) !== null && _g !== void 0 ? _g : null,
27
+ tags: (_h = content === null || content === void 0 ? void 0 : content.tags) !== null && _h !== void 0 ? _h : [],
28
+ seo: {
29
+ name: (_j = content === null || content === void 0 ? void 0 : content.seo.name) !== null && _j !== void 0 ? _j : "",
30
+ title: (_k = content === null || content === void 0 ? void 0 : content.seo.title) !== null && _k !== void 0 ? _k : "",
31
+ description: (_l = content === null || content === void 0 ? void 0 : content.seo.description) !== null && _l !== void 0 ? _l : "",
32
+ ogTitle: (_m = content === null || content === void 0 ? void 0 : content.seo.ogTitle) !== null && _m !== void 0 ? _m : "",
33
+ ogDescription: (_o = content === null || content === void 0 ? void 0 : content.seo.ogDescription) !== null && _o !== void 0 ? _o : "",
34
+ ogImage: (_p = content === null || content === void 0 ? void 0 : content.seo.ogImage) !== null && _p !== void 0 ? _p : null,
35
+ },
36
+ content: { data: (_q = content === null || content === void 0 ? void 0 : content.content) !== null && _q !== void 0 ? _q : [], search: "" },
37
+ };
38
+ }
@@ -0,0 +1,2 @@
1
+ import { ContentBuilderFormData, ContentRequestBody } from "./types";
2
+ export declare function mapFormDataToContentRequest(values: ContentBuilderFormData): ContentRequestBody;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapFormDataToContentRequest = mapFormDataToContentRequest;
4
+ function mapFormDataToContentRequest(values) {
5
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
6
+ return {
7
+ author: (_b = (_a = values.author) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null,
8
+ category: (_c = values.category) === null || _c === void 0 ? void 0 : _c.id,
9
+ content: values.content,
10
+ hidden: !values.isActive,
11
+ image: (_e = (_d = values.image) === null || _d === void 0 ? void 0 : _d.id) !== null && _e !== void 0 ? _e : null,
12
+ name: (_f = values.name) !== null && _f !== void 0 ? _f : "",
13
+ parent: (_g = values.parent) === null || _g === void 0 ? void 0 : _g.id,
14
+ perex: (_h = values.perex) !== null && _h !== void 0 ? _h : "",
15
+ publishedAt: values.publishedAt,
16
+ seo: {
17
+ description: (_j = values.seo.description) !== null && _j !== void 0 ? _j : "",
18
+ name: values.seo.name,
19
+ ogDescription: (_k = values.seo.ogDescription) !== null && _k !== void 0 ? _k : "",
20
+ ogImage: (_m = (_l = values.seo.ogImage) === null || _l === void 0 ? void 0 : _l.id) !== null && _m !== void 0 ? _m : null,
21
+ ogTitle: (_o = values.seo.ogTitle) !== null && _o !== void 0 ? _o : "",
22
+ title: (_p = values.seo.title) !== null && _p !== void 0 ? _p : "",
23
+ },
24
+ tags: (_r = (_q = values.tags) === null || _q === void 0 ? void 0 : _q.map((tag) => tag.id)) !== null && _r !== void 0 ? _r : [],
25
+ type: (_s = values.type) !== null && _s !== void 0 ? _s : "",
26
+ visibilityLevel: (_t = values.visibilityLevel) !== null && _t !== void 0 ? _t : "PRIVATE",
27
+ };
28
+ }
@@ -0,0 +1,7 @@
1
+ import React, { ReactNode } from "react";
2
+ interface Props {
3
+ children: ReactNode;
4
+ title: string;
5
+ }
6
+ export declare function Sidebar(props: Props): React.JSX.Element;
7
+ export {};
@@ -0,0 +1,12 @@
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.Sidebar = Sidebar;
7
+ const react_1 = __importDefault(require("react"));
8
+ function Sidebar(props) {
9
+ return (react_1.default.createElement("div", { className: "shrink-0 basis-[500px] bg-white px-4 pb-8 xl:overflow-y-auto dark:bg-gray-950" },
10
+ react_1.default.createElement("h2", { className: "uxf-typo-h5 px-4 pb-4 pt-6" }, props.title),
11
+ props.children));
12
+ }
@@ -0,0 +1,182 @@
1
+ import { CheckboxInputValue } from "@uxf/form/checkbox-input";
2
+ import { ComboboxValue } from "@uxf/form/combobox";
3
+ import { DatetimePickerInputValue } from "@uxf/form/datetime-picker-input";
4
+ import { FileInputValue } from "@uxf/form/file-input";
5
+ import { MultiComboboxValue } from "@uxf/form/multi-combobox";
6
+ import { SelectValue } from "@uxf/form/select";
7
+ import { TextInputValue } from "@uxf/form/text-input";
8
+ import { TextareaValue } from "@uxf/form/textarea";
9
+ import { SelectOption } from "@uxf/ui/select";
10
+ export type ContentBuilderFormData = {
11
+ author: ComboboxValue<number>;
12
+ category: ComboboxValue<number>;
13
+ content: {
14
+ data: any[];
15
+ search: string;
16
+ };
17
+ image: FileInputValue;
18
+ isActive: CheckboxInputValue;
19
+ name: TextInputValue;
20
+ parent: ComboboxValue<number>;
21
+ perex: TextareaValue;
22
+ publishedAt: DatetimePickerInputValue;
23
+ seo: {
24
+ description: TextInputValue;
25
+ name: TextInputValue;
26
+ ogDescription: TextInputValue;
27
+ ogImage: FileInputValue;
28
+ ogTitle: TextInputValue;
29
+ title: TextInputValue;
30
+ };
31
+ tags: MultiComboboxValue<number>;
32
+ type: SelectValue<string>;
33
+ visibilityLevel: SelectValue<VisibilityLevel>;
34
+ };
35
+ export type FieldsConfiguration = {
36
+ parent?: {
37
+ autocomplete?: Autocomplete;
38
+ };
39
+ type?: {
40
+ options?: SelectOption[];
41
+ isReadOnly?: boolean;
42
+ };
43
+ publishedAt?: {
44
+ isHidden?: boolean;
45
+ };
46
+ perex?: {
47
+ isHidden?: boolean;
48
+ };
49
+ author?: {
50
+ autocomplete?: Autocomplete;
51
+ isHidden?: boolean;
52
+ };
53
+ category?: {
54
+ autocomplete?: Autocomplete;
55
+ isHidden?: boolean;
56
+ };
57
+ tags?: {
58
+ autocomplete?: Autocomplete;
59
+ isHidden?: boolean;
60
+ };
61
+ image?: {
62
+ isHidden?: boolean;
63
+ };
64
+ visibilityLevel?: {
65
+ isHidden?: boolean;
66
+ };
67
+ isActive?: {
68
+ isHidden?: boolean;
69
+ };
70
+ seo?: {
71
+ isHidden?: boolean;
72
+ name?: {
73
+ isHidden?: boolean;
74
+ };
75
+ title?: {
76
+ isHidden?: boolean;
77
+ };
78
+ description?: {
79
+ isHidden?: boolean;
80
+ };
81
+ ogTitle?: {
82
+ isHidden?: boolean;
83
+ };
84
+ ogDescription?: {
85
+ isHidden?: boolean;
86
+ };
87
+ ogImage?: {
88
+ isHidden?: boolean;
89
+ };
90
+ };
91
+ };
92
+ export type VisibilityLevel = "PUBLIC" | "PUBLIC_WITHOUT_SITEMAP" | "PRIVATE";
93
+ export interface AutocompleteResponse {
94
+ id: number;
95
+ label: string;
96
+ }
97
+ export interface StorageImageResponse {
98
+ id: number;
99
+ uuid: string;
100
+ type: string;
101
+ extension: string;
102
+ name: string;
103
+ namespace: string;
104
+ width: number;
105
+ height: number;
106
+ size: number;
107
+ createdAt: string;
108
+ fileType: "image";
109
+ }
110
+ interface ContentSeo {
111
+ name: string | null;
112
+ title: string;
113
+ description: string;
114
+ ogTitle: string;
115
+ ogDescription: string;
116
+ ogImage: number | null;
117
+ }
118
+ interface ContentSeoResponse {
119
+ name: string | null;
120
+ title: string;
121
+ description: string;
122
+ ogTitle: string;
123
+ ogDescription: string;
124
+ ogImage: StorageImageResponse | null;
125
+ }
126
+ export interface ContentLite {
127
+ data: Array<any>;
128
+ search: string;
129
+ }
130
+ export interface ContentRequestBody {
131
+ type: string;
132
+ name: string;
133
+ perex: string;
134
+ seo: ContentSeo;
135
+ visibilityLevel: VisibilityLevel;
136
+ hidden: boolean;
137
+ image: number | null;
138
+ publishedAt: string | null;
139
+ author: number | null;
140
+ content: ContentLite;
141
+ tags: Array<number>;
142
+ parent?: number | null;
143
+ category?: number | null;
144
+ }
145
+ export interface ContentCategoryResponse {
146
+ id: number;
147
+ name: string;
148
+ }
149
+ export interface ContentPreviewResponse {
150
+ id: number;
151
+ name: string;
152
+ label: string;
153
+ }
154
+ export interface ContentAuthorResponse {
155
+ id: number;
156
+ firstName: string;
157
+ surname: string;
158
+ avatar: StorageImageResponse | null;
159
+ }
160
+ export interface ContentResponse {
161
+ id: number;
162
+ type: string;
163
+ name: string;
164
+ perex: string;
165
+ seo: ContentSeoResponse;
166
+ visibilityLevel: VisibilityLevel;
167
+ hidden: boolean;
168
+ image: StorageImageResponse | null;
169
+ publishedAt: string | null;
170
+ author: ContentAuthorResponse | null;
171
+ parent: ContentPreviewResponse | null;
172
+ category: ContentCategoryResponse | null;
173
+ content: Array<any>;
174
+ tags: Array<AutocompleteResponse>;
175
+ createdAt: string;
176
+ updatedAt: string;
177
+ }
178
+ export type Autocomplete = (value: string) => Promise<Array<{
179
+ id: string | number;
180
+ label: string;
181
+ }>>;
182
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { UseFormProps } from "react-hook-form";
2
+ import { ContentBuilderFormData } from "./types";
3
+ export declare function useContentBuilderFormApi(props: UseFormProps<ContentBuilderFormData>): import("react-hook-form").UseFormReturn<ContentBuilderFormData, any, undefined>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useContentBuilderFormApi = useContentBuilderFormApi;
4
+ const react_hook_form_1 = require("react-hook-form");
5
+ function useContentBuilderFormApi(props) {
6
+ return (0, react_hook_form_1.useForm)(props);
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/cms",
3
- "version": "11.41.4",
3
+ "version": "11.42.1",
4
4
  "description": "UXF Cms",
5
5
  "author": "UXFans <dev@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/cms#readme",
@@ -30,13 +30,13 @@
30
30
  "@dnd-kit/utilities": "3.2.2",
31
31
  "@floating-ui/react": "0.26.23",
32
32
  "@redux-devtools/extension": "3.3.0",
33
- "@uxf/core": "11.35.0",
34
- "@uxf/core-react": "11.38.3",
35
- "@uxf/data-grid": "11.41.4",
36
- "@uxf/form": "11.40.0",
37
- "@uxf/router": "11.32.0",
38
- "@uxf/ui": "11.40.0",
39
- "@uxf/wysiwyg": "11.40.0",
33
+ "@uxf/core": "11.42.0",
34
+ "@uxf/core-react": "11.42.0",
35
+ "@uxf/data-grid": "11.42.0",
36
+ "@uxf/form": "11.42.1",
37
+ "@uxf/router": "11.42.0",
38
+ "@uxf/ui": "11.42.0",
39
+ "@uxf/wysiwyg": "11.42.0",
40
40
  "axios": "1.7.5",
41
41
  "axios-hooks": "5.0.2",
42
42
  "es6-error": "4.1.1",
@@ -1,2 +1,3 @@
1
1
  import { Content, ContentBuilderConfig } from "./types";
2
+ /** @deprecated use ContentBuilder from @uxf/cms/content-builder */
2
3
  export declare const ContentBuilderPage: <T extends Content<string, any>>(config: ContentBuilderConfig<T>) => import("next").NextComponentType<import("../../deprecated/types/app").IAppContext, object, object>;
@@ -88,6 +88,7 @@ const ContentBuilderPageComponent = (props) => {
88
88
  react_1.default.createElement(form_1.Form, { config: props.config, defaultValues: props.initialValues, id: props.id, onSubmit: handleSubmit }))));
89
89
  };
90
90
  ContentBuilderPageComponent.displayName = "ContentBuilderComponent";
91
+ /** @deprecated use ContentBuilder from @uxf/cms/content-builder */
91
92
  const ContentBuilderPage = (config) => {
92
93
  const Page = (props) => {
93
94
  return react_1.default.createElement(ContentBuilderPageComponent, { config: config, id: props.id, initialValues: props.initialValues });
@@ -5,6 +5,9 @@ import { NextPageContext } from "next";
5
5
  import { FC, PropsWithChildren, ReactNode } from "react";
6
6
  import { Control, ControllerRenderProps } from "react-hook-form";
7
7
  import { ContentResponse, ContentTagResponse } from "../../api";
8
+ export type KeysOfType<T, U> = {
9
+ [K in keyof T]: T[K] extends U ? K : never;
10
+ }[keyof T];
8
11
  export type VisibilityLevel = "PUBLIC" | "PUBLIC_WITHOUT_SITEMAP" | "PRIVATE";
9
12
  export interface Content<Type extends string, ContentType> {
10
13
  type: Type;