playbook_ui 12.31.0.pre.alpha.datepickerdisableddatefix931 → 12.31.0.pre.alpha.multilevelnopillsdesigns944
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 +12 -1
- 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: 1f4769b966dabf8cf4ccc54f825aa29b69560d0884a39c590518e17262c5e329
|
4
|
+
data.tar.gz: 60f2476c312db5941580e09b6f14604dd6b536308b740a84f1126abca811de67
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 369f3abd7579952d66f1eda983def3158e94ded442861a8a5890b6def5fcbbc0ac4bb83776d8702c8fa973ccdc37f561daf3539676bb5333ac74096a2bbd8662
|
7
|
+
data.tar.gz: 189f950cd2d49e95781c1af4f8f5db4006cd3d826641d15e91e13cac284fc17a66f5a15998063b16ae9fc7ede82adc929a7e6220bf3d731ef9a1b497d4180b4f
|
@@ -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 '
|
@@ -250,6 +250,15 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
250
250
|
}
|
251
251
|
}
|
252
252
|
|
253
|
+
const itemsSelectedLength = () => {
|
254
|
+
let items
|
255
|
+
if (returnAllSelected && returnedArray && returnedArray.length) {
|
256
|
+
items = returnedArray.length
|
257
|
+
} else if (!returnAllSelected && defaultReturn && defaultReturn.length) {
|
258
|
+
items = defaultReturn.length
|
259
|
+
}
|
260
|
+
return items
|
261
|
+
}
|
253
262
|
//rendering formattedData to UI based on typeahead
|
254
263
|
const renderNestedOptions = (items: { [key: string]: any }[]) => {
|
255
264
|
return (
|
@@ -346,7 +355,9 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
|
346
355
|
onChange={(e) => {
|
347
356
|
setFilterItem(e.target.value)
|
348
357
|
}}
|
349
|
-
placeholder=
|
358
|
+
placeholder={inputDisplay === "none" && itemsSelectedLength() ? (
|
359
|
+
`${itemsSelectedLength()} ${itemsSelectedLength() === 1 ? 'item' : 'items'} selected`
|
360
|
+
) : ("Start typing...")}
|
350
361
|
value={filterItem}
|
351
362
|
onClick={() => setIsClosed(false)}
|
352
363
|
/>
|