@uxf/cms 11.40.0 → 11.41.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.40.0",
3
+ "version": "11.41.0",
4
4
  "description": "UXF Cms",
5
5
  "author": "UXFans <dev@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/cms#readme",
@@ -1,3 +1,4 @@
1
+ import { ComboboxOption } from "@uxf/ui/combobox";
1
2
  import React, { Dispatch, ReactNode, SetStateAction } from "react";
2
3
  import { Control } from "react-hook-form";
3
4
  import { ContentBuilderTabs } from "../constants";
@@ -9,6 +10,7 @@ interface Props {
9
10
  control: Control<any>;
10
11
  id: number | null;
11
12
  setActiveTab: Dispatch<SetStateAction<ContentBuilderTabs>>;
13
+ parentAutocomplete?: (value: string) => Promise<ComboboxOption[]>;
12
14
  }
13
15
  export declare function FormRootFields(props: Props): React.JSX.Element;
14
16
  export {};
@@ -28,51 +28,34 @@ function FormRootFields(props) {
28
28
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
29
29
  return (react_1.default.createElement("div", { className: "pb-2 pt-4" },
30
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 },
32
- react_1.default.createElement("div", { className: "space-y-8 px-4 pb-4" },
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 }))),
35
- react_1.default.createElement("div", null,
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" }))),
49
- react_1.default.createElement("div", null,
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 }))),
54
- react_1.default.createElement("div", null,
55
- react_1.default.createElement(checkbox_input_1.CheckboxInput, { control: props.control, label: "Aktivn\u00ED", name: "active" })),
56
- react_1.default.createElement("div", null,
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 },
59
- react_1.default.createElement("div", { className: "space-y-8 px-4 pb-4" },
60
- react_1.default.createElement("div", null,
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 })))))),
31
+ react_1.default.createElement(tabs_1.Tabs.Panel, { classNamePanel: "space-y-8 px-4 pb-4", isAlwaysMounted: true, label: "Z\u00E1kladn\u00ED", name: constants_1.ContentBuilderTabs.Basic },
32
+ (0, is_not_nil_1.isNotNil)(props.parentAutocomplete) && (react_1.default.createElement(combobox_1.Combobox, { control: props.control, label: "Nad\u0159azen\u00FD \u010Dl\u00E1nek", loadOptions: props.parentAutocomplete, name: "parent" })),
33
+ props.config.allowedTypes && (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 })),
34
+ react_1.default.createElement(text_input_1.TextInput, { control: props.control, isRequired: true, label: "Nadpis", name: "name", type: "text" }),
35
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_a = props.config.hide) === null || _a === void 0 ? void 0 : _a.publishedAt) },
36
+ react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { control: props.control, isRequired: true, label: "Datum publikace", name: "publishedAt" })),
37
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_b = props.config.hide) === null || _b === void 0 ? void 0 : _b.perex) },
38
+ react_1.default.createElement(textarea_1.Textarea, { control: props.control, label: "Perex", name: "perex", rows: 3 })),
39
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_c = props.config.hide) === null || _c === void 0 ? void 0 : _c.author) },
40
+ 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" })),
41
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_d = props.config.hide) === null || _d === void 0 ? void 0 : _d.category) },
42
+ 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" })),
43
+ 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" }),
44
+ react_1.default.createElement(hide_1.Hide, { when: Boolean((_e = props.config.hide) === null || _e === void 0 ? void 0 : _e.image) },
45
+ 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 })),
46
+ react_1.default.createElement(checkbox_input_1.CheckboxInput, { control: props.control, label: "Aktivn\u00ED", name: "active" }),
47
+ react_1.default.createElement(select_1.Select, { control: props.control, isRequired: true, label: "Viditelnost", name: "visibilityLevel", options: options })),
48
+ react_1.default.createElement(tabs_1.Tabs.Panel, { classNamePanel: "space-y-8 px-4 pb-4", isAlwaysMounted: true, label: "SEO", name: constants_1.ContentBuilderTabs.Seo },
49
+ 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" }),
50
+ 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) },
51
+ react_1.default.createElement(text_input_1.TextInput, { control: props.control, label: "Nadpis", name: "seo.title", type: "text" })),
52
+ 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) },
53
+ react_1.default.createElement(text_input_1.TextInput, { control: props.control, label: "Popis", name: "seo.description", type: "text" })),
54
+ 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) },
55
+ 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" })),
56
+ 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) },
57
+ 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" })),
58
+ 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) },
59
+ 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
60
  props.children));
