morghulis 1.0.47 → 1.0.49

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.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { App, DefineComponent } from 'vue';
1
+ import type { App, DefineComponent, Component } from 'vue';
2
2
  import type * as ElementPlus from 'element-plus';
3
+ import type { DialogProps } from 'element-plus';
3
4
 
4
5
  // 导出Element Plus的所有类型
5
6
  export * from 'element-plus';
@@ -116,8 +117,9 @@ export interface MDialogConfig {
116
117
 
117
118
  /**
118
119
  * 对话框属性选项
120
+ * 结合了Element Plus的Dialog组件属性和自定义属性
119
121
  */
120
- export interface MDialogProps extends MDialogConfig {
122
+ export interface MDialogProps extends Partial<DialogProps>, MDialogConfig {
121
123
  /**
122
124
  * 对话框宽度
123
125
  */
@@ -134,6 +136,92 @@ export interface MDialogProps extends MDialogConfig {
134
136
  * 取消回调函数
135
137
  */
136
138
  cancel?: (data: any, done: () => void) => void;
139
+ /**
140
+ * 对话框标题
141
+ */
142
+ title?: string;
143
+ /**
144
+ * 对话框副标题
145
+ */
146
+ subtitle?: string;
147
+ /**
148
+ * 是否显示关闭按钮
149
+ */
150
+ showClose?: boolean;
151
+ /**
152
+ * 是否全屏显示
153
+ */
154
+ fullscreen?: boolean;
155
+ /**
156
+ * 是否可拖动
157
+ */
158
+ draggable?: boolean;
159
+ /**
160
+ * 是否居中显示
161
+ */
162
+ center?: boolean;
163
+ /**
164
+ * 关闭前的回调
165
+ */
166
+ beforeClose?: (done: () => void) => void;
167
+ /**
168
+ * 自定义类名
169
+ */
170
+ customClass?: string;
171
+ /**
172
+ * 是否在关闭时销毁
173
+ */
174
+ destroyOnClose?: boolean;
175
+ /**
176
+ * 是否显示遮罩层
177
+ */
178
+ modal?: boolean;
179
+ /**
180
+ * 是否在点击遮罩层时关闭
181
+ */
182
+ closeOnClickModal?: boolean;
183
+ /**
184
+ * 是否在按下ESC时关闭
185
+ */
186
+ closeOnPressEscape?: boolean;
187
+ /**
188
+ * 是否锁定屏幕滚动
189
+ */
190
+ lockScroll?: boolean;
191
+ /**
192
+ * 是否将对话框插入到body元素
193
+ */
194
+ appendToBody?: boolean;
195
+ /**
196
+ * 确认按钮文本
197
+ */
198
+ confirmButtonText?: string;
199
+ /**
200
+ * 取消按钮文本
201
+ */
202
+ cancelButtonText?: string;
203
+ /**
204
+ * 初始数据
205
+ */
206
+ data?: any;
207
+ }
208
+
209
+ /**
210
+ * 对话框头部组件属性
211
+ */
212
+ export interface MDialogHeaderProps {
213
+ /**
214
+ * 标题
215
+ */
216
+ title?: string;
217
+ /**
218
+ * 副标题
219
+ */
220
+ subtitle?: string;
221
+ /**
222
+ * 配置选项
223
+ */
224
+ config: MDialogConfig;
137
225
  }
138
226
 
139
227
  /**
@@ -271,47 +359,41 @@ export function createMorghulis(options?: MOptions): {
271
359
 
272
360
  /**
273
361
  * 对话框组件
274
- * 支持的属性和方法完整列表
362
+ * 提供基于Element Plus对话框的增强版本
275
363
  */
276
- export const MDialog: DefineComponent<{
277
- /** 对话框标题 */
278
- title?: string;
279
- /** 对话框副标题 */
280
- subtitle?: string;
281
- /** 对话框宽度 */
282
- width?: string | number;
283
- /** 对话框距顶部距离 */
284
- top?: string;
285
- /** 确认回调函数 */
286
- confirm?: (data: any, done: () => void) => void;
287
- /** 取消回调函数 */
288
- cancel?: (data: any, done: () => void) => void;
289
- /** 自定义类名 */
290
- class?: string | object | string[];
291
- /** 是否显示关闭按钮 */
292
- 'close-on-click-modal'?: boolean;
293
- /** 是否显示遮罩层 */
294
- modal?: boolean;
295
- /** 是否可拖拽 */
296
- draggable?: boolean;
297
- }, {}, any, {}, {}, {}, {}, {
298
- /** 打开对话框 */
364
+ export const MDialog: DefineComponent<MDialogProps, {}, {
365
+ /**
366
+ * 打开对话框
367
+ * @param data 要传递的数据
368
+ * @param config 对话框配置
369
+ */
299
370
  open: (data?: any, config?: MDialogConfig) => void;
300
- /** 关闭对话框 */
371
+ /**
372
+ * 关闭对话框
373
+ */
301
374
  close: () => void;
302
375
  }>;
303
376
 
304
377
  /**
305
378
  * 对话框头部组件
379
+ * 用于显示对话框标题和副标题
306
380
  */
307
- export const MDialogHeader: DefineComponent<{
308
- /** 标题 */
309
- title: string;
310
- /** 副标题 */
311
- subtitle: string;
312
- /** 配置选项 */
313
- config: MDialogConfig;
314
- }>;
381
+ export const MDialogHeader: DefineComponent<MDialogHeaderProps>;
315
382
 
316
383
  // 导出Element Plus组件
317
- export const ElementPlusComponents: typeof ElementPlus;
384
+ export const ElementPlusComponents: typeof ElementPlus;
385
+
386
+ // 默认导出
387
+ export default createMorghulis;
388
+
389
+ // 为了支持全局组件类型声明,扩展Vue的内置类型
390
+ declare module '@vue/runtime-core' {
391
+ export interface GlobalComponents {
392
+ // Morghulis组件
393
+ MDialog: DefineComponent<MDialogProps, {}, {
394
+ open: (data?: any, config?: MDialogConfig) => void;
395
+ close: () => void;
396
+ }>;
397
+ MDialogHeader: DefineComponent<MDialogHeaderProps>;
398
+ }
399
+ }