@knovator/pagecreator-admin 1.7.0 → 1.7.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.
- package/index.cjs +103 -54
- package/index.js +103 -54
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -3826,40 +3826,53 @@ const SimpleForm = /*#__PURE__*/React.forwardRef(({
|
|
|
3826
3826
|
languages
|
|
3827
3827
|
}, ref) => {
|
|
3828
3828
|
const inputRenderer = schema => {
|
|
3829
|
-
var _a, _b, _c, _d
|
|
3829
|
+
var _a, _b, _c, _d;
|
|
3830
3830
|
let input;
|
|
3831
3831
|
if (typeof schema.show !== 'undefined' && !schema.show) return null;
|
|
3832
3832
|
if (schema.type) {
|
|
3833
3833
|
switch (schema.type) {
|
|
3834
3834
|
case 'ReactSelect':
|
|
3835
|
-
input = /*#__PURE__*/React__default["default"].createElement(
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3835
|
+
input = /*#__PURE__*/React__default["default"].createElement(reactHookForm.Controller, {
|
|
3836
|
+
control: control,
|
|
3837
|
+
name: schema.accessor,
|
|
3838
|
+
rules: schema.validations,
|
|
3839
|
+
render: ({
|
|
3840
|
+
field
|
|
3841
|
+
}) => {
|
|
3842
|
+
var _a, _b;
|
|
3843
|
+
return /*#__PURE__*/React__default["default"].createElement(CustomReactSelect, {
|
|
3844
|
+
disabled: _isUpdating && typeof schema.editable !== 'undefined' && !schema.editable || !_enable || schema.disabled,
|
|
3845
|
+
label: schema.label,
|
|
3846
|
+
error: (_b = (_a = errors[schema.accessor]) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
3847
|
+
onChange: value => {
|
|
3848
|
+
// Handle clear (null value) and selection
|
|
3849
|
+
const fieldValue = value ? Array.isArray(value) ? value.map(item => item.value) : value.value : null;
|
|
3850
|
+
field.onChange(fieldValue);
|
|
3851
|
+
setValue(schema.accessor, fieldValue, {
|
|
3852
|
+
shouldValidate: true
|
|
3853
|
+
});
|
|
3854
|
+
if (schema.onChange) schema.onChange(value);
|
|
3855
|
+
},
|
|
3856
|
+
selectedOptions: schema.selectedOptions,
|
|
3857
|
+
required: schema.required,
|
|
3858
|
+
isMulti: schema.isMulti,
|
|
3859
|
+
isSearchable: schema.isSearchable,
|
|
3860
|
+
isClearable: schema.isClearable,
|
|
3861
|
+
isLoading: schema.isLoading,
|
|
3862
|
+
placeholder: schema.placeholder,
|
|
3863
|
+
wrapperClassName: schema.wrapperClassName,
|
|
3864
|
+
formatOptionLabel: schema.formatOptionLabel,
|
|
3865
|
+
listCode: schema.listCode,
|
|
3866
|
+
customStyles: schema.customStyles,
|
|
3867
|
+
loadOptions: schema.loadOptions,
|
|
3868
|
+
selectKey: schema.selectKey
|
|
3869
|
+
});
|
|
3870
|
+
}
|
|
3858
3871
|
});
|
|
3859
3872
|
break;
|
|
3860
3873
|
case 'checkbox':
|
|
3861
3874
|
input = /*#__PURE__*/React__default["default"].createElement(Input.Checkbox, {
|
|
3862
|
-
error: (
|
|
3875
|
+
error: (_b = (_a = errors[schema.accessor]) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
3863
3876
|
switchClass: schema.switchClass,
|
|
3864
3877
|
label: schema.label,
|
|
3865
3878
|
rest: register(schema.accessor, schema.validations || {}),
|
|
@@ -3915,7 +3928,7 @@ const SimpleForm = /*#__PURE__*/React.forwardRef(({
|
|
|
3915
3928
|
} else input = /*#__PURE__*/React__default["default"].createElement(Input, {
|
|
3916
3929
|
rest: register(schema.accessor, schema.validations || {}),
|
|
3917
3930
|
label: schema.label,
|
|
3918
|
-
error: (
|
|
3931
|
+
error: (_d = (_c = errors[schema.accessor]) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
3919
3932
|
type: schema.type,
|
|
3920
3933
|
className: classNames__default["default"]('w-full p-2', schema.className),
|
|
3921
3934
|
placeholder: schema.placeholder,
|
|
@@ -7476,6 +7489,17 @@ const WidgetForm = ({
|
|
|
7476
7489
|
if (!formData[constants.widgetTypeAccessor] && formState === 'ADD') {
|
|
7477
7490
|
formData[constants.widgetTypeAccessor] = getFirstWidgetTypeValue();
|
|
7478
7491
|
}
|
|
7492
|
+
// Validate blogLimit is required when itemsType is 'blog'
|
|
7493
|
+
const widgetTypeValue = formData[constants.widgetTypeAccessor] || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value);
|
|
7494
|
+
if (currentItemsType === 'blog' && !itemsEnabled && (widgetTypeValue === constants.carouselWidgetTypeValue || widgetTypeValue === constants.fixedCardWidgetTypeValue) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value)) {
|
|
7495
|
+
if (!formData['blogLimit'] || formData['blogLimit'] === '') {
|
|
7496
|
+
setError('blogLimit', {
|
|
7497
|
+
type: 'manual',
|
|
7498
|
+
message: 'Number of blogs is required'
|
|
7499
|
+
});
|
|
7500
|
+
return;
|
|
7501
|
+
}
|
|
7502
|
+
}
|
|
7479
7503
|
// setting tabs data if widgetType tab is selected
|
|
7480
7504
|
const tabsData = getValues(constants.tabsAccessor);
|
|
7481
7505
|
if (Array.isArray(tabsData) && tabsData.length > 0) {
|
|
@@ -7526,10 +7550,11 @@ const WidgetForm = ({
|
|
|
7526
7550
|
return item;
|
|
7527
7551
|
});
|
|
7528
7552
|
// Clean up fields based on widget type
|
|
7529
|
-
|
|
7553
|
+
const currentWidgetType = formData['widgetType'] || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value);
|
|
7554
|
+
if (currentWidgetType !== constants.htmlWidgetTypeValue) {
|
|
7530
7555
|
delete formData['htmlContent'];
|
|
7531
7556
|
}
|
|
7532
|
-
if (
|
|
7557
|
+
if (currentWidgetType !== constants.textWidgetTypeValue) {
|
|
7533
7558
|
delete formData['textContent'];
|
|
7534
7559
|
}
|
|
7535
7560
|
const submitPayload = Object.assign(Object.assign(Object.assign(Object.assign({}, formData), {
|
|
@@ -7691,38 +7716,62 @@ const WidgetForm = ({
|
|
|
7691
7716
|
isLoading: blogCategoriesLoading,
|
|
7692
7717
|
show: currentItemsType === 'blog' && !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.carouselWidgetTypeValue || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.fixedCardWidgetTypeValue || !selectedWidgetType) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value),
|
|
7693
7718
|
placeholder: 'Select blog category...',
|
|
7694
|
-
wrapperClassName: 'khb_grid-item-1of2 khb_padding-right-1',
|
|
7695
7719
|
customStyles: reactSelectStyles || {},
|
|
7696
7720
|
selectKey: `blog-category-select-${blogCategories.length}`
|
|
7697
7721
|
}, {
|
|
7698
7722
|
label: 'No. of Blogs',
|
|
7699
7723
|
accessor: 'blogLimit',
|
|
7700
|
-
type: '
|
|
7701
|
-
|
|
7702
|
-
value:
|
|
7703
|
-
label:
|
|
7704
|
-
},
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
}, {
|
|
7708
|
-
value: '2',
|
|
7709
|
-
label: '2'
|
|
7710
|
-
}, {
|
|
7711
|
-
value: '3',
|
|
7712
|
-
label: '3'
|
|
7713
|
-
}, {
|
|
7714
|
-
value: '4',
|
|
7715
|
-
label: '4'
|
|
7716
|
-
}, {
|
|
7717
|
-
value: '5',
|
|
7718
|
-
label: '5'
|
|
7719
|
-
}, {
|
|
7720
|
-
value: '6',
|
|
7721
|
-
label: '6'
|
|
7722
|
-
}],
|
|
7723
|
-
show: currentItemsType === 'blog' && !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.carouselWidgetTypeValue || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.fixedCardWidgetTypeValue || !selectedWidgetType) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value),
|
|
7724
|
-
wrapperClassName: 'khb_grid-item-1of2 khb_padding-left-1',
|
|
7724
|
+
type: 'ReactSelect',
|
|
7725
|
+
selectedOptions: blogLimit ? [{
|
|
7726
|
+
value: blogLimit.toString(),
|
|
7727
|
+
label: blogLimit.toString()
|
|
7728
|
+
}] : [],
|
|
7729
|
+
isMulti: false,
|
|
7730
|
+
isSearchable: false,
|
|
7725
7731
|
required: true,
|
|
7732
|
+
isClearable: false,
|
|
7733
|
+
onChange: selected => {
|
|
7734
|
+
const selectedValue = Array.isArray(selected) ? selected[0] : selected;
|
|
7735
|
+
if (selectedValue) {
|
|
7736
|
+
setBlogLimit(parseInt(selectedValue.value));
|
|
7737
|
+
setValue('blogLimit', selectedValue.value);
|
|
7738
|
+
// Clear any existing error when a value is selected
|
|
7739
|
+
clearErrors('blogLimit');
|
|
7740
|
+
} else {
|
|
7741
|
+
// Set error if cleared
|
|
7742
|
+
setError('blogLimit', {
|
|
7743
|
+
type: 'manual',
|
|
7744
|
+
message: 'Number of blogs is required'
|
|
7745
|
+
});
|
|
7746
|
+
}
|
|
7747
|
+
},
|
|
7748
|
+
loadOptions: (_searchStr, callback) => {
|
|
7749
|
+
if (!callback) return;
|
|
7750
|
+
const options = [{
|
|
7751
|
+
value: '1',
|
|
7752
|
+
label: '1'
|
|
7753
|
+
}, {
|
|
7754
|
+
value: '2',
|
|
7755
|
+
label: '2'
|
|
7756
|
+
}, {
|
|
7757
|
+
value: '3',
|
|
7758
|
+
label: '3'
|
|
7759
|
+
}, {
|
|
7760
|
+
value: '4',
|
|
7761
|
+
label: '4'
|
|
7762
|
+
}, {
|
|
7763
|
+
value: '5',
|
|
7764
|
+
label: '5'
|
|
7765
|
+
}, {
|
|
7766
|
+
value: '6',
|
|
7767
|
+
label: '6'
|
|
7768
|
+
}];
|
|
7769
|
+
callback(options);
|
|
7770
|
+
},
|
|
7771
|
+
show: currentItemsType === 'blog' && !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.carouselWidgetTypeValue || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.fixedCardWidgetTypeValue || !selectedWidgetType) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value),
|
|
7772
|
+
placeholder: 'Select number of blogs',
|
|
7773
|
+
customStyles: reactSelectStyles || {},
|
|
7774
|
+
selectKey: `blog-limit-select-${blogLimit}`,
|
|
7726
7775
|
validations: {
|
|
7727
7776
|
required: 'Number of blogs is required'
|
|
7728
7777
|
}
|
package/index.js
CHANGED
|
@@ -3814,40 +3814,53 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
|
|
|
3814
3814
|
languages
|
|
3815
3815
|
}, ref) => {
|
|
3816
3816
|
const inputRenderer = schema => {
|
|
3817
|
-
var _a, _b, _c, _d
|
|
3817
|
+
var _a, _b, _c, _d;
|
|
3818
3818
|
let input;
|
|
3819
3819
|
if (typeof schema.show !== 'undefined' && !schema.show) return null;
|
|
3820
3820
|
if (schema.type) {
|
|
3821
3821
|
switch (schema.type) {
|
|
3822
3822
|
case 'ReactSelect':
|
|
3823
|
-
input = /*#__PURE__*/React.createElement(
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3823
|
+
input = /*#__PURE__*/React.createElement(Controller, {
|
|
3824
|
+
control: control,
|
|
3825
|
+
name: schema.accessor,
|
|
3826
|
+
rules: schema.validations,
|
|
3827
|
+
render: ({
|
|
3828
|
+
field
|
|
3829
|
+
}) => {
|
|
3830
|
+
var _a, _b;
|
|
3831
|
+
return /*#__PURE__*/React.createElement(CustomReactSelect, {
|
|
3832
|
+
disabled: _isUpdating && typeof schema.editable !== 'undefined' && !schema.editable || !_enable || schema.disabled,
|
|
3833
|
+
label: schema.label,
|
|
3834
|
+
error: (_b = (_a = errors[schema.accessor]) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
3835
|
+
onChange: value => {
|
|
3836
|
+
// Handle clear (null value) and selection
|
|
3837
|
+
const fieldValue = value ? Array.isArray(value) ? value.map(item => item.value) : value.value : null;
|
|
3838
|
+
field.onChange(fieldValue);
|
|
3839
|
+
setValue(schema.accessor, fieldValue, {
|
|
3840
|
+
shouldValidate: true
|
|
3841
|
+
});
|
|
3842
|
+
if (schema.onChange) schema.onChange(value);
|
|
3843
|
+
},
|
|
3844
|
+
selectedOptions: schema.selectedOptions,
|
|
3845
|
+
required: schema.required,
|
|
3846
|
+
isMulti: schema.isMulti,
|
|
3847
|
+
isSearchable: schema.isSearchable,
|
|
3848
|
+
isClearable: schema.isClearable,
|
|
3849
|
+
isLoading: schema.isLoading,
|
|
3850
|
+
placeholder: schema.placeholder,
|
|
3851
|
+
wrapperClassName: schema.wrapperClassName,
|
|
3852
|
+
formatOptionLabel: schema.formatOptionLabel,
|
|
3853
|
+
listCode: schema.listCode,
|
|
3854
|
+
customStyles: schema.customStyles,
|
|
3855
|
+
loadOptions: schema.loadOptions,
|
|
3856
|
+
selectKey: schema.selectKey
|
|
3857
|
+
});
|
|
3858
|
+
}
|
|
3846
3859
|
});
|
|
3847
3860
|
break;
|
|
3848
3861
|
case 'checkbox':
|
|
3849
3862
|
input = /*#__PURE__*/React.createElement(Input.Checkbox, {
|
|
3850
|
-
error: (
|
|
3863
|
+
error: (_b = (_a = errors[schema.accessor]) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.toString(),
|
|
3851
3864
|
switchClass: schema.switchClass,
|
|
3852
3865
|
label: schema.label,
|
|
3853
3866
|
rest: register(schema.accessor, schema.validations || {}),
|
|
@@ -3903,7 +3916,7 @@ const SimpleForm = /*#__PURE__*/forwardRef(({
|
|
|
3903
3916
|
} else input = /*#__PURE__*/React.createElement(Input, {
|
|
3904
3917
|
rest: register(schema.accessor, schema.validations || {}),
|
|
3905
3918
|
label: schema.label,
|
|
3906
|
-
error: (
|
|
3919
|
+
error: (_d = (_c = errors[schema.accessor]) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
3907
3920
|
type: schema.type,
|
|
3908
3921
|
className: classNames('w-full p-2', schema.className),
|
|
3909
3922
|
placeholder: schema.placeholder,
|
|
@@ -7464,6 +7477,17 @@ const WidgetForm = ({
|
|
|
7464
7477
|
if (!formData[constants.widgetTypeAccessor] && formState === 'ADD') {
|
|
7465
7478
|
formData[constants.widgetTypeAccessor] = getFirstWidgetTypeValue();
|
|
7466
7479
|
}
|
|
7480
|
+
// Validate blogLimit is required when itemsType is 'blog'
|
|
7481
|
+
const widgetTypeValue = formData[constants.widgetTypeAccessor] || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value);
|
|
7482
|
+
if (currentItemsType === 'blog' && !itemsEnabled && (widgetTypeValue === constants.carouselWidgetTypeValue || widgetTypeValue === constants.fixedCardWidgetTypeValue) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value)) {
|
|
7483
|
+
if (!formData['blogLimit'] || formData['blogLimit'] === '') {
|
|
7484
|
+
setError('blogLimit', {
|
|
7485
|
+
type: 'manual',
|
|
7486
|
+
message: 'Number of blogs is required'
|
|
7487
|
+
});
|
|
7488
|
+
return;
|
|
7489
|
+
}
|
|
7490
|
+
}
|
|
7467
7491
|
// setting tabs data if widgetType tab is selected
|
|
7468
7492
|
const tabsData = getValues(constants.tabsAccessor);
|
|
7469
7493
|
if (Array.isArray(tabsData) && tabsData.length > 0) {
|
|
@@ -7514,10 +7538,11 @@ const WidgetForm = ({
|
|
|
7514
7538
|
return item;
|
|
7515
7539
|
});
|
|
7516
7540
|
// Clean up fields based on widget type
|
|
7517
|
-
|
|
7541
|
+
const currentWidgetType = formData['widgetType'] || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value);
|
|
7542
|
+
if (currentWidgetType !== constants.htmlWidgetTypeValue) {
|
|
7518
7543
|
delete formData['htmlContent'];
|
|
7519
7544
|
}
|
|
7520
|
-
if (
|
|
7545
|
+
if (currentWidgetType !== constants.textWidgetTypeValue) {
|
|
7521
7546
|
delete formData['textContent'];
|
|
7522
7547
|
}
|
|
7523
7548
|
const submitPayload = Object.assign(Object.assign(Object.assign(Object.assign({}, formData), {
|
|
@@ -7679,38 +7704,62 @@ const WidgetForm = ({
|
|
|
7679
7704
|
isLoading: blogCategoriesLoading,
|
|
7680
7705
|
show: currentItemsType === 'blog' && !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.carouselWidgetTypeValue || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.fixedCardWidgetTypeValue || !selectedWidgetType) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value),
|
|
7681
7706
|
placeholder: 'Select blog category...',
|
|
7682
|
-
wrapperClassName: 'khb_grid-item-1of2 khb_padding-right-1',
|
|
7683
7707
|
customStyles: reactSelectStyles || {},
|
|
7684
7708
|
selectKey: `blog-category-select-${blogCategories.length}`
|
|
7685
7709
|
}, {
|
|
7686
7710
|
label: 'No. of Blogs',
|
|
7687
7711
|
accessor: 'blogLimit',
|
|
7688
|
-
type: '
|
|
7689
|
-
|
|
7690
|
-
value:
|
|
7691
|
-
label:
|
|
7692
|
-
},
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
}, {
|
|
7696
|
-
value: '2',
|
|
7697
|
-
label: '2'
|
|
7698
|
-
}, {
|
|
7699
|
-
value: '3',
|
|
7700
|
-
label: '3'
|
|
7701
|
-
}, {
|
|
7702
|
-
value: '4',
|
|
7703
|
-
label: '4'
|
|
7704
|
-
}, {
|
|
7705
|
-
value: '5',
|
|
7706
|
-
label: '5'
|
|
7707
|
-
}, {
|
|
7708
|
-
value: '6',
|
|
7709
|
-
label: '6'
|
|
7710
|
-
}],
|
|
7711
|
-
show: currentItemsType === 'blog' && !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.carouselWidgetTypeValue || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.fixedCardWidgetTypeValue || !selectedWidgetType) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value),
|
|
7712
|
-
wrapperClassName: 'khb_grid-item-1of2 khb_padding-left-1',
|
|
7712
|
+
type: 'ReactSelect',
|
|
7713
|
+
selectedOptions: blogLimit ? [{
|
|
7714
|
+
value: blogLimit.toString(),
|
|
7715
|
+
label: blogLimit.toString()
|
|
7716
|
+
}] : [],
|
|
7717
|
+
isMulti: false,
|
|
7718
|
+
isSearchable: false,
|
|
7713
7719
|
required: true,
|
|
7720
|
+
isClearable: false,
|
|
7721
|
+
onChange: selected => {
|
|
7722
|
+
const selectedValue = Array.isArray(selected) ? selected[0] : selected;
|
|
7723
|
+
if (selectedValue) {
|
|
7724
|
+
setBlogLimit(parseInt(selectedValue.value));
|
|
7725
|
+
setValue('blogLimit', selectedValue.value);
|
|
7726
|
+
// Clear any existing error when a value is selected
|
|
7727
|
+
clearErrors('blogLimit');
|
|
7728
|
+
} else {
|
|
7729
|
+
// Set error if cleared
|
|
7730
|
+
setError('blogLimit', {
|
|
7731
|
+
type: 'manual',
|
|
7732
|
+
message: 'Number of blogs is required'
|
|
7733
|
+
});
|
|
7734
|
+
}
|
|
7735
|
+
},
|
|
7736
|
+
loadOptions: (_searchStr, callback) => {
|
|
7737
|
+
if (!callback) return;
|
|
7738
|
+
const options = [{
|
|
7739
|
+
value: '1',
|
|
7740
|
+
label: '1'
|
|
7741
|
+
}, {
|
|
7742
|
+
value: '2',
|
|
7743
|
+
label: '2'
|
|
7744
|
+
}, {
|
|
7745
|
+
value: '3',
|
|
7746
|
+
label: '3'
|
|
7747
|
+
}, {
|
|
7748
|
+
value: '4',
|
|
7749
|
+
label: '4'
|
|
7750
|
+
}, {
|
|
7751
|
+
value: '5',
|
|
7752
|
+
label: '5'
|
|
7753
|
+
}, {
|
|
7754
|
+
value: '6',
|
|
7755
|
+
label: '6'
|
|
7756
|
+
}];
|
|
7757
|
+
callback(options);
|
|
7758
|
+
},
|
|
7759
|
+
show: currentItemsType === 'blog' && !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.carouselWidgetTypeValue || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === constants.fixedCardWidgetTypeValue || !selectedWidgetType) && !!(selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value),
|
|
7760
|
+
placeholder: 'Select number of blogs',
|
|
7761
|
+
customStyles: reactSelectStyles || {},
|
|
7762
|
+
selectKey: `blog-limit-select-${blogLimit}`,
|
|
7714
7763
|
validations: {
|
|
7715
7764
|
required: 'Number of blogs is required'
|
|
7716
7765
|
}
|