cnhis-design-vue 3.1.53-release.0 → 3.1.53-release.2

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 (158) hide show
  1. package/es/components/annotation-edit/src/AnnotationEdit.js +1 -1
  2. package/es/components/big-table/src/components/edit-form/edit-separate.vue.d.ts +4 -4
  3. package/es/components/big-table/src/hooks/useEdit.d.ts +4 -4
  4. package/es/components/big-table/src/hooks/useSeparateRow.d.ts +4 -4
  5. package/es/components/body-select/index.d.ts +9 -4
  6. package/es/components/body-select/src/config/index.js +1 -1
  7. package/es/components/body-select/src/hooks/renderCanvas.d.ts +1 -1
  8. package/es/components/body-select/src/hooks/renderCanvas.js +1 -1
  9. package/es/components/body-select/src/index.vue.d.ts +9 -4
  10. package/es/components/body-select/src/index.vue2.js +1 -1
  11. package/es/components/button-print/index.d.ts +9 -0
  12. package/es/components/button-print/src/ButtonPrint.vue.d.ts +9 -0
  13. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  14. package/es/components/button-print/src/utils/dialog.d.ts +2 -2
  15. package/es/components/button-print/src/utils/print.d.ts +14 -13
  16. package/es/components/button-print/src/utils/print.js +1 -1
  17. package/es/components/callback/src/components/render/popupMaps.d.ts +69 -6
  18. package/es/components/card-reader-sdk/src/types/index.d.ts +3 -3
  19. package/es/components/date-picker/src/DatePicker.vue2.js +1 -1
  20. package/es/components/fabric-chart/src/hooks/temperature/useLeft.js +1 -1
  21. package/es/components/form-config/index.d.ts +105 -26
  22. package/es/components/form-config/src/FormConfig.vue.d.ts +106 -27
  23. package/es/components/form-config/src/FormConfig.vue2.js +1 -1
  24. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +30 -6
  25. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +51 -12
  26. package/es/components/form-config/src/components/FormConfigEventSetting.vue2.js +1 -1
  27. package/es/components/form-render/index.d.ts +30 -6
  28. package/es/components/form-render/index.js +1 -1
  29. package/es/components/form-render/src/FormRender.vue.d.ts +31 -7
  30. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  31. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +31 -7
  32. package/es/components/form-render/src/components/renderer/{combination.d.ts → combination/combination.d.ts} +1 -1
  33. package/es/components/form-render/src/components/renderer/combination/combination.js +1 -0
  34. package/es/components/form-render/src/components/renderer/combination/hooks/index.d.ts +2 -0
  35. package/es/components/form-render/src/components/renderer/combination/hooks/index.js +1 -0
  36. package/es/components/form-render/src/components/renderer/combination/hooks/useCombination.d.ts +8 -0
  37. package/es/components/form-render/src/components/renderer/combination/hooks/useCombination.js +1 -0
  38. package/es/components/form-render/src/components/renderer/combination/index.d.ts +3 -0
  39. package/es/components/form-render/src/components/renderer/combination/index.js +1 -0
  40. package/es/components/form-render/src/components/renderer/combination/jsonCombination.js +1 -0
  41. package/es/components/form-render/src/components/renderer/combination/tableCombination.d.ts +61 -0
  42. package/es/components/form-render/src/components/renderer/combination/tableCombination.js +1 -0
  43. package/es/components/form-render/src/components/renderer/index.js +1 -1
  44. package/es/components/form-render/src/components/renderer/inputNumber.d.ts +5 -5
  45. package/es/components/form-render/src/components/renderer/{levelSearchCascader.d.ts → levelSearchCascader/index.d.ts} +3 -5
  46. package/es/components/form-render/src/components/renderer/levelSearchCascader/index.js +1 -0
  47. package/es/components/form-render/src/components/renderer/searchCascade.d.ts +3 -3
  48. package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
  49. package/es/components/form-render/src/components/renderer/select.d.ts +5 -5
  50. package/es/components/form-render/src/components/renderer/select.js +1 -1
  51. package/es/components/form-render/src/constants/index.d.ts +3 -2
  52. package/es/components/form-render/src/hooks/index.d.ts +0 -2
  53. package/es/components/form-render/src/hooks/index.js +1 -1
  54. package/es/components/form-render/src/hooks/useAnchor.d.ts +3 -3
  55. package/es/components/form-render/src/hooks/useCommonInjection.d.ts +2 -2
  56. package/es/components/form-render/src/hooks/useFieldListAdaptor.d.ts +2 -2
  57. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  58. package/es/components/form-render/src/hooks/useFieldNormalize.d.ts +10 -2
  59. package/es/components/form-render/src/hooks/useFormContext.d.ts +3 -3
  60. package/es/components/form-render/src/hooks/useFormContext.js +1 -1
  61. package/es/components/form-render/src/hooks/useFormItemDeps.d.ts +3 -3
  62. package/es/components/form-render/src/hooks/useFormRenderLifeCycle.d.ts +9 -1
  63. package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +5 -5
  64. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  65. package/es/components/form-render/src/types/fieldItem.d.ts +5 -26
  66. package/es/components/form-render/src/types/index.d.ts +7 -14
  67. package/es/components/form-render/src/utils/index.d.ts +1 -2
  68. package/es/components/form-render/src/utils/index.js +1 -1
  69. package/es/components/form-render/src/utils/schema.d.ts +2 -2
  70. package/es/components/form-render/src/utils/schema.js +1 -1
  71. package/es/components/guide/src/renderer.js +1 -1
  72. package/es/components/iho-table/index.d.ts +39 -0
  73. package/es/components/iho-table/src/IhoTable.vue.d.ts +40 -0
  74. package/es/components/iho-table/src/IhoTable.vue2.js +1 -1
  75. package/es/components/iho-table/src/constants/index.d.ts +4 -1
  76. package/es/components/iho-table/src/constants/index.js +1 -1
  77. package/es/components/iho-table/src/hooks/tapHooks/useEventHooks.d.ts +2 -2
  78. package/es/components/iho-table/src/hooks/tapHooks/useExposeHooks.d.ts +2 -2
  79. package/es/components/iho-table/src/hooks/useColumnConfigAdaptor.js +1 -1
  80. package/es/components/iho-table/src/plugins/defaultValuePlugin.js +1 -1
  81. package/es/components/iho-table/src/plugins/index.js +1 -1
  82. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.d.ts +2 -2
  83. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useAutoFocus.js +1 -1
  84. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/index.d.ts +1 -0
  85. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/index.js +1 -0
  86. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue.d.ts +552 -0
  87. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue.js +1 -0
  88. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/levelSearchCascadePlugin/levelSearchCascade.vue2.js +1 -0
  89. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +5 -2
  90. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  91. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
  92. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/editSeparate.vue.d.ts +2 -2
  93. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +1 -1
  94. package/es/components/iho-table/src/plugins/wordbookSettingPlugin.d.ts +1 -0
  95. package/es/components/iho-table/src/plugins/wordbookSettingPlugin.js +1 -0
  96. package/es/components/iho-table/src/types/index.d.ts +7 -2
  97. package/es/components/iho-table/src/types/pluginType.d.ts +3 -3
  98. package/es/components/iho-table/src/utils/index.d.ts +1 -1
  99. package/es/components/iho-table/src/utils/index.js +1 -1
  100. package/es/components/iho-table/style/index.css +1 -1
  101. package/es/components/index.css +1 -1
  102. package/es/components/index.d.ts +1 -0
  103. package/es/components/index.js +1 -1
  104. package/es/components/info-header/index.d.ts +97 -29
  105. package/es/components/info-header/src/InfoHeader.vue.d.ts +98 -30
  106. package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +9 -5
  107. package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +10 -6
  108. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +41 -13
  109. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +30 -6
  110. package/es/components/keyboard/src/Keyboard.vue2.js +1 -1
  111. package/es/components/search-cascader/index.d.ts +23 -3
  112. package/es/components/search-cascader/src/SearchCascader.vue.d.ts +24 -4
  113. package/es/components/search-cascader/src/SearchCascader.vue2.js +1 -1
  114. package/es/components/search-cascader/src/components/ClearIcon.vue.js +1 -0
  115. package/es/components/shortcut-setter/index.d.ts +34 -9
  116. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +35 -10
  117. package/es/components/steps-wheel/src/StepsWheel.vue2.js +1 -1
  118. package/es/components/time-picker/src/TimePicker.vue2.js +1 -1
  119. package/es/shared/components/InputNumberSlash/InputNumberSlash.d.ts +4 -4
  120. package/es/shared/components/SlotRender/SlotRender.d.ts +5 -5
  121. package/es/shared/hooks/index.d.ts +3 -0
  122. package/es/shared/hooks/index.js +1 -1
  123. package/es/shared/hooks/selectHooks/index.d.ts +4 -0
  124. package/es/shared/hooks/selectHooks/index.js +1 -0
  125. package/es/shared/hooks/selectHooks/useOptionFiltered.d.ts +10 -0
  126. package/es/shared/hooks/selectHooks/useOptionFiltered.js +1 -0
  127. package/es/shared/hooks/selectHooks/useSearchContent.d.ts +6 -0
  128. package/es/shared/hooks/selectHooks/useSearchContent.js +1 -0
  129. package/es/shared/hooks/selectHooks/useSelectAllowModify.d.ts +23 -0
  130. package/es/shared/hooks/selectHooks/useSelectAllowModify.js +1 -0
  131. package/es/shared/hooks/selectHooks/useSelectRenders.d.ts +21 -0
  132. package/es/shared/hooks/selectHooks/useSelectRenders.js +1 -0
  133. package/es/shared/hooks/{useAsyncQueue.d.ts → useAsyncQueue/index.d.ts} +7 -15
  134. package/es/shared/hooks/useAsyncQueue/index.js +1 -0
  135. package/es/shared/hooks/useAsyncQueue/types.d.ts +20 -0
  136. package/es/shared/hooks/useAsyncQueue/types.js +1 -0
  137. package/es/shared/hooks/useDateTime.d.ts +2 -2
  138. package/es/shared/hooks/useFormRequest/index.d.ts +24 -0
  139. package/es/shared/hooks/useFormRequest/index.js +1 -0
  140. package/es/shared/hooks/useFormRequest/types.d.ts +39 -0
  141. package/es/shared/hooks/useFormRequest/types.js +1 -0
  142. package/es/shared/hooks/useLevelSearchCascader.d.ts +31 -0
  143. package/es/shared/hooks/useLevelSearchCascader.js +1 -0
  144. package/es/shared/package.json.js +1 -1
  145. package/es/shared/types/business.d.ts +24 -0
  146. package/es/shared/types/index.d.ts +1 -1
  147. package/package.json +2 -2
  148. package/es/components/form-render/src/components/renderer/combination.js +0 -1
  149. package/es/components/form-render/src/components/renderer/jsonCombination/index.js +0 -1
  150. package/es/components/form-render/src/components/renderer/levelSearchCascader.js +0 -1
  151. package/es/components/form-render/src/hooks/useFormAsyncQueue.d.ts +0 -16
  152. package/es/components/form-render/src/hooks/useFormAsyncQueue.js +0 -1
  153. package/es/components/form-render/src/hooks/useFormRequest.d.ts +0 -26
  154. package/es/components/form-render/src/hooks/useFormRequest.js +0 -1
  155. package/es/shared/hooks/useAsyncQueue.js +0 -1
  156. /package/es/components/form-render/src/components/renderer/{jsonCombination → combination}/hooks/useDeepValidate.d.ts +0 -0
  157. /package/es/components/form-render/src/components/renderer/{jsonCombination → combination}/hooks/useDeepValidate.js +0 -0
  158. /package/es/components/form-render/src/components/renderer/{jsonCombination/index.d.ts → combination/jsonCombination.d.ts} +0 -0
