From 61900b1f71f4c9048cbc48ed6f4b41ccfa1a6ce4 Mon Sep 17 00:00:00 2001 From: yyg1378265336 <1378265336@qq.com> Date: 星期三, 26 二月 2025 09:16:16 +0800 Subject: [PATCH] 工具属性、工具信息页面初次编写 --- src/components/Upload/src/props.ts | 74 ++++++++++++++++++++++++++++++++++-- 1 files changed, 69 insertions(+), 5 deletions(-) diff --git a/src/components/Upload/src/props.ts b/src/components/Upload/src/props.ts index d37f68b..d26ca54 100644 --- a/src/components/Upload/src/props.ts +++ b/src/components/Upload/src/props.ts @@ -1,7 +1,46 @@ import type { PropType } from 'vue'; -import { FileBasicColumn } from './typing'; +import { BaseFileItem, FileBasicColumn } from './types/typing'; + +import type { Options } from 'sortablejs'; + +import { Merge } from '@/utils/types'; +import { propTypes } from '@/utils/propTypes'; +import { BasicColumn } from '@/components/Table'; + +type SortableOptions = Merge< + Omit<Options, 'onEnd'>, + { + onAfterEnd?: <T = any, R = any>(params: T) => R; + // ...鍙墿灞� + } +>; +export type handleFnKey = "record" | "valueKey" | "uidKey" +export type previewColumnsFnType = { + handleRemove: (record: Record<handleFnKey, any>) => any; + handleAdd: (record: Record<handleFnKey, any>) => any; +}; +export const previewType = { + previewColumns: { + type: [Array, Function] as PropType< + BasicColumn[] | ((arg: previewColumnsFnType) => BasicColumn[]) + >, + required: false, + }, + beforePreviewData: { + type: Function as PropType<(arg: BaseFileItem[] | any) => Recordable<any>>, + default: null, + required: false, + }, +}; + +type ListType = 'text' | 'picture' | 'picture-card'; export const basicProps = { + disabled: { type: Boolean, default: false }, + listType: { + type: String as PropType<ListType>, + default: 'picture-card', + }, helpText: { type: String as PropType<string>, default: '', @@ -14,7 +53,7 @@ // 鏈�澶ф暟閲忕殑鏂囦欢锛孖nfinity涓嶉檺鍒� maxNumber: { type: Number as PropType<number>, - default: Infinity, + default: 1, }, // 鏍规嵁鍚庣紑锛屾垨鑰呭叾浠� accept: { @@ -23,7 +62,7 @@ }, multiple: { type: Boolean as PropType<boolean>, - default: true, + default: false, }, uploadParams: { type: Object as PropType<any>, @@ -42,6 +81,17 @@ type: String as PropType<string>, default: null, }, + fileListOpenDrag: { + type: Boolean, + default: true, + }, + + fileListDragOptions: { + type: Object as PropType<SortableOptions>, + default: () => ({}), + }, + // support xxx.xxx.xx + resultField: propTypes.string.def(''), }; export const uploadContainerProps = { @@ -58,18 +108,24 @@ type: Boolean as PropType<boolean>, default: false, }, + ...previewType, }; export const previewProps = { value: { - type: Array as PropType<string[]>, + type: Array as PropType<BaseFileItem[] | any[]>, default: () => [], }, + maxNumber: { + type: Number as PropType<number>, + default: 1, + }, + ...previewType, }; export const fileListProps = { columns: { - type: Array as PropType<FileBasicColumn[]>, + type: Array as PropType<BasicColumn[] | FileBasicColumn[]>, default: null, }, actionColumn: { @@ -80,4 +136,12 @@ type: Array as PropType<any[]>, default: null, }, + openDrag: { + type: Boolean, + default: false, + }, + dragOptions: { + type: Object as PropType<SortableOptions>, + default: () => ({}), + }, }; -- Gitblit v1.9.3