import lodash from 'lodash'; import { VueConstructor } from 'vue'; import DraggableResizable from 'vue-draggable-resizable'; import 'vue-draggable-resizable/dist/VueDraggableResizable.css'; import draggable from 'vuedraggable'; import { default as I18nT } from './other/i18nT.vue'; import { default as PageActionDelete } from './page/action/action_delete.vue'; import { default as PageActionExport } from './page/action/action_export.vue'; import { default as PageActionImport } from './page/action/action_import.vue'; import { default as PageActionInfo } from './page/action/action_info.vue'; import { default as PageActionInsert } from './page/action/action_insert.vue'; import { default as PageActionUpdate } from './page/action/action_update.vue'; import { default as PageAction } from './page/action/index.vue'; import { default as PageDetails } from './page/details/index.vue'; import { baseValueType, valueTypeMap } from './page/field/declare'; import { default as PageField } from './page/field/index.vue'; import { default as PageFilter } from './page/filter.vue'; import { default as PageProvider } from './page/provider.vue'; import { default as PageTable } from './page/table.vue'; import { default as PageView } from './page/view.vue'; import { DefineProperty } from './prototype'; export * from './locales'; export * from './page/details/script'; export * from './page/field/declare'; export * from './page/field/script'; export function setValueTypeMap( map: T, ): { [P in keyof T]: P; } & typeof baseValueType { lodash.merge( valueTypeMap, // @ts-ignore lodash.mapKeys(map, (val, key) => `Field_${key}`), ); // @ts-ignore 转换一个 由组件名称组成的 key集合 const EnumValueType = lodash.mapValues(map, (val, key) => key); // @ts-ignore return lodash.assign({}, baseValueType, EnumValueType); } export function installBase(Vue: VueConstructor) { DefineProperty(Vue); lodash.mapValues(valueTypeMap, (val, key) => { Vue.component(key, val); }); Vue.component('draggable', draggable); Vue.component('draggable-resizable', DraggableResizable); Vue.component('I18nT', I18nT); Vue.component('PageProvider', PageProvider); Vue.component('PageFilter', PageFilter); Vue.component('PageTable', PageTable); Vue.component('PageView', PageView); Vue.component('PageDetails', PageDetails); Vue.component('PageActionDelete', PageActionDelete); Vue.component('PageActionExport', PageActionExport); Vue.component('PageActionImport', PageActionImport); Vue.component('PageActionInfo', PageActionInfo); Vue.component('PageActionInsert', PageActionInsert); Vue.component('PageActionUpdate', PageActionUpdate); Vue.component('PageAction', PageAction); Vue.component('PageField', PageField); }