|
| 1 | +// import { getDirname, path } from '@vuepress/utils' |
| 2 | +// import { searchPlugin } from '@vuepress/plugin-search' |
| 3 | +import VeeValidate from 'vee-validate' |
| 4 | +import Cleave from 'cleave.js' |
| 5 | +import * as lang from '../../dist/locale/index.esm' |
| 6 | +import Datepicker from '../../dist/vue-datepicker.esm' |
| 7 | +import AppendToBody from './components/Datepicker/AppendToBody.vue' |
| 8 | +import OpenDate from './components/Datepicker/OpenDate.vue' |
| 9 | +import Rtl from './components/Datepicker/Rtl.vue' |
| 10 | +import UseUtc from './components/Datepicker/UseUtc.vue' |
| 11 | +import VModel from './components/Datepicker/VModel.vue' |
| 12 | +import YearPickerRange from './components/Datepicker/YearPickerRange.vue' |
| 13 | +import Disabled from './components/Disabled.vue' |
| 14 | +import Highlighted from './components/Highlighted.vue' |
| 15 | +import Formatting from './components/Formatting.vue' |
| 16 | +import Language from './components/Language.vue' |
| 17 | +import Typeable from './components/Typeable.vue' |
| 18 | +import { defineClientConfig } from '@vuepress/client' |
| 19 | +// import { registerComponentsPlugin } from '@vuepress/plugin-register-components' |
| 20 | + |
| 21 | +// export default ({ Vue }) => { |
| 22 | +// const config = { |
| 23 | +// aria: true, |
| 24 | +// classNames: {}, |
| 25 | +// classes: true, |
| 26 | +// delay: 0, |
| 27 | +// dictionary: null, |
| 28 | +// errorBagName: 'errors', // change if property conflicts |
| 29 | +// events: 'input|blur', |
| 30 | +// fieldsBagName: 'fields', |
| 31 | +// i18n: null, // the vue-i18n plugin instance |
| 32 | +// i18nRootKey: 'validations', // the key under which nested validation messages will be located |
| 33 | +// inject: true, |
| 34 | +// locale: 'en', |
| 35 | +// validity: false, |
| 36 | +// useConstraintAttrs: true, |
| 37 | +// } |
| 38 | +// |
| 39 | +// Vue.use(VeeValidate, config) |
| 40 | +// Vue.component('Datepicker', Datepicker) |
| 41 | +// Vue.prototype.$datepickerLocals = lang |
| 42 | +// |
| 43 | +// Vue.directive('cleave', { |
| 44 | +// inserted(el, binding) { |
| 45 | +// // if the bound element is not an input field search for one |
| 46 | +// // this is for cases where the input is inside a wrapper |
| 47 | +// if (el.tagName !== 'INPUT') { |
| 48 | +// el = el.querySelector('input') |
| 49 | +// } |
| 50 | +// // only apply cleave if it is an input field and the options are set |
| 51 | +// if ( |
| 52 | +// el.tagName === 'INPUT' && |
| 53 | +// Object.keys(binding.value).length !== 0 && |
| 54 | +// binding.value.constructor === Object |
| 55 | +// ) { |
| 56 | +// new Cleave(el, binding.value) |
| 57 | +// } |
| 58 | +// }, |
| 59 | +// }) |
| 60 | +// } |
| 61 | + |
| 62 | +// const __dirname = getDirname(import.meta.url) |
| 63 | + |
| 64 | +const config = { |
| 65 | + aria: true, |
| 66 | + classNames: {}, |
| 67 | + classes: true, |
| 68 | + delay: 0, |
| 69 | + dictionary: null, |
| 70 | + errorBagName: 'errors', // change if property conflicts |
| 71 | + events: 'input|blur', |
| 72 | + fieldsBagName: 'fields', |
| 73 | + i18n: null, // the vue-i18n plugin instance |
| 74 | + i18nRootKey: 'validations', // the key under which nested validation messages will be located |
| 75 | + inject: true, |
| 76 | + locale: 'en', |
| 77 | + validity: false, |
| 78 | + useConstraintAttrs: true, |
| 79 | +} |
| 80 | + |
| 81 | +export default defineClientConfig({ |
| 82 | + // plugins: [ |
| 83 | + // searchPlugin({}), |
| 84 | + // registerComponentsPlugin({ |
| 85 | + // componentsDir: path.resolve(__dirname, './components'), |
| 86 | + // }), |
| 87 | + // ], |
| 88 | + |
| 89 | + // enhance({ app, router, siteData }) {}, |
| 90 | + |
| 91 | + enhance({ app }) { |
| 92 | + app.component('Datepicker', Datepicker) |
| 93 | + app.component('Datepicker-AppendToBody', AppendToBody) |
| 94 | + app.component('Datepicker-OpenDate', OpenDate) |
| 95 | + app.component('Datepicker-Rtl', Rtl) |
| 96 | + app.component('Datepicker-UseUtc', UseUtc) |
| 97 | + app.component('Datepicker-VModel', VModel) |
| 98 | + app.component('Datepicker-YearPickerRange', YearPickerRange) |
| 99 | + app.component('Disabled', Disabled) |
| 100 | + app.component('Highlighted', Highlighted) |
| 101 | + app.component('Formatting', Formatting) |
| 102 | + app.component('Language', Language) |
| 103 | + app.component('Typeable', Typeable) |
| 104 | + app.component('VeeValidate', VeeValidate) |
| 105 | + |
| 106 | + // app.use(VeeValidate, config) |
| 107 | + app.config.globalProperties.$datepickerLocals = lang |
| 108 | + app.directive('cleave', { |
| 109 | + inserted(el, binding) { |
| 110 | + // If the bound element is not an input field, search for one. |
| 111 | + // This is for cases where the input is inside a wrapper |
| 112 | + if (el.tagName !== 'INPUT') { |
| 113 | + el = el.querySelector('input') |
| 114 | + } |
| 115 | + // Only apply Cleave if it is an input field and the options are set |
| 116 | + if ( |
| 117 | + el.tagName === 'INPUT' && |
| 118 | + Object.keys(binding.value).length !== 0 && |
| 119 | + binding.value.constructor === Object |
| 120 | + ) { |
| 121 | + new Cleave(el, binding.value) |
| 122 | + } |
| 123 | + }, |
| 124 | + }) |
| 125 | + }, |
| 126 | + setup() {}, |
| 127 | + rootComponents: [], |
| 128 | +}) |
0 commit comments