@knovator/pagecreator-admin 1.6.10 → 1.7.1
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/index.cjs +26 -5
- package/index.js +26 -5
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -3370,13 +3370,25 @@ const Input$1 = ({
|
|
|
3370
3370
|
onChange,
|
|
3371
3371
|
wrapperClassName
|
|
3372
3372
|
}) => {
|
|
3373
|
+
const isTextarea = type === 'textarea';
|
|
3373
3374
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
3374
3375
|
className: classNames__default["default"]('khb_input-wrapper', wrapperClassName)
|
|
3375
3376
|
}, label && (/*#__PURE__*/React__default["default"].createElement("label", {
|
|
3376
3377
|
className: "khb_input-label"
|
|
3377
3378
|
}, label, required ? (/*#__PURE__*/React__default["default"].createElement("span", {
|
|
3378
3379
|
className: "khb_input-label-required"
|
|
3379
|
-
}, "*")) : null)), /*#__PURE__*/React__default["default"].createElement("
|
|
3380
|
+
}, "*")) : null)), isTextarea ? (/*#__PURE__*/React__default["default"].createElement("textarea", Object.assign({
|
|
3381
|
+
className: classNames__default["default"]('khb_input', `khb_input-${_size}`, className),
|
|
3382
|
+
placeholder: placeholder,
|
|
3383
|
+
disabled: disabled,
|
|
3384
|
+
id: id,
|
|
3385
|
+
value: value,
|
|
3386
|
+
onChange: onChange,
|
|
3387
|
+
rows: 10
|
|
3388
|
+
}, rest, {
|
|
3389
|
+
onInput: onInput,
|
|
3390
|
+
onBlur: onBlur
|
|
3391
|
+
}))) : (/*#__PURE__*/React__default["default"].createElement("input", Object.assign({
|
|
3380
3392
|
className: classNames__default["default"]('khb_input', `khb_input-${_size}`, className),
|
|
3381
3393
|
type: type,
|
|
3382
3394
|
placeholder: placeholder,
|
|
@@ -3387,7 +3399,7 @@ const Input$1 = ({
|
|
|
3387
3399
|
}, rest, {
|
|
3388
3400
|
onInput: onInput,
|
|
3389
3401
|
onBlur: onBlur
|
|
3390
|
-
})), error && /*#__PURE__*/React__default["default"].createElement("p", {
|
|
3402
|
+
}))), error && /*#__PURE__*/React__default["default"].createElement("p", {
|
|
3391
3403
|
className: "khb_input-error "
|
|
3392
3404
|
}, error), info && /*#__PURE__*/React__default["default"].createElement("p", {
|
|
3393
3405
|
className: "khb_input-info"
|
|
@@ -7197,7 +7209,7 @@ const WidgetForm = ({
|
|
|
7197
7209
|
const [collectionItemsUpdated, setCollectionItemsUpdated] = React.useState(false);
|
|
7198
7210
|
const [tabCollectionItemsUpdated, setTabCollectionItemsUpdated] = React.useState([]);
|
|
7199
7211
|
const [blogCategory, setBlogCategory] = React.useState(null);
|
|
7200
|
-
const [blogLimit, setBlogLimit] = React.useState(
|
|
7212
|
+
const [blogLimit, setBlogLimit] = React.useState(undefined);
|
|
7201
7213
|
const [blogCategories, setBlogCategories] = React.useState([]);
|
|
7202
7214
|
const [blogCategoriesLoading, setBlogCategoriesLoading] = React.useState(false);
|
|
7203
7215
|
const pagesLoadedRef = React.useRef(false);
|
|
@@ -7284,7 +7296,7 @@ const WidgetForm = ({
|
|
|
7284
7296
|
// Clear collectionItems when using blog category/limit (server will handle fetching latest blogs)
|
|
7285
7297
|
React.useEffect(() => {
|
|
7286
7298
|
if (currentItemsType === 'blog') {
|
|
7287
|
-
if (blogCategory || blogLimit > 0) {
|
|
7299
|
+
if (blogCategory || blogLimit && blogLimit > 0) {
|
|
7288
7300
|
// Clear selected collection items since server will fetch latest blogs based on category/limit
|
|
7289
7301
|
setSelectedCollectionItems([]);
|
|
7290
7302
|
setCollectionItemsUpdated(true);
|
|
@@ -7295,7 +7307,7 @@ const WidgetForm = ({
|
|
|
7295
7307
|
React.useEffect(() => {
|
|
7296
7308
|
if (currentItemsType !== 'blog') {
|
|
7297
7309
|
setBlogCategory(null);
|
|
7298
|
-
setBlogLimit(
|
|
7310
|
+
setBlogLimit(undefined);
|
|
7299
7311
|
setBlogCategories([]);
|
|
7300
7312
|
blogCategoryInitialized.current = false;
|
|
7301
7313
|
}
|
|
@@ -7513,6 +7525,14 @@ const WidgetForm = ({
|
|
|
7513
7525
|
}
|
|
7514
7526
|
return item;
|
|
7515
7527
|
});
|
|
7528
|
+
// Clean up fields based on widget type
|
|
7529
|
+
const currentWidgetType = formData['widgetType'] || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value);
|
|
7530
|
+
if (currentWidgetType !== constants.htmlWidgetTypeValue) {
|
|
7531
|
+
delete formData['htmlContent'];
|
|
7532
|
+
}
|
|
7533
|
+
if (currentWidgetType !== constants.textWidgetTypeValue) {
|
|
7534
|
+
delete formData['textContent'];
|
|
7535
|
+
}
|
|
7516
7536
|
const submitPayload = Object.assign(Object.assign(Object.assign(Object.assign({}, formData), {
|
|
7517
7537
|
items
|
|
7518
7538
|
}), blogCategory && {
|
|
@@ -7639,6 +7659,7 @@ const WidgetForm = ({
|
|
|
7639
7659
|
required: widgetTranslations.htmlContentRequired
|
|
7640
7660
|
},
|
|
7641
7661
|
show: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.htmlWidgetTypeValue,
|
|
7662
|
+
wrapperClassName: 'khb_html-content-field',
|
|
7642
7663
|
Input: customInputs && customInputs['htmlContent'] ? customInputs['htmlContent'] : undefined
|
|
7643
7664
|
}, {
|
|
7644
7665
|
label: widgetTranslations.itemsType,
|
package/index.js
CHANGED
|
@@ -3358,13 +3358,25 @@ const Input$1 = ({
|
|
|
3358
3358
|
onChange,
|
|
3359
3359
|
wrapperClassName
|
|
3360
3360
|
}) => {
|
|
3361
|
+
const isTextarea = type === 'textarea';
|
|
3361
3362
|
return /*#__PURE__*/React.createElement("div", {
|
|
3362
3363
|
className: classNames('khb_input-wrapper', wrapperClassName)
|
|
3363
3364
|
}, label && (/*#__PURE__*/React.createElement("label", {
|
|
3364
3365
|
className: "khb_input-label"
|
|
3365
3366
|
}, label, required ? (/*#__PURE__*/React.createElement("span", {
|
|
3366
3367
|
className: "khb_input-label-required"
|
|
3367
|
-
}, "*")) : null)), /*#__PURE__*/React.createElement("
|
|
3368
|
+
}, "*")) : null)), isTextarea ? (/*#__PURE__*/React.createElement("textarea", Object.assign({
|
|
3369
|
+
className: classNames('khb_input', `khb_input-${_size}`, className),
|
|
3370
|
+
placeholder: placeholder,
|
|
3371
|
+
disabled: disabled,
|
|
3372
|
+
id: id,
|
|
3373
|
+
value: value,
|
|
3374
|
+
onChange: onChange,
|
|
3375
|
+
rows: 10
|
|
3376
|
+
}, rest, {
|
|
3377
|
+
onInput: onInput,
|
|
3378
|
+
onBlur: onBlur
|
|
3379
|
+
}))) : (/*#__PURE__*/React.createElement("input", Object.assign({
|
|
3368
3380
|
className: classNames('khb_input', `khb_input-${_size}`, className),
|
|
3369
3381
|
type: type,
|
|
3370
3382
|
placeholder: placeholder,
|
|
@@ -3375,7 +3387,7 @@ const Input$1 = ({
|
|
|
3375
3387
|
}, rest, {
|
|
3376
3388
|
onInput: onInput,
|
|
3377
3389
|
onBlur: onBlur
|
|
3378
|
-
})), error && /*#__PURE__*/React.createElement("p", {
|
|
3390
|
+
}))), error && /*#__PURE__*/React.createElement("p", {
|
|
3379
3391
|
className: "khb_input-error "
|
|
3380
3392
|
}, error), info && /*#__PURE__*/React.createElement("p", {
|
|
3381
3393
|
className: "khb_input-info"
|
|
@@ -7185,7 +7197,7 @@ const WidgetForm = ({
|
|
|
7185
7197
|
const [collectionItemsUpdated, setCollectionItemsUpdated] = useState(false);
|
|
7186
7198
|
const [tabCollectionItemsUpdated, setTabCollectionItemsUpdated] = useState([]);
|
|
7187
7199
|
const [blogCategory, setBlogCategory] = useState(null);
|
|
7188
|
-
const [blogLimit, setBlogLimit] = useState(
|
|
7200
|
+
const [blogLimit, setBlogLimit] = useState(undefined);
|
|
7189
7201
|
const [blogCategories, setBlogCategories] = useState([]);
|
|
7190
7202
|
const [blogCategoriesLoading, setBlogCategoriesLoading] = useState(false);
|
|
7191
7203
|
const pagesLoadedRef = useRef(false);
|
|
@@ -7272,7 +7284,7 @@ const WidgetForm = ({
|
|
|
7272
7284
|
// Clear collectionItems when using blog category/limit (server will handle fetching latest blogs)
|
|
7273
7285
|
useEffect(() => {
|
|
7274
7286
|
if (currentItemsType === 'blog') {
|
|
7275
|
-
if (blogCategory || blogLimit > 0) {
|
|
7287
|
+
if (blogCategory || blogLimit && blogLimit > 0) {
|
|
7276
7288
|
// Clear selected collection items since server will fetch latest blogs based on category/limit
|
|
7277
7289
|
setSelectedCollectionItems([]);
|
|
7278
7290
|
setCollectionItemsUpdated(true);
|
|
@@ -7283,7 +7295,7 @@ const WidgetForm = ({
|
|
|
7283
7295
|
useEffect(() => {
|
|
7284
7296
|
if (currentItemsType !== 'blog') {
|
|
7285
7297
|
setBlogCategory(null);
|
|
7286
|
-
setBlogLimit(
|
|
7298
|
+
setBlogLimit(undefined);
|
|
7287
7299
|
setBlogCategories([]);
|
|
7288
7300
|
blogCategoryInitialized.current = false;
|
|
7289
7301
|
}
|
|
@@ -7501,6 +7513,14 @@ const WidgetForm = ({
|
|
|
7501
7513
|
}
|
|
7502
7514
|
return item;
|
|
7503
7515
|
});
|
|
7516
|
+
// Clean up fields based on widget type
|
|
7517
|
+
const currentWidgetType = formData['widgetType'] || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value);
|
|
7518
|
+
if (currentWidgetType !== constants.htmlWidgetTypeValue) {
|
|
7519
|
+
delete formData['htmlContent'];
|
|
7520
|
+
}
|
|
7521
|
+
if (currentWidgetType !== constants.textWidgetTypeValue) {
|
|
7522
|
+
delete formData['textContent'];
|
|
7523
|
+
}
|
|
7504
7524
|
const submitPayload = Object.assign(Object.assign(Object.assign(Object.assign({}, formData), {
|
|
7505
7525
|
items
|
|
7506
7526
|
}), blogCategory && {
|
|
@@ -7627,6 +7647,7 @@ const WidgetForm = ({
|
|
|
7627
7647
|
required: widgetTranslations.htmlContentRequired
|
|
7628
7648
|
},
|
|
7629
7649
|
show: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.htmlWidgetTypeValue,
|
|
7650
|
+
wrapperClassName: 'khb_html-content-field',
|
|
7630
7651
|
Input: customInputs && customInputs['htmlContent'] ? customInputs['htmlContent'] : undefined
|
|
7631
7652
|
}, {
|
|
7632
7653
|
label: widgetTranslations.itemsType,
|