UNPKG

bootstrap-vue

Version:

BootstrapVue, with more than 85 custom components, over 45 plugins, several custom directives, and over 300 icons, provides one of the most comprehensive implementations of Bootstrap v4 components and grid system for Vue.js. With extensive and automated W

68 lines (66 loc) 1.91 kB
import { isFunction } from '../../../utils/inspect'; import { BTr } from '../tr'; import { BTd } from '../td'; var busySlotName = 'table-busy'; export default { props: { busy: { type: Boolean, default: false } }, data: function data() { return { localBusy: false }; }, computed: { computedBusy: function computedBusy() { return this.busy || this.localBusy; } }, watch: { localBusy: function localBusy(newVal, oldVal) { if (newVal !== oldVal) { this.$emit('update:busy', newVal); } } }, methods: { // Event handler helper stopIfBusy: function stopIfBusy(evt) { if (this.computedBusy) { // If table is busy (via provider) then don't propagate evt.preventDefault(); evt.stopPropagation(); return true; } return false; }, // Render the busy indicator or return `null` if not busy renderBusy: function renderBusy() { var h = this.$createElement; // Return a busy indicator row, or `null` if not busy if (this.computedBusy && this.hasNormalizedSlot(busySlotName)) { // Show the busy slot return h(BTr, { key: 'table-busy-slot', staticClass: 'b-table-busy-slot', class: [isFunction(this.tbodyTrClass) ? /* istanbul ignore next */ this.tbodyTrClass(null, busySlotName) : this.tbodyTrClass], attrs: isFunction(this.tbodyTrAttr) ? /* istanbul ignore next */ this.tbodyTrAttr(null, busySlotName) : this.tbodyTrAttr }, [h(BTd, { props: { colspan: this.computedFields.length || null } }, [this.normalizeSlot(busySlotName)])]); } else { // We return `null` here so that we can determine if we need to // render the table items rows or not return null; } } } };