@@ -0,0 +1,24 @@
1
+ import { FormRequestDefine } from './types';
2
+ import { ComputedRef } from 'vue';
3
+ import { AsyncQueue, AsyncQueueDefine } from '../../../../es/shared/hooks';
4
+ import { AnyObject, Nullable, UndefinedAble } from '../../../../es/shared/types';
5
+ export * from './types';
6
+ export declare function useFormRequest(): {
7
+ getHttpInstance: () => Nullable<FormRequestDefine.RequestInstance>;
8
+ registGlobHttpInstance: (instance: FormRequestDefine.RequestInstance) => void;
9
+ registGlobRecommendInfo: (info: Partial<FormRequestDefine.RecommendInfo>) => void;
10
+ registGlobSearchInfo: (info: FormRequestDefine.SearchInfo) => void;
11
+ getSearchRequestInfo: () => {
12
+ method: FormRequestDefine.RequestType;
13
+ url: string;
14
+ primaryKeyUrl?: string | undefined;
15
+ };
16
+ getRecommendRequestInfo: () => FormRequestDefine.RecommendInfo;
17
+ };
18
+ export declare function useFormAsyncQueue(requestInstance: ComputedRef<UndefinedAble<FormRequestDefine.RequestInstance>>, uniqueData: ComputedRef<boolean>): {
19
+ create: (parallelism?: number, option?: AsyncQueueDefine.ProcessorOption) => AsyncQueue<FormRequestDefine.AsyncQueueItem, any, {
20
+ label: string;
21
+ value: unknown;
22
+ }[]>;
23
+ };
24
+ export declare function presetRequestHandler(res: unknown): AnyObject[];
@@ -0,0 +1 @@
1
+ import{isObject as e}from"@vue/shared";import{uuidGenerator as t}from"../../utils/index.js";import{unref as r}from"vue";import{cloneDeep as n,isFunction as o}from"lodash-es";import"naive-ui";import"@vueuse/core";import"date-fns";import{AsyncQueue as s}from"../useAsyncQueue/index.js";import"@vueuse/shared";import"../selectHooks/useSearchContent.js";import"@vicons/ionicons5";let u=null;const c={method:"post",url:"",primaryKeyUrl:""},a={url:{get:"/fdp-api/fdp/aiRec/search",post:"/fdp-api/fdp/aiRec/sendBehaviorData",delete:"/fdp-api/fdp/aiRec/delete"},getRecommendIds:()=>({})};function i(){return{getHttpInstance:function(){return u},registGlobHttpInstance:function(e){u=e},registGlobRecommendInfo:function(e){Object.assign(a,e)},registGlobSearchInfo:function(e){Object.assign(c,e)},getSearchRequestInfo:function(){return{...c}},getRecommendRequestInfo:function(){return n(a)}}}function f(e,n){const{getHttpInstance:u}=i();return{create:function(c=3,a){return new s({name:"FormRenderAsyncQueue",uniqueData:n.value,parallelism:c,async processor({key:t,method:n="post",cache:s,params:c,url:i,payload:f},p,l){var m,d;const h=null!=(m=r(e))?m:u();if(!h)return console.log("before use http feature, you should regist http instance by useFormRequest.registGlobHttpInstance()"),p(),void l();try{a&&o(a.beforeRequest)&&(c=null!=(d=a.beforeRequest(t,c,f))?d:{});let e=await h[n](i,c);a&&o(a.afterRequest)&&(e=a.afterRequest(t,e,f)),p(void 0,Array.isArray(e)?e:[]),!s&&l()}catch(e){p(new Error(`Request error => ${e}`)),l()}},getKey:({url:e,method:r="post",cache:n,params:o})=>n?e+r+JSON.stringify(o||{}):t()})}}}function p(t){if(!e(t))throw t;return r=t,Reflect.has(r,"map")&&Reflect.has(r,"result")?function(e){const{result:t,map:r}=e;if("SUCCESS"!==t)throw e;return r.rows}(t):function(e){return Reflect.has(e,"result")&&Reflect.has(e,"obj")}(t)?function(t){const{obj:r,result:n}=t;if("SUCCESS"!==n||!e(r))throw t;return Object.entries(r).reduce(((e,[t,r])=>(r.forEach((r=>e.push({...r,type:t}))),e)),[])}(t):function(e){return Reflect.has(e,"data")&&Reflect.has(e,"success")}(t)?function(e){const{data:t,success:r}=e;if(!r)throw e;return t}(t):[];var r}export{p as presetRequestHandler,f as useFormAsyncQueue,i as useFormRequest};
@@ -0,0 +1,39 @@
1
+ import { AsyncQueue } from '../../../../es/shared/hooks';
2
+ import { AnyObject, AnyFn } from '../../../../es/shared/types';
3
+ export declare namespace FormRequestDefine {
4
+ type RequestType = 'post' | 'get' | 'patch' | 'delete' | 'put';
5
+ interface AsyncQueueItem {
6
+ key: any;
7
+ cache?: boolean;
8
+ url: string;
9
+ method?: RequestType;
10
+ params?: AnyObject;
11
+ payload?: AnyObject;
12
+ }
13
+ type FormAsyncQueue = AsyncQueue<AsyncQueueItem, any, AnyObject[]>;
14
+ type RequestInstance = Record<string, AnyFn>;
15
+ type SearchInfo = {
16
+ method: RequestType;
17
+ url: string;
18
+ primaryKeyUrl?: string;
19
+ };
20
+ type RecommendIds = Partial<Record<'businessId' | 'componentId' | 'deptId' | 'userId', string>>;
21
+ type RecommendInfo = {
22
+ getRecommendIds(): RecommendIds;
23
+ url: Record<'get' | 'post' | 'delete', string>;
24
+ };
25
+ type SearchResult = {
26
+ result: 'SUCCESS' | 'ERROR';
27
+ map: {
28
+ rows: AnyObject[];
29
+ };
30
+ };
31
+ type SelectResult = {
32
+ success: boolean;
33
+ data: AnyObject[];
34
+ };
35
+ type RecommendResult = {
36
+ result: 'SUCCESS' | 'ERROR';
37
+ obj: Partial<Record<'commonly' | 'recently', AnyObject[]>>;
38
+ };
39
+ }
@@ -0,0 +1,31 @@
1
+ import { FormRequestDefine } from '../../../es/shared/hooks';
2
+ import { AnyObject, FormWordbook, AnyFn } from '../../../es/shared/types';
3
+ import { MaybeRef } from '@vueuse/core';
4
+ import { Ref } from 'vue';
5
+ export declare function useLevelSearchCascader(props: Partial<{
6
+ options: AnyObject[];
7
+ lazyRequest: boolean;
8
+ requestCache: boolean;
9
+ value: string | AnyObject[];
10
+ }> & {
11
+ autograph: string;
12
+ wordbook: FormWordbook;
13
+ labelField: string;
14
+ valueField: string;
15
+ }, emit: AnyFn, { asyncQueue, fieldKey, getRequestPayload }: {
16
+ asyncQueue: FormRequestDefine.FormAsyncQueue;
17
+ fieldKey: MaybeRef<string>;
18
+ getRequestPayload?: () => any;
19
+ }): {
20
+ valueRef: import("vue").WritableComputedRef<string | AnyObject[] | undefined>;
21
+ labelKey: import("vue").ComputedRef<string>;
22
+ valueKey: import("vue").ComputedRef<string>;
23
+ optionsRef: Ref<AnyObject[]>;
24
+ showRef: Ref<boolean>;
25
+ fetchData: (node?: AnyObject, keyword?: string, updateValueWhenNoChild?: boolean) => Promise<void | AnyObject>;
26
+ menuWidth: Ref<number>;
27
+ searchCascaderRef: Ref<{
28
+ getWidth: () => number;
29
+ setCursor: (option?: AnyObject) => void;
30
+ } | undefined>;
31
+ };
@@ -0,0 +1 @@
1
+ import"../utils/index.js";import{isEqual as e,noop as r,isString as t,isNumber as n,isEmpty as o,isFunction as a,cloneDeep as i,omit as l,isArray as u}from"lodash-es";import"naive-ui";import{computed as s,ref as c,watch as d,unref as v}from"vue";import"@vueuse/core";import"date-fns";import{useFormRequest as p}from"./useFormRequest/index.js";import"@vueuse/shared";import"./selectHooks/useSearchContent.js";import"@vicons/ionicons5";function h(h,y,{asyncQueue:f,fieldKey:m,getRequestPayload:k=r}){const g=s({get:()=>h.value,set(r){e(r,h.value)||y("update:value",r)}}),w=c(!1),b=c([]),O=s((()=>{var e,r,t;return null!=(t=null==(r=null==(e=h.wordbook)?void 0:e.show_key)?void 0:r[0])?t:h.labelField})),_=s((()=>{var e,r;return null!=(r=null==(e=h.wordbook)?void 0:e.value_key)?r:h.valueField})),L=s((()=>{var e,r;return null==(r=null==(e=h.wordbook)?void 0:e.render_key)?void 0:r[0]})),j=s((()=>{var e;return(null==(e=h.wordbook)?void 0:e.level_num)||1/0})),C=function(e,r,t){return{transformListToChildren(e){if(!e.length)return[];const r=[(e=i(e))[0]];let t=e[0];for(let r=1;r<e.length;r++){const n=e[r];n&&(t.children=[n],n.parent=t,t=n)}return[e,r]},getNodeDepth(e){let r=1,t=e.parent;for(;t;)r++,t=t.parent;return r},enrichChildOption(e,r,t){return{...e,parent:r,isLeaf:this.getNodeDepth(r)+1>=t}},enrichKeywordOption:(e,n)=>(e.__keyword=!!n,e.isLeaf=!!n,n&&t.value&&e[t.value]&&(e[r.value]=e[t.value]),e),sortOptionWithIdList:(r,t)=>t.map((t=>r.find((r=>r[e.value]===t)))),generateOptionWithIdList(r,t,n){let o=r[0];return{options:t.reduce(((e,t,i)=>{const l=a(r,t);return 0===i?(o=l,[l]):(Object.assign(l,{parent:o,isLeaf:i+1>=n}),o.children=[l],o=l,e)}),[]),lastOption:o};function a(r,t){return r.find((r=>r[e.value]===t))}},parseLinkFromString2List:e=>e.split("_").filter((e=>e)),isClickNodeCheckbox:e=>e&&!e.__keyword&&e.isLeaf,createConfigObject:(r,t,n)=>t?r.conObj||[]:n?[{con:"EQ",is_compare_field:!1,field_key:r.level_key,value:n[e.value]}]:r.conObjFirstLevel||[],createOptionValue(e){const r=[];let t=e;for(;t;)r.unshift(l(t,["parent","isLeaf","__keyword","children"])),t=t.parent;return r},shouldInitOptionList:(r,t,n)=>u(r)&&!o(r)&&r.every((r=>r[e.value]))&&!t&&!n}}(_,O,L),{getSearchRequestInfo:K}=p(),I=c(150),R=c();async function x(e,r,i=!0){var l,u;if(I.value=r&&(null==(l=R.value)?void 0:l.getWidth())||150,C.shouldInitOptionList(g.value,e,r)){const[e,r]=C.transformListToChildren(g.value),t=e[Math.max(0,e.length-2)];if(g.value.length>1){b.value=r;const t=e[Math.max(0,e.length-2)];return await x(t,void 0,!1),t}if(null==(u=b.value)?void 0:u.length)return t}try{return C.isClickNodeCheckbox(e)?s(e):e?e.__keyword?async function(){var r;if(!t(e.id_link))return Promise.reject();const a=C.parseLinkFromString2List(e.id_link);n(j.value)&&j.value!==1/0&&a.splice(j.value);const i=await async function(e){if(!K().primaryKeyUrl)return[];try{return await f.addAsync(r(h.wordbook,h.autograph,e,v(m)))}catch(e){t(e)&&console.error(e)}function r(e,r,t,n){const o=K();return{key:n,params:{autograph:r,tableId:e.id,primaryKeyValue:t.join(","),page:1},...o,url:o.primaryKeyUrl,cache:h.requestCache,payload:{field:{},labelKey:O.value,valueKey:_.value}}}}(a);if(!i)return Promise.reject();const{lastOption:l,options:u}=C.generateOptionWithIdList(i,a,j.value);if(u.length<j.value&&(await x(l),o(l.children)))return g.value=C.sortOptionWithIdList(i,a),w.value=!1,Promise.reject();return b.value=u,null==(r=R.value)||r.setCursor(l),l}():async function(){const r=await f.addAsync(c(h.wordbook,h.autograph,e,v(m)));if(!r.length)return i?s(e):Promise.reject();e.children=r.map((r=>C.enrichChildOption(r,e,j.value)))}():async function(){var t;const n=await f.addAsync(c(h.wordbook,h.autograph,e,v(m)));b.value=n.map((e=>C.enrichKeywordOption(e,r))),r&&(null==(t=R.value)||t.setCursor(b.value[0]))}()}catch(e){t(e)&&console.error(e)}function s(e){return g.value=C.createOptionValue(e),w.value=!1,Promise.reject()}function c(e,n,o,i){const l={autograph:()=>n,wordbookId:"id",wordbookType:"type",fieldKeys:()=>e.search_key?JSON.stringify(e.search_key):void 0,conObj:()=>JSON.stringify(C.createConfigObject(e,r,o)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>r,page:()=>1},u=Object.entries(l).reduce(((r,[n,o])=>(r[n]=t(o)?e[o]:a(o)?o():void 0,r)),{});return{...K(),params:u,key:i,cache:h.requestCache,payload:{...k(),labelKey:O.value,valueKey:_.value}}}}return d((()=>h.wordbook),((r,t)=>{e(r,t)||(b.value=[],r&&(g.value||!h.lazyRequest)&&x())}),{immediate:!0}),{valueRef:g,labelKey:O,valueKey:_,optionsRef:b,showRef:w,fetchData:x,menuWidth:I,searchCascaderRef:R}}export{h as useLevelSearchCascader};
@@ -1 +1 @@
1
- var e="@cnhis-design-vue/shared",s="3.1.53-release.0",i="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.53-release.0",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,i as main,e as name,n as peerDependencies,s as version};
1
+ var e="@cnhis-design-vue/shared",s="3.1.53-release.2",i="index.ts",n={"naive-ui":"^2.30.0",vue:"^3.2.0"},a={"@vicons/ionicons5":"^0.12.0","lodash-es":"^4.17.21",moment:"^2.29.1","video.js":"^7.19.2","videojs-contrib-hls":"^5.15.0",viewerjs:"^1.10.5","xe-utils":"^3.5.4"},d={name:e,version:"3.1.53-release.2",private:!0,main:"index.ts",peerDependencies:n,dependencies:a};export{d as default,a as dependencies,i as main,e as name,n as peerDependencies,s as version};
@@ -1,3 +1,4 @@
1
+ import { AnyObject } from '../../../es/shared/types/index';
1
2
  export declare type LOW_CODE_VALUE_RELATION = 'EQ' | 'NEQ' | 'CL' | 'NC' | 'NULL' | 'NOT_NULL' | 'BIG' | 'BIGEQ' | 'LESS' | 'LESSEQ';
