10000 Merge branch 'dev' of https://github.com/bootstrap-vue/bootstrap-vue … · siberfx/bootstrap-vue@4a3863b · GitHub
[go: up one dir, main page]

Skip to content

Commit 4a3863b

Browse files
committed
Merge branch 'dev' of https://github.com/bootstrap-vue/bootstrap-vue into v3-dev
2 parents 33fb3a5 + 9f02ecd commit 4a3863b

File tree

10 files changed

+326
-229
lines changed

10 files changed

+326
-229
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file. See
44
[standard-version](https://github.com/conventional-changelog/standard-version) for commit
55
guidelines.
66

7+
<a name="2.20.1"></a>
8+
9+
## [v2.20.1](https://github.com/bootstrap-vue/bootstrap-vue/compare/v2.20.0...v2.20.1)
10+
11+
Released: 2020-12-01
12+
13+
### Bug Fixes v2.20.1
14+
15+
- user supplied prop function detection (closes
16+
[#6112](https://github.com/bootstrap-vue/bootstrap-vue/issues/6112))
17+
([#6113](https://github.com/bootstrap-vue/bootstrap-vue/issues/6113))
18+
([1d85839](https://github.com/bootstrap-vue/bootstrap-vue/commit/1d85839fa76c88f1a411a81945d03a4c895b3f4f))
19+
720
<a name="2.20.0"></a>
821

922
## [v2.20.0](https://github.com/bootstrap-vue/bootstrap-vue/compare/v2.19.0...v2.20.0)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bootstrap-vue",
3-
"version": "2.20.0",
3+
"version": "2.20.1",
44
"description": "With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extensive and automated WAI-ARIA accessibility markup.",
55
"main": "dist/bootstrap-vue.common.js",
66
"web": "dist/bootstrap-vue.js",

src/components/calendar/calendar.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,14 @@ export const BCalendar = defineComponent({
344344
},
345345
computedDateDisabledFn() {
346346
const { dateDisabledFn } = this
347-
return dateDisabledFn.name !== 'default' ? dateDisabledFn : () => false
347+
return dateDisabledFn.name !== props.dateDisabledFn.default.name
348+
? dateDisabledFn
349+
: () => false
348350
},
349351
// TODO: Change `dateInfoFn` to handle events and notes as well as classes
350352
computedDateInfoFn() {
351353
const { dateInfoFn } = this
352-
return dateInfoFn.name !== 'default' ? dateInfoFn : () => ({})
354+
return dateInfoFn.name !== props.dateInfoFn.default.name ? dateInfoFn : () => ({})
353355
},
354356
calendarLocale() {
355357
// This locale enforces the gregorian calendar (for use in formatter functions)

src/components/calendar/calendar.spec.js

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,4 +377,70 @@ describe('calendar', () => {
377377
expect($buttons[3].classes()).toContain('btn-outline-primary')
378378
expect($buttons[4].classes()).toContain('btn-outline-primary')
379379
})
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+
})
380446
})

src/components/form-file/form-file.js

Lines changed: 79 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,83 @@ const getAllFileEntriesInDirectory = (directoryReader, path = '') =>
114114
readDirectoryEntries()
115115
})
116116

117+
// --- Props ---
118+
119+
const props = makePropsConfigurable(
120+
{
121+
...formControlProps,
122+
...formCustomProps,
123+
...formStateProps,
124+
...formSizeProps,
125+
[PROP_NAME_MODEL_VALUE]: {
126+
type: [File, Array],
127+
default: null,
128+
validator: value => {
129+
/* istanbul ignore next */
130+
if (value === '') {
131+
warn(VALUE_EMPTY_DEPRECATED_MSG, NAME_FORM_FILE)
132+
return true
133+
}
134+
return isUndefinedOrNull(value) || isValidValue(value)
135+
}
136+
},
137+
accept: {
138+
type: String,
139+
default: ''
140+
},
141+
// Instruct input to capture from camera
142+
capture: {
143+
type: Boolean,
144+
default: false
145+
},
146+
placeholder: {
147+
type: String,
148+
default: 'No file chosen'
149+
},
150+
browseText: {
151+
type: String,
152+
default: 'Browse'
153+
},
154+
dropPlaceholder: {
155+
type: String,
156+
default: 'Drop files here'
157+
},
158+
noDropPlaceholder: {
159+
type: String,
160+
default: 'Not allowed'
161+
},
162+
multiple: {
163+
type: Boolean,
164+
default: false
165+
},
166+
directory: {
167+
type: Boolean,
168+
default: false
169+
},
170+
// TODO:
171+
// Should we deprecate this and only support flat file structures?
172+
// Nested file structures are only supported when files are dropped
173+
// A Chromium "bug" prevents `webkitEntries` from being populated
174+
// on the file input's `change` event and is marked as "WontFix"
175+
// Mozilla implemented the behavior the same way as Chromium
176+
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=138987
177+
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1326031
178+
noTraverse: {
179+
type: Boolean,
180+
default: false
181+
},
182+
noDrop: {
183+
type: Boolean,
184+
default: false
185+
},
186+
fileNameFormatter: {
187+
type: Function
188+
// default: null
189+
}
190+
},
191+
NAME_FORM_FILE
192+
)
193+
117194
// --- Main component ---
118195

119196
// @vue/component
@@ -130,80 +207,7 @@ export const BFormFile = /*#__PURE__*/ defineComponent({
130207
normalizeSlotMixin
131208
],
132209
inheritAttrs: false,
133-
props: makePropsConfigurable(
134-
{
135-
...formControlProps,
136-
...formCustomProps,
137-
...formStateProps,
138-
...formSizeProps,
139-
[PROP_NAME_MODEL_VALUE]: {
140-
type: [File, Array],
141-
default: null,
142-
validator: value => {
143-
/* istanbul ignore next */
144-
if (value === '') {
145-
warn(VALUE_EMPTY_DEPRECATED_MSG, NAME_FORM_FILE)
146-
return true
147-
}
148-
return isUndefinedOrNull(value) || isValidValue(value)
149-
}
150-
},
151-
accept: {
152-
type: String,
153-
default: ''
154-
},
155-
// Instruct input to capture from camera
156-
capture: {
157-
type: Boolean,
158-
default: false
159-
},
160-
placeholder: {
161-
type: String,
162-
default: 'No file chosen'
163-
},
164-
browseText: {
165-
type: String,
166-
default: 'Browse'
167-
},
168-
dropPlaceholder: {
169-
type: String,
170-
default: 'Drop files here'
171-
},
172-
noDropPlaceholder: {
173-
type: String,
174-
default: 'Not allowed'
175-
},
176-
multiple: {
177-
type: Boolean,
178-
default: false
179-
},
180-
directory: {
181-
type: Boolean,
182-
default: false
183-
},
184-
// TODO:
185-
// Should we deprecate this and only support flat file structures?
186-
// Nested file structures are only supported when files are dropped
187-
// A Chromium "bug" prevents `webkitEntries` from being populated
188-
// on the file input's `change` event and is marked as "WontFix"
189-
// Mozilla implemented the behavior the same way as Chromium
190-
// See: https://bugs.chromium.org/p/chromium/issues/detail?id=138987
191-
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=1326031
192-
noTraverse: {
193-
type: Boolean,
194-
default: false
195-
},
196-
noDrop: {
197-
type: Boolean,
198-
default: false
199-
},
200-
fileNameFormatter: {
201-
type: Function
202-
// default: null
203-
}
204-
},
205-
NAME_FORM_FILE
206-
),
210+
props,
207211
emits: [EVENT_NAME_CHANGE],
208212
data() {
209213
return {
@@ -276,7 +280,7 @@ export const BFormFile = /*#__PURE__*/ defineComponent({
276280
},
277281
computedFileNameFormatter() {
278282
const { fileNameFormatter } = this
279-
return fileNameFormatter.name !== 'default'
283+
return fileNameFormatter.name !== props.fileNameFormatter.default.name
280284
? fileNameFormatter
281285
: this.defaultFileNameFormatter
282286
},

src/components/form-spinbutton/form-spinbutton.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ export const BFormSpinbutton = /*#__PURE__*/ defineComponent({
227227
},
228228
computedFormatter() {
229229
const { formatterFn } = this
230-
return formatterFn.name !== 'default' ? formatterFn : this.defaultFormatter
230+
return formatterFn.name !== props.formatterFn.default.name
231+
? formatterFn
232+
: this.defaultFormatter
231233
},
232234
computedAttrs() {
233235
return {

0 commit comments

Comments
 (0)
0