cnhis-design-vue 3.1.53-beta.1 → 3.1.53-beta.3

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.
Files changed (149) hide show
  1. package/README.md +87 -87
  2. package/es/components/annotation-edit/src/AnnotationEdit.js +1 -1
  3. package/es/components/big-table/src/components/edit-form/edit-separate.vue.d.ts +4 -4
  4. package/es/components/big-table/src/hooks/useEdit.d.ts +4 -4
  5. package/es/components/big-table/src/hooks/useSeparateRow.d.ts +4 -4
  6. package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
  7. package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
  8. package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
  9. package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
  10. package/es/components/button-print/src/utils/dialog.d.ts +2 -2
  11. package/es/components/button-print/src/utils/print.d.ts +14 -13
  12. package/es/components/button-print/src/utils/print.js +1 -1
  13. package/es/components/callback/src/components/render/popupMaps.d.ts +69 -6
  14. package/es/components/card-reader-sdk/src/cardReaderSDK.js +1 -1
  15. package/es/components/card-reader-sdk/src/types/index.d.ts +3 -3
  16. package/es/components/date-picker/src/DatePicker.vue2.js +1 -1
  17. package/es/components/expand-field/src/components/form.vue2.js +1 -1
  18. package/es/components/form-config/index.d.ts +98 -26
  19. package/es/components/form-config/src/FormConfig.vue.d.ts +99 -27
  20. package/es/components/form-config/src/FormConfig.vue2.js +1 -1
  21. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +30 -6
  22. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +48 -12
  23. package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +1 -1
  24. package/es/components/form-render/index.d.ts +30 -6
  25. package/es/components/form-render/index.js +1 -1
  26. package/es/components/form-render/src/FormRender.vue.d.ts +31 -7
  27. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  28. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +31 -7
  29. package/es/components/form-render/src/components/renderer/combination.js +1 -1
  30. package/es/components/form-render/src/components/renderer/inputNumber.d.ts +5 -5
  31. package/es/components/form-render/src/components/renderer/levelSearchCascader/index.d.ts +2 -4
  32. package/es/components/form-render/src/components/renderer/levelSearchCascader/index.js +1 -1
  33. package/es/components/form-render/src/components/renderer/searchCascade.d.ts +3 -3
  34. package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
  35. package/es/components/form-render/src/components/renderer/select.d.ts +4 -4
  36. package/es/components/form-render/src/components/renderer/select.js +1 -1
  37. package/es/components/form-render/src/constants/index.d.ts +3 -2
  38. package/es/components/form-render/src/hooks/index.d.ts +0 -2
  39. package/es/components/form-render/src/hooks/index.js +1 -1
  40. package/es/components/form-render/src/hooks/useAnchor.d.ts +3 -3
  41. package/es/components/form-render/src/hooks/useCommonInjection.d.ts +2 -2
  42. package/es/components/form-render/src/hooks/useFieldListAdaptor.d.ts +2 -2
  43. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  44. package/es/components/form-render/src/hooks/useFieldNormalize.d.ts +10 -2
  45. package/es/components/form-render/src/hooks/useFormContext.d.ts +3 -3
  46. package/es/components/form-render/src/hooks/useFormContext.js +1 -1
  47. package/es/components/form-render/src/hooks/useFormItemDeps.d.ts +3 -3
  48. package/es/components/form-render/src/hooks/useFormRenderLifeCycle.d.ts +9 -1
  49. package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +5 -5
  50. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  51. package/es/components/form-render/src/types/fieldItem.d.ts +3 -2
  52. package/es/components/form-render/src/types/index.d.ts +7 -14
  53. package/es/components/form-render/src/utils/index.d.ts +1 -2
  54. package/es/components/form-render/src/utils/index.js +1 -1
  55. package/es/components/form-render/src/utils/schema.d.ts +2 -2
  56. package/es/components/form-render/src/utils/schema.js +1 -1
  57. package/es/components/guide/src/renderer.js +1 -1
  58. package/es/components/iho-table/index.d.ts +39 -0
  59. package/es/components/iho-table/src/IhoTable.vue.d.ts +40 -0
  60. package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
  61. package/es/components/iho-table/src/constants/index.d.ts +4 -1
  62. package/es/components/iho-table/src/constants/index.js +1 -1
  63. package/es/components/iho-table/src/hooks/tapHooks/useEventHooks.d.ts +2 -2
  64. package/es/components/iho-table/src/hooks/tapHooks/useExposeHooks.d.ts +2 -2
  65. package/es/components/iho-table/src/plugins/defaultConfigPlugin/index.js +1 -1
  66. package/es/components/iho-table/src/plugins/index.js +1 -1
  67. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.d.ts +2 -2
  68. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useAutoFocus.js +1 -1
  69. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/index.d.ts +1 -0
  70. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/index.js +1 -0
  71. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue.d.ts +552 -0
  72. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue.js +1 -0
  73. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue2.js +1 -0
  74. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +4 -1
  75. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  76. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
  77. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/editSeparate.vue.d.ts +2 -2
  78. package/es/components/iho-table/src/types/index.d.ts +5 -2
  79. package/es/components/iho-table/src/types/pluginType.d.ts +3 -3
  80. package/es/components/index.d.ts +1 -0
  81. package/es/components/index.js +1 -1
  82. package/es/components/info-header/index.d.ts +97 -29
  83. package/es/components/info-header/src/InfoHeader.vue.d.ts +98 -30
  84. package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +9 -5
  85. package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +10 -6
  86. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +41 -13
  87. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +30 -6
  88. package/es/components/keyboard/src/Keyboard.vue2.js +1 -1
  89. package/es/components/scale-view/src/ScaleView.vue2.js +1 -1
  90. package/es/components/search-cascader/index.d.ts +23 -3
  91. package/es/components/search-cascader/src/SearchCascader.vue.d.ts +24 -4
  92. package/es/components/search-cascader/src/SearchCascader.vue2.js +1 -1
  93. package/es/components/search-cascader/src/components/ClearIcon.vue.js +1 -0
  94. package/es/components/select-label/src/LabelFormContent.vue2.js +1 -1
  95. package/es/components/select-person/src/SearchMultiple.vue.d.ts +0 -6
  96. package/es/components/shortcut-setter/index.d.ts +33 -9
  97. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +34 -10
  98. package/es/components/steps-wheel/src/StepsWheel.vue2.js +1 -1
  99. package/es/components/table-export-field/src/components/ExportModal.vue.d.ts +3 -0
  100. package/es/components/time-picker/src/TimePicker.vue2.js +1 -1
  101. package/es/env.d.ts +25 -25
  102. package/es/shared/assets/img/failure.png.js +1 -1
  103. package/es/shared/assets/img/no-permission.png.js +1 -1
  104. package/es/shared/assets/img/nodata.png.js +1 -1
  105. package/es/shared/assets/img/notfound.png.js +1 -1
  106. package/es/shared/assets/img/qr.png.js +1 -1
  107. package/es/shared/assets/img/success.png.js +1 -1
  108. package/es/shared/assets/img/video.png.js +1 -1
  109. package/es/shared/assets/img/video_default_cover.png.js +1 -1
  110. package/es/shared/assets/img/xb_big.png.js +1 -1
  111. package/es/shared/assets/img/xb_small.png.js +1 -1
  112. package/es/shared/components/InputNumberSlash/InputNumberSlash.d.ts +4 -4
  113. package/es/shared/components/SlotRender/SlotRender.d.ts +5 -5
  114. package/es/shared/components/VueDraggable/src/vuedraggable.d.ts +86 -0
  115. package/es/shared/hooks/index.d.ts +3 -0
  116. package/es/shared/hooks/index.js +1 -1
  117. package/es/shared/hooks/selectHooks/index.d.ts +4 -0
  118. package/es/shared/hooks/selectHooks/index.js +1 -0
  119. package/es/shared/hooks/selectHooks/useOptionFiltered.d.ts +10 -0
  120. package/es/shared/hooks/selectHooks/useOptionFiltered.js +1 -0
  121. package/es/shared/hooks/selectHooks/useSearchContent.d.ts +6 -0
  122. package/es/shared/hooks/selectHooks/useSearchContent.js +1 -0
  123. package/es/shared/hooks/selectHooks/useSelectAllowModify.d.ts +23 -0
  124. package/es/shared/hooks/selectHooks/useSelectAllowModify.js +1 -0
  125. package/es/shared/hooks/selectHooks/useSelectRenders.d.ts +19 -0
  126. package/es/shared/hooks/selectHooks/useSelectRenders.js +1 -0
  127. package/es/shared/hooks/{useAsyncQueue.d.ts → useAsyncQueue/index.d.ts} +7 -15
  128. package/es/shared/hooks/useAsyncQueue/index.js +1 -0
  129. package/es/shared/hooks/useAsyncQueue/types.d.ts +20 -0
  130. package/es/shared/hooks/useAsyncQueue/types.js +1 -0
  131. package/es/shared/hooks/useDateTime.d.ts +2 -2
  132. package/es/shared/hooks/useFormRequest/index.d.ts +24 -0
  133. package/es/shared/hooks/useFormRequest/index.js +1 -0
  134. package/es/shared/hooks/useFormRequest/types.d.ts +39 -0
  135. package/es/shared/hooks/useFormRequest/types.js +1 -0
  136. package/es/shared/hooks/useLevelSearchCascader.d.ts +31 -0
  137. package/es/shared/hooks/useLevelSearchCascader.js +1 -0
  138. package/es/shared/package.json.js +1 -1
  139. package/es/shared/types/index.d.ts +1 -1
  140. package/es/shared/utils/fabricjs/index.d.ts +6823 -0
  141. package/es/shared/utils/tapable/index.d.ts +139 -0
  142. package/package.json +2 -2
  143. package/es/components/form-render/src/components/renderer/levelSearchCascader/utils.d.ts +0 -23
  144. package/es/components/form-render/src/components/renderer/levelSearchCascader/utils.js +0 -1
  145. package/es/components/form-render/src/hooks/useFormAsyncQueue.d.ts +0 -16
  146. package/es/components/form-render/src/hooks/useFormAsyncQueue.js +0 -1
  147. package/es/components/form-render/src/hooks/useFormRequest.d.ts +0 -26
  148. package/es/components/form-render/src/hooks/useFormRequest.js +0 -1
  149. package/es/shared/hooks/useAsyncQueue.js +0 -1
