+314
-228
lines changedFilter options
+314
-228
lines changed Original file line number Diff line number Diff line change
@@ -342,12 +342,14 @@ export const BCalendar = Vue.extend({
342
342
},
343
343
computedDateDisabledFn() {
344
344
const { dateDisabledFn } = this
345
-
return dateDisabledFn.name !== 'default' ? dateDisabledFn : () => false
345
+
return dateDisabledFn.name !== props.dateDisabledFn.default.name
346
+
? dateDisabledFn
347
+
: () => false
346
348
},
347
349
// TODO: Change `dateInfoFn` to handle events and notes as well as classes
348
350
computedDateInfoFn() {
349
351
const { dateInfoFn } = this
350
-
return dateInfoFn.name !== 'default' ? dateInfoFn : () => ({})
352
+
return dateInfoFn.name !== props.dateInfoFn.default.name ? dateInfoFn : () => ({})
351
353
},
352
354
calendarLocale() {
353
355
// This locale enforces the gregorian calendar (for use in formatter functions)
Original file line number Diff line number Diff line change
@@ -377,4 +377,70 @@ describe('calendar', () => {
377
377
expect($buttons.at(3).classes()).toContain('btn-outline-primary')
378
378
expect($buttons.at(4).classes()).toContain('btn-outline-primary')
379
379
})
380
+
381
+
it('disables dates based on `date-disabled-fn` prop', async () => {
382
+
const wrapper = mount(BCalendar, {
383
+
attachTo: createContainer(),
384
+
propsData: {
385
+
value: '2020-01-01',
386
+
dateDisabledFn(ymd) {
387
+
return ymd === '2020-01-02'
388
+
}
389
+
}
390
+
})
391
+
392
+
expect(wrapper.vm).toBeDefined()
393
+
await waitNT(wrapper.vm)
394
+
await waitRAF()
395
+
396
+
const $grid = wrapper.find('[role="application"]')
397
+
expect($grid.exists()).toBe(true)
398
+
399
+
let $cell = $grid.find('[data-date="2020-01-01"]')
400
+
expect($cell.exists()).toBe(true)
401
+
expect($cell.attributes('aria-disabled')).toBeUndefined()
402
+
403
+
$cell = $grid.find('[data-date="2020-01-02"]')
404
+
expect($cell.exists()).toBe(true)
405
+
expect($cell.attributes('aria-disabled')).toEqual('true')
406
+
407
+
$cell = $grid.find('[data-date="2020-01-03"]')
408
+
expect($cell.exists()).toBe(true)
409
+
expect($cell.attributes('aria-disabled')).toBeUndefined()
410
+
411
+
wrapper.destroy()
412
+
})
413
+
414
+
it('applies classes on dates based on `date-info-fn` prop', async () => {
415
+
const wrapper = mount(BCalendar, {
416
+
attachTo: createContainer(),
417
+
propsData: {
418
+
value: '2020-01-01',
419
+
dateInfoFn(ymd) {
420
+
return ymd === '2020-01-02' ? 'my-info' : null
421
+
}
422
+
}
423
+
})
424
+
425
+
expect(wrapper.vm).toBeDefined()
426
+
await waitNT(wrapper.vm)
427
+
await waitRAF()
428
+
429
+
const $grid = wrapper.find('[role="application"]')
430
+
expect($grid.exists()).toBe(true)
431
+
432
+
let $cell = $grid.find('[data-date="2020-01-01"]')
433
+
expect($cell.exists()).toBe(true)
434
+
expect($cell.classes()).not.toContain('my-info')
435
+
436
+
$cell = $grid.find('[data-date="2020-01-02"]')
437
+
expect($cell.exists()).toBe(true)
438
+
expect($cell.classes()).toContain('my-info')
439
+
440
+
$cell = $grid.find('[data-date="2020-01-03"]')
441
+
expect($cell.exists()).toBe(true)
442
+
expect($cell.classes()).not.toContain('my-info')
443
+
444
+
wrapper.destroy()
445
+
})
380
446
})
Original file line number Diff line number Diff line change
@@ -108,6 +108,83 @@ const getAllFileEntriesInDirectory = (directoryReader, path = '') =>
108
108
readDirectoryEntries()
109
109
})
110
110
111
+
// --- Props ---
112
+
113
+
const props = makePropsConfigurable(
114
+
{
115
+
...formControlProps,
116
+
...formCustomProps,
117
+
...formStateProps,
118
+
...formSizeProps,
119
+
value: {
120
+
type: [File, Array],
121
+
default: null,
122
+
validator(value) {
123
+
/* istanbul ignore next */
124
+
if (value === '') {
125
+
warn(VALUE_EMPTY_DEPRECATED_MSG, NAME_FORM_FILE)
126
+
return true
127
+
}
128
+
return isUndefinedOrNull(value) || isValidValue(value)
129
+
}
130
+
},
131
+
accept: {
132
+
type: String,
133
+
default: ''
134
+
},
135
+
// Instruct input to capture from camera
136
+
capture: {
137
+
type: Boolean,
138
+
default: false
139
+
},
140
+
placeholder: {
141
+
type: String,
142
+
default: 'No file chosen'
143
+
},
144
+
browseText: {
145
+
type: String,
146
+
default: 'Browse'
147
+
},
148
+
dropPlaceholder: {
149
+
type: String,
150
+
default: 'Drop files here'
151
+
},
152
+
noDropPlaceholder: {
153
+
type: String,
154
+
default: 'Not allowed'
155
+
},
156
+
multiple: {
157
+
type: Boolean,
158
+
default: false
159
+
},
160
+
directory: {
161
+
type: Boolean,
162
+
default: false
163
+
},
164
+
// TODO:
165
+
// Should we deprecate this and only support flat file structures?
166
+
// Nested file structures are only supported when files are dropped
167
+
// A Chromium "bug" prevents `webkitEntries` from being populated
168
+
// on the file input's `change` event and is marked as "WontFix"
169
+
// Mozilla implemented the behavior the same way as Chromium
170
+
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=138987
171
+
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1326031
172
+
noTraverse: {
173
+
type: Boolean,
174
+
default: false
175
+
},
176
+
noDrop: {
177
+
type: Boolean,
178
+
default: false
179
+
},
180
+
fileNameFormatter: {
181
+
type: Function
182
+
// default: null
183
+
}
184
+
},
185
+
NAME_FORM_FILE
186
+
)
187
+
111
188
// @vue/component
112
189
export const BFormFile = /*#__PURE__*/ Vue.extend({
113
190
name: NAME_FORM_FILE,
@@ -124,80 +201,7 @@ export const BFormFile = /*#__PURE__*/ Vue.extend({
124
201
prop: 'value',
125
202
event: 'input'
126
203
},
127
-
props: makePropsConfigurable(
128
-
{
129
-
...formControlProps,
130
-
...formCustomProps,
131
-
...formStateProps,
132
-
...formSizeProps,
133
-
value: {
134
-
type: [File, Array],
135
-
default: null,
136
-
validator(value) {
137
-
/* istanbul ignore next */
138
-
if (value === '') {
139
-
warn(VALUE_EMPTY_DEPRECATED_MSG, NAME_FORM_FILE)
140
-
return true
141
-
}
142
-
return isUndefinedOrNull(value) || isValidValue(value)
143
-
}
144
-
},
145
-
accept: {
146
-
type: String,
147
-
default: ''
148
-
},
149
-
// Instruct input to capture from camera
150
-
capture: {
151
-
type: Boolean,
152
-
default: false
153
-
},
154
-
placeholder: {
155
-
type: String,
156
-
default: 'No file chosen'
157
-
},
158
-
browseText: {
159
-
type: String,
160
-
default: 'Browse'
161
-
},
162
-
dropPlaceholder: {
163
-
type: String,
164
-
default: 'Drop files here'
165
-
},
166
-
noDropPlaceholder: {
167
-
type: String,
168
-
default: 'Not allowed'
169
-
},
170
-
multiple: {
171
-
type: Boolean,
172
-
default: false
173
-
},
174
-
directory: {
175
-
type: Boolean,
176
-
default: false
177
-
},
178
-
// TODO:
179
-
// Should we deprecate this and only support flat file structures?
180
-
// Nested file structures are only supported when files are dropped
181
-
// A Chromium "bug" prevents `webkitEntries` from being populated
182
-
// on the file input's `change` event and is marked as "WontFix"
183
-
// Mozilla implemented the behavior the same way as Chromium
184
-
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=138987
185
-
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1326031
186
-
noTraverse: {
187
-
type: Boolean,
188
-
default: false
189
-
},
190
-
noDrop: {
191
-
type: Boolean,
192
-
default: false
193
-
},
194
-
fileNameFormatter: {
195
-
type: Function
196
-
// default: null
197
-
}
198
-
},
199
-
NAME_FORM_FILE
200
-
),
204
+
props,
201
205
data() {
202
206
return {
203
207
files: [],
@@ -269,7 +273,7 @@ export const BFormFile = /*#__PURE__*/ Vue.extend({
269
273
},
270
274
computedFileNameFormatter() {
271
275
const { fileNameFormatter } = this
272
-
return fileNameFormatter.name !== 'default'
276
+
return fileNameFormatter.name !== props.fileNameFormatter.default.name
273
277
? fileNameFormatter
274
278
: this.defaultFileNameFormatter
275
279
},
Original file line number Diff line number Diff line change
@@ -223,7 +223,9 @@ export const BFormSpinbutton = /*#__PURE__*/ Vue.extend({
223
223
},
224
224
computedFormatter() {
225
225
const { formatterFn } = this
226
-
return formatterFn.name !== 'default' ? formatterFn : this.defaultFormatter
226
+
return formatterFn.name !== props.formatterFn.default.name
227
+
? formatterFn
228
+
: this.defaultFormatter
227
229
},
228
230
computedAttrs() {
229
231
return {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4