fix: type
parent
8d280af271
commit
9abf0d8729
|
@ -5,7 +5,7 @@ import { useTabEmits, useTabProps, useTabSetup } from './useTabMixin'
|
|||
|
||||
export default defineComponent({
|
||||
name: 'YearUI',
|
||||
components: { Input, Radio, RadioGroup: Radio.Group },
|
||||
components: { AInput: Input, Radio, RadioGroup: Radio.Group },
|
||||
props: useTabProps({
|
||||
defaultValue: '*',
|
||||
}),
|
||||
|
@ -35,9 +35,9 @@ export default defineComponent({
|
|||
区间
|
||||
</Radio>
|
||||
<span> 从 </span>
|
||||
<Input v-model:value="valueRange.start" type="number" class="w80" v-bind="typeRangeAttrs" />
|
||||
<AInput v-model:value="valueRange.start" type="number" class="w80" v-bind="typeRangeAttrs" />
|
||||
<span> 年 至 </span>
|
||||
<Input v-model:value="valueRange.end" type="number" class="w80" v-bind="typeRangeAttrs" />
|
||||
<AInput v-model:value="valueRange.end" type="number" class="w80" v-bind="typeRangeAttrs" />
|
||||
<span> 年 </span>
|
||||
</div>
|
||||
<div class="item">
|
||||
|
@ -45,9 +45,9 @@ export default defineComponent({
|
|||
循环
|
||||
</Radio>
|
||||
<span> 从 </span>
|
||||
<Input v-model:value="valueLoop.start" type="number" class="w80" v-bind="typeLoopAttrs" />
|
||||
<AInput v-model:value="valueLoop.start" type="number" class="w80" v-bind="typeLoopAttrs" />
|
||||
<span> 年开始,间隔 </span>
|
||||
<Input v-model:value="valueLoop.interval" type="number" class="w80" v-bind="typeLoopAttrs" />
|
||||
<AInput v-model:value="valueLoop.interval" type="number" class="w80" v-bind="typeLoopAttrs" />
|
||||
<span> 年 </span>
|
||||
</div>
|
||||
</RadioGroup>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts" setup>
|
||||
import type { Ref } from 'vue'
|
||||
import { computed, nextTick, onMounted, reactive, ref, unref, useAttrs, watch } from 'vue'
|
||||
import { Form, Row } from 'ant-design-vue'
|
||||
import { type FormProps as AntFormProps, Form, Row } from 'ant-design-vue'
|
||||
import { useDebounceFn } from '@vueuse/core'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
import type { FormActionType, FormProps, FormSchema } from './types/form'
|
||||
|
@ -19,7 +19,6 @@ import { useAutoFocus } from './hooks/useAutoFocus'
|
|||
import { basicProps } from './props'
|
||||
import { dateUtil } from '@/utils/dateUtil'
|
||||
|
||||
// import { cloneDeep } from 'lodash-es';
|
||||
import { deepMerge } from '@/utils'
|
||||
|
||||
import { useModalContext } from '@/components/Modal'
|
||||
|
@ -43,14 +42,14 @@ const advanceState = reactive<AdvanceState>({
|
|||
|
||||
const defaultValueRef = ref<Recordable>({})
|
||||
const isInitedDefaultRef = ref(false)
|
||||
const propsRef = ref<Partial<FormProps>>({})
|
||||
const propsRef = ref<Partial<FormProps>>()
|
||||
const schemaRef = ref<Nullable<FormSchema[]>>(null)
|
||||
const formElRef = ref<Nullable<FormActionType>>(null)
|
||||
|
||||
const { prefixCls } = useDesign('basic-form')
|
||||
|
||||
// Get the basic configuration of the form
|
||||
const getProps = computed((): FormProps => {
|
||||
const getProps = computed(() => {
|
||||
return { ...props, ...unref(propsRef) } as FormProps
|
||||
})
|
||||
|
||||
|
@ -72,7 +71,9 @@ const getRow = computed((): Recordable => {
|
|||
}
|
||||
})
|
||||
|
||||
const getBindValue = computed(() => ({ ...attrs, ...props, ...unref(getProps) }) as Recordable)
|
||||
const getBindValue = computed(
|
||||
() => ({ ...attrs, ...props, ...unref(getProps) }) as AntFormProps,
|
||||
)
|
||||
|
||||
const getSchema = computed((): FormSchema[] => {
|
||||
const schemas: FormSchema[] = unref(schemaRef) || (unref(getProps).schemas as any)
|
||||
|
@ -214,7 +215,7 @@ function setFormModel(key: string, value: any, schema: FormSchema) {
|
|||
emit('field-value-change', key, value)
|
||||
// TODO 优化验证,这里如果是autoLink=false手动关联的情况下才会再次触发此函数
|
||||
if (schema && schema.itemProps && !schema.itemProps.autoLink)
|
||||
validateFields([key]).catch((_) => {})
|
||||
validateFields([key]).catch((_) => { })
|
||||
}
|
||||
|
||||
function handleEnterPress(e: KeyboardEvent) {
|
||||
|
@ -249,7 +250,7 @@ onMounted(() => {
|
|||
emit('register', formActionType)
|
||||
})
|
||||
|
||||
const getFormActionBindProps = computed((): Recordable => ({ ...getProps.value, ...advanceState }))
|
||||
const getFormActionBindProps = computed(() => ({ ...getProps.value, ...advanceState }) as InstanceType<typeof FormAction>['$props'])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -258,14 +259,9 @@ const getFormActionBindProps = computed((): Recordable => ({ ...getProps.value,
|
|||
<slot name="formHeader" />
|
||||
<template v-for="schema in getSchema" :key="schema.field">
|
||||
<FormItem
|
||||
:is-advanced="fieldsIsAdvancedMap[schema.field]"
|
||||
:table-action="tableAction"
|
||||
:form-action-type="formActionType as any"
|
||||
:schema="schema"
|
||||
:form-props="getProps"
|
||||
:all-default-values="defaultValueRef"
|
||||
:form-model="formModel"
|
||||
:set-form-model="setFormModel"
|
||||
:is-advanced="fieldsIsAdvancedMap[schema.field]" :table-action="tableAction"
|
||||
:form-action-type="formActionType as any" :schema="schema" :form-props="getProps"
|
||||
:all-default-values="defaultValueRef" :form-model="formModel" :set-form-model="setFormModel"
|
||||
>
|
||||
<template v-for="item in Object.keys($slots)" #[item]="data">
|
||||
<slot :name="item" v-bind="data || {}" />
|
||||
|
|
|
@ -89,7 +89,7 @@ async function fetch() {
|
|||
if (!isArray(result))
|
||||
result = get(result, props.resultField)
|
||||
|
||||
treeData.value = (result as DataNode[]) || []
|
||||
treeData.value = (result as (Recordable & { key: string | number })[]) || []
|
||||
isFirstLoaded.value = true
|
||||
emit('optionsChange', treeData.value)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ export default defineComponent({
|
|||
name: 'VFormCreate',
|
||||
components: {
|
||||
FormRender,
|
||||
Form,
|
||||
AntForm: Form,
|
||||
Row,
|
||||
},
|
||||
props: {
|
||||
|
@ -119,7 +119,7 @@ export default defineComponent({
|
|||
|
||||
<template>
|
||||
<div class="v-form-container">
|
||||
<Form ref="eFormModel" class="overflow-hidden" :model="formModel" v-bind="formModelProps">
|
||||
<AntForm ref="eFormModel" class="overflow-hidden" :model="formModel" v-bind="formModelProps">
|
||||
<Row>
|
||||
<FormRender
|
||||
v-for="(schema, index) of noHiddenList"
|
||||
|
@ -140,6 +140,6 @@ export default defineComponent({
|
|||
</template>
|
||||
</FormRender>
|
||||
</Row>
|
||||
</Form>
|
||||
</AntForm>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -26,7 +26,7 @@ const spinRef = ref<ElRef>(null)
|
|||
const realHeightRef = ref(0)
|
||||
const minRealHeightRef = ref(0)
|
||||
|
||||
const realHeight = ref(0);
|
||||
const realHeight = ref(0)
|
||||
|
||||
const stopElResizeFn: Fn = () => {}
|
||||
|
||||
|
@ -141,7 +141,7 @@ defineExpose({ scrollTop })
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<ScrollContainer ref="wrapperRef" :scrollHeight="realHeight">
|
||||
<ScrollContainer ref="wrapperRef" :scroll-height="realHeight">
|
||||
<div ref="spinRef" v-loading="loading" :style="spinStyle" :loading-tip="loadingTip">
|
||||
<slot />
|
||||
</div>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { FunctionalComponent, defineComponent } from 'vue'
|
||||
import type { defineComponent } from 'vue'
|
||||
import { Popover } from 'ant-design-vue'
|
||||
import { h } from 'vue'
|
||||
import type { ComponentType } from '../../types/componentType'
|
||||
|
@ -12,10 +12,8 @@ export interface ComponentProps {
|
|||
getPopupContainer?: Fn
|
||||
}
|
||||
|
||||
export const CellComponent: FunctionalComponent = (
|
||||
{ component = 'Input', rule = true, ruleMessage, popoverOpen, getPopupContainer }: ComponentProps,
|
||||
{ attrs },
|
||||
) => {
|
||||
export function CellComponent({ component = 'Input', rule = true, ruleMessage, popoverOpen, getPopupContainer }: ComponentProps,
|
||||
{ attrs }) {
|
||||
const Comp = componentMap.get(component) as typeof defineComponent
|
||||
|
||||
const DefaultComp = h(Comp, attrs)
|
||||
|
|
|
@ -273,8 +273,10 @@ function getUploadingImgName(name: string) {
|
|||
|
||||
<template>
|
||||
<div :class="prefixCls" :style="{ width: containerWidth }">
|
||||
<ImgUpload v-if="showImageUpload" v-show="editorRef" :fullscreen="fullscreen" :disabled="disabled"
|
||||
@uploading="handleImageUploading" @done="handleDone" />
|
||||
<ImgUpload
|
||||
v-if="showImageUpload" v-show="editorRef" :fullscreen="fullscreen" :disabled="disabled"
|
||||
@uploading="handleImageUploading" @done="handleDone"
|
||||
/>
|
||||
<textarea v-if="!initOptions.inline" :id="tinymceId" ref="elRef" :style="{ visibility: 'hidden' }" />
|
||||
<slot v-else />
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<script lang="ts" setup>
|
||||
import { computed, ref, useSlots, watch } from 'vue'
|
||||
import type { MenuProps } from 'ant-design-vue'
|
||||
import { Dropdown, InputSearch, Menu, MenuDivider } from 'ant-design-vue'
|
||||
import { useDebounceFn } from '@vueuse/core'
|
||||
import { ToolbarEnum } from '../types/tree'
|
||||
|
@ -108,8 +109,7 @@ const toolbarList = computed(() => {
|
|||
return checkable ? retList : defaultToolbarList
|
||||
})
|
||||
|
||||
function handleMenuClick(e) {
|
||||
const { key } = e
|
||||
const handleMenuClick: MenuProps['onClick'] = ({ key }) => {
|
||||
switch (key) {
|
||||
case ToolbarEnum.SELECT_ALL:
|
||||
props.checkAll?.(true)
|
||||
|
|
Loading…
Reference in New Issue