cnhis-design-vue 3.1.57-release.0 → 3.1.57-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 (122) hide show
  1. package/es/components/button-print/index.d.ts +8 -8
  2. package/es/components/button-print/src/ButtonPrint.vue.d.ts +8 -8
  3. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  4. package/es/components/button-print/src/components/EditFormat.vue.d.ts +3 -3
  5. package/es/components/button-print/src/components/IdentityVerification.vue.d.ts +7 -7
  6. package/es/components/button-print/style/index.css +1 -1
  7. package/es/components/callback/src/components/render/popupMaps.d.ts +17 -8
  8. package/es/components/expand-field/index.d.ts +98 -26
  9. package/es/components/expand-field/src/components/FormItemPerson.vue.d.ts +95 -23
  10. package/es/components/expand-field/src/components/PersonModal.vue.d.ts +95 -23
  11. package/es/components/expand-field/src/components/form.vue.d.ts +98 -26
  12. package/es/components/expand-field/src/index.vue.d.ts +98 -26
  13. package/es/components/fabric-chart/index.d.ts +2 -2
  14. package/es/components/fabric-chart/src/FabricChart.vue.d.ts +2 -2
  15. package/es/components/fabric-chart/src/components/PopupMenu.js +1 -1
  16. package/es/components/fabric-chart/src/hooks/temperature/useCenter.js +1 -1
  17. package/es/components/fabric-chart/src/interface.d.ts +2 -3
  18. package/es/components/field-set/index.d.ts +107 -616
  19. package/es/components/field-set/index.js +1 -1
  20. package/es/components/field-set/src/FieldColor.vue.d.ts +1680 -0
  21. package/es/components/field-set/src/FieldColor.vue.js +1 -0
  22. package/es/components/field-set/src/FieldColor.vue2.js +1 -0
  23. package/es/components/field-set/src/FieldSet.vue.d.ts +58 -16
  24. package/es/components/field-set/src/FieldSet.vue2.js +1 -1
  25. package/es/components/field-set/src/Index.vue.d.ts +141 -0
  26. package/es/components/field-set/src/Index.vue.js +1 -0
  27. package/es/components/field-set/src/Index.vue2.js +1 -0
  28. package/es/components/field-set/src/components/Row.vue.d.ts +50 -9
  29. package/es/components/field-set/src/components/Row.vue2.js +1 -1
  30. package/es/components/field-set/src/components/condition.vue.d.ts +172 -0
  31. package/es/components/field-set/src/components/condition.vue.js +1 -0
  32. package/es/components/field-set/src/components/condition.vue2.js +1 -0
  33. package/es/components/field-set/src/components/edit-dialog.vue.d.ts +1194 -0
  34. package/es/components/field-set/src/components/edit-dialog.vue.js +1 -0
  35. package/es/components/field-set/src/components/edit-dialog.vue2.js +1 -0
  36. package/es/components/field-set/src/components/edit-filter.vue.d.ts +286 -0
  37. package/es/components/field-set/src/components/edit-filter.vue.js +1 -0
  38. package/es/components/field-set/src/components/edit-filter.vue2.js +1 -0
  39. package/es/components/field-set/src/constants/index.d.ts +55 -0
  40. package/es/components/field-set/src/constants/index.js +1 -0
  41. package/es/components/field-set/src/types/index.d.ts +31 -1
  42. package/es/components/field-set/src/utils/index.d.ts +2 -1
  43. package/es/components/field-set/src/utils/index.js +1 -1
  44. package/es/components/field-set/style/index.css +1 -1
  45. package/es/components/form-config/index.d.ts +72 -42
  46. package/es/components/form-config/src/FormConfig.vue.d.ts +72 -42
  47. package/es/components/form-config/src/FormConfig.vue2.js +1 -1
  48. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +17 -8
  49. package/es/components/form-config/src/components/FormConfigDragDisplay.vue.d.ts +5 -2
  50. package/es/components/form-config/src/components/FormConfigDragDisplay.vue2.js +1 -1
  51. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +20 -11
  52. package/es/components/form-config/src/components/FormConfigEventSetting.vue.d.ts +8 -8
  53. package/es/components/form-config/src/components/renderer/ComplexNode.vue.d.ts +5 -2
  54. package/es/components/form-config/src/components/renderer/ComplexNode.vue2.js +1 -1
  55. package/es/components/form-config/src/components/renderer/DefaultNode.vue2.js +1 -1
  56. package/es/components/form-config/src/constants/index.d.ts +3 -2
  57. package/es/components/form-config/src/constants/index.js +1 -1
  58. package/es/components/form-config/src/hooks/useSortalbeConfig.d.ts +16 -12
  59. package/es/components/form-config/src/hooks/useSortalbeConfig.js +1 -1
  60. package/es/components/form-config/src/types/index.d.ts +14 -2
  61. package/es/components/form-render/index.d.ts +17 -8
  62. package/es/components/form-render/index.js +1 -1
  63. package/es/components/form-render/src/FormRender.vue.d.ts +17 -8
  64. package/es/components/form-render/src/FormRender.vue2.js +1 -1
  65. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +17 -8
  66. package/es/components/form-render/src/components/renderer/switch.js +1 -1
  67. package/es/components/form-render/src/hooks/index.d.ts +1 -0
  68. package/es/components/form-render/src/hooks/index.js +1 -1
  69. package/es/components/form-render/src/hooks/useFieldNormalize.d.ts +2 -2
  70. package/es/components/form-render/src/hooks/useLowCodeReactions.d.ts +1 -1
  71. package/es/components/form-render/src/hooks/useNewLowCodeReactions.d.ts +6 -0
  72. package/es/components/form-render/src/hooks/useNewLowCodeReactions.js +1 -0
  73. package/es/components/form-render/src/types/index.d.ts +1 -1
  74. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/hooks/useAutoFocus.js +1 -1
  75. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +1 -1
  76. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue2.js +1 -1
  77. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/checkRendererPlugin.js +1 -1
  78. package/es/components/index.css +1 -1
  79. package/es/components/index.js +1 -1
  80. package/es/components/info-header/index.d.ts +41 -23
  81. package/es/components/info-header/src/InfoHeader.vue.d.ts +41 -23
  82. package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +1 -1
  83. package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +1 -1
  84. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +18 -9
  85. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +17 -8
  86. package/es/components/keyboard/index.d.ts +1 -1
  87. package/es/components/keyboard/src/Keyboard.vue.d.ts +1 -1
  88. package/es/components/quick-search/index.d.ts +3 -3
  89. package/es/components/quick-search/src/index.vue.d.ts +3 -3
  90. package/es/components/recommend-search/index.d.ts +6 -6
  91. package/es/components/recommend-search/src/RecommendSearch.vue.d.ts +6 -6
  92. package/es/components/recommend-search/src/components/BaseSearch.d.ts +1 -1
  93. package/es/components/recommend-search/src/components/RecommendInput.vue.d.ts +1 -1
  94. package/es/components/recommend-search/src/components/RecommendSelect.vue.d.ts +1 -1
  95. package/es/components/scale-view/index.d.ts +3 -3
  96. package/es/components/scale-view/src/ScaleView.vue.d.ts +3 -3
  97. package/es/components/scale-view/src/components/formitem/standard-modal.d.ts +1 -1
  98. package/es/components/scale-view/src/hooks/use-component.d.ts +1 -1
  99. package/es/components/select-label/index.d.ts +2 -2
  100. package/es/components/select-label/src/LabelFormContent.vue.d.ts +1 -1
  101. package/es/components/select-label/src/SelectLabel.vue.d.ts +1 -1
  102. package/es/components/select-label/src/index.vue.d.ts +1 -1
  103. package/es/components/select-person/index.d.ts +95 -23
  104. package/es/components/select-person/src/SelectPerson.vue.d.ts +84 -17
  105. package/es/components/select-person/src/SelectPerson.vue2.js +1 -1
  106. package/es/components/select-person/src/types/enums.d.ts +9 -0
  107. package/es/components/select-person/src/types/enums.js +1 -1
  108. package/es/components/select-person/style/index.css +1 -1
  109. package/es/components/shortcut-provider/src/hooks/useShortcuts.js +1 -1
  110. package/es/components/shortcut-setter/index.d.ts +17 -8
  111. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +17 -8
  112. package/es/components/table-export-field/index.d.ts +3 -3
  113. package/es/components/table-export-field/src/components/SaveProjectModal.vue.d.ts +3 -3
  114. package/es/components/table-export-field/src/index.vue.d.ts +3 -3
  115. package/es/components/time-line/index.d.ts +7 -7
  116. package/es/components/time-line/src/TimeLine.vue.d.ts +3 -3
  117. package/es/shared/package.json.js +1 -1
  118. package/es/shared/types/business.d.ts +23 -3
  119. package/es/shared/utils/business.d.ts +2 -1
  120. package/es/shared/utils/business.js +1 -1
  121. package/es/shared/utils/index.js +1 -1
  122. package/package.json +68 -68
@@ -4,7 +4,6 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
4
4
  type: import("vue").PropType<((string | number) | {
5
5
  [key: string]: any;
6
6
  key: string | number;
7
- name: string;
8
7
  })[]>;
9
8
  default: () => never[];
10
9
  };
@@ -24,6 +23,7 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
24
23
  };
