@vue-start/pro 0.5.19 → 0.5.20

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,12 +1,13 @@
1
1
  /// <reference types="lodash" />
2
2
  import * as vue from 'vue';
3
- import { VNode, ExtractPropTypes, PropType, App, UnwrapNestedRefs as UnwrapNestedRefs$1, Ref as Ref$1 } from 'vue';
3
+ import { VNode, ExtractPropTypes, PropType, DefineComponent, App, UnwrapNestedRefs as UnwrapNestedRefs$1, Ref as Ref$1 } from 'vue';
4
4
  import * as _vue_reactivity from '@vue/reactivity';
5
5
  import { UnwrapNestedRefs, Ref, ComputedRef } from '@vue/reactivity';
6
6
  import { Subject } from 'rxjs';
7
7
  import { IRequestActor } from '@vue-start/request';
8
8
  import * as _vue_start_store from '@vue-start/store';
9
9
  import { TUpdater } from '@vue-start/store';
10
+ import { Router, RouteLocationNormalizedLoaded } from 'vue-router';
10
11
  import { TConvert } from '@vue-start/hooks';
11
12
  import * as lodash from 'lodash';
12
13
 
@@ -82,6 +83,84 @@ interface FieldNames {
82
83
  children?: string;
83
84
  }
84
85
 
86
+ /**
87
+ * eg:
88
+ * args:[{id:'111',name:'zx',age:18}]
89
+ * {type$: "data$", name$:"args", namePath$:"0.id"}
90
+ *
91
+ * 转换后
92
+ *
93
+ * '111'
94
+ */
95
+ declare type TDataType = {
96
+ /**
97
+ * 取值源对象
98
+ * name$
99
+ * state: 当前module的state对象;
100
+ * data: 当前module的data(普通obj,仅存储数据使用)对象;
101
+ * args: 当前方法中的参数;缺省取该值
102
+ */
103
+ type$: "data$";
104
+ name$: string;
105
+ namePath$?: string;
106
+ };
107
+ declare type TParamItem = any | TDataType;
108
+ /**
109
+ * args:[{id:'111',name:'zx',age:18}]
110
+ * eg1:
111
+ {
112
+ "type$": "obj",
113
+ "query$": [
114
+ "pick$",
115
+ {
116
+ "type$": "data$",
117
+ "name$": "args",
118
+ "namePath$": "0"
119
+ },
120
+ "id"
121
+ ],
122
+ "name": "QuotaDetail"
123
+ }
124
+ *
125
+ * eg2:
126
+ {
127
+ "type$": "obj",
128
+ "query.id$": {
129
+ "type$": "data$",
130
+ "name$": "args",
131
+ "namePath$": "0.id"
132
+ },
133
+ "name": "QuotaDetail"
134
+ }
135
+ *
136
+ * eg1 和 eg2 转换后的结果都为:
137
+ *
138
+ * {
139
+ * name:"QuotaDetail",
140
+ * query:{
141
+ * id:'111
142
+ * }
143
+ * }
144
+ */
145
+ declare type TObjItem = {
146
+ type$: "obj";
147
+ /**
148
+ * 以"$"符结尾的属性可以设置为 TFunItem | TDataType | TObjItem,最终将为去除$的属性赋值
149
+ */
150
+ [key: string]: TParamItem | TFunItem;
151
+ };
152
+ /**
153
+ * 第一个项:调用模块的方法名称,以"$"结尾
154
+ * eg:
155
+ * ["pick$", {"id":"111", "name":"name"}, "id"]
156
+ *
157
+ * 转换后的结果
158
+ *
159
+ * {id:"111"}
160
+ */
161
+ declare type TFunItem = (string | TParamItem | TObjItem)[];
162
+ declare type TExpression = TFunItem | TDataType | TObjItem;
163
+
85
164
  /***************************************** curd模式 *****************************************/
86
165
  /**
87
166
  * 获取Column的valueType,默认"text"
@@ -111,6 +190,9 @@ declare const getItemEl: <T extends TColumn>(elementMap: any, column: T, value:
111
190
  /***************************************** 通用模式 *****************************************/
112
191
  declare type InternalNamePath = (string | number)[];
113
192
  declare type NamePath = string | number | InternalNamePath;
