@vue-start/pro 0.1.0 → 0.2.0

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,77 +1,1037 @@
1
- import * as axios from 'axios';
2
- import { AxiosRequestConfig, AxiosResponse, AxiosInstance, AxiosInterceptorManager } from 'axios';
3
- import { Observable, Subject, BehaviorSubject } from 'rxjs';
4
1
  import * as vue from 'vue';
5
- import { App } from 'vue';
2
+ import { VNode, ExtractPropTypes, PropType } from 'vue';
3
+ import { Ref, UnwrapNestedRefs, ComputedRef } from '@vue/reactivity';
4
+ import { Subject } from 'rxjs';
5
+ import { IRequestActor } from '@vue-start/request';
6
6
 
7
- declare type ReqType = {
8
- body?: Record<string, any>;
9
- [key: string]: any;
7
+ declare type TDefaultValueType = "text" | "textarea" | "password" | "digit" | "date" | "dateRange" | "time" | "timeRange" | "select" | "treeSelect" | "checkbox" | "radio" | "slider" | "switch" | "rate" | "cascader";
8
+ declare type TValueType = TDefaultValueType | string;
9
+ declare type TOption = {
10
+ label?: string;
11
+ value: string | number;
12
+ disabled?: boolean;
13
+ };
14
+ declare type TOptions = TOption[];
15
+ declare type TColumn = {
16
+ title?: string | VNode;
17
+ dataIndex?: string | number;
18
+ valueType?: TValueType;
19
+ formValueType?: TValueType;
20
+ showProps?: Record<string, any>;
21
+ formItemProps?: {
22
+ name?: string;
23
+ label?: string;
24
+ };
25
+ formFieldProps?: Record<string, any>;
26
+ search?: boolean;
27
+ hideInTable?: boolean;
28
+ hideInForm?: boolean;
29
+ hideInDetail?: boolean;
30
+ searchSort?: boolean;
31
+ tableSort?: boolean;
32
+ formSort?: boolean;
33
+ descSort?: boolean;
34
+ extra?: {
35
+ desc?: any;
36
+ };
10
37
  };
38
+ declare type TColumns = TColumn[];
11
39
  /**
12
- * 两种模式
13
- * requestFromReq :开发时候创建的
14
- * requestConfig: 通过配置添加
40
+ * 发送事件对象
15
41
  */
16
- interface IRequestActor<TReq = any, TRes = any, TErr = any> {
17
- name: string;
18
- requestFromReq?: (req: TReq) => AxiosRequestConfig;
19
- requestConfig?: AxiosRequestConfig;
20
- label?: string;
21
- req?: TReq;
22
- res?: AxiosResponse<TRes>;
23
- err?: TErr;
24
- stage?: "DONE" | "FAILED" | "CANCEL";
25
- id?: string;
42
+ declare type TActionEvent = {
43
+ type: string;
44
+ payload?: any;
26
45
  extra?: Record<string, any>;
46
+ };
47
+ /**
48
+ * 发送state对象
49
+ */
50
+ declare type TActionState = {
51
+ type: string;
52
+ payload: any;
53
+ extra?: Record<string, any>;
54
+ };
55
+ /**
56
+ * 组件Map
57
+ */
58
+ declare type TElementMap = Record<string, any>;
59
+ declare type BooleanObjType = {
60
+ [key: string]: boolean;
61
+ };
62
+ declare type BooleanRulesObjType = {
63
+ [key: string]: (record: any) => boolean;
64
+ };
65
+
66
+ /**
67
+ * 获取Column的valueType,默认"text"
68
+ * @param column
69
+ */
70
+ declare const getColumnValueType: (column: TColumn) => TValueType;
71
+ /**
72
+ *获取Column的FormItem name
73
+ * @param column
74
+ */
75
+ declare const getColumnFormItemName: (column: TColumn) => string | number | undefined;
76
+ /**
77
+ * 根据Column生成FormItem VNode
78
+ * formFieldProps中的slots参数会以v-slots的形式传递到FormItem的录入组件(子组件)中
79
+ * @param formElementMap
80
+ * @param column
81
+ * @param needRules
82
+ */
83
+ declare const getFormItemEl: (formElementMap: any, column: TColumn, needRules?: boolean | undefined) => VNode | null;
84
+ /**
85
+ * 根据Column生成Item VNode
86
+ * @param elementMap
87
+ * @param column
88
+ * @param value
89
+ */
90
+ declare const getItemEl: <T extends TColumn>(elementMap: any, column: T, value: any) => VNode | null;
91
+ interface IProModuleProvide {
92
+ columns: Ref<TColumns>;
93
+ getFormItemVNode: (column: TColumn, needRules: boolean | undefined) => VNode | null;
94
+ getItemVNode: (column: TColumn, value: any) => VNode | null;
95
+ elementMap: {
96
+ [key: string]: any;
97
+ };
98
+ formElementMap: {
99
+ [key: string]: any;
100
+ };
101
+ subject$: Subject<TActionEvent>;
102
+ sendEvent: (action: TActionEvent) => void;
103
+ state: UnwrapNestedRefs<Record<string, any>>;
104
+ dispatch: (action: TActionState) => void;
105
+ requests: IRequestOpts[];
106
+ sendRequest: (requestNameOrAction: string, ...params: any[]) => void;
107
+ }
108
+ declare const useProModule: () => IProModuleProvide;
109
+ declare const provideProModule: (ctx: IProModuleProvide) => void;
110
+ interface IRequestOpts {
111
+ actor: IRequestActor;
112
+ /**
113
+ * 如果设置action,可以使用该值发起请求 住:要保证唯一性
114
+ * 设置该字段原因:因为actor中的name不友好,可以理解为一个备选方案
115
+ */
116
+ action?: string;
117
+ stateName?: string;
118
+ loadingName?: string;
119
+ convertParams?: (...params: any[]) => Record<string, any>;
120
+ convertData?: (actor: IRequestActor) => Record<string, any>;
121
+ onSuccess?: (actor?: IRequestActor) => void;
122
+ onFailed?: (actor?: IRequestActor) => void;
123
+ }
124
+ declare const RequestAction: {
125
+ Success: string;
126
+ Fail: string;
127
+ };
128
+ declare const proModuleProps: () => {
129
+ /**
130
+ * module状态
131
+ */
132
+ state: {
133
+ type: PropType<Record<string, any>>;
134
+ };
135
+ /**
136
+ * 配置(静态)
137
+ */
138
+ columns: {
139
+ type: PropType<TColumns>;
140
+ };
141
+ /**
142
+ * 配置(动态)
143
+ * columns动态属性兼容
144
+ */
145
+ columnState: {
146
+ type: PropType<Record<string, any>>;
147
+ };
148
+ /**
149
+ * 展示组件集
150
+ */
151
+ elementMap: {
152
+ type: PropType<TElementMap>;
153
+ };
154
+ /**
155
+ * 录入组件集
156
+ */
157
+ formElementMap: {
158
+ type: PropType<TElementMap>;
159
+ };
160
+ /**
161
+ * requests
162
+ */
163
+ requests: {
164
+ type: PropType<IRequestOpts[]>;
165
+ };
166
+ };
167
+ declare type ProModuleProps = Partial<ExtractPropTypes<ReturnType<typeof proModuleProps>>>;
168
+ declare const ProModule: vue.DefineComponent<Partial<ExtractPropTypes<{
169
+ /**
170
+ * module状态
171
+ */
172
+ state: {
173
+ type: PropType<Record<string, any>>;
174
+ };
175
+ /**
176
+ * 配置(静态)
177
+ */
178
+ columns: {
179
+ type: PropType<TColumns>;
180
+ };
181
+ /**
182
+ * 配置(动态)
183
+ * columns动态属性兼容
184
+ */
185
+ columnState: {
186
+ type: PropType<Record<string, any>>;
187
+ };
188
+ /**
189
+ * 展示组件集
190
+ */
191
+ elementMap: {
192
+ type: PropType<TElementMap>;
193
+ };
194
+ /**
195
+ * 录入组件集
196
+ */
197
+ formElementMap: {
198
+ type: PropType<TElementMap>;
199
+ };
200
+ /**
201
+ * requests
202
+ */
203
+ requests: {
204
+ type: PropType<IRequestOpts[]>;
205
+ };
206
+ }>>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<Partial<ExtractPropTypes<{
207
+ /**
208
+ * module状态
209
+ */
210
+ state: {
211
+ type: PropType<Record<string, any>>;
212
+ };
213
+ /**
214
+ * 配置(静态)
215
+ */
216
+ columns: {
217
+ type: PropType<TColumns>;
218
+ };
219
+ /**
220
+ * 配置(动态)
221
+ * columns动态属性兼容
222
+ */
223
+ columnState: {
224
+ type: PropType<Record<string, any>>;
225
+ };
226
+ /**
227
+ * 展示组件集
228
+ */
229
+ elementMap: {
230
+ type: PropType<TElementMap>;
231
+ };
232
+ /**
233
+ * 录入组件集
234
+ */
235
+ formElementMap: {
236
+ type: PropType<TElementMap>;
237
+ };
238
+ /**
239
+ * requests
240
+ */
241
+ requests: {
242
+ type: PropType<IRequestOpts[]>;
243
+ };
244
+ }>>>, {}>;
245
+
246
+ declare const useModuleEvent: (cb: (action: TActionEvent) => void) => void;
247
+
248
+ declare const useDoneRequestActor: (actors: (IRequestActor | string)[], callback: (actor: IRequestActor) => void) => void;
249
+ declare const useFailedRequestActor: (actors: (IRequestActor | string)[], callback: (actor: IRequestActor) => void) => void;
250
+ declare const useComposeRequestActor: (actors: (IRequestActor | string)[], options: {
251
+ onStart?: ((actor: IRequestActor) => void) | undefined;
252
+ onSuccess?: ((actor: IRequestActor) => void) | undefined;
253
+ onFailed?: ((actor: IRequestActor) => void) | undefined;
254
+ onFinish?: ((actor: IRequestActor) => void) | undefined;
255
+ }, cancelWhileUnmount?: boolean | undefined) => void;
256
+
257
+ interface IProTableProvideExtra extends Record<string, any> {
258
+ }
259
+ interface IProTableProvide extends IProTableProvideExtra {
260
+ columns: Ref<TTableColumns>;
261
+ }
262
+ declare const useProTable: () => IProTableProvide;
263
+ declare type TTableColumn = {
264
+ customRender?: (opt: {
265
+ value: any;
266
+ text: any;
267
+ record: Record<string, any>;
268
+ index: number;
269
+ column: TTableColumn;
270
+ }) => VNode;
271
+ fixed?: boolean | string;
272
+ } & TColumn;
273
+ declare type TTableColumns = TTableColumn[];
274
+ /**
275
+ * 单个操作描述
276
+ */
277
+ interface IOperateItem {
278
+ value: string | number;
279
+ label?: string | VNode;
280
+ element?: (record: Record<string, any>, item: IOperateItem) => VNode;
281
+ show?: boolean | ((record: Record<string, any>) => boolean);
282
+ disabled?: boolean | ((record: Record<string, any>) => boolean);
283
+ onClick?: (record: Record<string, any>) => void;
284
+ sort?: number;
285
+ }
286
+ /**
287
+ * 整个操作栏描述
288
+ */
289
+ interface ITableOperate {
290
+ column?: TColumn;
291
+ items?: IOperateItem[];
292
+ itemState?: {
293
+ [key: string]: Omit<IOperateItem, "value">;
294
+ };
295
+ }
296
+ declare const proTableProps: () => {
297
+ operate: {
298
+ type: PropType<ITableOperate>;
299
+ };
300
+ columnEmptyText: {
301
+ type: StringConstructor;
302
+ };
303
+ /**
304
+ * 公共column,会merge到columns item中
305
+ */
306
+ column: {
307
+ type: PropType<TTableColumn>;
308
+ };
309
+ columns: {
310
+ type: PropType<TTableColumns>;
311
+ };
312
+ /**
313
+ * 展示控件集合,readonly模式下使用这些组件渲染
314
+ */
315
+ elementMap: {
316
+ type: PropType<TElementMap>;
317
+ };
318
+ /**
319
+ * loading
320
+ */
321
+ loading: {
322
+ type: BooleanConstructor;
323
+ };
324
+ /**
325
+ * provide传递
326
+ */
327
+ provideExtra: {
328
+ type: PropType<IProTableProvideExtra>;
329
+ };
330
+ };
331
+ declare type ProTableProps = Partial<ExtractPropTypes<ReturnType<typeof proTableProps>>>;
332
+ declare const ProTable: vue.DefineComponent<Partial<ExtractPropTypes<{
333
+ operate: {
334
+ type: PropType<ITableOperate>;
335
+ };
336
+ columnEmptyText: {
337
+ type: StringConstructor;
338
+ };
339
+ /**
340
+ * 公共column,会merge到columns item中
341
+ */
342
+ column: {
343
+ type: PropType<TTableColumn>;
344
+ };
345
+ columns: {
346
+ type: PropType<TTableColumns>;
347
+ };
348
+ /**
349
+ * 展示控件集合,readonly模式下使用这些组件渲染
350
+ */
351
+ elementMap: {
352
+ type: PropType<TElementMap>;
353
+ };
354
+ /**
355
+ * loading
356
+ */
357
+ loading: {
358
+ type: BooleanConstructor;
359
+ };
360
+ /**
361
+ * provide传递
362
+ */
363
+ provideExtra: {
364
+ type: PropType<IProTableProvideExtra>;
365
+ };
366
+ }>>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<Partial<ExtractPropTypes<{
367
+ operate: {
368
+ type: PropType<ITableOperate>;
369
+ };
370
+ columnEmptyText: {
371
+ type: StringConstructor;
372
+ };
373
+ /**
374
+ * 公共column,会merge到columns item中
375
+ */
376
+ column: {
377
+ type: PropType<TTableColumn>;
378
+ };
379
+ columns: {
380
+ type: PropType<TTableColumns>;
381
+ };
382
+ /**
383
+ * 展示控件集合,readonly模式下使用这些组件渲染
384
+ */
385
+ elementMap: {
386
+ type: PropType<TElementMap>;
387
+ };
388
+ /**
389
+ * loading
390
+ */
391
+ loading: {
392
+ type: BooleanConstructor;
393
+ };
394
+ /**
395
+ * provide传递
396
+ */
397
+ provideExtra: {
398
+ type: PropType<IProTableProvideExtra>;
399
+ };
400
+ }>>>, {}>;
401
+
402
+ interface IListData extends Record<string, any> {
403
+ total: number;
404
+ dataSource: Record<string, any>[];
405
+ }
406
+ interface ICurdState extends Record<string, any> {
407
+ listLoading?: boolean;
408
+ listData?: IListData;
409
+ mode?: ICurdCurrentMode;
410
+ detailLoading?: boolean;
411
+ detailData?: Record<string, any>;
412
+ operateLoading?: boolean;
413
+ addAction?: ICurdAddAction;
414
+ }
415
+ /**
416
+ * action:list,detail,add,edit,delete
417
+ */
418
+ interface ICurdOperateOpts extends Omit<IRequestOpts, "actor" | "action">, Omit<IOperateItem, "value"> {
419
+ action: ICurdAction;
420
+ actor?: IRequestOpts;
421
+ }
422
+ declare type TCurdActionEvent = {
423
+ action: ICurdAction;
424
+ type: ICurdSubAction;
425
+ record?: Record<string, any>;
426
+ values?: Record<string, any>;
427
+ };
428
+ declare const proCurdProps: () => {
429
+ /**
430
+ * 列表 或 详情 的唯一标识
431
+ */
432
+ rowKey: {
433
+ type: StringConstructor;
434
+ default: string;
435
+ };
436
+ /**
437
+ * operates
438
+ */
439
+ operates: {
440
+ type: PropType<ICurdOperateOpts[]>;
441
+ };
442
+ /************************* 子组件props *******************************/
443
+ listProps: {
444
+ type: PropType<Record<string, any>>;
445
+ };
446
+ formProps: {
447
+ type: PropType<Record<string, any>>;
448
+ };
449
+ descProps: {
450
+ type: PropType<Record<string, any>>;
451
+ };
452
+ modalProps: {
453
+ type: PropType<Record<string, any>>;
454
+ };
455
+ };
456
+ declare type CurdProps = Partial<ExtractPropTypes<ReturnType<typeof proCurdProps>>>;
457
+ declare type ProCurdProps = CurdProps & Omit<ProModuleProps, "state" | "requests"> & {
458
+ curdState: UnwrapNestedRefs<ICurdState>;
459
+ };
460
+ declare const ProCurd: vue.DefineComponent<ProCurdProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<ProCurdProps>, {}>;
461
+
462
+ interface IProCurdProvide {
463
+ rowKey: string;
464
+ curdState: UnwrapNestedRefs<ICurdState>;
465
+ formColumns: Ref<TColumns>;
466
+ descColumns: Ref<TColumns>;
467
+ tableColumns: Ref<TColumns>;
468
+ searchColumns: Ref<TColumns>;
469
+ sendCurdEvent: (event: TCurdActionEvent) => void;
470
+ getOperate: (action: ICurdAction) => ICurdOperateOpts | undefined;
471
+ refreshList: (extra?: Record<string, any>) => void;
472
+ /******************子组件参数*******************/
473
+ listProps?: ComputedRef<Record<string, any> | undefined>;
474
+ formProps?: ComputedRef<Record<string, any> | undefined>;
475
+ descProps?: ComputedRef<Record<string, any> | undefined>;
476
+ modalProps?: ComputedRef<Record<string, any> | undefined>;
477
+ }
478
+ declare const useProCurd: <T extends IProCurdProvide>() => T;
479
+ declare const provideProCurd: (ctx: IProCurdProvide) => void;
480
+ /************************************ 常量 *************************************/
481
+ /**
482
+ * curd 5种Action
483
+ */
484
+ declare enum CurdAction {
485
+ LIST = "LIST",
486
+ DETAIL = "DETAIL",
487
+ ADD = "ADD",
488
+ EDIT = "EDIT",
489
+ DELETE = "DELETE"
490
+ }
491
+ declare type ICurdAction = keyof typeof CurdAction;
492
+ /**
493
+ * 5种Action 的子事件
494
+ */
495
+ declare enum CurdSubAction {
496
+ EMIT = "EMIT",
497
+ EXECUTE = "EXECUTE",
498
+ PAGE = "PAGE",
499
+ SUCCESS = "SUCCESS",
500
+ FAIL = "FAIL"
501
+ }
502
+ declare type ICurdSubAction = keyof typeof CurdSubAction;
503
+ /**
504
+ * curd 操作模式
505
+ */
506
+ declare enum CurdCurrentMode {
507
+ ADD = "ADD",
508
+ EDIT = "EDIT",
509
+ DETAIL = "DETAIL"
510
+ }
511
+ declare type ICurdCurrentMode = keyof typeof CurdCurrentMode;
512
+ /**
513
+ * curd add 模式下 标记 "确定" "确定并继续" 触发
514
+ */
515
+ declare enum CurdAddAction {
516
+ NORMAL = "NORMAL",
517
+ CONTINUE = "CONTINUE"
27
518
  }
28
- declare const isPreRequestActor: (actor: IRequestActor) => boolean;
29
- declare const isCancelRequestActor: (actor: IRequestActor) => boolean;
30
- declare const isFailedRequestActor: (actor: IRequestActor) => boolean;
31
- declare const isDoneRequestActor: (actor: IRequestActor) => boolean;
32
- declare const createRequestActor: <TReq extends ReqType, TRes>(name: string, requestFromReq: ((req: TReq) => AxiosRequestConfig) | undefined, extra?: Pick<IRequestActor<TReq, TRes, any>, "label"> | undefined) => IRequestActor<TReq, TRes, any>;
33
- declare const cancelActorIfExists: (actor: any) => void;
34
- declare const isCancelActor: (actor: any) => any;
35
- declare const createRequestFactory: (client: AxiosInstance) => (actor: IRequestActor) => {
36
- (): Observable<AxiosResponse<any>>;
37
- clear(): void;
38
- config: AxiosRequestConfig;
519
+ declare type ICurdAddAction = keyof typeof CurdAddAction;
520
+
521
+ interface IProFormProvideExtra extends Record<string, any> {
522
+ }
523
+ interface IProFormProvide extends IProFormProvideExtra {
524
+ formState: UnwrapNestedRefs<Record<string, any>>;
525
+ showState: UnwrapNestedRefs<Record<string, any>>;
526
+ readonlyState: UnwrapNestedRefs<Record<string, any>>;
527
+ disableState: UnwrapNestedRefs<Record<string, any>>;
528
+ readonly: Ref<boolean | undefined>;
529
+ elementMap?: TElementMap;
530
+ formElementMap?: TElementMap;
531
+ formItemVNodes: Ref<(VNode | null)[]>;
532
+ }
533
+ declare const useProForm: () => IProFormProvide;
534
+ declare const proFormProps: () => {
535
+ /**
536
+ * 同 antd 或 element form中的model
537
+ */
538
+ model: {
539
+ type: PropType<Record<string, any>>;
540
+ };
541
+ /**
542
+ * 子组件是否只读样式
543
+ */
544
+ readonly: {
545
+ type: BooleanConstructor;
546
+ default: undefined;
547
+ };
548
+ /**
549
+ * FormComponent 根据此项来确定组件是否显示
550
+ * rules 根据rules中方法生成showState对象
551
+ */
552
+ showState: {
553
+ type: PropType<BooleanObjType>;
554
+ };
555
+ showStateRules: {
556
+ type: PropType<BooleanRulesObjType>;
557
+ };
558
+ /**
559
+ * 是否只读
560
+ */
561
+ readonlyState: {
562
+ type: PropType<BooleanObjType>;
563
+ };
564
+ readonlyStateRules: {
565
+ type: PropType<BooleanRulesObjType>;
566
+ };
567
+ /**
568
+ * 是否disabled
569
+ */
570
+ disableState: {
571
+ type: PropType<BooleanObjType>;
572
+ };
573
+ disableStateRules: {
574
+ type: PropType<BooleanRulesObjType>;
575
+ };
576
+ /**
577
+ *
578
+ */
579
+ columns: {
580
+ type: PropType<TColumns>;
581
+ };
582
+ /**
583
+ * 展示控件集合,readonly模式下使用这些组件渲染
584
+ */
585
+ elementMap: {
586
+ type: PropType<TElementMap>;
587
+ };
588
+ /**
589
+ * 录入控件集合
590
+ */
591
+ formElementMap: {
592
+ type: PropType<TElementMap>;
593
+ };
594
+ /**
595
+ * 是否启用rules验证
596
+ */
597
+ needRules: {
598
+ type: BooleanConstructor;
599
+ default: boolean;
600
+ };
601
+ /**
602
+ * provide传递
603
+ */
604
+ provideExtra: {
605
+ type: PropType<IProFormProvideExtra>;
606
+ };
39
607
  };
40
- declare const createRequestObservable: (actor$: Observable<IRequestActor>, client: AxiosInstance) => Observable<IRequestActor<any, any, any>>;
608
+ declare type ProFormProps = Partial<ExtractPropTypes<ReturnType<typeof proFormProps>>>;
609
+ declare const ProForm: vue.DefineComponent<{
610
+ /**
611
+ * 同 antd 或 element form中的model
612
+ */
613
+ model: {
614
+ type: PropType<Record<string, any>>;
615
+ };
616
+ /**
617
+ * 子组件是否只读样式
618
+ */
619
+ readonly: {
620
+ type: BooleanConstructor;
621
+ default: undefined;
622
+ };
623
+ /**
624
+ * FormComponent 根据此项来确定组件是否显示
625
+ * rules 根据rules中方法生成showState对象
626
+ */
627
+ showState: {
628
+ type: PropType<BooleanObjType>;
629
+ };
630
+ showStateRules: {
631
+ type: PropType<BooleanRulesObjType>;
632
+ };
633
+ /**
634
+ * 是否只读
635
+ */
636
+ readonlyState: {
637
+ type: PropType<BooleanObjType>;
638
+ };
639
+ readonlyStateRules: {
640
+ type: PropType<BooleanRulesObjType>;
641
+ };
642
+ /**
643
+ * 是否disabled
644
+ */
645
+ disableState: {
646
+ type: PropType<BooleanObjType>;
647
+ };
648
+ disableStateRules: {
649
+ type: PropType<BooleanRulesObjType>;
650
+ };
651
+ /**
652
+ *
653
+ */
654
+ columns: {
655
+ type: PropType<TColumns>;
656
+ };
657
+ /**
658
+ * 展示控件集合,readonly模式下使用这些组件渲染
659
+ */
660
+ elementMap: {
661
+ type: PropType<TElementMap>;
662
+ };
663
+ /**
664
+ * 录入控件集合
665
+ */
666
+ formElementMap: {
667
+ type: PropType<TElementMap>;
668
+ };
669
+ /**
670
+ * 是否启用rules验证
671
+ */
672
+ needRules: {
673
+ type: BooleanConstructor;
674
+ default: boolean;
675
+ };
676
+ /**
677
+ * provide传递
678
+ */
679
+ provideExtra: {
680
+ type: PropType<IProFormProvideExtra>;
681
+ };
682
+ }, () => VNode<vue.RendererNode, vue.RendererElement, {
683
+ [key: string]: any;
684
+ }>[] | undefined, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, Record<string, any>, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<ExtractPropTypes<{
685
+ /**
686
+ * 同 antd 或 element form中的model
687
+ */
688
+ model: {
689
+ type: PropType<Record<string, any>>;
690
+ };
691
+ /**
692
+ * 子组件是否只读样式
693
+ */
694
+ readonly: {
695
+ type: BooleanConstructor;
696
+ default: undefined;
697
+ };
698
+ /**
699
+ * FormComponent 根据此项来确定组件是否显示
700
+ * rules 根据rules中方法生成showState对象
701
+ */
702
+ showState: {
703
+ type: PropType<BooleanObjType>;
704
+ };
705
+ showStateRules: {
706
+ type: PropType<BooleanRulesObjType>;
707
+ };
708
+ /**
709
+ * 是否只读
710
+ */
711
+ readonlyState: {
712
+ type: PropType<BooleanObjType>;
713
+ };
714
+ readonlyStateRules: {
715
+ type: PropType<BooleanRulesObjType>;
716
+ };
717
+ /**
718
+ * 是否disabled
719
+ */
720
+ disableState: {
721
+ type: PropType<BooleanObjType>;
722
+ };
723
+ disableStateRules: {
724
+ type: PropType<BooleanRulesObjType>;
725
+ };
726
+ /**
727
+ *
728
+ */
729
+ columns: {
730
+ type: PropType<TColumns>;
731
+ };
732
+ /**
733
+ * 展示控件集合,readonly模式下使用这些组件渲染
734
+ */
735
+ elementMap: {
736
+ type: PropType<TElementMap>;
737
+ };
738
+ /**
739
+ * 录入控件集合
740
+ */
741
+ formElementMap: {
742
+ type: PropType<TElementMap>;
743
+ };
744
+ /**
745
+ * 是否启用rules验证
746
+ */
747
+ needRules: {
748
+ type: BooleanConstructor;
749
+ default: boolean;
750
+ };
751
+ /**
752
+ * provide传递
753
+ */
754
+ provideExtra: {
755
+ type: PropType<IProFormProvideExtra>;
756
+ };
757
+ }>>, {
758
+ readonly: boolean;
759
+ needRules: boolean;
760
+ }>;
41
761
 
42
- declare type DispatchRequestType = (actor: IRequestActor, params?: IRequestActor["req"], extra?: IRequestActor["extra"]) => IRequestActor;
43
- declare type RequestProvideType = {
44
- client: AxiosInstance;
45
- requestSubject$: Subject<IRequestActor>;
46
- dispatchRequest: DispatchRequestType;
762
+ declare enum SearchMode {
763
+ AUTO = "AUTO",
764
+ MANUAL = "MANUAL"
765
+ }
766
+ declare type ISearchMode = keyof typeof SearchMode;
767
+ declare const proSearchFormProps: () => {
768
+ /**
769
+ * 需要监听的对象
770
+ */
771
+ model: {
772
+ type: PropType<Record<string, any>>;
773
+ required: boolean;
774
+ };
775
+ /**
776
+ * 初始化触发 onFinish
777
+ */
778
+ initEmit: {
779
+ type: BooleanConstructor;
780
+ default: boolean;
781
+ };
782
+ /**
783
+ * 模式 自动触发或者手动触发 onFinish
784
+ */
785
+ searchMode: {
786
+ type: PropType<"AUTO" | "MANUAL">;
787
+ default: SearchMode;
788
+ };
789
+ /**
790
+ * 配置 同ProForm中的columns
791
+ * 可以根据column中valueType计算出默认的debounceKeys
792
+ */
793
+ columns: {
794
+ type: PropType<TColumns>;
795
+ };
796
+ /**
797
+ * 需要debounce处理的字段
798
+ */
799
+ debounceKeys: {
800
+ type: PropType<string[]>;
801
+ };
802
+ debounceTime: {
803
+ type: NumberConstructor;
804
+ default: number;
805
+ };
47
806
  };
48
- declare const useRequestProvide: () => RequestProvideType;
49
- declare type TRequestInterceptor = (request: AxiosInterceptorManager<AxiosRequestConfig>, response: AxiosInterceptorManager<AxiosResponse>) => void;
50
- declare const ContentTypeInterceptor: TRequestInterceptor;
51
- declare const createRequest: (options: AxiosRequestConfig, interceptors: TRequestInterceptor[]) => (app: App) => void;
807
+ declare type ProSearchFormProps = Partial<ExtractPropTypes<ReturnType<typeof proSearchFormProps>>>;
808
+ /**
809
+ * 该组件只是个模式,最终返回null,不做任何渲染,应配合着ProForm的包装类一起使用
810
+ * 针对传入的model(监听对象)做相应的finish(回调)处理
811
+ */
812
+ declare const ProSearchForm: vue.DefineComponent<Partial<ExtractPropTypes<{
813
+ /**
814
+ * 需要监听的对象
815
+ */
816
+ model: {
817
+ type: PropType<Record<string, any>>;
818
+ required: boolean;
819
+ };
820
+ /**
821
+ * 初始化触发 onFinish
822
+ */
823
+ initEmit: {
824
+ type: BooleanConstructor;
825
+ default: boolean;
826
+ };
827
+ /**
828
+ * 模式 自动触发或者手动触发 onFinish
829
+ */
830
+ searchMode: {
831
+ type: PropType<"AUTO" | "MANUAL">;
832
+ default: SearchMode;
833
+ };
834
+ /**
835
+ * 配置 同ProForm中的columns
836
+ * 可以根据column中valueType计算出默认的debounceKeys
837
+ */
838
+ columns: {
839
+ type: PropType<TColumns>;
840
+ };
841
+ /**
842
+ * 需要debounce处理的字段
843
+ */
844
+ debounceKeys: {
845
+ type: PropType<string[]>;
846
+ };
847
+ debounceTime: {
848
+ type: NumberConstructor;
849
+ default: number;
850
+ };
851
+ }>>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<Partial<ExtractPropTypes<{
852
+ /**
853
+ * 需要监听的对象
854
+ */
855
+ model: {
856
+ type: PropType<Record<string, any>>;
857
+ required: boolean;
858
+ };
859
+ /**
860
+ * 初始化触发 onFinish
861
+ */
862
+ initEmit: {
863
+ type: BooleanConstructor;
864
+ default: boolean;
865
+ };
866
+ /**
867
+ * 模式 自动触发或者手动触发 onFinish
868
+ */
869
+ searchMode: {
870
+ type: PropType<"AUTO" | "MANUAL">;
871
+ default: SearchMode;
872
+ };
873
+ /**
874
+ * 配置 同ProForm中的columns
875
+ * 可以根据column中valueType计算出默认的debounceKeys
876
+ */
877
+ columns: {
878
+ type: PropType<TColumns>;
879
+ };
880
+ /**
881
+ * 需要debounce处理的字段
882
+ */
883
+ debounceKeys: {
884
+ type: PropType<string[]>;
885
+ };
886
+ debounceTime: {
887
+ type: NumberConstructor;
888
+ default: number;
889
+ };
890
+ }>>>, {}>;
52
891
 
53
- declare const isContentTypeMultipartFormData: (headers: any) => any;
54
- declare const isContentTypeFormURLEncoded: (headers: any) => any;
55
- declare const isContentTypeJSON: (headers: any) => any;
56
- declare const paramsSerializer: (params: any) => string;
57
- declare const transformRequest: (data: any, headers: any) => any;
58
- declare const transformResponse: (data: unknown, headers: {
59
- [k: string]: any;
60
- }) => any;
61
- declare const getRequestConfig: (actor: IRequestActor) => axios.AxiosRequestConfig;
62
- declare const toUrl: (actor: IRequestActor, baseUrl?: string) => string;
63
- declare const generateId: () => string;
892
+ interface FormItemProps {
893
+ name?: string | number | (string | number)[];
894
+ }
895
+ declare const proFormItemProps: () => {
896
+ readonly: {
897
+ type: BooleanConstructor;
898
+ default: undefined;
899
+ };
900
+ fieldProps: {
901
+ type: ObjectConstructor;
902
+ };
903
+ showProps: {
904
+ type: ObjectConstructor;
905
+ };
906
+ slots: {
907
+ type: ObjectConstructor;
908
+ };
909
+ };
910
+ declare type ProFormItemProps = Partial<ExtractPropTypes<ReturnType<typeof proFormItemProps>>> & Record<string, any>;
911
+ declare const createFormItemCompFn: <T extends FormItemProps>(FormItem: any, convertInputCompProps: (value: any, setValue: (v: any) => void, disabled: boolean | undefined) => Record<string, any>) => ({ InputComp, valueType, name }: {
912
+ InputComp: any;
913
+ valueType: TValueType;
914
+ name?: string | undefined;
915
+ }) => vue.DefineComponent<T & Partial<ExtractPropTypes<{
916
+ readonly: {
917
+ type: BooleanConstructor;
918
+ default: undefined;
919
+ };
920
+ fieldProps: {
921
+ type: ObjectConstructor;
922
+ };
923
+ showProps: {
924
+ type: ObjectConstructor;
925
+ };
926
+ slots: {
927
+ type: ObjectConstructor;
928
+ };
929
+ }>> & Record<string, any>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<T & Partial<ExtractPropTypes<{
930
+ readonly: {
931
+ type: BooleanConstructor;
932
+ default: undefined;
933
+ };
934
+ fieldProps: {
935
+ type: ObjectConstructor;
936
+ };
937
+ showProps: {
938
+ type: ObjectConstructor;
939
+ };
940
+ slots: {
941
+ type: ObjectConstructor;
942
+ };
943
+ }>> & Record<string, any> extends vue.ComponentPropsOptions<{
944
+ [x: string]: unknown;
945
+ }> ? ExtractPropTypes<T & Partial<ExtractPropTypes<{
946
+ readonly: {
947
+ type: BooleanConstructor;
948
+ default: undefined;
949
+ };
950
+ fieldProps: {
951
+ type: ObjectConstructor;
952
+ };
953
+ showProps: {
954
+ type: ObjectConstructor;
955
+ };
956
+ slots: {
957
+ type: ObjectConstructor;
958
+ };
959
+ }>> & Record<string, any>> : T & Partial<ExtractPropTypes<{
960
+ readonly: {
961
+ type: BooleanConstructor;
962
+ default: undefined;
963
+ };
964
+ fieldProps: {
965
+ type: ObjectConstructor;
966
+ };
967
+ showProps: {
968
+ type: ObjectConstructor;
969
+ };
970
+ slots: {
971
+ type: ObjectConstructor;
972
+ };
973
+ }>> & Record<string, any>>, vue.ExtractDefaultPropTypes<T & Partial<ExtractPropTypes<{
974
+ readonly: {
975
+ type: BooleanConstructor;
976
+ default: undefined;
977
+ };
978
+ fieldProps: {
979
+ type: ObjectConstructor;
980
+ };
981
+ showProps: {
982
+ type: ObjectConstructor;
983
+ };
984
+ slots: {
985
+ type: ObjectConstructor;
986
+ };
987
+ }>> & Record<string, any>>>;
64
988
 
65
- interface IUseRequestOptions<TReq, TRes, TErr> {
66
- defaultLoading?: boolean;
67
- onSuccess?: (actor: IRequestActor<TReq, TRes, TErr>) => void;
68
- onFail?: (actor: IRequestActor<TReq, TRes, TErr>) => void;
69
- onFinish?: () => void;
989
+ interface IProFormListProvide {
990
+ pathList: (string | number)[];
70
991
  }
71
- declare const useRequest: <TReq, TRes, TErr>(requestActor: IRequestActor<TReq, TRes, TErr>, options?: IUseRequestOptions<TReq, TRes, TErr> | undefined) => readonly [(params: TReq | undefined, options?: Pick<IUseRequestOptions<TReq, TRes, TErr>, "onSuccess" | "onFail"> | undefined) => void, BehaviorSubject<boolean>];
992
+ declare const useProFormList: () => IProFormListProvide;
993
+ declare const proFormListProps: () => {
994
+ rowKey: {
995
+ type: StringConstructor;
996
+ default: string;
997
+ };
998
+ name: {
999
+ type: PropType<string | number | (string | number)[]>;
1000
+ required: boolean;
1001
+ };
1002
+ };
1003
+ declare type ProFormListProps = Partial<ExtractPropTypes<ReturnType<typeof proFormListProps>>>;
1004
+ declare const ProFormList: vue.DefineComponent<Partial<ExtractPropTypes<{
1005
+ rowKey: {
1006
+ type: StringConstructor;
1007
+ default: string;
1008
+ };
1009
+ name: {
1010
+ type: PropType<string | number | (string | number)[]>;
1011
+ required: boolean;
1012
+ };
1013
+ }>>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<Partial<ExtractPropTypes<{
1014
+ rowKey: {
1015
+ type: StringConstructor;
1016
+ default: string;
1017
+ };
1018
+ name: {
1019
+ type: PropType<string | number | (string | number)[]>;
1020
+ required: boolean;
1021
+ };
1022
+ }>>>, {}>;
1023
+
1024
+ /**
1025
+ * 剔除showState或showStateRules规则为!true的值
1026
+ * @param values
1027
+ * @param showState
1028
+ * @param showStateRules
1029
+ */
1030
+ declare const getValidValues: (values: Record<string, any>, showState?: BooleanObjType | undefined, showStateRules?: BooleanRulesObjType | undefined) => Record<string, any>;
72
1031
  /**
73
- * 直接发起请求
1032
+ * string类型的path转为arr
1033
+ * @param path
74
1034
  */
75
- declare const useDirectRequest: <TRequestActor extends IRequestActor<any, any, any>>(requestActor: TRequestActor, params: TRequestActor["req"] | (() => TRequestActor["req"]), deps: any | any[]) => (BehaviorSubject<boolean> | vue.UnwrapNestedRefs<TRequestActor["res"]> | ((nextParams?: TRequestActor["req"] | undefined) => void))[];
1035
+ declare const convertPathToList: (path: undefined | string | number | (string | number)[]) => undefined | (string | number)[];
76
1036
 
77
- export { ContentTypeInterceptor, DispatchRequestType, IRequestActor, IUseRequestOptions, ReqType, RequestProvideType, TRequestInterceptor, cancelActorIfExists, createRequest, createRequestActor, createRequestFactory, createRequestObservable, generateId, getRequestConfig, isCancelActor, isCancelRequestActor, isContentTypeFormURLEncoded, isContentTypeJSON, isContentTypeMultipartFormData, isDoneRequestActor, isFailedRequestActor, isPreRequestActor, paramsSerializer, toUrl, transformRequest, transformResponse, useDirectRequest, useRequest, useRequestProvide };
1037
+ export { BooleanObjType, BooleanRulesObjType, CurdAction, CurdAddAction, CurdCurrentMode, CurdSubAction, FormItemProps, ICurdAction, ICurdAddAction, ICurdCurrentMode, ICurdOperateOpts, ICurdState, ICurdSubAction, IListData, IOperateItem, IProCurdProvide, IProFormProvideExtra, IProModuleProvide, IProTableProvide, IProTableProvideExtra, IRequestOpts, ISearchMode, ITableOperate, ProCurd, ProCurdProps, ProForm, ProFormItemProps, ProFormList, ProFormListProps, ProFormProps, ProModule, ProModuleProps, ProSearchForm, ProSearchFormProps, ProTable, ProTableProps, RequestAction, SearchMode, TActionEvent, TActionState, TColumn, TColumns, TCurdActionEvent, TDefaultValueType, TElementMap, TOption, TOptions, TTableColumn, TTableColumns, TValueType, convertPathToList, createFormItemCompFn, getColumnFormItemName, getColumnValueType, getFormItemEl, getItemEl, getValidValues, provideProCurd, provideProModule, useComposeRequestActor, useDoneRequestActor, useFailedRequestActor, useModuleEvent, useProCurd, useProForm, useProFormList, useProModule, useProTable };