ordering-ui-admin-external 1.43.31 → 1.43.32
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/_bundles/{ordering-ui-admin.631d4ac82d8f20108a58.js → ordering-ui-admin.395af03194f63ca488ce.js} +2 -2
- package/_modules/components/Delivery/DriverGroupSelectorHeader/index.js +14 -13
- package/_modules/components/Delivery/DriversTimeDisplay/UserList.js +10 -18
- package/_modules/components/Delivery/DriversTimeDisplay/index.js +63 -16
- package/_modules/components/Delivery/DriversTimeDisplay/styles.js +7 -6
- package/_modules/components/Orders/DriverMultiSelector/index.js +46 -17
- package/_modules/styles/MultiSelect/index.js +56 -10
- package/_modules/styles/MultiSelect/styles.js +16 -5
- package/_modules/styles/Selects/index.js +62 -51
- package/package.json +2 -2
- package/src/components/Delivery/DriverGroupSelectorHeader/index.js +21 -21
- package/src/components/Delivery/DriversTimeDisplay/UserList.js +35 -41
- package/src/components/Delivery/DriversTimeDisplay/index.js +89 -34
- package/src/components/Delivery/DriversTimeDisplay/styles.js +22 -4
- package/src/components/Orders/DriverMultiSelector/index.js +46 -10
- package/src/styles/MultiSelect/index.js +104 -33
- package/src/styles/MultiSelect/styles.js +16 -1
- package/src/styles/Selects/index.js +14 -10
- /package/_bundles/{ordering-ui-admin.631d4ac82d8f20108a58.js.LICENSE.txt → ordering-ui-admin.395af03194f63ca488ce.js.LICENSE.txt} +0 -0
|
@@ -26,13 +26,13 @@ import {
|
|
|
26
26
|
DeleteWrapper,
|
|
27
27
|
OrderStatusTypeSelectWrapper,
|
|
28
28
|
StackedBlock,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
WarningMessage
|
|
29
|
+
WarningMessage,
|
|
30
|
+
FiltContainer
|
|
32
31
|
} from './styles'
|
|
33
32
|
import { Select } from '../../../styles/Select'
|
|
34
33
|
import { DriverMultiSelector } from '../../Orders/DriverMultiSelector'
|
|
35
34
|
import TiWarningOutline from '@meronex/icons/ti/TiWarningOutline'
|
|
35
|
+
import MdClose from '@meronex/icons/md/MdClose'
|
|
36
36
|
|
|
37
37
|
const DriversTimeDisplayUI = (props) => {
|
|
38
38
|
const {
|
|
@@ -78,7 +78,10 @@ const DriversTimeDisplayUI = (props) => {
|
|
|
78
78
|
handleSetInitialStates,
|
|
79
79
|
filterValues,
|
|
80
80
|
handleChangeDriver,
|
|
81
|
-
handleClearFilters
|
|
81
|
+
handleClearFilters,
|
|
82
|
+
setFiltOption,
|
|
83
|
+
filtOption,
|
|
84
|
+
handleClearDriversList
|
|
82
85
|
} = props
|
|
83
86
|
|
|
84
87
|
const [, t] = useLanguage()
|
|
@@ -128,11 +131,24 @@ const DriversTimeDisplayUI = (props) => {
|
|
|
128
131
|
}
|
|
129
132
|
]
|
|
130
133
|
|
|
131
|
-
const
|
|
134
|
+
const handleCleanFilters = () => {
|
|
132
135
|
setShowSelectHeader(false)
|
|
136
|
+
handleClearFilters()
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const changeDriverGroupState = (_driverGroup) => {
|
|
140
|
+
if (_driverGroup?.id === selectedGroup?.id) return
|
|
141
|
+
handleCleanFilters()
|
|
133
142
|
setSelectedGroup(_driverGroup)
|
|
134
143
|
}
|
|
135
144
|
|
|
145
|
+
const handleCloseFiltOption = () => {
|
|
146
|
+
setSelectedGroup(null)
|
|
147
|
+
setFiltOption(null)
|
|
148
|
+
handleClearDriversList()
|
|
149
|
+
handleCleanFilters()
|
|
150
|
+
}
|
|
151
|
+
|
|
136
152
|
const handleChangeDate = (date1, date2) => {
|
|
137
153
|
const diff = moment(date2).diff(date1, 'days')
|
|
138
154
|
if (diff > 31) {
|
|
@@ -269,6 +285,11 @@ const DriversTimeDisplayUI = (props) => {
|
|
|
269
285
|
setScheduleOptions(_scheduleOptions)
|
|
270
286
|
}
|
|
271
287
|
|
|
288
|
+
const handleChangeFiltOption = (option) => {
|
|
289
|
+
setFiltOption(option)
|
|
290
|
+
option === 'driver_groups' && setShowSelectHeader(true)
|
|
291
|
+
}
|
|
292
|
+
|
|
272
293
|
useEffect(() => {
|
|
273
294
|
const isTodayOrPastDate = moment(selectedDate).format('YYYY-MM-DD') <= moment().format('YYYY-MM-DD')
|
|
274
295
|
const date = moment(selectedDate).format('YYYY-MM-DD')
|
|
@@ -388,9 +409,61 @@ const DriversTimeDisplayUI = (props) => {
|
|
|
388
409
|
<div>
|
|
389
410
|
<h1>{t('DRIVERS_TIME_DISPLAY', 'Drivers time display')}</h1>
|
|
390
411
|
<DriverGroupSelectorWrapper>
|
|
391
|
-
<
|
|
392
|
-
|
|
393
|
-
|
|
412
|
+
<span className='calendar'>{t('CALENDAR', 'Calendar')}</span>
|
|
413
|
+
<ChevronRight />
|
|
414
|
+
{!filtOption ? (
|
|
415
|
+
<>
|
|
416
|
+
<DriverGroupName className='calendar' onClick={() => handleChangeFiltOption('driver_groups')}>{t('SELECT_DRIVER_GROUPS', 'Select driver groups')}</DriverGroupName>
|
|
417
|
+
<span> {t('OR', 'Or')} </span>
|
|
418
|
+
<DriverGroupName className='calendar' onClick={() => handleChangeFiltOption('drivers')}>{t('SELECT_DRIVERS', 'Select drivers')}</DriverGroupName>
|
|
419
|
+
</>
|
|
420
|
+
) : (
|
|
421
|
+
<FiltContainer>
|
|
422
|
+
<DriverGroupName
|
|
423
|
+
className='calendar'
|
|
424
|
+
onClick={() => filtOption === 'driver_groups' ? setShowSelectHeader(!showSelectHeader) : {}}
|
|
425
|
+
>
|
|
426
|
+
{filtOption === 'driver_groups' ? t('DRIVER_GROUPS', 'driver groups') : t('DRIVERS', 'drivers')}
|
|
427
|
+
</DriverGroupName>
|
|
428
|
+
<Button
|
|
429
|
+
circle
|
|
430
|
+
outline
|
|
431
|
+
color='primary'
|
|
432
|
+
type='reset'
|
|
433
|
+
className='remove_option'
|
|
434
|
+
onClick={() => handleCloseFiltOption()}
|
|
435
|
+
>
|
|
436
|
+
<MdClose />
|
|
437
|
+
</Button>
|
|
438
|
+
</FiltContainer>
|
|
439
|
+
)}
|
|
440
|
+
<ChevronRight />
|
|
441
|
+
{(selectedGroup || (filtOption === 'drivers')) && (
|
|
442
|
+
<>
|
|
443
|
+
{selectedGroup && (
|
|
444
|
+
<>
|
|
445
|
+
<span>{selectedGroup?.name}</span>
|
|
446
|
+
<ChevronRight />
|
|
447
|
+
<span>{t('DRIVERS', 'DRIVERS')}</span>
|
|
448
|
+
<ChevronRight />
|
|
449
|
+
</>
|
|
450
|
+
)}
|
|
451
|
+
<DriverMultiSelector
|
|
452
|
+
isSearchByName
|
|
453
|
+
useDriversByProps={selectedGroup}
|
|
454
|
+
drivers={selectedGroup?.drivers}
|
|
455
|
+
disableSocketRoomDriver
|
|
456
|
+
useTextStyle
|
|
457
|
+
hideChevronIcon
|
|
458
|
+
autoOpen={filtOption === 'drivers'}
|
|
459
|
+
filterValues={filterValues}
|
|
460
|
+
handleChangeDriver={handleChangeDriver}
|
|
461
|
+
andText={t('AND', 'And')}
|
|
462
|
+
textClassnames='calendar'
|
|
463
|
+
optionsPosition='left'
|
|
464
|
+
/>
|
|
465
|
+
</>
|
|
466
|
+
)}
|
|
394
467
|
{showSelectHeader && (
|
|
395
468
|
<DriverGroupSelectHeader
|
|
396
469
|
close={() => setShowSelectHeader(false)}
|
|
@@ -398,36 +471,17 @@ const DriversTimeDisplayUI = (props) => {
|
|
|
398
471
|
changeDriverGroupState={changeDriverGroupState}
|
|
399
472
|
/>
|
|
400
473
|
)}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
<
|
|
406
|
-
|
|
407
|
-
</>
|
|
474
|
+
{(filterValues?.driverIds?.length > 0) && (
|
|
475
|
+
<WarningMessage>
|
|
476
|
+
<TiWarningOutline />
|
|
477
|
+
<span>{t('FILTER_APPLIED', 'Filters applied')}</span>
|
|
478
|
+
<LinkButton onClick={() => handleClearFilters()}>{t('CLEAR_FILTERS', 'Clear filters')}</LinkButton>
|
|
479
|
+
</WarningMessage>
|
|
408
480
|
)}
|
|
409
481
|
</DriverGroupSelectorWrapper>
|
|
410
482
|
</div>
|
|
411
483
|
|
|
412
|
-
{(filterValues?.driverIds?.length > 0) && (
|
|
413
|
-
<WarningMessage>
|
|
414
|
-
<TiWarningOutline />
|
|
415
|
-
<span>{t('WARNING_FILTER_APPLIED', 'Filters applied. You may miss new orders.')}</span>
|
|
416
|
-
<LinkButton onClick={() => handleClearFilters()}>{t('CLEAR_FILTERS', 'Clear filters')}</LinkButton>
|
|
417
|
-
</WarningMessage>
|
|
418
|
-
)}
|
|
419
484
|
<DriversGroupCalendarWrapper>
|
|
420
|
-
{selectedGroup && (
|
|
421
|
-
<WrapperRow wrapperWidth={400}>
|
|
422
|
-
<DriverMultiSelectorContainer>
|
|
423
|
-
<DriverMultiSelector
|
|
424
|
-
disableSocketRoomDriver
|
|
425
|
-
filterValues={filterValues}
|
|
426
|
-
handleChangeDriver={handleChangeDriver}
|
|
427
|
-
/>
|
|
428
|
-
</DriverMultiSelectorContainer>
|
|
429
|
-
</WrapperRow>
|
|
430
|
-
)}
|
|
431
485
|
<AnalyticsCalendar {...props} handleChangeDate={handleChangeDate} />
|
|
432
486
|
</DriversGroupCalendarWrapper>
|
|
433
487
|
</HeaderWrapper>
|
|
@@ -554,7 +608,8 @@ export const DriversTimeDisplay = (props) => {
|
|
|
554
608
|
initialPage: 1,
|
|
555
609
|
pageSize: 10,
|
|
556
610
|
controlType: 'pages'
|
|
557
|
-
}
|
|
611
|
+
},
|
|
612
|
+
propsToFetch: ['id', 'enabled', 'name', 'email', 'level', 'lastname', 'delivery_blocks', 'photo']
|
|
558
613
|
}
|
|
559
614
|
return (
|
|
560
615
|
<CalendarDriversListController {...driversTimeDisplayProps} />
|
|
@@ -63,7 +63,7 @@ export const DriverGroupSelectorWrapper = styled.div`
|
|
|
63
63
|
width: fit-content;
|
|
64
64
|
margin: 3px 0;
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
span {
|
|
67
67
|
font-size: 14px;
|
|
68
68
|
color: ${props => props.theme.colors.secundaryLight};
|
|
69
69
|
&.calendar {
|
|
@@ -942,10 +942,10 @@ export const WarningMessage = styled.div`
|
|
|
942
942
|
padding: 0px 15px;
|
|
943
943
|
box-sizing: border-box;
|
|
944
944
|
margin: 10px 0px 0px 0px !important;
|
|
945
|
-
|
|
946
|
-
|
|
945
|
+
max-width: 250px;
|
|
946
|
+
left: 0px;
|
|
947
947
|
${props => props.theme?.rtl && css`
|
|
948
|
-
|
|
948
|
+
right: 0px;
|
|
949
949
|
right: initial;
|
|
950
950
|
`}
|
|
951
951
|
|
|
@@ -991,3 +991,21 @@ export const WarningMessage = styled.div`
|
|
|
991
991
|
}
|
|
992
992
|
}
|
|
993
993
|
`
|
|
994
|
+
|
|
995
|
+
export const FiltContainer = styled.div`
|
|
996
|
+
display: inline-block;
|
|
997
|
+
position: relative;
|
|
998
|
+
button {
|
|
999
|
+
position: absolute;
|
|
1000
|
+
display: flex;
|
|
1001
|
+
align-items: center;
|
|
1002
|
+
justify-content: center;
|
|
1003
|
+
position: absolute;
|
|
1004
|
+
background: transparent;
|
|
1005
|
+
width: 20px;
|
|
1006
|
+
height: 20px;
|
|
1007
|
+
transform: translate(140%, -50%);
|
|
1008
|
+
top: 5px;
|
|
1009
|
+
right: 10px;
|
|
1010
|
+
}
|
|
1011
|
+
`
|
|
@@ -21,14 +21,29 @@ const DriverMultiSelectorUI = (props) => {
|
|
|
21
21
|
small,
|
|
22
22
|
padding,
|
|
23
23
|
handleChangeDriver,
|
|
24
|
-
filterValues
|
|
24
|
+
filterValues,
|
|
25
|
+
useTextStyle,
|
|
26
|
+
hideChevronIcon,
|
|
27
|
+
andText,
|
|
28
|
+
textClassnames,
|
|
29
|
+
pagination,
|
|
30
|
+
handleChangePage,
|
|
31
|
+
handleChangePageSize,
|
|
32
|
+
useDriversByProps,
|
|
33
|
+
setSearchValue,
|
|
34
|
+
searchValue,
|
|
35
|
+
optionsPosition
|
|
25
36
|
} = props
|
|
26
37
|
|
|
27
38
|
const [{ dictionary }] = useLanguage()
|
|
28
39
|
const theme = useTheme()
|
|
29
40
|
const [driversMultiOptionList, setDriversMultiOptionList] = useState([])
|
|
30
|
-
|
|
31
|
-
const driversLoading = [{
|
|
41
|
+
|
|
42
|
+
const driversLoading = [{
|
|
43
|
+
value: 'default',
|
|
44
|
+
content: <Option small={small}>{dictionary?.LOADING ?? 'loading'}...</Option>,
|
|
45
|
+
showOnSelected: useTextStyle ? dictionary?.LOADING ?? 'loading' : null
|
|
46
|
+
}]
|
|
32
47
|
|
|
33
48
|
useEffect(() => {
|
|
34
49
|
const _driversOptionList = [
|
|
@@ -36,7 +51,8 @@ const DriverMultiSelectorUI = (props) => {
|
|
|
36
51
|
value: 'default',
|
|
37
52
|
content: <Option padding='0px'><span>{dictionary?.SELECT_DRIVER ?? 'Select driver'}</span></Option>,
|
|
38
53
|
color: 'primary',
|
|
39
|
-
showDisable: true
|
|
54
|
+
showDisable: true,
|
|
55
|
+
showOnSelected: useTextStyle ? dictionary?.SELECT_DRIVER ?? 'Select driver' : null
|
|
40
56
|
}
|
|
41
57
|
]
|
|
42
58
|
if (!driversList.loading) {
|
|
@@ -62,7 +78,8 @@ const DriverMultiSelectorUI = (props) => {
|
|
|
62
78
|
</DriverNameContainer>
|
|
63
79
|
</OptionContent>
|
|
64
80
|
</Option>
|
|
65
|
-
)
|
|
81
|
+
),
|
|
82
|
+
showOnSelected: useTextStyle ? driver.name : null
|
|
66
83
|
}
|
|
67
84
|
})
|
|
68
85
|
|
|
@@ -78,22 +95,37 @@ const DriverMultiSelectorUI = (props) => {
|
|
|
78
95
|
|
|
79
96
|
return (
|
|
80
97
|
<>
|
|
81
|
-
{!driversList.loading ? (
|
|
98
|
+
{!driversList.loading || (!useDriversByProps && pagination) ? (
|
|
82
99
|
<MultiSelect
|
|
83
|
-
|
|
100
|
+
isLoading={driversList.loading}
|
|
101
|
+
useLazyPagination={!useDriversByProps}
|
|
102
|
+
searchBarIsNotLazyLoad={useDriversByProps}
|
|
103
|
+
useTextStyle={useTextStyle}
|
|
104
|
+
hideChevronIcon={hideChevronIcon}
|
|
105
|
+
andText={andText}
|
|
106
|
+
textClassnames={textClassnames}
|
|
107
|
+
defaultValue={driversList.loading && !useDriversByProps ? 'loading' : filterValues.driverIds}
|
|
84
108
|
placeholder={Placeholder}
|
|
85
|
-
options={driversMultiOptionList}
|
|
109
|
+
options={driversList.loading && !useDriversByProps ? driversLoading : driversMultiOptionList}
|
|
86
110
|
optionInnerMargin='10px'
|
|
87
111
|
optionInnerMaxHeight='150px'
|
|
112
|
+
optionsPosition={optionsPosition}
|
|
88
113
|
onChange={(driver) => handleChangeDriver(driver)}
|
|
89
114
|
isShowSearchBar
|
|
90
115
|
searchBarIsCustomLayout
|
|
91
|
-
searchBarIsNotLazyLoad
|
|
92
116
|
searchValue={searchValue}
|
|
93
117
|
handleChangeSearch={(val) => setSearchValue(val)}
|
|
118
|
+
pagination={pagination}
|
|
119
|
+
handleChangePage={handleChangePage}
|
|
120
|
+
handleChangePageSize={handleChangePageSize}
|
|
94
121
|
/>
|
|
95
122
|
) : (
|
|
96
123
|
<MultiSelect
|
|
124
|
+
searchBarIsNotLazyLoad={useDriversByProps}
|
|
125
|
+
useTextStyle={useTextStyle}
|
|
126
|
+
hideChevronIcon={hideChevronIcon}
|
|
127
|
+
andText={andText}
|
|
128
|
+
textClassnames={textClassnames}
|
|
97
129
|
defaultValue='default'
|
|
98
130
|
options={driversLoading}
|
|
99
131
|
optionInnerMargin='10px'
|
|
@@ -101,7 +133,6 @@ const DriverMultiSelectorUI = (props) => {
|
|
|
101
133
|
className='driver-select'
|
|
102
134
|
isShowSearchBar
|
|
103
135
|
searchBarIsCustomLayout
|
|
104
|
-
searchBarIsNotLazyLoad
|
|
105
136
|
searchValue={searchValue}
|
|
106
137
|
handleChangeSearch={(val) => setSearchValue(val)}
|
|
107
138
|
/>
|
|
@@ -114,6 +145,11 @@ export const DriverMultiSelector = (props) => {
|
|
|
114
145
|
const DriversControlProps = {
|
|
115
146
|
...props,
|
|
116
147
|
UIComponent: DriverMultiSelectorUI,
|
|
148
|
+
paginationSettings: {
|
|
149
|
+
initialPage: 1,
|
|
150
|
+
pageSize: 10,
|
|
151
|
+
controlType: 'pages'
|
|
152
|
+
},
|
|
117
153
|
propsToFetch: ['id', 'name', 'lastname', 'cellphone', 'photo']
|
|
118
154
|
}
|
|
119
155
|
return (
|
|
@@ -3,7 +3,7 @@ import EnChevronDown from '@meronex/icons/en/EnChevronDown'
|
|
|
3
3
|
import { CheckSquareFill, Square } from 'react-bootstrap-icons'
|
|
4
4
|
import MdClose from '@meronex/icons/md/MdClose'
|
|
5
5
|
import { Button } from '../Buttons'
|
|
6
|
-
import { SearchBar } from '../../components/Shared'
|
|
6
|
+
import { Pagination, SearchBar } from '../../components/Shared'
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
Select as SelectInput,
|
|
@@ -18,7 +18,9 @@ import {
|
|
|
18
18
|
} from '../Selects'
|
|
19
19
|
|
|
20
20
|
import {
|
|
21
|
-
CheckBox
|
|
21
|
+
CheckBox,
|
|
22
|
+
TextFormatted,
|
|
23
|
+
PaginationWrapper
|
|
22
24
|
} from './styles'
|
|
23
25
|
|
|
24
26
|
export const MultiSelect = (props) => {
|
|
@@ -33,7 +35,17 @@ export const MultiSelect = (props) => {
|
|
|
33
35
|
searchBarPlaceholder,
|
|
34
36
|
searchBarIsCustomLayout,
|
|
35
37
|
searchValue,
|
|
36
|
-
handleChangeSearch
|
|
38
|
+
handleChangeSearch,
|
|
39
|
+
useTextStyle,
|
|
40
|
+
textClassnames,
|
|
41
|
+
hideChevronIcon,
|
|
42
|
+
andText,
|
|
43
|
+
pagination,
|
|
44
|
+
handleChangePage,
|
|
45
|
+
handleChangePageSize,
|
|
46
|
+
useLazyPagination,
|
|
47
|
+
isLoading,
|
|
48
|
+
optionsPosition
|
|
37
49
|
} = props
|
|
38
50
|
|
|
39
51
|
const [open, setOpen] = useState(false)
|
|
@@ -48,7 +60,7 @@ export const MultiSelect = (props) => {
|
|
|
48
60
|
}
|
|
49
61
|
|
|
50
62
|
const closeSelect = (e) => {
|
|
51
|
-
if (open) {
|
|
63
|
+
if (open && !isLoading) {
|
|
52
64
|
const outsideDropdown = !dropdownReference.current?.contains(e.target)
|
|
53
65
|
if (outsideDropdown) {
|
|
54
66
|
setOpen(false)
|
|
@@ -62,7 +74,9 @@ export const MultiSelect = (props) => {
|
|
|
62
74
|
const _defaultOption = options?.filter(
|
|
63
75
|
(option) => defaultValue.includes(option.value)
|
|
64
76
|
)
|
|
65
|
-
|
|
77
|
+
if (!(useLazyPagination && pagination)) {
|
|
78
|
+
setSelectedOptions(_defaultOption)
|
|
79
|
+
}
|
|
66
80
|
setValues(defaultValue)
|
|
67
81
|
}, [defaultValue, options, searchValue])
|
|
68
82
|
|
|
@@ -75,6 +89,11 @@ export const MultiSelect = (props) => {
|
|
|
75
89
|
return () => document.removeEventListener('click', closeSelect)
|
|
76
90
|
}, [open])
|
|
77
91
|
|
|
92
|
+
const handlerChangePage = (page) => {
|
|
93
|
+
setOpen(true)
|
|
94
|
+
handleChangePage(page)
|
|
95
|
+
}
|
|
96
|
+
|
|
78
97
|
const handleSelectOption = (option) => {
|
|
79
98
|
if (option.value === null || option.value === 'default') return
|
|
80
99
|
const _selectedOptions = [...selectedOptions]
|
|
@@ -96,48 +115,89 @@ export const MultiSelect = (props) => {
|
|
|
96
115
|
onChange && onChange(option.value)
|
|
97
116
|
}
|
|
98
117
|
|
|
118
|
+
const optionsTextFormatted = (selectedOption, index) => {
|
|
119
|
+
if (index <= 2) {
|
|
120
|
+
return `${selectedOption.showOnSelected || selectedOption.content}${index + 1 !== selectedOptions?.length && index <= 2 ? ', ' : ' '}`
|
|
121
|
+
}
|
|
122
|
+
if (index + 1 === selectedOptions?.length && selectedOptions?.length >= 4) {
|
|
123
|
+
return `${andText || 'And'} ${index - 2} +`
|
|
124
|
+
}
|
|
125
|
+
return null
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const filterFunction = (_, index) => {
|
|
129
|
+
if (!pagination || useLazyPagination) return true
|
|
130
|
+
const validation = pagination?.currentPage === 1
|
|
131
|
+
? index < (pagination.pageSize * pagination.currentPage)
|
|
132
|
+
: (index >= (pagination.pageSize * (pagination.currentPage - 1))) && (index < (pagination.pageSize * pagination.currentPage))
|
|
133
|
+
return validation
|
|
134
|
+
}
|
|
135
|
+
|
|
99
136
|
return (
|
|
100
|
-
<SelectInput className={className || 'multi-select'}>
|
|
137
|
+
<SelectInput useTextStyle={useTextStyle} className={className || 'multi-select'}>
|
|
101
138
|
{selectedOptions.length === 0 ? (
|
|
102
|
-
<Selected onClick={(e) => handleSelectClick(e)}>
|
|
103
|
-
{
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
139
|
+
<Selected useTextStyle={useTextStyle} onClick={(e) => handleSelectClick(e)}>
|
|
140
|
+
{useTextStyle ? (
|
|
141
|
+
<Header>
|
|
142
|
+
<TextFormatted className={textClassnames}>
|
|
143
|
+
{placeholder || ''}
|
|
144
|
+
</TextFormatted>
|
|
145
|
+
</Header>
|
|
146
|
+
) : (
|
|
147
|
+
<>
|
|
148
|
+
{placeholder || ''}
|
|
149
|
+
</>
|
|
150
|
+
)}
|
|
151
|
+
{!hideChevronIcon && (
|
|
152
|
+
<Chevron>
|
|
153
|
+
<EnChevronDown />
|
|
154
|
+
</Chevron>
|
|
155
|
+
)}
|
|
107
156
|
</Selected>
|
|
108
157
|
) : (
|
|
109
158
|
<Selected onClick={(e) => handleSelectClick(e)}>
|
|
110
|
-
<Header>
|
|
111
|
-
{selectedOptions.map((selectedOption) => (
|
|
159
|
+
<Header useTextStyle={useTextStyle}>
|
|
160
|
+
{selectedOptions.map((selectedOption, index) => (
|
|
112
161
|
<React.Fragment key={selectedOption.value}>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
162
|
+
{
|
|
163
|
+
useTextStyle ? (
|
|
164
|
+
<TextFormatted className={textClassnames} primary>
|
|
165
|
+
{optionsTextFormatted(selectedOption, index)}
|
|
166
|
+
</TextFormatted>
|
|
167
|
+
) : (
|
|
168
|
+
<MultiSelectOption>
|
|
169
|
+
{selectedOption.showOnSelected || selectedOption.content}
|
|
170
|
+
{selectedOption?.value !== 'default' && (
|
|
171
|
+
<Button
|
|
172
|
+
circle
|
|
173
|
+
outline
|
|
174
|
+
color='primary'
|
|
175
|
+
type='reset'
|
|
176
|
+
className='remove_option'
|
|
177
|
+
onClick={() => onChange && onChange(selectedOption.value)}
|
|
178
|
+
>
|
|
179
|
+
<MdClose />
|
|
180
|
+
</Button>
|
|
181
|
+
)}
|
|
182
|
+
</MultiSelectOption>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
128
185
|
</React.Fragment>
|
|
129
186
|
))}
|
|
130
187
|
</Header>
|
|
131
|
-
|
|
132
|
-
<
|
|
133
|
-
|
|
188
|
+
{!hideChevronIcon && (
|
|
189
|
+
<Chevron>
|
|
190
|
+
<EnChevronDown />
|
|
191
|
+
</Chevron>
|
|
192
|
+
)}
|
|
134
193
|
</Selected>
|
|
135
194
|
)}
|
|
136
195
|
{open && options && (
|
|
137
196
|
<Options
|
|
138
197
|
isAbsolute
|
|
139
|
-
position='right'
|
|
198
|
+
position={optionsPosition ?? 'right'}
|
|
140
199
|
ref={dropdownReference}
|
|
200
|
+
minWidth='330px'
|
|
141
201
|
>
|
|
142
202
|
{isShowSearchBar && (
|
|
143
203
|
<SearchBarWrapper
|
|
@@ -156,7 +216,7 @@ export const MultiSelect = (props) => {
|
|
|
156
216
|
optionInnerMargin={props.optionInnerMargin}
|
|
157
217
|
optionInnerMaxHeight={props.optionInnerMaxHeight}
|
|
158
218
|
>
|
|
159
|
-
{options.map((option, i) => (
|
|
219
|
+
{options.filter(filterFunction).map((option, i) => (
|
|
160
220
|
<MultiOption
|
|
161
221
|
key={i}
|
|
162
222
|
color={option.color}
|
|
@@ -174,6 +234,17 @@ export const MultiSelect = (props) => {
|
|
|
174
234
|
</MultiOption>
|
|
175
235
|
))}
|
|
176
236
|
</OptionsInner>
|
|
237
|
+
{pagination && handleChangePageSize && handleChangePage && (
|
|
238
|
+
<PaginationWrapper>
|
|
239
|
+
<Pagination
|
|
240
|
+
currentPage={pagination?.currentPage}
|
|
241
|
+
totalPages={pagination?.totalPages}
|
|
242
|
+
handleChangePage={handlerChangePage}
|
|
243
|
+
handleChangePageSize={handleChangePageSize}
|
|
244
|
+
defaultPageSize={pagination?.pageSize}
|
|
245
|
+
/>
|
|
246
|
+
</PaginationWrapper>
|
|
247
|
+
)}
|
|
177
248
|
</Options>
|
|
178
249
|
)}
|
|
179
250
|
</SelectInput>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
1
|
+
import styled, { css } from 'styled-components'
|
|
2
2
|
|
|
3
3
|
export const CheckBox = styled.div`
|
|
4
4
|
color: ${props => props.theme.colors.primary};
|
|
@@ -7,3 +7,18 @@ export const CheckBox = styled.div`
|
|
|
7
7
|
font-size: 16px;
|
|
8
8
|
}
|
|
9
9
|
`
|
|
10
|
+
|
|
11
|
+
export const TextFormatted = styled.span`
|
|
12
|
+
${({ primary, theme }) => primary && css`
|
|
13
|
+
color: ${theme?.colors?.primary};
|
|
14
|
+
`}
|
|
15
|
+
|
|
16
|
+
div {
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
color: ${props => props.theme.colors.primary};
|
|
19
|
+
}
|
|
20
|
+
`
|
|
21
|
+
|
|
22
|
+
export const PaginationWrapper = styled.div`
|
|
23
|
+
margin: 20px;
|
|
24
|
+
`
|
|
@@ -59,7 +59,7 @@ export const Option = styled.div`
|
|
|
59
59
|
`
|
|
60
60
|
|
|
61
61
|
export const Options = styled.div`
|
|
62
|
-
min-width: 100
|
|
62
|
+
min-width: ${({ minWidth }) => minWidth || '100%'};
|
|
63
63
|
background: ${props => props.theme.colors?.backgroundPage || '#FFF'};
|
|
64
64
|
z-index: 10000;
|
|
65
65
|
border-width: 1px;
|
|
@@ -102,8 +102,10 @@ export const OptionsInner = styled.div`
|
|
|
102
102
|
overscroll-behavior: contain;
|
|
103
103
|
`
|
|
104
104
|
export const Selected = styled.div`
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
${({ useTextStyle }) => !useTextStyle && css`
|
|
106
|
+
padding-left: 15px;
|
|
107
|
+
padding-right: 15px;
|
|
108
|
+
`}
|
|
107
109
|
cursor: pointer;
|
|
108
110
|
position: relative;
|
|
109
111
|
display: flex;
|
|
@@ -136,14 +138,16 @@ export const Selected = styled.div`
|
|
|
136
138
|
|
|
137
139
|
export const Select = styled.div`
|
|
138
140
|
display: inline-block;
|
|
139
|
-
border-radius: 7.6px;
|
|
140
|
-
line-height: 34px;
|
|
141
|
-
border-width: 1px;
|
|
142
|
-
border-style: solid;
|
|
143
|
-
border-color: #DEE2E6;
|
|
144
141
|
color: #344050;
|
|
145
142
|
position: relative;
|
|
146
143
|
|
|
144
|
+
${props => !props.useTextStyle && css`
|
|
145
|
+
border-radius: 7.6px;
|
|
146
|
+
line-height: 34px;
|
|
147
|
+
border-width: 1px;
|
|
148
|
+
border-style: solid;
|
|
149
|
+
border-color: #DEE2E6;
|
|
150
|
+
`}
|
|
147
151
|
${props => props.open && css`
|
|
148
152
|
background-color: ${darken(0.07, '#CCC')};
|
|
149
153
|
`}
|
|
@@ -175,7 +179,7 @@ export const Chevron = styled.div`
|
|
|
175
179
|
export const Header = styled.div`
|
|
176
180
|
flex: 1;
|
|
177
181
|
overflow: auto;
|
|
178
|
-
white-space: nowrap;
|
|
182
|
+
white-space: ${({ useTextStyle }) => useTextStyle ? 'pre-wrap' : 'nowrap'};
|
|
179
183
|
display: flex;
|
|
180
184
|
align-items: center;
|
|
181
185
|
`
|
|
@@ -262,7 +266,7 @@ export const MultiOption = styled.div`
|
|
|
262
266
|
|
|
263
267
|
${props => props.selected && css`
|
|
264
268
|
background-color: ${darken(0.07, '#fafafa')};
|
|
265
|
-
|
|
269
|
+
|
|
266
270
|
&:hover {
|
|
267
271
|
background-color: ${darken(0.07, '#fafafa')};
|
|
268
272
|
}
|