playbook_ui 12.31.0.pre.alpha.datepickerdisableddatefix931 → 12.31.0.pre.alpha.multilevelnopillsdesigns941
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +31 -37
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +1 -0
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +17 -2
- data/dist/playbook-rails.js +2 -2
- data/lib/playbook/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6338c934943b1c56fef912cfbe032aa415b7288be0d44b23df01b858c4a12c0c
|
4
|
+
data.tar.gz: 55f1ac8191a65068030e682e8f7d50e337ce6c74c07ad160c5dd61b795d88bbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 309bd3c9d0885a98a6a280aa7182bcc7617d83cc7f788a435649c832d1188b972c22c4382530c0e30d02c680daa648ce9d0cfb65ee3b2b510ee42a5492440ded
|
7
|
+
data.tar.gz: 1f8e1b6f661fa9554fa85e9c75a2f5145745179361392a86eddbc8c11a1c8c165e82d8a9040b34daca088e0b73155e8b984c78d12d85a9df2fc3fb7beaf2a0bf
|
@@ -71,42 +71,13 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
71
71
|
}
|
72
72
|
}
|
73
73
|
const disabledParser = () => {
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
}
|
82
|
-
|
83
|
-
const disabledWeekDays = () => {
|
84
|
-
return (
|
85
|
-
[
|
86
|
-
(date:any) => {
|
87
|
-
const weekdayObj: {
|
88
|
-
[day: string]: number
|
89
|
-
} = {
|
90
|
-
Sunday: 0,
|
91
|
-
Monday: 1,
|
92
|
-
Tuesday: 2,
|
93
|
-
Wednesday: 3,
|
94
|
-
Thursday: 4,
|
95
|
-
Friday: 5,
|
96
|
-
Saturday: 6,
|
97
|
-
}
|
98
|
-
return (
|
99
|
-
date.getDay() === weekdayObj[disableWeekdays[0]] ||
|
100
|
-
date.getDay() === weekdayObj[disableWeekdays[1]] ||
|
101
|
-
date.getDay() === weekdayObj[disableWeekdays[2]] ||
|
102
|
-
date.getDay() === weekdayObj[disableWeekdays[3]] ||
|
103
|
-
date.getDay() === weekdayObj[disableWeekdays[4]] ||
|
104
|
-
date.getDay() === weekdayObj[disableWeekdays[5]] ||
|
105
|
-
date.getDay() === weekdayObj[disableWeekdays[6]]
|
106
|
-
)
|
107
|
-
},
|
108
|
-
]
|
109
|
-
)
|
74
|
+
if (disableDate && disableDate.length > 0) {
|
75
|
+
return disableDate
|
76
|
+
} else if (disableRange && disableRange.length > 0) {
|
77
|
+
return disableRange
|
78
|
+
} else {
|
79
|
+
return []
|
80
|
+
}
|
110
81
|
}
|
111
82
|
const calendarResizer = () => {
|
112
83
|
const cal = document.querySelector(`#cal-${pickerId}.open`) as HTMLElement
|
@@ -156,7 +127,30 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
|
|
156
127
|
disableMobile: true,
|
157
128
|
dateFormat: getDateFormat(),
|
158
129
|
defaultDate: defaultDateGetter(),
|
159
|
-
disable:
|
130
|
+
disable: disableWeekdays && disableWeekdays.length > 0 ? [
|
131
|
+
(date) => {
|
132
|
+
const weekdayObj: {
|
133
|
+
[day: string]: number
|
134
|
+
} = {
|
135
|
+
Sunday: 0,
|
136
|
+
Monday: 1,
|
137
|
+
Tuesday: 2,
|
138
|
+
Wednesday: 3,
|
139
|
+
Thursday: 4,
|
140
|
+
Friday: 5,
|
141
|
+
Saturday: 6,
|
142
|
+
}
|
143
|
+
return (
|
144
|
+
date.getDay() === weekdayObj[disableWeekdays[0]] ||
|
145
|
+
date.getDay() === weekdayObj[disableWeekdays[1]] ||
|
146
|
+
date.getDay() === weekdayObj[disableWeekdays[2]] ||
|
147
|
+
date.getDay() === weekdayObj[disableWeekdays[3]] ||
|
148
|
+
date.getDay() === weekdayObj[disableWeekdays[4]] ||
|
149
|
+
date.getDay() === weekdayObj[disableWeekdays[5]] ||
|
150
|
+
date.getDay() === weekdayObj[disableWeekdays[6]]
|
151
|
+
)
|
152
|
+
},
|
153
|
+
] : disabledParser(),
|
160
154
|
enableTime,
|
161
155
|
locale: {
|
162
156
|
rangeSeparator: ' to '
|
@@ -6,6 +6,7 @@ import Checkbox from "../pb_checkbox/_checkbox"
|
|
6
6
|
import Icon from "../pb_icon/_icon"
|
7
7
|
import FormPill from "../pb_form_pill/_form_pill"
|
8
8
|
import CircleIconButton from "../pb_circle_icon_button/_circle_icon_button"
|
9
|
+
import Body from "../pb_body/_body"
|
9
10
|
import { cloneDeep } from "lodash"
|
10
11
|
|
11
12
|
import {
|
@@ -250,6 +251,15 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
250
251
|
}
|
251
252
|
}
|
252
253
|
|
254
|
+
const itemsSelectedLength = () => {
|
255
|
+
let items
|
256
|
+
if (returnAllSelected && returnedArray && returnedArray.length) {
|
257
|
+
items = returnedArray.length
|
258
|
+
} else if (!returnAllSelected && defaultReturn && defaultReturn.length) {
|
259
|
+
items = defaultReturn.length
|
260
|
+
}
|
261
|
+
return items
|
262
|
+
}
|
253
263
|
//rendering formattedData to UI based on typeahead
|
254
264
|
const renderNestedOptions = (items: { [key: string]: any }[]) => {
|
255
265
|
return (
|
@@ -310,7 +320,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
310
320
|
<div {...ariaProps} {...dataProps} className={classes} id={id}>
|
311
321
|
<div ref={dropdownRef} className='wrapper'>
|
312
322
|
<div className='input_wrapper' onClick={handleInputWrapperClick}>
|
313
|
-
<div className='input_inner_container'>
|
323
|
+
<div className='input_inner_container' style={{display: `${inputDisplay === "none" && "flex"}`}}>
|
314
324
|
{returnedArray.length !== 0 && returnAllSelected
|
315
325
|
? returnedArray.map((item) => (
|
316
326
|
<input type='hidden' name={`${name}[]`} value={item.id} />
|
@@ -339,6 +349,11 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
339
349
|
))
|
340
350
|
: null
|
341
351
|
}
|
352
|
+
{
|
353
|
+
inputDisplay === "none" && itemsSelectedLength() && (
|
354
|
+
<Body paddingRight="xs">{`${itemsSelectedLength()} ${itemsSelectedLength() === 1 ? 'item' : 'items'} selected`}</Body>
|
355
|
+
)
|
356
|
+
}
|
342
357
|
{returnedArray.length !== 0 && returnAllSelected && inputDisplay === "pills" && <br />}
|
343
358
|
{defaultReturn.length !== 0 && !returnAllSelected && inputDisplay === "pills" && <br />}
|
344
359
|
<input
|
@@ -346,7 +361,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
346
361
|
onChange={(e) => {
|
347
362
|
setFilterItem(e.target.value)
|
348
363
|
}}
|
349
|
-
placeholder=
|
364
|
+
placeholder={inputDisplay === "none" && itemsSelectedLength() ? "" : "Start typing..."}
|
350
365
|
value={filterItem}
|
351
366
|
onClick={() => setIsClosed(false)}
|
352
367
|
/>
|