cnhis-design-vue 3.1.42-beta.6 → 3.1.42-beta.61

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 (277) hide show
  1. package/es/components/annotation-edit/src/AnnotationEdit.js +1 -1
  2. package/es/components/base-search/index.d.ts +2 -2
  3. package/es/components/base-search/src/index.vue.d.ts +2 -2
  4. package/es/components/base-search/src/index.vue.js +1 -1
  5. package/es/components/base-search/style/index.css +1 -1
  6. package/es/components/big-table/index.d.ts +3 -4
  7. package/es/components/big-table/src/BigTable.vue.d.ts +3 -4
  8. package/es/components/big-table/src/BigTable.vue2.js +1 -1
  9. package/es/components/big-table/src/components/edit-form/edit-select-table.d.ts +1 -1
  10. package/es/components/big-table/src/components/edit-form/edit-select.js +1 -1
  11. package/es/components/big-table/src/hooks/useEvent.js +1 -1
  12. package/es/components/big-table/src/hooks/useFormat.js +1 -1
  13. package/es/components/big-table/src/hooks/useNestTable.js +1 -1
  14. package/es/components/big-table/src/hooks/useTableParse.js +1 -1
  15. package/es/components/big-table/src/utils.d.ts +11 -1
  16. package/es/components/big-table/src/utils.js +1 -1
  17. package/es/components/big-table/style/index.css +1 -1
  18. package/es/components/bpmn-workflow/index.d.ts +12 -0
  19. package/es/components/bpmn-workflow/src/BpmnWorkflow.vue.d.ts +12 -0
  20. package/es/components/bpmn-workflow/src/BpmnWorkflow.vue.js +1 -1
  21. package/es/components/button-print/index.d.ts +32 -7
  22. package/es/components/button-print/src/ButtonPrint.vue.d.ts +32 -8
  23. package/es/components/button-print/src/ButtonPrint.vue2.js +1 -1
  24. package/es/components/button-print/src/components/EditFormat.vue.d.ts +4 -4
  25. package/es/components/button-print/src/components/IdentityVerification.vue.d.ts +4 -4
  26. package/es/components/button-print/src/utils/print.js +1 -1
  27. package/es/components/classification/index.d.ts +1 -1
  28. package/es/components/classification/src/index.vue.d.ts +2 -2
  29. package/es/components/classification/style/index.css +1 -1
  30. package/es/components/config-provider/src/ConfigProvider.js +1 -1
  31. package/es/components/config-provider/src/interface.d.ts +4 -4
  32. package/es/components/date-picker/index.d.ts +4 -0
  33. package/es/components/date-picker/src/DatePicker.vue.d.ts +4 -0
  34. package/es/components/date-picker/src/DatePicker.vue.js +1 -1
  35. package/es/components/fabric-chart/index.d.ts +2 -2
  36. package/es/components/fabric-chart/src/FabricChart.vue.d.ts +2 -2
  37. package/es/components/fabric-chart/src/hooks/useBirthProcess.d.ts +1 -0
  38. package/es/components/fabric-chart/src/hooks/useBirthProcess.js +1 -1
  39. package/es/components/fabric-chart/src/hooks/useBirthProcessChart.js +1 -1
  40. package/es/components/fabric-chart/src/hooks/useCenter.js +1 -1
  41. package/es/components/fabric-chart/src/hooks/useLeft.js +1 -1
  42. package/es/components/fabric-chart/src/hooks/useScaleColumn.d.ts +16 -0
  43. package/es/components/fabric-chart/src/hooks/useScaleColumn.js +1 -0
  44. package/es/components/field-set/index.d.ts +26 -81
  45. package/es/components/field-set/src/FieldSet.vue.d.ts +28 -32
  46. package/es/components/field-set/src/FieldSet.vue.js +1 -1
  47. package/es/components/field-set/style/index.css +1 -1
  48. package/es/components/form-config/index.d.ts +85 -44
  49. package/es/components/form-config/src/FormConfig.vue.d.ts +85 -44
  50. package/es/components/form-config/src/FormConfig.vue.js +1 -1
  51. package/es/components/form-config/src/components/FormConfigCreator.vue.d.ts +28 -14
  52. package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +45 -24
  53. package/es/components/form-config/src/components/FormConfigEdit.vue.js +1 -1
  54. package/es/components/form-config/src/components/renderer/DefaultNode.vue.js +1 -1
  55. package/es/components/form-config/src/constants/index.d.ts +19 -1
  56. package/es/components/form-config/src/constants/index.js +1 -1
  57. package/es/components/form-config/src/hooks/useConfigurationField.js +1 -1
  58. package/es/components/form-config/src/types/index.d.ts +1 -0
  59. package/es/components/form-render/index.d.ts +28 -14
  60. package/es/components/form-render/index.js +1 -1
  61. package/es/components/form-render/src/FormRender.vue.d.ts +28 -14
  62. package/es/components/form-render/src/FormRender.vue.js +1 -1
  63. package/es/components/form-render/src/FormRenderWrapper.vue.d.ts +28 -14
  64. package/es/components/form-render/src/components/renderer/combination.js +1 -1
  65. package/es/components/form-render/src/components/renderer/complex.d.ts +1 -1
  66. package/es/components/form-render/src/components/renderer/date.d.ts +4 -0
  67. package/es/components/form-render/src/components/renderer/date.js +1 -1
  68. package/es/components/form-render/src/components/renderer/jsonCombination/index.js +1 -1
  69. package/es/components/form-render/src/components/renderer/levelSearchCascader.d.ts +18 -0
  70. package/es/components/form-render/src/components/renderer/levelSearchCascader.js +1 -1
  71. package/es/components/form-render/src/components/renderer/lineBar/FormCollapse.vue.d.ts +1 -1
  72. package/es/components/form-render/src/components/renderer/lineBar/index.d.ts +1 -1
  73. package/es/components/form-render/src/components/renderer/radio&checkbox.d.ts +38 -2
  74. package/es/components/form-render/src/components/renderer/radio_checkbox.js +1 -1
  75. package/es/components/form-render/src/components/renderer/remoteSearch.d.ts +18 -0
  76. package/es/components/form-render/src/components/renderer/remoteSearch.js +1 -1
  77. package/es/components/form-render/src/components/renderer/searchCascade.d.ts +27 -0
  78. package/es/components/form-render/src/components/renderer/searchCascade.js +1 -1
  79. package/es/components/form-render/src/components/renderer/select.d.ts +32 -5
  80. package/es/components/form-render/src/components/renderer/select.js +1 -1
  81. package/es/components/form-render/src/hooks/index.d.ts +1 -1
  82. package/es/components/form-render/src/hooks/index.js +1 -1
  83. package/es/components/form-render/src/hooks/useFieldListAdaptor.js +1 -1
  84. package/es/components/form-render/src/hooks/useFieldNormalize.js +1 -1
  85. package/es/components/form-render/src/hooks/useFormAsyncQueue.d.ts +16 -0
  86. package/es/components/form-render/src/hooks/useFormAsyncQueue.js +1 -0
  87. package/es/components/form-render/src/hooks/useFormContext.js +1 -1
  88. package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +13 -8
  89. package/es/components/form-render/src/hooks/useFormRenderOptions.js +1 -1
  90. package/es/components/form-render/src/types/fieldItem.d.ts +11 -5
  91. package/es/components/form-render/src/types/index.d.ts +3 -2
  92. package/es/components/form-render/style/index.css +1 -1
  93. package/es/components/iho-table/index.d.ts +24 -5
  94. package/es/components/iho-table/src/IhoTable.vue.d.ts +24 -5
  95. package/es/components/iho-table/src/IhoTable.vue.js +1 -1
  96. package/es/components/iho-table/src/constants/index.d.ts +3 -2
  97. package/es/components/iho-table/src/constants/index.js +1 -1
  98. package/es/components/iho-table/src/hooks/tapHooks/index.d.ts +4 -4
  99. package/es/components/iho-table/src/hooks/tapHooks/index.js +1 -1
  100. package/es/components/iho-table/src/hooks/tapHooks/useConfigHooks.d.ts +22 -21
  101. package/es/components/iho-table/src/hooks/tapHooks/useConfigHooks.js +1 -1
  102. package/es/components/iho-table/src/hooks/tapHooks/useEventHooks.d.ts +60 -237
  103. package/es/components/iho-table/src/hooks/tapHooks/useExposeHooks.d.ts +1 -4
  104. package/es/components/iho-table/src/hooks/tapHooks/useFieldHooks.d.ts +4 -16
  105. package/es/components/iho-table/src/hooks/tapHooks/useSetupHooks.d.ts +2 -2
  106. package/es/components/iho-table/src/hooks/tapHooks/useSetupHooks.js +1 -1
  107. package/es/components/iho-table/src/hooks/useColumnConfigAdaptor.js +1 -1
  108. package/es/components/iho-table/src/plugins/anchorPlugin/useAnchor.js +1 -1
  109. package/es/components/iho-table/src/plugins/defaultConfigPlugin/index.js +1 -1
  110. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.d.ts +1 -1
  111. package/es/components/iho-table/src/plugins/filterRenderPlugin/filter.vue.js +1 -1
  112. package/es/components/iho-table/src/plugins/filterRenderPlugin/index.js +1 -1
  113. package/es/components/iho-table/src/plugins/highLightSetPlugin.d.ts +1 -0
  114. package/es/components/iho-table/src/plugins/highLightSetPlugin.js +1 -0
  115. package/es/components/iho-table/src/plugins/index.js +1 -1
  116. package/es/components/iho-table/src/plugins/keyboardEventPlugin/index.js +1 -1
  117. package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index.js +1 -1
  118. package/es/components/iho-table/src/plugins/maxCheckSizePlugin.d.ts +1 -0
  119. package/es/components/iho-table/src/plugins/maxCheckSizePlugin.js +1 -0
  120. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/editDate.vue.d.ts +4 -0
  121. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.d.ts +25 -3
  122. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/editSelect.js +1 -1
  123. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/index.js +1 -1
  124. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.d.ts +2 -1
  125. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/selectUtils.js +1 -1
  126. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +1 -1
  127. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.d.ts +2 -1
  128. package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/timeRendererPlugin/editTime.vue.js +1 -1
  129. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/defaultRendererPlugin.js +1 -1
  130. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/seqRendererPlugin.js +1 -1
  131. package/es/components/iho-table/src/plugins/rowDragPlugin/index.d.ts +1 -0
  132. package/es/components/iho-table/src/plugins/rowDragPlugin/index.js +1 -0
  133. package/es/components/iho-table/src/plugins/{rendererPlugins/widgets/variableHeightRendererPlugin.d.ts → varialbleHeightPlugin/index.d.ts} +1 -1
  134. package/es/components/iho-table/src/plugins/varialbleHeightPlugin/index.js +1 -0
  135. package/es/components/iho-table/src/types/index.d.ts +24 -5
  136. package/es/components/iho-table/src/types/pluginType.d.ts +10 -25
  137. package/es/components/iho-table/src/utils/index.d.ts +7 -3
  138. package/es/components/iho-table/src/utils/index.js +1 -1
  139. package/es/components/iho-table/style/iconfont.ttf +0 -0
  140. package/es/components/iho-table/style/index.css +1 -1
  141. package/es/components/index.css +1 -1
  142. package/es/components/index.d.ts +1 -0
  143. package/es/components/index.js +1 -1
  144. package/es/components/info-header/index.d.ts +61 -32
  145. package/es/components/info-header/src/InfoHeader.vue.d.ts +61 -32
  146. package/es/components/info-header/src/InfoHeader.vue.js +1 -1
  147. package/es/components/info-header/src/components/infoDescription/DescriptionItem.vue.d.ts +3 -3
  148. package/es/components/info-header/src/components/infoDescription/DescriptionList.vue.d.ts +3 -3
  149. package/es/components/info-header/src/components/infoDescription/HiddenContent.vue.d.ts +2 -2
  150. package/es/components/info-header/src/components/infoDescription/HiddenContent.vue.js +1 -1
  151. package/es/components/info-header/src/components/infoDescription/InfoEllipsis.vue.d.ts +1 -1
  152. package/es/components/info-header/src/components/infoDescription/index.vue.d.ts +31 -17
  153. package/es/components/info-header/src/components/patientInfo/index.vue.d.ts +29 -14
  154. package/es/components/info-header/src/components/patientInfo/index.vue.js +1 -1
  155. package/es/components/info-header/style/index.css +1 -1
  156. package/es/components/keyboard/index.d.ts +1 -1
  157. package/es/components/keyboard/src/Keyboard.vue.d.ts +1 -1
  158. package/es/components/keyboard/src/Keyboard.vue.js +1 -1
  159. package/es/components/keyboard/src/constants/index.js +1 -1
  160. package/es/components/keyboard/style/index.css +1 -1
  161. package/es/components/map/index.d.ts +2 -14
  162. package/es/components/map/src/Map.vue.d.ts +1 -14
  163. package/es/components/map/src/types/index.d.ts +19 -0
  164. package/es/components/map/src/types/index.js +1 -0
  165. package/es/components/recommend-search/index.d.ts +13 -128
  166. package/es/components/recommend-search/src/RecommendSearch.vue.d.ts +15 -130
  167. package/es/components/recommend-search/src/RecommendSearch.vue.js +1 -1
  168. package/es/components/recommend-search/src/components/BaseSearch.d.ts +84 -0
  169. package/es/components/recommend-search/src/components/BaseSearch.js +1 -0
  170. package/es/components/recommend-search/src/components/RecommendInput.vue.d.ts +3 -63
  171. package/es/components/recommend-search/src/components/RecommendInput.vue.js +1 -1
  172. package/es/components/recommend-search/src/components/RecommendMenu.vue.d.ts +1 -3
  173. package/es/components/recommend-search/src/components/RecommendMenu.vue.js +1 -1
  174. package/es/components/recommend-search/src/components/RecommendSelect.vue.d.ts +4 -62
  175. package/es/components/recommend-search/src/components/RecommendSelect.vue.js +1 -1
  176. package/es/components/recommend-search/src/constant/index.d.ts +3 -0
  177. package/es/components/recommend-search/src/constant/index.js +1 -1
  178. package/es/components/scale-view/index.d.ts +38 -224
  179. package/es/components/scale-view/index.js +1 -1
  180. package/es/components/scale-view/src/ScaleView.vue.d.ts +37 -224
  181. package/es/components/scale-view/src/ScaleView.vue.js +1 -1
  182. package/es/components/scale-view/src/components/AnswerParse.vue.d.ts +1 -43
  183. package/es/components/scale-view/src/components/AnswerParse.vue.js +1 -1
  184. package/es/components/scale-view/src/components/EvaluateCountdown.vue.d.ts +0 -42
  185. package/es/components/scale-view/src/components/EvaluateCountdown.vue.js +1 -1
  186. package/es/components/scale-view/src/components/formitem/r-address.js +1 -1
  187. package/es/components/scale-view/src/components/formitem/r-checkbox.js +1 -1
  188. package/es/components/scale-view/src/components/formitem/r-datetime.js +1 -1
  189. package/es/components/scale-view/src/components/formitem/r-map.js +1 -1
  190. package/es/components/scale-view/src/components/formitem/r-sign.js +1 -1
  191. package/es/components/scale-view/src/components/formitem/standard-modal.d.ts +8 -8
  192. package/es/components/scale-view/src/components/formitem/standard-modal.js +1 -1
  193. package/es/components/scale-view/src/components/formitem/text-over-tooltip/TextOverTooltip.vue.d.ts +1 -1
  194. package/es/components/scale-view/src/hooks/scaleview-computed.d.ts +1 -1
  195. package/es/components/scale-view/src/hooks/scaleview-computed.js +1 -1
  196. package/es/components/scale-view/src/hooks/scaleview-init.js +1 -1
  197. package/es/components/scale-view/src/hooks/scaleview-submit.d.ts +5 -1
  198. package/es/components/scale-view/src/hooks/scaleview-submit.js +1 -1
  199. package/es/components/scale-view/src/hooks/scaleview-validate.js +1 -1
  200. package/es/components/scale-view/src/hooks/use-component.d.ts +73 -3
  201. package/es/components/scale-view/src/hooks/use-evaluate.js +1 -1
  202. package/es/components/scale-view/src/hooks/use-event.js +1 -1
  203. package/es/components/scale-view/src/types/index.d.ts +7 -0
  204. package/es/components/scale-view/src/types/index.js +1 -0
  205. package/es/components/scale-view/style/index.css +1 -1
  206. package/es/components/scale-view/style/scale-view-iconfont.ttf +0 -0
  207. package/es/components/search-cascader/index.d.ts +12 -1
  208. package/es/components/search-cascader/src/SearchCascader.vue.d.ts +12 -1
  209. package/es/components/search-cascader/src/SearchCascader.vue.js +1 -1
  210. package/es/components/search-cascader/src/components/SearchMenu.d.ts +8 -1
  211. package/es/components/search-cascader/src/components/SearchMenu.js +1 -1
  212. package/es/components/search-cascader/src/constants/index.d.ts +1 -0
  213. package/es/components/search-cascader/src/constants/index.js +1 -1
  214. package/es/components/select-label/src/LabelFormContent.vue.js +1 -1
  215. package/es/components/select-label/src/SelectLabel.vue2.js +1 -1
  216. package/es/components/select-label/style/index.css +1 -1
  217. package/es/components/select-person/index.d.ts +43 -10
  218. package/es/components/select-person/src/SelectPerson.vue.d.ts +29 -8
  219. package/es/components/select-person/src/SelectPerson.vue2.js +1 -1
  220. package/es/components/select-person/src/utils/index.js +1 -1
  221. package/es/components/shortcut-setter/index.d.ts +33 -17
  222. package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +33 -17
  223. package/es/components/steps-wheel/src/StepsWheel.vue.js +1 -1
  224. package/es/components/steps-wheel/src/constants/index.js +1 -1
  225. package/es/components/steps-wheel/style/index.css +1 -1
  226. package/es/components/table-filter/index.d.ts +0 -1
  227. package/es/components/table-filter/index.js +1 -1
  228. package/es/components/table-filter/src/components/render-widget/components/CheckboxGroup.vue.d.ts +1 -1
  229. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.d.ts +1 -1
  230. package/es/components/table-filter/src/components/render-widget/widgetCfgMaps.js +1 -1
  231. package/es/components/table-filter/src/hooks/useMixins.js +1 -1
  232. package/es/components/table-filter/src/tool/baseOptions.d.ts +0 -10
  233. package/es/components/table-filter/src/tool/baseOptions.js +1 -1
  234. package/es/components/table-filter/src/tool/generateDefOptions.d.ts +0 -7
  235. package/es/components/table-filter/src/tool/generateDefOptions.js +1 -1
  236. package/es/components/table-filter/src/types/index.d.ts +11 -76
  237. package/es/components/time-picker/src/TimePicker.vue.js +1 -1
  238. package/es/components/vod-chunk-upload/index.d.ts +73 -3
  239. package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.d.ts +73 -3
  240. package/es/components/vod-chunk-upload/src/vod-chunk-upload/vod-chunk-upload.vue.js +1 -1
  241. package/es/env.d.ts +1 -0
  242. package/es/shared/components/TextOverTooltip/TextOverTooltip.vue.d.ts +1 -1
  243. package/es/shared/components/TextOverTooltip/TextOverTooltip.vue.js +1 -1
  244. package/es/shared/{mixins → hooks}/index.d.ts +1 -0
  245. package/es/shared/{mixins → hooks}/index.js +1 -1
  246. package/es/{components/form-render/src → shared}/hooks/useAsyncQueue.d.ts +0 -14
  247. package/es/shared/hooks/useAsyncQueue.js +1 -0
  248. package/es/shared/{mixins → hooks}/useDateTime.d.ts +2 -2
  249. package/es/shared/hooks/useDateTime.js +1 -0
  250. package/es/shared/utils/anime.d.ts +1 -1
  251. package/es/shared/utils/anime.js +1 -1
  252. package/es/shared/utils/index.d.ts +3 -14
  253. package/es/shared/utils/index.js +1 -1
  254. package/es/shared/utils/vexutils.d.ts +2 -2
  255. package/es/shared/utils/vexutils.js +1 -1
  256. package/es/shared/utils/vexutilsExpand.d.ts +254 -0
  257. package/es/shared/utils/vexutilsExpand.js +1 -0
  258. package/package.json +2 -2
  259. package/es/components/form-render/src/hooks/useAsyncQueue.js +0 -1
  260. package/es/components/iho-table/src/plugins/rendererPlugins/widgets/variableHeightRendererPlugin.js +0 -1
  261. package/es/components/recommend-search/src/components/BaseSearch.vue.d.ts +0 -143
  262. package/es/components/recommend-search/src/components/BaseSearch.vue.js +0 -1
  263. package/es/components/scale-view/src/hooks/scaleview-props.d.ts +0 -115
  264. package/es/components/scale-view/src/hooks/scaleview-props.js +0 -1
  265. package/es/components/table-filter/src/hooks/export.d.ts +0 -1
  266. package/es/components/table-filter/src/hooks/export.js +0 -1
  267. package/es/components/table-filter/src/tool/getWidgetType.d.ts +0 -1
  268. package/es/components/table-filter/src/tool/getWidgetType.js +0 -1
  269. package/es/shared/mixins/useDateTime.js +0 -1
  270. package/es/shared/utils/colorLog.d.ts +0 -31
  271. package/es/shared/utils/colorLog.js +0 -1
  272. /package/es/components/base-search/style/{iconfont.ttf → base-search-iconfont.ttf} +0 -0
  273. /package/es/components/classification/style/{iconfont.ttf → classification-iconfont.ttf} +0 -0
  274. /package/es/components/info-header/style/{iconfont.ttf → info-header-font.ttf} +0 -0
  275. /package/es/components/select-label/style/{iconfont.ttf → select-label-iconfont.ttf} +0 -0
  276. /package/es/shared/{mixins → hooks}/useTheme.d.ts +0 -0
  277. /package/es/shared/{mixins → hooks}/useTheme.js +0 -0
