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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 654d556d34f5a4d85545aff221a0ad40d54b0f09c6f5a26d74dbd99b346ce57d
4
- data.tar.gz: 3ae3d76e2d79224c105d7b8c53c7f7c9033cda03505d55cc4222262926e9a580
3
+ metadata.gz: 1f4769b966dabf8cf4ccc54f825aa29b69560d0884a39c590518e17262c5e329
4
+ data.tar.gz: 60f2476c312db5941580e09b6f14604dd6b536308b740a84f1126abca811de67
5
5
  SHA512:
6
- metadata.gz: 1e0ed9fa251b5130bcdfc146ea0e1144b2273424c5f8171fc12b573ada98fbf2ca743d7467602d6d904b65c16fb8976ed51133461bb6497cff4dc038823100b4
7
- data.tar.gz: a8dcf56f0adeed47b1e403318feec0a711f9d45dbc6617e26bdb19533fe055552a61bfeb05663141b49d28810f12f3e62397f8177ffa07e6510533a5972f1b5b
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
- const disabledArray=[]
75
-
76
- disableDate && disableDate.length > 0 && disabledArray.push(...disableDate)
77
- disableRange && disableRange.length > 0 && disabledArray.push(...disableRange)
78
- disableWeekdays && disableWeekdays.length > 0 && disabledArray.push(...disabledWeekDays())
79
-
80
- return disabledArray
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: disabledParser(),
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 '
@@ -36,6 +36,7 @@
36
36
  input {
37
37
  border: none;
38
38
  font-family: $font_family_base;
39
+ font-size: $font_base;
39
40
  &:focus {
40
41
  outline: none;
41
42
  }
@@ -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='Start typing...'
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
  />