78
61
  }
@@ -1,4 +1,5 @@
1
1
  import { FormProps as UXFFormProps } from "@uxf/form/form";
2
+ import { ComboboxOption } from "@uxf/ui/combobox";
2
3
  import React from "react";
3
4
  import { DefaultValues } from "react-hook-form";
4
5
  import { ContentBuilderConfig, RootContent } from "../types";
@@ -6,5 +7,6 @@ export interface FormProps extends Omit<UXFFormProps<RootContent<any>>, "childre
6
7
  config: ContentBuilderConfig<any>;
7
8
  id: number | null;
8
9
  defaultValues?: DefaultValues<any>;
10
+ parentAutocomplete?: (value: string) => Promise<ComboboxOption[]>;
9
11
  }
10
12
  export declare function Form(props: FormProps): React.JSX.Element;
@@ -35,6 +35,7 @@ const details_visibility_context_1 = require("../context/details-visibility-cont
35
35
  const form_root_fields_1 = require("./form-root-fields");
36
36
  // TODO: Mapování inputů na taby, asi by šlo udělat lépe
37
37
  const INPUT_TAB_MAP = {
38
+ parent: constants_1.ContentBuilderTabs.Basic,
38
39
  active: constants_1.ContentBuilderTabs.Basic,
39
40
  author: constants_1.ContentBuilderTabs.Basic,
40
41
  category: constants_1.ContentBuilderTabs.Basic,
@@ -77,5 +78,5 @@ function Form(props) {
77
78
  react_1.default.createElement(content_field_1.ContentField, { contentComponents: props.config.contentComponents, control: formApi.control, name: "content" })),
78
79
  react_1.default.createElement("div", { className: "shrink-0 basis-[500px] bg-white px-4 pb-8 xl:overflow-y-auto dark:bg-gray-950" },
79
80
  react_1.default.createElement("h2", { className: "uxf-typo-h5 px-4 pb-4 pt-6" }, "Nastaven\u00ED"),
80
- react_1.default.createElement(form_root_fields_1.FormRootFields, { activeTab: activeTab, config: props.config, control: formApi.control, id: props.id, setActiveTab: setActiveTab })))));
81
+ react_1.default.createElement(form_root_fields_1.FormRootFields, { activeTab: activeTab, config: props.config, control: formApi.control, id: props.id, parentAutocomplete: props.parentAutocomplete, setActiveTab: setActiveTab })))));
81
82
  }
@@ -1,5 +1,6 @@
1
1
  import { FileResponse } from "@uxf/core/types";
2
2
  import { SelectProps } from "@uxf/form/select";
3
+ import { ComboboxValue } from "@uxf/ui/combobox";
3
4
  import { NextPageContext } from "next";
4
5
  import { FC, PropsWithChildren, ReactNode } from "react";
5
6
  import { Control, ControllerRenderProps } from "react-hook-form";
@@ -29,6 +30,7 @@ export type ContentComponent<T extends Content<string, any>, Props extends Conte
29
30
  };
30
31
  export type ContentPageType = "BLOG" | "LANDING_PAGE" | "QUESTION" | "TERM";
31
32
  export type RootContent<T> = {
33
+ parent?: ComboboxValue<number> | null;
32
34
  type: string | null;
33
35
  active: boolean;
34
36
  visibilityLevel: VisibilityLevel;