@licklist/design 0.69.4 → 0.69.5
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/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts +2 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +3 -2
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts +2 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.js +31 -28
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts +2 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.d.ts.map +1 -1
- package/dist/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.js +14 -3
- package/dist/index.js +1 -0
- package/dist/modals/confirmation/ConfirmModal.d.ts +3 -1
- package/dist/modals/confirmation/ConfirmModal.d.ts.map +1 -1
- package/dist/modals/confirmation/ConfirmModal.js +172 -8
- package/dist/product-set/card/ProductSetCard.d.ts +6 -2
- package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
- package/dist/product-set/card/ProductSetCard.js +20 -11
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +8 -0
- package/dist/product-set/form/ProductSetNameControl.d.ts +6 -0
- package/dist/product-set/form/ProductSetNameControl.d.ts.map +1 -0
- package/dist/product-set/form/ProductSetNameControl.js +35 -0
- package/dist/product-set/form/index.d.ts +1 -0
- package/dist/product-set/form/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.d.ts +7 -0
- package/dist/product-set/utils/index.d.ts.map +1 -1
- package/dist/product-set/utils/index.js +10 -1
- package/dist/typeahead/Typeahead.d.ts +5 -1
- package/dist/typeahead/Typeahead.d.ts.map +1 -1
- package/dist/typeahead/Typeahead.js +9 -2
- package/package.json +4 -4
- package/src/events/edit-event-modal/component/EditEventForm/EditEventForm.tsx +3 -0
- package/src/events/edit-event-modal/component/SelectEventProductSet/SelectEventProductSet.tsx +86 -85
- package/src/events/edit-event-modal/component/SelectEventProductSet/component/EditEventProductSet.tsx +11 -1
- package/src/modals/confirmation/ConfirmModal.tsx +19 -3
- package/src/product-set/card/ProductSetCard.tsx +32 -6
- package/src/product-set/form/ProductSetForm.tsx +10 -0
- package/src/product-set/form/ProductSetNameControl.tsx +27 -0
- package/src/product-set/form/index.ts +1 -0
- package/src/product-set/utils/index.ts +11 -0
- package/src/typeahead/Typeahead.tsx +15 -1
- package/yarn.lock +6 -14
|
@@ -9,15 +9,20 @@ import RouteService from '@licklist/plugins/dist/services/Route/RouteService'
|
|
|
9
9
|
import { FaEllipsisH, FaEye, FaTrashAlt } from 'react-icons/fa'
|
|
10
10
|
import { ConfirmModal } from '../../modals'
|
|
11
11
|
import { MenuButton } from '../../table/MenuButton'
|
|
12
|
+
import { ProductSetNameControl } from '../form/ProductSetNameControl'
|
|
12
13
|
|
|
13
14
|
export interface ProductSetCardProps extends HasPermissionProp {
|
|
14
15
|
name: string
|
|
15
16
|
rrule?: string
|
|
16
17
|
href: string
|
|
17
|
-
|
|
18
|
+
duplicateProductSetName: string
|
|
19
|
+
onChangeDuplicateProductSetName: (value: string) => void
|
|
20
|
+
onCopy: () => Promise<boolean | undefined>
|
|
18
21
|
onRemove: () => void
|
|
22
|
+
isLoading?: boolean
|
|
19
23
|
className?: string
|
|
20
24
|
override?: number
|
|
25
|
+
duplicateProductSetError?: string
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
export function ProductSetCard({
|
|
@@ -26,6 +31,10 @@ export function ProductSetCard({
|
|
|
26
31
|
href,
|
|
27
32
|
onCopy,
|
|
28
33
|
onRemove,
|
|
34
|
+
onChangeDuplicateProductSetName,
|
|
35
|
+
duplicateProductSetName,
|
|
36
|
+
duplicateProductSetError,
|
|
37
|
+
isLoading,
|
|
29
38
|
className = '',
|
|
30
39
|
hasPermission = true,
|
|
31
40
|
override = 0,
|
|
@@ -35,19 +44,23 @@ export function ProductSetCard({
|
|
|
35
44
|
const productSetCardClasses = `product-set-card ${className}`
|
|
36
45
|
const [isOverlayVisibile, setIsOverlayVisible] = useState(false)
|
|
37
46
|
|
|
47
|
+
const onCardClick = () => {
|
|
48
|
+
RouteService.redirectTo(href)
|
|
49
|
+
}
|
|
38
50
|
return (
|
|
51
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
39
52
|
<div
|
|
40
53
|
role='button'
|
|
41
54
|
tabIndex={0}
|
|
42
55
|
className='border-0 product-set-card-wrapper w-100 pb-0'
|
|
43
|
-
onClick={
|
|
44
|
-
onKeyUp={() => RouteService.redirectTo(href)}
|
|
56
|
+
onClick={onCardClick}
|
|
45
57
|
>
|
|
46
58
|
<div className={productSetCardClasses}>
|
|
47
59
|
<div className='product-set-card-link'>
|
|
48
60
|
<div className='d-flex flex-column'>
|
|
49
61
|
<div>
|
|
50
|
-
{name}
|
|
62
|
+
{name}
|
|
63
|
+
{rrule && `(${RRule.fromString(rrule).toText()})`}
|
|
51
64
|
</div>
|
|
52
65
|
{!!override && (
|
|
53
66
|
<div className='h6 bold ml-1'>
|
|
@@ -87,12 +100,25 @@ export function ProductSetCard({
|
|
|
87
100
|
onClick={(e) => e.stopPropagation()}
|
|
88
101
|
>
|
|
89
102
|
{Boolean(onCopy) && (
|
|
90
|
-
<ConfirmModal
|
|
103
|
+
<ConfirmModal
|
|
104
|
+
// confirm function memoize the callback function and it leads to bugs
|
|
105
|
+
confirmationHandler={onCopy}
|
|
106
|
+
disabledButtons={isLoading}
|
|
107
|
+
content={
|
|
108
|
+
<ProductSetNameControl
|
|
109
|
+
value={duplicateProductSetName}
|
|
110
|
+
onChange={onChangeDuplicateProductSetName}
|
|
111
|
+
error={duplicateProductSetError}
|
|
112
|
+
/>
|
|
113
|
+
}
|
|
114
|
+
>
|
|
91
115
|
{(confirm) => (
|
|
92
116
|
<MenuButton
|
|
93
117
|
onClick={() => {
|
|
94
118
|
setIsOverlayVisible(false)
|
|
95
|
-
|
|
119
|
+
onChangeDuplicateProductSetName(name)
|
|
120
|
+
// confirm function memoize the callback function and it leads to bugs
|
|
121
|
+
confirm(() => {})
|
|
96
122
|
}}
|
|
97
123
|
name={t('duplicate')}
|
|
98
124
|
className='product-set-card-menu-item-text'
|
|
@@ -12,6 +12,7 @@ import { isEqual } from 'lodash'
|
|
|
12
12
|
import { ProviderBookingManagementSetting } from '@licklist/core/dist/DataMapper/Provider/ProviderBookingManagementSettingDataMapper'
|
|
13
13
|
import { Zone } from '@licklist/core/dist/DataMapper/Provider/ZoneDataMapper'
|
|
14
14
|
import { WorkHour } from '@licklist/core/dist/DataMapper/Provider/WorkHourDataMapper'
|
|
15
|
+
import { transformErrorToMessage } from '@licklist/plugins'
|
|
15
16
|
import { Dialog, useDialogContext } from '../../modals/dialog'
|
|
16
17
|
import {
|
|
17
18
|
ProductSetControl,
|
|
@@ -121,6 +122,15 @@ export function ProductSetForm({
|
|
|
121
122
|
if (!serverErrors) {
|
|
122
123
|
return
|
|
123
124
|
}
|
|
125
|
+
if (!Array.isArray(serverErrors)) {
|
|
126
|
+
setErrorMessage(transformErrorToMessage(serverErrors))
|
|
127
|
+
return
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (Array.isArray(serverErrors) && serverErrors[0]) {
|
|
131
|
+
setErrorMessage(serverErrors[0])
|
|
132
|
+
}
|
|
133
|
+
|
|
124
134
|
FormErrorService.handleServerErrors(serverErrors, setError)
|
|
125
135
|
}, [serverErrors, setError])
|
|
126
136
|
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Form } from 'react-bootstrap'
|
|
2
|
+
import { useTranslation } from 'react-i18next'
|
|
3
|
+
|
|
4
|
+
export const ProductSetNameControl = ({
|
|
5
|
+
value,
|
|
6
|
+
onChange,
|
|
7
|
+
error,
|
|
8
|
+
}: {
|
|
9
|
+
value: string
|
|
10
|
+
onChange: (value: string) => void
|
|
11
|
+
error?: string
|
|
12
|
+
}) => {
|
|
13
|
+
const { t } = useTranslation(['Design'])
|
|
14
|
+
return (
|
|
15
|
+
<Form.Group>
|
|
16
|
+
<Form.Label>{t('Design:ProductSetName')}*</Form.Label>
|
|
17
|
+
<Form.Control
|
|
18
|
+
value={value}
|
|
19
|
+
maxLength={255}
|
|
20
|
+
onChange={(e) => onChange(e.target.value)}
|
|
21
|
+
placeholder={t('Design:placeholderProductSetName')}
|
|
22
|
+
isInvalid={Boolean(error)}
|
|
23
|
+
/>
|
|
24
|
+
<Form.Control.Feedback type='invalid'>{error}</Form.Control.Feedback>
|
|
25
|
+
</Form.Group>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
@@ -3,6 +3,7 @@ import { SmsTemplate } from '@licklist/core/dist/DataMapper/Notification/SmsTemp
|
|
|
3
3
|
import { TFunction } from 'react-i18next'
|
|
4
4
|
import { UseFormSetError } from 'react-hook-form'
|
|
5
5
|
import { checkIfZoneCategory } from '@licklist/plugins'
|
|
6
|
+
import { ProductSet } from '@licklist/core/dist/DataMapper/Product/ProductSetDataMapper'
|
|
6
7
|
import { TemplateItem } from '../control/ProductSetControl'
|
|
7
8
|
import { ProductSetFormValues } from '../form/ProductSetForm'
|
|
8
9
|
|
|
@@ -12,6 +13,11 @@ interface CheckAvailableTimesErrors {
|
|
|
12
13
|
t: TFunction
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
export interface MenuTypeheadItem {
|
|
17
|
+
id: number
|
|
18
|
+
label: string
|
|
19
|
+
value: number
|
|
20
|
+
}
|
|
15
21
|
export const moveArrayElements = <T>(
|
|
16
22
|
array: T[],
|
|
17
23
|
prevIndex: number,
|
|
@@ -83,3 +89,8 @@ export const checkAvailableTimesErrors = ({
|
|
|
83
89
|
})
|
|
84
90
|
return hasError
|
|
85
91
|
}
|
|
92
|
+
|
|
93
|
+
export const getTypeHeadItemsFromMenus = (
|
|
94
|
+
menus?: (ProductSet | ProductSetFormValues)[],
|
|
95
|
+
): MenuTypeheadItem[] =>
|
|
96
|
+
menus?.map((menu) => ({ id: menu.id, value: menu.id, label: menu.name }))
|
|
@@ -12,10 +12,13 @@ export interface TypeaheadProps {
|
|
|
12
12
|
placeholder: string
|
|
13
13
|
isRequired?: boolean
|
|
14
14
|
name: string
|
|
15
|
+
value?: TypeaheadOptions
|
|
15
16
|
isMultipleChoise?: boolean
|
|
16
17
|
noOptionsMessage: string
|
|
17
18
|
isInvalid?: boolean
|
|
18
19
|
isCouponForm?: boolean
|
|
20
|
+
containerStyles?: CSSObjectWithLabel
|
|
21
|
+
onChangeValue?: (value: TypeaheadOptions) => void
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
function Typeahead({
|
|
@@ -24,6 +27,9 @@ function Typeahead({
|
|
|
24
27
|
isRequired = false,
|
|
25
28
|
isMultipleChoise,
|
|
26
29
|
name = '',
|
|
30
|
+
value,
|
|
31
|
+
onChangeValue,
|
|
32
|
+
containerStyles,
|
|
27
33
|
isCouponForm = false,
|
|
28
34
|
noOptionsMessage = '',
|
|
29
35
|
isInvalid,
|
|
@@ -53,15 +59,23 @@ function Typeahead({
|
|
|
53
59
|
render={({ field }) => (
|
|
54
60
|
<Select
|
|
55
61
|
placeholder={placeholder}
|
|
56
|
-
value={field.value}
|
|
62
|
+
value={value ?? field.value}
|
|
57
63
|
isMulti={isMultipleChoise}
|
|
58
64
|
styles={{
|
|
65
|
+
container: (base) => ({
|
|
66
|
+
...base,
|
|
67
|
+
...containerStyles,
|
|
68
|
+
}),
|
|
59
69
|
control: (base) => ({
|
|
60
70
|
...base,
|
|
61
71
|
...getStyle(),
|
|
62
72
|
}),
|
|
63
73
|
}}
|
|
64
74
|
onChange={(value) => {
|
|
75
|
+
if (onChangeValue) {
|
|
76
|
+
onChangeValue(value)
|
|
77
|
+
return
|
|
78
|
+
}
|
|
65
79
|
field.onChange(value)
|
|
66
80
|
}}
|
|
67
81
|
options={options}
|
package/yarn.lock
CHANGED
|
@@ -2518,7 +2518,7 @@ __metadata:
|
|
|
2518
2518
|
"@fortawesome/free-solid-svg-icons": "npm:5.15.2"
|
|
2519
2519
|
"@licklist/core": "npm:0.30.3"
|
|
2520
2520
|
"@licklist/eslint-config": "npm:0.5.6"
|
|
2521
|
-
"@licklist/plugins": "npm:0.33.
|
|
2521
|
+
"@licklist/plugins": "npm:0.33.4"
|
|
2522
2522
|
"@mantine/core": "npm:6.0.22"
|
|
2523
2523
|
"@mantine/hooks": "npm:6.0.22"
|
|
2524
2524
|
"@mdx-js/react": "npm:1.6.22"
|
|
@@ -2649,7 +2649,7 @@ __metadata:
|
|
|
2649
2649
|
peerDependencies:
|
|
2650
2650
|
"@licklist/core": 0.30.3
|
|
2651
2651
|
"@licklist/eslint-config": 0.5.6
|
|
2652
|
-
"@licklist/plugins": 0.33.
|
|
2652
|
+
"@licklist/plugins": 0.33.4
|
|
2653
2653
|
lodash: 4.17.21
|
|
2654
2654
|
luxon: 3.5.0
|
|
2655
2655
|
react: 17.0.2
|
|
@@ -2679,12 +2679,11 @@ __metadata:
|
|
|
2679
2679
|
languageName: node
|
|
2680
2680
|
linkType: hard
|
|
2681
2681
|
|
|
2682
|
-
"@licklist/plugins@npm:0.33.
|
|
2683
|
-
version: 0.33.
|
|
2684
|
-
resolution: "@licklist/plugins@npm:0.33.
|
|
2682
|
+
"@licklist/plugins@npm:0.33.4":
|
|
2683
|
+
version: 0.33.4
|
|
2684
|
+
resolution: "@licklist/plugins@npm:0.33.4"
|
|
2685
2685
|
dependencies:
|
|
2686
2686
|
"@licklist/core": "npm:0.30.1"
|
|
2687
|
-
"@ungap/url-search-params": "npm:0.2.2"
|
|
2688
2687
|
axios: "npm:0.26.0"
|
|
2689
2688
|
history: "npm:4.10.1"
|
|
2690
2689
|
laravel-echo: "npm:1.15.1"
|
|
@@ -2716,7 +2715,7 @@ __metadata:
|
|
|
2716
2715
|
react-loader: 2.4.7
|
|
2717
2716
|
react-query: 3.34.12
|
|
2718
2717
|
react-router-dom: 5.2.0
|
|
2719
|
-
checksum: 10c0/
|
|
2718
|
+
checksum: 10c0/d5be4b905709545cd7e936f19e84ad0b28b4b7ffcec3950366715dc4a4ca1a6fe023368cb6a348017626c1081b408d60261050141cee56666578afa1a35cb213
|
|
2720
2719
|
languageName: node
|
|
2721
2720
|
linkType: hard
|
|
2722
2721
|
|
|
@@ -6179,13 +6178,6 @@ __metadata:
|
|
|
6179
6178
|
languageName: node
|
|
6180
6179
|
linkType: hard
|
|
6181
6180
|
|
|
6182
|
-
"@ungap/url-search-params@npm:0.2.2":
|
|
6183
|
-
version: 0.2.2
|
|
6184
|
-
resolution: "@ungap/url-search-params@npm:0.2.2"
|
|
6185
|
-
checksum: 10c0/0ee84b8eff65b8f2af187d8487226c6358da2bd4f9036dea317fb5859c03dfbe1799864ade13127ba3d0b7069187c56a37596481983812e62929d8103e071690
|
|
6186
|
-
languageName: node
|
|
6187
|
-
linkType: hard
|
|
6188
|
-
|
|
6189
6181
|
"@vitejs/plugin-react@npm:4.3.1":
|
|
6190
6182
|
version: 4.3.1
|
|
6191
6183
|
resolution: "@vitejs/plugin-react@npm:4.3.1"
|