feat: type抽离

This commit is contained in:
hongxinzz
2022-10-09 17:12:03 +08:00
parent a62929a8da
commit 8b4fa1aa21
62 changed files with 223 additions and 172 deletions

View File

@@ -7,13 +7,14 @@ import { useWindowSize } from '@vueuse/core'
import { useAppStore } from '@/store/modules/app'
import { setCssVar } from '@/utils'
import { useDesign } from '@/hooks/web/useDesign'
import { ElementPlusSize } from '@/types/elementPlus'
const { variables } = useDesign()
const appStore = useAppStore()
const props = defineProps({
size: propTypes.oneOf<ElememtPlusSize[]>(['default', 'small', 'large']).def('default')
size: propTypes.oneOf<ElementPlusSize[]>(['default', 'small', 'large']).def('default')
})
provide('configGlobal', props)

View File

@@ -4,7 +4,7 @@ import { PropType, ref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { useDesign } from '@/hooks/web/useDesign'
import type { RouteLocationNormalizedLoaded } from 'vue-router'
import { contextMenuSchema } from '../../../types/contextMenu'
const { getPrefixCls } = useDesign()
const prefixCls = getPrefixCls('context-menu')

View File

@@ -4,6 +4,7 @@ import { useDesign } from '@/hooks/web/useDesign'
import { propTypes } from '@/utils/propTypes'
import { ref, unref, PropType, computed, useAttrs } from 'vue'
import { useAppStore } from '@/store/modules/app'
import { DescriptionsSchema } from '@/types/descriptions'
const appStore = useAppStore()

View File

@@ -1,5 +1,6 @@
import Form from './src/Form.vue'
import { ElForm } from 'element-plus'
import { FormSchema, FormSetPropsType } from '@/types/form'
export interface FormExpose {
setValues: (data: Recordable) => void

View File

@@ -20,6 +20,7 @@ import { findIndex } from '@/utils'
import { set } from 'lodash-es'
import { FormProps } from './types'
import { Icon } from '@/components/Icon'
import { FormSchema, FormSetPropsType } from '@/types/form'
const { getPrefixCls } = useDesign()

View File

@@ -20,6 +20,7 @@ import {
} from 'element-plus'
import { InputPassword } from '@/components/InputPassword'
import { Editor } from '@/components/Editor'
import { ComponentName } from '@/types/components'
const componentMap: Recordable<Component, ComponentName> = {
Radio: ElRadioGroup,

View File

@@ -1,3 +1,4 @@
import { FormSchema } from '@/types/form'
import { ElCheckbox, ElCheckboxButton } from 'element-plus'
import { defineComponent } from 'vue'

View File

@@ -1,3 +1,4 @@
import { FormSchema } from '@/types/form'
import { ElRadio, ElRadioButton } from 'element-plus'
import { defineComponent } from 'vue'

View File

@@ -1,6 +1,8 @@
import { ElOption, ElOptionGroup } from 'element-plus'
import { getSlot } from '@/utils/tsxHelper'
import { Slots } from 'vue'
import { FormSchema } from '@/types/form'
import { ComponentOptions } from '@/types/components'
export const useRenderSelect = (slots: Slots) => {
// 渲染 select options

View File

@@ -2,6 +2,7 @@ import { useI18n } from '@/hooks/web/useI18n'
import type { Slots } from 'vue'
import { getSlot } from '@/utils/tsxHelper'
import { PlaceholderMoel } from './types'
import { FormSchema } from '@/types/form'
const { t } = useI18n()

View File

@@ -1,3 +1,5 @@
import { FormSchema } from '@/types/form'
export interface PlaceholderMoel {
placeholder?: string
startPlaceholder?: string

View File

@@ -1,8 +1,9 @@
<script setup lang="ts">
import { PropType } from 'vue'
import { Highlight } from '@//components/Highlight'
import { Highlight } from '@/components/Highlight'
import { useDesign } from '@/hooks/web/useDesign'
import { propTypes } from '@/utils/propTypes'
import { TipSchema } from '@/types/infoTip';
const { getPrefixCls } = useDesign()

View File

@@ -6,6 +6,7 @@ import { cloneDeep } from 'lodash-es'
import { propTypes } from '@/utils/propTypes'
import { useDesign } from '@/hooks/web/useDesign'
import { isString } from '@/utils/is'
import { QrcodeLogo } from '@/types/qrcode'
const props = defineProps({
// img 或者 canvas,img不支持logo嵌套

View File

@@ -7,6 +7,7 @@ import { useI18n } from '@/hooks/web/useI18n'
import { useForm } from '@/hooks/web/useForm'
import { findIndex } from '@/utils'
import { cloneDeep } from 'lodash-es'
import { FormSchema } from '@/types/form'
const { t } = useI18n()

View File

@@ -5,6 +5,7 @@ import { useAppStore } from '@/store/modules/app'
import { useI18n } from '@/hooks/web/useI18n'
import { propTypes } from '@/utils/propTypes'
import { useDesign } from '@/hooks/web/useDesign'
import { ElementPlusSize } from '@/types/elementPlus'
const { getPrefixCls } = useDesign()
@@ -20,7 +21,7 @@ const appStore = useAppStore()
const sizeMap = computed(() => appStore.sizeMap)
const setCurrentSize = (size: ElememtPlusSize) => {
const setCurrentSize = (size: ElementPlusSize) => {
appStore.setCurrentSize(size)
}
</script>

View File

@@ -1,5 +1,6 @@
import Table from './src/Table.vue'
import { ElTable } from 'element-plus'
import { TableSetPropsType } from '@/types/table'
export interface TableExpose {
setProps: (props: Recordable) => void

View File

@@ -6,6 +6,7 @@ import { setIndex } from './helper'
import { getSlot } from '@/utils/tsxHelper'
import type { TableProps } from './types'
import { set } from 'lodash-es'
import { TableColumn, TableSlotDefault, Pagination, TableSetPropsType } from '../../../types/table'
export default defineComponent({
name: 'Table',

View File

@@ -1,3 +1,5 @@
import { Pagination, TableColumn } from '@/types/table'
export type TableProps = {
pageSize?: number
currentPage?: number