2
3
  export declare type LOW_CODE_EVENT_TYPE = 'SET_VALUE' | 'REPEAT_VALIDATE' | 'IS_SHOW_FIELD' | 'SQLSAVE' | 'API';
3
4
  export declare type BindEventSettingItem = {
@@ -49,3 +50,26 @@ export declare namespace FormLowCodeReactions {
49
50
  __oppositeTargetField: Config;
50
51
  }>;
51
52
  }
53
+ export declare type FormWordbook = Partial<{
54
+ level_num: number;
55
+ id: string;
56
+ name: string;
57
+ render_key: string[];
58
+ search_key: string[];
59
+ value_key: string;
60
+ queryParams: string[];
61
+ primary_key: string;
62
+ type: string;
63
+ level_key: string;
64
+ link_key: string;
65
+ link_key_split: string;
66
+ show_key: string[] | string;
67
+ conObj: AnyObject[];
68
+ conObjFirstLevel: AnyObject[];
69
+ setting: Partial<{
70
+ cascading: {
71
+ 'form.name': string;
72
+ value: string;
73
+ }[];
74
+ }>;
75
+ }>;
@@ -4,7 +4,7 @@ export declare type SFCWithInstall<T> = T & {
4
4
  install: (app: App, ...options: any[]) => any;
5
5
  };