193
+ declare type TExecuteName = "store" | "router" | "request";
194
+ declare type TExecuteFunName = string;
195
+ declare type TExecuteItem = (TExecuteName | TExecuteFunName | TParamItem | TObjItem | TFunItem)[];
114
196
  interface IHighConfig {
115
197
  registerStateList?: {
116
198
  name: NamePath;
@@ -118,7 +200,7 @@ interface IHighConfig {
118
200
  }[];
119
201
  registerEventList?: {
120
202
  name: string;
121
- sendEventName?: TActionEvent["type"];
203
+ executeList?: TExecuteItem[];
122
204
  }[];
123
205
  registerPropsTrans?: {
124
206
  name: NamePath;
@@ -134,7 +216,7 @@ interface IElementConfig {
134
216
  elementId: string;
135
217
  elementProps?: Record<string, any>;
136
218
  slots?: {
137
- [name: string]: ((...params$: any[]) => any) | (IElementConfig & {
219
+ [name: string]: string | number | ((...params$: any[]) => any) | (IElementConfig & {
138
220
  needParams?: boolean;
139
221
  });
140
222
  };
@@ -142,6 +224,7 @@ interface IElementConfig {
142
224
  childrenSlotName?: string;
143
225
  highConfig$?: IHighConfig;
144
226
  }
227
+ declare const isValidConfig: (elementConfig: any) => boolean;
145
228
  declare const renderElements: (elementMap: TElementMap, elementConfigs: IElementConfig[]) => (VNode | null)[];
146
229
  /**
147
230
  *
@@ -174,8 +257,11 @@ interface IProModuleProvide {
174
257
  sendEvent: (action: TActionEvent) => void;
175
258
  state: UnwrapNestedRefs<Record<string, any>>;
176
259
  dispatch: (action: TActionState) => void;
260
+ data: Record<string, any>;
177
261
  requests: IRequestOpts[];
178
262
  sendRequest: (requestNameOrAction: string, ...params: any[]) => void;
263
+ executeExp: (param: TExpression, args: any) => any;
264
+ execute: (executeList: TExecuteItem[], args: any[]) => void;
179
265
  }
180
266
  declare const useProModule: () => IProModuleProvide;
181
267
  declare const provideProModule: (ctx: IProModuleProvide) => void;
@@ -190,9 +276,13 @@ interface IRequestOpts {
190
276
  stateName?: string;
191
277
  loadingName?: string;
192
278
  convertParams?: (...params: any[]) => Record<string, any>;
279
+ convertParamsEx?: TExpression;
193
280
  convertData?: (actor: IRequestActor) => Record<string, any>;
281
+ convertDataEx?: TExpression;
194
282
  onSuccess?: (actor?: IRequestActor) => void;
283
+ onSuccessEx?: TExecuteItem[];
195
284
  onFailed?: (actor?: IRequestActor) => void;
285
+ onFailedEx?: TExecuteItem[];
196
286
  }
197
287
  declare const RequestAction: {
198
288
  Success: string;
@@ -205,6 +295,21 @@ declare const proModuleProps: () => {
205
295
  state: {
206
296
  type: PropType<Record<string, any>>;
207
297
  };
298
+ initState: {
299
+ type: PropType<object>;
300
+ };
301
+ /**
302
+ * store names
303
+ */
304
+ storeKeys: {
305
+ type: PropType<string[]>;
306
+ };
307
+ /**
308
+ * meta names
309
+ */
310
+ metasKeys: {
311
+ type: PropType<string[]>;
312
+ };
208
313
  /**
209
314
  * 组件集
210
315
  */
@@ -215,11 +320,14 @@ declare const proModuleProps: () => {
215
320
  * 组件描述(树)
216
321
  */
217
322
  elementConfigs: {
218
- type: PropType<IElementConfig[]>;
323
+ type: PropType<IElementConfig | IElementConfig[]>;
219
324
  };
220
325
  /**
221
326
  * requests
222
327
  */
328
+ actors: {
329
+ type: PropType<IRequestActor<any, any, any>[]>;
330
+ };
223
331
  requests: {
224
332
  type: PropType<IRequestOpts[]>;
225
333
  };
@@ -232,6 +340,21 @@ declare const ProModule: vue.DefineComponent<Partial<ExtractPropTypes<{
232
340
  state: {
233
341
  type: PropType<Record<string, any>>;
234
342
  };
343
+ initState: {
344
+ type: PropType<object>;
345
+ };
346
+ /**
347
+ * store names
348
+ */
349
+ storeKeys: {
350
+ type: PropType<string[]>;
351
+ };
352
+ /**
353
+ * meta names
354
+ */
355
+ metasKeys: {
356
+ type: PropType<string[]>;
357
+ };
235
358
  /**
236
359
  * 组件集
237
360
  */
@@ -242,11 +365,14 @@ declare const ProModule: vue.DefineComponent<Partial<ExtractPropTypes<{
242
365
  * 组件描述(树)
243
366
  */
244
367
  elementConfigs: {
245
- type: PropType<IElementConfig[]>;
368
+ type: PropType<IElementConfig | IElementConfig[]>;
246
369
  };
247
370
  /**
248
371
  * requests
249
372
  */
373
+ actors: {
374
+ type: PropType<IRequestActor<any, any, any>[]>;
375
+ };
250
376
  requests: {
251
377
  type: PropType<IRequestOpts[]>;
252
378
  };
@@ -257,6 +383,21 @@ declare const ProModule: vue.DefineComponent<Partial<ExtractPropTypes<{
257
383
  state: {
258
384
  type: PropType<Record<string, any>>;
259
385
  };
386
+ initState: {
387
+ type: PropType<object>;
388
+ };
389
+ /**
390
+ * store names
391
+ */
392
+ storeKeys: {
393
+ type: PropType<string[]>;
394
+ };
395
+ /**
396
+ * meta names
397
+ */
398
+ metasKeys: {
399
+ type: PropType<string[]>;
400
+ };
260
401
  /**
261
402
  * 组件集
262
403
  */
@@ -267,16 +408,35 @@ declare const ProModule: vue.DefineComponent<Partial<ExtractPropTypes<{
267
408
  * 组件描述(树)
268
409
  */
269
410
  elementConfigs: {
270
- type: PropType<IElementConfig[]>;
411
+ type: PropType<IElementConfig | IElementConfig[]>;
271
412
  };
272
413
  /**
273
414
  * requests
274
415
  */
416
+ actors: {
417
+ type: PropType<IRequestActor<any, any, any>[]>;
418
+ };
275
419
  requests: {
276
420
  type: PropType<IRequestOpts[]>;
277
421
  };
278
422
  }>>>, {}>;
279
423
 
424
+ declare type TConfigData = {
425
+ initState?: Record<string, any>;
426
+ initExecuteList?: TExecuteItem[];
427
+ storeKeys?: string[];
428
+ requests?: Omit<IRequestOpts, "actor"> & {
429
+ actor: string;
430
+ }[];
431
+ elementConfigs?: IElementConfig | IElementConfig[];
432
+ };
433
+ declare const createModule: ({ actors, configData, configDataExtra, Logic, }: {
434
+ actors?: IRequestActor<any, any, any>[] | undefined;
435
+ configData?: TConfigData | undefined;
436
+ configDataExtra?: Record<string, any> | undefined;
437
+ Logic?: DefineComponent<{}, {}, {}, vue.ComputedOptions, vue.MethodOptions, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}> | undefined;
438
+ }) => DefineComponent<unknown, () => JSX.Element | null, {}, vue.ComputedOptions, vue.MethodOptions, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<unknown>, {}>;
439
+
280
440
  declare type TInitialState<T> = T | (() => T);
281
441
  declare type TRegisterStore = {
282
442
  key: string;
@@ -322,6 +482,17 @@ declare type TMeta = {
322
482
  declare const useDispatchMeta: () => (actorName: string) => void;
323
483
  declare const useMetaRegister: (registerMetaMap: IProConfigProvide["registerMetaMap"], registerActorMap: IProConfigProvide["registerActorMap"]) => void;
324
484
 
485
+ declare type TOpen = (url?: string | URL, target?: string, features?: string) => WindowProxy | null;
486
+ declare type TOpenMenu = (menu: any) => void;
487
+ declare type TRouter = Router & {
488
+ open: TOpen;
489
+ openMenu: TOpenMenu;
490
+ };
491
+ declare const useProRouter: () => {
492
+ router: TRouter;
493
+ route: RouteLocationNormalizedLoaded;
494
+ };
495
+
325
496
  declare const proBasePropsFn: () => {
326
497
  /**
327
498
  * 组件集
@@ -390,6 +561,10 @@ interface IProConfigProvide {
390
561
  * @param extra
391
562
  */
392
563
  dispatchRequest: ProDispatchRequestType;
564
+ convertRouter?: (router: Router) => TRouter;
565
+ expressionMethods: {
566
+ [key: string]: (...params: any[]) => any;
567
+ };
393
568
  }
394
569
  declare const proConfigProps: () => {
395
570
  elementMap: {
@@ -412,6 +587,14 @@ declare const proConfigProps: () => {
412
587
  registerMetas: {
413
588
  type: PropType<TMeta[]>;
414
589
  };
590
+ convertRouter: {
591
+ type: PropType<(router: Router) => TRouter>;
592
+ };
593
+ expressionMethods: {
594
+ type: PropType<{
595
+ [key: string]: (...params: any[]) => any;
596
+ }>;
597
+ };
415
598
  };
416
599
  declare const useProConfig: () => IProConfigProvide;
417
600
  declare type ProConfigProps = Partial<ExtractPropTypes<ReturnType<typeof proConfigProps>>>;
@@ -439,6 +622,14 @@ declare const ProConfig: vue.DefineComponent<Partial<ExtractPropTypes<{
439
622
  registerMetas: {
440
623
  type: PropType<TMeta[]>;
441
624
  };
625
+ convertRouter: {
626
+ type: PropType<(router: Router) => TRouter>;
627
+ };
628
+ expressionMethods: {
629
+ type: PropType<{
630
+ [key: string]: (...params: any[]) => any;
631
+ }>;
632
+ };
442
633
  }>>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<Partial<ExtractPropTypes<{
443
634
  elementMap: {
444
635
  type: PropType<TElementMap>;
@@ -460,6 +651,14 @@ declare const ProConfig: vue.DefineComponent<Partial<ExtractPropTypes<{
460
651
  registerMetas: {
461
652
  type: PropType<TMeta[]>;
462
653
  };
654
+ convertRouter: {
655
+ type: PropType<(router: Router) => TRouter>;
656
+ };
657
+ expressionMethods: {
658
+ type: PropType<{
659
+ [key: string]: (...params: any[]) => any;
660
+ }>;
661
+ };
463
662
  }>>>, {}>;
464
663
  /**
465
664
  * app.use 方式注册
@@ -2063,4 +2262,4 @@ declare const getSignValue: <T = any>(item: TColumn, signName: string) => T;
2063
2262
  */
2064
2263
  declare const filterSlotsByPrefix: (slots: Record<string, any>, prefix: string) => lodash.Dictionary<any>;
2065
2264
 
2066
- export { AddButton, BooleanObjType, BooleanRulesObjType, ColumnSetting, CurdAction, CurdAddAction, CurdCurrentMode, CurdMethods, CurdSubAction, ElementKeys, FieldNames, FormAction, FormItemProps, FormRulePrefixMap, IAccess, ICurdAction, ICurdAddAction, ICurdCurrentMode, ICurdOperateOpts, ICurdState, ICurdSubAction, IElementConfig, IHighConfig, IListData, IOpeItem, IOperateItem, IPer, IProConfigProvide, IProCurdProvide, IProFormProvideExtra, IProModuleProvide, IProTableProvide, IProTableProvideExtra, IRequestOpts, ISearchMode, ITableOperate, IUser, InternalNamePath, LogonUser, LogonUserKey, MustLogon, NamePath, PageHeaderProps, PaginationSlotProps, PerSuffix, Permission, PermissionProps, ProBaseProps, ProColumnSettingProps, ProConfig, ProConfigProps, ProCurd, ProCurdDesc, ProCurdDescConnect, ProCurdDescProps, ProCurdForm, ProCurdFormConnect, ProCurdFormProps, ProCurdList, ProCurdListConnect, ProCurdListProps, ProCurdModal, ProCurdModalForm, ProCurdModalFormConnect, ProCurdModalProps, ProCurdProps, ProDesc, ProDescProps, ProDispatchRequestType, ProForm, ProFormItemProps, ProFormList, ProFormListProps, ProFormProps, ProGrid, ProGridProps, ProLayout, ProList, ProListProps, ProModalCurd, ProModalCurdProps, ProModule, ProModuleProps, ProOperate, ProOperateProps, ProPage, ProPageCurd, ProPageCurdProps, ProPageProps, ProSearchForm, ProSearchFormProps, ProShowDate, ProShowDigit, ProShowOptions, ProShowText, ProShowTree, ProTable, ProTableProps, ProTypography, ProTypographyProps, ProUploaderText, RequestAction, SearchMode, SearchSlotProps, TAccess, TActionEvent, TActionState, TColumn, TColumns, TCurdActionEvent, TDefaultValueType, TElementMap, TFile, TFormExtraMap, TInitialState, TLogonUserProvide, TMeta, TOption, TOptions, TPageState, TProFormOperate, TRegisterStore, TRegisterStoreMap, TTableColumn, TTableColumns, TValueType, TreeOption, TreeOptions, UploadList, Wrapper, convertPathToList, convertResData, createExpose, createExposeObj, createFormItemCompFn, createProConfig, defaultPage, filterSlotsByPrefix, getColumnFormItemName, getColumnValueType, getFirstPropName, getFormItemEl, getItemEl, getSignValue, getValidValues, mergeStateToList, proBaseProps, provideProCurd, provideProFormList, provideProModule, renderElement, renderElements, useAccess, useAccessMgr, useComposeRequestActor, useDispatchMeta, useDispatchStore, useDoneRequestActor, useFailedRequestActor, useGetCompByKey, useHasPer, useLogonUser, useMetaRegister, useModuleEvent, useProConfig, useProCurd, useProForm, useProFormList, useProModule, useProTable, useReadStore };
2265
+ export { AddButton, BooleanObjType, BooleanRulesObjType, ColumnSetting, CurdAction, CurdAddAction, CurdCurrentMode, CurdMethods, CurdSubAction, ElementKeys, FieldNames, FormAction, FormItemProps, FormRulePrefixMap, IAccess, ICurdAction, ICurdAddAction, ICurdCurrentMode, ICurdOperateOpts, ICurdState, ICurdSubAction, IElementConfig, IHighConfig, IListData, IOpeItem, IOperateItem, IPer, IProConfigProvide, IProCurdProvide, IProFormProvideExtra, IProModuleProvide, IProTableProvide, IProTableProvideExtra, IRequestOpts, ISearchMode, ITableOperate, IUser, InternalNamePath, LogonUser, LogonUserKey, MustLogon, NamePath, PageHeaderProps, PaginationSlotProps, PerSuffix, Permission, PermissionProps, ProBaseProps, ProColumnSettingProps, ProConfig, ProConfigProps, ProCurd, ProCurdDesc, ProCurdDescConnect, ProCurdDescProps, ProCurdForm, ProCurdFormConnect, ProCurdFormProps, ProCurdList, ProCurdListConnect, ProCurdListProps, ProCurdModal, ProCurdModalForm, ProCurdModalFormConnect, ProCurdModalProps, ProCurdProps, ProDesc, ProDescProps, ProDispatchRequestType, ProForm, ProFormItemProps, ProFormList, ProFormListProps, ProFormProps, ProGrid, ProGridProps, ProLayout, ProList, ProListProps, ProModalCurd, ProModalCurdProps, ProModule, ProModuleProps, ProOperate, ProOperateProps, ProPage, ProPageCurd, ProPageCurdProps, ProPageProps, ProSearchForm, ProSearchFormProps, ProShowDate, ProShowDigit, ProShowOptions, ProShowText, ProShowTree, ProTable, ProTableProps, ProTypography, ProTypographyProps, ProUploaderText, RequestAction, SearchMode, SearchSlotProps, TAccess, TActionEvent, TActionState, TColumn, TColumns, TConfigData, TCurdActionEvent, TDefaultValueType, TElementMap, TExecuteFunName, TExecuteItem, TExecuteName, TFile, TFormExtraMap, TInitialState, TLogonUserProvide, TMeta, TOpen, TOpenMenu, TOption, TOptions, TPageState, TProFormOperate, TRegisterStore, TRegisterStoreMap, TRouter, TTableColumn, TTableColumns, TValueType, TreeOption, TreeOptions, UploadList, Wrapper, convertPathToList, convertResData, createExpose, createExposeObj, createFormItemCompFn, createModule, createProConfig, defaultPage, filterSlotsByPrefix, getColumnFormItemName, getColumnValueType, getFirstPropName, getFormItemEl, getItemEl, getSignValue, getValidValues, isValidConfig, mergeStateToList, proBaseProps, provideProCurd, provideProFormList, provideProModule, renderElement, renderElements, useAccess, useAccessMgr, useComposeRequestActor, useDispatchMeta, useDispatchStore, useDoneRequestActor, useFailedRequestActor, useGetCompByKey, useHasPer, useLogonUser, useMetaRegister, useModuleEvent, useProConfig, useProCurd, useProForm, useProFormList, useProModule, useProRouter, useProTable, useReadStore };