morghulis 1.0.31 → 1.0.33

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 (42) hide show
  1. package/README.md +74 -350
  2. package/dist/index.css +1 -1
  3. package/dist/index.d.ts +220 -364
  4. package/dist/index.js +57062 -8657
  5. package/dist/index.js.map +1 -0
  6. package/package.json +28 -48
  7. package/dist/components/cell/MCell.vue.d.ts +0 -11
  8. package/dist/components/cell/char/CharCell.vue.d.ts +0 -15
  9. package/dist/components/cell/date/DateCell.vue.d.ts +0 -15
  10. package/dist/components/cell/refer/SelectCell.vue.d.ts +0 -15
  11. package/dist/components/cell/simple/BooleanCell.vue.d.ts +0 -15
  12. package/dist/components/cell/simple/DefaultCell.vue.d.ts +0 -15
  13. package/dist/components/cell/simple/NumberCell.vue.d.ts +0 -18
  14. package/dist/components/cell/useCellComponents.d.ts +0 -2
  15. package/dist/components/common/MCtrlBtn.vue.d.ts +0 -30
  16. package/dist/components/common/MOption.vue.d.ts +0 -10
  17. package/dist/components/dialog/MDialog.vue.d.ts +0 -57
  18. package/dist/components/dialog/MDialogHeader.vue.d.ts +0 -9
  19. package/dist/components/form/MForm.vue.d.ts +0 -13
  20. package/dist/components/table/MTable.vue.d.ts +0 -65
  21. package/dist/components/table/MTableButtons.vue.d.ts +0 -17
  22. package/dist/components/table/MTableHeader.vue.d.ts +0 -17
  23. package/dist/components/table/data/DCell.vue.d.ts +0 -18
  24. package/dist/components/table/data/DForm.vue.d.ts +0 -16
  25. package/dist/components/table/data/DTable.vue.d.ts +0 -78
  26. package/dist/components/table/data/DTableController.vue.d.ts +0 -19
  27. package/dist/components/table/data/DTablePopController.vue.d.ts +0 -13
  28. package/dist/components/table/data/useDTable.d.ts +0 -77
  29. package/dist/components/table/data/useDTableCell.d.ts +0 -6
  30. package/dist/components/table/useMTable.d.ts +0 -25
  31. package/dist/hooks/authorize.d.ts +0 -13
  32. package/dist/hooks/channel.d.ts +0 -13
  33. package/dist/hooks/cookies.d.ts +0 -6
  34. package/dist/hooks/request.d.ts +0 -5
  35. package/dist/hooks/socket.d.ts +0 -7
  36. package/dist/index.umd.cjs +0 -38
  37. package/dist/tools/dao.d.ts +0 -27
  38. package/dist/tools/feedback.d.ts +0 -4
  39. package/dist/tools/query.d.ts +0 -20
  40. package/dist/types/dialog/dialog.types.d.ts +0 -41
  41. package/dist/types/index.d.ts +0 -1
  42. package/dist/types/table/m.table.types.d.ts +0 -55
package/dist/index.d.ts CHANGED
@@ -1,374 +1,230 @@
1
1
  import type { App } from 'vue';
2
- import type { ElDialog, ElButton, ElText, ElDivider, ElSpace } from 'element-plus';
3
2
 