@@ -103,9 +103,11 @@ declare const _default: import("vue").DefineComponent<{
103
103
  emitValue: (value: ValueType) => void;
104
104
  onClear: () => void;
105
105
  onClick: (evt: Event) => void;
106
+ onKeydown: (evt: KeyboardEvent) => void;
106
107
  cssVariable: {
107
108
  '--menu-width': number;
108
109
  };
110
+ eventBus: AnyObject;
109
111
  uuid: string;
110
112
  show: import("vue").Ref<boolean> | import("vue").WritableComputedRef<boolean>;
111
113
  patternContent: import("vue").Ref<string>;
@@ -116,11 +118,13 @@ declare const _default: import("vue").DefineComponent<{
116
118
  inputRef: import("vue").Ref<any>;
117
119
  popoverRef: import("vue").Ref<any>;
118
120
  currentNode: import("vue").Ref<AnyObject | undefined>;
121
+ cursorNode: import("vue").Ref<AnyObject | undefined>;
119
122
  loadingNode: import("vue").Ref<Nullable<AnyObject>>;
120
123
  search: (payload?: {
121
124
  type: 'search' | 'update';
122
125
  node: AnyObject;
123
126
  }, keyword?: string) => Promise<void>;
127
+ changeCursorNode: (node: AnyObject) => void;
124
128
  NInput: any;
125
129
  NPopover: any;
126
130
  SearchMenu: import("vue").DefineComponent<{
@@ -143,7 +147,10 @@ declare const _default: import("vue").DefineComponent<{
143
147
  currentNode: {
144
148
  type: PropType<AnyObject>;
145
149
  };
146
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "nodeClick"[], "nodeClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
150
+ cursorNode: {
151
+ type: PropType<AnyObject>;
152
+ };
153
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("nodeClick" | "changeCursor")[], "nodeClick" | "changeCursor", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
147
154
  childKey: {
148
155
  type: StringConstructor;
149
156
  default: string;
@@ -163,8 +170,12 @@ declare const _default: import("vue").DefineComponent<{
163
170
  currentNode: {
164
171
  type: PropType<AnyObject>;
165
172
  };
173
+ cursorNode: {
174
+ type: PropType<AnyObject>;
175
+ };
166
176
  }>> & {
167
177
  onNodeClick?: ((...args: any[]) => any) | undefined;
178
+ onChangeCursor?: ((...args: any[]) => any) | undefined;
168
179
  }, {
169
180
  options: AnyObject[];
170
181
  valueKey: string;
@@ -1 +1 @@
1
- import{defineComponent as e,provide as a,computed as l,ref as t,nextTick as r,openBlock as o,createBlock as u,unref as n,isRef as s,normalizeStyle as i,withCtx as c,createVNode as p,withKeys as v,createElementVNode as d,renderSlot as f}from"vue";import{uuidGenerator as y}from"../../../shared/utils/index.js";import{NOOP as h}from"@vue/shared";import{useVModel as m,onClickOutside as b,useDebounceFn as g}from"@vueuse/core";import{isString as w,isArray as k,isFunction as S,isObject as _}from"lodash-es";import{NPopover as K,NInput as C}from"naive-ui";import{InjectionSearchCascaderCheckAbleLevel as j,InjectionSearchCascaderLoadingNode as N,InjectionSearchCascaderValue as P}from"./constants/index.js";import{useCssVariable as x}from"./hooks/useCssVariable.js";import{SearchMenu as A}from"./components/SearchMenu.js";import V from"../../../_virtual/plugin-vue_export-helper.js";const F=["id"];var L=V(e({__name:"SearchCascader",props:{value:{type:[String,Array]},show:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},childKey:{type:String,default:"children"},placeholder:{type:String,default:"请选择"},editPlaceholder:{type:String,default:"请输入关键字进行搜索"},options:{type:Array,default:()=>[]},search:{type:Function},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},checkAbleLevel:{type:[Number,String],default:"last"},beforeSetValue:{type:Function}},emits:["update:value","focus","update:show"],setup(e,{emit:V}){const L=e;function U(){var e;e=[],Promise.resolve(S(L.beforeSetValue)?L.beforeSetValue(e):e).then((e=>V("update:value",e)),h)}function B(e){var a;"INPUT"===(null==(a=e.target)?void 0:a.tagName)&&function(){if(I.value)return;I.value=!0,M.value="",J()}()}const R=x(),E=y(),I=m(L,"show",V);a(j,l((()=>L.checkAbleLevel)));const M=t(""),T=l({get:()=>I.value?M.value:w(L.value)?L.value:k(L.value)?L.value.reduce(((e,a,l)=>0===l?a[L.labelKey]:e+" / "+a[L.labelKey]),""):"",set(e){M.value=e,J(void 0,e)}});function $(e){V("focus",e)}async function q(){var e;I.value=!1,null==(e=z.value)||e.blur()}const z=t();b(z,(e=>{var a;if(!I.value)return;const l=e;if(!l.target)return q();!function(e){let a=!1,l=e;for(;l;){if(l.id===E){a=!0;break}l=l.parentElement}return a}(l.target)?q():null==(a=z.value)||a.focus()}));const D=t(),G=t(),H=t(null);a(N,H),a(P,l((()=>L.value)));const J=g((async(e,a)=>{var l;const{type:t,node:o}=e||{};try{if("update"===t)return void(S(L.search)&&L.search({...o,isLeaf:!0}));H.value=o;const e=await(S(L.search)&&L.search(o,a));G.value=_(e)?e:o}finally{H.value=null,await r(),null==(l=D.value)||l.syncPosition()}}),400);return(a,l)=>(o(),u(n(K),{class:"search-cascader",trigger:"manual",show:n(I),"onUpdate:show":l[1]||(l[1]=e=>s(I)?I.value=e:null),"show-arrow":!1,placement:"bottom-start",style:i(n(R)),width:e.options.length?void 0:"trigger",ref_key:"popoverRef",ref:D},{trigger:c((()=>[p(n(C),{class:"search-cascader__input",placeholder:n(I)?e.editPlaceholder:e.placeholder,clearable:e.clearable,onClear:U,value:n(T),"onUpdate:value":l[0]||(l[0]=e=>s(T)?T.value=e:null),ref_key:"inputRef",ref:z,onFocus:$,onClick:B,onKeydown:v(B,["enter"])},null,8,["placeholder","clearable","value","onKeydown"])])),default:c((()=>[d("section",{id:n(E)},[p(n(A),{"label-key":e.labelKey,"value-key":e.valueKey,options:e.options,onNodeClick:n(J),"current-node":G.value},{empty:c((()=>[f(a.$slots,"empty")])),_:3},8,["label-key","value-key","options","onNodeClick","current-node"])],8,F)])),_:3},8,["show","style","width"]))}}),[["__file","SearchCascader.vue"]]);export{L as default};
1
+ import{defineComponent as e,provide as a,computed as l,ref as t,nextTick as r,watch as o,openBlock as u,createBlock as n,unref as s,isRef as i,normalizeStyle as c,withCtx as v,createVNode as d,createElementVNode as p,renderSlot as f}from"vue";import{uuidGenerator as y}from"../../../shared/utils/index.js";import{NOOP as h}from"@vue/shared";import{useDebounceFn as m,useEventBus as g,useVModel as b,onClickOutside as w}from"@vueuse/core";import{isString as k,isArray as S,isFunction as _,isObject as K}from"lodash-es";import{NPopover as C,NInput as N}from"naive-ui";import{InjectionSearchCascaderCheckAbleLevel as P,InjectionKeyboardEventBus as j,InjectionSearchCascaderLoadingNode as x,InjectionSearchCascaderValue as A}from"./constants/index.js";import{useCssVariable as U}from"./hooks/useCssVariable.js";import{SearchMenu as V}from"./components/SearchMenu.js";import F from"../../../_virtual/plugin-vue_export-helper.js";const L=["id"];var B=F(e({__name:"SearchCascader",props:{value:{type:[String,Array]},show:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},childKey:{type:String,default:"children"},placeholder:{type:String,default:"请选择"},editPlaceholder:{type:String,default:"请输入关键字进行搜索"},options:{type:Array,default:()=>[]},search:{type:Function},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},checkAbleLevel:{type:[Number,String],default:"last"},beforeSetValue:{type:Function}},emits:["update:value","focus","update:show"],setup(e,{emit:F}){const B=e;function E(){var e;e=[],Promise.resolve(_(B.beforeSetValue)?B.beforeSetValue(e):e).then((e=>F("update:value",e)),h)}function I(e){var a;"INPUT"===(null==(a=e.target)?void 0:a.tagName)&&H()}const R=m((e=>{var a;"INPUT"!==(null==(a=e.target)?void 0:a.tagName)||"Enter"!==e.code||q.value?M.emit(e.key):H()}),50),T=U(),M=g("cascaderKeydown"),$=y(),q=b(B,"show",F);a(P,l((()=>B.checkAbleLevel))),a(j,M);const z=t(""),D=l({get:()=>q.value?z.value:k(B.value)?B.value:S(B.value)?B.value.reduce(((e,a,l)=>0===l?a[B.labelKey]:e+" / "+a[B.labelKey]),""):"",set(e){z.value=e,Z(void 0,e)}});function G(e){F("focus",e)}function H(){q.value||(q.value=!0,z.value="",Z())}async function J(){var e;q.value=!1,null==(e=O.value)||e.blur()}const O=t();w(O,(e=>{var a;if(!q.value)return;const l=e;if(!l.target)return J();!function(e){let a=!1,l=e;for(;l;){if(l.id===$){a=!0;break}l=l.parentElement}return a}(l.target)?J():null==(a=O.value)||a.focus()}));const Q=t(),W=t(),X=t(),Y=t(null);a(x,Y),a(A,l((()=>B.value)));const Z=m((async(e,a)=>{var l;const{type:t,node:o}=e||{};try{if("update"===t)return void(_(B.search)&&B.search({...o,isLeaf:!0}));Y.value=o;const e=await(_(B.search)&&B.search(o,a));W.value=K(e)?e:o}finally{Y.value=null,await r(),null==(l=Q.value)||l.syncPosition()}}),400),ee=e=>{X.value=e};return o((()=>B.show),(e=>{e&&(X.value={})})),(a,l)=>(u(),n(s(C),{class:"search-cascader",trigger:"manual",show:s(q),"onUpdate:show":l[1]||(l[1]=e=>i(q)?q.value=e:null),"show-arrow":!1,placement:"bottom-start",style:c(s(T)),width:e.options.length?void 0:"trigger",ref_key:"popoverRef",ref:Q},{trigger:v((()=>[d(s(N),{class:"search-cascader__input",placeholder:s(q)?e.editPlaceholder:e.placeholder,clearable:e.clearable,onClear:E,value:s(D),"onUpdate:value":l[0]||(l[0]=e=>i(D)?D.value=e:null),ref_key:"inputRef",ref:O,onFocus:G,onClick:I,onKeydown:s(R)},null,8,["placeholder","clearable","value","onKeydown"])])),default:v((()=>[p("section",{id:s($)},[d(s(V),{"label-key":e.labelKey,"value-key":e.valueKey,options:e.options,onNodeClick:s(Z),onChangeCursor:ee,"current-node":W.value,"cursor-node":X.value},{empty:v((()=>[f(a.$slots,"empty")])),_:3},8,["label-key","value-key","options","onNodeClick","current-node","cursor-node"])],8,L)])),_:3},8,["show","style","width"]))}}),[["__file","SearchCascader.vue"]]);export{B as default};
@@ -20,7 +20,10 @@ export declare const SearchMenu: import("vue").DefineComponent<{
20
20
  currentNode: {
21
21
  type: PropType<AnyObject>;
22
22
  };
23
- }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "nodeClick"[], "nodeClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
23
+ cursorNode: {
24
+ type: PropType<AnyObject>;
25
+ };
26
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("nodeClick" | "changeCursor")[], "nodeClick" | "changeCursor", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
24
27
  childKey: {
25
28
  type: StringConstructor;
26
29
  default: string;
@@ -40,8 +43,12 @@ export declare const SearchMenu: import("vue").DefineComponent<{
40
43
  currentNode: {
41
44
  type: PropType<AnyObject>;
42
45
  };
46
+ cursorNode: {
47
+ type: PropType<AnyObject>;
48
+ };
43
49
  }>> & {
44
50
  onNodeClick?: ((...args: any[]) => any) | undefined;
51
+ onChangeCursor?: ((...args: any[]) => any) | undefined;
45
52
  }, {
46
53
  options: AnyObject[];
47
54
  valueKey: string;
@@ -1 +1 @@
1
- import{defineComponent as e,computed as t,inject as a,createVNode as l,withModifiers as r,ref as n,createTextVNode as o}from"vue";import{traverse as i}from"../../../../shared/utils/index.js";import{Reload as s,ChevronForward as u}from"@vicons/ionicons5";import{NOOP as c}from"@vue/shared";import{useVirtualList as p}from"@vueuse/core";import{isNumber as d,isArray as v,isEqual as y,isString as f,isFunction as m}from"lodash-es";import{NCheckbox as h}from"naive-ui";import{InjectionSearchCascaderLoadingNode as K,InjectionSearchCascaderValue as b,InjectionSearchCascaderCheckAbleLevel as _}from"../constants/index.js";const k=e({props:{options:{type:Array,default:()=>[]},activeNodes:{type:Array,default:()=>[]},level:{type:Number,required:!0},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"}},emits:["nodeClick"],setup(e,{emit:n}){const o=t((()=>e.options)),{list:i,containerProps:m,wrapperProps:k}=p(o,{itemHeight:32,overscan:5}),g=a(K),C=a(b),N=a(_),S=t((()=>d(N.value)&&N.value<=e.level));function x(t){const a=function(e){const t=[e];let a=e;for(;a.parent;)a=a.parent,t.unshift(a);return t}(t);if(v(C.value))return y(l(a,e.valueKey),l(C.value,e.valueKey));if(f(C.value)){const t=C.value.split("/").map((e=>e.trim()));return y(t,l(a,e.labelKey))}return!1;function l(e,t){return e.map((e=>e[t]))}}return()=>l("div",{class:"search-cascader__optionWrapper",ref:m.ref,style:m.style,onScroll:m.onScroll},[l("div",{style:k.value.style},[i.value.map((t=>{return l("div",{class:["search-cascader__option",{"search-cascader__option--active":(a=t.data,null==(o=e.activeNodes)?void 0:o.includes(a))}],onClick:()=>n("nodeClick",{type:"search",node:t.data}),title:t.data[e.labelKey]},[l("div",{class:"search-cascader__optionText"},[S.value?l(h,{style:{marginRight:"8px"},checked:x(t.data),onClick:r(c,["stop"]),onUpdateChecked:e=>e&&function(e){n("nodeClick",{type:"update",node:e})}(t.data)},null):null,t.data[e.labelKey]]),g.value===t.data?l(s,{class:"rotate"},null):t.data.isLeaf?null:l(u,null,null)]);var a,o}))])])}}),g=e({props:{childKey:{type:String,default:"children"},options:{type:Array,default:()=>[]},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},currentNode:{type:Object}},emits:["nodeClick"],setup(e,{slots:t,emit:a}){const r=n([]);function s(t,n){return l(k,{level:n+1,labelKey:e.labelKey,valueKey:e.valueKey,activeNodes:r.value,onNodeClick:e=>a("nodeClick",e),options:t},null)}function u(t){let a=!1;return i(t,((t,l)=>{t===e.currentNode&&(a=!0,l())}),["children"]),a}function c(){if(!v(e.options)||!e.currentNode)return[];const t=[e.options];let a=e.options;for(r.value.length=0;v(a);){const l=a.find(u);if(!l)break;r.value.push(l),a=l[e.childKey],t.push(a)}return t}return()=>l("section",{class:"search-cascader__menuWrapper"},[v(e.options)&&e.options.length?e.currentNode?c().map(s):s(e.options,0):l("section",{class:"search-cascader__emptyWrapper"},[m(t.empty)?t.empty():l("section",null,[o("empty")])])])}});export{g as SearchMenu};
1
+ import{defineComponent as e,computed as r,inject as t,createVNode as o,withModifiers as n,ref as a,createTextVNode as l}from"vue";import{traverse as c}from"../../../../shared/utils/index.js";import{Reload as s,ChevronForward as u}from"@vicons/ionicons5";import{NOOP as i}from"@vue/shared";import{useVirtualList as d}from"@vueuse/core";import{isNumber as p,isArray as f,isEqual as v,isString as y,isFunction as h}from"lodash-es";import{NCheckbox as m}from"naive-ui";import{InjectionSearchCascaderLoadingNode as g,InjectionSearchCascaderValue as N,InjectionSearchCascaderCheckAbleLevel as C,InjectionKeyboardEventBus as b}from"../constants/index.js";const k=e({props:{options:{type:Array,default:()=>[]},activeNodes:{type:Array,default:()=>[]},level:{type:Number,required:!0},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},cursorNode:{type:Object,default:()=>({})}},emits:["nodeClick","changeCursor"],setup(e,{emit:a}){const l=r((()=>e.options)),{list:c,containerProps:h,wrapperProps:k}=d(l,{itemHeight:32,overscan:5}),K=t(g),_=t(N),x=t(C),A=t(b),S=r((()=>p(x.value)&&x.value<=e.level));function j(e){return Object.keys(e).length<=0}function w(r){return e.cursorNode==r}function I(r){const t=function(e){const r=[e];let t=e;for(;t.parent;)t=t.parent,r.unshift(t);return r}(r);if(f(_.value))return v(o(t,e.valueKey),o(_.value,e.valueKey));if(y(_.value)){const r=_.value.split("/").map((e=>e.trim()));return v(r,o(t,e.labelKey))}return!1;function o(e,r){return e.map((e=>e[r]))}}function O(e){const r=h.ref.value;if(r){const t=32*e-(null==r?void 0:r.clientHeight);r.scrollTo(0,t>0?t:0)}}return A.on((function(r){function t(){return S.value?a("nodeClick",{type:"update",node:e.cursorNode}):a("nodeClick",{type:"search",node:e.cursorNode})}if("ArrowUp"===r){if(j(e.cursorNode))return;const r=l.value.findIndex((r=>r===e.cursorNode));if(r>=0){const e=0===r?l.value.length-1:r-1,t=l.value[e];a("changeCursor",t),O(e+3)}}if("ArrowRight"===r){if(j(e.cursorNode))return;a("nodeClick",{type:"search",node:e.cursorNode}),a("changeCursor",{})}if("ArrowDown"===r){if(j(e.cursorNode))return a("changeCursor",l.value[0]);const r=l.value.findIndex((r=>r===e.cursorNode));if(r>=0){const e=r>=l.value.length-1?0:r+1,t=l.value[e];a("changeCursor",t),O(e+1)}}if("ArrowLeft"===r&&e.activeNodes.length){const r=e.activeNodes.slice(-1);a("changeCursor",r[0])}" "===r&&t(),"Enter"===r&&t()})),()=>o("div",{class:"search-cascader__optionWrapper",ref:h.ref,style:h.style,onScroll:h.onScroll},[o("div",{style:k.value.style},[c.value.map((r=>{return o("div",{class:["search-cascader__option",{"search-cascader__option--active":(t=r.data,(null==(l=e.activeNodes)?void 0:l.includes(t))||w(r.data))}],onClick:()=>a("nodeClick",{type:"search",node:r.data}),title:r.data[e.labelKey]},[o("div",{class:"search-cascader__optionText"},[S.value?o(m,{style:{marginRight:"8px"},checked:I(r.data),onClick:n(i,["stop"]),onUpdateChecked:e=>e&&function(e){a("nodeClick",{type:"update",node:e})}(r.data)},null):null,r.data[e.labelKey]]),K.value===r.data?o(s,{class:"rotate"},null):r.data.isLeaf?null:o(u,null,null)]);var t,l}))])])}}),K=e({props:{childKey:{type:String,default:"children"},options:{type:Array,default:()=>[]},labelKey:{type:String,default:"label"},valueKey:{type:String,default:"value"},currentNode:{type:Object},cursorNode:{type:Object}},emits:["nodeClick","changeCursor"],setup(e,{slots:r,emit:t}){const n=a([]);function s(r,a){return o(k,{level:a+1,labelKey:e.labelKey,valueKey:e.valueKey,activeNodes:n.value,onNodeClick:e=>t("nodeClick",e),onChangeCursor:e=>t("changeCursor",e),options:r,cursorNode:e.cursorNode},null)}function u(r){let t=!1;return c(r,((r,o)=>{r===e.currentNode&&(t=!0,o())}),["children"]),t}function i(){if(!f(e.options)||!e.currentNode)return[];const r=[e.options];let t=e.options;for(n.value.length=0;f(t);){const o=t.find(u);if(!o)break;n.value.push(o),t=o[e.childKey],r.push(t)}if(e.cursorNode){const t=r.findIndex((r=>r.findIndex((r=>r===e.cursorNode))>=0));if(t>=0){const e=r.slice(0,t+1);return n.value.splice(t,r.length),e}}return r}return()=>o("section",{class:"search-cascader__menuWrapper"},[f(e.options)&&e.options.length?e.currentNode?i().map(s):s(e.options,0):o("section",{class:"search-cascader__emptyWrapper"},[h(r.empty)?r.empty():o("section",null,[l("empty")])])])}});export{K as SearchMenu};
@@ -3,3 +3,4 @@ import { ComputedRef, InjectionKey, Ref } from 'vue';
3
3
  export declare const InjectionSearchCascaderLoadingNode: InjectionKey<Ref<Nullable<AnyObject>>>;
4
4
  export declare const InjectionSearchCascaderValue: InjectionKey<ComputedRef<AnyObject[] | string>>;
5
5
  export declare const InjectionSearchCascaderCheckAbleLevel: InjectionKey<ComputedRef<'last' | number>>;
6
+ export declare const InjectionKeyboardEventBus: InjectionKey<AnyObject>;
@@ -1 +1 @@
1
- const e=Symbol("InjectionSearchCascaderLoadingNode "),a=Symbol("InjectionSearchCascaderValue "),c=Symbol("InjectionSearchCascaderCheckAbleLevel");export{c as InjectionSearchCascaderCheckAbleLevel,e as InjectionSearchCascaderLoadingNode,a as InjectionSearchCascaderValue};
1
+ const e=Symbol("InjectionSearchCascaderLoadingNode "),o=Symbol("InjectionSearchCascaderValue "),a=Symbol("InjectionSearchCascaderCheckAbleLevel"),c=Symbol("InjectionKeyboardEventBus");export{c as InjectionKeyboardEventBus,a as InjectionSearchCascaderCheckAbleLevel,e as InjectionSearchCascaderLoadingNode,o as InjectionSearchCascaderValue};
@@ -1 +1 @@
1
- import{defineComponent as t,ref as e,reactive as l,computed as a,watch as i,openBlock as n,createElementBlock as s,unref as d,createCommentVNode as o,withDirectives as r,createElementVNode as c,normalizeClass as b,createVNode as u,withCtx as p,Fragment as f,renderList as h,createBlock as y,createTextVNode as v,toDisplayString as m,vShow as g,nextTick as C}from"vue";import{useMessage as L,NAnchor as I,NAnchorLink as S}from"naive-ui";import E from"./components/label-classify.vue.js";import{handleLabelColor as w}from"../../../shared/utils/vexutils.js";import x from"../../../_virtual/plugin-vue_export-helper.js";import A from"xe-utils";const O={key:0,class:"label-disable-wrap"},K=[c("p",{class:"label-disable-title"},"无可选标签",-1),c("p",{class:"label-disable-desc"},"请联系管理员进行标签管理设置",-1)],j={style:{height:"100%"}},k={class:"label-wrap"},T=["id"],_={class:"edit-label-type"};var B=x(t({__name:"LabelFormContent",props:{item:{default:()=>({})},isEdit:{type:Boolean,default:!0},isLock:{type:Boolean,default:!1},labelSelectedList:null,isChangeWindow:{type:Boolean},getLabelList:{type:Function,default:()=>Promise.resolve({rows:[]})},deleteLabel:{type:Function,default:()=>Promise.resolve({status:!0})},saveLabelItem:{type:Function,default:()=>Promise.resolve({status:!0})},labelOptions:null,sourceType:{default:""},explicit:{type:Boolean,default:!1}},emits:["explicitOnChange","change","updateLabelData"],setup(t,{expose:x,emit:B}){const D=t,F=L(),V=e(null),P=l({editLabelItem:{},inited:!1,labelSelectedEdit:[],labelAnchorKey:"",cacheAnchorKey:"",labelConfig:{}});let N=e(0);const W=a((()=>{if(!P.inited)return!1;let t=P.labelConfig;return!t||Object.keys(t).every((e=>!t[e].itemList))})),$=a((()=>{let t=[].concat(...P.labelSelectedEdit,...D.labelSelectedList);return J(t,"labelId")})),q=a((()=>{const t=$.value||[];return Array.isArray(t)?t.map((t=>t.labelId)):[]})),J=(t,e)=>{let l={};return t.reduce(((t,a)=>(!l[a[e]]&&(l[a[e]]=t.push(a)),t)),[])},R=()=>{if(P.labelSelectedEdit=$.value,"object"==typeof P.labelConfig){Object.keys(P.labelConfig||{}).forEach((t=>{var e;let l=(null==(e=P.labelConfig[t])?void 0:e.itemList)||[];l.length&&l.forEach((t=>{q.value.includes(t.labelId)&&(t.isSelect=!0)}))}))}},z=(t,e)=>{if(!t)return;let l=Object.keys(t)||[];if(!l.length)return;let a=t[l[0]].curKey;if(e&&"string"==typeof e){let[i]=e.split("~"),n=l.find((e=>t[e]&&t[e].curKey&&t[e].curKey.includes(i)));n&&(a=t[n].curKey)}a&&Y(a)},G=(t,e)=>{e.showAdd=!0;const l=t.target.nextElementSibling;C((()=>{var t;null==(t=null==l?void 0:l.firstChild)||t.focus()}))},H=(t,e)=>{setTimeout((()=>{e.addVal?Q(e):e.showAdd=!1}),150)},M=(t,e)=>{e.addVal="",e.showAdd=!1},Q=async t=>{var e;if(!!t.itemList.filter((t=>!(t.isPublic&&1==t.isPublic))).find((e=>e.labelName===t.addVal)))return F.error("标签名称重复!"),!1;let l="";l=(null==(e=t.itemList)?void 0:e.length)?t.itemList[0].parentColor||t.parentColor||"":(null==t?void 0:t.parentColor)||"";const a={type:t.typeId,name:t.addVal,parentColor:l},{status:i}=await D.saveLabelItem(a,t);i&&(F.success("添加成功!"),B("updateLabelData"),t.showAdd=!1)},U=(t,e,l,a)=>{var i;const n=l.itemList,s=l.multipleChoice;let d=(null==(i=P.labelSelectedEdit)?void 0:i.length)&&A.clone(P.labelSelectedEdit,!0)||[];if(t){if(d.some((t=>t.labelId==e.labelId)))return;if(2==s){const{typeId:t,labelId:l}=e;d=d.filter((e=>e.typeId!==t)),n.forEach((t=>{t.labelId!==l&&(t.isSelect=!1)}))}d.push(e)}else{const t=d.findIndex((t=>t.labelId==e.labelId));-1!=t&&d.splice(t,1)}P.labelSelectedEdit=[...d],N.value++,D.explicit&&B("explicitOnChange",[...P.labelSelectedEdit])},X=async t=>{const{status:e}=await D.deleteLabel(t,D.item);if(e){F.success("删除成功!");for(const e in P.labelConfig){const l=P.labelConfig[e].itemList.findIndex((e=>e.labelId==t.labelId));-1!=l&&P.labelConfig[e].itemList.splice(l,1)}const e=P.labelSelectedEdit||[],l=D.labelSelectedList||[];if(e&&e.length){const l=e.findIndex((e=>e.labelId==t.labelId));-1!=l&&e.splice(l,1)}if(l&&l.length){const e=l.findIndex((e=>e.labelId==t.labelId));-1!=e&&l.splice(e,1),B("change",[...l],D.item)}B("updateLabelData")}else F.warning("删除失败")},Y=t=>{t&&setTimeout((()=>{let e,l="#"+t;e=V.value.querySelector("a[href='"+l+"']"),e&&e.click(),P.labelAnchorKey=t}),32)},Z=t=>{t.preventDefault()},tt=t=>{if(!t)return;let e=t.slice(1);P.cacheAnchorKey=e},et=()=>{var t;return null==(t=V.value)?void 0:t.querySelector(".right-label-wrap")};return i((()=>D.labelOptions),(t=>{t&&(()=>{var t;if(D.isLock)return;const e=JSON.parse(JSON.stringify(D.labelOptions));for(let l in e){let a=(null==(t=e[l])?void 0:t.typeId)||"";Object.assign(e[l],{curKey:`${l}_${a}}`})}P.labelConfig=e,C((()=>{let t;R(),D.explicit&&P.inited&&(t=P.labelAnchorKey),z(P.labelConfig,t),P.inited=!0}))})()}),{immediate:!0,deep:!0}),x({resetShowAdd:()=>{let{labelObj:t}=P.editLabelItem;if(t&&Object.keys(t).length)for(let e in t){let l=t[e];Object.assign(l,{showAdd:!1})}},handleLabelForm:t=>{t([...P.labelSelectedEdit||[]])},handleResetOptions:()=>{},hanldeSetLabelItem:(t,e)=>{if("object"==typeof P.labelConfig){Object.keys(P.labelConfig||{}).forEach((l=>{var a;let i=(null==(a=P.labelConfig[l])?void 0:a.itemList)||[];i.length&&i.forEach((l=>{t==l.labelId&&(l.isSelect=e)}))}))}if(!1===e&&Array.isArray(P.labelSelectedEdit)){const e=P.labelSelectedEdit.findIndex((e=>e.labelId==t));-1!=e&&P.labelSelectedEdit.splice(e,1)}}}),(e,l)=>(n(),s("div",{class:"c-label-form-content",ref_key:"labelFormContent",ref:V},[d(W)?(n(),s("div",O,K)):o("v-if",!0),r(c("div",j,[c("div",k,[o(" 表单内嵌打开标签组件的样式 "),o(' <div v-if="explicit" class="explicit-continer">\n\t\t\t\t\t<n-tabs :value="state.labelAnchorKey" type="card" @change="labelAnchorTabsOnChange" tab-position="top">\n\t\t\t\t\t\t<template v-for="(v, i) in state.labelConfig">\n\t\t\t\t\t\t\t<n-tab-pane :name="v.curKey">\n\t\t\t\t\t\t\t\t<span slot="tab">\n\t\t\t\t\t\t\t\t\t{{ i }}\n\t\t\t\t\t\t\t\t\t<span class="edit-label-type">({{ v.multipleChoice == 2 ? \'单\' : \'多\' }}选)</span>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<div class="explicit-label-wrap left-label-wrap">\n\t\t\t\t\t\t\t\t\t<div class="edit-label-content">\n\t\t\t\t\t\t\t\t\t\t<labelClassify\n\t\t\t\t\t\t\t\t\t\t\t:classifyItem="v"\n\t\t\t\t\t\t\t\t\t\t\t:handleLabelChange="handleLabelChange"\n\t\t\t\t\t\t\t\t\t\t\t:handleLabelColor="handleLabelColor"\n\t\t\t\t\t\t\t\t\t\t\t:handleDelLabel="handleDelLabel"\n\t\t\t\t\t\t\t\t\t\t\t:hanldeBlur="hanldeBlur"\n\t\t\t\t\t\t\t\t\t\t\t:handleAddLabel="handleAddLabel"\n\t\t\t\t\t\t\t\t\t\t\t:clearaddVal="clearaddVal"\n\t\t\t\t\t\t\t\t\t\t\t:isEdit="isEdit"\n\t\t\t\t\t\t\t\t\t\t\t:sourceType="sourceType"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</n-tab-pane>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</n-tabs>\n\t\t\t\t</div> '),o("\n\t\t\t\t\t普通标签样式\n\t\t\t\t\tv-else\n\t\t\t\t\texplicit\n\t\t\t\t "),c("div",{class:b(["left-label-wrap",{"total-left-label-wrap":t.isChangeWindow}])},[u(d(I),{"offset-target":et,type:"block",onClick:Z,onChange:tt},{default:p((()=>[(n(!0),s(f,null,h(P.labelConfig,((t,e)=>(n(),y(d(S),{href:`#${t.curKey}`,title:String(e)},null,8,["href","title"])))),256))])),_:1})],2),o(' v-if="!explicit" '),c("div",{class:b(["right-label-wrap",{"total-right-label-wrap":t.isChangeWindow}])},[(n(!0),s(f,null,h(P.labelConfig,((e,l)=>(n(),s("div",{key:l,class:"edit-label-content"},[c("div",{class:"edit-label",id:e.curKey},[v(m(l)+" ",1),c("span",_,"("+m(2==e.multipleChoice?"单":"多")+"选)",1)],8,T),u(E,{classifyItem:e,handleLabelChange:U,handleLabelColor:d(w),handleDelLabel:X,hanldeBlur:H,handleAddLabel:G,clearaddVal:M,isEdit:t.isEdit,sourceType:t.sourceType},null,8,["classifyItem","handleLabelColor","isEdit","sourceType"])])))),128))],2)])],512),[[g,!d(W)]])],512))}}),[["__file","LabelFormContent.vue"]]);export{B as default};
1
+ import{defineComponent as t,ref as e,reactive as l,computed as a,watch as i,openBlock as n,createElementBlock as s,unref as d,createCommentVNode as o,withDirectives as r,createElementVNode as c,normalizeClass as b,createVNode as u,withCtx as p,Fragment as f,renderList as h,createBlock as y,createTextVNode as v,toDisplayString as m,vShow as g,nextTick as C}from"vue";import{useMessage as L,NAnchor as I,NAnchorLink as S}from"naive-ui";import E from"./components/label-classify.vue.js";import{handleLabelColor as w}from"../../../shared/utils/vexutils.js";import x from"../../../_virtual/plugin-vue_export-helper.js";import A from"../../../shared/utils/vexutilsExpand.js";const O={key:0,class:"label-disable-wrap"},j=[c("p",{class:"label-disable-title"},"无可选标签",-1),c("p",{class:"label-disable-desc"},"请联系管理员进行标签管理设置",-1)],K={style:{height:"100%"}},k={class:"label-wrap"},T=["id"],_={class:"edit-label-type"};var B=x(t({__name:"LabelFormContent",props:{item:{default:()=>({})},isEdit:{type:Boolean,default:!0},isLock:{type:Boolean,default:!1},labelSelectedList:null,isChangeWindow:{type:Boolean},getLabelList:{type:Function,default:()=>Promise.resolve({rows:[]})},deleteLabel:{type:Function,default:()=>Promise.resolve({status:!0})},saveLabelItem:{type:Function,default:()=>Promise.resolve({status:!0})},labelOptions:null,sourceType:{default:""},explicit:{type:Boolean,default:!1}},emits:["explicitOnChange","change","updateLabelData"],setup(t,{expose:x,emit:B}){const D=t,F=L(),V=e(null),P=l({editLabelItem:{},inited:!1,labelSelectedEdit:[],labelAnchorKey:"",cacheAnchorKey:"",labelConfig:{}});let N=e(0);const W=a((()=>{if(!P.inited)return!1;let t=P.labelConfig;return!t||Object.keys(t).every((e=>!t[e].itemList))})),$=a((()=>{let t=[].concat(...P.labelSelectedEdit,...D.labelSelectedList);return J(t,"labelId")})),q=a((()=>{const t=$.value||[];return Array.isArray(t)?t.map((t=>t.labelId)):[]})),J=(t,e)=>{let l={};return t.reduce(((t,a)=>(!l[a[e]]&&(l[a[e]]=t.push(a)),t)),[])},R=()=>{if(P.labelSelectedEdit=$.value,"object"==typeof P.labelConfig){Object.keys(P.labelConfig||{}).forEach((t=>{var e;let l=(null==(e=P.labelConfig[t])?void 0:e.itemList)||[];l.length&&l.forEach((t=>{q.value.includes(t.labelId)&&(t.isSelect=!0)}))}))}},z=(t,e)=>{if(!t)return;let l=Object.keys(t)||[];if(!l.length)return;let a=t[l[0]].curKey;if(e&&"string"==typeof e){let[i]=e.split("~"),n=l.find((e=>t[e]&&t[e].curKey&&t[e].curKey.includes(i)));n&&(a=t[n].curKey)}a&&Y(a)},G=(t,e)=>{e.showAdd=!0;const l=t.target.nextElementSibling;C((()=>{var t;null==(t=null==l?void 0:l.firstChild)||t.focus()}))},H=(t,e)=>{setTimeout((()=>{e.addVal?Q(e):e.showAdd=!1}),150)},M=(t,e)=>{e.addVal="",e.showAdd=!1},Q=async t=>{var e;if(!!t.itemList.filter((t=>!(t.isPublic&&1==t.isPublic))).find((e=>e.labelName===t.addVal)))return F.error("标签名称重复!"),!1;let l="";l=(null==(e=t.itemList)?void 0:e.length)?t.itemList[0].parentColor||t.parentColor||"":(null==t?void 0:t.parentColor)||"";const a={type:t.typeId,name:t.addVal,parentColor:l},{status:i}=await D.saveLabelItem(a,t);i&&(F.success("添加成功!"),B("updateLabelData"),t.showAdd=!1)},U=(t,e,l,a)=>{var i;const n=l.itemList,s=l.multipleChoice;let d=(null==(i=P.labelSelectedEdit)?void 0:i.length)&&A.clone(P.labelSelectedEdit,!0)||[];if(t){if(d.some((t=>t.labelId==e.labelId)))return;if(2==s){const{typeId:t,labelId:l}=e;d=d.filter((e=>e.typeId!==t)),n.forEach((t=>{t.labelId!==l&&(t.isSelect=!1)}))}d.push(e)}else{const t=d.findIndex((t=>t.labelId==e.labelId));-1!=t&&d.splice(t,1)}P.labelSelectedEdit=[...d],N.value++,D.explicit&&B("explicitOnChange",[...P.labelSelectedEdit])},X=async t=>{const{status:e}=await D.deleteLabel(t,D.item);if(e){F.success("删除成功!");for(const e in P.labelConfig){const l=P.labelConfig[e].itemList.findIndex((e=>e.labelId==t.labelId));-1!=l&&P.labelConfig[e].itemList.splice(l,1)}const e=P.labelSelectedEdit||[],l=D.labelSelectedList||[];if(e&&e.length){const l=e.findIndex((e=>e.labelId==t.labelId));-1!=l&&e.splice(l,1)}if(l&&l.length){const e=l.findIndex((e=>e.labelId==t.labelId));-1!=e&&l.splice(e,1),B("change",[...l],D.item)}B("updateLabelData")}else F.warning("删除失败")},Y=t=>{t&&setTimeout((()=>{let e,l="#"+t;e=V.value.querySelector("a[href='"+l+"']"),e&&e.click(),P.labelAnchorKey=t}),32)},Z=t=>{t.preventDefault()},tt=t=>{if(!t)return;let e=t.slice(1);P.cacheAnchorKey=e},et=()=>{var t;return null==(t=V.value)?void 0:t.querySelector(".right-label-wrap")};return i((()=>D.labelOptions),(t=>{t&&(()=>{var t;if(D.isLock)return;const e=JSON.parse(JSON.stringify(D.labelOptions));for(let l in e){let a=(null==(t=e[l])?void 0:t.typeId)||"";Object.assign(e[l],{curKey:`${l}_${a}}`})}P.labelConfig=e,C((()=>{let t;R(),D.explicit&&P.inited&&(t=P.labelAnchorKey),z(P.labelConfig,t),P.inited=!0}))})()}),{immediate:!0,deep:!0}),x({resetShowAdd:()=>{let{labelObj:t}=P.editLabelItem;if(t&&Object.keys(t).length)for(let e in t){let l=t[e];Object.assign(l,{showAdd:!1})}},handleLabelForm:t=>{t([...P.labelSelectedEdit||[]])},handleResetOptions:()=>{},hanldeSetLabelItem:(t,e)=>{if("object"==typeof P.labelConfig){Object.keys(P.labelConfig||{}).forEach((l=>{var a;let i=(null==(a=P.labelConfig[l])?void 0:a.itemList)||[];i.length&&i.forEach((l=>{t==l.labelId&&(l.isSelect=e)}))}))}if(!1===e&&Array.isArray(P.labelSelectedEdit)){const e=P.labelSelectedEdit.findIndex((e=>e.labelId==t));-1!=e&&P.labelSelectedEdit.splice(e,1)}}}),(e,l)=>(n(),s("div",{class:"c-label-form-content",ref_key:"labelFormContent",ref:V},[d(W)?(n(),s("div",O,j)):o("v-if",!0),r(c("div",K,[c("div",k,[o(" 表单内嵌打开标签组件的样式 "),o(' <div v-if="explicit" class="explicit-continer">\n\t\t\t\t\t<n-tabs :value="state.labelAnchorKey" type="card" @change="labelAnchorTabsOnChange" tab-position="top">\n\t\t\t\t\t\t<template v-for="(v, i) in state.labelConfig">\n\t\t\t\t\t\t\t<n-tab-pane :name="v.curKey">\n\t\t\t\t\t\t\t\t<span slot="tab">\n\t\t\t\t\t\t\t\t\t{{ i }}\n\t\t\t\t\t\t\t\t\t<span class="edit-label-type">({{ v.multipleChoice == 2 ? \'单\' : \'多\' }}选)</span>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<div class="explicit-label-wrap left-label-wrap">\n\t\t\t\t\t\t\t\t\t<div class="edit-label-content">\n\t\t\t\t\t\t\t\t\t\t<labelClassify\n\t\t\t\t\t\t\t\t\t\t\t:classifyItem="v"\n\t\t\t\t\t\t\t\t\t\t\t:handleLabelChange="handleLabelChange"\n\t\t\t\t\t\t\t\t\t\t\t:handleLabelColor="handleLabelColor"\n\t\t\t\t\t\t\t\t\t\t\t:handleDelLabel="handleDelLabel"\n\t\t\t\t\t\t\t\t\t\t\t:hanldeBlur="hanldeBlur"\n\t\t\t\t\t\t\t\t\t\t\t:handleAddLabel="handleAddLabel"\n\t\t\t\t\t\t\t\t\t\t\t:clearaddVal="clearaddVal"\n\t\t\t\t\t\t\t\t\t\t\t:isEdit="isEdit"\n\t\t\t\t\t\t\t\t\t\t\t:sourceType="sourceType"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</n-tab-pane>\n\t\t\t\t\t\t</template>\n\t\t\t\t\t</n-tabs>\n\t\t\t\t</div> '),o("\n\t\t\t\t\t普通标签样式\n\t\t\t\t\tv-else\n\t\t\t\t\texplicit\n\t\t\t\t "),c("div",{class:b(["left-label-wrap",{"total-left-label-wrap":t.isChangeWindow}])},[u(d(I),{"offset-target":et,type:"block",onClick:Z,onChange:tt},{default:p((()=>[(n(!0),s(f,null,h(P.labelConfig,((t,e)=>(n(),y(d(S),{href:`#${t.curKey}`,title:String(e)},null,8,["href","title"])))),256))])),_:1})],2),o(' v-if="!explicit" '),c("div",{class:b(["right-label-wrap",{"total-right-label-wrap":t.isChangeWindow}])},[(n(!0),s(f,null,h(P.labelConfig,((e,l)=>(n(),s("div",{key:l,class:"edit-label-content"},[c("div",{class:"edit-label",id:e.curKey},[v(m(l)+" ",1),c("span",_,"("+m(2==e.multipleChoice?"单":"多")+"选)",1)],8,T),u(E,{classifyItem:e,handleLabelChange:U,handleLabelColor:d(w),handleDelLabel:X,hanldeBlur:H,handleAddLabel:G,clearaddVal:M,isEdit:t.isEdit,sourceType:t.sourceType},null,8,["classifyItem","handleLabelColor","isEdit","sourceType"])])))),128))],2)])],512),[[g,!d(W)]])],512))}}),[["__file","LabelFormContent.vue"]]);export{B as default};
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,reactive as t,computed as a,onMounted as i,watch as o,openBlock as s,createElementBlock as n,Fragment as d,createElementVNode as c,createBlock as b,unref as m,withCtx as r,renderList as p,normalizeStyle as u,createVNode as L,toDisplayString as y,withDirectives as h,normalizeClass as C,createTextVNode as f,vShow as g,createCommentVNode as v,mergeProps as I,nextTick as w}from"vue";import{NSpace as x,NTag as S,NTooltip as k,NIcon as O,NModal as N}from"naive-ui";import{AddCircleOutline as j}from"@vicons/ionicons5";import W from"./LabelFormContent.vue.js";import{handleLabelColor as P}from"../../../shared/utils/vexutils.js";import _ from"xe-utils";const B={class:"c-select-label"},A=c("span",null,"常用",-1),E={key:2,class:"outexplicit"},H=c("span",null,"选择标签",-1),z={class:"svg-wrap"};var F=e({__name:"SelectLabel",props:{selectedList:{type:Array,default:()=>[]},item:{type:Object,default:()=>({})},isDetail:{type:Boolean,default:!1},isLock:{type:Boolean,default:!1},sourceType:{type:String,default:""},explicit:{type:Boolean,default:!1},getLabelList:{type:Function,default:()=>Promise.resolve({rows:[]})},queryCommonlabels:{type:Function,default:()=>Promise.resolve({data:{}})},deleteLabel:{type:Function,default:()=>Promise.resolve({status:!0})},saveLabelItem:{type:Function,default:()=>Promise.resolve({status:!0})}},emits:["onChange"],setup(e,{emit:F}){const V=e,T=l(null),U=t({labelVisible:!1,editLabelItem:{},labelSelectedList:[],labelSelectedEdit:[],inited:!1,isChangeWindow:!1,modalWidth:"763px",modalHeight:"404px",maxHeight:"404px",commonLabelList:[],multipleChoiceConfig:{}});const D=a((()=>{const e=(null==V?void 0:V.item)||{};return(1==e.is_edit||e.isShow)&&!V.isDetail})),$=(e,l)=>{e.length&&e.forEach((e=>{let t=l.some((l=>l.labelId==e.labelId));e.isSelect=t}))},q=(e,l)=>{let t=U.multipleChoiceConfig,a=U.labelSelectedList||[];if(e){if(a.some((e=>e.labelId==l.labelId)))return;"2"==t[l.typeId]&&(a=a.filter((e=>e.typeId!==l.typeId))),a.push(l)}else{const e=a.findIndex((e=>e.labelId==l.labelId));-1!=e&&a.splice(e,1)}F("onChange",[...a]),U.labelSelectedList=a},J=e=>{V.isLock||(V.explicit||"init"===e||(U.labelVisible=!0),M(V.item))},R=()=>{var e;V.explicit||(null==(e=T.value)||e.resetShowAdd(),U.editLabelItem.showAdd=!1,U.editLabelItem={},U.inited=!1,U.modalWidth="763px",U.modalHeight="404px",U.maxHeight="404px",U.isChangeWindow=!1,U.labelVisible=!1)},K=()=>{U.isChangeWindow=!U.isChangeWindow;let e=document.body.clientHeight;U.modalWidth="763px"===U.modalWidth?"100%":"763px",U.modalHeight="404px"===U.modalHeight?e-110+"px":"404px",U.maxHeight="auto"===U.modalHeight?"404px":"none"},G=()=>{var e;null==(e=T.value)||e.handleLabelForm((e=>{F("onChange",[...e]),U.labelSelectedList=e,$(U.commonLabelList,e),R()}))},M=async(e,l)=>{const{rows:t,results:a}=await V.getLabelList(e,{update:l}),i=t||[],o={},s=`${e.val_key}_${e.name}`,n=l?[...U.labelSelectedEdit||[]]:[...U.labelSelectedList||[]];i.forEach((e=>{e.cacheKey=s,e.isSelect=!1,o[e.typeName]?o[e.typeName].itemList.push({...e}):o[e.typeName]={itemList:[{...e}],showAdd:!1,addVal:"",typeName:e.typeName,typeId:e.typeId}})),a&&(e.labelObj=o,e.labelList=i),l&&(U.labelSelectedEdit=n),U.editLabelItem=e,Q(a)},Q=e=>{if(!e)return!1;let l=Object.keys(e),t={},a=(e.typeList||[]).reduce(((e,l)=>(t[l.typeId]=l.multipleChoice,e[l.typeName]={multipleChoice:l.multipleChoice,parentColor:l.parentColor,allowCreateByPersonal:l.allowCreateByPersonal},e)),{});V.explicit&&(U.multipleChoiceConfig=t),l.forEach((l=>{var t,i,o,s,n,d,c;"typeList"!==l&&("emptyTypes"!==l?_.isPlainObject(e[l])?U.editLabelItem.labelObj[l]?(U.editLabelItem.labelObj[l].isNoAdd=!0,U.editLabelItem.labelObj[l].multipleChoice=null==(i=a[l])?void 0:i.multipleChoice,U.editLabelItem.labelObj[l].allowCreateByPersonal=null==(o=a[l])?void 0:o.allowCreateByPersonal,U.editLabelItem.labelObj[l].parentColor=null==(s=a[l])?void 0:s.parentColor):U.editLabelItem.labelObj[l]={addVal:"",showAdd:!1,itemList:!1,typeId:"",typeName:l,allowCreateByPersonal:null==(t=a[l])?void 0:t.allowCreateByPersonal,...a[l]||{}}:(U.editLabelItem.labelObj[l].multipleChoice=null==(n=a[l])?void 0:n.multipleChoice,U.editLabelItem.labelObj[l].allowCreateByPersonal=null==(d=a[l])?void 0:d.allowCreateByPersonal,U.editLabelItem.labelObj[l].parentColor=null==(c=a[l])?void 0:c.parentColor):e[l].forEach((e=>{U.editLabelItem.labelObj[e.typeName]={addVal:"",showAdd:!1,itemList:[],typeId:e.typeId,typeName:e.typeName,allowCreateByPersonal:e.allowCreateByPersonal,...a[e.typeName]||{}}})))}))},X=()=>{M(V.item,!0)},Y=()=>{G()},Z=(e,l)=>{V.explicit&&w((()=>{var t;null==(t=T.value)||t.hanldeSetLabelItem(e,l)}))};return i((()=>{V.explicit?J():(async e=>{const{rows:l,results:t}=await V.getLabelList(e);if(!t)return!1;let a=(t.typeList||[]).reduce(((e,l)=>(e[l.typeId]=l.multipleChoice,e)),{});U.multipleChoiceConfig=a})(V.item)})),o((()=>V.selectedList),(e=>{if(e){let l=Array.isArray(e)?e:[];U.labelSelectedList=JSON.parse(JSON.stringify(l)),$(U.commonLabelList,U.labelSelectedList)}}),{immediate:!0,deep:!0}),o((()=>{var e;return null==(e=V.item)?void 0:e.label_type}),(e=>{e&&"form"==V.sourceType&&(async e=>{var l;let{data:t={}}=await V.queryCommonlabels(e)||{};if("SUCCESS"!==t.result)return;let a=(null==(l=t.map)?void 0:l.rows)||[];$(a,U.labelSelectedList),U.commonLabelList=a})(e)}),{immediate:!0,deep:!0}),(l,t)=>(s(),n(d,null,[c("div",B,[e.explicit?v("v-if",!0):(s(),b(m(x),{key:0,align:"center"},{default:r((()=>[(s(!0),n(d,null,p(U.labelSelectedList,(e=>(s(),b(m(S),{bordered:!1,key:e.labelId,style:u(m(P)(e,!0)),closable:m(D),onClose:l=>(e=>{const l=U.labelSelectedList||[],t=l.findIndex((l=>l.labelId==e.labelId));-1!=t&&l.splice(t,1),F("onChange",[...l]),U.labelSelectedList=l,Z(e.labelId,!1)})(e),size:"small"},{default:r((()=>[L(m(k),{placement:"top-start"},{trigger:r((()=>[c("span",null,y(e.labelName),1)])),default:r((()=>[c("span",null,y(e.labelName),1)])),_:2},1024)])),_:2},1032,["style","closable","onClose"])))),128)),e.explicit?v("v-if",!0):h((s(),n("span",{key:0,class:C(["form-add-icon form-add-icon-label",{disable:e.isLock}]),onClick:J},[L(m(O),{class:"add-icon",component:m(j)},null,8,["component"]),f(" 新增 ")],2)),[[g,m(D)]])])),_:1})),"form"==e.sourceType&&U.commonLabelList.length&&m(D)&&!e.explicit?(s(),b(m(x),{key:1,align:"center",class:"common-label"},{default:r((()=>[A,(s(!0),n(d,null,p(U.commonLabelList,((e,l)=>(s(),b(m(S),{checkable:"",checked:e.isSelect,"onUpdate:checked":l=>function(e,l){l.isSelect=e,q(e,l)}(l,e),key:l,style:u(m(P)(e)),size:"small"},{default:r((()=>[L(m(k),{placement:"top-start"},{trigger:r((()=>[c("span",null,y(e.labelName),1)])),default:r((()=>[c("span",null,y(e.labelName),1)])),_:2},1024)])),_:2},1032,["checked","onUpdate:checked","style"])))),128))])),_:1})):v("v-if",!0),e.explicit&&m(D)?(s(),n("div",E,[L(W,I(l.$attrs,{ref_key:"labelFormContentRef",ref:T,explicit:e.explicit,labelSelectedList:U.labelSelectedList,isChangeWindow:U.isChangeWindow,labelOptions:U.editLabelItem.labelObj,deleteLabel:e.deleteLabel,saveLabelItem:e.saveLabelItem,onUpdateLabelData:X,onExplicitOnChange:Y}),null,16,["explicit","labelSelectedList","isChangeWindow","labelOptions","deleteLabel","saveLabelItem"])])):v("v-if",!0)]),v(" 弹窗 "),L(m(N),{preset:"dialog",class:C(["label-form-modal-wrap modal-wrap standard-modal standard-modal-white",{"modal-screen":U.isChangeWindow}]),show:U.labelVisible,"onUpdate:show":t[0]||(t[0]=e=>U.labelVisible=e),onPositiveClick:G,onNegativeClick:R,onClose:R,"mask-closable":!1,"close-on-esc":!1,"show-icon":!1,"negative-text":"取消","positive-text":"确定",style:u({width:U.modalWidth})},{header:r((()=>[H,c("div",z,[c("i",{onClick:K,class:C(["iconfont-select-label",U.isChangeWindow?"icon-select-label-menzhenyishengzhanxitongtubiaozuixiaohua2":"icon-select-label-menzhenyishengzhanxitongtubiaozuidahua"])},null,2)])])),default:r((()=>[L(W,I(l.$attrs,{ref_key:"labelFormContentRef",ref:T,labelSelectedList:U.labelSelectedList,isChangeWindow:U.isChangeWindow,labelOptions:U.editLabelItem.labelObj,sourceType:e.sourceType,deleteLabel:e.deleteLabel,saveLabelItem:e.saveLabelItem,onUpdateLabelData:X}),null,16,["labelSelectedList","isChangeWindow","labelOptions","sourceType","deleteLabel","saveLabelItem"])])),_:1},8,["show","class","style"])],64))}});export{F as default};
1
+ import{defineComponent as e,ref as l,reactive as t,computed as a,onMounted as i,watch as o,openBlock as s,createElementBlock as n,Fragment as d,createElementVNode as c,createBlock as b,unref as m,withCtx as r,renderList as p,normalizeStyle as u,createVNode as L,toDisplayString as h,withDirectives as y,normalizeClass as C,createTextVNode as f,vShow as g,createCommentVNode as v,mergeProps as I,nextTick as w}from"vue";import{NSpace as x,NTag as S,NTooltip as k,NIcon as O,NModal as j}from"naive-ui";import{AddCircleOutline as N}from"@vicons/ionicons5";import W from"./LabelFormContent.vue.js";import{handleLabelColor as P}from"../../../shared/utils/vexutils.js";import _ from"../../../shared/utils/vexutilsExpand.js";const B={class:"c-select-label"},E=c("span",null,"常用",-1),A={key:2,class:"outexplicit"},H=c("span",null,"选择标签",-1),z={class:"svg-wrap"};var F=e({__name:"SelectLabel",props:{selectedList:{type:Array,default:()=>[]},item:{type:Object,default:()=>({})},isDetail:{type:Boolean,default:!1},isLock:{type:Boolean,default:!1},sourceType:{type:String,default:""},explicit:{type:Boolean,default:!1},getLabelList:{type:Function,default:()=>Promise.resolve({rows:[]})},queryCommonlabels:{type:Function,default:()=>Promise.resolve({data:{}})},deleteLabel:{type:Function,default:()=>Promise.resolve({status:!0})},saveLabelItem:{type:Function,default:()=>Promise.resolve({status:!0})}},emits:["onChange"],setup(e,{emit:F}){const V=e,T=l(null),U=t({labelVisible:!1,editLabelItem:{},labelSelectedList:[],labelSelectedEdit:[],inited:!1,isChangeWindow:!1,modalWidth:"763px",modalHeight:"404px",maxHeight:"404px",commonLabelList:[],multipleChoiceConfig:{}});const D=a((()=>{const e=(null==V?void 0:V.item)||{};return(1==e.is_edit||e.isShow)&&!V.isDetail})),$=(e,l)=>{e.length&&e.forEach((e=>{let t=l.some((l=>l.labelId==e.labelId));e.isSelect=t}))},q=(e,l)=>{let t=U.multipleChoiceConfig,a=U.labelSelectedList||[];if(e){if(a.some((e=>e.labelId==l.labelId)))return;"2"==t[l.typeId]&&(a=a.filter((e=>e.typeId!==l.typeId))),a.push(l)}else{const e=a.findIndex((e=>e.labelId==l.labelId));-1!=e&&a.splice(e,1)}F("onChange",[...a]),U.labelSelectedList=a},J=e=>{V.isLock||(V.explicit||"init"===e||(U.labelVisible=!0),M(V.item))},R=()=>{var e;V.explicit||(null==(e=T.value)||e.resetShowAdd(),U.editLabelItem.showAdd=!1,U.editLabelItem={},U.inited=!1,U.modalWidth="763px",U.modalHeight="404px",U.maxHeight="404px",U.isChangeWindow=!1,U.labelVisible=!1)},K=()=>{U.isChangeWindow=!U.isChangeWindow;let e=document.body.clientHeight;U.modalWidth="763px"===U.modalWidth?"100%":"763px",U.modalHeight="404px"===U.modalHeight?e-110+"px":"404px",U.maxHeight="auto"===U.modalHeight?"404px":"none"},G=()=>{var e;null==(e=T.value)||e.handleLabelForm((e=>{F("onChange",[...e]),U.labelSelectedList=e,$(U.commonLabelList,e),R()}))},M=async(e,l)=>{const{rows:t,results:a}=await V.getLabelList(e,{update:l}),i=t||[],o={},s=`${e.val_key}_${e.name}`,n=l?[...U.labelSelectedEdit||[]]:[...U.labelSelectedList||[]];i.forEach((e=>{e.cacheKey=s,e.isSelect=!1,o[e.typeName]?o[e.typeName].itemList.push({...e}):o[e.typeName]={itemList:[{...e}],showAdd:!1,addVal:"",typeName:e.typeName,typeId:e.typeId}})),a&&(e.labelObj=o,e.labelList=i),l&&(U.labelSelectedEdit=n),U.editLabelItem=e,Q(a)},Q=e=>{if(!e)return!1;let l=Object.keys(e),t={},a=(e.typeList||[]).reduce(((e,l)=>(t[l.typeId]=l.multipleChoice,e[l.typeName]={multipleChoice:l.multipleChoice,parentColor:l.parentColor,allowCreateByPersonal:l.allowCreateByPersonal},e)),{});V.explicit&&(U.multipleChoiceConfig=t),l.forEach((l=>{var t,i,o,s,n,d,c;"typeList"!==l&&("emptyTypes"!==l?_.isPlainObject(e[l])?U.editLabelItem.labelObj[l]?(U.editLabelItem.labelObj[l].isNoAdd=!0,U.editLabelItem.labelObj[l].multipleChoice=null==(i=a[l])?void 0:i.multipleChoice,U.editLabelItem.labelObj[l].allowCreateByPersonal=null==(o=a[l])?void 0:o.allowCreateByPersonal,U.editLabelItem.labelObj[l].parentColor=null==(s=a[l])?void 0:s.parentColor):U.editLabelItem.labelObj[l]={addVal:"",showAdd:!1,itemList:!1,typeId:"",typeName:l,allowCreateByPersonal:null==(t=a[l])?void 0:t.allowCreateByPersonal,...a[l]||{}}:(U.editLabelItem.labelObj[l].multipleChoice=null==(n=a[l])?void 0:n.multipleChoice,U.editLabelItem.labelObj[l].allowCreateByPersonal=null==(d=a[l])?void 0:d.allowCreateByPersonal,U.editLabelItem.labelObj[l].parentColor=null==(c=a[l])?void 0:c.parentColor):e[l].forEach((e=>{U.editLabelItem.labelObj[e.typeName]={addVal:"",showAdd:!1,itemList:[],typeId:e.typeId,typeName:e.typeName,allowCreateByPersonal:e.allowCreateByPersonal,...a[e.typeName]||{}}})))}))},X=()=>{M(V.item,!0)},Y=()=>{G()},Z=(e,l)=>{V.explicit&&w((()=>{var t;null==(t=T.value)||t.hanldeSetLabelItem(e,l)}))};return i((()=>{V.explicit?J():(async e=>{const{rows:l,results:t}=await V.getLabelList(e);if(!t)return!1;let a=(t.typeList||[]).reduce(((e,l)=>(e[l.typeId]=l.multipleChoice,e)),{});U.multipleChoiceConfig=a})(V.item)})),o((()=>V.selectedList),(e=>{if(e){let l=Array.isArray(e)?e:[];U.labelSelectedList=JSON.parse(JSON.stringify(l)),$(U.commonLabelList,U.labelSelectedList)}}),{immediate:!0,deep:!0}),o((()=>{var e;return null==(e=V.item)?void 0:e.label_type}),(e=>{e&&"form"==V.sourceType&&(async e=>{var l;let{data:t={}}=await V.queryCommonlabels(e)||{};if("SUCCESS"!==t.result)return;let a=(null==(l=t.map)?void 0:l.rows)||[];$(a,U.labelSelectedList),U.commonLabelList=a})(e)}),{immediate:!0,deep:!0}),(l,t)=>(s(),n(d,null,[c("div",B,[e.explicit?v("v-if",!0):(s(),b(m(x),{key:0,align:"center"},{default:r((()=>[(s(!0),n(d,null,p(U.labelSelectedList,(e=>(s(),b(m(S),{bordered:!1,key:e.labelId,style:u(m(P)(e,!0)),closable:m(D),onClose:l=>(e=>{const l=U.labelSelectedList||[],t=l.findIndex((l=>l.labelId==e.labelId));-1!=t&&l.splice(t,1),F("onChange",[...l]),U.labelSelectedList=l,Z(e.labelId,!1)})(e),size:"small"},{default:r((()=>[L(m(k),{placement:"top-start"},{trigger:r((()=>[c("span",null,h(e.labelName),1)])),default:r((()=>[c("span",null,h(e.labelName),1)])),_:2},1024)])),_:2},1032,["style","closable","onClose"])))),128)),e.explicit?v("v-if",!0):y((s(),n("span",{key:0,class:C(["form-add-icon form-add-icon-label",{disable:e.isLock}]),onClick:J},[L(m(O),{class:"add-icon",component:m(N)},null,8,["component"]),f(" 新增 ")],2)),[[g,m(D)]])])),_:1})),"form"==e.sourceType&&U.commonLabelList.length&&m(D)&&!e.explicit?(s(),b(m(x),{key:1,align:"center",class:"common-label"},{default:r((()=>[E,(s(!0),n(d,null,p(U.commonLabelList,((e,l)=>(s(),b(m(S),{checkable:"",checked:e.isSelect,"onUpdate:checked":l=>function(e,l){l.isSelect=e,q(e,l)}(l,e),key:l,style:u(m(P)(e)),size:"small"},{default:r((()=>[L(m(k),{placement:"top-start"},{trigger:r((()=>[c("span",null,h(e.labelName),1)])),default:r((()=>[c("span",null,h(e.labelName),1)])),_:2},1024)])),_:2},1032,["checked","onUpdate:checked","style"])))),128))])),_:1})):v("v-if",!0),e.explicit&&m(D)?(s(),n("div",A,[L(W,I(l.$attrs,{ref_key:"labelFormContentRef",ref:T,explicit:e.explicit,labelSelectedList:U.labelSelectedList,isChangeWindow:U.isChangeWindow,labelOptions:U.editLabelItem.labelObj,deleteLabel:e.deleteLabel,saveLabelItem:e.saveLabelItem,onUpdateLabelData:X,onExplicitOnChange:Y}),null,16,["explicit","labelSelectedList","isChangeWindow","labelOptions","deleteLabel","saveLabelItem"])])):v("v-if",!0)]),v(" 弹窗 "),L(m(j),{preset:"dialog",class:C(["label-form-modal-wrap modal-wrap standard-modal standard-modal-white",{"modal-screen":U.isChangeWindow}]),show:U.labelVisible,"onUpdate:show":t[0]||(t[0]=e=>U.labelVisible=e),onPositiveClick:G,onNegativeClick:R,onClose:R,"mask-closable":!1,"close-on-esc":!1,"show-icon":!1,"negative-text":"取消","positive-text":"确定",style:u({width:U.modalWidth})},{header:r((()=>[H,c("div",z,[c("i",{onClick:K,class:C(["iconfont-select-label",U.isChangeWindow?"icon-select-label-menzhenyishengzhanxitongtubiaozuixiaohua2":"icon-select-label-menzhenyishengzhanxitongtubiaozuidahua"])},null,2)])])),default:r((()=>[L(W,I(l.$attrs,{ref_key:"labelFormContentRef",ref:T,labelSelectedList:U.labelSelectedList,isChangeWindow:U.isChangeWindow,labelOptions:U.editLabelItem.labelObj,sourceType:e.sourceType,deleteLabel:e.deleteLabel,saveLabelItem:e.saveLabelItem,onUpdateLabelData:X}),null,16,["labelSelectedList","isChangeWindow","labelOptions","sourceType","deleteLabel","saveLabelItem"])])),_:1},8,["show","class","style"])],64))}});export{F as default};
@@ -1 +1 @@
1
- @font-face{font-family:iconfont;src:url(iconfont.ttf) format("truetype")}.iconfont-select-label{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:iconfont!important;font-size:14px;font-style:normal}.icon-select-label-menzhenyishengzhanxitongtubiaozuixiaohua2:before{content:"\e778"}.icon-select-label-menzhenyishengzhanxitongtubiaozuidahua:before{content:"\e779"}.c-select-label .label-disable-wrap{align-items:center;display:flex;flex-direction:column;font-size:14px;line-height:20px;width:100%}.c-select-label .label-disable-wrap .label-disable-img{height:248px;width:320px}.c-select-label .common-label{border:1px solid rgba(0,0,0,.1);border-radius:4px;margin-top:8px!important;padding:4px 12px}.c-select-label .common-label>span{color:rgba(0,0,0,.9);margin-right:16px}.c-select-label .form-add-icon-label{align-items:center;color:#2d7aff;cursor:pointer;display:inline-flex;vertical-align:middle}.c-select-label .anticon+.anticon{margin-left:16px}.c-select-label .n-tag{border:1px solid #e0e0e6;margin:0 8px 0 0;max-width:108px}.c-select-label .n-tag .n-base-icon{color:#fff}.c-select-label .n-tag .n-tag__content{align-items:center;display:inline-block;line-height:20px;max-width:80px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-label-form-content{border-bottom:1px solid #e8e8e8;border-top:1px solid #e8e8e8;height:100%;width:100%}.c-label-form-content .label-wrap{display:flex;height:100%;width:100%}.c-label-form-content .label-wrap .left-label-wrap{border-right:1px solid #e8e8e8;max-height:404px;width:140px}.c-label-form-content .label-wrap .left-label-wrap.total-left-label-wrap{height:calc(100vh - 109px);max-height:calc(100vh - 109px)}.c-label-form-content .label-wrap .left-label-wrap.explicit-label-wrap{height:auto;overflow:hidden;overflow-y:auto;width:100%}.c-label-form-content .label-wrap .left-label-wrap .n-anchor.n-anchor--block .n-anchor-link{font-size:14px;padding:10px 8px}.c-label-form-content .label-wrap .left-label-wrap .n-anchor.n-anchor--block .n-anchor-link.n-anchor-link--active{background-color:#f2f2f2}.c-label-form-content .label-wrap .right-label-wrap{flex:1;max-height:404px;overflow-y:auto}.c-label-form-content .label-wrap .right-label-wrap.total-right-label-wrap{max-height:calc(100vh - 109px)}.c-label-form-content .label-wrap .right-label-wrap .label-add{display:inline-flex;height:30px;justify-content:center;line-height:30px;position:relative;text-align:center;top:2px;width:108px}.c-label-form-content .label-wrap .right-label-wrap .label-add .selfval{align-items:center;display:flex;justify-content:center}.c-label-form-content .label-wrap .right-label-wrap .add-input{width:108px}.c-label-form-content .label-wrap .right-label-wrap .add-input .n-input__suffix{cursor:pointer}.c-label-form-content .label-wrap .explicit-continer{border:1px solid #d5d5d5;width:100%}.c-label-form-content .edit-label-type{font-size:12px;margin-left:4px}.c-label-form-content .edit-label-content{margin-top:10px;padding:0 14px}.c-label-form-content .edit-label-content .edit-content{margin-top:8px;width:100%}.c-label-form-content .edit-label-content .edit-content .n-tag{border:1px solid #e0e0e6;margin:0 8px 8px 0;max-width:108px;text-align:center}.c-label-form-content .edit-label-content .edit-content .n-tag .n-tag__content{align-items:center;display:inline-flex}.c-label-form-content .edit-label-content .edit-content .n-tag .n-tag__content span{display:inline-block;height:100%;line-height:30px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:80px}.n-dialog__title .svg-wrap{margin:0 0 0 auto}.n-dialog__title .svg-wrap i{cursor:pointer;font-size:16px}
1
+ @font-face{font-family:select-label-iconfont;src:url(select-label-iconfont.ttf) format("truetype")}.iconfont-select-label{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:select-label-iconfont!important;font-size:14px;font-style:normal}.icon-select-label-menzhenyishengzhanxitongtubiaozuixiaohua2:before{content:"\e778"}.icon-select-label-menzhenyishengzhanxitongtubiaozuidahua:before{content:"\e779"}.c-select-label .label-disable-wrap{align-items:center;display:flex;flex-direction:column;font-size:14px;line-height:20px;width:100%}.c-select-label .label-disable-wrap .label-disable-img{height:248px;width:320px}.c-select-label .common-label{border:1px solid rgba(0,0,0,.1);border-radius:4px;margin-top:8px!important;padding:4px 12px}.c-select-label .common-label>span{color:rgba(0,0,0,.9);margin-right:16px}.c-select-label .form-add-icon-label{align-items:center;color:#2d7aff;cursor:pointer;display:inline-flex;vertical-align:middle}.c-select-label .anticon+.anticon{margin-left:16px}.c-select-label .n-tag{border:1px solid #e0e0e6;margin:0 8px 0 0;max-width:108px}.c-select-label .n-tag .n-base-icon{color:#fff}.c-select-label .n-tag .n-tag__content{align-items:center;display:inline-block;line-height:20px;max-width:80px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.c-label-form-content{border-bottom:1px solid #e8e8e8;border-top:1px solid #e8e8e8;height:100%;width:100%}.c-label-form-content .label-wrap{display:flex;height:100%;width:100%}.c-label-form-content .label-wrap .left-label-wrap{border-right:1px solid #e8e8e8;max-height:404px;width:140px}.c-label-form-content .label-wrap .left-label-wrap.total-left-label-wrap{height:calc(100vh - 109px);max-height:calc(100vh - 109px)}.c-label-form-content .label-wrap .left-label-wrap.explicit-label-wrap{height:auto;overflow:hidden;overflow-y:auto;width:100%}.c-label-form-content .label-wrap .left-label-wrap .n-anchor.n-anchor--block .n-anchor-link{font-size:14px;padding:10px 8px}.c-label-form-content .label-wrap .left-label-wrap .n-anchor.n-anchor--block .n-anchor-link.n-anchor-link--active{background-color:#f2f2f2}.c-label-form-content .label-wrap .right-label-wrap{flex:1;max-height:404px;overflow-y:auto}.c-label-form-content .label-wrap .right-label-wrap.total-right-label-wrap{max-height:calc(100vh - 109px)}.c-label-form-content .label-wrap .right-label-wrap .label-add{display:inline-flex;height:30px;justify-content:center;line-height:30px;position:relative;text-align:center;top:2px;width:108px}.c-label-form-content .label-wrap .right-label-wrap .label-add .selfval{align-items:center;display:flex;justify-content:center}.c-label-form-content .label-wrap .right-label-wrap .add-input{width:108px}.c-label-form-content .label-wrap .right-label-wrap .add-input .n-input__suffix{cursor:pointer}.c-label-form-content .label-wrap .explicit-continer{border:1px solid #d5d5d5;width:100%}.c-label-form-content .edit-label-type{font-size:12px;margin-left:4px}.c-label-form-content .edit-label-content{margin-top:10px;padding:0 14px}.c-label-form-content .edit-label-content .edit-content{margin-top:8px;width:100%}.c-label-form-content .edit-label-content .edit-content .n-tag{border:1px solid #e0e0e6;margin:0 8px 8px 0;max-width:108px;text-align:center}.c-label-form-content .edit-label-content .edit-content .n-tag .n-tag__content{align-items:center;display:inline-flex}.c-label-form-content .edit-label-content .edit-content .n-tag .n-tag__content span{display:inline-block;height:100%;line-height:30px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:80px}.n-dialog__title .svg-wrap{margin:0 0 0 auto}.n-dialog__title .svg-wrap i{cursor:pointer;font-size:16px}
@@ -2,6 +2,7 @@ import { SFCWithInstall } from '../../../es/shared/types';
2
2
  declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
3
3
  defaultList: {
4
4
  type: import("vue").PropType<((string | number) | {
5
+ [key: string]: any;
5
6
  key: string | number;
6
7
  name: string;
7
8
  })[]>;
@@ -48,8 +49,14 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
48
49
  type: BooleanConstructor;
49
50
  default: boolean;
50
51
  };
52
+ treeSetting: {
53
+ type: import("vue").PropType<import("naive-ui/es/tree/src/interface").TreeOptionBase & {
54
+ [k: string]: unknown;
55
+ } & import("../../../es/shared/types").AnyObject>;
56
+ default: () => {};
57
+ };
51
58
  queryLoadChildData: {
52
- type: import("vue").PropType<(node: import("naive-ui").TreeOption) => Promise<void>>;
59
+ type: import("vue").PropType<(node: import("naive-ui").TreeOption) => Promise<import("../../../es/shared/types").AnyObject>>;
53
60
  default: undefined;
54
61
  };
55
62
  queryTreeSearch: {
@@ -60,6 +67,7 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
60
67
  props: Readonly<import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
61
68
  defaultList: {
62
69
  type: import("vue").PropType<((string | number) | {
70
+ [key: string]: any;
63
71
  key: string | number;
64
72
  name: string;
65
73
  })[]>;
@@ -106,8 +114,14 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
106
114
  type: BooleanConstructor;
107
115
  default: boolean;
108
116
  };
117
+ treeSetting: {
118
+ type: import("vue").PropType<import("naive-ui/es/tree/src/interface").TreeOptionBase & {
119
+ [k: string]: unknown;
120
+ } & import("../../../es/shared/types").AnyObject>;
121
+ default: () => {};
122
+ };
109
123
  queryLoadChildData: {
110
- type: import("vue").PropType<(node: import("naive-ui").TreeOption) => Promise<void>>;
124
+ type: import("vue").PropType<(node: import("naive-ui").TreeOption) => Promise<import("../../../es/shared/types").AnyObject>>;
111
125
  default: undefined;
112
126
  };
113
127
  queryTreeSearch: {
@@ -116,8 +130,9 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
116
130
  };
117
131
  }>> & {
118
132
  onCheck?: ((...args: any[]) => any) | undefined;
133
+ onCheckWithLevel?: ((...args: any[]) => any) | undefined;
119
134
  }>>;
120
- emit: (event: "check", ...args: any[]) => void;
135
+ emit: (event: "check" | "checkWithLevel", ...args: any[]) => void;
121
136
  keyword: import("vue").Ref<string>;
122
137
  checkedAll: import("vue").Ref<boolean>;
123
138
  checkedKeys: import("vue").Ref<(string | number)[]>;
@@ -134,28 +149,33 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
134
149
  suffix?: (() => import("vue").VNodeChild) | undefined;
135
150
  }[]>;
136
151
  tagData: import("vue").Ref<{
152
+ [x: string]: any;
137
153
  key: string | number;
138
154
  name: string;
139
155
  }[]>;
140
- temp: (import("naive-ui/es/tree/src/interface").TreeOptionBase & {
141
- [k: string]: unknown;
142
- } & import("../../../es/shared/types").AnyObject)[];
156
+ isSearch: import("vue").Ref<boolean>;
157
+ temp: import("naive-ui").TreeOption[];
143
158
  allCheckedKeys: (string | number)[];
144
159
  isRemote: import("vue").ComputedRef<boolean>;
145
160
  init: () => void;
161
+ queryLoadChildNode: (node: import("naive-ui").TreeOption) => Promise<import("../../../es/shared/types").AnyObject>;
146
162
  setDisabled: (data: import("naive-ui").TreeOption) => void;
147
163
  renderLabel: ({ option }: {
148
164
  option: import("naive-ui").TreeOption;
149
165
  }) => JSX.Element;
150
166
  getLabelName: (option: import("naive-ui").TreeOption) => unknown;
167
+ transformParentNodeName: (trees: import("naive-ui").TreeOption[], temp: any) => import("naive-ui").TreeOption[];
151
168
  setAllCheckedKeys: (tree: import("naive-ui").TreeOption[]) => void;
152
169
  onSearch: () => Promise<void>;
170
+ onClear: () => void;
153
171
  setTreeCheckd: (tree: import("naive-ui").TreeOption[], checked: boolean) => void;
154
172
  checkedAllChange: (checked: boolean) => void;
155
173
  uniq: (arr: {
174
+ [key: string]: any;
156
175
  key: string | number;
157
176
  name: string;
158
177
  }[]) => {
178
+ [key: string]: any;
159
179
  key: string | number;
160
180
  name: string;
161
181
  }[];
@@ -164,6 +184,7 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
164
184
  setCheckedAll: () => void;
165
185
  clearAll: () => void;
166
186
  closeTag: (tag: {
187
+ [key: string]: any;
167
188
  key: string | number;
168
189
  name: string;
169
190
  }) => void;
@@ -236,9 +257,10 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
236
257
  readonly privateShow: boolean;
237
258
  }>;
238
259
  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<{}>>, {}>;
239
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "check"[], "check", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
260
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("check" | "checkWithLevel")[], "check" | "checkWithLevel", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
240
261
  defaultList: {
241
262
  type: import("vue").PropType<((string | number) | {
263
+ [key: string]: any;
242
264
  key: string | number;
243
265
  name: string;
244
266
  })[]>;
@@ -285,8 +307,14 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
285
307
  type: BooleanConstructor;
286
308
  default: boolean;
287
309
  };
310
+ treeSetting: {
311
+ type: import("vue").PropType<import("naive-ui/es/tree/src/interface").TreeOptionBase & {
312
+ [k: string]: unknown;
313
+ } & import("../../../es/shared/types").AnyObject>;
314
+ default: () => {};
315
+ };
288
316
  queryLoadChildData: {
289
- type: import("vue").PropType<(node: import("naive-ui").TreeOption) => Promise<void>>;
317
+ type: import("vue").PropType<(node: import("naive-ui").TreeOption) => Promise<import("../../../es/shared/types").AnyObject>>;
290
318
  default: undefined;
291
319
  };
292
320
  queryTreeSearch: {
@@ -295,12 +323,13 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
295
323
  };
296
324
  }>> & {
297
325
  onCheck?: ((...args: any[]) => any) | undefined;
326
+ onCheckWithLevel?: ((...args: any[]) => any) | undefined;
298
327
  }, {
299
328
  data: (import("naive-ui/es/tree/src/interface").TreeOptionBase & {
300
329
  [k: string]: unknown;
301
330
  } & import("../../../es/shared/types").AnyObject)[];
302
- multiple: boolean;
303
331
  defaultList: ((string | number) | {
332
+ [key: string]: any;
304
333
  key: string | number;
305
334
  name: string;
306
335
  })[];
@@ -317,7 +346,11 @@ declare const SelectPerson: SFCWithInstall<import("vue").DefineComponent<{
317
346
  };
318
347
  showCount: boolean;
319
348
  showClear: boolean;
320
- queryLoadChildData: (node: import("naive-ui").TreeOption) => Promise<void>;
349
+ multiple: boolean;
350
+ treeSetting: import("naive-ui/es/tree/src/interface").TreeOptionBase & {
351
+ [k: string]: unknown;
352
+ } & import("../../../es/shared/types").AnyObject;
353
+ queryLoadChildData: (node: import("naive-ui").TreeOption) => Promise<import("../../../es/shared/types").AnyObject>;
321
354
  queryTreeSearch: (keyWork: string) => Promise<import("../../../es/shared/types").AnyObject[]>;
322
355
  }>>;
323
356
  export default SelectPerson;
@@ -15,6 +15,7 @@ declare type IWordBookChild<T> = {
15
15
  declare type ITag = {
16
16
  key: IKey;
17
17
  name: string;
18
+ [key: string]: any;
18
19
  };
19
20
  declare const _default: import("vue").DefineComponent<{
20
21
  defaultList: {
@@ -53,8 +54,12 @@ declare const _default: import("vue").DefineComponent<{
53
54
  type: BooleanConstructor;
54
55
  default: boolean;
55
56
  };
57
+ treeSetting: {
58
+ type: PropType<ITreeOption>;
59
+ default: () => {};
60
+ };
56
61
  queryLoadChildData: {
57
- type: PropType<(node: TreeOption) => Promise<void>>;
62
+ type: PropType<(node: TreeOption) => Promise<AnyObject>>;
58
63
  default: undefined;
59
64
  };
60
65
  queryTreeSearch: {
@@ -99,8 +104,12 @@ declare const _default: import("vue").DefineComponent<{
99
104
  type: BooleanConstructor;
100
105
  default: boolean;
101
106
  };
107
+ treeSetting: {
108
+ type: PropType<ITreeOption>;
109
+ default: () => {};
110
+ };
102
111
  queryLoadChildData: {
103
- type: PropType<(node: TreeOption) => Promise<void>>;
112
+ type: PropType<(node: TreeOption) => Promise<AnyObject>>;
104
113
  default: undefined;
105
114
  };
106
115
  queryTreeSearch: {
@@ -109,8 +118,9 @@ declare const _default: import("vue").DefineComponent<{
109
118
  };
110
119
  }>> & {
111
120
  onCheck?: ((...args: any[]) => any) | undefined;
121
+ onCheckWithLevel?: ((...args: any[]) => any) | undefined;
112
122
  }>>;
113
- emit: (event: "check", ...args: any[]) => void;
123
+ emit: (event: "check" | "checkWithLevel", ...args: any[]) => void;
114
124
  keyword: import("vue").Ref<string>;
115
125
  checkedAll: import("vue").Ref<boolean>;
116
126
  checkedKeys: import("vue").Ref<IKey[]>;
@@ -127,20 +137,25 @@ declare const _default: import("vue").DefineComponent<{
127
137
  suffix?: (() => import("vue").VNodeChild) | undefined;
128
138
  }[]>;
129
139
  tagData: import("vue").Ref<{
140
+ [x: string]: any;
130
141
  key: IKey;
131
142
  name: string;
132
143
  }[]>;
133
- temp: ITreeOption[];
144
+ isSearch: import("vue").Ref<boolean>;
145
+ temp: TreeOption[];
134
146
  allCheckedKeys: IKey[];
135
147
  isRemote: import("vue").ComputedRef<boolean>;
136
148
  init: () => void;
149
+ queryLoadChildNode: (node: TreeOption) => Promise<AnyObject>;
137
150
  setDisabled: (data: TreeOption) => void;
138
151
  renderLabel: ({ option }: {
139
152
  option: TreeOption;
140
153
  }) => JSX.Element;
141
154
  getLabelName: (option: TreeOption) => unknown;
155
+ transformParentNodeName: (trees: TreeOption[], temp: any) => TreeOption[];
142
156
  setAllCheckedKeys: (tree: TreeOption[]) => void;
143
157
  onSearch: () => Promise<void>;
158
+ onClear: () => void;
144
159
  setTreeCheckd: (tree: TreeOption[], checked: boolean) => void;
145
160
  checkedAllChange: (checked: boolean) => void;
146
161
  uniq: (arr: ITag[]) => ITag[];
@@ -218,7 +233,7 @@ declare const _default: import("vue").DefineComponent<{
218
233
  readonly privateShow: boolean;
219
234
  }>;
220
235
  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<{}>>, {}>;
221
- }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "check"[], "check", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
236
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("check" | "checkWithLevel")[], "check" | "checkWithLevel", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
222
237
  defaultList: {
223
238
  type: PropType<(IKey | ITag)[]>;
224
239
  default: () => never[];
@@ -255,8 +270,12 @@ declare const _default: import("vue").DefineComponent<{
255
270
  type: BooleanConstructor;
256
271
  default: boolean;
257
272
  };
273
+ treeSetting: {
274
+ type: PropType<ITreeOption>;
275
+ default: () => {};
276
+ };
258
277
  queryLoadChildData: {
259
- type: PropType<(node: TreeOption) => Promise<void>>;
278
+ type: PropType<(node: TreeOption) => Promise<AnyObject>>;
260
279
  default: undefined;
261
280
  };
262
281
  queryTreeSearch: {
@@ -265,9 +284,9 @@ declare const _default: import("vue").DefineComponent<{
265
284
  };
266
285
  }>> & {
267
286
  onCheck?: ((...args: any[]) => any) | undefined;
287
+ onCheckWithLevel?: ((...args: any[]) => any) | undefined;
268
288
  }, {
269
289
  data: ITreeOption[];
270
- multiple: boolean;
271
290
  defaultList: (IKey | ITag)[];
272
291
  searchPlaceholder: string;
273
292
  searchButtonText: string;
@@ -275,7 +294,9 @@ declare const _default: import("vue").DefineComponent<{
275
294
  wordbookChild: IWordBookChild<ITreeOption>;
276
295
  showCount: boolean;
277
296
  showClear: boolean;
278
- queryLoadChildData: (node: TreeOption) => Promise<void>;
297
+ multiple: boolean;
298
+ treeSetting: ITreeOption;
299
+ queryLoadChildData: (node: TreeOption) => Promise<AnyObject>;
279
300
  queryTreeSearch: (keyWork: string) => Promise<Array<AnyObject>>;
280
301
  }>;
281
302
  export default _default;
@@ -1 +1 @@
1
- import{defineComponent as e,ref as l,computed as t,watch as a,openBlock as n,createBlock as o,unref as u,withCtx as d,createVNode as c,withKeys as r,createTextVNode as i,toDisplayString as s,withDirectives as v,vShow as h,createCommentVNode as p,createElementBlock as f,createElementVNode as y,Fragment as k,renderList as b}from"vue";import{NGrid as g,NGi as m,NSpace as _,NInputGroup as w,NInput as x,NButton as C,NCheckbox as L,NTree as j,NIcon as q,NTooltip as B}from"naive-ui";import{CloseCircleSharp as P}from"@vicons/ionicons5";import{filterTree as S,getExpandedKeys as U}from"./utils/index.js";import{cloneDeep as D}from"lodash-es";const T={key:0},K={class:"c-select-person__scroll",style:{height:"342px"}};var $=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},queryLoadChildData:{type:Function,default:void 0},queryTreeSearch:{type:Function,default:()=>Promise.resolve([])}},emits:["check"],setup(e,{emit:$}){const A=e,E=l(""),F=l(!1),I=l([]),O=l([]),N=l([]),R=l([]),z=D(A.data);let G=[];const H=t((()=>!!A.queryLoadChildData));function J(e){var l;(null==(l=e.children)?void 0:l.every((e=>e.disabled)))&&(e.disabled=!0)}function M({option:e}){var l;if((null==(l=e.children)?void 0:l.length)||H.value&&!(null==e?void 0:e.isLeaf)){const l=A.wordbook.user_count_obj&&e[A.wordbook.user_count_obj]||"",t=l?`(${l})`:"";return c("span",null,[`${e.title}${t}`])}return c(B,{trigger:"hover"},{default:()=>c("span",null,[e.title]),trigger:()=>c("span",null,[e.title])})}function Q(e){return e[A.wordbookChild.user_name_obj]||e[A.wordbook.parent_name_obj]||e.orgName||e.title||""}function V(e){var l;for(let t=0,a=e.length;t<a;t++){const a=e[t];(null==(l=a.children)?void 0:l.length)&&V(a.children),a.disabled||a.children||G.push(a.key)}}async function W(){H.value?N.value=await A.queryTreeSearch(E.value):(N.value=S(z,E.value),G=[],V(N.value),le()),O.value=N.value.length&&E.value?U(N.value):[]}function X(e,l){for(let t=0,a=e.length;t<a;t++){const a=e[t];if(!a.disabled&&(!a.children||a.isLeaf)&&(l&&!I.value.includes(a.key)&&I.value.push(a.key),!l)){const e=I.value.findIndex((e=>e===a.key));I.value.splice(e,1)}a.children&&X(a.children,l)}}function Y(e){X(N.value,e)}function Z(e){var l;for(let t=0,a=e.length;t<a;t++){const a=e[t];I.value.includes(a.key)&&R.value.push({key:a.key,name:a.title}),(null==(l=a.children)?void 0:l.length)&&Z(a.children)}}function ee(e){I.value=e}function le(){F.value=G.every((e=>R.value.findIndex((l=>l.key===e))>-1))}function te(){I.value=[]}return function e(l){var t,a;for(let n=0,o=l.length;n<o;n++){const o=l[n];o.title=Q(o),o.key||(o.key=o[A.wordbookChild.user_id_obj]||o[A.wordbook.parent_id_obj]||Date.now()),(null==(t=o.children)?void 0:t.length)?(e(o.children),J(o)):0===(null==(a=o.children)?void 0:a.length)&&Reflect.deleteProperty(o,"children"),o.disabled||o.children||G.push(o.key)}}(z),N.value=z,A.defaultList.length>0&&(H.value?(A.defaultList.forEach((e=>I.value.push(e.key))),R.value=D(A.defaultList)):(A.defaultList.forEach((e=>I.value.push(e))),Z(z))),a((()=>I),(e=>{R.value=[],e.value.length&&Z(H.value?N.value:z),le(),$("check",e.value)}),{deep:!0}),(l,t)=>(n(),o(u(g),{cols:2,class:"c-select-person"},{default:d((()=>[c(u(m),null,{default:d((()=>[c(u(_),{vertical:"",style:{"padding-right":"12px","border-right":"1px solid #e8e8e8"}},{default:d((()=>[c(u(w),{style:{"margin-bottom":"12px"}},{default:d((()=>[c(u(x),{clearable:"",value:E.value,"onUpdate:value":t[0]||(t[0]=e=>E.value=e),placeholder:e.searchPlaceholder,onKeyup:r(W,["enter"])},null,8,["value","placeholder","onKeyup"]),c(u(C),{type:"primary",onClick:W},{default:d((()=>[i(s(e.searchButtonText),1)])),_:1})])),_:1}),e.multiple?v((n(),o(u(L),{key:0,checked:F.value,"onUpdate:checked":[t[1]||(t[1]=e=>F.value=e),Y]},{default:d((()=>[i(" 全选 ")])),_:1},8,["checked"])),[[h,u(G).length<1e3]]):p("v-if",!0),c(u(j),{"virtual-scroll":"",class:"c-select-person__scroll","checked-keys":I.value,"expanded-keys":O.value,"onUpdate:expanded-keys":t[2]||(t[2]=e=>O.value=e),checkable:e.multiple,cascade:"","allow-checking-not-loaded":"",selectable:!e.multiple,"selected-keys":I.value,"onUpdate:selected-keys":t[3]||(t[3]=e=>I.value=e),data:N.value,"check-strategy":"child","render-label":M,"onUpdate:checkedKeys":ee,onLoad:e.queryLoadChildData},null,8,["checked-keys","expanded-keys","checkable","selectable","selected-keys","data","onLoad"])])),_:1})])),_:1}),c(u(m),null,{default:d((()=>[c(u(_),{vertical:"",style:{"padding-left":"12px"}},{default:d((()=>[c(u(_),{justify:"space-between",style:{"margin-bottom":"20px"}},{default:d((()=>[e.showCount?(n(),f("span",T,"已选择:"+s(R.value.length),1)):p("v-if",!0),e.showClear?(n(),f("span",{key:1,class:"c-select-person__clear-btn",onClick:te},"清空")):p("v-if",!0)])),_:1}),y("div",K,[(n(!0),f(k,null,b(R.value,(e=>(n(),f("span",{class:"c-select-person__tag-item",key:e.key},[i(s(e.name)+" ",1),c(u(q),{class:"tag-close",component:u(P),onClick:l=>function(e){I.value=I.value.filter((l=>l!==e.key))}(e)},null,8,["component","onClick"])])))),128))])])),_:1})])),_:1})])),_:1}))}});export{$ as default};
1
+ import{defineComponent as e,ref as l,computed as t,watch as a,openBlock as n,createBlock as u,unref as o,withCtx as i,createVNode as r,withKeys as c,createTextVNode as d,toDisplayString as s,withDirectives as h,vShow as v,createCommentVNode as p,mergeProps as f,createElementBlock as y,createElementVNode as k,Fragment as m,renderList as g}from"vue";import{NGrid as b,NGi as _,NSpace as w,NInputGroup as C,NInput as x,NButton as L,NCheckbox as j,NTree as T,NIcon as $,NTooltip as S}from"naive-ui";import{CloseCircleSharp as q}from"@vicons/ionicons5";import{filterTree as B,getExpandedKeys as D}from"./utils/index.js";import{cloneDeep as P}from"lodash-es";const U={key:0},N={class:"c-select-person__scroll",style:{height:"342px"}};var K=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},treeSetting:{type:Object,default:()=>({})},queryLoadChildData:{type:Function,default:void 0},queryTreeSearch:{type:Function,default:()=>Promise.resolve([])}},emits:["check","checkWithLevel"],setup(e,{emit:K}){const O=e,A=l(""),E=l(!1),F=l([]),I=l([]),W=l([]),R=l([]),z=l(!0),G=P(function e(l,t){return l&&0!==l.length?l.map((l=>{var a;const n=X(l),u=t?`${n}/${t}`:n;return{...l,tempTitle:t,children:(null==(a=l.children)?void 0:a.length)?e(null==l?void 0:l.children,u):[]}})):[]}(O.data,""));let H=[];const J=t((()=>!!O.queryLoadChildData));async function M(e){if(O.queryLoadChildData){const l=await O.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 Q(e){var l;(null==(l=e.children)?void 0:l.every((e=>e.disabled)))&&(e.disabled=!0)}function V({option:e}){var l;if((null==(l=e.children)?void 0:l.length)||J.value&&!(null==e?void 0:e.isLeaf)){const l=O.wordbook.user_count_obj&&e[O.wordbook.user_count_obj]||"",t=l?`(${l})`:"";return r("span",null,[`${e.title}${t}`])}return r(S,{trigger:"hover"},{default:()=>r("span",null,[e.title]),trigger:()=>r("span",null,[e.title])})}function X(e){return e[O.wordbookChild.user_name_obj]||e[O.wordbook.parent_name_obj]||e.orgName||e.title||""}function Y(e){var l;for(let t=0,a=e.length;t<a;t++){const a=e[t];(null==(l=a.children)?void 0:l.length)&&Y(a.children),a.disabled||a.children||H.push(a.key)}}async function Z(){z.value=!A.value.trim(),J.value?W.value=await O.queryTreeSearch(A.value):(W.value=B(G,A.value),H=[],Y(W.value),ue()),I.value=W.value.length&&A.value?D(W.value):[]}function ee(){setTimeout((()=>{Z()}))}function le(e,l){for(let t=0,a=e.length;t<a;t++){const a=e[t];if(!a.disabled&&(!a.children||a.isLeaf)&&(l&&!F.value.includes(a.key)&&F.value.push(a.key),!l)){const e=F.value.findIndex((e=>e===a.key));F.value.splice(e,1)}a.children&&le(a.children,l)}}function te(e){le(W.value,e)}function ae(e){var l;for(let t=0,a=e.length;t<a;t++){const a=e[t];F.value.includes(a.key)&&R.value.push({key:a.key,name:a.title,parentName:a.tempTitle}),(null==(l=a.children)?void 0:l.length)&&ae(a.children)}}function ne(e){F.value=e}function ue(){E.value=H.every((e=>R.value.findIndex((l=>l.key===e))>-1))}function oe(){F.value=[]}return function e(l){var t,a;for(let n=0,u=l.length;n<u;n++){const u=l[n];u.title=X(u),u.key||(u.key=u[O.wordbookChild.user_id_obj]||u[O.wordbook.parent_id_obj]||Date.now()),(null==(t=u.children)?void 0:t.length)?(e(u.children),Q(u)):0===(null==(a=u.children)?void 0:a.length)&&Reflect.deleteProperty(u,"children"),u.disabled||u.children||H.push(u.key)}}(G),W.value=G,O.defaultList.length>0&&(J.value?(O.defaultList.forEach((e=>F.value.push(e.key))),R.value=P(O.defaultList)):(O.defaultList.forEach((e=>F.value.push(e))),ae(G))),a((()=>F),(e=>{R.value=[],e.value.length&&ae(J.value?W.value:G),ue();const l=R.value.filter((l=>e.value.includes(l.key)));K("check",e.value),K("checkWithLevel",l)}),{deep:!0}),(l,t)=>(n(),u(o(b),{cols:2,class:"c-select-person"},{default:i((()=>[r(o(_),null,{default:i((()=>[r(o(w),{vertical:"",style:{"padding-right":"12px","border-right":"1px solid #e8e8e8"}},{default:i((()=>[r(o(C),{style:{"margin-bottom":"12px"}},{default:i((()=>[r(o(x),{clearable:"",value:A.value,"onUpdate:value":t[0]||(t[0]=e=>A.value=e),placeholder:e.searchPlaceholder,onClear:ee,onKeyup:c(Z,["enter"])},null,8,["value","placeholder","onKeyup"]),r(o(L),{type:"primary",onClick:Z},{default:i((()=>[d(s(e.searchButtonText),1)])),_:1})])),_:1}),e.multiple&&z.value?h((n(),u(o(j),{key:0,checked:E.value,"onUpdate:checked":[t[1]||(t[1]=e=>E.value=e),te]},{default:i((()=>[d(" 全选 ")])),_:1},8,["checked"])),[[v,o(H).length<1e3]]):p("v-if",!0),r(o(T),f({"virtual-scroll":"",class:"c-select-person__scroll","checked-keys":F.value,"expanded-keys":I.value,"onUpdate:expanded-keys":t[2]||(t[2]=e=>I.value=e),checkable:e.multiple,cascade:"","allow-checking-not-loaded":"",selectable:!e.multiple,"selected-keys":F.value,"onUpdate:selected-keys":t[3]||(t[3]=e=>F.value=e),data:W.value,"check-strategy":"child","render-label":V},e.treeSetting,{"onUpdate:checkedKeys":ne,onLoad:M}),null,16,["checked-keys","expanded-keys","checkable","selectable","selected-keys","data"])])),_:1})])),_:1}),r(o(_),null,{default:i((()=>[r(o(w),{vertical:"",style:{"padding-left":"12px"}},{default:i((()=>[r(o(w),{justify:"space-between",style:{"margin-bottom":"20px"}},{default:i((()=>[e.showCount?(n(),y("span",U,"已选择:"+s(R.value.length),1)):p("v-if",!0),e.showClear?(n(),y("span",{key:1,class:"c-select-person__clear-btn",onClick:oe},"清空")):p("v-if",!0)])),_:1}),k("div",N,[(n(!0),y(m,null,g(R.value,(e=>(n(),y("span",{class:"c-select-person__tag-item",key:e.key},[d(s(e.name)+" "+s(e.parentName?`(${e.parentName})`:"")+" ",1),r(o($),{class:"tag-close",component:o(q),onClick:l=>function(e){F.value=F.value.filter((l=>l!==e.key))}(e)},null,8,["component","onClick"])])))),128))])])),_:1})])),_:1})])),_:1}))}});export{K as default};
@@ -1 +1 @@
1
- import{cloneDeep as i}from"lodash-es";function n(n,l){const c=i(n);return e(c,l),r(c)}function e(i,n){i.forEach((i=>{var r,c;if(i.visible=null==(r=i.title)?void 0:r.includes(n),null==(c=i.children)?void 0:c.length)if(e(i.children,n),i.visible)l(i.children);else{i.children.some((i=>i.visible))&&(i.visible=!0)}}))}function l(i){i.forEach((i=>{var n;i.visible=!0,(null==(n=i.children)?void 0:n.length)&&l(i.children)}))}function r(i){return i.filter((i=>{var n;return!!i.visible&&((null==(n=i.children)?void 0:n.length)&&(i.children=r(i.children)),!0)}))}function c(i){const n=[];return function i(e){for(let l=0,r=e.length;l<r;l++){const r=e[l];r.children&&(n.push(r.key),i(r.children))}}(i),n}export{n as filterTree,c as getExpandedKeys};
1
+ import{cloneDeep as n}from"lodash-es";function i(i,r){const c=n(i);return r.trim()?function(n,i){return e(n,[]).filter((n=>{var l;return null==(l=n.title)?void 0:l.includes(i.trim())}))}(c,r):(l(c,r),t(c))}function l(n,i){n.forEach((n=>{var e,t;if(n.visible=null==(e=n.title)?void 0:e.includes(i.trim()),null==(t=n.children)?void 0:t.length)if(l(n.children,i),n.visible)r(n.children);else{n.children.some((n=>n.visible))&&(n.visible=!0)}}))}function e(n,i){return n.forEach((n=>{var l;(null==(l=n.children)?void 0:l.length)?e(n.children,i):i.push(n)})),i}function r(n){n.forEach((n=>{var i;n.visible=!0,(null==(i=n.children)?void 0:i.length)&&r(n.children)}))}function t(n){return n.filter((n=>{var i;return!!n.visible&&((null==(i=n.children)?void 0:i.length)&&(n.children=t(n.children)),!0)}))}function c(n){const i=[];return function n(l){for(let e=0,r=l.length;e<r;e++){const r=l[e];r.children&&(i.push(r.key),n(r.children))}}(n),i}export{i as filterTree,c as getExpandedKeys};