@@ -0,0 +1,139 @@
1
+ type FixedSizeArray<T extends number, U> = T extends 0
2
+ ? void[]
3
+ : ReadonlyArray<U> & {
4
+ 0: U;
5
+ length: T;
6
+ };
7
+ type Measure<T extends number> = T extends 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 ? T : never;
8
+ type Append<T extends any[], U> = {
9
+ 0: [U];
10
+ 1: [T[0], U];
11
+ 2: [T[0], T[1], U];
12
+ 3: [T[0], T[1], T[2], U];
13
+ 4: [T[0], T[1], T[2], T[3], U];
14
+ 5: [T[0], T[1], T[2], T[3], T[4], U];
15
+ 6: [T[0], T[1], T[2], T[3], T[4], T[5], U];
16
+ 7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], U];
17
+ 8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], U];
18
+ }[Measure<T['length']>];
19
+ type AsArray<T> = T extends any[] ? T : [T];
20
+
21
+ declare class UnsetAdditionalOptions {
22
+ _UnsetAdditionalOptions: true;
23
+ }
24
+ type IfSet<X> = X extends UnsetAdditionalOptions ? {} : X;
25
+
26
+ type Callback<E, T> = (error: E | null, result?: T) => void;
27
+ type InnerCallback<E, T> = (error?: E | null | false, result?: T) => void;
28
+
29
+ type FullTap = Tap & {
30
+ type: 'sync' | 'async' | 'promise';
31
+ fn: Function;
32
+ };
33
+
34
+ type Tap = TapOptions & {
35
+ name: string;
36
+ };
37
+
38
+ type TapOptions = {
39
+ before?: string;
40
+ stage?: number;
41
+ };
42
+
43
+ interface HookInterceptor<T, R, AdditionalOptions = UnsetAdditionalOptions> {
44
+ name?: string;
45
+ tap?: (tap: FullTap & IfSet<AdditionalOptions>) => void;
46
+ call?: (...args: any[]) => void;
47
+ loop?: (...args: any[]) => void;
48
+ error?: (err: Error) => void;
49
+ result?: (result: R) => void;
50
+ done?: () => void;
51
+ register?: (tap: FullTap & IfSet<AdditionalOptions>) => FullTap & IfSet<AdditionalOptions>;
52
+ }
53
+
54
+ type ArgumentNames<T extends any[]> = FixedSizeArray<T['length'], string>;
55
+
56
+ declare class Hook<T, R, AdditionalOptions = UnsetAdditionalOptions> {
57
+ constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
58
+ name: string | undefined;
59
+ taps: FullTap[];
60
+ intercept(interceptor: HookInterceptor<T, R, AdditionalOptions>): void;
61
+ isUsed(): boolean;
62
+ callAsync(...args: Append<AsArray<T>, Callback<Error, R>>): void;
63
+ promise(...args: AsArray<T>): Promise<R>;
64
+ tap(options: string | (Tap & IfSet<AdditionalOptions>), fn: (...args: AsArray<T>) => R): void;
65
+ withOptions(options: TapOptions & IfSet<AdditionalOptions>): Omit<this, 'call' | 'callAsync' | 'promise'>;
66
+ }
67
+
68
+ export class SyncHook<T, R = void, AdditionalOptions = UnsetAdditionalOptions> extends Hook<T, R, AdditionalOptions> {
69
+ call(...args: AsArray<T>): R;
70
+ }
71
+
72
+ export class SyncBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends SyncHook<T, R, AdditionalOptions> {}
73
+ export class SyncLoopHook<T, AdditionalOptions = UnsetAdditionalOptions> extends SyncHook<T, void, AdditionalOptions> {}
74
+ export class SyncWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends SyncHook<
75
+ T,
76
+ AsArray<T>[0],
77
+ AdditionalOptions
78
+ > {}
79
+
80
+ declare class AsyncHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends Hook<T, R, AdditionalOptions> {
81
+ tapAsync(
82
+ options: string | (Tap & IfSet<AdditionalOptions>),
83
+ fn: (...args: Append<AsArray<T>, InnerCallback<Error, R>>) => void
84
+ ): void;
85
+ tapPromise(options: string | (Tap & IfSet<AdditionalOptions>), fn: (...args: AsArray<T>) => Promise<R>): void;
86
+ }
87
+
88
+ export class AsyncParallelHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
89
+ T,
90
+ void,
91
+ AdditionalOptions
92
+ > {}
93
+ export class AsyncParallelBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
94
+ T,
95
+ R,
96
+ AdditionalOptions
97
+ > {}
98
+ export class AsyncSeriesHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
99
+ T,
100
+ void,
101
+ AdditionalOptions
102
+ > {}
103
+ export class AsyncSeriesBailHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
104
+ T,
105
+ R,
106
+ AdditionalOptions
107
+ > {}
108
+ export class AsyncSeriesLoopHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
109
+ T,
110
+ void,
111
+ AdditionalOptions
112
+ > {}
113
+ export class AsyncSeriesWaterfallHook<T, AdditionalOptions = UnsetAdditionalOptions> extends AsyncHook<
114
+ T,
115
+ AsArray<T>[0],
116
+ AdditionalOptions
117
+ > {}
118
+
119
+ type HookFactory<H> = (key: any, hook?: H) => H;
120
+
121
+ interface HookMapInterceptor<H> {
122
+ factory?: HookFactory<H>;
123
+ }
124
+
125
+ export class HookMap<H> {
126
+ constructor(factory: HookFactory<H>, name?: string);
127
+ name: string | undefined;
128
+ get(key: any): H | undefined;
129
+ for(key: any): H;
130
+ intercept(interceptor: HookMapInterceptor<H>): void;
131
+ }
132
+
133
+ export class MultiHook<H> {
134
+ constructor(hooks: H[], name?: string);
135
+ name: string | undefined;
136
+ tap(options: string | Tap, fn?: Function): void;
137
+ tapAsync(options: string | Tap, fn?: Function): void;
138
+ tapPromise(options: string | Tap, fn?: Function): void;
139
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.53-beta.1",
3
+ "version": "3.1.53-beta.3",
4
4
  "license": "ISC",
5
5
  "module": "./es/components/index.js",
6
6
  "main": "./es/components/index.js",
@@ -63,5 +63,5 @@
63
63
  "iOS 7",
64
64
  "last 3 iOS versions"
65
65
  ],