4
- // 导入Vue组件实例类型
5
- import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, EmitsOptions, Component } from 'vue';
6
-
7
- // 如果这些类型错误是由于TypeScript版本不匹配导致的,我们可以使用更灵活的导入方式
8
- declare namespace Vue {
9
- interface App {}
10
- interface Component {}
11
- interface ComponentOptionsMixin {}
12
- interface VNodeProps {}
13
- interface AllowedComponentProps {}
14
- interface ComponentCustomProps {}
15
- interface EmitsOptions {}
16
- interface DefineComponent<P = {}, S = {}, M = {}> {
17
- new (): {
18
- $props: P
19
- }
20
- }
21
- }
22
-
23
- type DefineComponent<P = {}> = Vue.DefineComponent<P>;
24
-
25
- // 基础类型定义
26
- export type UIFeedbackTypes = "success" | "info" | "warning" | "error";
27
- export type UITextTypes = "success" | "info" | "warning" | "danger" | 'primary';
28
- export type UISizeTypes = 'default' | 'small' | 'large' | "";
29
-
30
- // 直接在类型定义文件中定义MorDialogProps,避免相对路径引用
31
- export interface MorDialogProps {
32
- modelValue?: boolean,
33
- title?: string,
34
- subTitle?: string,
35
- width?: string | number,
36
- fullscreen?: boolean,
37
- top?: string,
38
- modal?: boolean,
39
- modalClass?: string,
40
- headerClass?: string,
41
- bodyClass?: string,
42
- footerClass?: string,
43
- appendToBody?: boolean,
44
- appendTo?: string,
45
- lockScroll?: boolean,
46
- openDelay?: number,
47
- closeDelay?: number,
48
- closeOnClickModal?: boolean,
49
- closeOnPressEscape?: boolean,
50
- showClose?: boolean,
51
- beforeClose?: (done: () => void) => void,
52
- draggable?: boolean,
53
- overFlow?: boolean,
54
- center?: boolean,
55
- alignCenter?: boolean,
56
- destroyOnClose?: boolean,
57
- closeIcon?: string,
58
- zIndex?: number,
59
- headerAriaLevel?: string,
60
- confirm?: (data: any, done: () => void) => void,
61
- cancel?: (data: any, done: () => void) => void,
62
- confirmButtonText?: string,
63
- cancelButtonText?: string,
64
- data?: any
65
- }
66
-
67
- // 定义MorDialogConfig接口
68
- export interface MorDialogConfig {
69
- title?: string,
70
- subTitle?: string
71
- }
72
-
73
- // 定义MorOption接口
74
- export interface MorOption {
75
- baseURL?: string,
76
- minioURL?: string,
77
- [key: string]: any
78
- }
79
-
80
- // 定义表格相关类型
81
- export interface DataItem {
82
- [key: string]: any;
83
- }
84
-
85
- export type Orders = Array<{
86
- column: string;
87
- asc?: boolean;
88
- }>;
89
-
90
- export interface DaoTypes {
91
- add: (entity: string, bean: DataItem) => Promise<any>;
92
- update: (entity: string, bean: DataItem) => Promise<any>;
93
- delete: (entity: string, id: string | number) => Promise<any>;
94
- get: (entity: string, id: string | number, options?: any) => Promise<any>;
95
- list: (entity: string, options?: any) => Promise<any>;
96
- page: (entity: string, page: number, size: number, options?: any) => Promise<any>;
97
- }
98
-
99
- export interface MetaField {
100
- code: string;
101
- name: string;
102
- type: string;
103
- options?: any[];
104
- required?: boolean;
105
- readonly?: boolean;
106
- hidden?: boolean;
107
- [key: string]: any;
108
- }
109
-
110
- export interface MetaView {
111
- code: string;
112
- name: string;
113
- fields: MetaField[];
114
- [key: string]: any;
115
- }
116
-
117
- export type SortableCallbackFn = (newIndex: number, oldIndex: number) => void;
118
-
119
- export type MTableButton = {
120
- size?: UISizeTypes;
121
- handler?: (row: any, event?: Event) => void;
122
- title?: string | Function;
123
- type?: UITextTypes | Function;
124
- link?: boolean | Function;
125
- plain?: boolean | Function;
126
- text?: boolean | Function;
127
- round?: boolean | Function;
128
- circle?: boolean | Function;
129
- disabled?: boolean | Function;
130
- dark?: boolean | Function;
131
- color?: string | Function;
132
- tag?: string | Function;
3
+ /**
4
+ * Morghulis库的主配置选项
5
+ */
6
+ export interface MOptions {
7
+ /**
8
+ * API请求的基础URL
9
+ */
10
+ baseURL: string;
11
+ /**
12
+ * Minio对象存储的基础URL
13
+ */
14
+ minioURL: string;
15
+ }
16
+
17
+ /**
18
+ * 反馈类型
19
+ */
20
+ export type MFeedback = "success" | "info" | "warning" | "error";
21
+
22
+ /**
23
+ * 消息提示工具类型
24
+ */
25
+ export interface MMsg {
26
+ /**
27
+ * 显示信息提示
28
+ * @param content 提示内容
29
+ */
30
+ info: (content: string) => void;
31
+
32
+ /**
33
+ * 显示成功提示
34
+ * @param content 提示内容
35
+ */
36
+ success: (content: string) => void;
37
+
38
+ /**
39
+ * 显示警告提示
40
+ * @param content 提示内容
41
+ */
42
+ warning: (content: string) => void;
43
+
44
+ /**
45
+ * 显示错误提示
46
+ * @param content 提示内容
47
+ */
48
+ error: (content: string) => void;
49
+
50
+ /**
51
+ * 自定义类型提示
52
+ * @param content 提示内容
53
+ * @param type 提示类型
54
+ */
55
+ show: (content: string, type?: MFeedback) => void;
56
+ }
57
+
58
+ /**
59
+ * 对话框工具类型
60
+ */
61
+ export interface MBox {
62
+ /**
63
+ * 显示信息对话框
64
+ * @param content 内容
65
+ * @param title 标题
66
+ */
67
+ info: (content: string, title?: string) => Promise<any>;
68
+
69
+ /**
70
+ * 显示成功对话框
71
+ * @param content 内容
72
+ * @param title 标题
73
+ */
74
+ success: (content: string, title?: string) => Promise<any>;
75
+
76
+ /**
77
+ * 显示警告对话框
78
+ * @param content 内容
79
+ * @param title 标题
80
+ */
81
+ warning: (content: string, title?: string) => Promise<any>;
82
+
83
+ /**
84
+ * 显示错误对话框
85
+ * @param content 内容
86
+ * @param title 标题
87
+ */
88
+ error: (content: string, title?: string) => Promise<any>;
89
+
90
+ /**
91
+ * 自定义类型对话框
92
+ * @param content 内容
93
+ * @param title 标题
94
+ * @param type 类型
95
+ */
96
+ show: (content: string, title?: string, type?: MFeedback) => void;
97
+ }
98
+
99
+ /**
100
+ * 系统关键字常量
101
+ */
102
+ export const SYSTEM_KEY: {
103
+ /** 客户端标识 */
104
+ CLIENT: string;
105
+ /** 用户ID */
106
+ USER: string;
107
+ /** 认证令牌 */
108
+ AUTH: string;
133
109
  };
134
110
 
135
- export type MTableColumn = {
136
- label: string;
137
- component: Component;
138
- width?: string | number;
111
+ /**
112
+ * 消息提示工具
113
+ * 用于显示轻量级的反馈信息
114
+ */
115
+ export const $message: MMsg;
116
+
117
+ /**
118
+ * 警告框工具
119
+ * 用于显示需要用户确认的信息
120
+ */
121
+ export const $alert: MBox;
122
+
123
+ /**
124
+ * 确认框工具
125
+ * 用于显示需要用户确认的提示
126
+ */
127
+ export const $confirm: MBox;
128
+
129
+ /**
130
+ * Cookie管理工具钩子
131
+ * @returns Cookie操作方法集合
132
+ */
133
+ export function useMCookies(): {
134
+ /**
135
+ * 获取Cookie值
136
+ * @param path 路径,可以是简单的key或者点分隔的路径
137
+ * @returns 对应路径的值
138
+ */
139
+ get: (path: string) => any;
140
+
141
+ /**
142
+ * 设置Cookie值
143
+ * @param path 路径,可以是简单的key或者点分隔的路径
144
+ * @param value 需要存储的值,如果为null则删除该路径
145
+ */
146
+ set: (path: string, value?: any) => void;
147
+
148
+ /**
149
+ * 加载Cookie值,如果不存在则设置默认值
150
+ * @param key Cookie键
151
+ * @param value 默认值
152
+ * @returns 加载的值或默认值
153
+ */
154
+ load: (key: string, value?: any) => any;
155
+
156
+ /**
157
+ * 删除Cookie值
158
+ * @param path 路径,可以是简单的key或者点分隔的路径
159
+ */
160
+ remove: (path: string) => void;
139
161
  };
140
162
 
141
- export interface TableProps {
142
- data?: any[];
143
- height?: string | number;
144
- maxHeight?: string | number;
145
- stripe?: boolean;
146
- border?: boolean;
147
- size?: string;
148
- fit?: boolean;
149
- showHeader?: boolean;
150
- highlightCurrentRow?: boolean;
151
- currentRowKey?: string | number;
152
- rowClassName?: string | ((param: { row: any, rowIndex: number }) => string);
153
- rowStyle?: object | ((param: { row: any, rowIndex: number }) => object);
154
- cellClassName?: string | ((param: { row: any, column: any, rowIndex: number, columnIndex: number }) => string);
155
- cellStyle?: object | ((param: { row: any, column: any, rowIndex: number, columnIndex: number }) => object);
156
- headerRowClassName?: string | ((param: { row: any, rowIndex: number }) => string);
157
- headerRowStyle?: object | ((param: { row: any, rowIndex: number }) => object);
158
- headerCellClassName?: string | ((param: { row: any, column: any, rowIndex: number, columnIndex: number }) => string);
159
- headerCellStyle?: object | ((param: { row: any, column: any, rowIndex: number, columnIndex: number }) => object);
160
- rowKey?: string | ((row: any) => string);
161
- emptyText?: string;
162
- defaultExpandAll?: boolean;
163
- expandRowKeys?: any[];
164
- defaultSort?: { prop: string, order: string };
165
- tooltipEffect?: string;
166
- showSummary?: boolean;
167
- sumText?: string;
168
- summaryMethod?: (param: { columns: any[], data: any[] }) => any[];
169
- spanMethod?: (param: { row: any, column: any, rowIndex: number, columnIndex: number }) => number[] | { rowspan: number, colspan: number };
170
- selectOnIndeterminate?: boolean;
171
- indent?: number;
172
- lazy?: boolean;
173
- load?: (row: any, treeNode: any, resolve: (data: any[]) => void) => void;
174
- treeProps?: { children: string, hasChildren: string };
175
- }
176
-
177
- export interface MorghulisTableProps extends TableProps {
178
- loading?: boolean;
179
- view: MetaView;
180
- buttons?: MTableButton[];
181
- columns?: MTableColumn[];
182
- sortableCallback?: SortableCallbackFn;
183
- }
184
-
185
- export interface DTableProps {
186
- auth?: boolean;
187
- db: DaoTypes;
188
- entity: string;
189
- code?: string;
190
- size?: number;
191
- page?: number;
192
- includes?: DataItem;
193
- excludes?: DataItem;
194
- orders?: Orders;
195
- buttons?: MTableButton[];
196
- columns?: MTableColumn[];
197
- }
198
-
199
- export interface DCellProps {
200
- view: MetaView;
201
- prop: string;
202
- bean: DataItem;
203
- db: DaoTypes;
204
- disabled?: boolean;
205
- }
206
-
207
- // 定义MFormProps接口
208
- export interface MFormProps {
209
- item: DataItem;
210
- view: MetaView;
211
- db: DaoTypes;
212
- }
213
-
214
- // 定义DFormProps接口
215
- export interface DFormProps {
216
- selection: any[];
217
- view: MetaView;
218
- db: DaoTypes;
219
- bean: DataItem;
220
- }
221
-
222
- // 定义useMorghulisAuthorize函数的返回类型
223
- export interface MorghulisAuthorize {
224
- $client: string;
225
- user: () => any;
226
- check: (uid?: any) => boolean;
227
- login: (uid: any) => void;
228
- logout: () => void;
229
- bearer: () => string | null;
230
- }
231
-
232
- // 创建库的入口函数
233
- export declare function createMorghulis(options?: MorOption): {
234
- install: (Vue: App) => void;
163
+ /**
164
+ * 授权管理工具钩子
165
+ * @returns 授权相关的方法集合
166
+ */
167
+ export function useMAuthorize(): {
168
+ /**
169
+ * 客户端ID
170
+ */
171
+ $client: string;
172
+
173
+ /**
174
+ * 获取当前用户ID
175
+ * @returns 用户ID
176
+ */
177
+ user: () => any;
178
+
179
+ /**
180
+ * 检查用户ID是否匹配当前用户
181
+ * @param uid 用户ID
182
+ * @returns 是否匹配
183
+ */
184
+ check: (uid?: any) => boolean;
185
+
186
+ /**
187
+ * 登录用户
188
+ * @param uid 用户ID
189
+ */
190
+ login: (uid: any) => void;
191
+
192
+ /**
193
+ * 登出当前用户
194
+ */
195
+ logout: () => void;
196
+
197
+ /**
198
+ * 获取认证令牌
199
+ * @returns Bearer认证令牌或null
200
+ */
201
+ bearer: () => string | null;
235
202
  };
236
203
 
237
- // 导出更详细的组件类型
238
-
239
- // 导出MDialog组件类型增强
240
- export declare interface MDialogInstance {
241
- open: (data?: any, config?: MorDialogConfig) => void;
242
- close: () => void;
243
- }
244
-
245
- // 添加v-model和事件支持
246
- export interface ModelDirectives {
247
- 'v-model'?: any;
248
- 'v-model:modelValue'?: any;
249
- 'v-model:title'?: string;
250
- 'v-model:subTitle'?: string;
251
- }
252
-
253
- // 更新MDialog类型
254
- export declare const MDialog: DefineComponent<MorDialogProps & {
255
- 'onUpdate:modelValue'?: (value: boolean) => any;
256
- 'onUpdate:title'?: (value: string) => any;
257
- 'onUpdate:subTitle'?: (value: string) => any;
258
- 'onClose'?: () => any;
259
- } & ModelDirectives> & MDialogInstance;
260
-
261
- // 导出MTable组件类型增强
262
- export declare interface MTableInstance {
263
- getSelection: () => any[];
264
- setSelection: (rows: any[]) => void;
265
- closePopover: () => void;
266
- }
267
-
268
- // 更新MTable类型
269
- export declare const MTable: DefineComponent<MorghulisTableProps & {
270
- 'onSelection-change'?: (selection: any[]) => any;
271
- 'onSort'?: (column: any, prop: string, order: string) => any;
272
- }> & MTableInstance;
273
-
274
- // 导出MForm组件类型增强
275
- export declare interface MFormInstance {
276
- getData: () => any;
277
- reset: (prop: string) => void;
278
- }
279
- export declare const MForm: DefineComponent<MFormProps> & MFormInstance;
280
-
281
- // 导出DTable组件类型增强
282
- export declare interface DTableInstance {
283
- refresh: () => void;
284
- add: () => void;
285
- edit: (row: any) => void;
286
- remove: (row: any) => void;
287
- handlePageSizeChange: (size: number) => void;
288
- handleCurrentPageChange: (page: number) => void;
289
- load: () => void;
290
- upload: (data: any[]) => void;
291
- }
292
- export declare const DTable: DefineComponent<DTableProps> & DTableInstance;
293
-
294
- // 导出DForm组件类型增强
295
- export declare interface DFormInstance {
296
- getData: () => any[];
297
- }
298
- export declare const DForm: DefineComponent<DFormProps> & DFormInstance;
299
-
300
- // 导出DCell组件类型增强
301
- export declare interface DCellEvents {
302
- onCancel: (...args: any[]) => any;
303
- onSave: (...args: any[]) => any;
304
- }
305
- export declare const DCell: DefineComponent<DCellProps & DCellEvents>;
306
-
307
- // 导出MCell组件
308
- export declare const MCell: DefineComponent;
309
-
310
- // 导出DController组件
311
- export declare const DController: DefineComponent;
312
-
313
- // 声明useMorghulisAuthorize函数
314
- export declare function useMorghulisAuthorize(): MorghulisAuthorize;
315
-
316
- // 其他hooks
317
- export declare function useMorghulisChannel(): any;
318
- export declare function useMorghulisSockets(baseURL?: string): any;
319
- export declare function loadMorghulisSockets(baseURL?: string): any;
320
- export declare function useMorghulisRequest(): {
321
- get: <T = any>(url: string, params?: any, config?: any) => Promise<T>;
322
- post: <T = any>(url: string, data?: any, config?: any) => Promise<T>;
323
- put: <T = any>(url: string, data?: any, config?: any) => Promise<T>;
324
- delete: <T = any>(url: string, data?: any, config?: any) => Promise<T>;
325
- };
326
- export declare function useMorghulisCookies(): {
327
- get: (key: string, defaultValue?: any) => any;
328
- set: (key: string, value: any, options?: any) => void;
329
- remove: (key: string, options?: any) => void;
330
- load: (key: string, defaultValue?: any) => any;
204
+ /**
205
+ * 请求工具钩子
206
+ * @returns 请求相关的方法集合
207
+ */
208
+ export function useMoRequest(): {
209
+ /**
210
+ * 获取HTTP请求实例
211
+ * @param auth 是否需要授权
212
+ * @returns Axios实例
213
+ */
214
+ getHttpRequest: (auth?: boolean) => any;
215
+
216
+ /**
217
+ * 获取Minio请求实例
218
+ * @returns Axios实例
219
+ */
220
+ getMinioRequest: () => any;
331
221
  };
332
222
 
333
- // 声明全局组件类型
334
- declare module '@vue/runtime-core' {
335
- export interface GlobalComponents {
336
- // Morghulis组件
337
- MDialog: typeof MDialog;
338
- MTable: typeof MTable;
339
- MForm: typeof MForm;
340
- MCell: typeof MCell;
341
- DTable: typeof DTable;
342
- DCell: typeof DCell;
343
- DForm: typeof DForm;
344
- DController: typeof DController;
345
-
346
- // Element Plus组件
347
- ElButton: typeof ElButton;
348
- ElDialog: typeof ElDialog;
349
- ElText: typeof ElText;
350
- ElDivider: typeof ElDivider;
351
- ElSpace: typeof ElSpace;
352
- // 可以根据需要添加更多Element Plus组件
353
-
354
- // PascalCase 形式
355
- MTable: typeof import('morghulis')['MTable']
356
- MDialog: typeof import('morghulis')['MDialog']
357
- MForm: typeof import('morghulis')['MForm']
358
- DTable: typeof import('morghulis')['DTable']
359
- DCell: typeof import('morghulis')['DCell']
360
- DForm: typeof import('morghulis')['DForm']
361
- DController: typeof import('morghulis')['DController']
362
- MCell: typeof import('morghulis')['MCell']
363
-
364
- // kebab-case 形式
365
- 'm-table': typeof import('morghulis')['MTable']
366
- 'm-dialog': typeof import('morghulis')['MDialog']
367
- 'm-form': typeof import('morghulis')['MForm']
368
- 'd-table': typeof import('morghulis')['DTable']
369
- 'd-cell': typeof import('morghulis')['DCell']
370
- 'd-form': typeof import('morghulis')['DForm']
371
- 'd-controller': typeof import('morghulis')['DController']
372
- 'm-cell': typeof import('morghulis')['MCell']
373
- }
374
- }
223
+ /**
224
+ * 创建Morghulis实例
225
+ * @param options 配置选项
226
+ * @returns Vue插件对象
227
+ */
228
+ export function createMorghulis(options?: MOptions): {
229
+ install: (Vue: App) => void;
230
+ };