morghulis 1.0.29 → 1.0.30

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/README.md CHANGED
@@ -382,6 +382,12 @@ const handleClose = () => {
382
382
 
383
383
  ## 版本历史
384
384
 
385
+ ### 1.0.30
386
+ - 优化了组件类型定义,修复IDE无法识别和自动补全组件属性的问题
387
+ - 改进了类型导出机制,增强了组件与IDE的集成
388
+ - 添加了对v-model属性的明确类型支持
389
+ - 扩展了组件的方法类型定义,使API更加清晰
390
+
385
391
  ### 1.0.29
386
392
  - 增强了类型定义,补充了 MTable, MForm, DTable 组件的方法导出
387
393
  - 更新了 README.md,添加了详细的组件属性和方法说明
package/dist/index.d.ts CHANGED
@@ -4,6 +4,24 @@ import type { ElDialog, ElButton, ElText, ElDivider, ElSpace } from 'element-plu
4
4
  // 导入Vue组件实例类型
5
5
  import type { DefineComponent, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, EmitsOptions, Component } from 'vue';
6
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
+
7
25
  // 基础类型定义
8
26
  export type UIFeedbackTypes = "success" | "info" | "warning" | "error";
9
27
  export type UITextTypes = "success" | "info" | "warning" | "danger" | 'primary';
@@ -186,6 +204,14 @@ export interface DCellProps {
186
204
  disabled?: boolean;
187
205
  }
188
206
 
207
+ // 定义MFormProps接口
208
+ export interface MFormProps {
209
+ item: DataItem;
210
+ view: MetaView;
211
+ db: DaoTypes;
212
+ }
213
+
214
+ // 定义DFormProps接口
189
215
  export interface DFormProps {
190
216
  selection: any[];
191
217
  view: MetaView;
@@ -208,134 +234,52 @@ export declare function createMorghulis(options?: MorOption): {
208
234
  install: (Vue: App) => void;
209
235
  };
210
236
 
211
- // 导出MDialog组件
212
- export declare const MDialog: DefineComponent<
213
- MorDialogProps,
214
- {},
215
- {},
216
- {},
217
- {},
218
- ComponentOptionsMixin,
219
- ComponentOptionsMixin,
220
- {
221
- 'update:modelValue': (value: boolean) => true;
222
- 'close': () => true;
223
- 'update:title': (value: string) => true;
224
- 'update:subTitle': (value: string) => true;
225
- },
226
- string,
227
- VNodeProps & AllowedComponentProps & ComponentCustomProps,
228
- Readonly<MorDialogProps> & {
229
- onClose?: () => any;
230
- 'onUpdate:modelValue'?: (value: boolean) => any;
231
- 'onUpdate:title'?: (value: string) => any;
232
- 'onUpdate:subTitle'?: (value: string) => any;
233
- },
234
- {
235
- title: string;
236
- width: string | number;
237
- fullscreen: boolean;
238
- top: string;
239
- modal: boolean;
240
- modalClass: string;
241
- headerClass: string;
242
- bodyClass: string;
243
- footerClass: string;
244
- appendToBody: boolean;
245
- appendTo: string;
246
- lockScroll: boolean;
247
- openDelay: number;
248
- closeDelay: number;
249
- closeOnClickModal: boolean;
250
- closeOnPressEscape: boolean;
251
- showClose: boolean;
252
- draggable: boolean;
253
- overFlow: boolean;
254
- center: boolean;
255
- alignCenter: boolean;
256
- destroyOnClose: boolean;
257
- closeIcon: string;
258
- confirmButtonText: string;
259
- cancelButtonText: string;
260
- }
261
- > & {
237
+ // 导出更详细的组件类型
238
+
239
+ // 导出MDialog组件类型增强
240
+ export declare interface MDialogInstance {
262
241
  open: (data?: any, config?: MorDialogConfig) => void;
263
242
  close: () => void;
264
- };
243
+ }
265
244
 
266
- // 导出MCell组件
267
- export declare const MCell: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
268
-
269
- // 导出MTable组件
270
- export declare const MTable: DefineComponent<
271
- MorghulisTableProps,
272
- {},
273
- {},
274
- {},
275
- {},
276
- ComponentOptionsMixin,
277
- ComponentOptionsMixin,
278
- {
279
- 'selection-change': (selection: any[]) => true;
280
- 'sort': (column: any, prop: string, order: string) => true;
281
- },
282
- string,
283
- VNodeProps & AllowedComponentProps & ComponentCustomProps,
284
- Readonly<MorghulisTableProps> & {
285
- 'onSelection-change'?: (selection: any[]) => any;
286
- 'onSort'?: (column: any, prop: string, order: string) => any;
287
- },
288
- {}
289
- > & {
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 {
290
263
  getSelection: () => any[];
291
264
  setSelection: (rows: any[]) => void;
292
265
  closePopover: () => void;
293
- };
294
-
295
- // 更新MForm接口,添加缺失的属性
296
- export interface MFormProps {
297
- item: DataItem;
298
- view: MetaView;
299
- db: DaoTypes;
300
266
  }
301
267
 
302
- // 导出MForm组件
303
- export declare const MForm: DefineComponent<
304
- MFormProps,
305
- {},
306
- {},
307
- {},
308
- {},
309
- ComponentOptionsMixin,
310
- ComponentOptionsMixin,
311
- {},
312
- string,
313
- VNodeProps & AllowedComponentProps & ComponentCustomProps,
314
- Readonly<MFormProps>,
315
- {}
316
- > & {
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 {
317
276
  getData: () => any;
318
277
  reset: (prop: string) => void;
319
- };
278
+ }
279
+ export declare const MForm: DefineComponent<MFormProps> & MFormInstance;
320
280
 
321
- // 导出数据表格相关组件
322
- export declare const DTable: DefineComponent<
323
- DTableProps,
324
- {},
325
- {},
326
- {},
327
- {},
328
- ComponentOptionsMixin,
329
- ComponentOptionsMixin,
330
- {},
331
- string,
332
- VNodeProps & AllowedComponentProps & ComponentCustomProps,
333
- Readonly<DTableProps>,
334
- {
335
- size: number;
336
- page: number;
337
- }
338
- > & {
281
+ // 导出DTable组件类型增强
282
+ export declare interface DTableInstance {
339
283
  refresh: () => void;
340
284
  add: () => void;
341
285
  edit: (row: any) => void;
@@ -344,47 +288,27 @@ export declare const DTable: DefineComponent<
344
288
  handleCurrentPageChange: (page: number) => void;
345
289
  load: () => void;
346
290
  upload: (data: any[]) => void;
347
- };
291
+ }
292
+ export declare const DTable: DefineComponent<DTableProps> & DTableInstance;
348
293
 
349
- export declare const DCell: DefineComponent<
350
- DCellProps,
351
- {},
352
- {},
353
- {},
354
- {},
355
- ComponentOptionsMixin,
356
- ComponentOptionsMixin,
357
- {
358
- cancel: (...args: any[]) => void;
359
- save: (...args: any[]) => void;
360
- },
361
- string,
362
- VNodeProps & AllowedComponentProps & ComponentCustomProps,
363
- Readonly<DCellProps> & {
364
- onCancel?: (...args: any[]) => any;
365
- onSave?: (...args: any[]) => any;
366
- },
367
- {}
368
- >;
369
-
370
- export declare const DForm: DefineComponent<
371
- DFormProps,
372
- {},
373
- {},
374
- {},
375
- {},
376
- ComponentOptionsMixin,
377
- ComponentOptionsMixin,
378
- {},
379
- string,
380
- VNodeProps & AllowedComponentProps & ComponentCustomProps,
381
- Readonly<DFormProps>,
382
- {}
383
- > & {
294
+ // 导出DForm组件类型增强
295
+ export declare interface DFormInstance {
384
296
  getData: () => any[];
385
- };
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;
386
309
 
387
- export declare const DController: DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, VNodeProps & AllowedComponentProps & ComponentCustomProps, Readonly<{}>, {}>;
310
+ // 导出DController组件
311
+ export declare const DController: DefineComponent;
388
312
 
389
313
  // 声明useMorghulisAuthorize函数
390
314
  export declare function useMorghulisAuthorize(): MorghulisAuthorize;
@@ -0,0 +1 @@
1
+ export * from '../index'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "morghulis",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "private": false,
5
5
  "description": "Vue 3组件库",
6
6
  "type": "module",
@@ -19,16 +19,25 @@
19
19
  "./dist/index.css": "./dist/index.css",
20
20
  "./dist/style.css": "./dist/index.css",
21
21
  "./style": "./dist/index.css",
22
- "./dist/style": "./dist/index.css"
22
+ "./dist/style": "./dist/index.css",
23
+ "./types": {
24
+ "types": "./dist/types/index.d.ts"
25
+ },
26
+ "./components/*": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js"
29
+ }
23
30
  },
24
31
  "typesVersions": {
25
32
  "*": {
26
- "*": ["dist/index.d.ts"]
33
+ "*": [
34
+ "dist/index.d.ts"
35
+ ]
27
36
  }
28
37
  },
29
38
  "scripts": {
30
39
  "dev": "vite",
31
- "build": "vue-tsc --noEmit && vite build && cp index.d.ts dist/",
40
+ "build": "vue-tsc --noEmit && vite build && cp index.d.ts dist/ && mkdir -p dist/types && echo \"export * from '../index'\" > dist/types/index.d.ts",
32
41
  "preview": "vite preview",
33
42
  "type-check": "vue-tsc --build"
34
43
  },