25
24
  wordbook: {
26
25
  type: import("vue").PropType<{
26
+ [key: string]: any;
27
27
  parent_id_obj: string | number;
28
28
  parent_name_obj: string | number;
29
29
  user_count_obj?: string | number | undefined;
@@ -73,6 +73,24 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
73
73
  type: import("vue").PropType<(keyWork: string) => Promise<import("../../shared/types").AnyObject[]>>;
74
74
  default: () => Promise<never[]>;
75
75
  };
76
+ showSelectType: {
77
+ type: BooleanConstructor;
78
+ default: boolean;
79
+ };
80
+ roleData: {
81
+ type: import("vue").PropType<(import("naive-ui/es/tree/src/interface").TreeOptionBase & {
82
+ [k: string]: unknown;
83
+ } & import("../../shared/types").AnyObject)[]>;
84
+ default: () => never[];
85
+ };
86
+ roleFields: {
87
+ type: ObjectConstructor;
88
+ default: () => {
89
+ label: string;
90
+ key: string;
91
+ children: string;
92
+ };
93
+ };
76
94
  }, {
77
95
  searchFilterBase: {
78
96
  isOpen: boolean;
@@ -80,12 +98,19 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
80
98
  customTitles: string[];
81
99
  itemHeight: number;
82
100
  };
101
+ labelList: {
102
+ key: string;
103
+ label: string;
104
+ }[];
105
+ labelListName: {
106
+ dept: string;
107
+ role: string;
108
+ };
83
109
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
84
110
  defaultList: {
85
111
  type: import("vue").PropType<((string | number) | {
86
112
  [key: string]: any;
87
113
  key: string | number;
88
- name: string;
89
114
  })[]>;
90
115
  default: () => never[];
91
116
  };
@@ -105,6 +130,7 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
105
130
  };