6
6
  export declare type AnyObject = Record<string, any>;
7
- export declare type Func<T extends Array<any> = any[], P = any> = (...args: T) => P;
7
+ export declare type AnyFn<T extends Array<any> = any[], P = any> = (...args: T) => P;
8
8
  export declare type Nullable<T> = T | null | undefined;
9
9
  export declare type UndefinedAble<T> = T | undefined;
10
10
  export declare type ArrayAble<T> = T | T[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "3.1.53-release.0",
3
+ "version": "3.1.53-release.2",
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": "a8f7d7cdca3113620c2a7b0dbaf062673dfc51cc"
66
+ "gitHead": "d0a36c62f586fb25963759c95be92123b6aa7821"
67
67
  }
@@ -1 +0,0 @@
1
- import{defineComponent as e,ref as o,computed as t,watch as r,inject as a,onBeforeUnmount as i,createVNode as m}from"vue";import{isObjectField as n}from"@formily/core";import{autorun as l}from"@formily/reactive";import{connect as s,RecursionField as u}from"@formily/vue";import{AddCircleOutline as p,RemoveCircle as c}from"@vicons/ionicons5";import{isNumber as d,isArray as f,isFunction as v,range as b}from"lodash-es";import{NButton as y,NIcon as h}from"naive-ui";import"../../../index.js";import{InjectionBusinessCollector as x}from"../../constants/index.js";import"../../../../../shared/utils/index.js";import"@formily/path";import"@vue/shared";import"@vueuse/core";import"date-fns";import{createObjSchema as _}from"../../utils/schema.js";import{useFormField as j}from"../../hooks/useFormField.js";import{useFieldListAdaptor as C}from"../../hooks/useFieldListAdaptor.js";const k=s(e({name:"FormCombination",props:{title:{type:String,default:""},value:{type:Array},maxGroupNum:{type:Number},disabled:{type:Boolean},properties:{type:Array,default:()=>[]},combinationItemDeletable:{type:[Boolean,Function],default:!0},onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e){const{field:s,fieldKey:k}=j(),F=o(1),I=t((()=>d(e.maxGroupNum)?e.maxGroupNum<1?0:~~e.maxGroupNum:1/0));function N(){F.value++}r((()=>e.value),(e=>{f(e)&&(F.value=Math.min(Math.max(e.length,1),I.value))}),{immediate:!0});const A=a(x),{schemaAdaptor:D}=C(A),G=o([]);return i(l((()=>{f(s.value.value)&&(G.value=s.value.value.map(((o,t)=>v(e.combinationItemDeletable)?e.combinationItemDeletable(o||{},t):e.combinationItemDeletable)))}))),()=>m("section",{class:"form-render__combination"},[m("header",{class:"form-render__combinationHeader"},[m("div",{class:"form-render__combinationHeaderText"},[e.title]),m(y,{onClick:N,text:!0,style:{"--n-text-color":"var(--c-primary-color)"},disabled:F.value>=I.value||e.disabled},{icon:()=>m(h,{component:p},null),default:()=>"新增"})]),b(F.value).map(((o,t)=>m("section",{class:"form-render__combinationContent"},[m(u,{schema:_(D(e.properties)),name:t},null),m(y,{text:!0,disabled:!G.value[t],type:"error",class:"form-render__combinationClose",onClick:()=>async function(e){if(F.value>1)F.value--,await s.value.remove(e);else{const o=s.value.query(`${k.value}.${e}`).take();if(!o||!n(o))return;await o.reset()}}(t)},{icon:()=>m(h,{component:c},null)})])))])}}));export{k as COMBINATION};
@@ -1 +0,0 @@
1
- import{defineComponent as e,ref as o,computed as r,watch as t,onMounted as n,createVNode as i}from"vue";import{isField as l}from"@formily/core";import{Path as a}from"@formily/path";import{AddCircleOutline as u,RemoveCircle as s}from"@vicons/ionicons5";import{isNumber as m,range as p,isArray as c,isEqual as f}from"lodash-es";import{useDeepValidate as v}from"./hooks/useDeepValidate.js";import{formRenderLog as d,mergeDeepProperties as y}from"../../../utils/index.js";import{connect as h,mapProps as g}from"@formily/vue";import{useDebounceFn as b,isObject as x}from"@vueuse/core";import{NButton as N,NIcon as _}from"naive-ui";import C from"../../../FormRender.vue.js";import{assignUpdateValue as j}from"../../../utils/schema.js";const I=h(e({name:"FormJsonCombination",props:{title:{type:String,default:""},value:{type:[String,Array]},maxGroupNum:{type:Number},properties:{type:Array,default:()=>[]},onInput:{},onBlur:{},onChange:{}},emits:["update:value"],setup(e,{emit:h}){d("当前COMBINATION控件为json模式,推荐使用非json模式,FieldItem.jsonCombination=false");const g=b((function(){h("update:value",JSON.stringify(j.value))}),300),j=o([]),I=r((()=>j.value.length));function S(o,r=!1){c(o)&&(o.length||o.push({}),o=JSON.stringify(o));const t=function(e){try{if(!e)return null;const o=JSON.parse(e);return Array.isArray(o)?o:null}catch(e){return null}}(o);var n;(n=t)&&!f(n,j.value)&&(t.splice(O.value),t.forEach((function(o,t){if(!x(o))return;j.value[t]=o,r&&y(o,e.properties)})),j.value.splice(t.length),j.value.forEach(F))}t((()=>e.value),(e=>S(e))),n((()=>{S(e.value||"[{}]",!0),g()}));const A=o([]);function F(e,o){var r;null==(r=A.value[o])||r.setFieldState("*",(o=>{l(o)&&(o.value=a.getIn(e,o.path))}))}function J(){j.value.push(y({},e.properties)),g()}v().bindDeepValidate(A);const O=r((()=>m(e.maxGroupNum)?e.maxGroupNum<1?0:~~e.maxGroupNum:1/0));t(O,(e=>{I.value<=e||(j.value.splice(e),g(),A.value.splice(e))}),{immediate:!0});const G=C;return()=>i("section",{class:"form-render__combination"},[i("header",{class:"form-render__combinationHeader"},[i("div",{class:"form-render__combinationHeaderText"},[e.title]),i(N,{onClick:J,style:{"--n-text-color":"var(--c-primary-color)"},text:!0,disabled:I.value>=O.value},{icon:()=>i(_,{component:u},null),default:()=>"新增"})]),p(I.value).map(((o,r)=>i("section",{class:"form-render__combinationContentJson"},[i(G,{ref:e=>function(e,o){A.value[e]=o,F(j.value[e]||{},e)}(r,e),fieldList:e.properties,onFormChange:e=>function(e,{fieldKey:o,value:r}){!j.value[e]&&(j.value[e]={}),a.setIn(j.value[e],o,r),g()}(r,e)},null),i(N,{text:!0,class:"form-render__combinationClose",type:"error",onClick:()=>function(e){j.value.length>1?(j.value.splice(e,1),A.value.splice(e,1)):j.value.splice(e,1,{}),g()}(r)},{icon:()=>i(_,{component:s},null)})])))])}}),g(j));export{I as JSON_COMBINATION};
@@ -1 +0,0 @@
1
- import{defineComponent as e,computed as r,ref as a,inject as t,watch as l,createVNode as o}from"vue";import{isEqual as u,isArray as n,isEmpty as i,isString as s,isNumber as v,isFunction as d,omit as c,cloneDeep as p}from"lodash-es";import"../../../index.js";import{InjectionAsyncQueue as f}from"../../constants/index.js";import{useCommonInjection as y}from"../../hooks/useCommonInjection.js";import{formRenderLog as m}from"../../utils/index.js";import{connect as h,mapProps as k}from"@formily/vue";import g from"../../../../search-cascader/index.js";import j from"../../../../../shared/components/no-data/NoData.vue.js";import{assignUpdateValue as w}from"../../utils/schema.js";import{useFormField as _}from"../../hooks/useFormField.js";import{useFormRequest as b}from"../../hooks/useFormRequest.js";const K=h(e({name:"FormSearchCascade",props:{options:{type:Array,default:()=>[]},labelField:{type:String,default:"text"},valueField:{type:String,default:"value"},autograph:{type:String,required:!0},lazyRequest:{type:Boolean,default:!0},requestCache:{type:Boolean,default:!0},wordbook:{type:Object,required:!0},onChange:{},value:{type:[String,Array]}},emits:["update:value"],setup(e,{emit:h}){const k=r({get:()=>e.value,set(r){u(r,e.value)||h("update:value",r)}}),w=a(!1),K=a([]),{field:F,fieldKey:O}=_(),q=r((()=>{var r,a,t;return null!=(t=null==(a=null==(r=e.wordbook)?void 0:r.show_key)?void 0:a[0])?t:e.labelField})),S=r((()=>{var r,a;return null!=(a=null==(r=e.wordbook)?void 0:r.value_key)?a:e.valueField})),x=r((()=>{var r,a;return null==(a=null==(r=e.wordbook)?void 0:r.render_key)?void 0:a[0]})),C=r((()=>{var r;return(null==(r=e.wordbook)?void 0:r.level_num)||1/0})),L=t(f),{getSearchRequestInfo:P}=b(),A=a(150),I=a();async function R(r,a,t=!0){var l,o,u,f;if(A.value=a&&(null==(l=I.value)?void 0:l.getWidth())||150,n(e.value)&&!i(e.value)&&e.value.every((e=>e[S.value]))&&!r&&!a){const r=1===e.value.length,a=null==(o=K.value)?void 0:o.length,[t,l]=function(e){if(!e.length)return[];const r=[(e=p(e))[0]];let a=e[0];for(let r=1;r<e.length;r++){const t=e[r];t&&(a.children=[t],t.parent=a,a=t)}return[e,r]}(e.value),u=t[Math.max(0,t.length-2)];if(!r){K.value=l;const e=t[Math.max(0,t.length-2)];return await R(e,void 0),e}if(a)return u}try{if(r&&!r.__keyword&&r.isLeaf)return y(r);if(!(null==r?void 0:r.__keyword)){const l=await L.addAsync(function(r,t,l,o,u){const n={autograph:()=>t,wordbookId:"id",wordbookType:"type",fieldKeys:()=>r.search_key?JSON.stringify(r.search_key):void 0,conObj:()=>JSON.stringify(function(e,r,a){return r?e.conObj||[]:a?[{con:"EQ",is_compare_field:!1,field_key:e.level_key,value:a[S.value]}]:e.conObjFirstLevel||[]}(r,a,o)),primaryKey:"primary_key",levelKey:"level_key",keyword:()=>a,page:()=>1},i=Object.entries(n).reduce(((e,[a,t])=>(e[a]=s(t)?r[t]:d(t)?t():void 0,e)),{});return{...P(),params:i,key:u,cache:e.requestCache,payload:{field:l,labelKey:q.value,valueKey:S.value}}}(e.wordbook,e.autograph,F.value,r,O.value));if(r){if(!l.length)return t?y(r):Promise.reject();r.children=l.map((e=>function(e,r,a){return{...e,parent:r,isLeaf:h(r)+1>=a}}(e,r,C.value)))}else K.value=l.map((e=>function(e,r){e.__keyword=!!r,e.isLeaf=!!r,r&&(e[q.value]=e[x.value||q.value]||e[q.value]);return e}(e,a))),a&&(null==(u=I.value)||u.setCursor(K.value[0]));return}if(!s(r.id_link))return Promise.reject();const l=r.id_link.split("_").filter((e=>e));v(C.value)&&C.value!==1/0&&l.splice(C.value);const o=await async function(r){if(!P().primaryKeyUrl)return[];try{return await L.addAsync(a(e.wordbook,e.autograph,r,O.value))}catch(e){s(e)&&m(e)}function a(r,a,t,l){const o=P();return{key:l,params:{autograph:a,tableId:r.id,primaryKeyValue:t.join(","),page:1},...o,url:o.primaryKeyUrl,cache:e.requestCache,payload:{field:F.value,labelKey:q.value,valueKey:S.value}}}}(l);if(!o)return Promise.reject();const{lastOption:n,options:c}=function(e,r){let a=e[0];return{options:r.reduce(((r,l,o)=>{const u=t(e,l);return 0===o?(a=u,[u]):(Object.assign(u,{parent:a,isLeaf:o+1>=C.value}),a.children=[u],a=u,r)}),[]),lastOption:a};function t(e,r){return e.find((e=>e[S.value]===r))}}(o,l);return c.length<C.value&&(await R(n),i(n.children))?(k.value=function(e,r){return r.map((r=>e.find((e=>e[S.value]===r))))}(o,l),w.value=!1,Promise.reject()):(K.value=c,null==(f=I.value)||f.setCursor(n),n)}catch(e){s(e)&&m(e)}function y(e){return k.value=function(e){const r=[];let a=e;for(;a;)r.unshift(c(a,["parent","isLeaf","__keyword","children"])),a=a.parent;return r}(e),w.value=!1,Promise.reject()}function h(e){let r=1,a=e.parent;for(;a;)r++,a=a.parent;return r}}function U(){A.value=150}l((()=>e.wordbook),((r,a)=>{u(r,a)||(K.value=[],r&&(k.value||!e.lazyRequest)&&R())}),{immediate:!0});const{injectValueValidate:V,injectValueBindKey:B}=y();V(k);const N=B(k);return()=>o(g,{ref:I,value:k.value,"onUpdate:value":e=>k.value=e,show:w.value,"onUpdate:show":e=>w.value=e,options:K.value,key:N.value,labelKey:q.value,valueKey:S.value,search:R,onFocus:U,menuWidth:A.value},{empty:()=>o(j,null,null)})}}),k({dataSource:"options"},w));export{K as LEVEL_SEARCH_CASCADER};
@@ -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};