@vue-start/pro 0.5.19 → 0.5.21

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,14 +190,18 @@ 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;
117
199
  mapName?: NamePath;
200
+ target?: "prop" | "slot";
118
201
  }[];
119
202
  registerEventList?: {
120
203
  name: string;
121
- sendEventName?: TActionEvent["type"];
204
+ executeList?: TExecuteItem[];
122
205
  }[];
123
206
  registerPropsTrans?: {
124
207
  name: NamePath;
@@ -134,7 +217,7 @@ interface IElementConfig {
134
217
  elementId: string;
135
218
  elementProps?: Record<string, any>;
136
219
  slots?: {
137
- [name: string]: ((...params$: any[]) => any) | (IElementConfig & {
220
+ [name: string]: string | number | ((...params$: any[]) => any) | (IElementConfig & {
138
221
  needParams?: boolean;
139
222
  });
140
223
  };
@@ -142,6 +225,7 @@ interface IElementConfig {
142
225
  childrenSlotName?: string;
143
226
  highConfig$?: IHighConfig;
144
227
  }
228
+ declare const isValidConfig: (elementConfig: any) => boolean;
145
229
  declare const renderElements: (elementMap: TElementMap, elementConfigs: IElementConfig[]) => (VNode | null)[];
146
230
  /**
147
231
  *
@@ -174,8 +258,11 @@ interface IProModuleProvide {
174
258
  sendEvent: (action: TActionEvent) => void;
175
259
  state: UnwrapNestedRefs<Record<string, any>>;
176
260
  dispatch: (action: TActionState) => void;
261
+ data: Record<string, any>;
177
262
  requests: IRequestOpts[];
178
263
  sendRequest: (requestNameOrAction: string, ...params: any[]) => void;
264
+ executeExp: (param: TExpression, args: any) => any;
265
+ execute: (executeList: TExecuteItem[], args: any[]) => void;
179
266
  }
180
267
  declare const useProModule: () => IProModuleProvide;
181
268
  declare const provideProModule: (ctx: IProModuleProvide) => void;
@@ -190,9 +277,13 @@ interface IRequestOpts {
190
277
  stateName?: string;
191
278
  loadingName?: string;
192
279
  convertParams?: (...params: any[]) => Record<string, any>;
280
+ convertParamsEx?: TExpression;
193
281
  convertData?: (actor: IRequestActor) => Record<string, any>;
282
+ convertDataEx?: TExpression;
194
283
  onSuccess?: (actor?: IRequestActor) => void;
284
+ onSuccessEx?: TExecuteItem[];
195
285
  onFailed?: (actor?: IRequestActor) => void;
286
+ onFailedEx?: TExecuteItem[];
196
287
  }
197
288
  declare const RequestAction: {
198
289
  Success: string;
@@ -205,6 +296,21 @@ declare const proModuleProps: () => {
205
296
  state: {
206
297
  type: PropType<Record<string, any>>;
207
298
  };
299
+ initState: {
300
+ type: PropType<object>;
301
+ };
302
+ /**
303
+ * store names
304
+ */
305
+ storeKeys: {
306
+ type: PropType<string[]>;
307
+ };
308
+ /**
309
+ * meta names
310
+ */
311
+ metasKeys: {
312
+ type: PropType<string[]>;
313
+ };
208
314
  /**
209
315
  * 组件集
210
316
  */
@@ -215,11 +321,14 @@ declare const proModuleProps: () => {
215
321
  * 组件描述(树)
216
322
  */
217
323
  elementConfigs: {
218
- type: PropType<IElementConfig[]>;
324
+ type: PropType<IElementConfig | IElementConfig[]>;
219
325
  };
220
326
  /**
221
327
  * requests
222
328
  */
329
+ actors: {
330
+ type: PropType<IRequestActor<any, any, any>[]>;
331
+ };
223
332
  requests: {
224
333
  type: PropType<IRequestOpts[]>;
225
334
  };
@@ -232,6 +341,21 @@ declare const ProModule: vue.DefineComponent<Partial<ExtractPropTypes<{
232
341
  state: {
233
342
  type: PropType<Record<string, any>>;
234
343
  };
344
+ initState: {
345
+ type: PropType<object>;
346
+ };
347
+ /**
348
+ * store names
349
+ */
350
+ storeKeys: {
351
+ type: PropType<string[]>;
352
+ };
353
+ /**
354
+ * meta names
355
+ */
356
+ metasKeys: {
357
+ type: PropType<string[]>;
358
+ };
235
359
  /**
236
360
  * 组件集
237
361
  */
@@ -242,11 +366,14 @@ declare const ProModule: vue.DefineComponent<Partial<ExtractPropTypes<{
242
366
  * 组件描述(树)
243
367
  */
244
368
  elementConfigs: {
245
- type: PropType<IElementConfig[]>;
369
+ type: PropType<IElementConfig | IElementConfig[]>;
246
370
  };
247
371
  /**
248
372
  * requests
249
373
  */
374
+ actors: {
375
+ type: PropType<IRequestActor<any, any, any>[]>;
376
+ };
250
377
  requests: {
251
378
  type: PropType<IRequestOpts[]>;
252
379
  };
@@ -257,6 +384,21 @@ declare const ProModule: vue.DefineComponent<Partial<ExtractPropTypes<{
257
384
  state: {
258
385
  type: PropType<Record<string, any>>;
259
386
  };
387
+ initState: {
388
+ type: PropType<object>;
389
+ };
390
+ /**
391
+ * store names
392
+ */
393
+ storeKeys: {
394
+ type: PropType<string[]>;
395
+ };
396
+ /**
397
+ * meta names
398
+ */
399
+ metasKeys: {
400
+ type: PropType<string[]>;
401
+ };
260
402
  /**
261
403
  * 组件集
262
404
  */
@@ -267,16 +409,35 @@ declare const ProModule: vue.DefineComponent<Partial<ExtractPropTypes<{
267
409
  * 组件描述(树)
268
410
  */
269
411
  elementConfigs: {
270
- type: PropType<IElementConfig[]>;
412
+ type: PropType<IElementConfig | IElementConfig[]>;
271
413
  };
272
414
  /**
273
415
  * requests
274
416
  */
417
+ actors: {
418
+ type: PropType<IRequestActor<any, any, any>[]>;
419
+ };
275
420
  requests: {
276
421
  type: PropType<IRequestOpts[]>;
277
422
  };
278
423
  }>>>, {}>;
279
424
 
425
+ declare type TConfigData = {
426
+ initState?: Record<string, any>;
427
+ initExecuteList?: TExecuteItem[];
428
+ storeKeys?: string[];
429
+ requests?: Omit<IRequestOpts, "actor"> & {
430
+ actor: string;
431
+ }[];
432
+ elementConfigs?: IElementConfig | IElementConfig[];
433
+ };
434
+ declare const createModule: ({ actors, configData, configDataExtra, Logic, }: {
435
+ actors?: IRequestActor<any, any, any>[] | undefined;
436
+ configData?: TConfigData | undefined;
437
+ configDataExtra?: Record<string, any> | undefined;
438
+ Logic?: DefineComponent<{}, {}, {}, vue.ComputedOptions, vue.MethodOptions, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<vue.ExtractPropTypes<{}>>, {}> | undefined;
439
+ }) => DefineComponent<unknown, () => JSX.Element | null, {}, vue.ComputedOptions, vue.MethodOptions, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<unknown>, {}>;
440
+
280
441
  declare type TInitialState<T> = T | (() => T);
281
442
  declare type TRegisterStore = {
282
443
  key: string;
@@ -322,6 +483,17 @@ declare type TMeta = {
322
483
  declare const useDispatchMeta: () => (actorName: string) => void;
323
484
  declare const useMetaRegister: (registerMetaMap: IProConfigProvide["registerMetaMap"], registerActorMap: IProConfigProvide["registerActorMap"]) => void;
324
485
 
486
+ declare type TOpen = (url?: string | URL, target?: string, features?: string) => WindowProxy | null;
487
+ declare type TOpenMenu = (menu: any) => void;
488
+ declare type TRouter = Router & {
489
+ open: TOpen;
490
+ openMenu: TOpenMenu;
491
+ };
492
+ declare const useProRouter: () => {
493
+ router: TRouter;
494
+ route: RouteLocationNormalizedLoaded;
495
+ };
496
+
325
497
  declare const proBasePropsFn: () => {
326
498
  /**
327
499
  * 组件集
@@ -390,6 +562,10 @@ interface IProConfigProvide {
390
562
  * @param extra
391
563
  */
392
564
  dispatchRequest: ProDispatchRequestType;
565
+ convertRouter?: (router: Router) => TRouter;
566
+ expressionMethods: {
567
+ [key: string]: (...params: any[]) => any;
568
+ };
393
569
  }
394
570
  declare const proConfigProps: () => {
395
571
  elementMap: {
@@ -412,6 +588,14 @@ declare const proConfigProps: () => {
412
588
  registerMetas: {
413
589
  type: PropType<TMeta[]>;
414
590
  };
591
+ convertRouter: {
592
+ type: PropType<(router: Router) => TRouter>;
593
+ };
594
+ expressionMethods: {
595
+ type: PropType<{
596
+ [key: string]: (...params: any[]) => any;
597
+ }>;
598
+ };
415
599
  };
416
600
  declare const useProConfig: () => IProConfigProvide;
417
601
  declare type ProConfigProps = Partial<ExtractPropTypes<ReturnType<typeof proConfigProps>>>;
@@ -439,6 +623,14 @@ declare const ProConfig: vue.DefineComponent<Partial<ExtractPropTypes<{
439
623
  registerMetas: {
440
624
  type: PropType<TMeta[]>;
441
625
  };
626
+ convertRouter: {
627
+ type: PropType<(router: Router) => TRouter>;
628
+ };
629
+ expressionMethods: {
630
+ type: PropType<{
631
+ [key: string]: (...params: any[]) => any;
632
+ }>;
633
+ };
442
634
  }>>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, vue.EmitsOptions, string, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps, Readonly<Partial<ExtractPropTypes<{
443
635
  elementMap: {
444
636
  type: PropType<TElementMap>;
@@ -460,6 +652,14 @@ declare const ProConfig: vue.DefineComponent<Partial<ExtractPropTypes<{
460
652
  registerMetas: {
461
653
  type: PropType<TMeta[]>;
462
654
  };
655
+ convertRouter: {
656
+ type: PropType<(router: Router) => TRouter>;
657
+ };
658
+ expressionMethods: {
659
+ type: PropType<{
660
+ [key: string]: (...params: any[]) => any;
661
+ }>;
662
+ };
463
663
  }>>>, {}>;
464
664
  /**
465
665
  * app.use 方式注册
@@ -2063,4 +2263,4 @@ declare const getSignValue: <T = any>(item: TColumn, signName: string) => T;
2063
2263
  */
2064
2264
  declare const filterSlotsByPrefix: (slots: Record<string, any>, prefix: string) => lodash.Dictionary<any>;
2065
2265
 
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 };
2266
+ 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 };