disguise-ui 0.1.3 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/disguise-ui.js +145 -93
  2. package/dist/style.css +1 -1
  3. package/dist/types/components/async-select/async-select.type.d.ts +14 -0
  4. package/dist/types/components/async-select/async-select.utils.d.ts +12 -0
  5. package/dist/types/components/async-select/async-select.vue.d.ts +52 -0
  6. package/dist/types/components/async-select/index.d.ts +2 -0
  7. package/dist/types/components/card/index.vue.d.ts +15 -0
  8. package/dist/types/components/crud-page/index.d.ts +2 -0
  9. package/dist/types/components/crud-page/index.type.d.ts +105 -0
  10. package/dist/types/components/crud-page/index.vue.d.ts +66 -0
  11. package/dist/types/components/dialog-list/index.vue.d.ts +540 -0
  12. package/dist/types/components/dict-tag/index.vue.d.ts +18 -0
  13. package/dist/types/components/disguise-icon/index.vue.d.ts +14 -0
  14. package/dist/types/components/drawer-form-page/index.d.ts +3 -0
  15. package/dist/types/components/drawer-form-page/index.type.d.ts +76 -0
  16. package/dist/types/components/drawer-form-page/index.vue.d.ts +94 -0
  17. package/dist/types/components/drawer-form-page/use-drawer-form-page.d.ts +4 -0
  18. package/dist/types/components/file-upload/components/file-status.vue.d.ts +50 -0
  19. package/dist/types/components/file-upload/composables/use-file-type.d.ts +41 -0
  20. package/dist/types/components/file-upload/composables/use-file-upload.d.ts +82 -0
  21. package/dist/types/components/file-upload/composables/use-file-upload.utils.d.ts +9 -0
  22. package/dist/types/components/file-upload/composables/use-multiple-file-upload.d.ts +119 -0
  23. package/dist/types/components/file-upload/file-upload.type.d.ts +68 -0
  24. package/dist/types/components/file-upload/file-upload.vue.d.ts +33 -0
  25. package/dist/types/components/file-upload/index.d.ts +2 -0
  26. package/dist/types/components/image-upload/index.vue.d.ts +26 -0
  27. package/dist/types/components/images-view/index.vue.d.ts +18 -0
  28. package/dist/types/components/import-dialog/index.d.ts +3 -0
  29. package/dist/types/components/import-dialog/index.type.d.ts +101 -0
  30. package/dist/types/components/import-dialog/index.vue.d.ts +35 -0
  31. package/dist/types/components/picture-upload/index.d.ts +3 -0
  32. package/dist/types/components/picture-upload/picture-upload.vue.d.ts +52 -0
  33. package/dist/types/components/rich-text-editor/index.vue.d.ts +35 -0
  34. package/dist/types/components/schema-form/index.d.ts +5 -0
  35. package/dist/types/components/schema-form/readonly-text.vue.d.ts +7 -0
  36. package/dist/types/components/schema-form/schema-form-item.vue.d.ts +36 -0
  37. package/dist/types/components/schema-form/schema-form-registry.d.ts +18 -0
  38. package/dist/types/components/schema-form/schema-form.type.d.ts +190 -0
  39. package/dist/types/components/schema-form/schema-form.util.d.ts +10 -0
  40. package/dist/types/components/schema-form/schema-form.vue.d.ts +59 -0
  41. package/dist/types/components/schema-form/translate-field.vue.d.ts +27 -0
  42. package/dist/types/components/schema-form/translate-toolbar.vue.d.ts +24 -0
  43. package/dist/types/components/schema-form/use-field-options.d.ts +4 -0
  44. package/dist/types/components/search-form/index.d.ts +2 -0
  45. package/dist/types/components/search-form/index.type.d.ts +3 -0
  46. package/dist/types/components/search-form/index.vue.d.ts +66 -0
  47. package/dist/types/components/table-entity/cells/avatar-cell.vue.d.ts +10 -0
  48. package/dist/types/components/table-entity/cells/file-cell.vue.d.ts +20 -0
  49. package/dist/types/components/table-entity/cells/index.d.ts +10 -0
  50. package/dist/types/components/table-entity/cells/list-expand-cell.vue.d.ts +19 -0
  51. package/dist/types/components/table-entity/cells/picture-cell.vue.d.ts +22 -0
  52. package/dist/types/components/table-entity/cells/price-cell.vue.d.ts +10 -0
  53. package/dist/types/components/table-entity/components/ColumnFixedPanel.vue.d.ts +13 -0
  54. package/dist/types/components/table-entity/components/ColumnSettingsPanel.vue.d.ts +25 -0
  55. package/dist/types/components/table-entity/composables/use-column-fixed.d.ts +15 -0
  56. package/dist/types/components/table-entity/composables/use-column-resize.d.ts +25 -0
  57. package/dist/types/components/table-entity/composables/use-column-settings.d.ts +41 -0
  58. package/dist/types/components/table-entity/composables/use-row-drag.d.ts +21 -0
  59. package/dist/types/components/table-entity/composables/use-table-selection.d.ts +23 -0
  60. package/dist/types/components/table-entity/index.type.d.ts +189 -0
  61. package/dist/types/components/table-entity/index.vue.d.ts +101 -0
  62. package/dist/types/components/table-entity/utils/column-slots.d.ts +8 -0
  63. package/dist/types/components/table-entity/utils/column-utils.d.ts +7 -0
  64. package/dist/types/components/table-entity/utils/list-expand.d.ts +9 -0
  65. package/dist/types/components/user-avatar-info/index.vue.d.ts +114 -0
  66. package/dist/types/composables/use-dict-data.d.ts +192 -0
  67. package/dist/types/composables/use-image-url.d.ts +8 -0
  68. package/dist/types/entities/index.d.ts +2 -0
  69. package/dist/types/entities/registry.d.ts +33 -0
  70. package/dist/types/index.d.ts +25 -0
  71. package/dist/types/runtime/access.d.ts +13 -0
  72. package/dist/types/runtime/context.d.ts +48 -0
  73. package/dist/types/runtime/dict.d.ts +22 -0
  74. package/dist/types/runtime/i18n.d.ts +12 -0
  75. package/dist/types/runtime/modal.d.ts +31 -0
  76. package/dist/types/runtime/preferences.d.ts +6 -0
  77. package/dist/types/runtime/request.d.ts +19 -0
  78. package/dist/types/runtime/types.d.ts +1 -0
  79. package/dist/types/runtime/upload.d.ts +5 -0
  80. package/dist/types/runtime/utils.d.ts +16 -0
  81. package/dist/types/services/file-upload.d.ts +11 -0
  82. package/dist/types/setup.d.ts +7 -0
  83. package/package.json +6 -3
