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,114 @@
1
+ /** ****************************** props ********************************/
2
+ type __VLS_Props = {
3
+ /** 用户 ID,传入后请求 `/system/user/{id}`,返回 data 为 SysUser */
4
+ userId?: number | string;
5
+ /** 展示名称(仅 userId 时可省略,由接口 nickName / userName 兜底) */
6
+ name?: string;
7
+ /** 副标题,如部门、职位 */
8
+ subtitle?: string;
9
+ /** 头像图片地址 */
10
+ src?: string;
11
+ /** 男性:右侧文案蓝色;女性:粉色;未传或无法识别:次要文字色 */
12
+ gender?: UserAvatarGenderInput;
13
+ /** 头像尺寸,对应 el-avatar size */
14
+ size?: number;
15
+ /** 透传 el-avatar(会与 src、size、shape 合并,后者优先) */
16
+ avatar?: Record<string, unknown>;
17
+ /** 抽屉内头像尺寸(基础信息 el-descriptions 首行) */
18
+ drawerAvatarSize?: number;
19
+ /** 年龄 */
20
+ age?: number | string;
21
+ /** 工龄 */
22
+ workYears?: number | string;
23
+ /** 邮箱 */
24
+ email?: string;
25
+ /** 手机号 */
26
+ phone?: string;
27
+ /** 部门信息(未传时用 subtitle / 接口 dept 兜底) */
28
+ department?: string;
29
+ /** 职级 */
30
+ jobLevel?: string;
31
+ /** 是否允许点击打开抽屉 */
32
+ enableDrawer?: boolean;
33
+ /** 抽屉标题,不传则用 i18n */
34
+ drawerTitle?: string;
35
+ /** 抽屉宽度 */
36
+ drawerSize?: number | string;
37
+ /** 透传 el-drawer */
38
+ drawerProps?: Record<string, unknown>;
39
+ /** 昵称(props 直传,不调接口时用) */
40
+ nickName?: string;
41
+ /** 部门名称(props 直传,不调接口时用) */
42
+ deptName?: string;
43
+ /** 性别(props 直传,不调接口时用) */
44
+ sex?: string;
45
+ };
46
+ /** ****************************** 类型 ********************************/
47
+ export type UserAvatarGenderInput = 1 | 2 | '' | 'F' | 'f' | 'female' | 'M' | 'm' | 'male' | 'unknown' | '女' | '男';
48
+ declare function openDrawer(): void;
49
+ declare function closeDrawer(): void;
50
+ type __VLS_ModelProps = {
51
+ 'drawerVisible'?: boolean;
52
+ };
53
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
54
+ declare const __VLS_template: () => {
55
+ __VLS_Slots: {
56
+ avatar?: (props: {}) => any;
57
+ } & {
58
+ name?: (props: {}) => any;
59
+ } & {
60
+ subtitle?: (props: {}) => any;
61
+ } & {
62
+ subtitle?: (props: {}) => any;
63
+ } & {
64
+ default?: (props: {}) => any;
65
+ } & {
66
+ 'drawer-avatar'?: (props: {}) => any;
67
+ } & {
68
+ 'drawer-name'?: (props: {}) => any;
69
+ };
70
+ };
71
+ type __VLS_Slots = ReturnType<typeof __VLS_template>['__VLS_Slots'];
72
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
73
+ openDrawer: typeof openDrawer;
74
+ closeDrawer: typeof closeDrawer;
75
+ /** data 内 SysUser */
76
+ remoteUser: import("vue").ComputedRef<Record<string, any> | undefined>;
77
+ /** 完整接口响应(含根级 roles、posts、roleIds) */
78
+ remoteDetail: import("vue").ComputedRef<{
79
+ data?: Record<string, any>;
80
+ } | null>;
81
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
82
+ "update:drawerVisible": (value: boolean) => any;
83
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
84
+ "onUpdate:drawerVisible"?: ((value: boolean) => any) | undefined;
85
+ }>, {
86
+ name: string;
87
+ size: number;
88
+ userId: string | number;
89
+ subtitle: string;
90
+ gender: UserAvatarGenderInput;
91
+ avatar: Record<string, unknown>;
92
+ drawerAvatarSize: number;
93
+ age: string | number;
94
+ workYears: string | number;
95
+ email: string;
96
+ phone: string;
97
+ department: string;
98
+ jobLevel: string;
99
+ enableDrawer: boolean;
100
+ drawerTitle: string;
101
+ drawerSize: string | number;
102
+ drawerProps: Record<string, unknown>;
103
+ nickName: string;
104
+ deptName: string;
105
+ sex: string;
106
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
107
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
108
+ declare const _default: typeof __VLS_export;
109
+ export default _default;
110
+ type __VLS_WithSlots<T, S> = T & {
111
+ new (): {
112
+ $slots: S;
113
+ };
114
+ };
@@ -0,0 +1,192 @@
1
+ import type { DictValueItem } from '../runtime/dict';
2
+ import type { MaybeRefOrGetter } from 'vue';
3
+ /** ****************************** 字典缓存查询 ********************************/
4
+ export interface DictOption {
5
+ color?: string;
6
+ label: string;
7
+ value: string;
8
+ }
9
+ export declare function useAllDictDataQuery(enabled?: MaybeRefOrGetter<boolean>): import("@tanstack/vue-query").UseQueryReturnType<{}, Error>;
10
+ export declare function isDictValueEnabled(status: unknown): status is true | 1 | "1" | undefined;
11
+ /** 某个字典编码下的可选项,供下拉 / 单选使用 */
12
+ export declare function toDictOptions(items: DictValueItem[] | undefined): DictOption[];
13
+ export declare function findDictValue(items: DictValueItem[], value: unknown): DictValueItem | null;
14
+ /**
15
+ * 按字典编码读取已缓存的字典值。
16
+ * 多个编码共用同一次全量请求。
17
+ */
18
+ export declare function useDictData(code: MaybeRefOrGetter<string | undefined>): {
19
+ items: import("vue").ComputedRef<any>;
20
+ options: import("vue").ComputedRef<DictOption[]>;
21
+ data: import("vue").Ref<{}, {}>;
22
+ error: import("vue").Ref<Error, Error>;
23
+ isError: import("vue").Ref<true, true>;
24
+ isPending: import("vue").Ref<false, false>;
25
+ isLoading: import("vue").Ref<false, false>;
26
+ isLoadingError: import("vue").Ref<false, false>;
27
+ isRefetchError: import("vue").Ref<true, true>;
28
+ isSuccess: import("vue").Ref<false, false>;
29
+ isPlaceholderData: import("vue").Ref<false, false>;
30
+ status: import("vue").Ref<"error", "error">;
31
+ dataUpdatedAt: import("vue").Ref<number, number>;
32
+ errorUpdatedAt: import("vue").Ref<number, number>;
33
+ failureCount: import("vue").Ref<number, number>;
34
+ failureReason: import("vue").Ref<Error | null, Error | null>;
35
+ errorUpdateCount: import("vue").Ref<number, number>;
36
+ isFetched: import("vue").Ref<boolean, boolean>;
37
+ isFetchedAfterMount: import("vue").Ref<boolean, boolean>;
38
+ isFetching: import("vue").Ref<boolean, boolean>;
39
+ isInitialLoading: import("vue").Ref<boolean, boolean>;
40
+ isPaused: import("vue").Ref<boolean, boolean>;
41
+ isRefetching: import("vue").Ref<boolean, boolean>;
42
+ isStale: import("vue").Ref<boolean, boolean>;
43
+ isEnabled: import("vue").Ref<boolean, boolean>;
44
+ refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
45
+ fetchStatus: import("vue").Ref<import("@tanstack/query-core").FetchStatus, import("@tanstack/query-core").FetchStatus>;
46
+ suspense: () => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
47
+ } | {
48
+ items: import("vue").ComputedRef<any>;
49
+ options: import("vue").ComputedRef<DictOption[]>;
50
+ data: import("vue").Ref<{}, {}>;
51
+ error: import("vue").Ref<null, null>;
52
+ isError: import("vue").Ref<false, false>;
53
+ isPending: import("vue").Ref<false, false>;
54
+ isLoading: import("vue").Ref<false, false>;
55
+ isLoadingError: import("vue").Ref<false, false>;
56
+ isRefetchError: import("vue").Ref<false, false>;
57
+ isSuccess: import("vue").Ref<true, true>;
58
+ isPlaceholderData: import("vue").Ref<false, false>;
59
+ status: import("vue").Ref<"success", "success">;
60
+ dataUpdatedAt: import("vue").Ref<number, number>;
61
+ errorUpdatedAt: import("vue").Ref<number, number>;
62
+ failureCount: import("vue").Ref<number, number>;
63
+ failureReason: import("vue").Ref<Error | null, Error | null>;
64
+ errorUpdateCount: import("vue").Ref<number, number>;
65
+ isFetched: import("vue").Ref<boolean, boolean>;
66
+ isFetchedAfterMount: import("vue").Ref<boolean, boolean>;
67
+ isFetching: import("vue").Ref<boolean, boolean>;
68
+ isInitialLoading: import("vue").Ref<boolean, boolean>;
69
+ isPaused: import("vue").Ref<boolean, boolean>;
70
+ isRefetching: import("vue").Ref<boolean, boolean>;
71
+ isStale: import("vue").Ref<boolean, boolean>;
72
+ isEnabled: import("vue").Ref<boolean, boolean>;
73
+ refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
74
+ fetchStatus: import("vue").Ref<import("@tanstack/query-core").FetchStatus, import("@tanstack/query-core").FetchStatus>;
75
+ suspense: () => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
76
+ } | {
77
+ items: import("vue").ComputedRef<any>;
78
+ options: import("vue").ComputedRef<DictOption[]>;
79
+ data: import("vue").Ref<undefined, undefined>;
80
+ error: import("vue").Ref<Error, Error>;
81
+ isError: import("vue").Ref<true, true>;
82
+ isPending: import("vue").Ref<false, false>;
83
+ isLoading: import("vue").Ref<false, false>;
84
+ isLoadingError: import("vue").Ref<true, true>;
85
+ isRefetchError: import("vue").Ref<false, false>;
86
+ isSuccess: import("vue").Ref<false, false>;
87
+ isPlaceholderData: import("vue").Ref<false, false>;
88
+ status: import("vue").Ref<"error", "error">;
89
+ dataUpdatedAt: import("vue").Ref<number, number>;
90
+ errorUpdatedAt: import("vue").Ref<number, number>;
91
+ failureCount: import("vue").Ref<number, number>;
92
+ failureReason: import("vue").Ref<Error | null, Error | null>;
93
+ errorUpdateCount: import("vue").Ref<number, number>;
94
+ isFetched: import("vue").Ref<boolean, boolean>;
95
+ isFetchedAfterMount: import("vue").Ref<boolean, boolean>;
96
+ isFetching: import("vue").Ref<boolean, boolean>;
97
+ isInitialLoading: import("vue").Ref<boolean, boolean>;
98
+ isPaused: import("vue").Ref<boolean, boolean>;
99
+ isRefetching: import("vue").Ref<boolean, boolean>;
100
+ isStale: import("vue").Ref<boolean, boolean>;
101
+ isEnabled: import("vue").Ref<boolean, boolean>;
102
+ refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
103
+ fetchStatus: import("vue").Ref<import("@tanstack/query-core").FetchStatus, import("@tanstack/query-core").FetchStatus>;
104
+ suspense: () => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
105
+ } | {
106
+ items: import("vue").ComputedRef<any>;
107
+ options: import("vue").ComputedRef<DictOption[]>;
108
+ data: import("vue").Ref<undefined, undefined>;
109
+ error: import("vue").Ref<null, null>;
110
+ isError: import("vue").Ref<false, false>;
111
+ isPending: import("vue").Ref<true, true>;
112
+ isLoading: import("vue").Ref<true, true>;
113
+ isLoadingError: import("vue").Ref<false, false>;
114
+ isRefetchError: import("vue").Ref<false, false>;
115
+ isSuccess: import("vue").Ref<false, false>;
116
+ isPlaceholderData: import("vue").Ref<false, false>;
117
+ status: import("vue").Ref<"pending", "pending">;
118
+ dataUpdatedAt: import("vue").Ref<number, number>;
119
+ errorUpdatedAt: import("vue").Ref<number, number>;
120
+ failureCount: import("vue").Ref<number, number>;
121
+ failureReason: import("vue").Ref<Error | null, Error | null>;
122
+ errorUpdateCount: import("vue").Ref<number, number>;
123
+ isFetched: import("vue").Ref<boolean, boolean>;
124
+ isFetchedAfterMount: import("vue").Ref<boolean, boolean>;
125
+ isFetching: import("vue").Ref<boolean, boolean>;
126
+ isInitialLoading: import("vue").Ref<boolean, boolean>;
127
+ isPaused: import("vue").Ref<boolean, boolean>;
128
+ isRefetching: import("vue").Ref<boolean, boolean>;
129
+ isStale: import("vue").Ref<boolean, boolean>;
130
+ isEnabled: import("vue").Ref<boolean, boolean>;
131
+ refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
132
+ fetchStatus: import("vue").Ref<import("@tanstack/query-core").FetchStatus, import("@tanstack/query-core").FetchStatus>;
133
+ suspense: () => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
134
+ } | {
135
+ items: import("vue").ComputedRef<any>;
136
+ options: import("vue").ComputedRef<DictOption[]>;
137
+ data: import("vue").Ref<undefined, undefined>;
138
+ error: import("vue").Ref<null, null>;
139
+ isError: import("vue").Ref<false, false>;
140
+ isPending: import("vue").Ref<true, true>;
141
+ isLoadingError: import("vue").Ref<false, false>;
142
+ isRefetchError: import("vue").Ref<false, false>;
143
+ isSuccess: import("vue").Ref<false, false>;
144
+ isPlaceholderData: import("vue").Ref<false, false>;
145
+ status: import("vue").Ref<"pending", "pending">;
146
+ dataUpdatedAt: import("vue").Ref<number, number>;
147
+ errorUpdatedAt: import("vue").Ref<number, number>;
148
+ failureCount: import("vue").Ref<number, number>;
149
+ failureReason: import("vue").Ref<Error | null, Error | null>;
150
+ errorUpdateCount: import("vue").Ref<number, number>;
151
+ isFetched: import("vue").Ref<boolean, boolean>;
152
+ isFetchedAfterMount: import("vue").Ref<boolean, boolean>;
153
+ isFetching: import("vue").Ref<boolean, boolean>;
154
+ isLoading: import("vue").Ref<boolean, boolean>;
155
+ isInitialLoading: import("vue").Ref<boolean, boolean>;
156
+ isPaused: import("vue").Ref<boolean, boolean>;
157
+ isRefetching: import("vue").Ref<boolean, boolean>;
158
+ isStale: import("vue").Ref<boolean, boolean>;
159
+ isEnabled: import("vue").Ref<boolean, boolean>;
160
+ refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
161
+ fetchStatus: import("vue").Ref<import("@tanstack/query-core").FetchStatus, import("@tanstack/query-core").FetchStatus>;
162
+ suspense: () => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
163
+ } | {
164
+ items: import("vue").ComputedRef<any>;
165
+ options: import("vue").ComputedRef<DictOption[]>;
166
+ data: import("vue").Ref<{}, {}>;
167
+ isError: import("vue").Ref<false, false>;
168
+ error: import("vue").Ref<null, null>;
169
+ isPending: import("vue").Ref<false, false>;
170
+ isLoading: import("vue").Ref<false, false>;
171
+ isLoadingError: import("vue").Ref<false, false>;
172
+ isRefetchError: import("vue").Ref<false, false>;
173
+ isSuccess: import("vue").Ref<true, true>;
174
+ isPlaceholderData: import("vue").Ref<true, true>;
175
+ status: import("vue").Ref<"success", "success">;
176
+ dataUpdatedAt: import("vue").Ref<number, number>;
177
+ errorUpdatedAt: import("vue").Ref<number, number>;
178
+ failureCount: import("vue").Ref<number, number>;
179
+ failureReason: import("vue").Ref<Error | null, Error | null>;
180
+ errorUpdateCount: import("vue").Ref<number, number>;
181
+ isFetched: import("vue").Ref<boolean, boolean>;
182
+ isFetchedAfterMount: import("vue").Ref<boolean, boolean>;
183
+ isFetching: import("vue").Ref<boolean, boolean>;
184
+ isInitialLoading: import("vue").Ref<boolean, boolean>;
185
+ isPaused: import("vue").Ref<boolean, boolean>;
186
+ isRefetching: import("vue").Ref<boolean, boolean>;
187
+ isStale: import("vue").Ref<boolean, boolean>;
188
+ isEnabled: import("vue").Ref<boolean, boolean>;
189
+ refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
190
+ fetchStatus: import("vue").Ref<import("@tanstack/query-core").FetchStatus, import("@tanstack/query-core").FetchStatus>;
191
+ suspense: () => Promise<import("@tanstack/query-core").QueryObserverResult<{}, Error>>;
192
+ };
@@ -0,0 +1,8 @@
1
+ import { getImageBaseUrl } from '../runtime/context';
2
+ /**
3
+ * 把相对路径拼成可访问的图片地址。域名由 setupDisguise 的 imageBaseUrl 决定。
4
+ */
5
+ export declare const useImageUrl: () => {
6
+ ensureImageBaseUrl: typeof getImageBaseUrl;
7
+ resolveImageUrl: (path?: unknown) => string;
8
+ };
@@ -0,0 +1,2 @@
1
+ export { getEntity, paginateLocally, registerEntity } from './registry';
2
+ export type { EntityDefinition, EntityFetchParams, EntityFetchResult, } from './registry';
@@ -0,0 +1,33 @@
1
+ import type { ColumnsItem } from '../components/table-entity/index.type';
2
+ /** ****************************** 类型 ********************************/
3
+ export type EntityFetchParams = {
4
+ keyword?: string;
5
+ page: number;
6
+ per_page: number;
7
+ params?: Record<string, any>;
8
+ };
9
+ export type EntityFetchResult = {
10
+ items: Record<string, any>[];
11
+ total: number;
12
+ };
13
+ /**
14
+ * 实体定义:把一个业务键(如 'dept')映射到取数函数与展示字段,
15
+ * 供 schema-form 的 async-select 字段按 entityKey 查表使用。
16
+ */
17
+ export type EntityDefinition = {
18
+ /** 弹窗列表的列配置 */
19
+ columns?: ColumnsItem[];
20
+ dialogTitle?: string;
21
+ fetch: (params: EntityFetchParams) => Promise<EntityFetchResult>;
22
+ key: string;
23
+ labelKey: string;
24
+ subtitleKey?: string;
25
+ valueKey: string;
26
+ };
27
+ export declare function registerEntity(definition: EntityDefinition): void;
28
+ export declare function getEntity(key: string): EntityDefinition | undefined;
29
+ /** ****************************** 工具 ********************************/
30
+ /**
31
+ * 全量接口转分页结果:接口一次性返回全部数据时,在前端完成关键词过滤与分页。
32
+ */
33
+ export declare function paginateLocally(rows: Record<string, any>[], { keyword, page, per_page }: EntityFetchParams, searchKeys: string[]): EntityFetchResult;
@@ -0,0 +1,25 @@
1
+ export { default as AsyncSelect } from './components/async-select/async-select.vue';
2
+ export { default as BaseCard } from './components/card/index.vue';
3
+ export { CrudPage } from './components/crud-page/index.js';
4
+ export type * from './components/crud-page/index.type.js';
5
+ export { default as DictTag } from './components/dict-tag/index.vue';
6
+ export { DrawerFormPage, useDrawerFormPage, } from './components/drawer-form-page/index.js';
7
+ export type * from './components/drawer-form-page/index.type.js';
8
+ export { default as DisguiseIcon } from './components/disguise-icon/index.vue';
9
+ export { default as ImageUpload } from './components/image-upload/index.vue';
10
+ export { default as ImagesView } from './components/images-view/index.vue';
11
+ export type { ImagesViewProps } from './components/images-view/index.vue';
12
+ export { default as ImportDialog } from './components/import-dialog/index';
13
+ export type * from './components/import-dialog/index.type.js';
14
+ export { default as PictureUpload } from './components/picture-upload/picture-upload.vue';
15
+ export { default as RichTextEditor } from './components/rich-text-editor/index.vue';
16
+ export { registerSchemaFormComponents, SchemaForm } from './components/schema-form/index.js';
17
+ export type * from './components/schema-form/schema-form.type.js';
18
+ export { SearchForm } from './components/search-form/index.js';
19
+ export type * from './components/search-form/index.type.js';
20
+ export type * from './components/table-entity/index.type.js';
21
+ export { default as TableEntity } from './components/table-entity/index.vue';
22
+ export { getEntity, paginateLocally, registerEntity } from './entities/index';
23
+ export type { EntityDefinition, EntityFetchParams, EntityFetchResult, } from './entities/index';
24
+ export { setupDisguise } from './setup';
25
+ export type { DisguiseOptions } from './setup';
@@ -0,0 +1,13 @@
1
+ /******************************** 权限 ********************************/
2
+ /**
3
+ * 判断按钮权限码。未注入时默认放行。
4
+ */
5
+ export declare function useAccess(): {
6
+ hasAccessByCodes(codes: string[]): boolean;
7
+ };
8
+ /**
9
+ * 导出时读取访问令牌。
10
+ */
11
+ export declare function useAccessStore(): {
12
+ readonly accessToken: string;
13
+ };
@@ -0,0 +1,48 @@
1
+ import type { DictValueItem } from './dict';
2
+ import type { DisguiseRequestClient } from './request';
3
+ /******************************** 宿主配置 ********************************/
4
+ export interface UploadFileOptions {
5
+ /** OSS 保存目录,相对 attachment/v3 */
6
+ baseFolder?: string;
7
+ /** 是否给图片加中心水印 */
8
+ addWatermark?: boolean;
9
+ /** 上传进度 0-100 */
10
+ onProgress?: (percent: number) => void;
11
+ }
12
+ export interface UploadFileResult {
13
+ url: string;
14
+ cache_url?: string;
15
+ }
16
+ export interface DisguiseOptions {
17
+ /** 组件内置文案语言,默认 zh-CN */
18
+ locale?: string;
19
+ /** 覆盖内置文案,key 路径与组件里的 t() 一致 */
20
+ messages?: Record<string, Record<string, unknown>>;
21
+ /** 导入、导出使用的请求客户端 */
22
+ request?: DisguiseRequestClient;
23
+ /** 按字典编码返回字典项。不传时字典标签显示原始值 */
24
+ fetchAllDictData?: () => Promise<Record<string, DictValueItem[]>>;
25
+ /** 图片和附件上传 */
26
+ uploadFile?: (file: File, options?: UploadFileOptions) => Promise<UploadFileResult>;
27
+ /** 相对图片路径要拼接的域名 */
28
+ imageBaseUrl?: string;
29
+ /** 返回 false 时隐藏对应权限按钮。不传时全部显示 */
30
+ hasAccess?: (codes: string[]) => boolean;
31
+ /** 导出请求附带的 token */
32
+ getAccessToken?: () => string;
33
+ /** BaseCard 阴影 */
34
+ cardShadow?: 'always' | 'hover' | 'never';
35
+ }
36
+ /**
37
+ * 写入组件运行时需要的请求、上传、字典和文案。
38
+ */
39
+ export declare function configureDisguise(options: DisguiseOptions): void;
40
+ export declare function getLocale(): import("vue").Ref<string, string>;
41
+ export declare function getExtraMessages(): import("vue").Ref<Record<string, Record<string, unknown>>, Record<string, Record<string, unknown>>>;
42
+ export declare function getRequestClient(): DisguiseRequestClient | null;
43
+ export declare function loadDictData(): Promise<{}>;
44
+ export declare function getFileUploader(): ((file: File, options?: UploadFileOptions) => Promise<UploadFileResult>) | undefined;
45
+ export declare function getImageBaseUrl(): string;
46
+ export declare function getAccessChecker(): import("vue").Ref<(codes: string[]) => boolean, (codes: string[]) => boolean>;
47
+ export declare function getAccessToken(): string;
48
+ export declare function getCardShadow(): import("vue").Ref<"always" | "hover" | "never", "always" | "hover" | "never">;
@@ -0,0 +1,22 @@
1
+ /******************************** 字典 ********************************/
2
+ export declare const DICT_DATA_ALL_QUERY_KEY: string[];
3
+ export interface DictValueItem {
4
+ id?: number | string;
5
+ code?: string;
6
+ name?: string;
7
+ color?: string;
8
+ description?: string;
9
+ status?: boolean | number;
10
+ dictCode?: string;
11
+ cssClass?: string;
12
+ dictLabel?: string;
13
+ dictType?: string;
14
+ dictValue?: string;
15
+ dict?: {
16
+ code: string;
17
+ };
18
+ }
19
+ /**
20
+ * 读取宿主注入的全量字典。未注入时返回空对象。
21
+ */
22
+ export declare function fetchAllDictData(): Promise<{}>;
@@ -0,0 +1,12 @@
1
+ import type { Recordable } from './types';
2
+ /**
3
+ * 读取组件文案。宿主可通过 setupDisguise 覆盖。
4
+ */
5
+ export declare function t(key: string, params?: Recordable): string;
6
+ export declare const $t: typeof t;
7
+ /**
8
+ * 给仍调用 useI18n 的上传组件提供同一套文案。
9
+ */
10
+ export declare function useI18n(): {
11
+ t: typeof t;
12
+ };
@@ -0,0 +1,31 @@
1
+ /******************************** 弹窗 ********************************/
2
+ type ModalOptions = {
3
+ cancelText?: string;
4
+ closeOnClickModal?: boolean;
5
+ closeOnPressEscape?: boolean;
6
+ confirmText?: string;
7
+ destroyOnClose?: boolean;
8
+ footer?: boolean;
9
+ fullscreenButton?: boolean;
10
+ onCancel?: () => void;
11
+ onClosed?: () => void;
12
+ onConfirm?: () => void;
13
+ onOpenChange?: (isOpen: boolean) => void;
14
+ title?: string;
15
+ zIndex?: number;
16
+ };
17
+ /**
18
+ * 兼容原弹窗调用的轻量对话框。支持 open、close 和 setState。
19
+ */
20
+ export declare function useVbenModal(options?: ModalOptions): readonly [import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
21
+ [key: string]: any;
22
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
23
+ readonly open: () => void;
24
+ readonly close: () => void;
25
+ readonly setState: (patch: {
26
+ footer?: boolean;
27
+ fullscreen?: boolean;
28
+ title?: string;
29
+ }) => void;
30
+ }];
31
+ export {};
@@ -0,0 +1,6 @@
1
+ /** BaseCard 读取的外观配置 */
2
+ export declare const preferences: {
3
+ theme: {
4
+ readonly cardShadow: "always" | "hover" | "never";
5
+ };
6
+ };
@@ -0,0 +1,19 @@
1
+ /******************************** 请求 ********************************/
2
+ export interface RequestResponse<T> {
3
+ data: T;
4
+ headers: {
5
+ get?: (name: string) => null | string;
6
+ [key: string]: unknown;
7
+ };
8
+ }
9
+ export interface DisguiseRequestClient {
10
+ getBaseUrl: () => string;
11
+ download: <T>(url: string, config?: Record<string, unknown>) => Promise<T>;
12
+ upload: <T>(url: string, data?: Record<string, unknown>, config?: Record<string, unknown>) => Promise<T>;
13
+ }
14
+ /** 导入、导出组件使用的请求入口 */
15
+ export declare const requestClient: {
16
+ getBaseUrl(): string;
17
+ download<T>(url: string, config?: Record<string, unknown>): Promise<T>;
18
+ upload<T>(url: string, data?: Record<string, unknown>, config?: Record<string, unknown>): Promise<T>;
19
+ };
@@ -0,0 +1 @@
1
+ export type Recordable = Record<string, unknown>;
@@ -0,0 +1,5 @@
1
+ import type { UploadFileOptions, UploadFileResult } from './context';
2
+ /**
3
+ * 上传单个文件。具体接口由 setupDisguise 的 uploadFile 提供。
4
+ */
5
+ export declare function uploadFileApi(file: File, options?: UploadFileOptions): Promise<UploadFileResult>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 按 dayjs 格式输出日期。秒级时间戳会先转成毫秒。
3
+ */
4
+ export declare function formatDate(time?: unknown, format?: string): string;
5
+ /**
6
+ * 输出日期时间。
7
+ */
8
+ export declare function formatDateTime(time?: unknown): string;
9
+ /******************************** 下载 ********************************/
10
+ /**
11
+ * 用 Blob 触发浏览器下载。
12
+ */
13
+ export declare function downloadFileFromBlob({ fileName, source, }: {
14
+ fileName?: string;
15
+ source: Blob;
16
+ }): void;
@@ -0,0 +1,11 @@
1
+ import type { AttachmentData } from '../components/file-upload/file-upload.type';
2
+ export interface UploadFileParams {
3
+ /** OSS 保存目录,相对 attachment/v3 */
4
+ baseFolder?: string;
5
+ /** 是否给图片加中心水印 */
6
+ addWatermark?: boolean;
7
+ }
8
+ /**
9
+ * 上传文件并转成附件数据,供上传组件使用。
10
+ */
11
+ export declare function uploadFile(file: File, onProgress?: (percent: number) => void, options?: UploadFileParams): Promise<AttachmentData>;
@@ -0,0 +1,7 @@
1
+ import type { DisguiseOptions } from './runtime/context';
2
+ /**
3
+ * 在应用启动时注入请求、上传、字典、权限和文案。
4
+ * 组件不直接依赖具体后台,这些能力都从这里进入。
5
+ */
6
+ export declare function setupDisguise(options?: DisguiseOptions): void;
7
+ export type { DisguiseOptions } from './runtime/context';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disguise-ui",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
4
  "description": "Disguise:可独立使用的后台列表、表单和上传组件",
