morghulis 1.0.14 → 1.0.16

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 (2) hide show
  1. package/package.json +1 -1
  2. package/types/index.d.ts +66 -19
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morghulis",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "基于Vue 3和TypeScript的数据库便捷搭建UI组件库",
5
5
  "main": "dist/morghulis.umd.js",
6
6
  "module": "dist/morghulis.es.js",
package/types/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { App } from 'vue';
2
2
  import type { ElDialog, ElButton, ElText, ElDivider, ElSpace } from 'element-plus';
3
3
 
4
+ // 导入Vue组件实例类型
5
+ import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, EmitsOptions } from 'vue';
6
+
4
7
  // 直接在类型定义文件中定义MorDialogProps,避免相对路径引用
5
8
  export interface MorDialogProps {
6
9
  modelValue?: boolean,
@@ -22,7 +25,7 @@ export interface MorDialogProps {
22
25
  closeOnClickModal?: boolean,
23
26
  closeOnPressEscape?: boolean,
24
27
  showClose?: boolean,
25
- beforeClose?: Function,
28
+ beforeClose?: (done: () => void) => void,
26
29
  draggable?: boolean,
27
30
  overFlow?: boolean,
28
31
  center?: boolean,
@@ -31,13 +34,19 @@ export interface MorDialogProps {
31
34
  closeIcon?: string,
32
35
  zIndex?: number,
33
36
  headerAriaLevel?: string,
34
- confirm?: Function,
35
- cancel?: Function,
37
+ confirm?: (data: any, done: () => void) => void,
38
+ cancel?: (data: any, done: () => void) => void,
36
39
  confirmButtonText?: string,
37
40
  cancelButtonText?: string,
38
41
  data?: any
39
42
  };
40
43
 
44
+ // 定义MorDialogConfig接口
45
+ export interface MorDialogConfig {
46
+ title: string,
47
+ subTitle: string
48
+ }
49
+
41
50
  // 定义MorOption接口
42
51
  export interface MorOption {
43
52
  [key: string]: any
@@ -50,27 +59,65 @@ export declare function createMorghulis(options?: MorOption): {
50
59
  };
51
60
 
52
61
  // 导出MDialog组件
53
- export declare const MDialog: typeof import('../src/components/dialog/MDialog.vue')['default'];
62
+ export declare const MDialog: DefineComponent<
63
+ MorDialogProps,
64
+ {},
65
+ {},
66
+ {},
67
+ {},
68
+ ComponentOptionsMixin,
69
+ ComponentOptionsMixin,
70
+ {
71
+ 'update:modelValue': (value: boolean) => true;
72
+ 'close': () => true;
73
+ 'update:title': (value: string) => true;
74
+ 'update:subTitle': (value: string) => true;
75
+ },
76
+ string,
77
+ VNodeProps & AllowedComponentProps & ComponentCustomProps,
78
+ Readonly<MorDialogProps> & {
79
+ onClose?: () => any;
80
+ 'onUpdate:modelValue'?: (value: boolean) => any;
81
+ 'onUpdate:title'?: (value: string) => any;
82
+ 'onUpdate:subTitle'?: (value: string) => any;
83
+ },
84
+ {
85
+ title: string;
86
+ width: string | number;
87
+ fullscreen: boolean;
88
+ top: string;
89
+ modal: boolean;
90
+ modalClass: string;
91
+ headerClass: string;
92
+ bodyClass: string;
93
+ footerClass: string;
94
+ appendToBody: boolean;
95
+ appendTo: string;
96
+ lockScroll: boolean;
97
+ openDelay: number;
98
+ closeDelay: number;
99
+ closeOnClickModal: boolean;
100
+ closeOnPressEscape: boolean;
101
+ showClose: boolean;
102
+ draggable: boolean;
103
+ overFlow: boolean;
104
+ center: boolean;
105
+ alignCenter: boolean;
106
+ destroyOnClose: boolean;
107
+ closeIcon: string;
108
+ confirmButtonText: string;
109
+ cancelButtonText: string;
110
+ }
111
+ > & {
112
+ open: (data?: any, config?: MorDialogConfig) => void;
113
+ close: () => void;
114
+ };
54
115
 
55
116
  // 声明全局组件类型
56
117
  declare module '@vue/runtime-core' {
57
118
  export interface GlobalComponents {
58
119
  // Morghulis组件
59
- MDialog: {
60
- new (): {
61
- $props: MorDialogProps & {
62
- modelValue?: boolean;
63
- };
64
- $slots: {
65
- default: (props: { data: any }) => any;
66
- title: (props: { data: any }) => any;
67
- 'sub-title': (props: { data: any }) => any;
68
- header: (props: { data: any }) => any;
69
- footer: (props: { data: any }) => any;
70
- };
71
- $emit: (event: 'update:modelValue' | 'close' | 'update:title' | 'update:subTitle', value: any) => void;
72
- };
73
- };
120
+ MDialog: typeof MDialog;
74
121
 
75
122
  // Element Plus组件
76
123
  ElButton: typeof ElButton;