106
131
  wordbook: {
107
132
  type: import("vue").PropType<{
133
+ [key: string]: any;
108
134
  parent_id_obj: string | number;
109
135
  parent_name_obj: string | number;
110
136
  user_count_obj?: string | number | undefined;
@@ -154,6 +180,24 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
154
180
  type: import("vue").PropType<(keyWork: string) => Promise<import("../../shared/types").AnyObject[]>>;
155
181
  default: () => Promise<never[]>;
156
182
  };
183
+ showSelectType: {
184
+ type: BooleanConstructor;
185
+ default: boolean;
186
+ };
187
+ roleData: {
188
+ type: import("vue").PropType<(import("naive-ui/es/tree/src/interface").TreeOptionBase & {
189
+ [k: string]: unknown;
190
+ } & import("../../shared/types").AnyObject)[]>;
191
+ default: () => never[];
192
+ };
193
+ roleFields: {
194
+ type: ObjectConstructor;
195
+ default: () => {
196
+ label: string;
197
+ key: string;
198
+ children: string;
199
+ };
200
+ };
157
201
  }>> & {
158
202
  onCheck?: ((...args: any[]) => any) | undefined;
159
203
  onCheckWithLevel?: ((...args: any[]) => any) | undefined;
@@ -177,19 +221,18 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
177
221
  tagData: import("vue").Ref<{
178
222
  [x: string]: any;
179
223
  key: string | number;
180
- name: string;
181
224
  }[]>;
182
225
  initTagData: import("vue").Ref<{
183
226
  [x: string]: any;
184
227
  key: string | number;
185
- name: string;
186
228
  }[]>;
187
229
  isSearch: import("vue").Ref<boolean>;
188
- temp: import("naive-ui").TreeOption[];
189
- allCheckedKeys: (string | number)[];
230
+ tempData: import("naive-ui").TreeOption[];
231
+ allCheckedTreeKeys: import("vue").Ref<(string | number)[]>;
190
232
  isRemote: import("vue").ComputedRef<boolean>;
191
233
  checkStrategyResult: import("vue").ComputedRef<any>;
192
234
  isSearchFilter: import("vue").ComputedRef<boolean>;
235
+ curSelectKey: import("vue").Ref<string>;
193
236
  mergeSearchFilter: import("vue").ComputedRef<{
194
237
  isOpen: boolean;
195
238
  multiple: boolean;
@@ -197,10 +240,24 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
197
240
  itemHeight: number;
198
241
  }>;
199
242
  wordbookChildExpandkeys: import("vue").ComputedRef<string[]>;
200
- caculateTagData: import("vue").ComputedRef<any[]>;
243
+ caculateTagData: import("vue").ComputedRef<any>;
244
+ treeDataMiddle: any;
245
+ checkedKeysMiddle: any;
246
+ checkedTagsMiddle: any;
247
+ allCheckedKeysMiddle: any;
248
+ attrType: import("vue").ComputedRef<any>;
249
+ keyStr: import("vue").ComputedRef<string>;
250
+ getTreeDataMiddleData: () => void;
251
+ getDeptData: (list: any[], cb?: any) => any[];
252
+ getRoleData: (list: any[], cb?: any) => any[];
253
+ onHandleLabelChange: (item: any) => void;
254
+ setSelectTagData: (tree: import("naive-ui").TreeOption[], operatorType: string) => void;
255
+ uniqArrObj: (arr: any[], name: string) => any;
201
256
  init: () => void;
202
- getallCheckedKeysWithChild: (item: import("naive-ui").TreeOption) => void;
203
- getallCheckedKeysWithParent: (item: import("naive-ui").TreeOption) => void;
257
+ getMainData: (tree: import("naive-ui").TreeOption[], parentNode: import("naive-ui").TreeOption | null, cb?: any) => void;
258
+ setAllCheckedKeys: (tree: import("naive-ui").TreeOption, cb?: any) => void;
259
+ setAllCheckedKeysWithChild: (item: import("naive-ui").TreeOption, cb?: any) => void;
260
+ setAllCheckedKeysWithParent: (item: import("naive-ui").TreeOption, cb?: any) => void;
204
261
  queryLoadChildNode: (node: import("naive-ui").TreeOption) => Promise<import("../../shared/types").AnyObject>;
205
262
  setDisabled: (data: import("naive-ui").TreeOption) => void;
206
263
  renderLabel: ({ option }: {
@@ -209,10 +266,7 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
209
266
  getLabelName: (option: import("naive-ui").TreeOption) => unknown;
210
267
  transformData: (trees: import("naive-ui").TreeOption[]) => import("naive-ui").TreeOption[];
211
268
  calculateRootItems: (trees: import("naive-ui").TreeOption[], items: import("naive-ui").TreeOption[]) => import("naive-ui").TreeOption[];
212
- transformParentNodeName: (trees: import("naive-ui").TreeOption[], temp: any) => import("naive-ui").TreeOption[];
213
- setAllCheckedKeys: (tree: import("naive-ui").TreeOption[]) => void;
214
- setAllCheckedKeysWithChild: (tree: import("naive-ui").TreeOption[]) => void;
215
- setAllCheckedKeysWithParent: (tree: import("naive-ui").TreeOption[]) => void;
269
+ transformParentNodeName: (trees: import("naive-ui").TreeOption[], tempContent: any) => import("naive-ui").TreeOption[];
216
270
  searchSetting: () => string;
217
271
  onSearch: () => Promise<void>;
218
272
  setTreeCheckd: (tree: import("naive-ui").TreeOption[], checked: boolean) => void;
@@ -222,11 +276,9 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
222
276
  uniq: (arr: {
223
277
  [key: string]: any;
224
278
  key: string | number;
225
- name: string;
226
279
  }[]) => {
227
280
  [key: string]: any;
228
281
  key: string | number;
229
- name: string;
230
282
  }[];
231
283
  setTagData: (tree: import("naive-ui").TreeOption[]) => void;
232
284
  updateTreeChecked: (keys: (string | number)[]) => void;
@@ -235,15 +287,10 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
235
287
  closeTag: (tag: {
236
288
  [key: string]: any;
237
289
  key: string | number;
238
- name: string;
239
290
  }) => void;
240
291
  notifyCheck: (keys: (string | number)[]) => void;
241
292
  notifySearchClear: () => void;
242
- getCheckWithLevel: () => {
243
- [x: string]: any;
244
- key: string | number;
245
- name: string;
246
- }[];
293
+ getCheckWithLevel: () => any;
247
294
  NButton: any;
248
295
  NInput: any;
249
296
  NInputGroup: import("vue").DefineComponent<{
@@ -259,6 +306,7 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
259
306
  }>>, {}>;
260
307
  NCheckbox: any;
261
308
  NTree: any;
309
+ NTag: any;
262
310
  NIcon: any;
263
311
  NSpace: any;
264
312
  NGrid: any;
@@ -312,6 +360,7 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
312
360
  readonly suffix: boolean;
313
361
  readonly privateShow: boolean;
314
362
  }>;
363
+ NEmpty: any;
315
364
  CloseCircleSharp: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
316
365
  SearchMultiple: import("vue").DefineComponent<{
317
366
  treeData: {
@@ -581,7 +630,6 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
581
630
  type: import("vue").PropType<((string | number) | {
582
631
  [key: string]: any;
583
632
  key: string | number;
584
- name: string;
585
633
  })[]>;
586
634
  default: () => never[];
587
635
  };
@@ -601,6 +649,7 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
601
649
  };
602
650
  wordbook: {
603
651
  type: import("vue").PropType<{
652
+ [key: string]: any;
604
653
  parent_id_obj: string | number;
605
654
  parent_name_obj: string | number;
606
655
  user_count_obj?: string | number | undefined;
@@ -650,6 +699,24 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
650
699
  type: import("vue").PropType<(keyWork: string) => Promise<import("../../shared/types").AnyObject[]>>;
651
700
  default: () => Promise<never[]>;
652
701
  };
702
+ showSelectType: {
703
+ type: BooleanConstructor;
704
+ default: boolean;
705
+ };
706
+ roleData: {
707
+ type: import("vue").PropType<(import("naive-ui/es/tree/src/interface").TreeOptionBase & {
708
+ [k: string]: unknown;
709
+ } & import("../../shared/types").AnyObject)[]>;
710
+ default: () => never[];
711
+ };
712
+ roleFields: {
713
+ type: ObjectConstructor;
714
+ default: () => {
715
+ label: string;
716
+ key: string;
717
+ children: string;
718
+ };
719
+ };
653
720
  }>> & {
654
721
  onCheck?: ((...args: any[]) => any) | undefined;
655
722
  onCheckWithLevel?: ((...args: any[]) => any) | undefined;
@@ -660,11 +727,11 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
660
727
  defaultList: ((string | number) | {
661
728
  [key: string]: any;
662
729
  key: string | number;
663
- name: string;
664
730
  })[];
665
731
  searchPlaceholder: string;
666
732
  searchButtonText: string;
667
733
  wordbook: {
734
+ [key: string]: any;
668
735
  parent_id_obj: string | number;
669
736
  parent_name_obj: string | number;
670
737
  user_count_obj?: string | number | undefined;
@@ -685,5 +752,10 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
685
752
  } & import("../../shared/types").AnyObject;
686
753
  queryLoadChildData: (node: import("naive-ui").TreeOption) => Promise<import("../../shared/types").AnyObject>;
687
754
  queryTreeSearch: (keyWork: string) => Promise<import("../../shared/types").AnyObject[]>;
755
+ showSelectType: boolean;
756
+ roleData: (import("naive-ui/es/tree/src/interface").TreeOptionBase & {
757
+ [k: string]: unknown;
758
+ } & import("../../shared/types").AnyObject)[];
759
+ roleFields: Record<string, any>;
688
760
  }>>;
689
761
  export default SelectPerson;
@@ -8,6 +8,7 @@ declare type IWordBook<T> = {
8
8
  parent_name_obj: keyof T;
9
9
  user_count_obj?: keyof T;
10
10
  filter_key?: string;
11
+ [key: string]: any;
11
12
  };
12
13
  declare type IWordBookChild<T> = {
13
14
  user_id_obj: keyof T;
@@ -16,7 +17,6 @@ declare type IWordBookChild<T> = {
16
17
  };
17
18
  declare type ITag = {
18
19
  key: IKey;
19
- name: string;
20
20
  [key: string]: any;
21
21
  };
22
22
  declare const _default: import("vue").DefineComponent<{
@@ -76,6 +76,22 @@ declare const _default: import("vue").DefineComponent<{
76
76
  type: PropType<(keyWork: string) => Promise<Array<AnyObject>>>;
77
77
  default: () => Promise<never[]>;
78
78
  };
79
+ showSelectType: {
80
+ type: BooleanConstructor;
81
+ default: boolean;
82
+ };
83
+ roleData: {
84
+ type: PropType<ITreeOption[]>;
85
+ default: () => never[];
86
+ };
87
+ roleFields: {
88
+ type: ObjectConstructor;
89
+ default: () => {
90
+ label: string;
91
+ key: string;
92
+ children: string;
93
+ };
94
+ };
79
95
  }, {
80
96
  searchFilterBase: {
81
97
  isOpen: boolean;
@@ -83,6 +99,14 @@ declare const _default: import("vue").DefineComponent<{
83
99
  customTitles: string[];
84
100
  itemHeight: number;
85
101
  };
102
+ labelList: {
103
+ key: string;
104
+ label: string;
105
+ }[];
106
+ labelListName: {
107
+ dept: string;
108
+ role: string;
109
+ };
86
110
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
87
111
  defaultList: {
88
112
  type: PropType<(IKey | ITag)[]>;
@@ -140,6 +164,22 @@ declare const _default: import("vue").DefineComponent<{
140
164
  type: PropType<(keyWork: string) => Promise<Array<AnyObject>>>;
141
165
  default: () => Promise<never[]>;
142
166
  };
167
+ showSelectType: {
168
+ type: BooleanConstructor;
169
+ default: boolean;
170
+ };
171
+ roleData: {
172
+ type: PropType<ITreeOption[]>;
173
+ default: () => never[];
174
+ };
175
+ roleFields: {
176
+ type: ObjectConstructor;
177
+ default: () => {
178
+ label: string;
179
+ key: string;
180
+ children: string;
181
+ };
182
+ };
143
183
  }>> & {
144
184
  onCheck?: ((...args: any[]) => any) | undefined;
145
185
  onCheckWithLevel?: ((...args: any[]) => any) | undefined;
@@ -163,19 +203,18 @@ declare const _default: import("vue").DefineComponent<{
163
203
  tagData: import("vue").Ref<{
164
204
  [x: string]: any;
165
205
  key: IKey;
166
- name: string;
167
206
  }[]>;
168
207
  initTagData: import("vue").Ref<{
169
208
  [x: string]: any;
170
209
  key: IKey;
171
- name: string;
172
210
  }[]>;
173
211
  isSearch: import("vue").Ref<boolean>;
174
- temp: TreeOption[];
175
- allCheckedKeys: IKey[];
212
+ tempData: TreeOption[];
213
+ allCheckedTreeKeys: import("vue").Ref<IKey[]>;
176
214
  isRemote: import("vue").ComputedRef<boolean>;
177
215
  checkStrategyResult: import("vue").ComputedRef<any>;
178
216
  isSearchFilter: import("vue").ComputedRef<boolean>;
217
+ curSelectKey: import("vue").Ref<string>;
179
218
  mergeSearchFilter: import("vue").ComputedRef<{
180
219
  isOpen: boolean;
181
220
  multiple: boolean;
@@ -183,10 +222,24 @@ declare const _default: import("vue").DefineComponent<{
183
222
  itemHeight: number;
184
223
  }>;
185
224
  wordbookChildExpandkeys: import("vue").ComputedRef<string[]>;
186
- caculateTagData: import("vue").ComputedRef<any[]>;
225
+ caculateTagData: import("vue").ComputedRef<any>;
226
+ treeDataMiddle: any;
227
+ checkedKeysMiddle: any;
228
+ checkedTagsMiddle: any;
229
+ allCheckedKeysMiddle: any;
230
+ attrType: import("vue").ComputedRef<any>;
231
+ keyStr: import("vue").ComputedRef<string>;
232
+ getTreeDataMiddleData: () => void;
233
+ getDeptData: (list: any[], cb?: any) => any[];
234
+ getRoleData: (list: any[], cb?: any) => any[];
235
+ onHandleLabelChange: (item: any) => void;
236
+ setSelectTagData: (tree: TreeOption[], operatorType: string) => void;
237
+ uniqArrObj: (arr: any[], name: string) => any;
187
238
  init: () => void;
188
- getallCheckedKeysWithChild: (item: TreeOption) => void;
189
- getallCheckedKeysWithParent: (item: TreeOption) => void;
239
+ getMainData: (tree: TreeOption[], parentNode: TreeOption | null, cb?: any) => void;
240
+ setAllCheckedKeys: (tree: TreeOption, cb?: any) => void;
241
+ setAllCheckedKeysWithChild: (item: TreeOption, cb?: any) => void;
242
+ setAllCheckedKeysWithParent: (item: TreeOption, cb?: any) => void;
190
243
  queryLoadChildNode: (node: TreeOption) => Promise<AnyObject>;
191
244
  setDisabled: (data: TreeOption) => void;
192
245
  renderLabel: ({ option }: {
@@ -195,10 +248,7 @@ declare const _default: import("vue").DefineComponent<{
195
248
  getLabelName: (option: TreeOption) => unknown;
196
249
  transformData: (trees: TreeOption[]) => TreeOption[];
197
250
  calculateRootItems: (trees: TreeOption[], items: TreeOption[]) => TreeOption[];
198
- transformParentNodeName: (trees: TreeOption[], temp: any) => TreeOption[];
199
- setAllCheckedKeys: (tree: TreeOption[]) => void;
200
- setAllCheckedKeysWithChild: (tree: TreeOption[]) => void;
201
- setAllCheckedKeysWithParent: (tree: TreeOption[]) => void;
251
+ transformParentNodeName: (trees: TreeOption[], tempContent: any) => TreeOption[];
202
252
  searchSetting: () => string;
203
253
  onSearch: () => Promise<void>;
204
254
  setTreeCheckd: (tree: TreeOption[], checked: boolean) => void;
@@ -213,11 +263,7 @@ declare const _default: import("vue").DefineComponent<{
213
263
  closeTag: (tag: ITag) => void;
214
264
  notifyCheck: (keys: IKey[]) => void;
215
265
  notifySearchClear: () => void;
216
- getCheckWithLevel: () => {
217
- [x: string]: any;
218
- key: IKey;
219
- name: string;
220
- }[];
266
+ getCheckWithLevel: () => any;
221
267
  NButton: any;
222
268
  NInput: any;
223
269
  NInputGroup: import("vue").DefineComponent<{
@@ -233,6 +279,7 @@ declare const _default: import("vue").DefineComponent<{
233
279
  }>>, {}>;
234
280
  NCheckbox: any;
235
281
  NTree: any;
282
+ NTag: any;
236
283
  NIcon: any;
237
284
  NSpace: any;
238
285
  NGrid: any;
@@ -286,6 +333,7 @@ declare const _default: import("vue").DefineComponent<{
286
333
  readonly suffix: boolean;
287
334
  readonly privateShow: boolean;
288
335
  }>;
336
+ NEmpty: any;
289
337
  CloseCircleSharp: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
290
338
  SearchMultiple: import("vue").DefineComponent<{
291
339
  treeData: {
@@ -607,6 +655,22 @@ declare const _default: import("vue").DefineComponent<{
607
655
  type: PropType<(keyWork: string) => Promise<Array<AnyObject>>>;
608
656
  default: () => Promise<never[]>;
609
657
  };
658
+ showSelectType: {
659
+ type: BooleanConstructor;
660
+ default: boolean;
661
+ };
662
+ roleData: {
663
+ type: PropType<ITreeOption[]>;
664
+ default: () => never[];
665
+ };
666
+ roleFields: {
667
+ type: ObjectConstructor;
668
+ default: () => {
669
+ label: string;
670
+ key: string;
671
+ children: string;
672
+ };
673
+ };
610
674
  }>> & {
611
675
  onCheck?: ((...args: any[]) => any) | undefined;
612
676
  onCheckWithLevel?: ((...args: any[]) => any) | undefined;
@@ -625,5 +689,8 @@ declare const _default: import("vue").DefineComponent<{
625
689
  treeSetting: ITreeOption;
626
690
  queryLoadChildData: (node: TreeOption) => Promise<AnyObject>;
627
691
  queryTreeSearch: (keyWork: string) => Promise<Array<AnyObject>>;
692
+ showSelectType: boolean;
693
+ roleData: ITreeOption[];
694
+ roleFields: Record<string, any>;
628
695
  }>;
629
696
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,computed as t,watch as n,openBlock as a,createBlock as u,unref as i,withCtx as r,createVNode as c,createCommentVNode as o,withKeys as s,createTextVNode as d,toDisplayString as h,withDirectives as v,vShow as p,createElementBlock as f,Fragment as y,mergeProps as k,createElementVNode as m,renderList as g}from"vue";import{NGrid as _,NGi as b,NSpace as C,NInputGroup as w,NInput as x,NIcon as L,NButton as S,NCheckbox as j,NTree as T}from"naive-ui";import{CloseCircleSharp as N}from"@vicons/ionicons5";import{searchFilterTree as I,getExpandedKeys as F}from"./utils/index.js";import{cloneDeep as O}from"lodash-es";import{SearchTypeConfig as $}from"./types/enums.js";import D from"./SearchMultiple.vue.js";import K from"./SearchOrgAndStaff.vue.js";const q={key:0},A={class:"c-select-person__scroll",style:{height:"342px"}};var B=e({__name:"SelectPerson",props:{defaultList:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},searchPlaceholder:{type:String,default:"输入关键字搜索"},searchButtonText:{type:String,default:"搜索"},wordbook:{type:Object,default:()=>({})},wordbookChild:{type:Object,default:()=>({})},showCount:{type:Boolean,default:!0},showClear:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0},searchInner:{type:Boolean,default:!1},searchFilter:{type:Object,default:()=>({})},treeSetting:{type:Object,default:()=>({})},queryLoadChildData:{type:Function,default:void 0},queryTreeSearch:{type:Function,default:()=>Promise.resolve([])}},emits:["check","checkWithLevel"],setup(e,{expose:B,emit:E}){const P=e,R={isOpen:!1,multiple:!1,customTitles:["联系人","部门"],itemHeight:250},U=l(""),H=l(!1),W=l([]),G=l([]),z=l([]),M=l([]),J=l([]),Q=l(!1),V=O(function e(l){var t;for(let n=0,a=l.length;n<a;n++){const a=l[n];if(null==(t=a.children)?void 0:t.length){const l=se(a.children,[]);a.innerItemsNum=l.length,a.innerLeafs=l,e(a.children)}}return de(l,"")}(P.data));let X=[];const Y=t((()=>!!P.queryLoadChildData)),Z=t((()=>{var e,l;return null!=(l=null==(e=null==P?void 0:P.treeSetting)?void 0:e.checkStrategy)?l:"child"})),ee=t((()=>(null==P?void 0:P.searchFilter)&&Object.keys(null==P?void 0:P.searchFilter).length>0)),le=t((()=>ee.value?{...O(R),...P.searchFilter}:O(R))),te=t((()=>{var e,l;return null!=(l=null==(e=null==P?void 0:P.wordbookChild)?void 0:e.user_expand_keys)?l:[]})),ne=t((()=>{let e=[];return W.value.forEach((l=>{for(let t=0,n=M.value.length;t<n;t++){const n=M.value[t];if(n.key==l){e.push(n);break}}})),e}));function ae(e){e.disabled||e.children||!e.key||X.push(e.key)}function ue(e){e.disabled||e.tempTitle||!e.key||X.push(e.key)}async function ie(e){if(P.queryLoadChildData){const l=await P.queryLoadChildData(e);return l.children&&(l.children=l.children.map((e=>({...e,tempTitle:l.tempTitle?`${l.title}/${l.tempTitle}`:l.title})))),l}return e}function re(e){var l;(null==(l=e.children)?void 0:l.every((e=>e.disabled)))&&(e.disabled=!0)}function ce({option:e}){var l,t;if((null==(l=e.children)?void 0:l.length)||Y.value&&!(null==e?void 0:e.isLeaf)){const l=P.wordbook.user_count_obj&&e[P.wordbook.user_count_obj]||"",t=l?`(${l})`:"";return c("span",null,[`${e.title}${t}`])}{const l=null!=(t=e.title_expand_strs)?t:"";return c("p",{class:"user_item"},[e.title,c("span",{class:"user_item_expand",title:l},[l])])}}function oe(e){return e[P.wordbookChild.user_name_obj]||e[P.wordbook.parent_name_obj]||e.orgName||e.title||""}function se(e,l){var t;for(let n=0,a=e.length;n<a;n++){const a=e[n];(null==(t=a.children)?void 0:t.length)?se(a.children,l):!a.disabled&&l.push(a)}return l}function de(e,l){return e&&0!==e.length?e.map((e=>{var t;const n=oe(e),a=l?`${n}/${l}`:n;return{...e,tempTitle:l,children:(null==(t=e.children)?void 0:t.length)?de(null==e?void 0:e.children,a):[]}})):[]}async function he(){var e,l;const t=null!=(l=null==(e=null==P?void 0:P.wordbook)?void 0:e.filter_key)?l:"keyword";if(Q.value=!!U.value.trim(),Y.value)z.value=await P.queryTreeSearch(U.value);else{const e=function(){const e={[$.SEARCH_ORG_STAFF]:ee.value,[$.SEARCH_ORG]:P.searchInner},l=Object.keys(e).find((l=>e[l]));return null!=l?l:""}();z.value=I(e,V,U.value,t)}G.value=z.value.length&&U.value?F(z.value):[]}function ve(e,l){var t,n;switch(null!=(n=null==(t=null==P?void 0:P.treeSetting)?void 0:t.checkStrategy)?n:"child"){case"child":!function(e,l){for(let t=0,n=e.length;t<n;t++){const n=e[t];if(!n.disabled&&(!n.children||n.isLeaf)&&(l&&!W.value.includes(n.key)&&W.value.push(n.key),!l)){const e=W.value.findIndex((e=>e===n.key));W.value.splice(e,1)}n.children&&ve(n.children,l)}}(e,l);break;case"parent":!function(e,l){W.value=[];for(let t=0,n=e.length;t<n;t++){const n=e[t];if(!n.disabled&&!n.tempTitle&&(l&&!W.value.includes(n.key)&&W.value.push(n.key),!l)){const e=W.value.findIndex((e=>e===n.key));W.value.splice(e,1)}}}(e,l)}}function pe(e){ve(z.value,e)}function fe(e){var l;for(let t=0,n=e.length;t<n;t++){const n=e[t],a=J.value.map((e=>e.key));W.value.includes(n.key)&&!a.includes(n.key)&&M.value.push({key:n.key,name:n.title,parentName:n.tempTitle,innerItemsNum:n.innerItemsNum,innerLeafs:n.innerLeafs,originItem:n}),(null==(l=n.children)?void 0:l.length)&&fe(n.children)}}function ye(e){W.value=e}function ke(){W.value=[]}function me(e){W.value=e}function ge(){U.value="",setTimeout((()=>{he()}))}return function e(l,t){var n,a,u,i;for(let r=0,c=l.length;r<c;r++){const c=l[r];let o=te.value.reduce(((e,l)=>e+(c[l]?`${c[l]},`:"")),"");switch(c.title_expand_strs=o.slice(0,-1),c.title=oe(c),c.label=oe(c),c.parentNode=t,c.key||(c.key=c[P.wordbookChild.user_id_obj]||c[P.wordbook.parent_id_obj]||Date.now()),(null==(n=c.children)?void 0:n.length)?(e(c.children,c),re(c)):0===(null==(a=c.children)?void 0:a.length)&&Reflect.deleteProperty(c,"children"),null!=(i=null==(u=null==P?void 0:P.treeSetting)?void 0:u.checkStrategy)?i:"child"){case"child":ae(c);break;case"parent":ue(c)}}}(V,null),z.value=V,P.defaultList.length>0&&(Y.value?(P.defaultList.forEach((e=>W.value.push(e.key))),M.value=O(P.defaultList),J.value=O(P.defaultList)):(P.defaultList.forEach((e=>W.value.push(e))),fe(V))),n((()=>W),(e=>{M.value=J.value.filter((l=>e.value.includes(l.key))),e.value.length&&fe(Y.value?z.value:V),H.value=X.every((e=>M.value.findIndex((l=>l.key===e))>-1));const l=M.value.filter((l=>e.value.includes(l.key)));E("check",e.value),E("checkWithLevel",l)}),{deep:!0}),n((()=>U.value),(e=>{e||ge()})),B({getCheckWithLevel:function(){const e=W.value,l=M.value.filter((l=>e.includes(l.key)));return null!=l?l:[]}}),(l,t)=>(a(),u(i(_),{cols:2,class:"c-select-person"},{default:r((()=>[c(i(b),null,{default:r((()=>[c(i(C),{vertical:"",style:{"padding-right":"12px","border-right":"1px solid #e8e8e8"}},{default:r((()=>[c(i(w),{style:{"margin-bottom":"12px"}},{default:r((()=>[o(" clearable "),c(i(x),{class:"search-input",value:U.value,"onUpdate:value":t[0]||(t[0]=e=>U.value=e),placeholder:e.searchPlaceholder,onKeyup:s(he,["enter"])},{suffix:r((()=>[U.value?(a(),u(i(L),{key:0,class:"search-clear",component:i(N),size:"16",onClick:ge},null,8,["component"])):o("v-if",!0)])),_:1},8,["value","placeholder","onKeyup"]),c(i(S),{type:"primary",onClick:he},{default:r((()=>[d(h(e.searchButtonText),1)])),_:1})])),_:1}),e.multiple&&!Q.value?v((a(),u(i(j),{key:0,checked:H.value,"onUpdate:checked":[t[1]||(t[1]=e=>H.value=e),pe]},{default:r((()=>[d(" 全选 ")])),_:1},8,["checked"])),[[p,i(X).length<1e3]]):o("v-if",!0),o(" 支持选人 "),e.searchInner&&e.multiple&&Q.value&&"parent"===i(Z)?(a(),u(D,{key:1,treeData:z.value,checkedKeys:W.value,onNotifyCheck:me},null,8,["treeData","checkedKeys"])):i(ee)&&e.multiple&&Q.value&&"parent"===i(Z)?(a(),f(y,{key:2},[o(" 同时兼容选人和选部门 "),c(K,{treeData:z.value,checkedKeys:W.value,searchFilter:i(le),onNotifyCheck:me,onNotifyClear:ge},null,8,["treeData","checkedKeys","searchFilter"])],2112)):(a(),u(i(T),k({key:3,"virtual-scroll":"",class:"c-select-person__scroll","checked-keys":W.value,"expanded-keys":G.value,"onUpdate:expanded-keys":t[2]||(t[2]=e=>G.value=e),checkable:e.multiple,cascade:"","allow-checking-not-loaded":"",selectable:!e.multiple,"selected-keys":W.value,"onUpdate:selected-keys":t[3]||(t[3]=e=>W.value=e),data:z.value,"check-strategy":"child","render-label":ce},e.treeSetting,{"onUpdate:checkedKeys":ye,onLoad:ie}),null,16,["checked-keys","expanded-keys","checkable","selectable","selected-keys","data"]))])),_:1})])),_:1}),c(i(b),null,{default:r((()=>[c(i(C),{vertical:"",style:{"padding-left":"12px"}},{default:r((()=>[c(i(C),{justify:"space-between",style:{"margin-bottom":"20px"}},{default:r((()=>[e.showCount?(a(),f("span",q,"已选择:"+h(i(ne).length),1)):o("v-if",!0),e.showClear?(a(),f("span",{key:1,class:"c-select-person__clear-btn",onClick:ke},"清空")):o("v-if",!0)])),_:1}),m("div",A,[(a(!0),f(y,null,g(i(ne),(e=>(a(),f("span",{class:"c-select-person__tag-item",key:e.key},[d(h(e.name)+" "+h(e.parentName?`(${e.parentName})`:"")+" "+h(e.innerItemsNum?`(${e.innerItemsNum}人)`:"")+" ",1),c(i(L),{class:"tag-close",component:i(N),onClick:l=>function(e){W.value=W.value.filter((l=>l!==e.key))}(e)},null,8,["component","onClick"])])))),128))])])),_:1})])),_:1})])),_:1}))}});export{B as default};
1
+ import{defineComponent as e,ref as l,computed as t,reactive as n,watch as a,openBlock as i,createBlock as u,unref as r,withCtx as o,createVNode as c,createCommentVNode as d,withKeys as s,createTextVNode as v,toDisplayString as p,createElementBlock as h,Fragment as y,renderList as f,withDirectives as k,vShow as m,mergeProps as b,createElementVNode as g}from"vue";import{NGrid as _,NGi as T,NSpace as w,NInputGroup as S,NInput as C,NIcon as x,NButton as L,NTag as j,NCheckbox as O,NEmpty as D,NTree as E}from"naive-ui";import{CloseCircleSharp as F}from"@vicons/ionicons5";import{searchFilterTree as N,getExpandedKeys as I}from"./utils/index.js";import{cloneDeep as P}from"lodash-es";import{SelectItemTypesConfig as $,SelectRoleEnumsConfig as R,SearchTypeConfig as A}from"./types/enums.js";import B from"./SearchMultiple.vue.js";import K from"./SearchOrgAndStaff.vue.js";const U={key:0,class:"select-type-tags"},q={key:4,class:"tree-content"},W={key:0},H={class:"c-select-person__scroll",style:{height:"342px"}};var G=e({__name:"SelectPerson",props:{defaultList:{type:Array,default:()=>[]},data:{type:Array,default:()=>[]},searchPlaceholder:{type:String,default:"输入关键字搜索"},searchButtonText:{type:String,default:"搜索"},wordbook:{type:Object,default:()=>({})},wordbookChild:{type:Object,default:()=>({})},showCount:{type:Boolean,default:!0},showClear:{type:Boolean,default:!0},multiple:{type:Boolean,default:!0},searchInner:{type:Boolean,default:!1},searchFilter:{type:Object,default:()=>({})},treeSetting:{type:Object,default:()=>({})},queryLoadChildData:{type:Function,default:void 0},queryTreeSearch:{type:Function,default:()=>Promise.resolve([])},showSelectType:{type:Boolean,default:!1},roleData:{type:Array,default:()=>[]},roleFields:{type:Object,default:()=>({label:"name",key:"id",children:"children"})}},emits:["check","checkWithLevel"],setup(e,{expose:G,emit:z}){const M=e,J={isOpen:!1,multiple:!1,customTitles:["联系人","部门"],itemHeight:250},Q=[{key:"main",label:"选人员"},{key:"dept",label:"选科室"},{key:"role",label:"选角色"}],V={dept:"科室",role:"角色"},X=l(""),Y=l(!1),Z=l([]),ee=l([]),le=l([]),te=l([]),ne=l([]),ae=l(!1),ie=P(function e(l){var t;for(let n=0,a=l.length;n<a;n++){const a=l[n];if(null==(t=a.children)?void 0:t.length){const l=De(a.children,[]);a.innerItemsNum=l.length,a.innerLeafs=l,e(a.children)}}return M.showSelectType?l:Ee(l,"")}(M.data)),ue=l([]),re=t((()=>!!M.queryLoadChildData)),oe=t((()=>{var e,l;return null!=(l=null==(e=null==M?void 0:M.treeSetting)?void 0:e.checkStrategy)?l:"child"})),ce=t((()=>(null==M?void 0:M.searchFilter)&&Object.keys(null==M?void 0:M.searchFilter).length>0)),de=l("main"),se=t((()=>ce.value?{...P(J),...M.searchFilter}:P(J))),ve=t((()=>{var e,l;return null!=(l=null==(e=null==M?void 0:M.wordbookChild)?void 0:e.user_expand_keys)?l:[]})),pe=t((()=>{if(M.showSelectType){return function(e,l){let t={};return e.reduce(((e,n)=>(!t[n[l]]&&(t[n[l]]=e.push(n)),e)),[])}([...fe.main.filter((e=>(e.itemType=$.PERSON,e[me.value]==R.STAFF))),...fe.dept.filter((e=>(e.itemType=$.DEPT,e[me.value]==R.DEPT))),...fe.role.filter((e=>(e.itemType=$.ROLE,e)))],"key")}let e=[];return Z.value.forEach((l=>{for(let t=0,n=te.value.length;t<n;t++){const n=te.value[t];if(n.key==l){e.push(n);break}}})),e})),he=n({main:[],dept:[],role:[],temp:[]}),ye=n({main:[],dept:[],role:[]}),fe=n({main:[],dept:[],role:[]}),ke=n({main:[],dept:[],role:[]}),me=t((()=>{var e;return(null==(e=M.wordbook)?void 0:e.type)||"type"})),be=t((()=>M.wordbookChild.user_id_obj||M.wordbook.parent_id_obj||Date.now()));function ge(){he.main=he.temp=ie,Se(he.temp,null,(e=>{ke.main.push(e.key)})),ue.value=ke.main,he.dept=_e(P(ie),(e=>{ke.dept.push(e.key)})),he.role=Te(P(M.roleData),(e=>{ke.role.push(e.key)}))}function _e(e,l){return e.filter((e=>{var t;M.showSelectType&&(null==(t=e.children)?void 0:t.length)&&(e.children=_e(e.children,l));const n=e[me.value]==R.DEPT;return n&&Ce(e,l),n}))}function Te(e,l){const{label:t,key:n,children:a}=M.roleFields;return e.map((e=>{var i;return e.key=e[n],e.label=e.title=e[t],(null==(i=e[a])?void 0:i.length)&&(e.children=Te(e[a],l)),Ce(e,l),e}))}function we(e,l){var t,n;const a=["main","dept"].includes(l)?be.value:null==(t=M.roleFields)?void 0:t.key;for(let t=0,i=e.length;t<i;t++){const i=e[t],u=ne.value.map((e=>e.key));ye[l].includes(i.key)&&!u.includes(i.key)&&fe[l].push({...i,key:i[a]}),(null==(n=i.children)?void 0:n.length)&&we(i.children,l)}}function Se(e,l,t){var n,a;for(let i=0,u=e.length;i<u;i++){const u=e[i];let r=ve.value.reduce(((e,l)=>e+(u[l]?`${u[l]},`:"")),"");u.title_expand_strs=r.slice(0,-1),u.title=Oe(u),u.label=Oe(u),u.parentNode=l,u.key||(u.key=u[M.wordbookChild.user_id_obj]||u[M.wordbook.parent_id_obj]||Date.now()),(null==(n=u.children)?void 0:n.length)?(Se(u.children,u,t),Le(u)):0===(null==(a=u.children)?void 0:a.length)&&Reflect.deleteProperty(u,"children"),Ce(u,t)}}function Ce(e,l){var t,n;switch(null!=(n=null==(t=null==M?void 0:M.treeSetting)?void 0:t.checkStrategy)?n:"child"){case"child":!function(e,l){e.disabled||e.children||!e.key||l&&l(e)}(e,l);break;case"parent":!function(e,l){e.disabled||e.tempTitle||!e.key||l&&l(e)}(e,l)}}async function xe(e){if(M.queryLoadChildData){const l=await M.queryLoadChildData(e);return l.children&&(l.children=l.children.map((e=>({...e,tempTitle:l.tempTitle?`${l.title}/${l.tempTitle}`:l.title})))),l}return e}function Le(e){var l;(null==(l=e.children)?void 0:l.every((e=>e.disabled)))&&(e.disabled=!0)}function je({option:e}){var l,t;if((null==(l=e.children)?void 0:l.length)||re.value&&!(null==e?void 0:e.isLeaf)){const l=M.wordbook.user_count_obj&&e[M.wordbook.user_count_obj]||"",t=l?`(${l})`:"",n=`${e.title}${t}`;return c("span",{title:n},[n])}{const l=null!=(t=e.title_expand_strs)?t:"";return c("p",{class:"user_item"},[c("span",{title:e.title},[e.title]),c("span",{class:"user_item_expand",title:l},[l])])}}function Oe(e){return e[M.wordbookChild.user_name_obj]||e[M.wordbook.parent_name_obj]||e.orgName||e.title||""}function De(e,l){var t;for(let n=0,a=e.length;n<a;n++){const a=e[n];(null==(t=a.children)?void 0:t.length)?De(a.children,l):!a.disabled&&l.push(a)}return l}function Ee(e,l){return e&&0!==e.length?e.map((e=>{var t;const n=Oe(e),a=l?`${n}/${l}`:n;return{...e,tempTitle:l,children:(null==(t=e.children)?void 0:t.length)?Ee(null==e?void 0:e.children,a):[]}})):[]}async function Fe(){var e,l;const t=null!=(l=null==(e=null==M?void 0:M.wordbook)?void 0:e.filter_key)?l:"keyword";if(ae.value=!!X.value.trim(),re.value)le.value=await M.queryTreeSearch(X.value);else{const e=function(){const e={[A.SEARCH_ORG_STAFF]:ce.value,[A.SEARCH_ORG]:M.searchInner},l=Object.keys(e).find((l=>e[l]));return null!=l?l:""}();le.value=N(e,he.temp,X.value,t)}ee.value=le.value.length&&X.value?I(le.value):[]}function Ne(e,l){var t,n;switch(null!=(n=null==(t=null==M?void 0:M.treeSetting)?void 0:t.checkStrategy)?n:"child"){case"child":!function(e,l){for(let t=0,n=e.length;t<n;t++){const n=e[t];if(!n.disabled&&(!n.children||n.isLeaf)&&(l&&!Z.value.includes(n.key)&&Z.value.push(n.key),!l)){const e=Z.value.findIndex((e=>e===n.key));Z.value.splice(e,1)}n.children&&Ne(n.children,l)}}(e,l);break;case"parent":!function(e,l){Z.value=[];for(let t=0,n=e.length;t<n;t++){const n=e[t];if(!n.disabled&&!n.tempTitle&&(l&&!Z.value.includes(n.key)&&Z.value.push(n.key),!l)){const e=Z.value.findIndex((e=>e===n.key));Z.value.splice(e,1)}}}(e,l)}}function Ie(e){Ne(le.value,e)}function Pe(e){var l;for(let t=0,n=e.length;t<n;t++){const n=e[t],a=ne.value.map((e=>e.key));Z.value.includes(n.key)&&!a.includes(n.key)&&te.value.push({key:n.key,name:n.title,parentName:n.tempTitle,innerItemsNum:n.innerItemsNum,innerLeafs:n.innerLeafs,originItem:n}),(null==(l=n.children)?void 0:l.length)&&Pe(n.children)}}function $e(e){if(M.showSelectType){const l=de.value;Z.value=ye[l]=e}else Z.value=e}function Re(){Object.keys(ye).forEach((e=>{ye[e]=fe[e]=[]})),Z.value=[]}function Ae(e){Z.value=e}function Be(){X.value="",setTimeout((()=>{Fe()}))}return a((()=>M.data),(e=>{!function(){if(ge(),le.value=he.temp,M.defaultList.length>0)if(re.value)M.defaultList.forEach((e=>Z.value.push(e.key))),te.value=P(M.defaultList),ne.value=P(M.defaultList);else{if(M.showSelectType){const e=de.value;return M.defaultList.forEach((e=>{e.itemType===$.PERSON&&(ye.main.push(e[be.value]),fe.main.push(e)),e.itemType===$.DEPT&&(ye.dept.push(e[be.value]),fe.dept.push(e)),e.itemType===$.ROLE&&(ye.role.push(e[M.roleFields.key]),fe.role.push(e))})),void(Z.value=ye[e])}M.defaultList.forEach((e=>Z.value.push(e))),Pe(he.temp)}}()}),{immediate:!0}),a((()=>Z),(e=>{if(M.showSelectType){const l=de.value;fe[l]=ne.value.filter((l=>e.value.includes(l.key))),we(he[l],l),M.showSelectType?Y.value=ue.value.every((e=>Z.value.findIndex((l=>l===e))>-1)):Y.value=ue.value.every((e=>te.value.findIndex((l=>l.key===e))>-1));const t=pe.value.map((e=>e.key));return z("check",t),void z("checkWithLevel",pe.value)}te.value=ne.value.filter((l=>e.value.includes(l.key))),Pe(re.value?le.value:he.temp);const l=te.value.filter((l=>e.value.includes(l.key)));z("check",e.value),z("checkWithLevel",l)}),{deep:!0}),a((()=>X.value),(e=>{e||Be()})),G({getCheckWithLevel:function(){var e;if(M.showSelectType)return null!=(e=pe.value)?e:[];const l=Z.value,t=te.value.filter((e=>l.includes(e.key)));return null!=t?t:[]}}),(l,t)=>(i(),u(r(_),{cols:2,class:"c-select-person"},{default:o((()=>[c(r(T),null,{default:o((()=>[c(r(w),{vertical:"",style:{"padding-right":"12px","border-right":"1px solid #e8e8e8"}},{default:o((()=>[c(r(S),{style:{"margin-bottom":"12px"}},{default:o((()=>[d(" clearable "),c(r(C),{class:"search-input",value:X.value,"onUpdate:value":t[0]||(t[0]=e=>X.value=e),placeholder:e.searchPlaceholder,onKeyup:s(Fe,["enter"])},{suffix:o((()=>[X.value?(i(),u(r(x),{key:0,class:"search-clear",component:r(F),size:"16",onClick:Be},null,8,["component"])):d("v-if",!0)])),_:1},8,["value","placeholder","onKeyup"]),c(r(L),{type:"primary",onClick:Fe},{default:o((()=>[v(p(e.searchButtonText),1)])),_:1})])),_:1}),e.showSelectType?(i(),h("div",U,[(i(),h(y,null,f(Q,(e=>c(r(j),{round:"",checkable:"",checked:de.value===e.key,key:e.key,"onUpdate:checked":l=>function(e){de.value=e.key,le.value=he.temp=he[e.key],Z.value=ye[e.key],ue.value=ke[e.key]}(e)},{default:o((()=>[v(p(e.label),1)])),_:2},1032,["checked","onUpdate:checked"]))),64))])):d("v-if",!0),e.multiple&&!ae.value?k((i(),u(r(O),{key:1,checked:Y.value,"onUpdate:checked":[t[1]||(t[1]=e=>Y.value=e),Ie]},{default:o((()=>[v(" 全选 ")])),_:1},8,["checked"])),[[m,ue.value.length<1e3]]):d("v-if",!0),d(" 支持选人 "),e.searchInner&&e.multiple&&ae.value&&"parent"===r(oe)?(i(),u(B,{key:2,treeData:le.value,checkedKeys:Z.value,onNotifyCheck:Ae},null,8,["treeData","checkedKeys"])):r(ce)&&e.multiple&&ae.value&&"parent"===r(oe)?(i(),h(y,{key:3},[d(" 同时兼容选人和选部门 "),c(K,{treeData:le.value,checkedKeys:Z.value,searchFilter:r(se),onNotifyCheck:Ae,onNotifyClear:Be},null,8,["treeData","checkedKeys","searchFilter"])],2112)):(i(),h("div",q,[0===le.value.length?(i(),u(r(D),{key:0,description:"暂无数据"})):(i(),u(r(E),b({key:1,"virtual-scroll":"",class:"c-select-person__scroll","checked-keys":Z.value,"expanded-keys":ee.value,"onUpdate:expanded-keys":t[2]||(t[2]=e=>ee.value=e),checkable:e.multiple,cascade:"","allow-checking-not-loaded":"",selectable:!e.multiple,"selected-keys":Z.value,"onUpdate:selected-keys":t[3]||(t[3]=e=>Z.value=e),data:le.value,"check-strategy":"child","render-label":je},e.treeSetting,{"onUpdate:checkedKeys":$e,onLoad:xe}),null,16,["checked-keys","expanded-keys","checkable","selectable","selected-keys","data"]))]))])),_:1})])),_:1}),c(r(T),null,{default:o((()=>[c(r(w),{vertical:"",style:{"padding-left":"12px"}},{default:o((()=>[c(r(w),{justify:"space-between",style:{"margin-bottom":"20px"}},{default:o((()=>[e.showCount?(i(),h("span",W,"已选择:"+p(r(pe).length),1)):d("v-if",!0),e.showClear?(i(),h("span",{key:1,class:"c-select-person__clear-btn",onClick:Re},"清空")):d("v-if",!0)])),_:1}),g("div",H,[(i(!0),h(y,null,f(r(pe),(l=>(i(),h("span",{class:"c-select-person__tag-item",key:l.key},[v(p(l.name)+" "+p(l.parentName?`(${l.parentName})`:"")+" "+p(l.innerItemsNum?`(${l.innerItemsNum}人)`:"")+" "+p(e.showSelectType&&V[l.itemType]?`(${V[l.itemType]})`:"")+" ",1),c(r(x),{class:"tag-close",component:r(F),onClick:e=>function(e){if(M.showSelectType){const l=e.itemType===$.PERSON?"main":e.itemType;return ye[l]=ye[l].filter((l=>l!==e.key)),fe[l]=ne.value.filter((e=>ye[l].includes(e.key))),we(he[l],l),void(de.value==l&&(Z.value=ye[l]))}Z.value=Z.value.filter((l=>l!==e.key))}(l)},null,8,["component","onClick"])])))),128))])])),_:1})])),_:1})])),_:1}))}});export{G as default};
@@ -2,3 +2,12 @@ export declare const SearchTypeConfig: {
2
2
  SEARCH_ORG_STAFF: string;
3
3
  SEARCH_ORG: string;
4
4
  };
5
+ export declare const SelectRoleEnumsConfig: {
6
+ DEPT: number;
7
+ STAFF: number;
8
+ };
9
+ export declare const SelectItemTypesConfig: {
10
+ DEPT: string;
11
+ PERSON: string;
12
+ ROLE: string;
13
+ };
@@ -1 +1 @@
1
- const e={SEARCH_ORG_STAFF:"isSearchFilter",SEARCH_ORG:"searchInner"};export{e as SearchTypeConfig};
1
+ const e={SEARCH_ORG_STAFF:"isSearchFilter",SEARCH_ORG:"searchInner"},r={DEPT:1,STAFF:2},E={DEPT:"dept",PERSON:"person",ROLE:"role"};export{e as SearchTypeConfig,E as SelectItemTypesConfig,r as SelectRoleEnumsConfig};
@@ -1 +1 @@
1
- .c-select-person{padding:0 12px}.c-select-person__scroll{height:308px;overflow-y:auto}.c-select-person__clear-btn{color:#5585f5;cursor:pointer}.c-select-person__tag-item{align-items:center;background:rgba(85,133,245,.08);border:1px solid rgba(85,133,245,.5);border-radius:4px;box-sizing:border-box;color:#5585f5;display:inline-flex;font-size:14px;height:24px;line-height:24px;list-style:none;margin:0 8px 4px 0;padding:0 6px;transition:all .3s cubic-bezier(.215,.61,.355,1);white-space:nowrap}.c-select-person__tag-item .tag-close{color:#5585f5;cursor:pointer;display:inline-block;font-size:14px;font-weight:700;margin-left:3px;transition:all .3s}.c-select-person__tag-item .tag-close:hover{color:rgba(85,133,245,.6)}.c-select-person__tag-item .tag-close:active{color:#fff}.c-select-person .n-tree-node-content{flex:1;overflow:hidden}.c-select-person .search-input .search-clear{cursor:pointer}.c-select-person .user_item{align-items:center;display:flex;font-size:14px;margin:0}.c-select-person .user_item .user_item_expand{flex:1;font-size:12px;margin-left:5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-select-person .search_title{border-bottom:1px solid #eee;font-size:16px;margin-top:8px;padding-bottom:5px}.c-select-person .select-person__multiple-search{display:flex;flex-direction:column}.c-select-person .select-person__multiple-search .n-checkbox{height:30px;overflow:hidden}.c-select-person .select-person__multiple-search .n-checkbox .n-checkbox__label{overflow:hidden}.c-select-person .select-person__multiple-search .search_item{align-items:flex-start;box-sizing:content-box;cursor:pointer;display:flex;flex-direction:column;height:40px;margin:2px;padding:3px}.c-select-person .select-person__multiple-search .search_item .title{align-items:center;display:flex;font-size:14px;overflow:hidden;width:100%}.c-select-person .select-person__multiple-search .search_item .desc{color:#7d88b5;font-size:12px;margin-top:5px}.c-select-person .select-person__multiple-search .search_item:hover{background:#f1f1f1}.c-select-person .select-person__multiple-search .search_disabled{color:#c2c2c2;cursor:not-allowed}.c-select-person .select-person__multiple-search .search_disabled .desc{color:#c2c2c2}.c-select-person .n-empty{margin-top:30px}
1
+ .c-select-person{padding:0 12px}.c-select-person__scroll{height:308px;overflow-y:auto}.c-select-person__clear-btn{color:#5585f5;cursor:pointer}.c-select-person__tag-item{align-items:center;background:rgba(85,133,245,.08);border:1px solid rgba(85,133,245,.5);border-radius:4px;box-sizing:border-box;color:#5585f5;display:inline-flex;font-size:14px;height:24px;line-height:24px;list-style:none;margin:0 8px 4px 0;padding:0 6px;transition:all .3s cubic-bezier(.215,.61,.355,1);white-space:nowrap}.c-select-person__tag-item .tag-close{color:#5585f5;cursor:pointer;display:inline-block;font-size:14px;font-weight:700;margin-left:3px;transition:all .3s}.c-select-person__tag-item .tag-close:hover{color:rgba(85,133,245,.6)}.c-select-person__tag-item .tag-close:active{color:#fff}.c-select-person .select-type-tags .n-tag{background-color:var(--n-color-hover-checkable);margin-right:10px}.c-select-person .select-type-tags .n-tag.n-tag--checkable.n-tag--checked{background-color:var(--n-color-checked)}.c-select-person .n-tree-node-content{flex:1;overflow:hidden}.c-select-person .search-input .search-clear{cursor:pointer}.c-select-person .user_item{align-items:center;display:flex;font-size:14px;margin:0}.c-select-person .user_item .user_item_expand{flex:1;font-size:12px;margin-left:5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-select-person .search_title{border-bottom:1px solid #eee;font-size:16px;margin-top:8px;padding-bottom:5px}.c-select-person .select-person__multiple-search{display:flex;flex-direction:column}.c-select-person .select-person__multiple-search .n-checkbox{height:30px;overflow:hidden}.c-select-person .select-person__multiple-search .n-checkbox .n-checkbox__label{overflow:hidden}.c-select-person .select-person__multiple-search .search_item{align-items:flex-start;box-sizing:content-box;cursor:pointer;display:flex;flex-direction:column;height:40px;margin:2px;padding:3px}.c-select-person .select-person__multiple-search .search_item .title{align-items:center;display:flex;font-size:14px;overflow:hidden;width:100%}.c-select-person .select-person__multiple-search .search_item .desc{color:#7d88b5;font-size:12px;margin-top:5px}.c-select-person .select-person__multiple-search .search_item:hover{background:#f1f1f1}.c-select-person .select-person__multiple-search .search_disabled{color:#c2c2c2;cursor:not-allowed}.c-select-person .select-person__multiple-search .search_disabled .desc{color:#c2c2c2}.c-select-person .n-empty{margin-top:30px}
@@ -1 +1 @@
1
- import{findAncestor as t}from"../../../../shared/utils/index.js";import{useEventListener as e,useDebounceFn as r}from"@vueuse/core";import{once as s,pick as a,omit as n,isFunction as u,isString as c}from"lodash-es";import{reactive as o,ref as i,unref as l,computed as h,getCurrentInstance as d,inject as p,onBeforeUnmount as g,onDeactivated as b,onActivated as v}from"vue";import{ShortcutStatus as f,InjectionShortcutManager as k}from"../constants/index.js";import{normalizeSignatureInfo as y,getKeySignature as C,getDisplaySignature as m,isInvalidSignature as S,isKeyboardEvent as w,isInvalidKeyboardEvent as E,isShortcutProvider as M}from"../utils/index.js";const K=Symbol("Glob"),j=new Map;class ${constructor(t,e=K){this.shortcutCallbackMap=o(new Map),this.shortcutCache=i({}),this.disabled=!1,this.environmentEle=t||window,j.set(e,this)}static log(t,e=!1){const r=`[ShortcutManager] ${t}`;return!e&&console.warn(r),r}get traverse(){return[...Object.values(this.shortcutCache.value)].sort(((t,e)=>(t.order||0)-(e.order||0)))}query(t){return this.shortcutCache.value[t]}async update(t,e){var r,s;const a=null==(r=this.query(t))?void 0:r.currentKeySignature;e&&u(this.shortcutCache,e);const n=this.query(t);function u(t,e){if(a!==C(e)){if(Object.values(t.value).some((t=>t.currentKeySignature===C(e))))throw`重复的快捷键=> ${m(e)}`;if(S(e))throw`非法的快捷键=>${e.key}`}}n&&(await(null==(s=n.onUpdate)?void 0:s.call(n,t,e?y(e):void 0)),u(this.shortcutCache,e),n.currentKeySignature=C(e),n.shortcutSignature=y(e),this.shortcutCallbackMap.set(n.currentKeySignature,this.shortcutCallbackMap.get(a)),this.shortcutCallbackMap.delete(a))}register(t){const e=this.query(t.key);return e?(e.status=f.ACTIVE,this.shortcutCallbackMap.set(e.currentKeySignature,t.callback),Object.assign(e,a(t,["debounce","debounceOption","label","order","key"])),r(e)):(this.shortcutCache.value[t.key]=n(t,["callback"]),this.shortcutCallbackMap.set(t.currentKeySignature,t.callback),r(this.shortcutCache.value[t.key]));function r(t){return{stop:()=>{t.status=f.INACTIVE},start:()=>{t.status=f.ACTIVE},signature:()=>t.currentKeySignature}}}start(){return this.handle?($.log(`请勿重复启动=>${this}`),this):(this.handle=async e=>{if(!w(e)||this.disabled)return;const r=t(e.target,M);if(r&&r!==l(this.environmentEle)||E(e))return;const s=C(e),a=this.shortcutCallbackMap.get(s);if(!a)return;e.preventDefault();const n=Object.values(this.shortcutCache.value).find((t=>t.currentKeySignature===s));n&&n.status===f.ACTIVE&&!n.disabled&&a(e)},e(this.environmentEle,"keyup",this.handle,{capture:!0}),this)}destroy(){var t;this.handle&&(null==(t=l(this.environmentEle))||t.removeEventListener("keyup",this.handle,{capture:!0})),this.handle=void 0,this.clear()}clear(){this.shortcutCallbackMap.clear(),this.shortcutCache.value={}}}const I=(new $).start(),O=s((()=>$.log("非setup语境下的shortcut将影响全局"))),A=s((()=>$.log("在非setup语境下使用register函数,组件销毁时可能需要手动调用stop函数使快捷键失活")));function T(t){const e=h((()=>{if(l(t)){const e=j.get(l(t));return e||$.log(`不存在的scope=>${t}, 将使用全局快捷键`),e||I}return d()?p(k,I):(O(),I)}));return{register:function(t){const{stop:s,signature:a,start:n}=l(e).register(function(t){return{...t,shortcutSignature:y(t.shortcutSignature),currentKeySignature:C(t.shortcutSignature),key:function(t){const e=t.key||t.label;if(!c(e))throw new Error($.log(`非法的key类型=>${e}`,!0));return e}(t),status:f.ACTIVE,callback:function(t){var e,s;if(!u(t.callback))throw new Error($.log(`非法的callback类型=>${t.callback}`,!0));return t.debounce?r(t.callback,null!=(s=null==(e=t.debounceOption)?void 0:e.duration)?s:300):t.callback}(t)}}(t));return d()?(g(s),b(s),v(n)):A(),{stop:s,signature:a,start:n}},traverse:function(){return l(e).traverse},clear:function(){l(e).clear()},update:function(t,r){return l(e).update(t,r)},updateManagerDisabled:function(t){l(e).disabled=!!t}}}export{K as GlobalShortcutProvider,$ as ShortcutManager,T as useShortcuts};
1
+ import{findAncestor as t}from"../../../../shared/utils/index.js";import{useEventListener as e,useDebounceFn as r}from"@vueuse/core";import{once as s,pick as a,omit as n,isFunction as u,isString as c}from"lodash-es";import{reactive as o,ref as i,unref as l,computed as h,getCurrentInstance as d,inject as p,onBeforeUnmount as g,onDeactivated as b,onActivated as v}from"vue";import{ShortcutStatus as f,InjectionShortcutManager as k}from"../constants/index.js";import{normalizeSignatureInfo as y,getKeySignature as C,getDisplaySignature as m,isInvalidSignature as S,isKeyboardEvent as w,isInvalidKeyboardEvent as E,isShortcutProvider as M}from"../utils/index.js";const K=Symbol("Glob"),j=new Map;class ${constructor(t,e=K){this.shortcutCallbackMap=o(new Map),this.shortcutCache=i({}),this.disabled=!1,this.environmentEle=t||window,j.set(e,this)}static log(t,e=!1){const r=`[ShortcutManager] ${t}`;return!e&&console.warn(r),r}get traverse(){return[...Object.values(this.shortcutCache.value)].sort(((t,e)=>(t.order||0)-(e.order||0)))}query(t){return this.shortcutCache.value[t]}async update(t,e){var r,s;const a=null==(r=this.query(t))?void 0:r.currentKeySignature;e&&c(this.shortcutCache,e);const n=this.query(t);if(!n)return;await(null==(s=n.onUpdate)?void 0:s.call(n,t,e?y(e):void 0)),c(this.shortcutCache,e),n.currentKeySignature=C(e),n.shortcutSignature=y(e);const u=this.shortcutCallbackMap.get(a);function c(t,e){if(a!==C(e)){if(Object.values(t.value).some((t=>t.currentKeySignature===C(e))))throw`重复的快捷键=> ${m(e)}`;if(S(e))throw`非法的快捷键=>${e.key}`}}this.shortcutCallbackMap.delete(a),this.shortcutCallbackMap.set(n.currentKeySignature,u)}register(t){const e=this.query(t.key);return e?(e.status=f.ACTIVE,this.shortcutCallbackMap.set(e.currentKeySignature,t.callback),Object.assign(e,a(t,["debounce","debounceOption","label","order","key"])),r(e)):(this.shortcutCache.value[t.key]=n(t,["callback"]),this.shortcutCallbackMap.set(t.currentKeySignature,t.callback),r(this.shortcutCache.value[t.key]));function r(t){return{stop:()=>{t.status=f.INACTIVE},start:()=>{t.status=f.ACTIVE},signature:()=>t.currentKeySignature}}}start(){return this.handle?($.log(`请勿重复启动=>${this}`),this):(this.handle=async e=>{if(!w(e)||this.disabled)return;const r=t(e.target,M);if(r&&r!==l(this.environmentEle)||E(e))return;const s=C(e),a=this.shortcutCallbackMap.get(s);if(!a)return;e.preventDefault();const n=Object.values(this.shortcutCache.value).find((t=>t.currentKeySignature===s));n&&n.status===f.ACTIVE&&!n.disabled&&a(e)},e(this.environmentEle,"keyup",this.handle,{capture:!0}),this)}destroy(){var t;this.handle&&(null==(t=l(this.environmentEle))||t.removeEventListener("keyup",this.handle,{capture:!0})),this.handle=void 0,this.clear()}clear(){this.shortcutCallbackMap.clear(),this.shortcutCache.value={}}}const I=(new $).start(),O=s((()=>$.log("非setup语境下的shortcut将影响全局"))),A=s((()=>$.log("在非setup语境下使用register函数,组件销毁时可能需要手动调用stop函数使快捷键失活")));function T(t){const e=h((()=>{if(l(t)){const e=j.get(l(t));return e||$.log(`不存在的scope=>${t}, 将使用全局快捷键`),e||I}return d()?p(k,I):(O(),I)}));return{register:function(t){const{stop:s,signature:a,start:n}=l(e).register(function(t){return{...t,shortcutSignature:y(t.shortcutSignature),currentKeySignature:C(t.shortcutSignature),key:function(t){const e=t.key||t.label;if(!c(e))throw new Error($.log(`非法的key类型=>${e}`,!0));return e}(t),status:f.ACTIVE,callback:function(t){var e,s;if(!u(t.callback))throw new Error($.log(`非法的callback类型=>${t.callback}`,!0));return t.debounce?r(t.callback,null!=(s=null==(e=t.debounceOption)?void 0:e.duration)?s:300):t.callback}(t)}}(t));return d()?(g(s),b(s),v(n)):A(),{stop:s,signature:a,start:n}},traverse:function(){return l(e).traverse},clear:function(){l(e).clear()},update:function(t,r){return l(e).update(t,r)},updateManagerDisabled:function(t){l(e).disabled=!!t}}}export{K as GlobalShortcutProvider,$ as ShortcutManager,T as useShortcuts};