66
- "gitHead": "d160efdbb0655ca9fb207e69e5da215fefcb2b21"
66
+ "gitHead": "d1b8ae639160d56f3fc0d3ed985f630077a8388a"
67
67
  }
@@ -1,23 +0,0 @@
1
- import { AnyObject, FormWordbook } from '../../../../../../../es/shared/types';
2
- import { Ref } from 'vue';
3
- export declare function createCascaderUtils(valueKey: Ref<string>, labelKey: Ref<string>, renderKey: Ref<string | undefined>): {
4
- transformListToChildren(list: AnyObject[]): AnyObject[][];
5
- getNodeDepth(node: AnyObject): number;
6
- enrichChildOption(option: AnyObject, parent: AnyObject, depth: number): {
7
- parent: AnyObject;
8
- isLeaf: boolean;
9
- };
10
- enrichKeywordOption(option: AnyObject, keyword?: string): AnyObject;
11
- sortOptionWithIdList(options: AnyObject[], idList: string[]): AnyObject[];
12
- generateOptionWithIdList(options: AnyObject[], idList: string[], depth: number): {
13
- options: AnyObject[];
14
- lastOption: AnyObject;
15
- };
16
- parseLinkFromString2List(linkString: string): string[];
17
- isClickNodeCheckbox(node?: AnyObject): node is {
18
- isLeaf: true;
19
- } & AnyObject;
20
- createConfigObject(wordbook: FormWordbook, keyword?: string, node?: AnyObject): AnyObject[];
21
- createOptionValue(node: AnyObject): AnyObject[];
22
- shouldInitOptionList(value: unknown, node?: AnyObject, keyword?: string): value is any[];
23
- };
@@ -1 +0,0 @@
1
- import{cloneDeep as e,omit as t,isArray as r,isEmpty as n}from"lodash-es";function i(i,o,a){return{transformListToChildren(t){if(!t.length)return[];const r=[(t=e(t))[0]];let n=t[0];for(let e=1;e<t.length;e++){const r=t[e];r&&(n.children=[r],r.parent=n,n=r)}return[t,r]},getNodeDepth(e){let t=1,r=e.parent;for(;r;)t++,r=r.parent;return t},enrichChildOption(e,t,r){return{...e,parent:t,isLeaf:this.getNodeDepth(t)+1>=r}},enrichKeywordOption:(e,t)=>(e.__keyword=!!t,e.isLeaf=!!t,t&&a.value&&e[a.value]&&(e[o.value]=e[a.value]),e),sortOptionWithIdList:(e,t)=>t.map((t=>e.find((e=>e[i.value]===t)))),generateOptionWithIdList(e,t,r){let n=e[0];return{options:t.reduce(((t,o,a)=>{const l=(s=o,e.find((e=>e[i.value]===s)));var s;return 0===a?(n=l,[l]):(Object.assign(l,{parent:n,isLeaf:a+1>=r}),n.children=[l],n=l,t)}),[]),lastOption:n}},parseLinkFromString2List:e=>e.split("_").filter((e=>e)),isClickNodeCheckbox:e=>e&&!e.__keyword&&e.isLeaf,createConfigObject:(e,t,r)=>t?e.conObj||[]:r?[{con:"EQ",is_compare_field:!1,field_key:e.level_key,value:r[i.value]}]:e.conObjFirstLevel||[],createOptionValue(e){const r=[];let n=e;for(;n;)r.unshift(t(n,["parent","isLeaf","__keyword","children"])),n=n.parent;return r},shouldInitOptionList:(e,t,o)=>r(e)&&!n(e)&&e.every((e=>e[i.value]))&&!t&&!o}}export{i as createCascaderUtils};
@@ -1,16 +0,0 @@
1
- import { AsyncQueue } from '../../../../../es/shared/hooks';
2
- import { AnyObject, UndefinedAble } from '../../../../../es/shared/types';
3
- import { ComputedRef } from 'vue';
4
- import { FormAsyncQueueItem } from '../types';
5
- import { RequestInstance } from '../../../../../es/components/form-render';
6
- declare type ProcessorOption = Partial<{
7
- afterRequest(key: string, res?: unknown, payload?: AnyObject): AnyObject[];
8
- beforeRequest(key: string, params?: unknown, payload?: AnyObject): UndefinedAble<AnyObject> | void;
9
- }>;
10
- export declare function useFormAsyncQueue(requestInstance: ComputedRef<UndefinedAble<RequestInstance>>, uniqueData: ComputedRef<boolean>): {
11
- create: (parallelism?: number, option?: ProcessorOption) => AsyncQueue<FormAsyncQueueItem, any, {
12
- label: string;
13
- value: unknown;
14
- }[]>;
15
- };
16
- export {};
@@ -1 +0,0 @@
1
- import{uuidGenerator as e}from"../../../../shared/utils/index.js";import{isFunction as r}from"lodash-es";import"naive-ui";import{unref as t}from"vue";import"@vueuse/core";import"date-fns";import{AsyncQueue as o}from"../../../../shared/hooks/useAsyncQueue.js";import"../../index.js";import{useCommonLog as s}from"./useCommonLog.js";import{useFormRequest as a}from"./useFormRequest.js";function n(n,u){const{getHttpInstance:i}=a();return{create:function(a=3,m){return new o({name:"FormRenderAsyncQueue",uniqueData:u.value,parallelism:a,async processor({key:e,method:o="post",cache:a,params:u,url:p,payload:c},f,l){var d,y;const h=null!=(d=t(n))?d:i();if(!h)return s().invalidHttpInstanceLog(),f(),void l();try{m&&r(m.beforeRequest)&&(u=null!=(y=m.beforeRequest(e,u,c))?y:{});let t=await h[o](p,u);m&&r(m.afterRequest)&&(t=m.afterRequest(e,t,c)),f(void 0,Array.isArray(t)?t:[]),!a&&l()}catch(e){f(new Error(`Request error => ${e}`)),l()}},getKey:({url:r,method:t="post",cache:o,params:s})=>o?r+t+JSON.stringify(s||{}):e()})}}}export{n as useFormAsyncQueue};
@@ -1,26 +0,0 @@
1
- import { Func, Nullable } from '../../../../../es/shared/types';
2
- import { FormRequestType } from '../../../../../es/components/form-render';
3
- export declare type RequestInstance = Record<string, Func>;
4
- declare type SearchRequestInfo = {
5
- method: FormRequestType;
6
- url: string;
7
- primaryKeyUrl?: string;
8
- };
9
- export declare type RecommendIds = Partial<Record<'businessId' | 'componentId' | 'deptId' | 'userId', string>>;
10
- declare type RecommendRequestInfo = {
11
- getRecommendIds(): RecommendIds;
12
- url: Record<'get' | 'post' | 'delete', string>;
13
- };
14
- export declare function useFormRequest(): {
15
- getHttpInstance: () => Nullable<RequestInstance>;
16
- registGlobHttpInstance: (instance: RequestInstance) => void;
17
- registGlobRecommendInfo: (info: Partial<RecommendRequestInfo>) => void;
18
- registGlobSearchInfo: (info: SearchRequestInfo) => void;
19
- getSearchRequestInfo: () => {
20
- method: FormRequestType;
21
- url: string;
22
- primaryKeyUrl?: string | undefined;
23
- };
24
- getRecommendRequestInfo: () => RecommendRequestInfo;
25
- };
26
- export {};
@@ -1 +0,0 @@
1
- import{cloneDeep as e}from"lodash-es";let t=null;const n={method:"post",url:"",primaryKeyUrl:""},o={url:{get:"/fdp-api/fdp/aiRec/search",post:"/fdp-api/fdp/aiRec/sendBehaviorData",delete:"/fdp-api/fdp/aiRec/delete"},getRecommendIds:()=>({})};function r(){return{getHttpInstance:function(){return t},registGlobHttpInstance:function(e){t=e},registGlobRecommendInfo:function(e){Object.assign(o,e)},registGlobSearchInfo:function(e){Object.assign(n,e)},getSearchRequestInfo:function(){return{...n}},getRecommendRequestInfo:function(){return e(o)}}}export{r as useFormRequest};
@@ -1 +0,0 @@
1
- import{cloneDeep as s}from"lodash-es";class e{constructor(s,e,t){this.item=s,this.key=e,this.state=0,this.callback=t}}class t{constructor(s){this._list=s?Array.from(s):[]}enqueue(s){this._list.push(s)}dequeue(){return this._list.shift()}}class i{constructor({name:s,processor:e,getKey:i,parallelism:r,uniqueData:a}){this._queued=new t,this._entries=new Map,this._activeTasks=0,this._processingLock=!1,this._stopped=!1,this.uniqueData=!0,this.name=s,this.processor=e,this.getKey=i,this.parallelism=r||100,this.uniqueData=!!a}add(t,i){if(this._stopped)return i(new Error("Queue was stopped"));const r=this.getKey(t);if(this._entries.has(r)){const e=this._entries.get(r);return void(1===e.state?setTimeout((()=>{i&&i(this.uniqueData?s(e.error):e.error,this.uniqueData?s(e.result):e.result)})):e.callbacks?e.callbacks.push(i):e.callbacks=[i])}const a=new e(t,r,i);this._entries.set(r,a),this._queued.enqueue(a),this._processingLock||(this._processingLock=!0,Promise.resolve().then(this._ensureProcessing.bind(this)))}addAsync(s){return new Promise(((e,t)=>{this.add(s,((s,i)=>{s&&t(s),e(i)}))}))}_ensureProcessing(){for(;this._activeTasks<this.parallelism;){const s=this._queued.dequeue();if(!s)break;this._activeTasks++,s.state=0,this._startProcess(s)}this._processingLock=!1}_startProcess(s){this.processor(s.item,((e,t)=>{e?this._handlerResult(s,e):this._handlerResult(s,e,t)}),(()=>this._entries.delete(s.key)))}_handlerResult(e,t,i){const r=e.callback;e.state=1,e.callback=void 0,e.result=this.uniqueData?s(i):i,e.error=this.uniqueData?s(t):t,this._activeTasks--,r&&r(t,i),e.callbacks&&e.callbacks.forEach((s=>s(t,i))),this._processingLock||(this._processingLock=!0,Promise.resolve().then(this._ensureProcessing.bind(this)))}}export{i as AsyncQueue};