5
5
  "type": "module",
6
6
  "files": [
@@ -9,8 +9,10 @@
9
9
  ],
10
10
  "main": "./dist/disguise-ui.js",
11
11
  "module": "./dist/disguise-ui.js",
12
+ "types": "./dist/types/index.d.ts",
12
13
  "exports": {
13
14
  ".": {
15
+ "types": "./dist/types/index.d.ts",
14
16
  "import": "./dist/disguise-ui.js"
15
17
  },
16
18
  "./style.css": "./dist/style.css"
@@ -19,7 +21,7 @@
19
21
  "**/*.css"
20
22
  ],
21
23
  "scripts": {
22
- "build": "vite build",
24
+ "build": "vite build && node scripts/build-types.mjs",
23
25
  "docs:dev": "vitepress dev docs",
24
26
  "docs:build": "vitepress build docs",
25
27
  "docs:preview": "vitepress build docs && vitepress preview docs"
@@ -79,6 +81,7 @@
79
81
  "vite": "^8.2.2",
80
82
  "vitepress": "^2.0.0-alpha.19",
81
83
  "vue": "^3.5.40",
82
- "vue-draggable-plus": "^0.6.1"
84
+ "vue-draggable-plus": "^0.6.1",
85
+ "vue-tsc": "^3.3.14"
83
86
  }
84
87
  }