@uxf/cms 14.0.0 → 14.1.0
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.ContentBuilderSeoForm = ContentBuilderSeoForm;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const translations_1 = require("@uxf/core-react/translations");
|
|
8
9
|
const file_input_1 = require("@uxf/form/file-input");
|
|
9
10
|
const text_input_1 = require("@uxf/form/text-input");
|
|
@@ -11,13 +12,96 @@ const react_1 = __importDefault(require("react"));
|
|
|
11
12
|
const api_1 = require("../../api");
|
|
12
13
|
// eslint-disable-next-line complexity
|
|
13
14
|
function ContentBuilderSeoForm(props) {
|
|
14
|
-
var _a, _b,
|
|
15
|
+
var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30;
|
|
16
|
+
const $ = (0, compiler_runtime_1.c)(33);
|
|
15
17
|
const t = (0, translations_1.useUxfTranslation)();
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
!((
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
let t0;
|
|
19
|
+
if ($[0] !== ((_d = (_b = (_a = props.fields) === null || _a === void 0 ? void 0 : _a.seo) === null || _b === void 0 ? void 0 : _b.name) === null || _d === void 0 ? void 0 : _d.isHidden) || $[1] !== props.formApi || $[2] !== t) {
|
|
20
|
+
t0 = !((_g = (_f = (_e = props.fields) === null || _e === void 0 ? void 0 : _e.seo) === null || _f === void 0 ? void 0 : _f.name) === null || _g === void 0 ? void 0 : _g.isHidden) && react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, helperText: t("uxf-cms-content-builder:seo-form.slug-helper"), isRequired: true, label: t("uxf-cms-content-builder:seo-form.slug"), name: "seo.name", type: "text" });
|
|
21
|
+
$[0] = (_k = (_j = (_h = props.fields) === null || _h === void 0 ? void 0 : _h.seo) === null || _j === void 0 ? void 0 : _j.name) === null || _k === void 0 ? void 0 : _k.isHidden;
|
|
22
|
+
$[1] = props.formApi;
|
|
23
|
+
$[2] = t;
|
|
24
|
+
$[3] = t0;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
t0 = $[3];
|
|
28
|
+
}
|
|
29
|
+
let t1;
|
|
30
|
+
if ($[4] !== ((_o = (_m = (_l = props.fields) === null || _l === void 0 ? void 0 : _l.seo) === null || _m === void 0 ? void 0 : _m.title) === null || _o === void 0 ? void 0 : _o.isHidden) || $[5] !== props.formApi || $[6] !== t) {
|
|
31
|
+
t1 = !((_r = (_q = (_p = props.fields) === null || _p === void 0 ? void 0 : _p.seo) === null || _q === void 0 ? void 0 : _q.title) === null || _r === void 0 ? void 0 : _r.isHidden) && react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, label: t("uxf-cms-content-builder:seo-form.title"), name: "seo.title", type: "text" });
|
|
32
|
+
$[4] = (_u = (_t = (_s = props.fields) === null || _s === void 0 ? void 0 : _s.seo) === null || _t === void 0 ? void 0 : _t.title) === null || _u === void 0 ? void 0 : _u.isHidden;
|
|
33
|
+
$[5] = props.formApi;
|
|
34
|
+
$[6] = t;
|
|
35
|
+
$[7] = t1;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
t1 = $[7];
|
|
39
|
+
}
|
|
40
|
+
let t2;
|
|
41
|
+
if ($[8] !== ((_x = (_w = (_v = props.fields) === null || _v === void 0 ? void 0 : _v.seo) === null || _w === void 0 ? void 0 : _w.description) === null || _x === void 0 ? void 0 : _x.isHidden) || $[9] !== props.formApi || $[10] !== t) {
|
|
42
|
+
t2 = !((_0 = (_z = (_y = props.fields) === null || _y === void 0 ? void 0 : _y.seo) === null || _z === void 0 ? void 0 : _z.description) === null || _0 === void 0 ? void 0 : _0.isHidden) && react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, label: t("uxf-cms-content-builder:seo-form.description"), name: "seo.description", type: "text" });
|
|
43
|
+
$[8] = (_3 = (_2 = (_1 = props.fields) === null || _1 === void 0 ? void 0 : _1.seo) === null || _2 === void 0 ? void 0 : _2.description) === null || _3 === void 0 ? void 0 : _3.isHidden;
|
|
44
|
+
$[9] = props.formApi;
|
|
45
|
+
$[10] = t;
|
|
46
|
+
$[11] = t2;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
t2 = $[11];
|
|
50
|
+
}
|
|
51
|
+
let t3;
|
|
52
|
+
if ($[12] !== ((_6 = (_5 = (_4 = props.fields) === null || _4 === void 0 ? void 0 : _4.seo) === null || _5 === void 0 ? void 0 : _5.ogTitle) === null || _6 === void 0 ? void 0 : _6.isHidden) || $[13] !== props.formApi || $[14] !== t) {
|
|
53
|
+
t3 = !((_9 = (_8 = (_7 = props.fields) === null || _7 === void 0 ? void 0 : _7.seo) === null || _8 === void 0 ? void 0 : _8.ogTitle) === null || _9 === void 0 ? void 0 : _9.isHidden) && react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, helperText: t("uxf-cms-content-builder:seo-form.og-title-helper"), label: "OG nadpis", name: "seo.ogTitle", type: "text" });
|
|
54
|
+
$[12] = (_12 = (_11 = (_10 = props.fields) === null || _10 === void 0 ? void 0 : _10.seo) === null || _11 === void 0 ? void 0 : _11.ogTitle) === null || _12 === void 0 ? void 0 : _12.isHidden;
|
|
55
|
+
$[13] = props.formApi;
|
|
56
|
+
$[14] = t;
|
|
57
|
+
$[15] = t3;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
t3 = $[15];
|
|
61
|
+
}
|
|
62
|
+
let t4;
|
|
63
|
+
if ($[16] !== ((_15 = (_14 = (_13 = props.fields) === null || _13 === void 0 ? void 0 : _13.seo) === null || _14 === void 0 ? void 0 : _14.ogDescription) === null || _15 === void 0 ? void 0 : _15.isHidden) || $[17] !== props.formApi || $[18] !== t) {
|
|
64
|
+
t4 = !((_18 = (_17 = (_16 = props.fields) === null || _16 === void 0 ? void 0 : _16.seo) === null || _17 === void 0 ? void 0 : _17.ogDescription) === null || _18 === void 0 ? void 0 : _18.isHidden) && react_1.default.createElement(text_input_1.TextInput, { control: props.formApi.control, helperText: t("uxf-cms-content-builder:seo-form.og-description-helper"), label: "OG popis", name: "seo.ogDescription", type: "text" });
|
|
65
|
+
$[16] = (_21 = (_20 = (_19 = props.fields) === null || _19 === void 0 ? void 0 : _19.seo) === null || _20 === void 0 ? void 0 : _20.ogDescription) === null || _21 === void 0 ? void 0 : _21.isHidden;
|
|
66
|
+
$[17] = props.formApi;
|
|
67
|
+
$[18] = t;
|
|
68
|
+
$[19] = t4;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
t4 = $[19];
|
|
72
|
+
}
|
|
73
|
+
let t5;
|
|
74
|
+
if ($[20] !== ((_24 = (_23 = (_22 = props.fields) === null || _22 === void 0 ? void 0 : _22.seo) === null || _23 === void 0 ? void 0 : _23.ogImage) === null || _24 === void 0 ? void 0 : _24.isHidden) || $[21] !== props.formApi || $[22] !== props.uploadNamespace || $[23] !== t) {
|
|
75
|
+
t5 = !((_27 = (_26 = (_25 = props.fields) === null || _25 === void 0 ? void 0 : _25.seo) === null || _26 === void 0 ? void 0 : _26.ogImage) === null || _27 === void 0 ? void 0 : _27.isHidden) && react_1.default.createElement(file_input_1.FileInput, { control: props.formApi.control, helperText: t("uxf-cms-content-builder:seo-form.og-image-helper"), id: "seo.ogImage", label: t("uxf-cms-content-builder:seo-form.og-image"), name: "seo.ogImage", onUploadFile: file => (0, api_1.uploadFile)(file, props.uploadNamespace) });
|
|
76
|
+
$[20] = (_30 = (_29 = (_28 = props.fields) === null || _28 === void 0 ? void 0 : _28.seo) === null || _29 === void 0 ? void 0 : _29.ogImage) === null || _30 === void 0 ? void 0 : _30.isHidden;
|
|
77
|
+
$[21] = props.formApi;
|
|
78
|
+
$[22] = props.uploadNamespace;
|
|
79
|
+
$[23] = t;
|
|
80
|
+
$[24] = t5;
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
t5 = $[24];
|
|
84
|
+
}
|
|
85
|
+
let t6;
|
|
86
|
+
if ($[25] !== props.className || $[26] !== t0 || $[27] !== t1 || $[28] !== t2 || $[29] !== t3 || $[30] !== t4 || $[31] !== t5) {
|
|
87
|
+
t6 = react_1.default.createElement("div", { className: props.className },
|
|
88
|
+
t0,
|
|
89
|
+
t1,
|
|
90
|
+
t2,
|
|
91
|
+
t3,
|
|
92
|
+
t4,
|
|
93
|
+
t5);
|
|
94
|
+
$[25] = props.className;
|
|
95
|
+
$[26] = t0;
|
|
96
|
+
$[27] = t1;
|
|
97
|
+
$[28] = t2;
|
|
98
|
+
$[29] = t3;
|
|
99
|
+
$[30] = t4;
|
|
100
|
+
$[31] = t5;
|
|
101
|
+
$[32] = t6;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
t6 = $[32];
|
|
105
|
+
}
|
|
106
|
+
return t6;
|
|
23
107
|
}
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ChangePasswordForm = void 0;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const translations_1 = require("@uxf/core-react/translations");
|
|
8
9
|
const form_1 = require("@uxf/form/form");
|
|
9
10
|
const text_input_1 = require("@uxf/form/text-input");
|
|
@@ -11,21 +12,157 @@ const button_1 = require("@uxf/ui/button");
|
|
|
11
12
|
const react_1 = __importDefault(require("react"));
|
|
12
13
|
const react_hook_form_1 = require("react-hook-form");
|
|
13
14
|
const widget_1 = require("../../ui/widget");
|
|
14
|
-
const ChangePasswordForm =
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const ChangePasswordForm = props => {
|
|
16
|
+
const $ = (0, compiler_runtime_1.c)(39);
|
|
17
|
+
let defaultValues;
|
|
18
|
+
let formProps;
|
|
19
|
+
if ($[0] !== props) {
|
|
20
|
+
({
|
|
21
|
+
defaultValues,
|
|
22
|
+
...formProps
|
|
23
|
+
} = props);
|
|
24
|
+
$[0] = props;
|
|
25
|
+
$[1] = defaultValues;
|
|
26
|
+
$[2] = formProps;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
defaultValues = $[1];
|
|
30
|
+
formProps = $[2];
|
|
31
|
+
}
|
|
17
32
|
const t = (0, translations_1.useUxfTranslation)();
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
let t0;
|
|
34
|
+
if ($[3] !== defaultValues) {
|
|
35
|
+
t0 = {
|
|
36
|
+
defaultValues
|
|
37
|
+
};
|
|
38
|
+
$[3] = defaultValues;
|
|
39
|
+
$[4] = t0;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
t0 = $[4];
|
|
43
|
+
}
|
|
44
|
+
const formApi = (0, react_hook_form_1.useForm)(t0);
|
|
45
|
+
const t1 = formApi.formState.isSubmitting;
|
|
46
|
+
let t2;
|
|
47
|
+
if ($[5] !== t) {
|
|
48
|
+
t2 = t("uxf-cms-change-password-form:save");
|
|
49
|
+
$[5] = t;
|
|
50
|
+
$[6] = t2;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
t2 = $[6];
|
|
54
|
+
}
|
|
55
|
+
let t3;
|
|
56
|
+
if ($[7] !== formApi.formState.isSubmitting || $[8] !== t2) {
|
|
57
|
+
t3 = react_1.default.createElement("div", { className: "text-right" },
|
|
58
|
+
react_1.default.createElement(button_1.Button, { isDisabled: t1, type: "submit" }, t2));
|
|
59
|
+
$[7] = formApi.formState.isSubmitting;
|
|
60
|
+
$[8] = t2;
|
|
61
|
+
$[9] = t3;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
t3 = $[9];
|
|
65
|
+
}
|
|
66
|
+
const t4 = formApi.control;
|
|
67
|
+
let t5;
|
|
68
|
+
if ($[10] !== t) {
|
|
69
|
+
t5 = t("uxf-cms-change-password-form:original-password");
|
|
70
|
+
$[10] = t;
|
|
71
|
+
$[11] = t5;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
t5 = $[11];
|
|
75
|
+
}
|
|
76
|
+
let t6;
|
|
77
|
+
if ($[12] !== formApi.control || $[13] !== t5) {
|
|
78
|
+
t6 = react_1.default.createElement(text_input_1.TextInput, { control: t4, isRequired: true, label: t5, name: "originalPassword", type: "password" });
|
|
79
|
+
$[12] = formApi.control;
|
|
80
|
+
$[13] = t5;
|
|
81
|
+
$[14] = t6;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
t6 = $[14];
|
|
85
|
+
}
|
|
86
|
+
const t7 = formApi.control;
|
|
87
|
+
let t8;
|
|
88
|
+
if ($[15] !== t) {
|
|
89
|
+
t8 = t("uxf-cms-change-password-form:new-password");
|
|
90
|
+
$[15] = t;
|
|
91
|
+
$[16] = t8;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
t8 = $[16];
|
|
95
|
+
}
|
|
96
|
+
let t9;
|
|
97
|
+
if ($[17] !== formApi.control || $[18] !== props.passwordRules || $[19] !== t8) {
|
|
98
|
+
t9 = react_1.default.createElement(text_input_1.TextInput, { control: t7, isRequired: true, label: t8, name: "newPassword", rules: props.passwordRules, type: "password" });
|
|
99
|
+
$[17] = formApi.control;
|
|
100
|
+
$[18] = props.passwordRules;
|
|
101
|
+
$[19] = t8;
|
|
102
|
+
$[20] = t9;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
t9 = $[20];
|
|
106
|
+
}
|
|
107
|
+
const t10 = formApi.control;
|
|
108
|
+
let t11;
|
|
109
|
+
if ($[21] !== t) {
|
|
110
|
+
t11 = t("uxf-cms-change-password-form:new-password-again");
|
|
111
|
+
$[21] = t;
|
|
112
|
+
$[22] = t11;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
t11 = $[22];
|
|
116
|
+
}
|
|
117
|
+
let t12;
|
|
118
|
+
if ($[23] !== formApi || $[24] !== t) {
|
|
119
|
+
t12 = {
|
|
120
|
+
validate: v => v === formApi.getValues("newPassword") || t("uxf-cms-change-password-form:passwords-must-match")
|
|
121
|
+
};
|
|
122
|
+
$[23] = formApi;
|
|
123
|
+
$[24] = t;
|
|
124
|
+
$[25] = t12;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
t12 = $[25];
|
|
128
|
+
}
|
|
129
|
+
let t13;
|
|
130
|
+
if ($[26] !== formApi.control || $[27] !== t11 || $[28] !== t12) {
|
|
131
|
+
t13 = react_1.default.createElement(text_input_1.TextInput, { control: t10, isRequired: true, label: t11, name: "newPasswordAgain", rules: t12, type: "password" });
|
|
132
|
+
$[26] = formApi.control;
|
|
133
|
+
$[27] = t11;
|
|
134
|
+
$[28] = t12;
|
|
135
|
+
$[29] = t13;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
t13 = $[29];
|
|
139
|
+
}
|
|
140
|
+
let t14;
|
|
141
|
+
if ($[30] !== t13 || $[31] !== t3 || $[32] !== t6 || $[33] !== t9) {
|
|
142
|
+
t14 = react_1.default.createElement(widget_1.Widget, { className: "[&>*]:p-4", footer: t3, withDividers: true },
|
|
143
|
+
t6,
|
|
144
|
+
t9,
|
|
145
|
+
t13);
|
|
146
|
+
$[30] = t13;
|
|
147
|
+
$[31] = t3;
|
|
148
|
+
$[32] = t6;
|
|
149
|
+
$[33] = t9;
|
|
150
|
+
$[34] = t14;
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
t14 = $[34];
|
|
154
|
+
}
|
|
155
|
+
let t15;
|
|
156
|
+
if ($[35] !== formApi || $[36] !== formProps || $[37] !== t14) {
|
|
157
|
+
t15 = react_1.default.createElement(form_1.Form, { formApi: formApi, id: "change-password-form", ...formProps }, t14);
|
|
158
|
+
$[35] = formApi;
|
|
159
|
+
$[36] = formProps;
|
|
160
|
+
$[37] = t14;
|
|
161
|
+
$[38] = t15;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
t15 = $[38];
|
|
165
|
+
}
|
|
166
|
+
return t15;
|
|
30
167
|
};
|
|
31
168
|
exports.ChangePasswordForm = ChangePasswordForm;
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.WysiwygInput = WysiwygInput;
|
|
37
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
37
38
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
38
39
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
39
40
|
const file_1 = require("@uxf/core/utils/file");
|
|
@@ -47,59 +48,196 @@ const react_1 = __importStar(require("react"));
|
|
|
47
48
|
const react_hook_form_1 = require("react-hook-form");
|
|
48
49
|
const api_1 = require("../../../api");
|
|
49
50
|
function WysiwygInput(props) {
|
|
50
|
-
var _a, _b,
|
|
51
|
+
var _a, _b, _d, _e, _f;
|
|
52
|
+
const $ = (0, compiler_runtime_1.c)(65);
|
|
51
53
|
const t = (0, translations_1.useUxfTranslation)();
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
54
|
+
let t0;
|
|
55
|
+
if ($[0] !== props.isRequired || $[1] !== props.requiredMessage || $[2] !== t) {
|
|
56
|
+
t0 = props.isRequired ? props.requiredMessage || t("uxf-cms-wysiwyg-input:validation.required") : undefined;
|
|
57
|
+
$[0] = props.isRequired;
|
|
58
|
+
$[1] = props.requiredMessage;
|
|
59
|
+
$[2] = t;
|
|
60
|
+
$[3] = t0;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
t0 = $[3];
|
|
64
|
+
}
|
|
65
|
+
let t1;
|
|
66
|
+
if ($[4] !== props.rules || $[5] !== t0) {
|
|
67
|
+
t1 = {
|
|
68
|
+
required: t0,
|
|
69
|
+
...props.rules
|
|
70
|
+
};
|
|
71
|
+
$[4] = props.rules;
|
|
72
|
+
$[5] = t0;
|
|
73
|
+
$[6] = t1;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
t1 = $[6];
|
|
77
|
+
}
|
|
78
|
+
let t2;
|
|
79
|
+
if ($[7] !== props.control || $[8] !== props.defaultValue || $[9] !== props.name || $[10] !== props.shouldUnregister || $[11] !== t1) {
|
|
80
|
+
t2 = {
|
|
81
|
+
control: props.control,
|
|
82
|
+
defaultValue: props.defaultValue,
|
|
83
|
+
name: props.name,
|
|
84
|
+
rules: t1,
|
|
85
|
+
shouldUnregister: props.shouldUnregister
|
|
86
|
+
};
|
|
87
|
+
$[7] = props.control;
|
|
88
|
+
$[8] = props.defaultValue;
|
|
89
|
+
$[9] = props.name;
|
|
90
|
+
$[10] = props.shouldUnregister;
|
|
91
|
+
$[11] = t1;
|
|
92
|
+
$[12] = t2;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
t2 = $[12];
|
|
96
|
+
}
|
|
97
|
+
const { field, fieldState } = (0, react_hook_form_1.useController)(t2);
|
|
98
|
+
let t3;
|
|
99
|
+
if ($[13] !== props.allPluginsOptions || $[14] !== props.plugins) {
|
|
100
|
+
t3 = props.plugins && props.plugins.length > 0 ? (0, wysiwyg_1.createPluginsWithUi)(props.plugins) : (0, create_all_plugins_with_ui_1.createAllPluginsWithUi)((_a = props.allPluginsOptions) !== null && _a !== void 0 ? _a : {
|
|
101
|
+
image: {
|
|
102
|
+
getImageUrl: file_1.getFileUrl,
|
|
103
|
+
uploadImage: api_1.uploadFile
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
$[13] = props.allPluginsOptions;
|
|
107
|
+
$[14] = props.plugins;
|
|
108
|
+
$[15] = t3;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
t3 = $[15];
|
|
112
|
+
}
|
|
113
|
+
const plugins = t3;
|
|
70
114
|
const generatedId = (0, react_1.useId)();
|
|
71
|
-
const id = (
|
|
115
|
+
const id = (_b = props.id) !== null && _b !== void 0 ? _b : generatedId;
|
|
72
116
|
const innerRef = (0, react_1.useRef)(null);
|
|
73
117
|
const editorRef = (0, react_1.useRef)(null);
|
|
74
118
|
const input = (0, use_input_focus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
119
|
+
let errorId;
|
|
120
|
+
let isInvalid;
|
|
121
|
+
let t4;
|
|
122
|
+
if ($[16] !== fieldState.error || $[17] !== input || $[18] !== props._isFocused || $[19] !== props.className || $[20] !== props.id || $[21] !== props.isDisabled || $[22] !== props.isReadOnly || $[23] !== props.isRequired) {
|
|
123
|
+
isInvalid = (0, is_not_nil_1.isNotNil)(fieldState.error);
|
|
124
|
+
errorId = isInvalid ? `${props.id}--error-message` : undefined;
|
|
125
|
+
t4 = (0, cx_1.cx)("uxf-text-input", ((_d = props._isFocused) !== null && _d !== void 0 ? _d : input.focused) && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.className);
|
|
126
|
+
$[16] = fieldState.error;
|
|
127
|
+
$[17] = input;
|
|
128
|
+
$[18] = props._isFocused;
|
|
129
|
+
$[19] = props.className;
|
|
130
|
+
$[20] = props.id;
|
|
131
|
+
$[21] = props.isDisabled;
|
|
132
|
+
$[22] = props.isReadOnly;
|
|
133
|
+
$[23] = props.isRequired;
|
|
134
|
+
$[24] = errorId;
|
|
135
|
+
$[25] = isInvalid;
|
|
136
|
+
$[26] = t4;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
errorId = $[24];
|
|
140
|
+
isInvalid = $[25];
|
|
141
|
+
t4 = $[26];
|
|
142
|
+
}
|
|
143
|
+
const rootClassName = t4;
|
|
144
|
+
let t5;
|
|
145
|
+
if ($[27] !== input || $[28] !== props) {
|
|
146
|
+
t5 = e => {
|
|
147
|
+
var _a, _b;
|
|
148
|
+
input.onFocus(e);
|
|
149
|
+
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
150
|
+
(_b = editorRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
151
|
+
};
|
|
152
|
+
$[27] = input;
|
|
153
|
+
$[28] = props;
|
|
154
|
+
$[29] = t5;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
t5 = $[29];
|
|
158
|
+
}
|
|
159
|
+
const onFocus = t5;
|
|
160
|
+
let t6;
|
|
161
|
+
if ($[30] !== field || $[31] !== input || $[32] !== props) {
|
|
162
|
+
t6 = e_0 => {
|
|
163
|
+
var _a;
|
|
164
|
+
field.onBlur();
|
|
165
|
+
input.onBlur(e_0);
|
|
166
|
+
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e_0);
|
|
167
|
+
};
|
|
168
|
+
$[30] = field;
|
|
169
|
+
$[31] = input;
|
|
170
|
+
$[32] = props;
|
|
171
|
+
$[33] = t6;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
t6 = $[33];
|
|
175
|
+
}
|
|
176
|
+
const onBlur = t6;
|
|
177
|
+
const t7 = (_f = (_e = fieldState.error) === null || _e === void 0 ? void 0 : _e.message) !== null && _f !== void 0 ? _f : props.helperText;
|
|
178
|
+
let t8;
|
|
179
|
+
if ($[34] !== errorId || $[35] !== isInvalid || $[36] !== onBlur || $[37] !== onFocus || $[38] !== props.autoComplete || $[39] !== props.form || $[40] !== props.isDisabled || $[41] !== props.isReadOnly || $[42] !== props.isRequired || $[43] !== props.onKeyDown || $[44] !== props.placeholder) {
|
|
180
|
+
t8 = {
|
|
181
|
+
"aria-describedby": errorId,
|
|
182
|
+
"aria-invalid": isInvalid,
|
|
183
|
+
autoComplete: props.autoComplete,
|
|
184
|
+
disabled: props.isDisabled,
|
|
185
|
+
form: props.form,
|
|
186
|
+
onBlur,
|
|
187
|
+
onFocus,
|
|
188
|
+
onKeyDown: props.onKeyDown,
|
|
189
|
+
placeholder: props.placeholder,
|
|
190
|
+
readOnly: props.isReadOnly,
|
|
191
|
+
required: props.isRequired
|
|
192
|
+
};
|
|
193
|
+
$[34] = errorId;
|
|
194
|
+
$[35] = isInvalid;
|
|
195
|
+
$[36] = onBlur;
|
|
196
|
+
$[37] = onFocus;
|
|
197
|
+
$[38] = props.autoComplete;
|
|
198
|
+
$[39] = props.form;
|
|
199
|
+
$[40] = props.isDisabled;
|
|
200
|
+
$[41] = props.isReadOnly;
|
|
201
|
+
$[42] = props.isRequired;
|
|
202
|
+
$[43] = props.onKeyDown;
|
|
203
|
+
$[44] = props.placeholder;
|
|
204
|
+
$[45] = t8;
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
t8 = $[45];
|
|
208
|
+
}
|
|
209
|
+
let t9;
|
|
210
|
+
if ($[46] !== field.onChange || $[47] !== field.value || $[48] !== id || $[49] !== plugins || $[50] !== props.customPluginsToolbarButtons || $[51] !== props.editorProps || $[52] !== t8) {
|
|
211
|
+
t9 = react_1.default.createElement(wysiwyg_1.WysiwygEditor, { customPluginsToolbarButtons: props.customPluginsToolbarButtons, editableProps: t8, id: id, initialValue: field.value, onChange: field.onChange, plugins: plugins, ref: editorRef, ...props.editorProps });
|
|
212
|
+
$[46] = field.onChange;
|
|
213
|
+
$[47] = field.value;
|
|
214
|
+
$[48] = id;
|
|
215
|
+
$[49] = plugins;
|
|
216
|
+
$[50] = props.customPluginsToolbarButtons;
|
|
217
|
+
$[51] = props.editorProps;
|
|
218
|
+
$[52] = t8;
|
|
219
|
+
$[53] = t9;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
t9 = $[53];
|
|
223
|
+
}
|
|
224
|
+
let t10;
|
|
225
|
+
if ($[54] !== errorId || $[55] !== id || $[56] !== props.form || $[57] !== props.hiddenLabel || $[58] !== props.isRequired || $[59] !== props.label || $[60] !== props.name || $[61] !== rootClassName || $[62] !== t7 || $[63] !== t9) {
|
|
226
|
+
t10 = react_1.default.createElement(form_component_1.FormComponent, { className: rootClassName, errorId: errorId, form: props.form, helperText: t7, hiddenLabel: props.hiddenLabel, inputId: id, isRequired: props.isRequired, label: props.label, name: props.name }, t9);
|
|
227
|
+
$[54] = errorId;
|
|
228
|
+
$[55] = id;
|
|
229
|
+
$[56] = props.form;
|
|
230
|
+
$[57] = props.hiddenLabel;
|
|
231
|
+
$[58] = props.isRequired;
|
|
232
|
+
$[59] = props.label;
|
|
233
|
+
$[60] = props.name;
|
|
234
|
+
$[61] = rootClassName;
|
|
235
|
+
$[62] = t7;
|
|
236
|
+
$[63] = t9;
|
|
237
|
+
$[64] = t10;
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
t10 = $[64];
|
|
241
|
+
}
|
|
242
|
+
return t10;
|
|
105
243
|
}
|