@@ -0,0 +1,76 @@
1
+ import type { SchemaFormItem, SchemaFormMode, SchemaFormProps } from '../schema-form/schema-form.type';
2
+ export type DrawerFormValues = Record<string, any>;
3
+ export type DrawerFormSchemaProps = Omit<SchemaFormProps, 'disabled' | 'loading' | 'mode' | 'schema'>;
4
+ export type DrawerFormPageProps = {
5
+ /** 抽屉显隐 */
6
+ modelValue?: boolean;
7
+ /** 抽屉标题 */
8
+ title?: string;
9
+ /** 标题上方的路径文字 */
10
+ breadcrumb?: string;
11
+ /** 右侧状态文案;不传时根据 mode 自动生成 */
12
+ statusText?: string;
13
+ /** 表单模式 */
14
+ mode?: SchemaFormMode;
15
+ /** SchemaForm 字段配置 */
16
+ schema?: SchemaFormItem[];
17
+ /** 表单值,配合 v-model:form-values 使用 */
18
+ formValues?: DrawerFormValues;
19
+ /** 普通模式下的抽屉宽度 */
20
+ size?: number | string;
21
+ /** 抽屉打开方向 */
22
+ direction?: 'btt' | 'ltr' | 'rtl' | 'ttb';
23
+ /** 是否显示全屏切换按钮 */
24
+ fullscreenButton?: boolean;
25
+ /** 初始是否全屏 */
26
+ fullscreen?: boolean;
27
+ /** 新增、编辑等常规模式下的表单列数;查看模式固定为两列 */
28
+ normalColumns?: number;
29
+ /** 全屏模式下的表单列数 */
30
+ fullscreenColumns?: number;
31
+ /** 是否显示底部操作栏 */
32
+ showFooter?: boolean;
33
+ /** 是否显示取消按钮 */
34
+ showCancelButton?: boolean;
35
+ /** 是否显示提交按钮,查看模式下默认隐藏 */
36
+ showSubmitButton?: boolean;
37
+ cancelText?: string;
38
+ submitText?: string;
39
+ /** 抽屉内容与表单的加载状态 */
40
+ loading?: boolean;
41
+ /** 提交中的状态,会禁用关闭与操作按钮 */
42
+ submitting?: boolean;
43
+ disabled?: boolean;
44
+ destroyOnClose?: boolean;
45
+ closeOnClickModal?: boolean;
46
+ closeOnPressEscape?: boolean;
47
+ appendToBody?: boolean;
48
+ lockScroll?: boolean;
49
+ /** 透传给 ElDrawer 的其他属性 */
50
+ drawerProps?: Record<string, any>;
51
+ /** 透传给 SchemaForm 的布局属性 */
52
+ schemaFormProps?: DrawerFormSchemaProps;
53
+ };
54
+ export type DrawerFormPageOpenOptions<TValues extends DrawerFormValues> = Partial<Pick<DrawerFormPageProps, 'appendToBody' | 'breadcrumb' | 'cancelText' | 'closeOnClickModal' | 'closeOnPressEscape' | 'destroyOnClose' | 'direction' | 'disabled' | 'drawerProps' | 'fullscreen' | 'fullscreenButton' | 'fullscreenColumns' | 'loading' | 'lockScroll' | 'mode' | 'normalColumns' | 'schema' | 'schemaFormProps' | 'showCancelButton' | 'showFooter' | 'showSubmitButton' | 'size' | 'statusText' | 'submitText' | 'submitting' | 'title'>> & {
55
+ values?: TValues;
56
+ };
57
+ export type DrawerFormPageState<TValues extends DrawerFormValues> = DrawerFormPageOpenOptions<TValues>;
58
+ export type DrawerFormPageApi<TValues extends DrawerFormValues> = {
59
+ open: (options?: DrawerFormPageOpenOptions<TValues>) => void;
60
+ close: () => void;
61
+ toggleFullscreen: () => void;
62
+ setValues: (values: Partial<TValues>) => void;
63
+ getValues: () => TValues;
64
+ validate: () => Promise<boolean>;
65
+ resetFields: () => void;
66
+ submit: () => Promise<boolean>;
67
+ setState: (state: DrawerFormPageState<TValues>) => void;
68
+ };
69
+ export type DrawerFormPageSubmitHandler<TValues extends DrawerFormValues> = (values: TValues, api: DrawerFormPageApi<TValues>) => boolean | Promise<boolean | void> | void;
70
+ export type DrawerFormPageOptions<TValues extends DrawerFormValues> = DrawerFormPageOpenOptions<TValues> & {
71
+ initialValues?: TValues;
72
+ closeOnSubmit?: boolean;
73
+ onSubmit?: DrawerFormPageSubmitHandler<TValues>;
74
+ onCancel?: () => void;
75
+ onOpenChange?: (visible: boolean) => void;
76
+ };
@@ -0,0 +1,94 @@
1
+ import type { DrawerFormPageProps, DrawerFormValues } from './index.type';
2
+ declare function toggleFullscreen(): void;
3
+ declare function close(): void;
4
+ declare function handleCancel(): void;
5
+ declare function validate(): Promise<boolean>;
6
+ declare function getValues(): {
7
+ [k: string]: any;
8
+ };
9
+ declare function submit(): Promise<boolean>;
10
+ declare function resetFields(): void;
11
+ declare const __VLS_template: () => {
12
+ __VLS_Slots: {
13
+ [x: string]: ((props: {
14
+ field: import("../..").ResolvedField;
15
+ value: any;
16
+ disabled: boolean;
17
+ updateValue: (value: any) => void;
18
+ }) => any) | undefined;
19
+ } & {
20
+ header?: (props: {
21
+ fullscreen: boolean;
22
+ title: string;
23
+ toggleFullscreen: typeof toggleFullscreen;
24
+ }) => any;
25
+ } & {
26
+ default?: (props: {}) => any;
27
+ } & {
28
+ footer?: (props: {
29
+ cancel: typeof handleCancel;
30
+ submit: typeof submit;
31
+ submitting: boolean;
32
+ }) => any;
33
+ };
34
+ };
35
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
36
+ declare const __VLS_base: import("vue").DefineComponent<DrawerFormPageProps, {
37
+ close: typeof close;
38
+ getValues: typeof getValues;
39
+ resetFields: typeof resetFields;
40
+ submit: typeof submit;
41
+ toggleFullscreen: typeof toggleFullscreen;
42
+ validate: typeof validate;
43
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
44
+ open: () => any;
45
+ "update:modelValue": (value: boolean) => any;
46
+ closed: () => any;
47
+ cancel: () => any;
48
+ submit: (value: DrawerFormValues) => any;
49
+ "update:formValues": (value: DrawerFormValues) => any;
50
+ "update:fullscreen": (value: boolean) => any;
51
+ }, string, import("vue").PublicProps, Readonly<DrawerFormPageProps> & Readonly<{
52
+ onOpen?: (() => any) | undefined;
53
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
54
+ onClosed?: (() => any) | undefined;
55
+ onCancel?: (() => any) | undefined;
56
+ onSubmit?: ((value: DrawerFormValues) => any) | undefined;
57
+ "onUpdate:formValues"?: ((value: DrawerFormValues) => any) | undefined;
58
+ "onUpdate:fullscreen"?: ((value: boolean) => any) | undefined;
59
+ }>, {
60
+ appendToBody: boolean;
61
+ destroyOnClose: boolean;
62
+ closeOnClickModal: boolean;
63
+ closeOnPressEscape: boolean;
64
+ lockScroll: boolean;
65
+ modelValue: boolean;
66
+ fullscreen: boolean;
67
+ title: string;
68
+ size: string | number;
69
+ mode: import("../schema-form").SchemaFormMode;
70
+ cancelText: string;
71
+ drawerProps: Record<string, any>;
72
+ disabled: boolean;
73
+ loading: boolean;
74
+ schema: import("../schema-form").SchemaFormItem[];
75
+ formValues: DrawerFormValues;
76
+ direction: "rtl" | "btt" | "ltr" | "ttb";
77
+ fullscreenButton: boolean;
78
+ normalColumns: number;
79
+ fullscreenColumns: number;
80
+ showFooter: boolean;
81
+ showCancelButton: boolean;
82
+ showSubmitButton: boolean;
83
+ submitText: string;
84
+ submitting: boolean;
85
+ schemaFormProps: import("./index.type").DrawerFormSchemaProps;
86
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
87
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
88
+ declare const _default: typeof __VLS_export;
89
+ export default _default;
90
+ type __VLS_WithSlots<T, S> = T & {
91
+ new (): {
92
+ $slots: S;
93
+ };
94
+ };
@@ -0,0 +1,4 @@
1
+ import type { DrawerFormPageApi, DrawerFormPageOptions, DrawerFormValues } from './index.type';
2
+ export declare function useDrawerFormPage<TValues extends DrawerFormValues = DrawerFormValues>(options?: DrawerFormPageOptions<TValues>): readonly [import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
3
+ [key: string]: any;
4
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, DrawerFormPageApi<TValues>];
@@ -0,0 +1,50 @@
1
+ import type { AttachmentData } from '../file-upload.type';
2
+ interface Props {
3
+ /** 状态类型 */
4
+ status: 'error' | 'loading' | 'success';
5
+ /** 文件信息 */
6
+ file?: AttachmentData;
7
+ /** 文件名 */
8
+ fileName?: string;
9
+ /** 文件图标类名 */
10
+ iconClass?: string;
11
+ /** 文件图标 SVG */
12
+ iconSvg?: string;
13
+ /** 进度百分比(0-100,仅 loading 状态) */
14
+ progress?: number;
15
+ /** 进度文本(仅 loading 状态) */
16
+ progressText?: string;
17
+ /** 错误信息(仅 error 状态) */
18
+ errorMessage?: string;
19
+ /** 是否显示预览按钮 */
20
+ showPreview?: boolean;
21
+ /** 是否显示下载按钮 */
22
+ showDownload?: boolean;
23
+ /** 是否显示删除按钮 */
24
+ showRemove?: boolean;
25
+ /** 预览回调 */
26
+ onPreview?: (file?: AttachmentData) => void;
27
+ /** 下载回调 */
28
+ onDownload?: (file?: AttachmentData) => void;
29
+ /** 删除回调 */
30
+ onRemove?: (file?: AttachmentData) => void;
31
+ disabled?: boolean;
32
+ }
33
+ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
34
+ progress: number;
35
+ file: AttachmentData;
36
+ disabled: boolean;
37
+ fileName: string;
38
+ iconClass: string;
39
+ iconSvg: string;
40
+ progressText: string;
41
+ errorMessage: string;
42
+ showPreview: boolean;
43
+ showDownload: boolean;
44
+ showRemove: boolean;
45
+ onPreview: (file?: AttachmentData) => void;
46
+ onDownload: (file?: AttachmentData) => void;
47
+ onRemove: (file?: AttachmentData) => void;
48
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
49
+ declare const _default: typeof __VLS_export;
50
+ export default _default;
@@ -0,0 +1,41 @@
1
+ import type { Ref } from 'vue';
2
+ /**
3
+ * 文件类型枚举
4
+ */
5
+ export declare enum FileType {
6
+ PDF = "pdf",
7
+ WORD = "word",
8
+ EXCEL = "excel",
9
+ POWERPOINT = "powerpoint",
10
+ IMAGE = "image",
11
+ VIDEO = "video",
12
+ AUDIO = "audio",
13
+ ARCHIVE = "archive",
14
+ TEXT = "text",
15
+ CODE = "code",
16
+ DEFAULT = "default"
17
+ }
18
+ /**
19
+ * 文件类型配置
20
+ */
21
+ interface FileTypeConfig {
22
+ extensions: string[];
23
+ mimeTypes: string[];
24
+ iconClass: string;
25
+ color: string;
26
+ icon: string;
27
+ }
28
+ /**
29
+ * 文件类型判断 Composable
30
+ *
31
+ * @param fileName - 文件名(Ref 或字符串)
32
+ * @param fileType - 文件 MIME 类型(可选,Ref 或字符串)
33
+ */
34
+ export declare const useFileType: (fileName: Ref<string> | string, fileType?: Ref<string | undefined> | string | undefined) => {
35
+ fileType: import("vue").ComputedRef<FileType>;
36
+ iconClass: import("vue").ComputedRef<string>;
37
+ iconSvg: import("vue").ComputedRef<string>;
38
+ iconColor: import("vue").ComputedRef<string>;
39
+ typeConfig: import("vue").ComputedRef<FileTypeConfig>;
40
+ };
41
+ export {};
@@ -0,0 +1,82 @@
1
+ import type { UploadRequestOptions } from 'element-plus';
2
+ import type { Ref } from 'vue';
3
+ import type { AttachmentData } from '../file-upload.type';
4
+ export interface UseFileUploadOptions {
5
+ /** 文件数据(支持 v-model,可以是字符串 URL/key 或 AttachmentData 对象) */
6
+ modelValue: Ref<AttachmentData | string | undefined>;
7
+ /** 文件大小限制(MB) */
8
+ maxSize: Ref<number>;
9
+ /** 允许的文件类型 */
10
+ accept: Ref<string[]>;
11
+ /** 自定义文件名称显示 */
12
+ fileName?: Ref<string | undefined>;
13
+ /** 错误信息(显示错误状态) */
14
+ errorMessage?: Ref<string>;
15
+ /** 更新文件数据的回调 */
16
+ onUpdate: (value: AttachmentData | string | undefined) => void;
17
+ /** 上传成功回调 */
18
+ onUploadSuccess?: (file: AttachmentData) => void;
19
+ /** 上传错误回调 */
20
+ onUploadError?: (error: Error) => void;
21
+ /** 删除回调 */
22
+ onRemove?: (file: AttachmentData) => void;
23
+ /** 预览回调 */
24
+ onPreview?: (file: AttachmentData) => void;
25
+ /** 下载回调 */
26
+ onDownload?: (file: AttachmentData) => void;
27
+ /** OSS 保存目录,相对 attachment/v3 */
28
+ baseFolder?: Ref<string | undefined>;
29
+ /** 是否给图片加中心水印 */
30
+ addWatermark?: Ref<boolean | undefined>;
31
+ }
32
+ /**
33
+ * 格式化文件大小
34
+ */
35
+ export declare const formatFileSize: (bytes: number) => string;
36
+ /**
37
+ * 文件上传 Composable
38
+ */
39
+ export declare const useFileUpload: (options: UseFileUploadOptions) => {
40
+ loading: Ref<boolean, boolean>;
41
+ uploadProgress: Ref<number, number>;
42
+ uploadingFile: Ref<{
43
+ readonly lastModified: number;
44
+ readonly name: string;
45
+ readonly webkitRelativePath: string;
46
+ readonly size: number;
47
+ readonly type: string;
48
+ arrayBuffer: () => Promise<ArrayBuffer>;
49
+ bytes: () => Promise<Uint8Array<ArrayBuffer>>;
50
+ slice: (start?: number, end?: number, contentType?: string) => Blob;
51
+ stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
52
+ text: () => Promise<string>;
53
+ } | null, File | {
54
+ readonly lastModified: number;
55
+ readonly name: string;
56
+ readonly webkitRelativePath: string;
57
+ readonly size: number;
58
+ readonly type: string;
59
+ arrayBuffer: () => Promise<ArrayBuffer>;
60
+ bytes: () => Promise<Uint8Array<ArrayBuffer>>;
61
+ slice: (start?: number, end?: number, contentType?: string) => Blob;
62
+ stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
63
+ text: () => Promise<string>;
64
+ } | null>;
65
+ uploadError: Ref<string, string>;
66
+ fileData: import("vue").ComputedRef<AttachmentData | null>;
67
+ fileUrl: import("vue").ComputedRef<string>;
68
+ isEmpty: import("vue").ComputedRef<boolean>;
69
+ isError: import("vue").ComputedRef<boolean>;
70
+ displayErrorMessage: import("vue").ComputedRef<string>;
71
+ displayFileName: import("vue").ComputedRef<string>;
72
+ progressText: import("vue").ComputedRef<string>;
73
+ getFileIconClass: import("vue").ComputedRef<string>;
74
+ getFileIconSvg: import("vue").ComputedRef<string>;
75
+ acceptAttr: import("vue").ComputedRef<string>;
76
+ beforeUpload: (rawFile: import("element-plus").UploadRawFile) => import("element-plus/es/utils/typescript.mjs").Awaitable<void | undefined | null | boolean | File | Blob>;
77
+ handleUpload: (uploadOptions: UploadRequestOptions) => Promise<void>;
78
+ handleRemove: () => void;
79
+ handlePreview: () => void;
80
+ handleDownload: () => void;
81
+ formatFileSize: (bytes: number) => string;
82
+ };
@@ -0,0 +1,9 @@
1
+ import type { AttachmentData } from '../file-upload.type';
2
+ /** ****************************** 单文件上传状态工具 ********************************/
3
+ interface ResolvePendingFileDataOptions {
4
+ incomingValue: AttachmentData | string | undefined;
5
+ pendingFileData: AttachmentData | null;
6
+ isUploading: boolean;
7
+ }
8
+ export declare function resolvePendingFileData(options: ResolvePendingFileDataOptions): AttachmentData | null;
9
+ export {};
@@ -0,0 +1,119 @@
1
+ import type { UploadRequestOptions } from 'element-plus';
2
+ import type { Ref } from 'vue';
3
+ import type { AttachmentData } from '../file-upload.type';
4
+ /**
5
+ * 单个文件上传状态
6
+ */
7
+ export interface FileUploadItem {
8
+ /** 文件对象 */
9
+ file: File;
10
+ /** 上传进度 0-100 */
11
+ progress: number;
12
+ /** 上传状态 */
13
+ status: 'error' | 'pending' | 'success' | 'uploading';
14
+ /** 错误信息 */
15
+ error?: string;
16
+ /** 上传结果 */
17
+ result?: AttachmentData;
18
+ }
19
+ export interface UseMultipleFileUploadOptions {
20
+ /** 文件数据数组(支持 v-model) */
21
+ modelValue: Ref<AttachmentData[] | undefined>;
22
+ /** 文件大小限制(MB) */
23
+ maxSize: Ref<number>;
24
+ /** 允许的文件类型 */
25
+ accept: Ref<string[]>;
26
+ /** 最大文件数量限制 */
27
+ maxCount?: Ref<number | undefined>;
28
+ /** 错误信息(显示错误状态) */
29
+ errorMessage?: Ref<string>;
30
+ /** OSS 保存目录,相对 attachment/v3 */
31
+ baseFolder?: Ref<string | undefined>;
32
+ /** 是否给图片加中心水印 */
33
+ addWatermark?: Ref<boolean | undefined>;
34
+ /** 更新文件数据的回调 */
35
+ onUpdate: (value: AttachmentData[] | undefined) => void;
36
+ /** 上传成功回调 */
37
+ onUploadSuccess?: (file: AttachmentData) => void;
38
+ /** 上传错误回调 */
39
+ onUploadError?: (error: Error, file: File) => void;
40
+ /** 删除回调 */
41
+ onRemove?: (file: AttachmentData) => void;
42
+ /** 预览回调 */
43
+ onPreview?: (file: AttachmentData) => void;
44
+ /** 下载回调 */
45
+ onDownload?: (file: AttachmentData) => void;
46
+ }
47
+ /**
48
+ * 多文件上传 Composable
49
+ */
50
+ export declare const useMultipleFileUpload: (options: UseMultipleFileUploadOptions) => {
51
+ loading: Ref<boolean, boolean>;
52
+ uploadItems: Ref<Map<string, {
53
+ file: {
54
+ readonly lastModified: number;
55
+ readonly name: string;
56
+ readonly webkitRelativePath: string;
57
+ readonly size: number;
58
+ readonly type: string;
59
+ arrayBuffer: () => Promise<ArrayBuffer>;
60
+ bytes: () => Promise<Uint8Array<ArrayBuffer>>;
61
+ slice: (start?: number, end?: number, contentType?: string) => Blob;
62
+ stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
63
+ text: () => Promise<string>;
64
+ };
65
+ progress: number;
66
+ status: "error" | "pending" | "success" | "uploading";
67
+ error?: string | undefined;
68
+ result?: {
69
+ fileOriginName?: string | undefined;
70
+ name?: string | undefined;
71
+ fileSuffix?: string | undefined;
72
+ type?: string | undefined;
73
+ fileUrl?: string | undefined;
74
+ url?: string | undefined;
75
+ fileSizeInfo?: number | undefined;
76
+ size?: number | undefined;
77
+ } | undefined;
78
+ }> & Omit<Map<string, FileUploadItem>, keyof Map<any, any>>, Map<string, FileUploadItem> | (Map<string, {
79
+ file: {
80
+ readonly lastModified: number;
81
+ readonly name: string;
82
+ readonly webkitRelativePath: string;
83
+ readonly size: number;
84
+ readonly type: string;
85
+ arrayBuffer: () => Promise<ArrayBuffer>;
86
+ bytes: () => Promise<Uint8Array<ArrayBuffer>>;
87
+ slice: (start?: number, end?: number, contentType?: string) => Blob;
88
+ stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
89
+ text: () => Promise<string>;
90
+ };
91
+ progress: number;
92
+ status: "error" | "pending" | "success" | "uploading";
93
+ error?: string | undefined;
94
+ result?: {
95
+ fileOriginName?: string | undefined;
96
+ name?: string | undefined;
97
+ fileSuffix?: string | undefined;
98
+ type?: string | undefined;
99
+ fileUrl?: string | undefined;
100
+ url?: string | undefined;
101
+ fileSizeInfo?: number | undefined;
102
+ size?: number | undefined;
103
+ } | undefined;
104
+ }> & Omit<Map<string, FileUploadItem>, keyof Map<any, any>>)>;
105
+ totalProgress: import("vue").ComputedRef<number>;
106
+ fileList: import("vue").ComputedRef<AttachmentData[]>;
107
+ isEmpty: import("vue").ComputedRef<boolean>;
108
+ isError: import("vue").ComputedRef<boolean>;
109
+ displayErrorMessage: import("vue").ComputedRef<string>;
110
+ acceptAttr: import("vue").ComputedRef<string>;
111
+ beforeUpload: (rawFile: import("element-plus").UploadRawFile) => import("element-plus/es/utils/typescript.mjs").Awaitable<void | undefined | null | boolean | File | Blob>;
112
+ handleUpload: (uploadOptions: UploadRequestOptions) => Promise<void>;
113
+ handleRemove: (file: AttachmentData) => void;
114
+ handlePreview: (file: AttachmentData) => void;
115
+ handleDownload: (file: AttachmentData) => void;
116
+ getUploadItem: (file: AttachmentData) => FileUploadItem | undefined;
117
+ getFileIconClass: (file: AttachmentData) => string;
118
+ getFileIconSvg: (file: AttachmentData) => string;
119
+ };
@@ -0,0 +1,68 @@
1
+ /**
2
+ * 附件数据结构(与后端接口保持一致)
3
+ */
4
+ export interface AttachmentData {
5
+ /** 文件名称 */
6
+ fileOriginName?: string;
7
+ /** 兼容前端组件使用的文件名称 */
8
+ name?: string;
9
+ /** 文件类型 */
10
+ fileSuffix?: string;
11
+ /** 兼容前端组件使用的文件类型 */
12
+ type?: string;
13
+ /** 文件URL 或 key */
14
+ fileUrl?: string;
15
+ /** 兼容前端组件使用的文件地址 */
16
+ url?: string;
17
+ /** 文件大小 */
18
+ fileSizeInfo?: number;
19
+ /** 兼容前端组件使用的文件大小 */
20
+ size?: number;
21
+ }
22
+ /**
23
+ * 文件上传组件 Props
24
+ */
25
+ export interface FileUploadProps {
26
+ /** 文件数据(支持 v-model,可以是字符串 URL、AttachmentData 对象或数组) */
27
+ modelValue?: AttachmentData | AttachmentData[] | string;
28
+ /** 是否禁用 */
29
+ disabled?: boolean;
30
+ /** 文件大小限制(MB),默认 5MB */
31
+ maxSize?: number;
32
+ /** 允许的文件类型 */
33
+ accept?: string[];
34
+ /** 文件显示宽度(px) */
35
+ width?: number;
36
+ /** 文件显示高度(px) */
37
+ height?: number;
38
+ /** 是否显示文件预览 */
39
+ showPreview?: boolean;
40
+ /** 是否显示下载按钮 */
41
+ showDownload?: boolean;
42
+ /** 是否显示删除按钮 */
43
+ showRemove?: boolean;
44
+ /** 自定义文件名称显示 */
45
+ fileName?: string;
46
+ /** 占位符文本 */
47
+ placeholder?: string;
48
+ /** 是否选中(显示蓝色边框) */
49
+ selected?: boolean;
50
+ /** 错误信息(显示错误状态) */
51
+ errorMessage?: string;
52
+ /** 最大文件数量限制,用于区分单文件/多文件模式:
53
+ * - 未设置或为 1:单文件模式
54
+ * - 大于 1:多文件模式,限制最大文件数量
55
+ */
56
+ maxCount?: number;
57
+ }
58
+ /**
59
+ * 文件上传组件 Emits
60
+ */
61
+ export interface FileUploadEmits {
62
+ (e: 'update:modelValue', value: AttachmentData | AttachmentData[] | string | undefined): void;
63
+ (e: 'uploadSuccess', file: AttachmentData): void;
64
+ (e: 'uploadError', error: Error): void;
65
+ (e: 'remove', file: AttachmentData): void;
66
+ (e: 'preview', file: AttachmentData): void;
67
+ (e: 'download', file: AttachmentData): void;
68
+ }
@@ -0,0 +1,33 @@
1
+ import type { AttachmentData, FileUploadProps } from './file-upload.type';
2
+ declare const __VLS_export: import("vue").DefineComponent<FileUploadProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
3
+ "update:modelValue": (value: string | AttachmentData | AttachmentData[] | undefined) => any;
4
+ uploadSuccess: (file: AttachmentData) => any;
5
+ uploadError: (error: Error) => any;
6
+ remove: (file: AttachmentData) => any;
7
+ preview: (file: AttachmentData) => any;
8
+ download: (file: AttachmentData) => any;
9
+ }, string, import("vue").PublicProps, Readonly<FileUploadProps> & Readonly<{
10
+ "onUpdate:modelValue"?: ((value: string | AttachmentData | AttachmentData[] | undefined) => any) | undefined;
11
+ onUploadSuccess?: ((file: AttachmentData) => any) | undefined;
12
+ onUploadError?: ((error: Error) => any) | undefined;
13
+ onRemove?: ((file: AttachmentData) => any) | undefined;
14
+ onPreview?: ((file: AttachmentData) => any) | undefined;
15
+ onDownload?: ((file: AttachmentData) => any) | undefined;
16
+ }>, {
17
+ modelValue: string | AttachmentData | AttachmentData[];
18
+ width: number;
19
+ accept: string[];
20
+ maxSize: number;
21
+ height: number;
22
+ placeholder: string;
23
+ disabled: boolean;
24
+ fileName: string;
25
+ errorMessage: string;
26
+ showPreview: boolean;
27
+ showDownload: boolean;
28
+ showRemove: boolean;
29
+ selected: boolean;
30
+ maxCount: number;
31
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
+ declare const _default: typeof __VLS_export;
33
+ export default _default;
@@ -0,0 +1,2 @@
1
+ import fileUpload from './file-upload.vue';
2
+ export default fileUpload;
@@ -0,0 +1,26 @@
1
+ type __VLS_Props = {
2
+ /** 允许的 MIME 类型,如 image/png */
3
+ accept?: string[];
4
+ disabled?: boolean;
5
+ height?: number;
6
+ /** 单位 MB */
7
+ maxSize?: number;
8
+ width?: number;
9
+ };
10
+ type __VLS_ModelProps = {
11
+ modelValue?: string;
12
+ };
13
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
14
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
+ "update:modelValue": (value: string) => any;
16
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
17
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
18
+ }>, {
19
+ width: number;
20
+ accept: string[];
21
+ maxSize: number;
22
+ height: number;
23
+ disabled: boolean;
24
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
25
+ declare const _default: typeof __VLS_export;
26
+ export default _default;
@@ -0,0 +1,18 @@
1
+ export interface ImagesViewProps {
2
+ /** 图片地址数组 */
3
+ images?: string[];
4
+ /** 单张缩略图尺寸(像素) */
5
+ size?: number;
6
+ /** 最多叠放多少层 */
7
+ maxStack?: number;
8
+ /** 每层偏移距离(像素) */
9
+ offset?: number;
10
+ }
11
+ declare const __VLS_export: import("vue").DefineComponent<ImagesViewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ImagesViewProps> & Readonly<{}>, {
12
+ size: number;
13
+ images: string[];
14
+ maxStack: number;
15
+ offset: number;
16
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const _default: typeof __VLS_export;
18
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import ImportDialog from './index.vue';
2
+ export default ImportDialog;
3
+ export type { ImportDialogEmits, ImportDialogMappingItem, ImportDialogMode, ImportDialogModeOption, ImportDialogParsePayload, ImportDialogParseResult, ImportDialogPreviewColumn, ImportDialogProps, ImportDialogSheetOption, ImportDialogSubmitPayload, ImportDialogSubmitResult, ImportDialogTargetField, ImportDialogUrlConfig, } from './index.type.js';