Commit 08df198710ff597af2cbffa2afbb3a6ca13a1d63
1 parent
3b126e01
fix(form): form-item style error
Showing
8 changed files
with
44 additions
and
91 deletions
src/components/Form/src/BasicForm.vue
@@ -53,7 +53,6 @@ | @@ -53,7 +53,6 @@ | ||
53 | export default defineComponent({ | 53 | export default defineComponent({ |
54 | name: 'BasicForm', | 54 | name: 'BasicForm', |
55 | components: { FormItem, Form, Row, FormAction }, | 55 | components: { FormItem, Form, Row, FormAction }, |
56 | - inheritAttrs: false, | ||
57 | props: basicProps, | 56 | props: basicProps, |
58 | emits: ['advanced-change', 'reset', 'submit', 'register'], | 57 | emits: ['advanced-change', 'reset', 'submit', 'register'], |
59 | setup(props, { emit }) { | 58 | setup(props, { emit }) { |
@@ -279,7 +278,7 @@ | @@ -279,7 +278,7 @@ | ||
279 | 278 | ||
280 | &--compact { | 279 | &--compact { |
281 | .ant-form-item { | 280 | .ant-form-item { |
282 | - margin-bottom: 8px; | 281 | + margin-bottom: 8px !important; |
283 | } | 282 | } |
284 | } | 283 | } |
285 | } | 284 | } |
src/components/Form/src/components/FormAction.vue
@@ -55,7 +55,7 @@ | @@ -55,7 +55,7 @@ | ||
55 | export default defineComponent({ | 55 | export default defineComponent({ |
56 | name: 'BasicFormAction', | 56 | name: 'BasicFormAction', |
57 | components: { | 57 | components: { |
58 | - FormItem: Form, | 58 | + FormItem: Form.Item, |
59 | Button, | 59 | Button, |
60 | BasicArrow, | 60 | BasicArrow, |
61 | }, | 61 | }, |
src/components/Form/src/components/FormItem.tsx
@@ -97,7 +97,7 @@ export default defineComponent({ | @@ -97,7 +97,7 @@ export default defineComponent({ | ||
97 | return disabled; | 97 | return disabled; |
98 | }); | 98 | }); |
99 | 99 | ||
100 | - const getShow = computed(() => { | 100 | + function getShow() { |
101 | const { show, ifShow } = props.schema; | 101 | const { show, ifShow } = props.schema; |
102 | const { showAdvancedButton } = props.formProps; | 102 | const { showAdvancedButton } = props.formProps; |
103 | const itemIsAdvanced = showAdvancedButton | 103 | const itemIsAdvanced = showAdvancedButton |
@@ -122,7 +122,7 @@ export default defineComponent({ | @@ -122,7 +122,7 @@ export default defineComponent({ | ||
122 | } | 122 | } |
123 | isShow = isShow && itemIsAdvanced; | 123 | isShow = isShow && itemIsAdvanced; |
124 | return { isShow, isIfShow }; | 124 | return { isShow, isIfShow }; |
125 | - }); | 125 | + } |
126 | 126 | ||
127 | function handleRules(): ValidationRule[] { | 127 | function handleRules(): ValidationRule[] { |
128 | const { | 128 | const { |
@@ -310,7 +310,7 @@ export default defineComponent({ | @@ -310,7 +310,7 @@ export default defineComponent({ | ||
310 | const { baseColProps = {} } = props.formProps; | 310 | const { baseColProps = {} } = props.formProps; |
311 | 311 | ||
312 | const realColProps = { ...baseColProps, ...colProps }; | 312 | const realColProps = { ...baseColProps, ...colProps }; |
313 | - const { isIfShow, isShow } = unref(getShow); | 313 | + const { isIfShow, isShow } = getShow(); |
314 | 314 | ||
315 | const getContent = () => { | 315 | const getContent = () => { |
316 | return colSlot | 316 | return colSlot |
src/components/Form/src/hooks/useFormEvents.ts
@@ -178,11 +178,12 @@ export function useFormEvents({ | @@ -178,11 +178,12 @@ export function useFormEvents({ | ||
178 | } | 178 | } |
179 | 179 | ||
180 | async function validateFields(nameList?: NamePath[] | undefined) { | 180 | async function validateFields(nameList?: NamePath[] | undefined) { |
181 | - return await unref(formElRef)?.validateFields(nameList); | 181 | + const res = await unref(formElRef)?.validateFields(nameList || []); |
182 | + return res; | ||
182 | } | 183 | } |
183 | 184 | ||
184 | async function validate(nameList?: NamePath[] | undefined) { | 185 | async function validate(nameList?: NamePath[] | undefined) { |
185 | - return await unref(formElRef)?.validate(nameList); | 186 | + return await unref(formElRef)?.validate(nameList || []); |
186 | } | 187 | } |
187 | 188 | ||
188 | async function clearValidate(name?: string | string[]) { | 189 | async function clearValidate(name?: string | string[]) { |
src/components/Markdown/src/index.vue
@@ -75,7 +75,9 @@ | @@ -75,7 +75,9 @@ | ||
75 | onUnmounted(() => { | 75 | onUnmounted(() => { |
76 | const vditorInstance = unref(vditorRef); | 76 | const vditorInstance = unref(vditorRef); |
77 | if (!vditorInstance) return; | 77 | if (!vditorInstance) return; |
78 | - vditorInstance?.destroy?.(); | 78 | + try { |
79 | + vditorInstance?.destroy?.(); | ||
80 | + } catch (error) {} | ||
79 | }); | 81 | }); |
80 | 82 | ||
81 | return { | 83 | return { |
src/components/Table/src/BasicTable.vue
@@ -80,14 +80,13 @@ | @@ -80,14 +80,13 @@ | ||
80 | const innerPropsRef = ref<Partial<BasicTableProps>>(); | 80 | const innerPropsRef = ref<Partial<BasicTableProps>>(); |
81 | const [registerForm, { getFieldsValue }] = useForm(); | 81 | const [registerForm, { getFieldsValue }] = useForm(); |
82 | 82 | ||
83 | - const getMergeProps = computed( | ||
84 | - (): BasicTableProps => { | ||
85 | - return { | ||
86 | - ...props, | ||
87 | - ...unref(innerPropsRef), | ||
88 | - } as BasicTableProps; | ||
89 | - } | ||
90 | - ); | 83 | + const getMergeProps = computed(() => { |
84 | + return { | ||
85 | + ...props, | ||
86 | + ...unref(innerPropsRef), | ||
87 | + } as BasicTableProps; | ||
88 | + }); | ||
89 | + | ||
91 | const { loadingRef } = useLoading(getMergeProps); | 90 | const { loadingRef } = useLoading(getMergeProps); |
92 | const { getPaginationRef, setPagination } = usePagination(getMergeProps); | 91 | const { getPaginationRef, setPagination } = usePagination(getMergeProps); |
93 | const { getColumnsRef, setColumns } = useColumns(getMergeProps, getPaginationRef); | 92 | const { getColumnsRef, setColumns } = useColumns(getMergeProps, getPaginationRef); |
@@ -123,7 +122,7 @@ | @@ -123,7 +122,7 @@ | ||
123 | getMergeProps | 122 | getMergeProps |
124 | ); | 123 | ); |
125 | const hideTitle = !slots.tableTitle && !title && !slots.toolbar && !showTableSetting; | 124 | const hideTitle = !slots.tableTitle && !title && !slots.toolbar && !showTableSetting; |
126 | - const titleData: any = | 125 | + const titleData: Recordable = |
127 | hideTitle && !isString(title) | 126 | hideTitle && !isString(title) |
128 | ? {} | 127 | ? {} |
129 | : { | 128 | : { |
@@ -313,6 +312,7 @@ | @@ -313,6 +312,7 @@ | ||
313 | useExpose<TableActionType>(tableAction); | 312 | useExpose<TableActionType>(tableAction); |
314 | 313 | ||
315 | emit('register', tableAction); | 314 | emit('register', tableAction); |
315 | + | ||
316 | return { | 316 | return { |
317 | tableElRef, | 317 | tableElRef, |
318 | getBindValues, | 318 | getBindValues, |
src/components/Table/src/props.ts
@@ -10,51 +10,31 @@ import type { | @@ -10,51 +10,31 @@ import type { | ||
10 | } from './types/table'; | 10 | } from './types/table'; |
11 | import type { FormProps } from '/@/components/Form'; | 11 | import type { FormProps } from '/@/components/Form'; |
12 | import { DEFAULT_SORT_FN, FETCH_SETTING } from './const'; | 12 | import { DEFAULT_SORT_FN, FETCH_SETTING } from './const'; |
13 | +import { propTypes } from '/@/utils/propTypes'; | ||
13 | 14 | ||
14 | // ๆณจ้็ types/table | 15 | // ๆณจ้็ types/table |
15 | export const basicProps = { | 16 | export const basicProps = { |
16 | tableSetting: { | 17 | tableSetting: { |
17 | type: Object as PropType<TableSetting>, | 18 | type: Object as PropType<TableSetting>, |
18 | }, | 19 | }, |
19 | - inset: { | ||
20 | - type: Boolean as PropType<boolean>, | ||
21 | - default: false, | ||
22 | - }, | 20 | + inset: propTypes.bool, |
23 | sortFn: { | 21 | sortFn: { |
24 | type: Function as PropType<(sortInfo: SorterResult) => any>, | 22 | type: Function as PropType<(sortInfo: SorterResult) => any>, |
25 | default: DEFAULT_SORT_FN, | 23 | default: DEFAULT_SORT_FN, |
26 | }, | 24 | }, |
27 | 25 | ||
28 | - showTableSetting: { | ||
29 | - type: Boolean as PropType<boolean>, | ||
30 | - default: false, | ||
31 | - }, | ||
32 | - autoCreateKey: { | ||
33 | - type: Boolean as PropType<boolean>, | ||
34 | - default: true, | ||
35 | - }, | ||
36 | - striped: { | ||
37 | - type: Boolean as PropType<boolean>, | ||
38 | - default: true, | ||
39 | - }, | ||
40 | - showSummary: { | ||
41 | - type: Boolean as PropType<boolean>, | ||
42 | - default: false, | ||
43 | - }, | 26 | + showTableSetting: propTypes.bool, |
27 | + autoCreateKey: propTypes.bool.def(true), | ||
28 | + striped: propTypes.bool.def(true), | ||
29 | + showSummary: propTypes.bool, | ||
44 | 30 | ||
45 | summaryFunc: { | 31 | summaryFunc: { |
46 | type: [Function, Array] as PropType<(...arg: any[]) => any[]>, | 32 | type: [Function, Array] as PropType<(...arg: any[]) => any[]>, |
47 | default: null, | 33 | default: null, |
48 | }, | 34 | }, |
49 | 35 | ||
50 | - canColDrag: { | ||
51 | - type: Boolean as PropType<boolean>, | ||
52 | - default: true, | ||
53 | - }, | ||
54 | - isTreeTable: { | ||
55 | - type: Boolean as PropType<boolean>, | ||
56 | - default: false, | ||
57 | - }, | 36 | + canColDrag: propTypes.bool.def(true), |
37 | + isTreeTable: propTypes.bool, | ||
58 | api: { | 38 | api: { |
59 | type: Function as PropType<(...arg: any[]) => Promise<any>>, | 39 | type: Function as PropType<(...arg: any[]) => Promise<any>>, |
60 | default: null, | 40 | default: null, |
@@ -78,22 +58,16 @@ export const basicProps = { | @@ -78,22 +58,16 @@ export const basicProps = { | ||
78 | }, | 58 | }, |
79 | }, | 59 | }, |
80 | // ็ซๅณ่ฏทๆฑๆฅๅฃ | 60 | // ็ซๅณ่ฏทๆฑๆฅๅฃ |
81 | - immediate: { type: Boolean as PropType<boolean>, default: true }, | 61 | + immediate: propTypes.bool.def(true), |
82 | 62 | ||
83 | - emptyDataIsShowTable: { | ||
84 | - type: Boolean as PropType<boolean>, | ||
85 | - default: true, | ||
86 | - }, | 63 | + emptyDataIsShowTable: propTypes.bool.def(true), |
87 | // ้ขๅค็่ฏทๆฑๅๆฐ | 64 | // ้ขๅค็่ฏทๆฑๅๆฐ |
88 | searchInfo: { | 65 | searchInfo: { |
89 | type: Object as PropType<any>, | 66 | type: Object as PropType<any>, |
90 | default: null, | 67 | default: null, |
91 | }, | 68 | }, |
92 | // ไฝฟ็จๆ็ดข่กจๅ | 69 | // ไฝฟ็จๆ็ดข่กจๅ |
93 | - useSearchForm: { | ||
94 | - type: Boolean as PropType<boolean>, | ||
95 | - default: false, | ||
96 | - }, | 70 | + useSearchForm: propTypes.bool, |
97 | // ่กจๅ้ ็ฝฎ | 71 | // ่กจๅ้ ็ฝฎ |
98 | formConfig: { | 72 | formConfig: { |
99 | type: Object as PropType<Partial<FormProps>>, | 73 | type: Object as PropType<Partial<FormProps>>, |
@@ -103,10 +77,7 @@ export const basicProps = { | @@ -103,10 +77,7 @@ export const basicProps = { | ||
103 | type: [Array] as PropType<BasicColumn[]>, | 77 | type: [Array] as PropType<BasicColumn[]>, |
104 | default: null, | 78 | default: null, |
105 | }, | 79 | }, |
106 | - showIndexColumn: { | ||
107 | - type: Boolean as PropType<boolean>, | ||
108 | - default: true, | ||
109 | - }, | 80 | + showIndexColumn: propTypes.bool.def(true), |
110 | indexColumnProps: { | 81 | indexColumnProps: { |
111 | type: Object as PropType<BasicColumn>, | 82 | type: Object as PropType<BasicColumn>, |
112 | default: null, | 83 | default: null, |
@@ -115,22 +86,10 @@ export const basicProps = { | @@ -115,22 +86,10 @@ export const basicProps = { | ||
115 | type: Object as PropType<BasicColumn>, | 86 | type: Object as PropType<BasicColumn>, |
116 | default: null, | 87 | default: null, |
117 | }, | 88 | }, |
118 | - ellipsis: { | ||
119 | - type: Boolean as PropType<boolean>, | ||
120 | - default: true, | ||
121 | - }, | ||
122 | - canResize: { | ||
123 | - type: Boolean as PropType<boolean>, | ||
124 | - default: true, | ||
125 | - }, | ||
126 | - clearSelectOnPageChange: { | ||
127 | - type: Boolean as PropType<boolean>, | ||
128 | - default: false, | ||
129 | - }, | ||
130 | - resizeHeightOffset: { | ||
131 | - type: Number as PropType<number>, | ||
132 | - default: 0, | ||
133 | - }, | 89 | + ellipsis: propTypes.bool.def(true), |
90 | + canResize: propTypes.bool.def(true), | ||
91 | + clearSelectOnPageChange: propTypes.bool, | ||
92 | + resizeHeightOffset: propTypes.number.def(0), | ||
134 | rowSelection: { | 93 | rowSelection: { |
135 | type: Object as PropType<TableRowSelection | null>, | 94 | type: Object as PropType<TableRowSelection | null>, |
136 | default: null, | 95 | default: null, |
@@ -142,30 +101,22 @@ export const basicProps = { | @@ -142,30 +101,22 @@ export const basicProps = { | ||
142 | titleHelpMessage: { | 101 | titleHelpMessage: { |
143 | type: [String, Array] as PropType<string | string[]>, | 102 | type: [String, Array] as PropType<string | string[]>, |
144 | }, | 103 | }, |
145 | - maxHeight: { | ||
146 | - type: Number as PropType<number>, | ||
147 | - }, | 104 | + maxHeight: propTypes.number, |
148 | dataSource: { | 105 | dataSource: { |
149 | - type: Array as PropType<any[]>, | 106 | + type: Array as PropType<Recordable[]>, |
150 | default: null, | 107 | default: null, |
151 | }, | 108 | }, |
152 | rowKey: { | 109 | rowKey: { |
153 | - type: [String, Function] as PropType<string | ((record: any) => string)>, | 110 | + type: [String, Function] as PropType<string | ((record: Recordable) => string)>, |
154 | default: '', | 111 | default: '', |
155 | }, | 112 | }, |
156 | - bordered: { | ||
157 | - type: Boolean as PropType<boolean>, | ||
158 | - default: false, | ||
159 | - }, | 113 | + bordered: propTypes.bool, |
160 | pagination: { | 114 | pagination: { |
161 | type: [Object, Boolean] as PropType<PaginationProps | boolean>, | 115 | type: [Object, Boolean] as PropType<PaginationProps | boolean>, |
162 | default: null, | 116 | default: null, |
163 | }, | 117 | }, |
164 | 118 | ||
165 | - loading: { | ||
166 | - type: Boolean as PropType<boolean>, | ||
167 | - default: false, | ||
168 | - }, | 119 | + loading: propTypes.bool, |
169 | rowClassName: { | 120 | rowClassName: { |
170 | type: Function as PropType<(record: TableCustomRecord<any>, index: number) => string>, | 121 | type: Function as PropType<(record: TableCustomRecord<any>, index: number) => string>, |
171 | }, | 122 | }, |
src/components/Table/src/types/tableAction.ts
1 | import { ButtonProps } from 'ant-design-vue/es/button/buttonTypes'; | 1 | import { ButtonProps } from 'ant-design-vue/es/button/buttonTypes'; |
2 | export interface ActionItem extends ButtonProps { | 2 | export interface ActionItem extends ButtonProps { |
3 | - onClick?: any; | 3 | + onClick?: Fn; |
4 | label: string; | 4 | label: string; |
5 | color?: 'success' | 'error' | 'warning'; | 5 | color?: 'success' | 'error' | 'warning'; |
6 | icon?: string; | 6 | icon?: string; |
@@ -11,7 +11,7 @@ export interface PopConfirm { | @@ -11,7 +11,7 @@ export interface PopConfirm { | ||
11 | title: string; | 11 | title: string; |
12 | okText?: string; | 12 | okText?: string; |
13 | cancelText?: string; | 13 | cancelText?: string; |
14 | - confirm: any; | ||
15 | - cancel?: any; | 14 | + confirm: Fn; |
15 | + cancel?: Fn; | ||
16 | icon?: string; | 16 | icon?: string; |
17 | } | 17 | } |