@knovator/pagecreator-admin 0.9.5 → 1.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/index.cjs +359 -332
- package/index.js +359 -332
- package/package.json +1 -1
- package/src/lib/components/Page/Page/Page.d.ts +1 -1
- package/src/lib/components/Widget/Widget/Widget.d.ts +1 -1
- package/src/lib/components/common/Input/SrcSet.d.ts +2 -2
- package/src/lib/constants/common.d.ts +73 -86
- package/src/lib/context/PageContext.d.ts +1 -1
- package/src/lib/context/ProviderContext.d.ts +1 -1
- package/src/lib/context/WidgetContext.d.ts +1 -1
- package/src/lib/helper/utils.d.ts +0 -2
- package/src/lib/types/components.d.ts +68 -4
- package/src/lib/types/context.d.ts +38 -3
package/index.js
CHANGED
|
@@ -1693,108 +1693,96 @@ 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
|
-
nextContent: 'Next',
|
|
1697
|
-
previousContent: 'Previous',
|
|
1698
|
-
page: 'Page',
|
|
1699
1696
|
next: 'Next',
|
|
1697
|
+
previous: 'Previous',
|
|
1698
|
+
page: 'Page',
|
|
1700
1699
|
indicatesRequired: 'Indicates fields are required',
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
updateButtonText: 'Update',
|
|
1700
|
+
cancel: 'Cancel',
|
|
1701
|
+
yes: 'Yes',
|
|
1702
|
+
delete: 'Delete',
|
|
1703
|
+
create: 'Create',
|
|
1704
|
+
update: 'Update',
|
|
1707
1705
|
showing: 'Showing',
|
|
1706
|
+
add: 'Add',
|
|
1708
1707
|
of: 'of',
|
|
1709
|
-
typeHerePlaceholder: 'Type Here'
|
|
1708
|
+
typeHerePlaceholder: 'Type Here',
|
|
1709
|
+
code: 'Code',
|
|
1710
|
+
codePlaceholder: 'Enter code',
|
|
1711
|
+
codeRequired: 'Code is required',
|
|
1712
|
+
name: 'Name',
|
|
1713
|
+
namePlaceholder: 'Enter name',
|
|
1714
|
+
nameRequired: 'Name is required',
|
|
1715
|
+
title: 'Title',
|
|
1716
|
+
titlePlaceholder: 'Enter title',
|
|
1717
|
+
titleRequired: 'Title is required',
|
|
1718
|
+
active: 'Active',
|
|
1719
|
+
actions: 'Actions'
|
|
1710
1720
|
};
|
|
1711
1721
|
const TRANSLATION_PAIRS_WIDGET = {
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
'
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
'item.image': 'Image',
|
|
1760
|
-
'item.uploadFile': 'Upload File',
|
|
1761
|
-
'item.dragDrop': 'or drag and drop',
|
|
1762
|
-
'item.allowedFormat': 'PNG, JPG, SVG up to 2 MB',
|
|
1763
|
-
'item.srcset': 'Srcset',
|
|
1764
|
-
'item.screenSizeRequired': 'ScreenSize is required',
|
|
1765
|
-
'item.widthRequired': 'Width is required',
|
|
1766
|
-
'item.heightRequired': 'Height is required',
|
|
1767
|
-
'item.minScreenSize': 'ScreenSize should be greater than 0',
|
|
1768
|
-
'item.minWidth': 'Width should be greater than 0',
|
|
1769
|
-
'item.minHeight': 'Height should be greater than 0',
|
|
1770
|
-
'item.titleRequired': 'Title is required',
|
|
1771
|
-
'item.deleteTitle': 'Are you sure you want to delete this item?'
|
|
1722
|
+
itemsType: 'Items Type',
|
|
1723
|
+
itemsTypePlaceholder: 'Select Items Type',
|
|
1724
|
+
widgetType: 'Widget Type',
|
|
1725
|
+
widgetTypeRequired: 'Widget Type is required',
|
|
1726
|
+
color: 'Color',
|
|
1727
|
+
webPerRow: 'Web Per Row',
|
|
1728
|
+
webPerRowPlaceholder: 'Enter web per row',
|
|
1729
|
+
mobilePerRow: 'Mobile Per Row',
|
|
1730
|
+
mobilePerRowPlaceholder: 'Enter mobile per row',
|
|
1731
|
+
tabletPerRow: 'Tablet Per Row',
|
|
1732
|
+
tabletPerRowPlaceholder: 'Enter tablet per row',
|
|
1733
|
+
mobileItems: 'Mobile Items',
|
|
1734
|
+
webItems: 'Web Items',
|
|
1735
|
+
searchPlaceholder: 'Search Widgets...',
|
|
1736
|
+
autoPlay: 'Auto Play',
|
|
1737
|
+
addWidgetTitle: 'Add Widget',
|
|
1738
|
+
updateWidgetTitle: 'Update Widget',
|
|
1739
|
+
webPerRowRequired: 'Web Per Row is required',
|
|
1740
|
+
tabletPerRowRequired: 'Tablet Per Row is required',
|
|
1741
|
+
mobilePerRowRequired: 'Mobile Per Row is required',
|
|
1742
|
+
tabDeleteTitle: 'Are you sure you want to delete this tab?',
|
|
1743
|
+
widgetTitleInfo: 'HTML is supported',
|
|
1744
|
+
minPerRow: 'Value must be greater than zero',
|
|
1745
|
+
// actionsLabel': 'Actions', -> 'actions'
|
|
1746
|
+
tabNameRequired: 'Tab Name is required',
|
|
1747
|
+
subtitle: 'Subtitle',
|
|
1748
|
+
subTitlePlaceholder: 'Enter Subtitle',
|
|
1749
|
+
altText: 'Alt Text',
|
|
1750
|
+
altTextPlaceholder: 'Enter alt text',
|
|
1751
|
+
link: 'Link',
|
|
1752
|
+
linkPlaceholder: 'Enter link',
|
|
1753
|
+
image: 'Image',
|
|
1754
|
+
uploadFile: 'Upload File',
|
|
1755
|
+
dragDrop: 'or drag and drop',
|
|
1756
|
+
allowedFormat: 'PNG, JPG, SVG up to 2 MB',
|
|
1757
|
+
srcset: 'Srcset',
|
|
1758
|
+
screenSizeRequired: 'ScreenSize is required',
|
|
1759
|
+
widthRequired: 'Width is required',
|
|
1760
|
+
heightRequired: 'Height is required',
|
|
1761
|
+
minScreenSize: 'ScreenSize should be greater than 0',
|
|
1762
|
+
minWidth: 'Width should be greater than 0',
|
|
1763
|
+
minHeight: 'Height should be greater than 0',
|
|
1764
|
+
deleteTitle: 'Are you sure you want to delete this item?',
|
|
1765
|
+
textContent: 'Text',
|
|
1766
|
+
textContentRequired: 'Text is required',
|
|
1767
|
+
textContentInfo: 'HTML is supported',
|
|
1768
|
+
textContentPlaceholder: 'Enter text'
|
|
1772
1769
|
};
|
|
1773
1770
|
const TRANSLATION_PAIRS_PAGE = {
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
'page.addPageTitle': 'Add Page',
|
|
1784
|
-
'page.updatePageTitle': 'Update Page',
|
|
1785
|
-
'page.searchPages': 'Search Pages...',
|
|
1786
|
-
'page.tableName': 'Name',
|
|
1787
|
-
'page.tableCode': 'Code',
|
|
1788
|
-
'page.widgets': 'Widgets',
|
|
1789
|
-
'page.actionsLabel': 'Actions'
|
|
1790
|
-
};
|
|
1791
|
-
|
|
1792
|
-
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
1771
|
+
widgets: 'Widgets',
|
|
1772
|
+
slug: 'Slug',
|
|
1773
|
+
slugPlaceholder: 'Enter Slug',
|
|
1774
|
+
slugRequired: 'Slug is required',
|
|
1775
|
+
addPage: 'Add Page',
|
|
1776
|
+
updatePage: 'Update Page',
|
|
1777
|
+
searchPages: 'Search Pages...'
|
|
1778
|
+
};
|
|
1779
|
+
|
|
1793
1780
|
const ProviderContext = /*#__PURE__*/createContext(null);
|
|
1794
1781
|
const Provider = ({
|
|
1795
1782
|
children,
|
|
1796
1783
|
baseUrl,
|
|
1797
1784
|
token,
|
|
1785
|
+
translations,
|
|
1798
1786
|
onError: _onError = () => {},
|
|
1799
1787
|
onSuccess: _onSuccess = () => {},
|
|
1800
1788
|
onLogout: _onLogout = () => {},
|
|
@@ -1811,7 +1799,8 @@ const Provider = ({
|
|
|
1811
1799
|
onLogout: _onLogout,
|
|
1812
1800
|
switchClass: _switchClass,
|
|
1813
1801
|
widgetRoutesPrefix: _widgetRoutesPrefix,
|
|
1814
|
-
pageRoutesPrefix: _pageRoutesPrefix
|
|
1802
|
+
pageRoutesPrefix: _pageRoutesPrefix,
|
|
1803
|
+
commonTranslations: Object.assign(Object.assign({}, TRANSLATION_PAIRS_COMMON), translations || {})
|
|
1815
1804
|
}
|
|
1816
1805
|
}, children);
|
|
1817
1806
|
};
|
|
@@ -2533,12 +2522,6 @@ const isEmpty = data => {
|
|
|
2533
2522
|
if ([undefined, null, ''].includes(data)) return true;
|
|
2534
2523
|
return false;
|
|
2535
2524
|
};
|
|
2536
|
-
function createTranslation(t, obj) {
|
|
2537
|
-
return function (key) {
|
|
2538
|
-
if (typeof t === 'function') return t(key);
|
|
2539
|
-
return obj[key] || '';
|
|
2540
|
-
};
|
|
2541
|
-
}
|
|
2542
2525
|
const build_path = (...args) => {
|
|
2543
2526
|
return args.map((part, i) => {
|
|
2544
2527
|
if (i === 0) {
|
|
@@ -3015,8 +2998,6 @@ const usePage = ({
|
|
|
3015
2998
|
|
|
3016
2999
|
const PageContext = /*#__PURE__*/createContext(null);
|
|
3017
3000
|
const PageContextProvider = ({
|
|
3018
|
-
t: _t = key => Object.assign({}, TRANSLATION_PAIRS_COMMON)[key],
|
|
3019
|
-
// Form
|
|
3020
3001
|
searchText: _searchText = '',
|
|
3021
3002
|
changeSearch: _changeSearch = () => {},
|
|
3022
3003
|
list: _list = [],
|
|
@@ -3047,12 +3028,12 @@ const PageContextProvider = ({
|
|
|
3047
3028
|
data: _data = [],
|
|
3048
3029
|
canDelete: _canDelete = false,
|
|
3049
3030
|
loader: _loader = undefined,
|
|
3031
|
+
pageTranslations,
|
|
3050
3032
|
// other
|
|
3051
3033
|
children
|
|
3052
3034
|
}) => {
|
|
3053
3035
|
return /*#__PURE__*/React.createElement(PageContext.Provider, {
|
|
3054
3036
|
value: {
|
|
3055
|
-
t: _t,
|
|
3056
3037
|
// Form
|
|
3057
3038
|
list: _list,
|
|
3058
3039
|
searchText: _searchText,
|
|
@@ -3083,7 +3064,8 @@ const PageContextProvider = ({
|
|
|
3083
3064
|
columns: _columns,
|
|
3084
3065
|
data: _data,
|
|
3085
3066
|
canDelete: _canDelete,
|
|
3086
|
-
loader: _loader
|
|
3067
|
+
loader: _loader,
|
|
3068
|
+
pageTranslations: Object.assign(Object.assign({}, TRANSLATION_PAIRS_PAGE), pageTranslations || {})
|
|
3087
3069
|
}
|
|
3088
3070
|
}, children);
|
|
3089
3071
|
};
|
|
@@ -3204,10 +3186,12 @@ const PageTable = ({
|
|
|
3204
3186
|
extraActions,
|
|
3205
3187
|
extraColumns
|
|
3206
3188
|
}) => {
|
|
3189
|
+
const {
|
|
3190
|
+
commonTranslations
|
|
3191
|
+
} = useProviderState();
|
|
3207
3192
|
const {
|
|
3208
3193
|
list,
|
|
3209
3194
|
onChangeFormState,
|
|
3210
|
-
t,
|
|
3211
3195
|
loading,
|
|
3212
3196
|
loader,
|
|
3213
3197
|
canUpdate,
|
|
@@ -3220,14 +3204,14 @@ const PageTable = ({
|
|
|
3220
3204
|
loader: loader,
|
|
3221
3205
|
loading: loading,
|
|
3222
3206
|
dataKeys: [{
|
|
3223
|
-
label:
|
|
3207
|
+
label: commonTranslations.name,
|
|
3224
3208
|
dataKey: 'name',
|
|
3225
3209
|
highlight: true
|
|
3226
3210
|
}, {
|
|
3227
|
-
label:
|
|
3211
|
+
label: commonTranslations.code,
|
|
3228
3212
|
dataKey: 'code'
|
|
3229
3213
|
}],
|
|
3230
|
-
actionsLabel:
|
|
3214
|
+
actionsLabel: commonTranslations.actions,
|
|
3231
3215
|
actions: {
|
|
3232
3216
|
edit: canUpdate ? onUpdateClick : undefined,
|
|
3233
3217
|
delete: canDelete ? onDeleteClick : undefined
|
|
@@ -3489,7 +3473,12 @@ const SrcSet = ({
|
|
|
3489
3473
|
errors,
|
|
3490
3474
|
name,
|
|
3491
3475
|
disabled: _disabled2 = false,
|
|
3492
|
-
|
|
3476
|
+
screenSizeRequired,
|
|
3477
|
+
heightRequired,
|
|
3478
|
+
minHeight,
|
|
3479
|
+
minScreenSize,
|
|
3480
|
+
minWidth,
|
|
3481
|
+
widthRequired
|
|
3493
3482
|
}) => {
|
|
3494
3483
|
const {
|
|
3495
3484
|
fields,
|
|
@@ -3519,8 +3508,8 @@ const SrcSet = ({
|
|
|
3519
3508
|
size: _size,
|
|
3520
3509
|
placeholder: "Screen Size",
|
|
3521
3510
|
rest: register(`${name}.${index}.screenSize`, {
|
|
3522
|
-
required:
|
|
3523
|
-
validate: value => Number(value) <= 0 ?
|
|
3511
|
+
required: screenSizeRequired,
|
|
3512
|
+
validate: value => Number(value) <= 0 ? minScreenSize : true
|
|
3524
3513
|
}),
|
|
3525
3514
|
disabled: _disabled2
|
|
3526
3515
|
}), /*#__PURE__*/React.createElement("span", {
|
|
@@ -3529,8 +3518,8 @@ const SrcSet = ({
|
|
|
3529
3518
|
error: (_f = (_e = (_d = errors === null || errors === void 0 ? void 0 : errors[index]) === null || _d === void 0 ? void 0 : _d['width']) === null || _e === void 0 ? void 0 : _e.message) === null || _f === void 0 ? void 0 : _f.toString(),
|
|
3530
3519
|
index: index,
|
|
3531
3520
|
rest: register(`${name}.${index}.width`, {
|
|
3532
|
-
required:
|
|
3533
|
-
validate: value => Number(value) <= 0 ?
|
|
3521
|
+
required: widthRequired,
|
|
3522
|
+
validate: value => Number(value) <= 0 ? minWidth : true
|
|
3534
3523
|
}),
|
|
3535
3524
|
className: className,
|
|
3536
3525
|
size: _size,
|
|
@@ -3542,8 +3531,8 @@ const SrcSet = ({
|
|
|
3542
3531
|
error: (_j = (_h = (_g = errors === null || errors === void 0 ? void 0 : errors[index]) === null || _g === void 0 ? void 0 : _g['height']) === null || _h === void 0 ? void 0 : _h.message) === null || _j === void 0 ? void 0 : _j.toString(),
|
|
3543
3532
|
index: index,
|
|
3544
3533
|
rest: register(`${name}.${index}.height`, {
|
|
3545
|
-
required:
|
|
3546
|
-
validate: value => Number(value) <= 0 ?
|
|
3534
|
+
required: heightRequired,
|
|
3535
|
+
validate: value => Number(value) <= 0 ? minHeight : true
|
|
3547
3536
|
}),
|
|
3548
3537
|
className: className,
|
|
3549
3538
|
size: _size,
|
|
@@ -3580,7 +3569,7 @@ var Input = Object.assign(Input$1, {
|
|
|
3580
3569
|
|
|
3581
3570
|
const PageSearch = () => {
|
|
3582
3571
|
const {
|
|
3583
|
-
|
|
3572
|
+
pageTranslations,
|
|
3584
3573
|
canList,
|
|
3585
3574
|
changeSearch,
|
|
3586
3575
|
setCurrentPage
|
|
@@ -3600,7 +3589,7 @@ const PageSearch = () => {
|
|
|
3600
3589
|
value: search,
|
|
3601
3590
|
disabled: !canList,
|
|
3602
3591
|
onChange: e => onChangeSearch(e.target.value),
|
|
3603
|
-
placeholder:
|
|
3592
|
+
placeholder: pageTranslations.searchPages
|
|
3604
3593
|
});
|
|
3605
3594
|
};
|
|
3606
3595
|
|
|
@@ -3918,7 +3907,9 @@ const PageForm = ({
|
|
|
3918
3907
|
formRef
|
|
3919
3908
|
}) => {
|
|
3920
3909
|
const {
|
|
3921
|
-
|
|
3910
|
+
commonTranslations
|
|
3911
|
+
} = useProviderState();
|
|
3912
|
+
const {
|
|
3922
3913
|
data,
|
|
3923
3914
|
formState,
|
|
3924
3915
|
onPageFormSubmit,
|
|
@@ -3928,7 +3919,8 @@ const PageForm = ({
|
|
|
3928
3919
|
getWidgets,
|
|
3929
3920
|
onChangeWidgetSequence,
|
|
3930
3921
|
canAdd,
|
|
3931
|
-
canUpdate
|
|
3922
|
+
canUpdate,
|
|
3923
|
+
pageTranslations
|
|
3932
3924
|
} = usePageState();
|
|
3933
3925
|
const {
|
|
3934
3926
|
register,
|
|
@@ -3999,39 +3991,39 @@ const PageForm = ({
|
|
|
3999
3991
|
};
|
|
4000
3992
|
// Schemas
|
|
4001
3993
|
const pageFormSchema = [{
|
|
4002
|
-
label:
|
|
3994
|
+
label: commonTranslations.name,
|
|
4003
3995
|
required: true,
|
|
4004
3996
|
accessor: 'name',
|
|
4005
3997
|
type: 'text',
|
|
4006
|
-
placeholder:
|
|
3998
|
+
placeholder: commonTranslations.namePlaceholder,
|
|
4007
3999
|
onInput: handleCapitalize,
|
|
4008
4000
|
validations: {
|
|
4009
|
-
required:
|
|
4001
|
+
required: commonTranslations.nameRequired
|
|
4010
4002
|
}
|
|
4011
4003
|
}, {
|
|
4012
|
-
label:
|
|
4004
|
+
label: commonTranslations.code,
|
|
4013
4005
|
accessor: 'code',
|
|
4014
4006
|
required: true,
|
|
4015
4007
|
type: 'text',
|
|
4016
4008
|
onInput: handleCode,
|
|
4017
4009
|
editable: false,
|
|
4018
|
-
placeholder:
|
|
4010
|
+
placeholder: commonTranslations.codePlaceholder,
|
|
4019
4011
|
validations: {
|
|
4020
|
-
required:
|
|
4012
|
+
required: commonTranslations.codeRequired
|
|
4021
4013
|
}
|
|
4022
4014
|
}, {
|
|
4023
|
-
label:
|
|
4015
|
+
label: pageTranslations.slug,
|
|
4024
4016
|
accessor: 'slug',
|
|
4025
4017
|
required: true,
|
|
4026
4018
|
type: 'text',
|
|
4027
4019
|
onInput: handleSlug,
|
|
4028
4020
|
editable: false,
|
|
4029
|
-
placeholder:
|
|
4021
|
+
placeholder: pageTranslations.slugPlaceholder,
|
|
4030
4022
|
validations: {
|
|
4031
|
-
required:
|
|
4023
|
+
required: pageTranslations.slugRequired
|
|
4032
4024
|
}
|
|
4033
4025
|
}, {
|
|
4034
|
-
label:
|
|
4026
|
+
label: pageTranslations.widgets,
|
|
4035
4027
|
accessor: 'widgets',
|
|
4036
4028
|
type: 'ReactSelect',
|
|
4037
4029
|
options: widgets,
|
|
@@ -4086,15 +4078,17 @@ const Button = ({
|
|
|
4086
4078
|
};
|
|
4087
4079
|
|
|
4088
4080
|
const AddButton$1 = () => {
|
|
4081
|
+
const {
|
|
4082
|
+
commonTranslations
|
|
4083
|
+
} = useProviderState();
|
|
4089
4084
|
const {
|
|
4090
4085
|
onChangeFormState,
|
|
4091
|
-
t,
|
|
4092
4086
|
canAdd
|
|
4093
4087
|
} = usePageState();
|
|
4094
4088
|
return /*#__PURE__*/React.createElement(Button, {
|
|
4095
4089
|
disabled: !canAdd,
|
|
4096
4090
|
onClick: () => onChangeFormState('ADD')
|
|
4097
|
-
},
|
|
4091
|
+
}, commonTranslations.add);
|
|
4098
4092
|
};
|
|
4099
4093
|
|
|
4100
4094
|
const ChevronLeft = ({
|
|
@@ -4198,7 +4192,9 @@ const Pagination = ({
|
|
|
4198
4192
|
|
|
4199
4193
|
const PagePagination = () => {
|
|
4200
4194
|
const {
|
|
4201
|
-
|
|
4195
|
+
commonTranslations
|
|
4196
|
+
} = useProviderState();
|
|
4197
|
+
const {
|
|
4202
4198
|
totalPages,
|
|
4203
4199
|
totalRecords,
|
|
4204
4200
|
currentPage,
|
|
@@ -4206,11 +4202,11 @@ const PagePagination = () => {
|
|
|
4206
4202
|
setCurrentPage
|
|
4207
4203
|
} = usePageState();
|
|
4208
4204
|
return /*#__PURE__*/React.createElement(Pagination, {
|
|
4209
|
-
ofText:
|
|
4210
|
-
pageText:
|
|
4211
|
-
showingText:
|
|
4212
|
-
nextContent:
|
|
4213
|
-
previousContent:
|
|
4205
|
+
ofText: commonTranslations.of,
|
|
4206
|
+
pageText: commonTranslations.confirm,
|
|
4207
|
+
showingText: commonTranslations.showing,
|
|
4208
|
+
nextContent: commonTranslations.next,
|
|
4209
|
+
previousContent: commonTranslations.previous,
|
|
4214
4210
|
totalPages: totalPages,
|
|
4215
4211
|
totalRecords: totalRecords,
|
|
4216
4212
|
currentPage: currentPage,
|
|
@@ -4219,6 +4215,65 @@ const PagePagination = () => {
|
|
|
4219
4215
|
});
|
|
4220
4216
|
};
|
|
4221
4217
|
|
|
4218
|
+
const Drawer = ({
|
|
4219
|
+
children,
|
|
4220
|
+
open,
|
|
4221
|
+
onClose,
|
|
4222
|
+
title,
|
|
4223
|
+
footerContent
|
|
4224
|
+
}) => {
|
|
4225
|
+
const nodeRef = useRef(null);
|
|
4226
|
+
return /*#__PURE__*/React.createElement(CSSTransition, {
|
|
4227
|
+
ref: nodeRef,
|
|
4228
|
+
in: open,
|
|
4229
|
+
timeout: {
|
|
4230
|
+
enter: 250,
|
|
4231
|
+
exit: 350
|
|
4232
|
+
},
|
|
4233
|
+
classNames: "khb_drawer",
|
|
4234
|
+
mountOnEnter: true,
|
|
4235
|
+
unmountOnExit: true
|
|
4236
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4237
|
+
className: "khb_drawer-wrapper-1",
|
|
4238
|
+
"aria-labelledby": "modal",
|
|
4239
|
+
role: "dialog",
|
|
4240
|
+
"aria-modal": "true",
|
|
4241
|
+
ref: nodeRef,
|
|
4242
|
+
"data-testid": "drawer"
|
|
4243
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4244
|
+
className: "khb_drawer-wrapper-2"
|
|
4245
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4246
|
+
className: "khb_drawer-backdrop",
|
|
4247
|
+
role: "button",
|
|
4248
|
+
onClick: onClose,
|
|
4249
|
+
onKeyDown: onClose,
|
|
4250
|
+
tabIndex: 0
|
|
4251
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
4252
|
+
className: "khb_drawer-container-1"
|
|
4253
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4254
|
+
className: "khb_drawer-container-2"
|
|
4255
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4256
|
+
className: "khb_drawer-close-section"
|
|
4257
|
+
}, /*#__PURE__*/React.createElement("button", {
|
|
4258
|
+
type: "button",
|
|
4259
|
+
className: "khb_drawer-close-btn",
|
|
4260
|
+
onClick: onClose,
|
|
4261
|
+
"data-testid": "drawer-close"
|
|
4262
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
4263
|
+
className: "khb_sr-only"
|
|
4264
|
+
}, "Close panel"), /*#__PURE__*/React.createElement(Close, null))), /*#__PURE__*/React.createElement("div", {
|
|
4265
|
+
className: "khb_drawer-main"
|
|
4266
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4267
|
+
className: "khb_drawer-header"
|
|
4268
|
+
}, /*#__PURE__*/React.createElement("p", {
|
|
4269
|
+
className: "khb_drawer-header-title"
|
|
4270
|
+
}, title)), /*#__PURE__*/React.createElement("div", {
|
|
4271
|
+
className: "khb_darwer-content"
|
|
4272
|
+
}, children), footerContent && /*#__PURE__*/React.createElement("div", {
|
|
4273
|
+
className: "khb_drawer-footer"
|
|
4274
|
+
}, footerContent)))))));
|
|
4275
|
+
};
|
|
4276
|
+
|
|
4222
4277
|
const Modal = ({
|
|
4223
4278
|
open,
|
|
4224
4279
|
onClose,
|
|
@@ -4315,65 +4370,6 @@ const DeleteModal = ({
|
|
|
4315
4370
|
}, confirm || TRANSLATION_PAIRS_COMMON.confirm)))) : null;
|
|
4316
4371
|
};
|
|
4317
4372
|
|
|
4318
|
-
const Drawer = ({
|
|
4319
|
-
children,
|
|
4320
|
-
open,
|
|
4321
|
-
onClose,
|
|
4322
|
-
title,
|
|
4323
|
-
footerContent
|
|
4324
|
-
}) => {
|
|
4325
|
-
const nodeRef = useRef(null);
|
|
4326
|
-
return /*#__PURE__*/React.createElement(CSSTransition, {
|
|
4327
|
-
ref: nodeRef,
|
|
4328
|
-
in: open,
|
|
4329
|
-
timeout: {
|
|
4330
|
-
enter: 250,
|
|
4331
|
-
exit: 350
|
|
4332
|
-
},
|
|
4333
|
-
classNames: "khb_drawer",
|
|
4334
|
-
mountOnEnter: true,
|
|
4335
|
-
unmountOnExit: true
|
|
4336
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4337
|
-
className: "khb_drawer-wrapper-1",
|
|
4338
|
-
"aria-labelledby": "modal",
|
|
4339
|
-
role: "dialog",
|
|
4340
|
-
"aria-modal": "true",
|
|
4341
|
-
ref: nodeRef,
|
|
4342
|
-
"data-testid": "drawer"
|
|
4343
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4344
|
-
className: "khb_drawer-wrapper-2"
|
|
4345
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4346
|
-
className: "khb_drawer-backdrop",
|
|
4347
|
-
role: "button",
|
|
4348
|
-
onClick: onClose,
|
|
4349
|
-
onKeyDown: onClose,
|
|
4350
|
-
tabIndex: 0
|
|
4351
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
4352
|
-
className: "khb_drawer-container-1"
|
|
4353
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4354
|
-
className: "khb_drawer-container-2"
|
|
4355
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4356
|
-
className: "khb_drawer-close-section"
|
|
4357
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
4358
|
-
type: "button",
|
|
4359
|
-
className: "khb_drawer-close-btn",
|
|
4360
|
-
onClick: onClose,
|
|
4361
|
-
"data-testid": "drawer-close"
|
|
4362
|
-
}, /*#__PURE__*/React.createElement("span", {
|
|
4363
|
-
className: "khb_sr-only"
|
|
4364
|
-
}, "Close panel"), /*#__PURE__*/React.createElement(Close, null))), /*#__PURE__*/React.createElement("div", {
|
|
4365
|
-
className: "khb_drawer-main"
|
|
4366
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4367
|
-
className: "khb_drawer-header"
|
|
4368
|
-
}, /*#__PURE__*/React.createElement("p", {
|
|
4369
|
-
className: "khb_drawer-header-title"
|
|
4370
|
-
}, title)), /*#__PURE__*/React.createElement("div", {
|
|
4371
|
-
className: "khb_darwer-content"
|
|
4372
|
-
}, children), footerContent && /*#__PURE__*/React.createElement("div", {
|
|
4373
|
-
className: "khb_drawer-footer"
|
|
4374
|
-
}, footerContent)))))));
|
|
4375
|
-
};
|
|
4376
|
-
|
|
4377
4373
|
const FormActions = ({
|
|
4378
4374
|
loading: _loading = false,
|
|
4379
4375
|
primaryLabel: _primaryLabel = 'Submit',
|
|
@@ -4395,14 +4391,14 @@ const PageFormActions = ({
|
|
|
4395
4391
|
formRef
|
|
4396
4392
|
}) => {
|
|
4397
4393
|
const {
|
|
4398
|
-
onError
|
|
4394
|
+
onError,
|
|
4395
|
+
commonTranslations
|
|
4399
4396
|
} = useProviderState();
|
|
4400
4397
|
const {
|
|
4401
4398
|
closeForm,
|
|
4402
4399
|
loading,
|
|
4403
4400
|
canAdd,
|
|
4404
4401
|
canUpdate,
|
|
4405
|
-
t,
|
|
4406
4402
|
formState
|
|
4407
4403
|
} = usePageState();
|
|
4408
4404
|
const onSubmitClick = e => {
|
|
@@ -4422,10 +4418,10 @@ const PageFormActions = ({
|
|
|
4422
4418
|
if (!canAdd && !canUpdate) return null;
|
|
4423
4419
|
return /*#__PURE__*/React.createElement(FormActions, {
|
|
4424
4420
|
loading: loading,
|
|
4425
|
-
primaryLabel: formState === 'ADD' ?
|
|
4421
|
+
primaryLabel: formState === 'ADD' ? commonTranslations.create : commonTranslations.update,
|
|
4426
4422
|
onPrimaryButtonClick: onSubmitClick,
|
|
4427
4423
|
onSecondaryButtonClick: closeForm,
|
|
4428
|
-
secondaryLabel:
|
|
4424
|
+
secondaryLabel: commonTranslations.cancel
|
|
4429
4425
|
});
|
|
4430
4426
|
};
|
|
4431
4427
|
|
|
@@ -4444,8 +4440,8 @@ const PageFormWrapper = ({
|
|
|
4444
4440
|
};
|
|
4445
4441
|
|
|
4446
4442
|
const Page = ({
|
|
4447
|
-
t,
|
|
4448
4443
|
loader,
|
|
4444
|
+
translations,
|
|
4449
4445
|
explicitForm: _explicitForm = false,
|
|
4450
4446
|
children,
|
|
4451
4447
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -4453,9 +4449,12 @@ const Page = ({
|
|
|
4453
4449
|
permissions: _permissions = {},
|
|
4454
4450
|
preConfirmDelete
|
|
4455
4451
|
}) => {
|
|
4452
|
+
const {
|
|
4453
|
+
commonTranslations
|
|
4454
|
+
} = useProviderState();
|
|
4456
4455
|
const derivedPermissions = Object.assign(DEFAULT_PERMISSIONS, _permissions);
|
|
4457
4456
|
const formRef = useRef(null);
|
|
4458
|
-
const
|
|
4457
|
+
const combinedTranslations = Object.assign(Object.assign({}, TRANSLATION_PAIRS_PAGE), translations);
|
|
4459
4458
|
const {
|
|
4460
4459
|
list,
|
|
4461
4460
|
widgets,
|
|
@@ -4484,7 +4483,6 @@ const Page = ({
|
|
|
4484
4483
|
canList: derivedPermissions.list
|
|
4485
4484
|
});
|
|
4486
4485
|
return /*#__PURE__*/React.createElement(PageContextProvider, {
|
|
4487
|
-
t: derivedT,
|
|
4488
4486
|
loader: loader,
|
|
4489
4487
|
list: list,
|
|
4490
4488
|
searchText: searchText,
|
|
@@ -4510,13 +4508,14 @@ const Page = ({
|
|
|
4510
4508
|
canAdd: derivedPermissions.add,
|
|
4511
4509
|
canDelete: derivedPermissions.delete,
|
|
4512
4510
|
canUpdate: derivedPermissions.update,
|
|
4513
|
-
canList: derivedPermissions.list
|
|
4511
|
+
canList: derivedPermissions.list,
|
|
4512
|
+
pageTranslations: translations
|
|
4514
4513
|
}, children ? children : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AddButton$1, null), /*#__PURE__*/React.createElement(PageSearch, null), /*#__PURE__*/React.createElement("div", {
|
|
4515
4514
|
className: "khb_table-wrapper"
|
|
4516
4515
|
}, /*#__PURE__*/React.createElement(PageTable, null), /*#__PURE__*/React.createElement(PagePagination, null))), !_explicitForm && /*#__PURE__*/React.createElement(Drawer, {
|
|
4517
4516
|
open: formState === 'ADD' || formState === 'UPDATE',
|
|
4518
4517
|
onClose: onCloseForm,
|
|
4519
|
-
title: formState === 'ADD' ?
|
|
4518
|
+
title: formState === 'ADD' ? combinedTranslations.addPage : formState === 'UPDATE' ? combinedTranslations.updatePage : '',
|
|
4520
4519
|
footerContent: /*#__PURE__*/React.createElement(PageFormActions, {
|
|
4521
4520
|
formRef: formRef
|
|
4522
4521
|
})
|
|
@@ -4527,13 +4526,13 @@ const Page = ({
|
|
|
4527
4526
|
itemData: itemData,
|
|
4528
4527
|
onClose: onCloseForm,
|
|
4529
4528
|
onConfirmDelete: onCofirmDeletePage,
|
|
4530
|
-
confirmationRequired:
|
|
4531
|
-
confirm:
|
|
4532
|
-
lossOfData:
|
|
4533
|
-
permanentlyDelete:
|
|
4534
|
-
pleaseType:
|
|
4535
|
-
toProceedOrCancel:
|
|
4536
|
-
typeHerePlaceholder:
|
|
4529
|
+
confirmationRequired: commonTranslations.confirmationRequired,
|
|
4530
|
+
confirm: commonTranslations.confirm,
|
|
4531
|
+
lossOfData: commonTranslations.lossOfData,
|
|
4532
|
+
permanentlyDelete: commonTranslations.permanentlyDelete,
|
|
4533
|
+
pleaseType: commonTranslations.pleaseType,
|
|
4534
|
+
toProceedOrCancel: commonTranslations.toProceedOrCancel,
|
|
4535
|
+
typeHerePlaceholder: commonTranslations.typeHerePlaceholder
|
|
4537
4536
|
}));
|
|
4538
4537
|
};
|
|
4539
4538
|
Page.Table = PageTable;
|
|
@@ -6045,7 +6044,6 @@ $$1({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
|
|
|
6045
6044
|
|
|
6046
6045
|
const WidgetContext = /*#__PURE__*/createContext(null);
|
|
6047
6046
|
const WidgetContextProvider = ({
|
|
6048
|
-
t: _t = () => '',
|
|
6049
6047
|
// Form
|
|
6050
6048
|
list: _list = [],
|
|
6051
6049
|
languages: _languages = [],
|
|
@@ -6089,12 +6087,12 @@ const WidgetContextProvider = ({
|
|
|
6089
6087
|
onPartialUpdateWidget: _onPartialUpdateWidget = () => Promise.resolve(),
|
|
6090
6088
|
reactSelectStyles: _reactSelectStyles = {},
|
|
6091
6089
|
imageMaxSize: _imageMaxSize = 10485760,
|
|
6090
|
+
widgetTranslations,
|
|
6092
6091
|
// other
|
|
6093
6092
|
children
|
|
6094
6093
|
}) => {
|
|
6095
6094
|
return /*#__PURE__*/React.createElement(WidgetContext.Provider, {
|
|
6096
6095
|
value: {
|
|
6097
|
-
t: _t,
|
|
6098
6096
|
// Form
|
|
6099
6097
|
list: _list,
|
|
6100
6098
|
languages: _languages,
|
|
@@ -6137,7 +6135,8 @@ const WidgetContextProvider = ({
|
|
|
6137
6135
|
data: _data,
|
|
6138
6136
|
canDelete: _canDelete,
|
|
6139
6137
|
loader: _loader,
|
|
6140
|
-
imageMaxSize: _imageMaxSize
|
|
6138
|
+
imageMaxSize: _imageMaxSize,
|
|
6139
|
+
widgetTranslations: Object.assign(Object.assign({}, TRANSLATION_PAIRS_WIDGET), widgetTranslations || {})
|
|
6141
6140
|
}
|
|
6142
6141
|
}, children);
|
|
6143
6142
|
};
|
|
@@ -6171,6 +6170,7 @@ const WidgetTable = ({
|
|
|
6171
6170
|
extraColumns
|
|
6172
6171
|
}) => {
|
|
6173
6172
|
const {
|
|
6173
|
+
commonTranslations,
|
|
6174
6174
|
switchClass
|
|
6175
6175
|
} = useProviderState();
|
|
6176
6176
|
const {
|
|
@@ -6181,8 +6181,7 @@ const WidgetTable = ({
|
|
|
6181
6181
|
onChangeFormState,
|
|
6182
6182
|
onPartialUpdateWidget,
|
|
6183
6183
|
loading,
|
|
6184
|
-
loader
|
|
6185
|
-
t
|
|
6184
|
+
loader
|
|
6186
6185
|
} = useWidgetState();
|
|
6187
6186
|
const updateClosure = useCallback((item, key, value) => {
|
|
6188
6187
|
onPartialUpdateWidget({
|
|
@@ -6192,15 +6191,15 @@ const WidgetTable = ({
|
|
|
6192
6191
|
const onUpdateClick = item => onChangeFormState('UPDATE', item);
|
|
6193
6192
|
const onDeleteClick = item => onChangeFormState('DELETE', item);
|
|
6194
6193
|
const dataKeys = [{
|
|
6195
|
-
label:
|
|
6194
|
+
label: commonTranslations.name,
|
|
6196
6195
|
dataKey: 'name',
|
|
6197
6196
|
highlight: true
|
|
6198
6197
|
}, {
|
|
6199
|
-
label:
|
|
6198
|
+
label: commonTranslations.code,
|
|
6200
6199
|
dataKey: 'code'
|
|
6201
6200
|
}];
|
|
6202
6201
|
if (canPartialUpdate) dataKeys.push({
|
|
6203
|
-
label:
|
|
6202
|
+
label: commonTranslations.active,
|
|
6204
6203
|
dataKey: 'isActive',
|
|
6205
6204
|
Cell: ({
|
|
6206
6205
|
row
|
|
@@ -6215,7 +6214,7 @@ const WidgetTable = ({
|
|
|
6215
6214
|
loader: loader,
|
|
6216
6215
|
loading: loading,
|
|
6217
6216
|
dataKeys: dataKeys,
|
|
6218
|
-
actionsLabel:
|
|
6217
|
+
actionsLabel: commonTranslations.actions,
|
|
6219
6218
|
extraColumns: extraColumns,
|
|
6220
6219
|
extraActions: extraActions,
|
|
6221
6220
|
actions: {
|
|
@@ -6546,14 +6545,15 @@ const ItemsAccordian = ({
|
|
|
6546
6545
|
deleteText: _deleteText = 'Delete'
|
|
6547
6546
|
}) => {
|
|
6548
6547
|
const {
|
|
6549
|
-
baseUrl
|
|
6548
|
+
baseUrl,
|
|
6549
|
+
commonTranslations
|
|
6550
6550
|
} = useProviderState();
|
|
6551
6551
|
const {
|
|
6552
6552
|
onImageUpload,
|
|
6553
6553
|
onImageRemove,
|
|
6554
|
-
t,
|
|
6555
6554
|
imageBaseUrl,
|
|
6556
|
-
imageMaxSize
|
|
6555
|
+
imageMaxSize,
|
|
6556
|
+
widgetTranslations
|
|
6557
6557
|
} = useWidgetState();
|
|
6558
6558
|
const [itemsShow, setItemsShow] = useState([]);
|
|
6559
6559
|
const {
|
|
@@ -6614,9 +6614,9 @@ const ItemsAccordian = ({
|
|
|
6614
6614
|
id: `${id}-item-${index}`,
|
|
6615
6615
|
footerContent: /*#__PURE__*/React.createElement(ConfirmPopOver, {
|
|
6616
6616
|
onConfirm: () => removeItem(index),
|
|
6617
|
-
title:
|
|
6618
|
-
confirmText:
|
|
6619
|
-
cancelText:
|
|
6617
|
+
title: widgetTranslations.deleteTitle,
|
|
6618
|
+
confirmText: commonTranslations.yes,
|
|
6619
|
+
cancelText: commonTranslations.cancel
|
|
6620
6620
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
6621
6621
|
type: "danger",
|
|
6622
6622
|
size: "sm",
|
|
@@ -6628,67 +6628,72 @@ const ItemsAccordian = ({
|
|
|
6628
6628
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6629
6629
|
return /*#__PURE__*/React.createElement(Input, {
|
|
6630
6630
|
rest: register(`${name}.${index}.titles.${lang.code}`, {
|
|
6631
|
-
required:
|
|
6631
|
+
required: commonTranslations.titleRequired
|
|
6632
6632
|
}),
|
|
6633
|
-
label:
|
|
6633
|
+
label: commonTranslations.title + ` (${lang.name})`,
|
|
6634
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})` : '',
|
|
6635
6635
|
type: "text",
|
|
6636
6636
|
className: "w-full p-2",
|
|
6637
|
-
placeholder:
|
|
6637
|
+
placeholder: commonTranslations.titlePlaceholder + ` (${lang.name})`,
|
|
6638
6638
|
required: true
|
|
6639
6639
|
});
|
|
6640
6640
|
})) : /*#__PURE__*/React.createElement(Input, {
|
|
6641
6641
|
rest: register(`${name}.${index}.title`, {
|
|
6642
|
-
required:
|
|
6642
|
+
required: commonTranslations.titleRequired
|
|
6643
6643
|
}),
|
|
6644
|
-
label:
|
|
6644
|
+
label: commonTranslations.title,
|
|
6645
6645
|
error: (_d = (_c = (_b = (_a = errors[name]) === null || _a === void 0 ? void 0 : _a[index]) === null || _b === void 0 ? void 0 : _b['title']) === null || _c === void 0 ? void 0 : _c.message) === null || _d === void 0 ? void 0 : _d.toString(),
|
|
6646
6646
|
type: "text",
|
|
6647
6647
|
className: "w-full p-2",
|
|
6648
|
-
placeholder:
|
|
6648
|
+
placeholder: commonTranslations.titlePlaceholder,
|
|
6649
6649
|
required: true
|
|
6650
6650
|
}), Array.isArray(languages) && languages.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, languages.map(lang => /*#__PURE__*/React.createElement(Input, {
|
|
6651
6651
|
rest: register(`${name}.${index}.subtitles.${lang.code}`),
|
|
6652
|
-
label:
|
|
6652
|
+
label: widgetTranslations.subtitle + ` (${lang.name})`,
|
|
6653
6653
|
type: "text",
|
|
6654
6654
|
className: "w-full p-2",
|
|
6655
|
-
placeholder:
|
|
6655
|
+
placeholder: widgetTranslations.subTitlePlaceholder + ` (${lang.name})`
|
|
6656
6656
|
}))) : /*#__PURE__*/React.createElement(Input, {
|
|
6657
6657
|
rest: register(`${name}.${index}.subtitle`),
|
|
6658
|
-
label:
|
|
6658
|
+
label: widgetTranslations.subtitle,
|
|
6659
6659
|
type: "text",
|
|
6660
6660
|
className: "w-full p-2",
|
|
6661
|
-
placeholder:
|
|
6661
|
+
placeholder: widgetTranslations.subTitlePlaceholder
|
|
6662
6662
|
}), Array.isArray(languages) && languages.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, languages.map(lang => /*#__PURE__*/React.createElement(Input, {
|
|
6663
6663
|
rest: register(`${name}.${index}.altTexts.${lang.code}`),
|
|
6664
|
-
label:
|
|
6665
|
-
type:
|
|
6664
|
+
label: widgetTranslations.altText + ` (${lang.name})`,
|
|
6665
|
+
type: "text",
|
|
6666
6666
|
className: "w-full p-2",
|
|
6667
|
-
placeholder:
|
|
6667
|
+
placeholder: widgetTranslations.altTextPlaceholder + ` (${lang.name})`
|
|
6668
6668
|
}))) : /*#__PURE__*/React.createElement(Input, {
|
|
6669
6669
|
rest: register(`${name}.${index}.altText`),
|
|
6670
|
-
label:
|
|
6671
|
-
type:
|
|
6670
|
+
label: widgetTranslations.altText,
|
|
6671
|
+
type: "text",
|
|
6672
6672
|
className: "w-full p-2",
|
|
6673
|
-
placeholder:
|
|
6673
|
+
placeholder: widgetTranslations.altTextPlaceholder
|
|
6674
6674
|
}), /*#__PURE__*/React.createElement(Input, {
|
|
6675
6675
|
rest: register(`${name}.${index}.link`),
|
|
6676
|
-
label:
|
|
6677
|
-
type:
|
|
6676
|
+
label: widgetTranslations.link,
|
|
6677
|
+
type: "url",
|
|
6678
6678
|
className: "w-full p-2",
|
|
6679
|
-
placeholder:
|
|
6679
|
+
placeholder: widgetTranslations.linkPlaceholder
|
|
6680
6680
|
}), /*#__PURE__*/React.createElement(Input.SrcSet, {
|
|
6681
6681
|
control: control,
|
|
6682
6682
|
register: register,
|
|
6683
|
-
label:
|
|
6683
|
+
label: widgetTranslations.srcset,
|
|
6684
6684
|
name: `${name}.${index}.srcset`,
|
|
6685
6685
|
errors: (_f = (_e = errors[name]) === null || _e === void 0 ? void 0 : _e[index]) === null || _f === void 0 ? void 0 : _f['srcset'],
|
|
6686
|
-
|
|
6686
|
+
screenSizeRequired: widgetTranslations.screenSizeRequired,
|
|
6687
|
+
heightRequired: widgetTranslations.heightRequired,
|
|
6688
|
+
minHeight: widgetTranslations.minHeight,
|
|
6689
|
+
minScreenSize: widgetTranslations.minScreenSize,
|
|
6690
|
+
minWidth: widgetTranslations.minWidth,
|
|
6691
|
+
widthRequired: widgetTranslations.widthRequired
|
|
6687
6692
|
}), Array.isArray(languages) && languages.length > 0 ? /*#__PURE__*/React.createElement(React.Fragment, null, languages.map(lang => {
|
|
6688
6693
|
var _a, _b, _c, _d, _e;
|
|
6689
6694
|
return /*#__PURE__*/React.createElement(ImageInput, {
|
|
6690
6695
|
key: lang.code,
|
|
6691
|
-
label:
|
|
6696
|
+
label: widgetTranslations.image + ` (${lang.name})`,
|
|
6692
6697
|
control: control,
|
|
6693
6698
|
name: `${name}.${index}.imgs.${lang.code}`,
|
|
6694
6699
|
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(),
|
|
@@ -6702,14 +6707,14 @@ const ItemsAccordian = ({
|
|
|
6702
6707
|
className: "khb_img-text-wrapper"
|
|
6703
6708
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6704
6709
|
className: "khb_img-text-label"
|
|
6705
|
-
}, /*#__PURE__*/React.createElement("span", null,
|
|
6710
|
+
}, /*#__PURE__*/React.createElement("span", null, widgetTranslations.uploadFile)), /*#__PURE__*/React.createElement("p", {
|
|
6706
6711
|
className: "khb_img-text-1"
|
|
6707
|
-
},
|
|
6712
|
+
}, widgetTranslations.dragDrop)), /*#__PURE__*/React.createElement("p", {
|
|
6708
6713
|
className: "khb_img-text-2"
|
|
6709
|
-
},
|
|
6714
|
+
}, widgetTranslations.allowedFormat))
|
|
6710
6715
|
});
|
|
6711
6716
|
})) : /*#__PURE__*/React.createElement(ImageInput, {
|
|
6712
|
-
label:
|
|
6717
|
+
label: widgetTranslations.image,
|
|
6713
6718
|
control: control,
|
|
6714
6719
|
name: `${name}.${index}.img`,
|
|
6715
6720
|
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(),
|
|
@@ -6723,11 +6728,11 @@ const ItemsAccordian = ({
|
|
|
6723
6728
|
className: "khb_img-text-wrapper"
|
|
6724
6729
|
}, /*#__PURE__*/React.createElement("div", {
|
|
6725
6730
|
className: "khb_img-text-label"
|
|
6726
|
-
}, /*#__PURE__*/React.createElement("span", null,
|
|
6731
|
+
}, /*#__PURE__*/React.createElement("span", null, widgetTranslations.uploadFile)), /*#__PURE__*/React.createElement("p", {
|
|
6727
6732
|
className: "khb_img-text-1"
|
|
6728
|
-
},
|
|
6733
|
+
}, widgetTranslations.dragDrop)), /*#__PURE__*/React.createElement("p", {
|
|
6729
6734
|
className: "khb_img-text-2"
|
|
6730
|
-
},
|
|
6735
|
+
}, widgetTranslations.allowedFormat))
|
|
6731
6736
|
})));
|
|
6732
6737
|
})));
|
|
6733
6738
|
};
|
|
@@ -6938,10 +6943,10 @@ const WidgetForm = ({
|
|
|
6938
6943
|
shouldUnregister: false
|
|
6939
6944
|
});
|
|
6940
6945
|
const {
|
|
6941
|
-
switchClass
|
|
6946
|
+
switchClass,
|
|
6947
|
+
commonTranslations
|
|
6942
6948
|
} = useProviderState();
|
|
6943
6949
|
const {
|
|
6944
|
-
t,
|
|
6945
6950
|
data,
|
|
6946
6951
|
canAdd,
|
|
6947
6952
|
canUpdate,
|
|
@@ -6950,6 +6955,7 @@ const WidgetForm = ({
|
|
|
6950
6955
|
widgetTypes,
|
|
6951
6956
|
loading,
|
|
6952
6957
|
languages,
|
|
6958
|
+
widgetTranslations,
|
|
6953
6959
|
onWidgetFormSubmit,
|
|
6954
6960
|
getCollectionData,
|
|
6955
6961
|
collectionData,
|
|
@@ -7094,7 +7100,7 @@ const WidgetForm = ({
|
|
|
7094
7100
|
if (!tabItem.names[lang.code]) {
|
|
7095
7101
|
setError(`tabs.${index}.names.${lang.code}`, {
|
|
7096
7102
|
type: 'manual',
|
|
7097
|
-
message: `${
|
|
7103
|
+
message: `${widgetTranslations.tabNameRequired} (${lang.name})`
|
|
7098
7104
|
});
|
|
7099
7105
|
isTabsValid = false;
|
|
7100
7106
|
}
|
|
@@ -7102,7 +7108,7 @@ const WidgetForm = ({
|
|
|
7102
7108
|
} else if (!tabItem.name) {
|
|
7103
7109
|
setError(`tabs.${index}.name`, {
|
|
7104
7110
|
type: 'manual',
|
|
7105
|
-
message:
|
|
7111
|
+
message: widgetTranslations.tabNameRequired
|
|
7106
7112
|
});
|
|
7107
7113
|
isTabsValid = false;
|
|
7108
7114
|
}
|
|
@@ -7146,15 +7152,13 @@ const WidgetForm = ({
|
|
|
7146
7152
|
items = items.map(_a => {
|
|
7147
7153
|
var item = __rest(_a, ["_id", "__v", "widgetId"]);
|
|
7148
7154
|
if (typeof item['imgs'] === 'object' && item['imgs']) {
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
obj[lng.code] = item['imgs'][lng.code];
|
|
7155
|
+
Object.keys(item['imgs']).forEach(key => {
|
|
7156
|
+
if (item['imgs'][key] && item['imgs'][key]['_id']) {
|
|
7157
|
+
item['imgs'][key] = item['imgs'][key]['_id'];
|
|
7158
|
+
} else if (typeof item['imgs'][key] !== 'string' || !item['imgs'][key]) {
|
|
7159
|
+
delete item['imgs'][key];
|
|
7155
7160
|
}
|
|
7156
7161
|
});
|
|
7157
|
-
item['imgs'] = obj;
|
|
7158
7162
|
}
|
|
7159
7163
|
if (item['img'] && item['img']['_id']) {
|
|
7160
7164
|
item['img'] = item['img']['_id'];
|
|
@@ -7202,123 +7206,139 @@ const WidgetForm = ({
|
|
|
7202
7206
|
}, [watch, onWidgetFormInputChange]);
|
|
7203
7207
|
// Schemas
|
|
7204
7208
|
const widgetFormSchema = [{
|
|
7205
|
-
label:
|
|
7209
|
+
label: commonTranslations.name,
|
|
7206
7210
|
required: true,
|
|
7207
7211
|
accessor: 'name',
|
|
7208
7212
|
type: 'text',
|
|
7209
|
-
placeholder:
|
|
7213
|
+
placeholder: commonTranslations.namePlaceholder,
|
|
7210
7214
|
onInput: handleCapitalize,
|
|
7211
7215
|
validations: {
|
|
7212
|
-
required:
|
|
7216
|
+
required: commonTranslations.nameRequired
|
|
7213
7217
|
},
|
|
7214
7218
|
wrapperClassName: 'khb_grid-item-1of2 khb_padding-right-1 khb_align-top'
|
|
7215
7219
|
}, {
|
|
7216
|
-
label:
|
|
7220
|
+
label: commonTranslations.code,
|
|
7217
7221
|
accessor: 'code',
|
|
7218
7222
|
required: true,
|
|
7219
7223
|
type: 'text',
|
|
7220
7224
|
onInput: handleCode,
|
|
7221
7225
|
editable: false,
|
|
7222
|
-
placeholder:
|
|
7226
|
+
placeholder: commonTranslations.codePlaceholder,
|
|
7223
7227
|
validations: {
|
|
7224
|
-
required:
|
|
7228
|
+
required: commonTranslations.codeRequired
|
|
7225
7229
|
},
|
|
7226
7230
|
wrapperClassName: 'khb_grid-item-1of2 khb_padding-left-1 khb_align-top khb_margin-top-0'
|
|
7227
7231
|
}, Array.isArray(languages) && languages.length > 0 ? {
|
|
7228
|
-
label:
|
|
7232
|
+
label: commonTranslations.title,
|
|
7229
7233
|
accessor: 'widgetTitles',
|
|
7230
7234
|
required: true,
|
|
7231
7235
|
type: customInputs && customInputs['widgetTitles'] ? undefined : 'text',
|
|
7232
7236
|
validations: {
|
|
7233
|
-
required:
|
|
7237
|
+
required: commonTranslations.titleRequired
|
|
7234
7238
|
},
|
|
7235
|
-
info:
|
|
7236
|
-
placeholder:
|
|
7239
|
+
info: widgetTranslations.widgetTitleInfo,
|
|
7240
|
+
placeholder: commonTranslations.titlePlaceholder,
|
|
7237
7241
|
onInput: handleCapitalize,
|
|
7238
7242
|
Input: customInputs && customInputs['widgetTitles'] ? customInputs['widgetTitles'] : undefined
|
|
7239
7243
|
} : {
|
|
7240
|
-
label:
|
|
7244
|
+
label: commonTranslations.title,
|
|
7241
7245
|
accessor: 'widgetTitle',
|
|
7242
7246
|
required: true,
|
|
7243
7247
|
type: customInputs && customInputs['widgetTitle'] ? undefined : 'text',
|
|
7244
7248
|
onInput: handleCapitalize,
|
|
7245
|
-
placeholder:
|
|
7249
|
+
placeholder: commonTranslations.titlePlaceholder,
|
|
7246
7250
|
validations: {
|
|
7247
|
-
required:
|
|
7251
|
+
required: commonTranslations.titleRequired
|
|
7248
7252
|
},
|
|
7249
|
-
info:
|
|
7253
|
+
info: widgetTranslations.widgetTitleInfo,
|
|
7250
7254
|
Input: customInputs && customInputs['widgetTitle'] ? customInputs['widgetTitle'] : undefined
|
|
7251
7255
|
}, {
|
|
7252
|
-
label:
|
|
7256
|
+
label: widgetTranslations.widgetType,
|
|
7253
7257
|
required: true,
|
|
7254
7258
|
editable: false,
|
|
7255
7259
|
accessor: 'widgetType',
|
|
7256
7260
|
type: 'select',
|
|
7257
7261
|
validations: {
|
|
7258
|
-
required:
|
|
7262
|
+
required: widgetTranslations.widgetTypeRequired
|
|
7259
7263
|
},
|
|
7260
7264
|
options: widgetTypes
|
|
7261
7265
|
}, {
|
|
7262
|
-
label:
|
|
7266
|
+
label: widgetTranslations.autoPlay,
|
|
7263
7267
|
accessor: 'autoPlay',
|
|
7264
7268
|
type: 'checkbox',
|
|
7265
7269
|
show: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === 'Carousel',
|
|
7266
7270
|
switchClass: switchClass
|
|
7267
7271
|
}, {
|
|
7268
|
-
label:
|
|
7272
|
+
label: widgetTranslations.textContent,
|
|
7273
|
+
accessor: 'textContent',
|
|
7274
|
+
required: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === 'Text',
|
|
7275
|
+
type: customInputs && customInputs['textContent'] ? undefined : 'text',
|
|
7276
|
+
placeholder: widgetTranslations.textContentPlaceholder,
|
|
7277
|
+
validations: {
|
|
7278
|
+
required: widgetTranslations.textContentRequired
|
|
7279
|
+
},
|
|
7280
|
+
info: widgetTranslations.textContentInfo,
|
|
7281
|
+
show: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === 'Text',
|
|
7282
|
+
Input: customInputs && customInputs['textContent'] ? customInputs['textContent'] : undefined
|
|
7283
|
+
}, {
|
|
7284
|
+
label: widgetTranslations.itemsType,
|
|
7269
7285
|
required: true,
|
|
7270
7286
|
editable: false,
|
|
7287
|
+
show: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== 'Text',
|
|
7271
7288
|
accessor: 'itemsType',
|
|
7272
7289
|
type: 'select',
|
|
7273
7290
|
validations: {
|
|
7274
|
-
required:
|
|
7291
|
+
required: widgetTranslations.itemsTypePlaceholder
|
|
7275
7292
|
},
|
|
7276
7293
|
options: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) === 'Tabs' || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.collectionsOnly) ? itemsTypes.filter(item => item.label !== 'Image') : (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.imageOnly) ? itemsTypes.filter(item => item.label === 'Image') : itemsTypes
|
|
7277
7294
|
}, {
|
|
7278
|
-
label:
|
|
7295
|
+
label: widgetTranslations.color,
|
|
7279
7296
|
accessor: 'backgroundColor',
|
|
7280
7297
|
type: 'color',
|
|
7281
7298
|
className: 'khb_input-color'
|
|
7282
7299
|
}, {
|
|
7283
|
-
label:
|
|
7300
|
+
label: widgetTranslations.webPerRow,
|
|
7284
7301
|
accessor: 'webPerRow',
|
|
7285
7302
|
type: 'number',
|
|
7303
|
+
show: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== 'Text',
|
|
7286
7304
|
required: true,
|
|
7287
|
-
placeholder:
|
|
7305
|
+
placeholder: widgetTranslations.webPerRowPlaceholder,
|
|
7288
7306
|
wrapperClassName: 'khb_grid-item-1of3 khb_padding-right-1',
|
|
7289
7307
|
validations: {
|
|
7290
|
-
required:
|
|
7308
|
+
required: widgetTranslations.webPerRowRequired,
|
|
7291
7309
|
min: {
|
|
7292
7310
|
value: 1,
|
|
7293
|
-
message:
|
|
7311
|
+
message: widgetTranslations.minPerRow
|
|
7294
7312
|
}
|
|
7295
7313
|
}
|
|
7296
7314
|
}, {
|
|
7297
|
-
label:
|
|
7315
|
+
label: widgetTranslations.tabletPerRow,
|
|
7298
7316
|
accessor: 'tabletPerRow',
|
|
7299
7317
|
type: 'number',
|
|
7318
|
+
show: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== 'Text',
|
|
7300
7319
|
required: true,
|
|
7301
|
-
placeholder:
|
|
7320
|
+
placeholder: widgetTranslations.tabletPerRowPlaceholder,
|
|
7302
7321
|
wrapperClassName: 'khb_grid-item-1of3 khb_padding-left-1',
|
|
7303
7322
|
validations: {
|
|
7304
|
-
required:
|
|
7323
|
+
required: widgetTranslations.tabletPerRowRequired,
|
|
7305
7324
|
min: {
|
|
7306
7325
|
value: 1,
|
|
7307
|
-
message:
|
|
7326
|
+
message: widgetTranslations.minPerRow
|
|
7308
7327
|
}
|
|
7309
7328
|
}
|
|
7310
7329
|
}, {
|
|
7311
|
-
label:
|
|
7330
|
+
label: widgetTranslations.mobilePerRow,
|
|
7312
7331
|
accessor: 'mobilePerRow',
|
|
7313
7332
|
type: 'number',
|
|
7333
|
+
show: (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== 'Text',
|
|
7314
7334
|
required: true,
|
|
7315
|
-
placeholder:
|
|
7335
|
+
placeholder: widgetTranslations.mobilePerRowPlaceholder,
|
|
7316
7336
|
wrapperClassName: 'khb_grid-item-1of3 khb_padding-right-1 khb_padding-left-1',
|
|
7317
7337
|
validations: {
|
|
7318
|
-
required:
|
|
7338
|
+
required: widgetTranslations.mobilePerRowRequired,
|
|
7319
7339
|
min: {
|
|
7320
7340
|
value: 1,
|
|
7321
|
-
message:
|
|
7341
|
+
message: widgetTranslations.minPerRow
|
|
7322
7342
|
}
|
|
7323
7343
|
}
|
|
7324
7344
|
}, {
|
|
@@ -7333,7 +7353,7 @@ const WidgetForm = ({
|
|
|
7333
7353
|
onChange: setSelectedCollectionItems,
|
|
7334
7354
|
loadOptions: onChangeSearch,
|
|
7335
7355
|
isLoading: collectionDataLoading,
|
|
7336
|
-
show: !itemsEnabled && (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== 'Tabs',
|
|
7356
|
+
show: !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== 'Tabs' || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== 'Text'),
|
|
7337
7357
|
formatOptionLabel: formatOptionLabel,
|
|
7338
7358
|
listCode: selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value,
|
|
7339
7359
|
customStyles: reactSelectStyles || {},
|
|
@@ -7360,9 +7380,9 @@ const WidgetForm = ({
|
|
|
7360
7380
|
setValue: setValue,
|
|
7361
7381
|
control: control,
|
|
7362
7382
|
languages: languages,
|
|
7363
|
-
deleteTitle:
|
|
7364
|
-
yesButtonText:
|
|
7365
|
-
noButtonText:
|
|
7383
|
+
deleteTitle: widgetTranslations.tabDeleteTitle,
|
|
7384
|
+
yesButtonText: commonTranslations.yes,
|
|
7385
|
+
noButtonText: commonTranslations.cancel,
|
|
7366
7386
|
errors: errors,
|
|
7367
7387
|
itemsPlaceholder: `Select ${selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.label}...`,
|
|
7368
7388
|
loadOptions: onChangeSearch,
|
|
@@ -7380,11 +7400,11 @@ const WidgetForm = ({
|
|
|
7380
7400
|
onDragEnd: onCollectionIndexChange,
|
|
7381
7401
|
formatItem: formatListItem,
|
|
7382
7402
|
listCode: selectedCollectionType === null || selectedCollectionType === void 0 ? void 0 : selectedCollectionType.value
|
|
7383
|
-
}), itemsEnabled && (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== 'Tabs' && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ItemsAccordian, {
|
|
7403
|
+
}), !itemsEnabled && ((selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== 'Tabs' || (selectedWidgetType === null || selectedWidgetType === void 0 ? void 0 : selectedWidgetType.value) !== 'Text') && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ItemsAccordian, {
|
|
7384
7404
|
languages: languages,
|
|
7385
7405
|
clearError: clearErrors,
|
|
7386
7406
|
collapseId: constants.webItems,
|
|
7387
|
-
title:
|
|
7407
|
+
title: widgetTranslations.webItems,
|
|
7388
7408
|
id: constants.webItems,
|
|
7389
7409
|
setError: setError,
|
|
7390
7410
|
show: webItemsVisible || !!(errors && (errors === null || errors === void 0 ? void 0 : errors[constants.webItems])),
|
|
@@ -7395,13 +7415,13 @@ const WidgetForm = ({
|
|
|
7395
7415
|
control: control,
|
|
7396
7416
|
register: register,
|
|
7397
7417
|
loading: loading,
|
|
7398
|
-
addText:
|
|
7399
|
-
deleteText:
|
|
7418
|
+
addText: commonTranslations.add,
|
|
7419
|
+
deleteText: commonTranslations.delete
|
|
7400
7420
|
}), /*#__PURE__*/React.createElement(ItemsAccordian, {
|
|
7401
7421
|
languages: languages,
|
|
7402
7422
|
clearError: clearErrors,
|
|
7403
7423
|
collapseId: constants.mobileItems,
|
|
7404
|
-
title:
|
|
7424
|
+
title: widgetTranslations.mobileItems,
|
|
7405
7425
|
id: constants.mobileItems,
|
|
7406
7426
|
name: constants.mobileItems,
|
|
7407
7427
|
setError: setError,
|
|
@@ -7412,26 +7432,30 @@ const WidgetForm = ({
|
|
|
7412
7432
|
errors: errors,
|
|
7413
7433
|
control: control,
|
|
7414
7434
|
register: register,
|
|
7415
|
-
addText:
|
|
7416
|
-
deleteText:
|
|
7435
|
+
addText: commonTranslations.add,
|
|
7436
|
+
deleteText: commonTranslations.delete
|
|
7417
7437
|
})));
|
|
7418
7438
|
};
|
|
7419
7439
|
|
|
7420
7440
|
const AddButton = () => {
|
|
7441
|
+
const {
|
|
7442
|
+
commonTranslations
|
|
7443
|
+
} = useProviderState();
|
|
7421
7444
|
const {
|
|
7422
7445
|
onChangeFormState,
|
|
7423
|
-
t,
|
|
7424
7446
|
canAdd
|
|
7425
7447
|
} = useWidgetState();
|
|
7426
7448
|
return /*#__PURE__*/React.createElement(Button, {
|
|
7427
7449
|
disabled: !canAdd,
|
|
7428
7450
|
onClick: () => onChangeFormState('ADD')
|
|
7429
|
-
},
|
|
7451
|
+
}, commonTranslations.add);
|
|
7430
7452
|
};
|
|
7431
7453
|
|
|
7432
7454
|
const WidgetPagination = () => {
|
|
7433
7455
|
const {
|
|
7434
|
-
|
|
7456
|
+
commonTranslations
|
|
7457
|
+
} = useProviderState();
|
|
7458
|
+
const {
|
|
7435
7459
|
totalPages,
|
|
7436
7460
|
totalRecords,
|
|
7437
7461
|
currentPage,
|
|
@@ -7439,11 +7463,11 @@ const WidgetPagination = () => {
|
|
|
7439
7463
|
setCurrentPage
|
|
7440
7464
|
} = useWidgetState();
|
|
7441
7465
|
return /*#__PURE__*/React.createElement(Pagination, {
|
|
7442
|
-
ofText:
|
|
7443
|
-
pageText:
|
|
7444
|
-
showingText:
|
|
7445
|
-
nextContent:
|
|
7446
|
-
previousContent:
|
|
7466
|
+
ofText: commonTranslations.of,
|
|
7467
|
+
pageText: commonTranslations.page,
|
|
7468
|
+
showingText: commonTranslations.showing,
|
|
7469
|
+
nextContent: commonTranslations.next,
|
|
7470
|
+
previousContent: commonTranslations.previous,
|
|
7447
7471
|
totalPages: totalPages,
|
|
7448
7472
|
totalRecords: totalRecords,
|
|
7449
7473
|
currentPage: currentPage,
|
|
@@ -7455,7 +7479,7 @@ const WidgetPagination = () => {
|
|
|
7455
7479
|
const WidgetSearch = () => {
|
|
7456
7480
|
const {
|
|
7457
7481
|
changeSearch,
|
|
7458
|
-
|
|
7482
|
+
widgetTranslations,
|
|
7459
7483
|
canList,
|
|
7460
7484
|
setCurrentPage
|
|
7461
7485
|
} = useWidgetState();
|
|
@@ -7474,7 +7498,7 @@ const WidgetSearch = () => {
|
|
|
7474
7498
|
value: searchVal,
|
|
7475
7499
|
disabled: !canList,
|
|
7476
7500
|
onChange: e => onChangeSearch(e.target.value),
|
|
7477
|
-
placeholder:
|
|
7501
|
+
placeholder: widgetTranslations.searchPlaceholder
|
|
7478
7502
|
});
|
|
7479
7503
|
};
|
|
7480
7504
|
|
|
@@ -7482,14 +7506,14 @@ const WidgetFormActions = ({
|
|
|
7482
7506
|
formRef
|
|
7483
7507
|
}) => {
|
|
7484
7508
|
const {
|
|
7485
|
-
onError
|
|
7509
|
+
onError,
|
|
7510
|
+
commonTranslations
|
|
7486
7511
|
} = useProviderState();
|
|
7487
7512
|
const {
|
|
7488
7513
|
closeForm,
|
|
7489
7514
|
loading,
|
|
7490
7515
|
canAdd,
|
|
7491
7516
|
canUpdate,
|
|
7492
|
-
t,
|
|
7493
7517
|
formState
|
|
7494
7518
|
} = useWidgetState();
|
|
7495
7519
|
const onSubmitClick = e => {
|
|
@@ -7509,10 +7533,10 @@ const WidgetFormActions = ({
|
|
|
7509
7533
|
if (!canAdd && !canUpdate) return null;
|
|
7510
7534
|
return /*#__PURE__*/React.createElement(FormActions, {
|
|
7511
7535
|
loading: loading,
|
|
7512
|
-
primaryLabel: formState === 'ADD' ?
|
|
7536
|
+
primaryLabel: formState === 'ADD' ? commonTranslations.create : commonTranslations.update,
|
|
7513
7537
|
onPrimaryButtonClick: onSubmitClick,
|
|
7514
7538
|
onSecondaryButtonClick: closeForm,
|
|
7515
|
-
secondaryLabel:
|
|
7539
|
+
secondaryLabel: commonTranslations.cancel
|
|
7516
7540
|
});
|
|
7517
7541
|
};
|
|
7518
7542
|
|
|
@@ -7531,7 +7555,6 @@ const WiddgetFormWrapper = ({
|
|
|
7531
7555
|
};
|
|
7532
7556
|
|
|
7533
7557
|
const Widget = ({
|
|
7534
|
-
t,
|
|
7535
7558
|
routes,
|
|
7536
7559
|
loader,
|
|
7537
7560
|
explicitForm: _explicitForm = false,
|
|
@@ -7543,11 +7566,15 @@ const Widget = ({
|
|
|
7543
7566
|
formatListItem,
|
|
7544
7567
|
formatOptionLabel,
|
|
7545
7568
|
imageMaxSize,
|
|
7569
|
+
translations,
|
|
7546
7570
|
children
|
|
7547
7571
|
}) => {
|
|
7572
|
+
const {
|
|
7573
|
+
commonTranslations
|
|
7574
|
+
} = useProviderState();
|
|
7548
7575
|
const derivedPermissions = Object.assign(DEFAULT_PERMISSIONS, _permissions);
|
|
7549
7576
|
const widgetFormRef = useRef(null);
|
|
7550
|
-
const derivedT =
|
|
7577
|
+
const derivedT = Object.assign(Object.assign({}, TRANSLATION_PAIRS_WIDGET), translations || {});
|
|
7551
7578
|
const {
|
|
7552
7579
|
list,
|
|
7553
7580
|
loading,
|
|
@@ -7588,7 +7615,6 @@ const Widget = ({
|
|
|
7588
7615
|
languages: languages,
|
|
7589
7616
|
imageBaseUrl: imageBaseUrl,
|
|
7590
7617
|
onChangeFormState: onChangeFormState,
|
|
7591
|
-
t: derivedT,
|
|
7592
7618
|
searchText: searchText,
|
|
7593
7619
|
changeSearch: changeSearch,
|
|
7594
7620
|
loader: loader,
|
|
@@ -7619,13 +7645,14 @@ const Widget = ({
|
|
|
7619
7645
|
canPartialUpdate: derivedPermissions.partialUpdate,
|
|
7620
7646
|
formState: formState,
|
|
7621
7647
|
closeForm: onCloseForm,
|
|
7622
|
-
imageMaxSize: imageMaxSize
|
|
7648
|
+
imageMaxSize: imageMaxSize,
|
|
7649
|
+
widgetTranslations: translations
|
|
7623
7650
|
}, children ? children : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(AddButton, null), /*#__PURE__*/React.createElement(WidgetSearch, null), /*#__PURE__*/React.createElement("div", {
|
|
7624
7651
|
className: "khb_table-wrapper"
|
|
7625
7652
|
}, /*#__PURE__*/React.createElement(WidgetTable, null), /*#__PURE__*/React.createElement(WidgetPagination, null))), !_explicitForm && /*#__PURE__*/React.createElement(Drawer, {
|
|
7626
7653
|
open: formState === 'ADD' || formState === 'UPDATE',
|
|
7627
7654
|
onClose: onCloseForm,
|
|
7628
|
-
title: formState === 'ADD' ? derivedT
|
|
7655
|
+
title: formState === 'ADD' ? derivedT.addWidgetTitle : formState === 'UPDATE' ? derivedT.updateWidgetTitle : '',
|
|
7629
7656
|
footerContent: /*#__PURE__*/React.createElement(WidgetFormActions, {
|
|
7630
7657
|
formRef: widgetFormRef
|
|
7631
7658
|
})
|
|
@@ -7636,13 +7663,13 @@ const Widget = ({
|
|
|
7636
7663
|
itemData: itemData,
|
|
7637
7664
|
onClose: onCloseForm,
|
|
7638
7665
|
onConfirmDelete: onCofirmDeleteWidget,
|
|
7639
|
-
confirmationRequired:
|
|
7640
|
-
confirm:
|
|
7641
|
-
lossOfData:
|
|
7642
|
-
permanentlyDelete:
|
|
7643
|
-
pleaseType:
|
|
7644
|
-
toProceedOrCancel:
|
|
7645
|
-
typeHerePlaceholder:
|
|
7666
|
+
confirmationRequired: commonTranslations.confirmationRequired,
|
|
7667
|
+
confirm: commonTranslations.confirm,
|
|
7668
|
+
lossOfData: commonTranslations.lossOfData,
|
|
7669
|
+
permanentlyDelete: commonTranslations.permanentlyDelete,
|
|
7670
|
+
pleaseType: commonTranslations.pleaseType,
|
|
7671
|
+
toProceedOrCancel: commonTranslations.toProceedOrCancel,
|
|
7672
|
+
typeHerePlaceholder: commonTranslations.typeHerePlaceholder
|
|
7646
7673
|
}));
|
|
7647
7674
|
};
|
|
7648
7675
|
Widget.Table = WidgetTable;
|