@uxf/cms 15.3.1 → 15.3.2
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.
|
@@ -41,6 +41,7 @@ const file_1 = require("@uxf/core/utils/file");
|
|
|
41
41
|
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
42
42
|
const use_input_focus_1 = require("@uxf/core-react/hooks/use-input-focus");
|
|
43
43
|
const translations_1 = require("@uxf/core-react/translations");
|
|
44
|
+
const resolve_required_1 = require("@uxf/form/_rules/resolve-required");
|
|
44
45
|
const form_component_1 = require("@uxf/ui/form-component");
|
|
45
46
|
const get_error_id_1 = require("@uxf/ui/utils/get-error-id");
|
|
46
47
|
const wysiwyg_1 = require("@uxf/wysiwyg");
|
|
@@ -50,68 +51,71 @@ const react_hook_form_1 = require("react-hook-form");
|
|
|
50
51
|
const api_1 = require("../../../api");
|
|
51
52
|
function WysiwygInput(props) {
|
|
52
53
|
var _a, _b, _d, _e, _f;
|
|
53
|
-
const $ = (0, compiler_runtime_1.c)(
|
|
54
|
+
const $ = (0, compiler_runtime_1.c)(66);
|
|
54
55
|
const t = (0, translations_1.useUxfTranslation)();
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
const t0 = props.control;
|
|
57
|
+
const t1 = props.defaultValue;
|
|
58
|
+
const t2 = props.name;
|
|
59
|
+
const t3 = props.rules;
|
|
60
|
+
let t4;
|
|
61
|
+
if ($[0] !== props || $[1] !== t) {
|
|
62
|
+
t4 = (0, resolve_required_1.resolveRequiredRule)(props, t("uxf-cms-wysiwyg-input:validation.required"));
|
|
63
|
+
$[0] = props;
|
|
64
|
+
$[1] = t;
|
|
65
|
+
$[2] = t4;
|
|
62
66
|
}
|
|
63
67
|
else {
|
|
64
|
-
|
|
68
|
+
t4 = $[2];
|
|
65
69
|
}
|
|
66
|
-
let
|
|
67
|
-
if ($[
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
let t5;
|
|
71
|
+
if ($[3] !== props.rules || $[4] !== t4) {
|
|
72
|
+
t5 = {
|
|
73
|
+
...t3,
|
|
74
|
+
required: t4
|
|
71
75
|
};
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
74
|
-
$[
|
|
76
|
+
$[3] = props.rules;
|
|
77
|
+
$[4] = t4;
|
|
78
|
+
$[5] = t5;
|
|
75
79
|
}
|
|
76
80
|
else {
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
let
|
|
80
|
-
if ($[
|
|
81
|
-
|
|
82
|
-
control:
|
|
83
|
-
defaultValue:
|
|
84
|
-
name:
|
|
85
|
-
rules:
|
|
81
|
+
t5 = $[5];
|
|
82
|
+
}
|
|
83
|
+
let t6;
|
|
84
|
+
if ($[6] !== props.control || $[7] !== props.defaultValue || $[8] !== props.name || $[9] !== props.shouldUnregister || $[10] !== t5) {
|
|
85
|
+
t6 = {
|
|
86
|
+
control: t0,
|
|
87
|
+
defaultValue: t1,
|
|
88
|
+
name: t2,
|
|
89
|
+
rules: t5,
|
|
86
90
|
shouldUnregister: props.shouldUnregister
|
|
87
91
|
};
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
92
|
+
$[6] = props.control;
|
|
93
|
+
$[7] = props.defaultValue;
|
|
94
|
+
$[8] = props.name;
|
|
95
|
+
$[9] = props.shouldUnregister;
|
|
96
|
+
$[10] = t5;
|
|
97
|
+
$[11] = t6;
|
|
94
98
|
}
|
|
95
99
|
else {
|
|
96
|
-
|
|
100
|
+
t6 = $[11];
|
|
97
101
|
}
|
|
98
|
-
const { field, fieldState } = (0, react_hook_form_1.useController)(
|
|
99
|
-
let
|
|
100
|
-
if ($[
|
|
101
|
-
|
|
102
|
+
const { field, fieldState } = (0, react_hook_form_1.useController)(t6);
|
|
103
|
+
let t7;
|
|
104
|
+
if ($[12] !== props.allPluginsOptions || $[13] !== props.plugins) {
|
|
105
|
+
t7 = 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 : {
|
|
102
106
|
image: {
|
|
103
107
|
getImageUrl: file_1.getFileUrl,
|
|
104
108
|
uploadImage: api_1.uploadFile
|
|
105
109
|
}
|
|
106
110
|
});
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
111
|
+
$[12] = props.allPluginsOptions;
|
|
112
|
+
$[13] = props.plugins;
|
|
113
|
+
$[14] = t7;
|
|
110
114
|
}
|
|
111
115
|
else {
|
|
112
|
-
|
|
116
|
+
t7 = $[14];
|
|
113
117
|
}
|
|
114
|
-
const plugins =
|
|
118
|
+
const plugins = t7;
|
|
115
119
|
const generatedId = (0, react_1.useId)();
|
|
116
120
|
const id = (_b = props.id) !== null && _b !== void 0 ? _b : generatedId;
|
|
117
121
|
const innerRef = (0, react_1.useRef)(null);
|
|
@@ -120,69 +124,69 @@ function WysiwygInput(props) {
|
|
|
120
124
|
let errorId;
|
|
121
125
|
let helperText;
|
|
122
126
|
let isInvalid;
|
|
123
|
-
let
|
|
124
|
-
if ($[
|
|
127
|
+
let t8;
|
|
128
|
+
if ($[15] !== fieldState.error || $[16] !== id || $[17] !== input || $[18] !== props._isFocused || $[19] !== props.className || $[20] !== props.helperText || $[21] !== props.isDisabled || $[22] !== props.isReadOnly || $[23] !== props.isRequired) {
|
|
125
129
|
isInvalid = (0, is_not_nil_1.isNotNil)(fieldState.error);
|
|
126
130
|
helperText = (_e = (_d = fieldState.error) === null || _d === void 0 ? void 0 : _d.message) !== null && _e !== void 0 ? _e : props.helperText;
|
|
127
131
|
errorId = (0, get_error_id_1.getErrorId)(id, isInvalid, helperText);
|
|
128
|
-
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
132
|
+
t8 = (0, cx_1.cx)("uxf-text-input", ((_f = props._isFocused) !== null && _f !== void 0 ? _f : 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);
|
|
133
|
+
$[15] = fieldState.error;
|
|
134
|
+
$[16] = id;
|
|
135
|
+
$[17] = input;
|
|
136
|
+
$[18] = props._isFocused;
|
|
137
|
+
$[19] = props.className;
|
|
138
|
+
$[20] = props.helperText;
|
|
139
|
+
$[21] = props.isDisabled;
|
|
140
|
+
$[22] = props.isReadOnly;
|
|
141
|
+
$[23] = props.isRequired;
|
|
142
|
+
$[24] = errorId;
|
|
143
|
+
$[25] = helperText;
|
|
144
|
+
$[26] = isInvalid;
|
|
145
|
+
$[27] = t8;
|
|
142
146
|
}
|
|
143
147
|
else {
|
|
144
|
-
errorId = $[
|
|
145
|
-
helperText = $[
|
|
146
|
-
isInvalid = $[
|
|
147
|
-
|
|
148
|
+
errorId = $[24];
|
|
149
|
+
helperText = $[25];
|
|
150
|
+
isInvalid = $[26];
|
|
151
|
+
t8 = $[27];
|
|
148
152
|
}
|
|
149
|
-
const rootClassName =
|
|
150
|
-
let
|
|
151
|
-
if ($[
|
|
152
|
-
|
|
153
|
+
const rootClassName = t8;
|
|
154
|
+
let t9;
|
|
155
|
+
if ($[28] !== input || $[29] !== props) {
|
|
156
|
+
t9 = e => {
|
|
153
157
|
var _a, _b;
|
|
154
158
|
input.onFocus(e);
|
|
155
159
|
(_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
156
160
|
(_b = editorRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
157
161
|
};
|
|
158
|
-
$[
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
162
|
+
$[28] = input;
|
|
163
|
+
$[29] = props;
|
|
164
|
+
$[30] = t9;
|
|
161
165
|
}
|
|
162
166
|
else {
|
|
163
|
-
|
|
167
|
+
t9 = $[30];
|
|
164
168
|
}
|
|
165
|
-
const onFocus =
|
|
166
|
-
let
|
|
167
|
-
if ($[
|
|
168
|
-
|
|
169
|
+
const onFocus = t9;
|
|
170
|
+
let t10;
|
|
171
|
+
if ($[31] !== field || $[32] !== input || $[33] !== props) {
|
|
172
|
+
t10 = e_0 => {
|
|
169
173
|
var _a;
|
|
170
174
|
field.onBlur();
|
|
171
175
|
input.onBlur(e_0);
|
|
172
176
|
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e_0);
|
|
173
177
|
};
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
+
$[31] = field;
|
|
179
|
+
$[32] = input;
|
|
180
|
+
$[33] = props;
|
|
181
|
+
$[34] = t10;
|
|
178
182
|
}
|
|
179
183
|
else {
|
|
180
|
-
|
|
184
|
+
t10 = $[34];
|
|
181
185
|
}
|
|
182
|
-
const onBlur =
|
|
183
|
-
let
|
|
184
|
-
if ($[
|
|
185
|
-
|
|
186
|
+
const onBlur = t10;
|
|
187
|
+
let t11;
|
|
188
|
+
if ($[35] !== errorId || $[36] !== isInvalid || $[37] !== onBlur || $[38] !== onFocus || $[39] !== props.autoComplete || $[40] !== props.form || $[41] !== props.isDisabled || $[42] !== props.isReadOnly || $[43] !== props.isRequired || $[44] !== props.onKeyDown || $[45] !== props.placeholder) {
|
|
189
|
+
t11 = {
|
|
186
190
|
"aria-describedby": errorId,
|
|
187
191
|
"aria-invalid": isInvalid,
|
|
188
192
|
autoComplete: props.autoComplete,
|
|
@@ -195,54 +199,54 @@ function WysiwygInput(props) {
|
|
|
195
199
|
readOnly: props.isReadOnly,
|
|
196
200
|
required: props.isRequired
|
|
197
201
|
};
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
$[
|
|
204
|
-
$[
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
207
|
-
$[
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
202
|
+
$[35] = errorId;
|
|
203
|
+
$[36] = isInvalid;
|
|
204
|
+
$[37] = onBlur;
|
|
205
|
+
$[38] = onFocus;
|
|
206
|
+
$[39] = props.autoComplete;
|
|
207
|
+
$[40] = props.form;
|
|
208
|
+
$[41] = props.isDisabled;
|
|
209
|
+
$[42] = props.isReadOnly;
|
|
210
|
+
$[43] = props.isRequired;
|
|
211
|
+
$[44] = props.onKeyDown;
|
|
212
|
+
$[45] = props.placeholder;
|
|
213
|
+
$[46] = t11;
|
|
210
214
|
}
|
|
211
215
|
else {
|
|
212
|
-
|
|
213
|
-
}
|
|
214
|
-
let
|
|
215
|
-
if ($[
|
|
216
|
-
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
216
|
+
t11 = $[46];
|
|
217
|
+
}
|
|
218
|
+
let t12;
|
|
219
|
+
if ($[47] !== field.onChange || $[48] !== field.value || $[49] !== id || $[50] !== plugins || $[51] !== props.customPluginsToolbarButtons || $[52] !== props.editorProps || $[53] !== t11) {
|
|
220
|
+
t12 = react_1.default.createElement(wysiwyg_1.WysiwygEditor, { customPluginsToolbarButtons: props.customPluginsToolbarButtons, editableProps: t11, id: id, initialValue: field.value, onChange: field.onChange, plugins: plugins, ref: editorRef, ...props.editorProps });
|
|
221
|
+
$[47] = field.onChange;
|
|
222
|
+
$[48] = field.value;
|
|
223
|
+
$[49] = id;
|
|
224
|
+
$[50] = plugins;
|
|
225
|
+
$[51] = props.customPluginsToolbarButtons;
|
|
226
|
+
$[52] = props.editorProps;
|
|
227
|
+
$[53] = t11;
|
|
228
|
+
$[54] = t12;
|
|
225
229
|
}
|
|
226
230
|
else {
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
let
|
|
230
|
-
if ($[
|
|
231
|
-
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
231
|
+
t12 = $[54];
|
|
232
|
+
}
|
|
233
|
+
let t13;
|
|
234
|
+
if ($[55] !== errorId || $[56] !== helperText || $[57] !== id || $[58] !== props.form || $[59] !== props.hiddenLabel || $[60] !== props.isRequired || $[61] !== props.label || $[62] !== props.name || $[63] !== rootClassName || $[64] !== t12) {
|
|
235
|
+
t13 = react_1.default.createElement(form_component_1.FormComponent, { className: rootClassName, errorId: errorId, form: props.form, helperText: helperText, hiddenLabel: props.hiddenLabel, inputId: id, isRequired: props.isRequired, label: props.label, name: props.name }, t12);
|
|
236
|
+
$[55] = errorId;
|
|
237
|
+
$[56] = helperText;
|
|
238
|
+
$[57] = id;
|
|
239
|
+
$[58] = props.form;
|
|
240
|
+
$[59] = props.hiddenLabel;
|
|
241
|
+
$[60] = props.isRequired;
|
|
242
|
+
$[61] = props.label;
|
|
243
|
+
$[62] = props.name;
|
|
244
|
+
$[63] = rootClassName;
|
|
245
|
+
$[64] = t12;
|
|
246
|
+
$[65] = t13;
|
|
243
247
|
}
|
|
244
248
|
else {
|
|
245
|
-
|
|
249
|
+
t13 = $[65];
|
|
246
250
|
}
|
|
247
|
-
return
|
|
251
|
+
return t13;
|
|
248
252
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/cms",
|
|
3
|
-
"version": "15.3.
|
|
3
|
+
"version": "15.3.2",
|
|
4
4
|
"description": "UXF Cms",
|
|
5
5
|
"author": "UX Fans s.r.o. <dev@uxf.cz>",
|
|
6
6
|
"homepage": "https://fe.uxf.dev/docs/cms",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@uxf/core-react": "15.2.1",
|
|
27
27
|
"@uxf/data-grid": "15.3.1",
|
|
28
28
|
"@uxf/dnd": "15.2.1",
|
|
29
|
-
"@uxf/form": "15.3.
|
|
29
|
+
"@uxf/form": "15.3.2",
|
|
30
30
|
"@uxf/router": "15.2.1",
|
|
31
31
|
"@uxf/styles": "15.2.1",
|
|
32
32
|
"@uxf/ui": "15.3.1",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@uxf/core-react": "15.2.1",
|
|
49
49
|
"@uxf/data-grid": "15.3.1",
|
|
50
50
|
"@uxf/dnd": "15.2.1",
|
|
51
|
-
"@uxf/form": "15.3.
|
|
51
|
+
"@uxf/form": "15.3.2",
|
|
52
52
|
"@uxf/router": "15.2.1",
|
|
53
53
|
"@uxf/styles": "15.2.1",
|
|
54
54
|
"@uxf/ui": "15.3.1",
|