@knovator/pagecreator-admin 0.9.2 → 0.9.4
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 +149 -89
- package/index.js +149 -89
- package/package.json +1 -1
- package/src/lib/constants/common.d.ts +2 -4
package/index.cjs
CHANGED
|
@@ -1705,14 +1705,12 @@ const TRANSLATION_PAIRS_COMMON = {
|
|
|
1705
1705
|
pleaseType: 'Please type',
|
|
1706
1706
|
toProceedOrCancel: 'to processed or close this modal to cancel.',
|
|
1707
1707
|
confirm: 'Confirm',
|
|
1708
|
-
|
|
1709
|
-
|
|
1708
|
+
nextContent: 'Next',
|
|
1709
|
+
previousContent: 'Previous',
|
|
1710
1710
|
page: 'Page',
|
|
1711
1711
|
next: 'Next',
|
|
1712
|
-
previous: 'Previous',
|
|
1713
1712
|
indicatesRequired: 'Indicates fields are required',
|
|
1714
1713
|
addButtonText: 'Add',
|
|
1715
|
-
editButtonText: 'Edit',
|
|
1716
1714
|
cancelButtonText: 'Cancel',
|
|
1717
1715
|
yesButtonText: 'Yes',
|
|
1718
1716
|
deleteButtonText: 'Delete',
|
|
@@ -4107,8 +4105,8 @@ const AddButton$1 = () => {
|
|
|
4107
4105
|
} = usePageState();
|
|
4108
4106
|
return /*#__PURE__*/React__default["default"].createElement(Button, {
|
|
4109
4107
|
disabled: !canAdd,
|
|
4110
|
-
onClick: () => onChangeFormState(
|
|
4111
|
-
}, t(
|
|
4108
|
+
onClick: () => onChangeFormState('ADD')
|
|
4109
|
+
}, t('addButtonText') || t('common:addButtonText'));
|
|
4112
4110
|
};
|
|
4113
4111
|
|
|
4114
4112
|
const ChevronLeft = ({
|
|
@@ -4220,11 +4218,11 @@ const PagePagination = () => {
|
|
|
4220
4218
|
setCurrentPage
|
|
4221
4219
|
} = usePageState();
|
|
4222
4220
|
return /*#__PURE__*/React__default["default"].createElement(Pagination, {
|
|
4223
|
-
ofText: t('of'),
|
|
4224
|
-
pageText: t('
|
|
4225
|
-
showingText: t('showing'),
|
|
4226
|
-
nextContent: t('nextContent'),
|
|
4227
|
-
previousContent: t('previousContent'),
|
|
4221
|
+
ofText: t('of') || t('common:of'),
|
|
4222
|
+
pageText: t('confirm') || t('common:confirm'),
|
|
4223
|
+
showingText: t('showing') || t('common:showing'),
|
|
4224
|
+
nextContent: t('nextContent') || t('common:nextContent'),
|
|
4225
|
+
previousContent: t('previousContent') || t('common:previousContent'),
|
|
4228
4226
|
totalPages: totalPages,
|
|
4229
4227
|
totalRecords: totalRecords,
|
|
4230
4228
|
currentPage: currentPage,
|
|
@@ -4436,10 +4434,10 @@ const PageFormActions = ({
|
|
|
4436
4434
|
if (!canAdd && !canUpdate) return null;
|
|
4437
4435
|
return /*#__PURE__*/React__default["default"].createElement(FormActions, {
|
|
4438
4436
|
loading: loading,
|
|
4439
|
-
primaryLabel: formState === 'ADD' ? t('createButtonText') : t('updateButtonText'),
|
|
4437
|
+
primaryLabel: formState === 'ADD' ? t('createButtonText') || t('common:createButtonText') : t('updateButtonText') || t('common:updateButtonText'),
|
|
4440
4438
|
onPrimaryButtonClick: onSubmitClick,
|
|
4441
4439
|
onSecondaryButtonClick: closeForm,
|
|
4442
|
-
secondaryLabel: t('cancelButtonText')
|
|
4440
|
+
secondaryLabel: t('cancelButtonText') || t('common:cancelButtonText')
|
|
4443
4441
|
});
|
|
4444
4442
|
};
|
|
4445
4443
|
|
|
@@ -4541,13 +4539,13 @@ const Page = ({
|
|
|
4541
4539
|
itemData: itemData,
|
|
4542
4540
|
onClose: onCloseForm,
|
|
4543
4541
|
onConfirmDelete: onCofirmDeletePage,
|
|
4544
|
-
confirmationRequired: derivedT('confirmationRequired'),
|
|
4545
|
-
confirm: derivedT('confirm'),
|
|
4546
|
-
lossOfData: derivedT('lossOfData'),
|
|
4547
|
-
permanentlyDelete: derivedT('permanentlyDelete'),
|
|
4548
|
-
pleaseType: derivedT('pleaseType'),
|
|
4549
|
-
toProceedOrCancel: derivedT('toProceedOrCancel'),
|
|
4550
|
-
typeHerePlaceholder: derivedT('typeHerePlaceholder')
|
|
4542
|
+
confirmationRequired: derivedT('confirmationRequired') || derivedT('common:confirmationRequired'),
|
|
4543
|
+
confirm: derivedT('confirm') || derivedT('common:confirm'),
|
|
4544
|
+
lossOfData: derivedT('lossOfData') || derivedT('common:lossOfData'),
|
|
4545
|
+
permanentlyDelete: derivedT('permanentlyDelete') || derivedT('common:permanentlyDelete'),
|
|
4546
|
+
pleaseType: derivedT('pleaseType') || derivedT('common:pleaseType'),
|
|
4547
|
+
toProceedOrCancel: derivedT('toProceedOrCancel') || derivedT('common:toProceedOrCancel'),
|
|
4548
|
+
typeHerePlaceholder: derivedT('typeHerePlaceholder') || derivedT('common:typeHerePlaceholder')
|
|
4551
4549
|
}));
|
|
4552
4550
|
};
|
|
4553
4551
|
Page.Table = PageTable;
|
|
@@ -4582,8 +4580,7 @@ const useWidget = ({
|
|
|
4582
4580
|
onError,
|
|
4583
4581
|
onSuccess,
|
|
4584
4582
|
onLogout,
|
|
4585
|
-
widgetRoutesPrefix
|
|
4586
|
-
pageRoutesPrefix
|
|
4583
|
+
widgetRoutesPrefix
|
|
4587
4584
|
} = useProviderState();
|
|
4588
4585
|
const {
|
|
4589
4586
|
changeSearch,
|
|
@@ -4645,7 +4642,7 @@ const useWidget = ({
|
|
|
4645
4642
|
const api = getApiType({
|
|
4646
4643
|
routes,
|
|
4647
4644
|
action: 'LANGUAGES',
|
|
4648
|
-
prefix:
|
|
4645
|
+
prefix: widgetRoutesPrefix
|
|
4649
4646
|
});
|
|
4650
4647
|
const response = yield commonApi({
|
|
4651
4648
|
baseUrl,
|
|
@@ -4658,7 +4655,7 @@ const useWidget = ({
|
|
|
4658
4655
|
setLanguages(response.data);
|
|
4659
4656
|
return response.data;
|
|
4660
4657
|
}
|
|
4661
|
-
}), [baseUrl, handleError,
|
|
4658
|
+
}), [baseUrl, handleError, widgetRoutesPrefix, routes, token]);
|
|
4662
4659
|
const onCofirmDeleteWidget = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
4663
4660
|
try {
|
|
4664
4661
|
let proceed = true;
|
|
@@ -6500,6 +6497,48 @@ const ConfirmPopOver = ({
|
|
|
6500
6497
|
}, children));
|
|
6501
6498
|
};
|
|
6502
6499
|
|
|
6500
|
+
const ImageInput = ({
|
|
6501
|
+
label,
|
|
6502
|
+
control,
|
|
6503
|
+
name,
|
|
6504
|
+
text,
|
|
6505
|
+
error,
|
|
6506
|
+
baseUrl,
|
|
6507
|
+
setError,
|
|
6508
|
+
clearError,
|
|
6509
|
+
onImageRemove,
|
|
6510
|
+
imageMaxSize,
|
|
6511
|
+
onImageUpload
|
|
6512
|
+
}) => {
|
|
6513
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6514
|
+
className: "kms_input-wrapper"
|
|
6515
|
+
}, /*#__PURE__*/React__default["default"].createElement("label", {
|
|
6516
|
+
className: "kms_input-label"
|
|
6517
|
+
}, label), /*#__PURE__*/React__default["default"].createElement(reactHookForm.Controller, {
|
|
6518
|
+
control: control,
|
|
6519
|
+
name: name,
|
|
6520
|
+
render: ({
|
|
6521
|
+
field
|
|
6522
|
+
}) => /*#__PURE__*/React__default["default"].createElement(ImageUpload$1, {
|
|
6523
|
+
imgId: field.value,
|
|
6524
|
+
clearError: () => clearError(name),
|
|
6525
|
+
maxSize: imageMaxSize,
|
|
6526
|
+
onError: msg => setError(name, {
|
|
6527
|
+
type: 'custom',
|
|
6528
|
+
message: msg
|
|
6529
|
+
}),
|
|
6530
|
+
error: error,
|
|
6531
|
+
setImgId: value => {
|
|
6532
|
+
field.onChange(value);
|
|
6533
|
+
},
|
|
6534
|
+
baseUrl: baseUrl,
|
|
6535
|
+
text: text,
|
|
6536
|
+
onImageUpload: onImageUpload,
|
|
6537
|
+
onImageRemove: onImageRemove,
|
|
6538
|
+
className: "khb_img-upload-wrapper-3"
|
|
6539
|
+
})
|
|
6540
|
+
}));
|
|
6541
|
+
};
|
|
6503
6542
|
const ItemsAccordian = ({
|
|
6504
6543
|
show,
|
|
6505
6544
|
title,
|
|
@@ -6577,7 +6616,7 @@ const ItemsAccordian = ({
|
|
|
6577
6616
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6578
6617
|
className: "khb_item-items"
|
|
6579
6618
|
}, items === null || items === void 0 ? void 0 : items.map((field, index) => {
|
|
6580
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6619
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
6581
6620
|
return /*#__PURE__*/React__default["default"].createElement(Accordian, {
|
|
6582
6621
|
key: index,
|
|
6583
6622
|
open: itemsShow[index],
|
|
@@ -6588,8 +6627,8 @@ const ItemsAccordian = ({
|
|
|
6588
6627
|
footerContent: /*#__PURE__*/React__default["default"].createElement(ConfirmPopOver, {
|
|
6589
6628
|
onConfirm: () => removeItem(index),
|
|
6590
6629
|
title: t('item.deleteTitle'),
|
|
6591
|
-
confirmText: t('yesButtonText'),
|
|
6592
|
-
cancelText: t('cancelButtonText')
|
|
6630
|
+
confirmText: t('yesButtonText') || t('common:yesButtonText'),
|
|
6631
|
+
cancelText: t('cancelButtonText') || t('common:cancelButtonText')
|
|
6593
6632
|
}, /*#__PURE__*/React__default["default"].createElement(Button, {
|
|
6594
6633
|
type: "danger",
|
|
6595
6634
|
size: "sm",
|
|
@@ -6598,16 +6637,16 @@ const ItemsAccordian = ({
|
|
|
6598
6637
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6599
6638
|
className: "khb-form-items"
|
|
6600
6639
|
}, Array.isArray(languages) && languages.length > 0 ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, languages.map(lang => {
|
|
6601
|
-
var _a, _b, _c, _d, _e;
|
|
6640
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6602
6641
|
return /*#__PURE__*/React__default["default"].createElement(Input, {
|
|
6603
6642
|
rest: register(`${name}.${index}.titles.${lang.code}`, {
|
|
6604
6643
|
required: t('item.titleRequired')
|
|
6605
6644
|
}),
|
|
6606
6645
|
label: t('item.title') + ` (${lang.name})`,
|
|
6607
|
-
error: (
|
|
6646
|
+
error: ((_c = (_b = (_a = errors[name]) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b['titles']) === null || _c === void 0 ? void 0 : _c[lang.code]) ? ((_h = (_g = (_f = (_e = (_d = errors[name]) === null || _d === void 0 ? void 0 : _d[index]) === null || _e === void 0 ? void 0 : _e['titles']) === null || _f === void 0 ? void 0 : _f[lang.code]) === null || _g === void 0 ? void 0 : _g.message) === null || _h === void 0 ? void 0 : _h.toString()) + ` (${lang.name})` : '',
|
|
6608
6647
|
type: "text",
|
|
6609
6648
|
className: "w-full p-2",
|
|
6610
|
-
placeholder: t('item.titlePlaceholder')
|
|
6649
|
+
placeholder: t('item.titlePlaceholder') + ` (${lang.name})`,
|
|
6611
6650
|
required: true
|
|
6612
6651
|
});
|
|
6613
6652
|
})) : /*#__PURE__*/React__default["default"].createElement(Input, {
|
|
@@ -6625,14 +6664,20 @@ const ItemsAccordian = ({
|
|
|
6625
6664
|
label: t('item.subtitle') + ` (${lang.name})`,
|
|
6626
6665
|
type: "text",
|
|
6627
6666
|
className: "w-full p-2",
|
|
6628
|
-
placeholder: t('item.subTitlePlaceholder')
|
|
6667
|
+
placeholder: t('item.subTitlePlaceholder') + ` (${lang.name})`
|
|
6629
6668
|
}))) : /*#__PURE__*/React__default["default"].createElement(Input, {
|
|
6630
6669
|
rest: register(`${name}.${index}.subtitle`),
|
|
6631
6670
|
label: t('item.subtitle'),
|
|
6632
6671
|
type: "text",
|
|
6633
6672
|
className: "w-full p-2",
|
|
6634
6673
|
placeholder: t('item.subTitlePlaceholder')
|
|
6635
|
-
}), /*#__PURE__*/React__default["default"].createElement(Input, {
|
|
6674
|
+
}), Array.isArray(languages) && languages.length > 0 ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, languages.map(lang => /*#__PURE__*/React__default["default"].createElement(Input, {
|
|
6675
|
+
rest: register(`${name}.${index}.altTexts.${lang.code}`),
|
|
6676
|
+
label: t('item.altText') + ` (${lang.name})`,
|
|
6677
|
+
type: 'text',
|
|
6678
|
+
className: "w-full p-2",
|
|
6679
|
+
placeholder: t('item.altTextPlaceholder') + ` (${lang.name})`
|
|
6680
|
+
}))) : /*#__PURE__*/React__default["default"].createElement(Input, {
|
|
6636
6681
|
rest: register(`${name}.${index}.altText`),
|
|
6637
6682
|
label: t('item.altText'),
|
|
6638
6683
|
type: 'text',
|
|
@@ -6651,45 +6696,51 @@ const ItemsAccordian = ({
|
|
|
6651
6696
|
name: `${name}.${index}.srcset`,
|
|
6652
6697
|
errors: (_f = (_e = errors[name]) === null || _e === void 0 ? void 0 : _e[index]) === null || _f === void 0 ? void 0 : _f['srcset'],
|
|
6653
6698
|
t: t
|
|
6654
|
-
}), /*#__PURE__*/React__default["default"].createElement("
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6699
|
+
}), Array.isArray(languages) && languages.length > 0 ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, languages.map(lang => {
|
|
6700
|
+
var _a, _b, _c, _d, _e;
|
|
6701
|
+
return /*#__PURE__*/React__default["default"].createElement(ImageInput, {
|
|
6702
|
+
key: lang.code,
|
|
6703
|
+
label: t('item.image') + ` (${lang.name})`,
|
|
6704
|
+
control: control,
|
|
6705
|
+
name: `${name}.${index}.imgs.${lang.code}`,
|
|
6706
|
+
error: (_e = (_d = (_c = (_b = (_a = errors[name]) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b['imgs']) === null || _c === void 0 ? void 0 : _c[lang.code]) === null || _d === void 0 ? void 0 : _d.message) === null || _e === void 0 ? void 0 : _e.toString(),
|
|
6707
|
+
baseUrl: imageBaseUrl ? imageBaseUrl : baseUrl,
|
|
6708
|
+
setError: setError,
|
|
6709
|
+
clearError: clearError,
|
|
6710
|
+
onImageRemove: onImageRemove,
|
|
6711
|
+
imageMaxSize: imageMaxSize,
|
|
6712
|
+
onImageUpload: onImageUpload,
|
|
6713
|
+
text: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6714
|
+
className: "khb_img-text-wrapper"
|
|
6715
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6716
|
+
className: "khb_img-text-label"
|
|
6717
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, t('item.uploadFile'))), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
6718
|
+
className: "khb_img-text-1"
|
|
6719
|
+
}, t('item.dragDrop'))), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
6720
|
+
className: "khb_img-text-2"
|
|
6721
|
+
}, t('item.allowedFormat')))
|
|
6722
|
+
});
|
|
6723
|
+
})) : /*#__PURE__*/React__default["default"].createElement(ImageInput, {
|
|
6724
|
+
label: t('item.image'),
|
|
6659
6725
|
control: control,
|
|
6660
6726
|
name: `${name}.${index}.img`,
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
text: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6679
|
-
className: "khb_img-text-wrapper"
|
|
6680
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6681
|
-
className: "khb_img-text-label"
|
|
6682
|
-
}, /*#__PURE__*/React__default["default"].createElement("span", null, t('item.uploadFile'))), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
6683
|
-
className: "khb_img-text-1"
|
|
6684
|
-
}, t('item.dragDrop'))), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
6685
|
-
className: "khb_img-text-2"
|
|
6686
|
-
}, t('item.allowedFormat'))),
|
|
6687
|
-
onImageUpload: onImageUpload,
|
|
6688
|
-
onImageRemove: onImageRemove,
|
|
6689
|
-
className: "khb_img-upload-wrapper-3"
|
|
6690
|
-
});
|
|
6691
|
-
}
|
|
6692
|
-
}))));
|
|
6727
|
+
error: (_k = (_j = (_h = (_g = errors[name]) === null || _g === void 0 ? void 0 : _g[index]) === null || _h === void 0 ? void 0 : _h['img']) === null || _j === void 0 ? void 0 : _j.message) === null || _k === void 0 ? void 0 : _k.toString(),
|
|
6728
|
+
baseUrl: imageBaseUrl ? imageBaseUrl : baseUrl,
|
|
6729
|
+
setError: setError,
|
|
6730
|
+
clearError: clearError,
|
|
6731
|
+
onImageRemove: onImageRemove,
|
|
6732
|
+
imageMaxSize: imageMaxSize,
|
|
6733
|
+
onImageUpload: onImageUpload,
|
|
6734
|
+
text: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6735
|
+
className: "khb_img-text-wrapper"
|
|
6736
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6737
|
+
className: "khb_img-text-label"
|
|
6738
|
+
}, /*#__PURE__*/React__default["default"].createElement("span", null, t('item.uploadFile'))), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
6739
|
+
className: "khb_img-text-1"
|
|
6740
|
+
}, t('item.dragDrop'))), /*#__PURE__*/React__default["default"].createElement("p", {
|
|
6741
|
+
className: "khb_img-text-2"
|
|
6742
|
+
}, t('item.allowedFormat')))
|
|
6743
|
+
})));
|
|
6693
6744
|
})));
|
|
6694
6745
|
};
|
|
6695
6746
|
|
|
@@ -7106,6 +7157,15 @@ const WidgetForm = ({
|
|
|
7106
7157
|
let items = [...(getValues(constants.webItems) || []), ...(getValues(constants.mobileItems) || [])];
|
|
7107
7158
|
items = items.map(_a => {
|
|
7108
7159
|
var item = __rest(_a, ["_id", "__v", "widgetId"]);
|
|
7160
|
+
if (typeof item['imgs'] === 'object' && item['imgs']) {
|
|
7161
|
+
Object.keys(item['imgs']).forEach(key => {
|
|
7162
|
+
if (item['imgs'][key] && item['imgs'][key]['_id']) {
|
|
7163
|
+
item['imgs'][key] = item['imgs'][key]['_id'];
|
|
7164
|
+
} else if (typeof item['imgs'][key] !== 'string' || !item['imgs'][key]) {
|
|
7165
|
+
delete item['imgs'][key];
|
|
7166
|
+
}
|
|
7167
|
+
});
|
|
7168
|
+
}
|
|
7109
7169
|
if (item['img'] && item['img']['_id']) {
|
|
7110
7170
|
item['img'] = item['img']['_id'];
|
|
7111
7171
|
} else if (typeof item['img'] !== 'string' || !item['img']) {
|
|
@@ -7311,8 +7371,8 @@ const WidgetForm = ({
|
|
|
7311
7371
|
control: control,
|
|
7312
7372
|
languages: languages,
|
|
7313
7373
|
deleteTitle: t('widget.tabDeleteTitle'),
|
|
7314
|
-
yesButtonText: t('yesButtonText'),
|
|
7315
|
-
noButtonText: t('cancelButtonText'),
|
|
7374
|
+
yesButtonText: t('yesButtonText') || t('common:yesButtonText'),
|
|
7375
|
+
noButtonText: t('cancelButtonText') || t('common:cancelButtonText'),
|
|
7316
7376
|
errors: errors,
|
|
7317
7377
|
itemsPlaceholder: `Select ${selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.label}...`,
|
|
7318
7378
|
loadOptions: onChangeSearch,
|
|
@@ -7346,7 +7406,7 @@ const WidgetForm = ({
|
|
|
7346
7406
|
register: register,
|
|
7347
7407
|
loading: loading,
|
|
7348
7408
|
addText: t('addButtonText'),
|
|
7349
|
-
deleteText: t('deleteButtonText')
|
|
7409
|
+
deleteText: t('deleteButtonText') || t('common:deleteButtonText')
|
|
7350
7410
|
}), /*#__PURE__*/React__default["default"].createElement(ItemsAccordian, {
|
|
7351
7411
|
languages: languages,
|
|
7352
7412
|
clearError: clearErrors,
|
|
@@ -7363,7 +7423,7 @@ const WidgetForm = ({
|
|
|
7363
7423
|
control: control,
|
|
7364
7424
|
register: register,
|
|
7365
7425
|
addText: t('addButtonText'),
|
|
7366
|
-
deleteText: t('deleteButtonText')
|
|
7426
|
+
deleteText: t('deleteButtonText') || t('common:deleteButtonText')
|
|
7367
7427
|
})));
|
|
7368
7428
|
};
|
|
7369
7429
|
|
|
@@ -7375,8 +7435,8 @@ const AddButton = () => {
|
|
|
7375
7435
|
} = useWidgetState();
|
|
7376
7436
|
return /*#__PURE__*/React__default["default"].createElement(Button, {
|
|
7377
7437
|
disabled: !canAdd,
|
|
7378
|
-
onClick: () => onChangeFormState(
|
|
7379
|
-
}, t(
|
|
7438
|
+
onClick: () => onChangeFormState('ADD')
|
|
7439
|
+
}, t('addButtonText') || t('common:addButtonText'));
|
|
7380
7440
|
};
|
|
7381
7441
|
|
|
7382
7442
|
const WidgetPagination = () => {
|
|
@@ -7389,11 +7449,11 @@ const WidgetPagination = () => {
|
|
|
7389
7449
|
setCurrentPage
|
|
7390
7450
|
} = useWidgetState();
|
|
7391
7451
|
return /*#__PURE__*/React__default["default"].createElement(Pagination, {
|
|
7392
|
-
ofText: t('of'),
|
|
7393
|
-
pageText: t('
|
|
7394
|
-
showingText: t('showing'),
|
|
7395
|
-
nextContent: t('nextContent'),
|
|
7396
|
-
previousContent: t('previousContent'),
|
|
7452
|
+
ofText: t('of') || t('common:of'),
|
|
7453
|
+
pageText: t('confirm') || t('common:confirm'),
|
|
7454
|
+
showingText: t('showing') || t('common:showing'),
|
|
7455
|
+
nextContent: t('nextContent') || t('common:nextContent'),
|
|
7456
|
+
previousContent: t('previousContent') || t('common:previousContent'),
|
|
7397
7457
|
totalPages: totalPages,
|
|
7398
7458
|
totalRecords: totalRecords,
|
|
7399
7459
|
currentPage: currentPage,
|
|
@@ -7459,10 +7519,10 @@ const WidgetFormActions = ({
|
|
|
7459
7519
|
if (!canAdd && !canUpdate) return null;
|
|
7460
7520
|
return /*#__PURE__*/React__default["default"].createElement(FormActions, {
|
|
7461
7521
|
loading: loading,
|
|
7462
|
-
primaryLabel: formState === 'ADD' ? t('createButtonText') : t('updateButtonText'),
|
|
7522
|
+
primaryLabel: formState === 'ADD' ? t('createButtonText') || t('common:createButtonText') : t('updateButtonText') || t('common:updateButtonText'),
|
|
7463
7523
|
onPrimaryButtonClick: onSubmitClick,
|
|
7464
7524
|
onSecondaryButtonClick: closeForm,
|
|
7465
|
-
secondaryLabel: t('cancelButtonText')
|
|
7525
|
+
secondaryLabel: t('cancelButtonText') || t('common:cancelButtonText')
|
|
7466
7526
|
});
|
|
7467
7527
|
};
|
|
7468
7528
|
|
|
@@ -7586,13 +7646,13 @@ const Widget = ({
|
|
|
7586
7646
|
itemData: itemData,
|
|
7587
7647
|
onClose: onCloseForm,
|
|
7588
7648
|
onConfirmDelete: onCofirmDeleteWidget,
|
|
7589
|
-
confirmationRequired: derivedT('confirmationRequired'),
|
|
7590
|
-
confirm: derivedT('confirm'),
|
|
7591
|
-
lossOfData: derivedT('lossOfData'),
|
|
7592
|
-
permanentlyDelete: derivedT('permanentlyDelete'),
|
|
7593
|
-
pleaseType: derivedT('pleaseType'),
|
|
7594
|
-
toProceedOrCancel: derivedT('toProceedOrCancel'),
|
|
7595
|
-
typeHerePlaceholder: derivedT('typeHerePlaceholder')
|
|
7649
|
+
confirmationRequired: derivedT('confirmationRequired') || derivedT('common:confirmationRequired'),
|
|
7650
|
+
confirm: derivedT('confirm') || derivedT('common:confirm'),
|
|
7651
|
+
lossOfData: derivedT('lossOfData') || derivedT('common:lossOfData'),
|
|
7652
|
+
permanentlyDelete: derivedT('permanentlyDelete') || derivedT('common:permanentlyDelete'),
|
|
7653
|
+
pleaseType: derivedT('pleaseType') || derivedT('common:pleaseType'),
|
|
7654
|
+
toProceedOrCancel: derivedT('toProceedOrCancel') || derivedT('common:toProceedOrCancel'),
|
|
7655
|
+
typeHerePlaceholder: derivedT('typeHerePlaceholder') || derivedT('common:typeHerePlaceholder')
|
|
7596
7656
|
}));
|
|
7597
7657
|
};
|
|
7598
7658
|
Widget.Table = WidgetTable;
|
package/index.js
CHANGED
|
@@ -1693,14 +1693,12 @@ const TRANSLATION_PAIRS_COMMON = {
|
|
|
1693
1693
|
pleaseType: 'Please type',
|
|
1694
1694
|
toProceedOrCancel: 'to processed or close this modal to cancel.',
|
|
1695
1695
|
confirm: 'Confirm',
|
|
1696
|
-
|
|
1697
|
-
|
|
1696
|
+
nextContent: 'Next',
|
|
1697
|
+
previousContent: 'Previous',
|
|
1698
1698
|
page: 'Page',
|
|
1699
1699
|
next: 'Next',
|
|
1700
|
-
previous: 'Previous',
|
|
1701
1700
|
indicatesRequired: 'Indicates fields are required',
|
|
1702
1701
|
addButtonText: 'Add',
|
|
1703
|
-
editButtonText: 'Edit',
|
|
1704
1702
|
cancelButtonText: 'Cancel',
|
|
1705
1703
|
yesButtonText: 'Yes',
|
|
1706
1704
|
deleteButtonText: 'Delete',
|
|
@@ -4095,8 +4093,8 @@ const AddButton$1 = () => {
|
|
|
4095
4093
|
} = usePageState();
|
|
4096
4094
|
return /*#__PURE__*/React.createElement(Button, {
|
|
4097
4095
|
disabled: !canAdd,
|
|
4098
|
-
onClick: () => onChangeFormState(
|
|
4099
|
-
}, t(
|
|
4096
|
+
onClick: () => onChangeFormState('ADD')
|
|
4097
|
+
}, t('addButtonText') || t('common:addButtonText'));
|
|
4100
4098
|
};
|
|
4101
4099
|
|
|
4102
4100
|
const ChevronLeft = ({
|
|
@@ -4208,11 +4206,11 @@ const PagePagination = () => {
|
|
|
4208
4206
|
setCurrentPage
|
|
4209
4207
|
} = usePageState();
|
|
4210
4208
|
return /*#__PURE__*/React.createElement(Pagination, {
|
|
4211
|
-
ofText: t('of'),
|
|
4212
|
-
pageText: t('
|
|
4213
|
-
showingText: t('showing'),
|
|
4214
|
-
nextContent: t('nextContent'),
|
|
4215
|
-
previousContent: t('previousContent'),
|
|
4209
|
+
ofText: t('of') || t('common:of'),
|
|
4210
|
+
pageText: t('confirm') || t('common:confirm'),
|
|
4211
|
+
showingText: t('showing') || t('common:showing'),
|
|
4212
|
+
nextContent: t('nextContent') || t('common:nextContent'),
|
|
4213
|
+
previousContent: t('previousContent') || t('common:previousContent'),
|
|
4216
4214
|
totalPages: totalPages,
|
|
4217
4215
|
totalRecords: totalRecords,
|
|
4218
4216
|
currentPage: currentPage,
|
|
@@ -4424,10 +4422,10 @@ const PageFormActions = ({
|
|
|
4424
4422
|
if (!canAdd && !canUpdate) return null;
|
|
4425
4423
|
return /*#__PURE__*/React.createElement(FormActions, {
|
|
4426
4424
|
loading: loading,
|
|
4427
|
-
primaryLabel: formState === 'ADD' ? t('createButtonText') : t('updateButtonText'),
|
|
4425
|
+
primaryLabel: formState === 'ADD' ? t('createButtonText') || t('common:createButtonText') : t('updateButtonText') || t('common:updateButtonText'),
|
|
4428
4426
|
onPrimaryButtonClick: onSubmitClick,
|
|
4429
4427
|
onSecondaryButtonClick: closeForm,
|
|
4430
|
-
secondaryLabel: t('cancelButtonText')
|
|
4428
|
+
secondaryLabel: t('cancelButtonText') || t('common:cancelButtonText')
|
|
4431
4429
|
});
|
|
4432
4430
|
};
|
|
4433
4431
|
|
|
@@ -4529,13 +4527,13 @@ const Page = ({
|
|
|
4529
4527
|
itemData: itemData,
|
|
4530
4528
|
onClose: onCloseForm,
|
|
4531
4529
|
onConfirmDelete: onCofirmDeletePage,
|
|
4532
|
-
confirmationRequired: derivedT('confirmationRequired'),
|
|
4533
|
-
confirm: derivedT('confirm'),
|
|
4534
|
-
lossOfData: derivedT('lossOfData'),
|
|
4535
|
-
permanentlyDelete: derivedT('permanentlyDelete'),
|
|
4536
|
-
pleaseType: derivedT('pleaseType'),
|
|
4537
|
-
toProceedOrCancel: derivedT('toProceedOrCancel'),
|
|
4538
|
-
typeHerePlaceholder: derivedT('typeHerePlaceholder')
|
|
4530
|
+
confirmationRequired: derivedT('confirmationRequired') || derivedT('common:confirmationRequired'),
|
|
4531
|
+
confirm: derivedT('confirm') || derivedT('common:confirm'),
|
|
4532
|
+
lossOfData: derivedT('lossOfData') || derivedT('common:lossOfData'),
|
|
4533
|
+
permanentlyDelete: derivedT('permanentlyDelete') || derivedT('common:permanentlyDelete'),
|
|
4534
|
+
pleaseType: derivedT('pleaseType') || derivedT('common:pleaseType'),
|
|
4535
|
+
toProceedOrCancel: derivedT('toProceedOrCancel') || derivedT('common:toProceedOrCancel'),
|
|
4536
|
+
typeHerePlaceholder: derivedT('typeHerePlaceholder') || derivedT('common:typeHerePlaceholder')
|
|
4539
4537
|
}));
|
|
4540
4538
|
};
|
|
4541
4539
|
Page.Table = PageTable;
|
|
@@ -4570,8 +4568,7 @@ const useWidget = ({
|
|
|
4570
4568
|
onError,
|
|
4571
4569
|
onSuccess,
|
|
4572
4570
|
onLogout,
|
|
4573
|
-
widgetRoutesPrefix
|
|
4574
|
-
pageRoutesPrefix
|
|
4571
|
+
widgetRoutesPrefix
|
|
4575
4572
|
} = useProviderState();
|
|
4576
4573
|
const {
|
|
4577
4574
|
changeSearch,
|
|
@@ -4633,7 +4630,7 @@ const useWidget = ({
|
|
|
4633
4630
|
const api = getApiType({
|
|
4634
4631
|
routes,
|
|
4635
4632
|
action: 'LANGUAGES',
|
|
4636
|
-
prefix:
|
|
4633
|
+
prefix: widgetRoutesPrefix
|
|
4637
4634
|
});
|
|
4638
4635
|
const response = yield commonApi({
|
|
4639
4636
|
baseUrl,
|
|
@@ -4646,7 +4643,7 @@ const useWidget = ({
|
|
|
4646
4643
|
setLanguages(response.data);
|
|
4647
4644
|
return response.data;
|
|
4648
4645
|
}
|
|
4649
|
-
}), [baseUrl, handleError,
|
|
4646
|
+
}), [baseUrl, handleError, widgetRoutesPrefix, routes, token]);
|
|
4650
4647
|
const onCofirmDeleteWidget = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
4651
4648
|
try {
|
|
4652
4649
|
let proceed = true;
|
|
@@ -6488,6 +6485,48 @@ const ConfirmPopOver = ({
|
|
|
6488
6485
|
}, children));
|
|
6489
6486
|
};
|
|
6490
6487
|
|
|
6488
|
+
const ImageInput = ({
|
|
6489
|
+
label,
|
|
6490
|
+
control,
|
|
6491
|
+
name,
|
|
6492
|
+
text,
|
|
6493
|
+
error,
|
|
6494
|
+
baseUrl,
|
|
6495
|
+
setError,
|
|
6496
|
+
clearError,
|
|
6497
|
+
onImageRemove,
|
|
6498
|
+
imageMaxSize,
|
|
6499
|
+
onImageUpload
|
|
6500
|
+
}) => {
|
|
6501
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
6502
|
+
className: "kms_input-wrapper"
|
|
6503
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
6504
|
+
className: "kms_input-label"
|
|
6505
|
+
}, label), /*#__PURE__*/React.createElement(Controller, {
|
|
6506
|
+
control: control,
|
|
6507
|
+
name: name,
|
|
6508
|
+
render: ({
|
|
6509
|
+
field
|
|
6510
|
+
}) => /*#__PURE__*/React.createElement(ImageUpload$1, {
|
|
6511
|
+
imgId: field.value,
|
|
6512
|
+
clearError: () => clearError(name),
|
|
6513
|
+
maxSize: imageMaxSize,
|
|
6514
|
+
onError: msg => setError(name, {
|
|
6515
|
+
type: 'custom',
|
|
6516
|
+
message: msg
|
|
6517
|
+
}),
|
|
6518
|
+
error: error,
|
|
6519
|
+
setImgId: value => {
|
|
6520
|
+
field.onChange(value);
|
|
6521
|
+
},
|
|
6522
|
+
baseUrl: baseUrl,
|
|
6523
|
+
text: text,
|
|
6524
|
+
onImageUpload: onImageUpload,
|
|
6525
|
+
onImageRemove: onImageRemove,
|
|
6526
|
+
className: "khb_img-upload-wrapper-3"
|
|
6527
|
+
})
|
|
6528
|
+
}));
|
|
6529
|
+
};
|
|
6491
6530
|
const ItemsAccordian = ({
|
|
6492
6531
|
show,
|
|
6493
6532
|
title,
|
|
@@ -6565,7 +6604,7 @@ const ItemsAccordian = ({
|
|
|
6565
6604
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6566
6605
|
className: "khb_item-items"
|
|
6567
6606
|
}, items === null || items === void 0 ? void 0 : items.map((field, index) => {
|
|
6568
|
-
var _a, _b, _c, _d, _e, _f;
|
|
6607
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
6569
6608
|
return /*#__PURE__*/React.createElement(Accordian, {
|
|
6570
6609
|
key: index,
|
|
6571
6610
|
open: itemsShow[index],
|
|
@@ -6576,8 +6615,8 @@ const ItemsAccordian = ({
|
|
|
6576
6615
|
footerContent: /*#__PURE__*/React.createElement(ConfirmPopOver, {
|
|
6577
6616
|
onConfirm: () => removeItem(index),
|
|
6578
6617
|
title: t('item.deleteTitle'),
|
|
6579
|
-
confirmText: t('yesButtonText'),
|
|
6580
|
-
cancelText: t('cancelButtonText')
|
|
6618
|
+
confirmText: t('yesButtonText') || t('common:yesButtonText'),
|
|
6619
|
+
cancelText: t('cancelButtonText') || t('common:cancelButtonText')
|
|
6581
6620
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
6582
6621
|
type: "danger",
|
|
6583
6622
|
size: "sm",
|
|
@@ -6586,16 +6625,16 @@ const ItemsAccordian = ({
|
|
|
6586
6625
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6587
6626
|
className: "khb-form-items"
|
|
6588
6627
|
}, Array.isArray(languages) && languages.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, languages.map(lang => {
|
|
6589
|
-
var _a, _b, _c, _d, _e;
|
|
6628
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6590
6629
|
return /*#__PURE__*/React.createElement(Input, {
|
|
6591
6630
|
rest: register(`${name}.${index}.titles.${lang.code}`, {
|
|
6592
6631
|
required: t('item.titleRequired')
|
|
6593
6632
|
}),
|
|
6594
6633
|
label: t('item.title') + ` (${lang.name})`,
|
|
6595
|
-
error: (
|
|
6634
|
+
error: ((_c = (_b = (_a = errors[name]) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b['titles']) === null || _c === void 0 ? void 0 : _c[lang.code]) ? ((_h = (_g = (_f = (_e = (_d = errors[name]) === null || _d === void 0 ? void 0 : _d[index]) === null || _e === void 0 ? void 0 : _e['titles']) === null || _f === void 0 ? void 0 : _f[lang.code]) === null || _g === void 0 ? void 0 : _g.message) === null || _h === void 0 ? void 0 : _h.toString()) + ` (${lang.name})` : '',
|
|
6596
6635
|
type: "text",
|
|
6597
6636
|
className: "w-full p-2",
|
|
6598
|
-
placeholder: t('item.titlePlaceholder')
|
|
6637
|
+
placeholder: t('item.titlePlaceholder') + ` (${lang.name})`,
|
|
6599
6638
|
required: true
|
|
6600
6639
|
});
|
|
6601
6640
|
})) : /*#__PURE__*/React.createElement(Input, {
|
|
@@ -6613,14 +6652,20 @@ const ItemsAccordian = ({
|
|
|
6613
6652
|
label: t('item.subtitle') + ` (${lang.name})`,
|
|
6614
6653
|
type: "text",
|
|
6615
6654
|
className: "w-full p-2",
|
|
6616
|
-
placeholder: t('item.subTitlePlaceholder')
|
|
6655
|
+
placeholder: t('item.subTitlePlaceholder') + ` (${lang.name})`
|
|
6617
6656
|
}))) : /*#__PURE__*/React.createElement(Input, {
|
|
6618
6657
|
rest: register(`${name}.${index}.subtitle`),
|
|
6619
6658
|
label: t('item.subtitle'),
|
|
6620
6659
|
type: "text",
|
|
6621
6660
|
className: "w-full p-2",
|
|
6622
6661
|
placeholder: t('item.subTitlePlaceholder')
|
|
6623
|
-
}), /*#__PURE__*/React.createElement(Input, {
|
|
6662
|
+
}), Array.isArray(languages) && languages.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, languages.map(lang => /*#__PURE__*/React.createElement(Input, {
|
|
6663
|
+
rest: register(`${name}.${index}.altTexts.${lang.code}`),
|
|
6664
|
+
label: t('item.altText') + ` (${lang.name})`,
|
|
6665
|
+
type: 'text',
|
|
6666
|
+
className: "w-full p-2",
|
|
6667
|
+
placeholder: t('item.altTextPlaceholder') + ` (${lang.name})`
|
|
6668
|
+
}))) : /*#__PURE__*/React.createElement(Input, {
|
|
6624
6669
|
rest: register(`${name}.${index}.altText`),
|
|
6625
6670
|
label: t('item.altText'),
|
|
6626
6671
|
type: 'text',
|
|
@@ -6639,45 +6684,51 @@ const ItemsAccordian = ({
|
|
|
6639
6684
|
name: `${name}.${index}.srcset`,
|
|
6640
6685
|
errors: (_f = (_e = errors[name]) === null || _e === void 0 ? void 0 : _e[index]) === null || _f === void 0 ? void 0 : _f['srcset'],
|
|
6641
6686
|
t: t
|
|
6642
|
-
}), /*#__PURE__*/React.createElement(
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6687
|
+
}), Array.isArray(languages) && languages.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, languages.map(lang => {
|
|
6688
|
+
var _a, _b, _c, _d, _e;
|
|
6689
|
+
return /*#__PURE__*/React.createElement(ImageInput, {
|
|
6690
|
+
key: lang.code,
|
|
6691
|
+
label: t('item.image') + ` (${lang.name})`,
|
|
6692
|
+
control: control,
|
|
6693
|
+
name: `${name}.${index}.imgs.${lang.code}`,
|
|
6694
|
+
error: (_e = (_d = (_c = (_b = (_a = errors[name]) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b['imgs']) === null || _c === void 0 ? void 0 : _c[lang.code]) === null || _d === void 0 ? void 0 : _d.message) === null || _e === void 0 ? void 0 : _e.toString(),
|
|
6695
|
+
baseUrl: imageBaseUrl ? imageBaseUrl : baseUrl,
|
|
6696
|
+
setError: setError,
|
|
6697
|
+
clearError: clearError,
|
|
6698
|
+
onImageRemove: onImageRemove,
|
|
6699
|
+
imageMaxSize: imageMaxSize,
|
|
6700
|
+
onImageUpload: onImageUpload,
|
|
6701
|
+
text: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
6702
|
+
className: "khb_img-text-wrapper"
|
|
6703
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
6704
|
+
className: "khb_img-text-label"
|
|
6705
|
+
}, /*#__PURE__*/React.createElement("span", null, t('item.uploadFile'))), /*#__PURE__*/React.createElement("p", {
|
|
6706
|
+
className: "khb_img-text-1"
|
|
6707
|
+
}, t('item.dragDrop'))), /*#__PURE__*/React.createElement("p", {
|
|
6708
|
+
className: "khb_img-text-2"
|
|
6709
|
+
}, t('item.allowedFormat')))
|
|
6710
|
+
});
|
|
6711
|
+
})) : /*#__PURE__*/React.createElement(ImageInput, {
|
|
6712
|
+
label: t('item.image'),
|
|
6647
6713
|
control: control,
|
|
6648
6714
|
name: `${name}.${index}.img`,
|
|
6649
|
-
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
|
|
6655
|
-
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
text: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
6667
|
-
className: "khb_img-text-wrapper"
|
|
6668
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
6669
|
-
className: "khb_img-text-label"
|
|
6670
|
-
}, /*#__PURE__*/React.createElement("span", null, t('item.uploadFile'))), /*#__PURE__*/React.createElement("p", {
|
|
6671
|
-
className: "khb_img-text-1"
|
|
6672
|
-
}, t('item.dragDrop'))), /*#__PURE__*/React.createElement("p", {
|
|
6673
|
-
className: "khb_img-text-2"
|
|
6674
|
-
}, t('item.allowedFormat'))),
|
|
6675
|
-
onImageUpload: onImageUpload,
|
|
6676
|
-
onImageRemove: onImageRemove,
|
|
6677
|
-
className: "khb_img-upload-wrapper-3"
|
|
6678
|
-
});
|
|
6679
|
-
}
|
|
6680
|
-
}))));
|
|
6715
|
+
error: (_k = (_j = (_h = (_g = errors[name]) === null || _g === void 0 ? void 0 : _g[index]) === null || _h === void 0 ? void 0 : _h['img']) === null || _j === void 0 ? void 0 : _j.message) === null || _k === void 0 ? void 0 : _k.toString(),
|
|
6716
|
+
baseUrl: imageBaseUrl ? imageBaseUrl : baseUrl,
|
|
6717
|
+
setError: setError,
|
|
6718
|
+
clearError: clearError,
|
|
6719
|
+
onImageRemove: onImageRemove,
|
|
6720
|
+
imageMaxSize: imageMaxSize,
|
|
6721
|
+
onImageUpload: onImageUpload,
|
|
6722
|
+
text: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
6723
|
+
className: "khb_img-text-wrapper"
|
|
6724
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
6725
|
+
className: "khb_img-text-label"
|
|
6726
|
+
}, /*#__PURE__*/React.createElement("span", null, t('item.uploadFile'))), /*#__PURE__*/React.createElement("p", {
|
|
6727
|
+
className: "khb_img-text-1"
|
|
6728
|
+
}, t('item.dragDrop'))), /*#__PURE__*/React.createElement("p", {
|
|
6729
|
+
className: "khb_img-text-2"
|
|
6730
|
+
}, t('item.allowedFormat')))
|
|
6731
|
+
})));
|
|
6681
6732
|
})));
|
|
6682
6733
|
};
|
|
6683
6734
|
|
|
@@ -7094,6 +7145,15 @@ const WidgetForm = ({
|
|
|
7094
7145
|
let items = [...(getValues(constants.webItems) || []), ...(getValues(constants.mobileItems) || [])];
|
|
7095
7146
|
items = items.map(_a => {
|
|
7096
7147
|
var item = __rest(_a, ["_id", "__v", "widgetId"]);
|
|
7148
|
+
if (typeof item['imgs'] === 'object' && item['imgs']) {
|
|
7149
|
+
Object.keys(item['imgs']).forEach(key => {
|
|
7150
|
+
if (item['imgs'][key] && item['imgs'][key]['_id']) {
|
|
7151
|
+
item['imgs'][key] = item['imgs'][key]['_id'];
|
|
7152
|
+
} else if (typeof item['imgs'][key] !== 'string' || !item['imgs'][key]) {
|
|
7153
|
+
delete item['imgs'][key];
|
|
7154
|
+
}
|
|
7155
|
+
});
|
|
7156
|
+
}
|
|
7097
7157
|
if (item['img'] && item['img']['_id']) {
|
|
7098
7158
|
item['img'] = item['img']['_id'];
|
|
7099
7159
|
} else if (typeof item['img'] !== 'string' || !item['img']) {
|
|
@@ -7299,8 +7359,8 @@ const WidgetForm = ({
|
|
|
7299
7359
|
control: control,
|
|
7300
7360
|
languages: languages,
|
|
7301
7361
|
deleteTitle: t('widget.tabDeleteTitle'),
|
|
7302
|
-
yesButtonText: t('yesButtonText'),
|
|
7303
|
-
noButtonText: t('cancelButtonText'),
|
|
7362
|
+
yesButtonText: t('yesButtonText') || t('common:yesButtonText'),
|
|
7363
|
+
noButtonText: t('cancelButtonText') || t('common:cancelButtonText'),
|
|
7304
7364
|
errors: errors,
|
|
7305
7365
|
itemsPlaceholder: `Select ${selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.label}...`,
|
|
7306
7366
|
loadOptions: onChangeSearch,
|
|
@@ -7334,7 +7394,7 @@ const WidgetForm = ({
|
|
|
7334
7394
|
register: register,
|
|
7335
7395
|
loading: loading,
|
|
7336
7396
|
addText: t('addButtonText'),
|
|
7337
|
-
deleteText: t('deleteButtonText')
|
|
7397
|
+
deleteText: t('deleteButtonText') || t('common:deleteButtonText')
|
|
7338
7398
|
}), /*#__PURE__*/React.createElement(ItemsAccordian, {
|
|
7339
7399
|
languages: languages,
|
|
7340
7400
|
clearError: clearErrors,
|
|
@@ -7351,7 +7411,7 @@ const WidgetForm = ({
|
|
|
7351
7411
|
control: control,
|
|
7352
7412
|
register: register,
|
|
7353
7413
|
addText: t('addButtonText'),
|
|
7354
|
-
deleteText: t('deleteButtonText')
|
|
7414
|
+
deleteText: t('deleteButtonText') || t('common:deleteButtonText')
|
|
7355
7415
|
})));
|
|
7356
7416
|
};
|
|
7357
7417
|
|
|
@@ -7363,8 +7423,8 @@ const AddButton = () => {
|
|
|
7363
7423
|
} = useWidgetState();
|
|
7364
7424
|
return /*#__PURE__*/React.createElement(Button, {
|
|
7365
7425
|
disabled: !canAdd,
|
|
7366
|
-
onClick: () => onChangeFormState(
|
|
7367
|
-
}, t(
|
|
7426
|
+
onClick: () => onChangeFormState('ADD')
|
|
7427
|
+
}, t('addButtonText') || t('common:addButtonText'));
|
|
7368
7428
|
};
|
|
7369
7429
|
|
|
7370
7430
|
const WidgetPagination = () => {
|
|
@@ -7377,11 +7437,11 @@ const WidgetPagination = () => {
|
|
|
7377
7437
|
setCurrentPage
|
|
7378
7438
|
} = useWidgetState();
|
|
7379
7439
|
return /*#__PURE__*/React.createElement(Pagination, {
|
|
7380
|
-
ofText: t('of'),
|
|
7381
|
-
pageText: t('
|
|
7382
|
-
showingText: t('showing'),
|
|
7383
|
-
nextContent: t('nextContent'),
|
|
7384
|
-
previousContent: t('previousContent'),
|
|
7440
|
+
ofText: t('of') || t('common:of'),
|
|
7441
|
+
pageText: t('confirm') || t('common:confirm'),
|
|
7442
|
+
showingText: t('showing') || t('common:showing'),
|
|
7443
|
+
nextContent: t('nextContent') || t('common:nextContent'),
|
|
7444
|
+
previousContent: t('previousContent') || t('common:previousContent'),
|
|
7385
7445
|
totalPages: totalPages,
|
|
7386
7446
|
totalRecords: totalRecords,
|
|
7387
7447
|
currentPage: currentPage,
|
|
@@ -7447,10 +7507,10 @@ const WidgetFormActions = ({
|
|
|
7447
7507
|
if (!canAdd && !canUpdate) return null;
|
|
7448
7508
|
return /*#__PURE__*/React.createElement(FormActions, {
|
|
7449
7509
|
loading: loading,
|
|
7450
|
-
primaryLabel: formState === 'ADD' ? t('createButtonText') : t('updateButtonText'),
|
|
7510
|
+
primaryLabel: formState === 'ADD' ? t('createButtonText') || t('common:createButtonText') : t('updateButtonText') || t('common:updateButtonText'),
|
|
7451
7511
|
onPrimaryButtonClick: onSubmitClick,
|
|
7452
7512
|
onSecondaryButtonClick: closeForm,
|
|
7453
|
-
secondaryLabel: t('cancelButtonText')
|
|
7513
|
+
secondaryLabel: t('cancelButtonText') || t('common:cancelButtonText')
|
|
7454
7514
|
});
|
|
7455
7515
|
};
|
|
7456
7516
|
|
|
@@ -7574,13 +7634,13 @@ const Widget = ({
|
|
|
7574
7634
|
itemData: itemData,
|
|
7575
7635
|
onClose: onCloseForm,
|
|
7576
7636
|
onConfirmDelete: onCofirmDeleteWidget,
|
|
7577
|
-
confirmationRequired: derivedT('confirmationRequired'),
|
|
7578
|
-
confirm: derivedT('confirm'),
|
|
7579
|
-
lossOfData: derivedT('lossOfData'),
|
|
7580
|
-
permanentlyDelete: derivedT('permanentlyDelete'),
|
|
7581
|
-
pleaseType: derivedT('pleaseType'),
|
|
7582
|
-
toProceedOrCancel: derivedT('toProceedOrCancel'),
|
|
7583
|
-
typeHerePlaceholder: derivedT('typeHerePlaceholder')
|
|
7637
|
+
confirmationRequired: derivedT('confirmationRequired') || derivedT('common:confirmationRequired'),
|
|
7638
|
+
confirm: derivedT('confirm') || derivedT('common:confirm'),
|
|
7639
|
+
lossOfData: derivedT('lossOfData') || derivedT('common:lossOfData'),
|
|
7640
|
+
permanentlyDelete: derivedT('permanentlyDelete') || derivedT('common:permanentlyDelete'),
|
|
7641
|
+
pleaseType: derivedT('pleaseType') || derivedT('common:pleaseType'),
|
|
7642
|
+
toProceedOrCancel: derivedT('toProceedOrCancel') || derivedT('common:toProceedOrCancel'),
|
|
7643
|
+
typeHerePlaceholder: derivedT('typeHerePlaceholder') || derivedT('common:typeHerePlaceholder')
|
|
7584
7644
|
}));
|
|
7585
7645
|
};
|
|
7586
7646
|
Widget.Table = WidgetTable;
|
package/package.json
CHANGED
|
@@ -34,14 +34,12 @@ declare const TRANSLATION_PAIRS_COMMON: {
|
|
|
34
34
|
pleaseType: string;
|
|
35
35
|
toProceedOrCancel: string;
|
|
36
36
|
confirm: string;
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
nextContent: string;
|
|
38
|
+
previousContent: string;
|
|
39
39
|
page: string;
|
|
40
40
|
next: string;
|
|
41
|
-
previous: string;
|
|
42
41
|
indicatesRequired: string;
|
|
43
42
|
addButtonText: string;
|
|
44
|
-
editButtonText: string;
|
|
45
43
|
cancelButtonText: string;
|
|
46
44
|
yesButtonText: string;
|
|
47
45
|
deleteButtonText: string;
|