first commit

This commit is contained in:
DanielRamirezGe
2020-01-14 20:43:08 -06:00
parent 3557894f7f
commit 5eecfbf6cd
26326 changed files with 2434803 additions and 0 deletions
@@ -0,0 +1,113 @@
import Vue from '../../utils/vue';
import { isVisible, selectAll } from '../../utils/dom';
import normalizeSlotMixin from '../../mixins/normalize-slot';
import KeyCodes from '../../utils/key-codes';
var ITEM_SELECTOR = ['.btn:not(.disabled):not([disabled]):not(.dropdown-item)', '.form-control:not(.disabled):not([disabled])', 'select:not(.disabled):not([disabled])', 'input[type="checkbox"]:not(.disabled)', 'input[type="radio"]:not(.disabled)'].join(','); // @vue/component
export var BButtonToolbar =
/*#__PURE__*/
Vue.extend({
name: 'BButtonToolbar',
mixins: [normalizeSlotMixin],
props: {
justify: {
type: Boolean,
default: false
},
keyNav: {
type: Boolean,
default: false
}
},
mounted: function mounted() {
if (this.keyNav) {
// Pre-set the tabindexes if the markup does not include tabindex="-1" on the toolbar items
this.getItems();
}
},
methods: {
onFocusin: function onFocusin(evt) {
if (evt.target === this.$el) {
evt.preventDefault();
evt.stopPropagation();
this.focusFirst(evt);
}
},
stop: function stop(evt) {
evt.preventDefault();
evt.stopPropagation();
},
onKeydown: function onKeydown(evt) {
if (!this.keyNav) {
/* istanbul ignore next: should never happen */
return;
}
var key = evt.keyCode;
var shift = evt.shiftKey;
if (key === KeyCodes.UP || key === KeyCodes.LEFT) {
this.stop(evt);
shift ? this.focusFirst(evt) : this.focusPrev(evt);
} else if (key === KeyCodes.DOWN || key === KeyCodes.RIGHT) {
this.stop(evt);
shift ? this.focusLast(evt) : this.focusNext(evt);
}
},
setItemFocus: function setItemFocus(item) {
item && item.focus && item.focus();
},
focusFirst: function focusFirst(evt) {
var items = this.getItems();
this.setItemFocus(items[0]);
},
focusPrev: function focusPrev(evt) {
var items = this.getItems();
var index = items.indexOf(evt.target);
if (index > -1) {
items = items.slice(0, index).reverse();
this.setItemFocus(items[0]);
}
},
focusNext: function focusNext(evt) {
var items = this.getItems();
var index = items.indexOf(evt.target);
if (index > -1) {
items = items.slice(index + 1);
this.setItemFocus(items[0]);
}
},
focusLast: function focusLast(evt) {
var items = this.getItems().reverse();
this.setItemFocus(items[0]);
},
getItems: function getItems() {
var items = selectAll(ITEM_SELECTOR, this.$el);
items.forEach(function (item) {
// Ensure tabfocus is -1 on any new elements
item.tabIndex = -1;
});
return items.filter(function (el) {
return isVisible(el);
});
}
},
render: function render(h) {
return h('div', {
staticClass: 'btn-toolbar',
class: {
'justify-content-between': this.justify
},
attrs: {
role: 'toolbar',
tabindex: this.keyNav ? '0' : null
},
on: this.keyNav ? {
focusin: this.onFocusin,
keydown: this.onKeydown
} : {}
}, [this.normalizeSlot('default')]);
}
});
+11
View File
@@ -0,0 +1,11 @@
//
// Button Toolbar
//
import Vue from 'vue'
import { BvPlugin, BvComponent } from '../../'
// Plugin
export declare const ButtonToolbarPlugin: BvPlugin
// Component: b-button-toolbar
export declare class BButtonToolbar extends BvComponent {}
+11
View File
@@ -0,0 +1,11 @@
import { BButtonToolbar } from './button-toolbar';
import { pluginFactory } from '../../utils/plugins';
var ButtonToolbarPlugin =
/*#__PURE__*/
pluginFactory({
components: {
BButtonToolbar: BButtonToolbar,
BBtnToolbar: BButtonToolbar
}
});
export { ButtonToolbarPlugin, BButtonToolbar };