Permalink
Browse files

feat(utils): wrap-up as ES6 module (#656)

* feat (utils, mixins) wrap-up as ES6 module
* feat (utils, mixins) make use of new ES6 modules
  • Loading branch information...
mosinve committed Jul 7, 2017
1 parent 7a65721 commit b5f7cfc9defaf66ff950bd578cb01ee3ea1f395b
@@ -19,7 +19,7 @@
</template>
<script>
import warn from '../utils/warn';
import {warn} from '../utils';
export default {
data() {
@@ -18,7 +18,7 @@
<script>
import bLink from './link.vue';
import { props as linkProps } from '../mixins/link';
import arrayIncludes from '../utils/arrayIncludes';
import {arrayIncludes} from '../utils';
const bLinkPropKeys = Object.keys(linkProps);
@@ -20,10 +20,10 @@
</style>
<script>
import listenOnRoot from '../mixins/listen-on-root';
import {listenOnRootMixin} from '../mixins';
export default {
mixins: [listenOnRoot],
mixins: [listenOnRootMixin],
data() {
return {
show: this.visible
@@ -45,11 +45,11 @@
</template>
<script>
import dropdown from '../mixins/dropdown';
import {dropdownMixin} from '../mixins';
import bButton from './button.vue';
export default {
mixins: [dropdown],
mixins: [dropdownMixin],
components: {bButton},
props: {
split: {
@@ -21,12 +21,8 @@
</template>
<script>
import formMixin from '../mixins/form';
import formCustomMixin from '../mixins/form-custom';
import formCheckBoxMixin from '../mixins/form-checkbox';
import arrayIncludes from '../utils/arrayIncludes';
import isArray from '../utils/isArray';
import {formMixin, formCustomMixin, formCheckBoxMixin} from '../mixins';
import {arrayIncludes, isArray} from '../utils';
export default {
mixins: [formMixin, formCustomMixin, formCheckBoxMixin],
@@ -33,7 +33,7 @@
</template>
<script>
import warn from '../utils/warn';
import {warn} from '../utils';
export default {
data() {
@@ -84,8 +84,7 @@
</style>
<script>
import formMixin from '../mixins/form';
import formCustomMixin from '../mixins/form-custom';
import {formCustomMixin, formMixin} from '../mixins';
export default {
mixins: [formMixin, formCustomMixin],
@@ -30,7 +30,7 @@
</template>
<script>
import formMixin from '../mixins/form';
import {formMixin} from '../mixins';
import bFormInputStatic from './form-input-static.vue';
export default {
@@ -27,10 +27,7 @@
</template>
<script>
import formOptionsMixin from '../mixins/form-options';
import formMixin from '../mixins/form';
import formCustomMixin from '../mixins/form-custom';
import formCheckBoxMixin from '../mixins/form-checkbox';
import {formOptionsMixin, formMixin, formCustomMixin, formCheckBoxMixin} from '../mixins';
export default {
mixins: [formMixin, formCustomMixin, formCheckBoxMixin, formOptionsMixin],
@@ -18,12 +18,10 @@
</template>
<script>
import formOptions from '../mixins/form-options';
import formMixin from '../mixins/form';
import formCustomMixin from '../mixins/form-custom';
import {formMixin, formOptionsMixin, formCustomMixin} from '../mixins';
export default {
mixins: [formMixin, formCustomMixin, formOptions],
mixins: [formMixin, formCustomMixin, formOptionsMixin],
data() {
return {
localValue: this.value
@@ -31,7 +31,7 @@
</template>
<script>
import linkMixin from '../mixins/link';
import {linkMixin} from '../mixins';
export default {
mixins: [linkMixin]
@@ -10,7 +10,7 @@
<script>
import bLink from './link.vue';
import { props as originalLinkProps, computed, omitLinkProps } from '../mixins/link';
import arrayIncludes from '../utils/arrayIncludes';
import {arrayIncludes} from '../utils';
// copy link props, but exclude defaults for 'href', 'to', & 'tag'
// to ensure proper component tag computation
const linkProps = Object.assign(omitLinkProps('href', 'to'), {
@@ -92,7 +92,7 @@
<script>
import bBtn from './button.vue';
import listenOnRoot from '../mixins/listen-on-root';
import {listenOnRootMixin} from '../mixins';
const FOCUS_SELECTOR = [
'button:not([disabled])',
@@ -127,7 +127,7 @@
}
export default {
mixins: [listenOnRoot],
mixins: [listenOnRootMixin],
components: {bBtn},
data() {
return {
@@ -11,10 +11,10 @@
</template>
<script>
import listenOnRoot from '../mixins/listen-on-root';
import {listenOnRootMixin} from '../mixins';
export default {
mixins: [listenOnRoot],
mixins: [listenOnRootMixin],
computed: {
classObject() {
return [
@@ -20,10 +20,10 @@
</template>
<script>
import popover from '../mixins/popover';
import {popoverMixin} from '../mixins';
export default {
mixins: [popover],
mixins: [popoverMixin],
props: {
title: {
type: String,
@@ -76,7 +76,7 @@
</template>
<script>
import warn from '../utils/warn';
import {warn} from '../utils';
const toString = v => {
if (!v) {
@@ -52,7 +52,7 @@
</template>
<script>
import observeDom from '../utils/observe-dom';
import {observeDom} from '../utils';
export default {
data() {
@@ -23,10 +23,10 @@
</style>
<script>
import popover from '../mixins/popover';
import {popoverMixin} from '../mixins';
export default {
mixins: [popover],
mixins: [popoverMixin],
props: {
content: {
type: String,
@@ -1,4 +1,4 @@
import isArray from '../utils/isArray';
import { isArray } from '../utils';
const inBrowser = typeof window !== 'undefined';
const isServer = !inBrowser;
@@ -1,4 +1,4 @@
import clickOut from './clickout';
import clickOutMixin from './clickout';
// Determine if an HTML element is visible - Faster than CSS check
function isVisible(el) {
@@ -60,8 +60,8 @@ export default {
// Hide when clicked on links
this.$root.$on('clicked::link', listener);
},
mounted: clickOut.mounted,
destroyed: clickOut.destroyed,
mounted: clickOutMixin.mounted,
destroyed: clickOutMixin.destroyed,
watch: {
visible(state, old) {
if (state === old) {
@@ -98,7 +98,7 @@ export default {
}
},
methods: {
...clickOut.methods,
...clickOutMixin.methods,
noop() {
// Do nothing event handler (used in visible watch)
},
@@ -1,4 +1,4 @@
import isArray from '../utils/isArray';
import { isArray }from '../utils';
export default {
computed: {
@@ -0,0 +1,11 @@
import clickOutMixin from './clickout';
import dropdownMixin from './dropdown';
import formMixin from './form';
import formCheckBoxMixin from './form-checkbox';
import formCustomMixin from './form-custom';
import formOptionsMixin from './form-options';
import linkMixin from './link';
import listenOnRootMixin from './listen-on-root';
import popoverMixin from './popover';
export {clickOutMixin, dropdownMixin, formMixin, formCheckBoxMixin, formCustomMixin, formOptionsMixin, linkMixin, listenOnRootMixin, popoverMixin};
@@ -1,5 +1,4 @@
import warn from '../utils/warn';
import arrayIncludes from '../utils/arrayIncludes';
import {warn, arrayIncludes} from '../utils';
// Props compatible with vue-router
// https://github.com/vuejs/vue-router/blob/dev/src/components/link.js
export const props = {
@@ -1,4 +1,4 @@
import isArray from "../utils/isArray"
import { isArray } from "../utils"
/**
* Issue #569: collapse::toggle::state triggered too many times
* @link https://github.com/bootstrap-vue/bootstrap-vue/issues/569
@@ -1,5 +1,5 @@
import Tether from 'tether';
import isArray from '../utils/isArray';
import { isArray } from '../utils';
// Controls which events are mapped for each named trigger, and the expected popover behavior for each.
const TRIGGER_LISTENERS = {
click: {click: 'toggle'},
@@ -0,0 +1,6 @@
import arrayIncludes from './arrayIncludes';
import isArray from './isArray';
import observeDom from './observe-dom';
import warn from './warn';
export {arrayIncludes, isArray, observeDom, warn};

0 comments on commit b5f7cfc

Please sign in to comment.