chore: fix type:check error (#3126)
* chore: Fix ts type error
* chore: fix type:check error
| | |
| | | /** |
| | | * 字符串类型对象 |
| | | */ |
| | | type Recordable<T> = Record<string, T>; |
| | | type Recordable<T = any> = Record<string, T>; |
| | | |
| | | /** |
| | | * 字符串类型对象(只读) |
| | |
| | | import type { Ref } from 'vue'; |
| | | |
| | | import { defineComponent, reactive, ref, computed, unref, onMounted, watch, nextTick } from 'vue'; |
| | | import { Form, Row } from 'ant-design-vue'; |
| | | import { Form, Row, type FormProps as AntFormProps } from 'ant-design-vue'; |
| | | import FormItem from './components/FormItem.vue'; |
| | | import FormAction from './components/FormAction.vue'; |
| | | |
| | |
| | | }; |
| | | }); |
| | | |
| | | const getBindValue = computed(() => ({ ...attrs, ...props, ...unref(getProps) })); |
| | | const getBindValue = computed( |
| | | () => ({ ...attrs, ...props, ...unref(getProps) }) as AntFormProps, |
| | | ); |
| | | |
| | | const getSchema = computed((): FormSchema[] => { |
| | | const schemas: FormSchema[] = unref(schemaRef) || (unref(getProps).schemas as any); |
| | |
| | | formActionType: formActionType as any, |
| | | setFormModel, |
| | | getFormClass, |
| | | getFormActionBindProps: computed(() => ({ ...getProps.value, ...advanceState })), |
| | | getFormActionBindProps: computed( |
| | | () => |
| | | ({ ...getProps.value, ...advanceState }) as InstanceType<typeof FormAction>['$props'], |
| | | ), |
| | | fieldsIsAdvancedMap, |
| | | ...formActionType, |
| | | }; |
| | |
| | | if (!isArray(result)) { |
| | | result = get(result, props.resultField); |
| | | } |
| | | treeData.value = (result as Recordable<any>[]) || []; |
| | | treeData.value = (result as (Recordable & { key: string | number })[]) || []; |
| | | isFirstLoaded.value = true; |
| | | emit('options-change', treeData.value); |
| | | } |
| | |
| | | import type { FunctionalComponent, defineComponent } from 'vue'; |
| | | import type { defineComponent } from 'vue'; |
| | | import type { ComponentType } from '../../types/componentType'; |
| | | import { componentMap } from '/@/components/Table/src/componentMap'; |
| | | |
| | |
| | | getPopupContainer?: Fn; |
| | | } |
| | | |
| | | export const CellComponent: FunctionalComponent = ( |
| | | export const CellComponent = ( |
| | | { |
| | | component = 'Input', |
| | | rule = true, |
| | |
| | | }, |
| | | }, |
| | | setup(props, { slots, attrs }) { |
| | | const onBeforeEnter = (el: HTMLElement) => { |
| | | el.style.transformOrigin = props.origin; |
| | | const onBeforeEnter = (el: Element) => { |
| | | (el as HTMLElement).style.transformOrigin = props.origin; |
| | | }; |
| | | |
| | | return () => { |
| | |
| | | import type { VNode, FunctionalComponent } from 'vue'; |
| | | import type { VNode } from 'vue'; |
| | | import { h } from 'vue'; |
| | | import { isString } from 'lodash-es'; |
| | | import Icon from '@/components/Icon/Icon.vue'; |
| | | |
| | | export const TreeIcon: FunctionalComponent = ({ icon }: { icon: VNode | string }) => { |
| | | export const TreeIcon = ({ icon }: { icon: VNode | string }) => { |
| | | if (!icon) return null; |
| | | if (isString(icon)) { |
| | | return h(Icon, { icon, class: 'mr-1' }); |
| | |
| | | </template> |
| | | <script lang="ts" setup> |
| | | import { type PropType, computed, ref, watch, useSlots } from 'vue'; |
| | | import { Dropdown, Menu, MenuItem, MenuDivider, InputSearch } from 'ant-design-vue'; |
| | | import { |
| | | Dropdown, |
| | | Menu, |
| | | MenuItem, |
| | | MenuDivider, |
| | | InputSearch, |
| | | type MenuProps, |
| | | } from 'ant-design-vue'; |
| | | import Icon from '@/components/Icon/Icon.vue'; |
| | | import { BasicTitle } from '/@/components/Basic'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | |
| | | : defaultToolbarList; |
| | | }); |
| | | |
| | | function handleMenuClick(e: { key: ToolbarEnum }) { |
| | | const { key } = e; |
| | | const handleMenuClick: MenuProps['onClick'] = ({ key }) => { |
| | | switch (key) { |
| | | case ToolbarEnum.SELECT_ALL: |
| | | props.checkAll?.(true); |
| | |
| | | emit('strictly-change', true); |
| | | break; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | function emitChange(value?: string): void { |
| | | emit('search', value); |
| | |
| | | <script lang="ts"> |
| | | import { defineComponent, PropType, computed } from 'vue'; |
| | | |
| | | import { Select } from 'ant-design-vue'; |
| | | import { Select, type SelectProps } from 'ant-design-vue'; |
| | | import { useDesign } from '/@/hooks/web/useDesign'; |
| | | import { baseHandler } from '../handler'; |
| | | import { HandlerEnum } from '../enum'; |
| | |
| | | return props.def ? { value: props.def, defaultValue: props.initValue || props.def } : {}; |
| | | }); |
| | | |
| | | function handleChange(e: ChangeEvent) { |
| | | props.event && baseHandler(props.event, e); |
| | | } |
| | | const handleChange: SelectProps['onChange'] = (val) => { |
| | | props.event && baseHandler(props.event, val); |
| | | }; |
| | | |
| | | return { |
| | | prefixCls, |
| | | handleChange, |
| | |
| | | <script lang="ts"> |
| | | import { defineComponent, PropType, computed } from 'vue'; |
| | | |
| | | import { Switch } from 'ant-design-vue'; |
| | | import { Switch, type SwitchProps } from 'ant-design-vue'; |
| | | import { useDesign } from '/@/hooks/web/useDesign'; |
| | | import { useI18n } from '/@/hooks/web/useI18n'; |
| | | import { baseHandler } from '../handler'; |
| | |
| | | const getBindValue = computed(() => { |
| | | return props.def ? { checked: props.def } : {}; |
| | | }); |
| | | function handleChange(e: ChangeEvent) { |
| | | props.event && baseHandler(props.event, e); |
| | | } |
| | | |
| | | const handleChange: SwitchProps['onChange'] = (val) => { |
| | | props.event && baseHandler(props.event, val); |
| | | }; |
| | | |
| | | return { |
| | | prefixCls, |
| | | t, |
| | |
| | | import { defineComponent, ref, unref, h } from 'vue'; |
| | | import { CodeEditor, JsonPreview, MODE } from '/@/components/CodeEditor'; |
| | | import { PageWrapper } from '/@/components/Page'; |
| | | import { Radio, Space, Modal } from 'ant-design-vue'; |
| | | import { Radio, Space, Modal, type RadioGroupProps } from 'ant-design-vue'; |
| | | |
| | | const jsonData = |
| | | '{"name":"BeJson","url":"http://www.xxx.com","page":88,"isNonProfit":true,"address":{"street":"科技园路.","city":"江苏苏州","country":"中国"},"links":[{"name":"Google","url":"http://www.xxx.com"},{"name":"Baidu","url":"http://www.xxx.com"},{"name":"SoSo","url":"http://www.xxx.com"}]}'; |
| | |
| | | const modeValue = ref<MODE>(MODE.JSON); |
| | | const value = ref(jsonData); |
| | | |
| | | function handleModeChange(e: ChangeEvent) { |
| | | const handleModeChange: RadioGroupProps['onChange'] = (e) => { |
| | | const mode = e.target.value; |
| | | if (mode === MODE.JSON) { |
| | | value.value = jsonData; |
| | |
| | | value.value = jsData; |
| | | return; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | function showData() { |
| | | if (unref(modeValue) === 'application/json') { |
| | |
| | | import { optionsListApi } from '/@/api/demo/select'; |
| | | import { useDebounceFn } from '@vueuse/core'; |
| | | import { treeOptionsListApi } from '/@/api/demo/tree'; |
| | | import { Select } from 'ant-design-vue'; |
| | | import { Select, type SelectProps } from 'ant-design-vue'; |
| | | import { cloneDeep } from 'lodash-es'; |
| | | import { areaRecord } from '/@/api/demo/cascader'; |
| | | import { uploadApi } from '/@/api/sys/upload'; |
| | | |
| | | const valueSelectA = ref<string[]>([]); |
| | | const valueSelectB = ref<string[]>([]); |
| | | const options = ref<Recordable[]>([]); |
| | | const options = ref<Required<SelectProps>['options']>([]); |
| | | for (let i = 1; i < 10; i++) options.value.push({ label: '选项' + i, value: `${i}` }); |
| | | |
| | | const optionsA = computed(() => { |
| | | return cloneDeep(unref(options)).map((op) => { |
| | | op.disabled = unref(valueSelectB).indexOf(op.value) !== -1; |
| | | op.disabled = unref(valueSelectB).indexOf(op.value as string) !== -1; |
| | | return op; |
| | | }); |
| | | }); |
| | | const optionsB = computed(() => { |
| | | return cloneDeep(unref(options)).map((op) => { |
| | | op.disabled = unref(valueSelectA).indexOf(op.value) !== -1; |
| | | op.disabled = unref(valueSelectA).indexOf(op.value as string) !== -1; |
| | | return op; |
| | | }); |
| | | }); |
| | |
| | | const check = ref(null); |
| | | const { createMessage } = useMessage(); |
| | | const keyword = ref<string>(''); |
| | | const searchParams = computed<Recordable>(() => { |
| | | const searchParams = computed<Recordable<string>>(() => { |
| | | return { keyword: unref(keyword) }; |
| | | }); |
| | | |
| | |
| | | </BasicTable> |
| | | </template> |
| | | <script lang="ts"> |
| | | import { defineComponent, ref } from 'vue'; |
| | | import { defineComponent, ref, unref } from 'vue'; |
| | | import { BasicTable, useTable } from '/@/components/Table'; |
| | | import { getBasicColumns, getFormConfig } from './tableData'; |
| | | import { Alert } from 'ant-design-vue'; |
| | |
| | | rowKey: 'id', |
| | | rowSelection: { |
| | | type: 'checkbox', |
| | | selectedRowKeys: checkedKeys, |
| | | selectedRowKeys: unref(checkedKeys), |
| | | onSelect: onSelect, |
| | | onSelectAll: onSelectAll, |
| | | }, |
| | |
| | | [key: string]: string | number | boolean; |
| | | }[]; |
| | | |
| | | declare type EmitType = (event: string, ...args: any[]) => void; |
| | | declare type EmitType = ReturnType<typeof defineEmits>; |
| | | |
| | | declare type TargetContext = '_self' | '_blank'; |
| | | |