tntd 2.8.29 → 2.8.30

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 (578) hide show
  1. package/CHANGELOG.json +1034 -0
  2. package/CHANGELOG.md +605 -0
  3. package/es/_util/context.js +1 -1
  4. package/es/_util/defaultRenderEmpty.js +1 -1
  5. package/es/_util/hooks/useFlexGapSupport.js +4 -4
  6. package/es/_util/hooks/useForceUpdate.js +4 -4
  7. package/es/_util/responsiveObserve.js +1 -1
  8. package/es/_util/styleChecker.js +1 -1
  9. package/es/actions/index.js +1 -1
  10. package/es/alert/alert.js +93 -0
  11. package/es/alert/alert.js.map +1 -0
  12. package/es/alert/alert.less +128 -0
  13. package/es/array-input/index.js +9 -9
  14. package/es/cascader/cascader.js +49 -0
  15. package/es/cascader/cascader.js.map +1 -0
  16. package/es/cascader/cascader.less +16 -0
  17. package/es/check-card/group.js +8 -8
  18. package/es/check-card/index.js +6 -6
  19. package/es/checkbox/check.png +0 -0
  20. package/es/checkbox/checkbox-group.js +1 -1
  21. package/es/checkbox/checkbox.js +65 -0
  22. package/es/checkbox/checkbox.js.map +1 -0
  23. package/es/checkbox/checkbox.less +69 -0
  24. package/es/color-picker/ColorPicker.js +6 -6
  25. package/es/color-picker/index.js +1 -1
  26. package/es/columns/index.js +1 -1
  27. package/es/config-provider/config-provider.js +1 -1
  28. package/es/date-picker/DatePicker.js +128 -0
  29. package/es/date-picker/DatePicker.js.map +1 -0
  30. package/es/date-picker/index.less +294 -0
  31. package/es/descriptions/descriptions.js +5 -5
  32. package/es/development-login/LoginModal.js +6 -6
  33. package/es/development-login/index.js +4 -4
  34. package/es/drawer/drawer.js +2 -2
  35. package/es/ellipsis/Svg/CopySVG.js +1 -1
  36. package/es/ellipsis/Svg/TickSVG.js +1 -1
  37. package/es/ellipsis/index.js +5 -5
  38. package/es/empty/empty.js +2 -2
  39. package/es/empty/empty.stories.js +2 -2
  40. package/es/exception/exception.js +1 -1
  41. package/es/form/form.js +2 -2
  42. package/es/grid-v4/col.js +2 -2
  43. package/es/grid-v4/hooks/useBreakpoint.js +1 -1
  44. package/es/grid-v4/index.js +1 -1
  45. package/es/grid-v4/row.js +6 -6
  46. package/es/handle/index.js +1 -1
  47. package/es/handle-icon/index.js +11 -11
  48. package/es/icon/IconFont.js +1 -1
  49. package/es/icon/components/Icon.js +9 -9
  50. package/es/icon/components/index.js +1 -1
  51. package/es/icon/components/utils.js +3 -3
  52. package/es/icon/index.js +7 -7
  53. package/es/icon/twoTonePrimaryColor.js +1 -1
  54. package/es/icon/utils.js +1 -1
  55. package/es/img/Contain.js +1 -1
  56. package/es/img/Cover.js +5 -5
  57. package/es/img/index.js +5 -5
  58. package/es/index.js +1 -1
  59. package/es/input/input.js +2 -2
  60. package/es/input-number/index.js +1 -1
  61. package/es/input-number/inputNumber.js +54 -0
  62. package/es/input-number/inputNumber.js.map +1 -0
  63. package/es/input-number/inputNumber.less +12 -0
  64. package/es/label/index.js +2 -2
  65. package/es/loading-button/index.js +5 -5
  66. package/es/locale/default.js +1 -1
  67. package/es/locale/en_US.js +1 -1
  68. package/es/locale/zh_CN.js +1 -1
  69. package/es/modal/index.less +36 -0
  70. package/es/modal/modal.js +1 -1
  71. package/es/notification/assets/index.js +1 -1
  72. package/es/notification/index.js +1 -1
  73. package/es/notification/notification.js +1 -1
  74. package/es/page/Box.js +1 -1
  75. package/es/page/index.js +7 -7
  76. package/es/page-container/index.js +1 -1
  77. package/es/page-loading/index.js +1 -1
  78. package/es/popconfirm/index.less +32 -0
  79. package/es/popconfirm/popconfirm.js +61 -0
  80. package/es/popconfirm/popconfirm.js.map +1 -0
  81. package/es/popover/index.less +57 -0
  82. package/es/popover/popover.js +55 -0
  83. package/es/popover/popover.js.map +1 -0
  84. package/es/preview-text/index.js +7 -7
  85. package/es/progress/progress.js +148 -0
  86. package/es/progress/progress.js.map +1 -0
  87. package/es/progress/progress.less +82 -0
  88. package/es/query-form/Field/Checkbox.js +1 -1
  89. package/es/query-form/Field/Composition/FieldPopover.js +341 -0
  90. package/es/query-form/Field/Composition/FieldPopover.js.map +1 -0
  91. package/es/query-form/Field/Composition/FieldPopover.less +35 -0
  92. package/es/query-form/Field/Composition/Select.js +146 -0
  93. package/es/query-form/Field/Composition/Select.js.map +1 -0
  94. package/es/query-form/Field/Composition/ValueTag.js +158 -0
  95. package/es/query-form/Field/Composition/ValueTag.js.map +1 -0
  96. package/es/query-form/Field/Composition/index.js +321 -0
  97. package/es/query-form/Field/Composition/index.js.map +1 -0
  98. package/es/query-form/Field/Composition/index.less +145 -0
  99. package/es/query-form/Field/Composition/utils.js +168 -0
  100. package/es/query-form/Field/Composition/utils.js.map +1 -0
  101. package/es/query-form/Field/Select.js +6 -6
  102. package/es/query-form/Field/SelectInput.js +6 -6
  103. package/es/query-form/Field/fieldsMap.js +3 -2
  104. package/es/query-form/Field/fieldsMap.js.map +1 -1
  105. package/es/query-form/Field/index.js +10 -10
  106. package/es/query-form/createActions.js +1 -1
  107. package/es/query-form/index.js +10 -10
  108. package/es/query-form/useForm.js +1 -1
  109. package/es/query-form-v2/index.less +133 -0
  110. package/es/query-list-scene/List.js +13 -13
  111. package/es/query-list-scene/QueryForm.js +10 -10
  112. package/es/query-list-scene/QueryListScene.js +10 -10
  113. package/es/query-list-scene/Title.js +1 -1
  114. package/es/query-list-scene/Toolbar.js +2 -2
  115. package/es/query-list-scene/createActions.js +1 -1
  116. package/es/query-list-scene/index.js +1 -1
  117. package/es/query-list-scene/useActions.js +1 -1
  118. package/es/radio/index.js +1 -1
  119. package/es/radio/radio-group.js +1 -1
  120. package/es/radio/radio.js +75 -0
  121. package/es/radio/radio.js.map +1 -0
  122. package/es/radio/radio.less +43 -0
  123. package/es/render-empty/render-empty.js +1 -1
  124. package/es/scroll-bar/Bar.js +91 -0
  125. package/es/scroll-bar/Bar.js.map +1 -0
  126. package/es/scroll-bar/Context.js +13 -0
  127. package/es/scroll-bar/Context.js.map +1 -0
  128. package/es/scroll-bar/ScrollBar.js +97 -0
  129. package/es/scroll-bar/ScrollBar.js.map +1 -0
  130. package/es/scroll-bar/Thumb.js +125 -0
  131. package/es/scroll-bar/Thumb.js.map +1 -0
  132. package/es/scroll-bar/index.js +10 -0
  133. package/es/scroll-bar/index.js.map +1 -0
  134. package/es/scroll-bar/scrollBar.less +59 -0
  135. package/es/scroll-bar/util.js +39 -0
  136. package/es/scroll-bar/util.js.map +1 -0
  137. package/es/segmented/index.js +2 -2
  138. package/es/select/select.js +2 -2
  139. package/es/spin/spin.js +44 -0
  140. package/es/spin/spin.js.map +1 -0
  141. package/es/spin/spin.less +9 -0
  142. package/es/steps/assets/background_left.svg +12 -0
  143. package/es/steps/assets/background_right.svg +12 -0
  144. package/es/steps/assets/horizontal_line.svg +3 -0
  145. package/es/steps/assets/vertical_line.svg +3 -0
  146. package/es/steps/stepStyle/icon.less +51 -0
  147. package/es/steps/stepStyle/progress-dot.less +10 -0
  148. package/es/steps/stepStyle/variables.less +8 -0
  149. package/es/steps/stepStyle/vertical.less +41 -0
  150. package/es/steps/steps.js +2 -2
  151. package/es/svg-components/index.js +1 -1
  152. package/es/switch/index.less +45 -0
  153. package/es/switch/switch.js +1 -1
  154. package/es/table/hooks/use-column-setting.js +4 -4
  155. package/es/table/hooks/use-expand-fixed.js +6 -6
  156. package/es/table/resizableTable/index.js +6 -6
  157. package/es/table/table-hoc.js +1 -1
  158. package/es/table/table.js +9 -9
  159. package/es/table/table.stories.js +2 -2
  160. package/es/table/total-shower.js +1 -1
  161. package/es/table/utils.js +1 -1
  162. package/es/table-container/index.js +1 -1
  163. package/es/tabs/tabs.less +125 -0
  164. package/es/tabs-container/index.js +1 -1
  165. package/es/tag/tag.js +2 -2
  166. package/es/time-picker/TimePicker.js +55 -0
  167. package/es/time-picker/TimePicker.js.map +1 -0
  168. package/es/time-picker/index.less +38 -0
  169. package/es/title/index.js +1 -1
  170. package/es/tntd-action/Action.js +141 -0
  171. package/es/tntd-action/Action.js.map +1 -0
  172. package/es/tntd-action/index.less +61 -0
  173. package/es/tntd-cascader/AntdCascader/component/context.js +1 -1
  174. package/es/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +1 -1
  175. package/es/tntd-cascader/AntdCascader/component/getIcons.js +1 -1
  176. package/es/tntd-cascader/AntdCascader/component/useCompactItemContext.js +2 -2
  177. package/es/tntd-cascader/AntdCascader/config/utils.js +2 -2
  178. package/es/tntd-cascader/AntdCascader/index.js +7 -7
  179. package/es/tntd-cascader/index.js +1 -1
  180. package/es/tntd-cascader/rc-cascader/Cascader.js +8 -8
  181. package/es/tntd-cascader/rc-cascader/OptionList/Checkbox.js +2 -2
  182. package/es/tntd-cascader/rc-cascader/OptionList/Column.js +7 -7
  183. package/es/tntd-cascader/rc-cascader/OptionList/index.js +9 -9
  184. package/es/tntd-cascader/rc-cascader/OptionList/useActive.js +5 -5
  185. package/es/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +8 -8
  186. package/es/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +5 -5
  187. package/es/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +1 -1
  188. package/es/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +6 -6
  189. package/es/tntd-cascader/rc-cascader/index.js +1 -1
  190. package/es/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +4 -4
  191. package/es/tntd-form/ErrorList.js +7 -7
  192. package/es/tntd-form/Form.js +6 -6
  193. package/es/tntd-form/FormItem/ItemHolder.js +6 -6
  194. package/es/tntd-form/FormItem/index.js +8 -8
  195. package/es/tntd-form/FormItemInput.js +1 -1
  196. package/es/tntd-form/FormItemLabel.js +2 -2
  197. package/es/tntd-form/FormList.js +1 -1
  198. package/es/tntd-form/context.js +1 -1
  199. package/es/tntd-form/hooks/useDebounce.js +4 -4
  200. package/es/tntd-form/hooks/useForm.js +5 -5
  201. package/es/tntd-form/hooks/useFormItemStatus.js +1 -1
  202. package/es/tntd-form/hooks/useFrameState.js +5 -5
  203. package/es/tntd-form/index.js +1 -1
  204. package/es/tntd-icon/index.js +1 -1
  205. package/es/tntd-layout/AppList.js +6 -6
  206. package/es/tntd-layout/Application.js +6 -6
  207. package/es/tntd-layout/Avatar.js +2 -2
  208. package/es/tntd-layout/CompatibleLanguage.js +6 -6
  209. package/es/tntd-layout/EnterpriseLayout/Avatar.js +2 -2
  210. package/es/tntd-layout/EnterpriseLayout/Language.js +6 -6
  211. package/es/tntd-layout/EnterpriseLayout/Theme.js +6 -6
  212. package/es/tntd-layout/EnterpriseLayout/index.js +1 -1
  213. package/es/tntd-layout/GlobalNavigation/NavigationPopup.js +6 -6
  214. package/es/tntd-layout/GlobalNavigation/index.js +9 -9
  215. package/es/tntd-layout/Header.js +2 -2
  216. package/es/tntd-layout/HeaderActions.js +2 -2
  217. package/es/tntd-layout/HeaderNavs.js +6 -6
  218. package/es/tntd-layout/HeaderTabs.js +7 -7
  219. package/es/tntd-layout/Iconfont.js +1 -1
  220. package/es/tntd-layout/Language.js +6 -6
  221. package/es/tntd-layout/Layout.js +6 -6
  222. package/es/tntd-layout/Logo.js +2 -2
  223. package/es/tntd-layout/OrgAppList.js +6 -6
  224. package/es/tntd-layout/SideMenu.js +6 -6
  225. package/es/tntd-layout/Theme.js +6 -6
  226. package/es/tntd-layout/createActions.js +1 -1
  227. package/es/tntd-layout/images/index.js +1 -1
  228. package/es/tntd-layout/index.js +1 -1
  229. package/es/tntd-layout/paaslayout/CompactSideMenu.js +6 -6
  230. package/es/tntd-layout/paaslayout/Header.js +2 -2
  231. package/es/tntd-layout/paaslayout/Logo.js +2 -2
  232. package/es/tntd-layout/paaslayout/SideMenu.js +6 -6
  233. package/es/tntd-layout/paaslayout/index.js +6 -6
  234. package/es/tntd-layout/storage.js +1 -1
  235. package/es/tntd-modal/index.js +6 -6
  236. package/es/tntd-rc-select/_util/PurePanel.js +5 -5
  237. package/es/tntd-rc-select/_util/context.js +1 -1
  238. package/es/tntd-rc-select/_util/defaultRenderEmpty.js +1 -1
  239. package/es/tntd-rc-select/_util/getIcons.js +1 -1
  240. package/es/tntd-rc-select/_util/useCompactItemContext.js +2 -2
  241. package/es/tntd-rc-select/index.js +2 -2
  242. package/es/tntd-reference/AHref/index.js +1 -1
  243. package/es/tntd-reference/ReferenceBatchCheck/index.js +1 -1
  244. package/es/tntd-reference/ReferenceBatchDrawer/index.js +5 -5
  245. package/es/tntd-reference/ReferenceCheck/index.js +1 -1
  246. package/es/tntd-reference/ReferenceDrawer/index.js +5 -5
  247. package/es/tntd-reference/ReferenceInfo/index.js +1 -1
  248. package/es/tntd-reference/index.js +1 -1
  249. package/es/tntd-second-page/index.js +1 -1
  250. package/es/tntd-select/DropDownWrap.js +8 -8
  251. package/es/tntd-select/index.js +10 -9
  252. package/es/tntd-select/index.less +7 -0
  253. package/es/tntd-virtual-tree/index.js +8 -8
  254. package/es/tntd-virtual-tree/index.less +1 -1
  255. package/es/tntd-virtual-tree/utils.js +28 -28
  256. package/es/tntd-virtual-tree-select/index.js +10 -10
  257. package/es/tntd-virtual-tree-select/utils.js +9 -9
  258. package/es/tooltip/tooltip.js +1 -1
  259. package/es/upload/index.js +6 -6
  260. package/es/upload/svg/UploadSVG.js +1 -1
  261. package/es/utils/checkAuth.js +4 -4
  262. package/es/utils/index.js +9 -9
  263. package/es/utils/lang.js +1 -1
  264. package/es/water-mark/index.js +5 -5
  265. package/lib/_util/context.js +3 -3
  266. package/lib/_util/defaultRenderEmpty.js +3 -3
  267. package/lib/_util/hooks/useFlexGapSupport.js +14 -15
  268. package/lib/_util/hooks/useForceUpdate.js +14 -15
  269. package/lib/_util/responsiveObserve.js +7 -13
  270. package/lib/_util/styleChecker.js +3 -3
  271. package/lib/actions/index.js +3 -3
  272. package/lib/alert/alert.d.ts +12 -0
  273. package/lib/alert/alert.d.ts.map +1 -0
  274. package/lib/alert/alert.js +147 -0
  275. package/lib/alert/alert.js.map +1 -0
  276. package/lib/alert/alert.less +128 -0
  277. package/lib/array-input/index.js +30 -37
  278. package/lib/cascader/cascader.d.ts +10 -0
  279. package/lib/cascader/cascader.d.ts.map +1 -0
  280. package/lib/cascader/cascader.js +84 -0
  281. package/lib/cascader/cascader.js.map +1 -0
  282. package/lib/cascader/cascader.less +16 -0
  283. package/lib/check-card/group.js +23 -24
  284. package/lib/check-card/index.js +24 -31
  285. package/lib/checkbox/check.png +0 -0
  286. package/lib/checkbox/checkbox-group.js +3 -3
  287. package/lib/checkbox/checkbox.d.ts +16 -0
  288. package/lib/checkbox/checkbox.d.ts.map +1 -0
  289. package/lib/checkbox/checkbox.js +100 -0
  290. package/lib/checkbox/checkbox.js.map +1 -0
  291. package/lib/checkbox/checkbox.less +69 -0
  292. package/lib/color-picker/ColorPicker.js +24 -31
  293. package/lib/color-picker/index.js +3 -3
  294. package/lib/columns/index.js +3 -3
  295. package/lib/config-provider/config-provider.js +3 -3
  296. package/lib/date-picker/DatePicker.d.ts +21 -0
  297. package/lib/date-picker/DatePicker.d.ts.map +1 -0
  298. package/lib/date-picker/DatePicker.js +163 -0
  299. package/lib/date-picker/DatePicker.js.map +1 -0
  300. package/lib/date-picker/index.less +294 -0
  301. package/lib/descriptions/descriptions.js +13 -19
  302. package/lib/development-login/LoginModal.js +24 -31
  303. package/lib/development-login/index.js +14 -15
  304. package/lib/drawer/drawer.js +10 -16
  305. package/lib/ellipsis/Svg/CopySVG.js +3 -3
  306. package/lib/ellipsis/Svg/TickSVG.js +3 -3
  307. package/lib/ellipsis/index.js +17 -18
  308. package/lib/empty/empty.js +10 -16
  309. package/lib/empty/empty.stories.js +6 -9
  310. package/lib/exception/exception.js +3 -3
  311. package/lib/form/form.js +10 -16
  312. package/lib/grid-v4/col.js +10 -16
  313. package/lib/grid-v4/hooks/useBreakpoint.js +3 -3
  314. package/lib/grid-v4/index.js +3 -3
  315. package/lib/grid-v4/row.js +24 -31
  316. package/lib/handle/index.js +3 -3
  317. package/lib/handle-icon/index.js +13 -13
  318. package/lib/icon/IconFont.js +3 -3
  319. package/lib/icon/components/Icon.js +44 -70
  320. package/lib/icon/components/index.js +3 -3
  321. package/lib/icon/components/utils.js +10 -18
  322. package/lib/icon/index.js +26 -33
  323. package/lib/icon/twoTonePrimaryColor.js +3 -3
  324. package/lib/icon/utils.js +3 -3
  325. package/lib/img/Contain.js +3 -3
  326. package/lib/img/Cover.js +17 -18
  327. package/lib/img/index.js +17 -18
  328. package/lib/index.js +3 -3
  329. package/lib/input/input.js +10 -16
  330. package/lib/input-number/index.js +3 -3
  331. package/lib/input-number/inputNumber.d.ts +10 -0
  332. package/lib/input-number/inputNumber.d.ts.map +1 -0
  333. package/lib/input-number/inputNumber.js +89 -0
  334. package/lib/input-number/inputNumber.js.map +1 -0
  335. package/lib/input-number/inputNumber.less +12 -0
  336. package/lib/label/index.js +10 -16
  337. package/lib/loading-button/index.js +17 -18
  338. package/lib/locale/default.js +3 -3
  339. package/lib/locale/en_US.js +3 -3
  340. package/lib/locale/zh_CN.js +3 -3
  341. package/lib/modal/index.less +36 -0
  342. package/lib/modal/modal.js +3 -3
  343. package/lib/notification/assets/index.js +3 -3
  344. package/lib/notification/index.js +3 -3
  345. package/lib/notification/notification.js +3 -3
  346. package/lib/page/Box.js +3 -3
  347. package/lib/page/index.js +26 -33
  348. package/lib/page-container/index.js +3 -3
  349. package/lib/page-loading/index.js +3 -3
  350. package/lib/popconfirm/index.less +32 -0
  351. package/lib/popconfirm/popconfirm.d.ts +8 -0
  352. package/lib/popconfirm/popconfirm.d.ts.map +1 -0
  353. package/lib/popconfirm/popconfirm.js +96 -0
  354. package/lib/popconfirm/popconfirm.js.map +1 -0
  355. package/lib/popover/index.less +57 -0
  356. package/lib/popover/popover.d.ts +14 -0
  357. package/lib/popover/popover.d.ts.map +1 -0
  358. package/lib/popover/popover.js +90 -0
  359. package/lib/popover/popover.js.map +1 -0
  360. package/lib/preview-text/index.js +9 -9
  361. package/lib/progress/progress.d.ts +12 -0
  362. package/lib/progress/progress.d.ts.map +1 -0
  363. package/lib/progress/progress.js +179 -0
  364. package/lib/progress/progress.js.map +1 -0
  365. package/lib/progress/progress.less +82 -0
  366. package/lib/query-form/Field/Checkbox.js +3 -3
  367. package/lib/query-form/Field/Composition/FieldPopover.d.ts +19 -0
  368. package/lib/query-form/Field/Composition/FieldPopover.d.ts.map +1 -0
  369. package/lib/query-form/Field/Composition/FieldPopover.js +418 -0
  370. package/lib/query-form/Field/Composition/FieldPopover.js.map +1 -0
  371. package/lib/query-form/Field/Composition/FieldPopover.less +35 -0
  372. package/lib/query-form/Field/Composition/Select.d.ts +4 -0
  373. package/lib/query-form/Field/Composition/Select.d.ts.map +1 -0
  374. package/lib/query-form/Field/Composition/Select.js +242 -0
  375. package/lib/query-form/Field/Composition/Select.js.map +1 -0
  376. package/lib/query-form/Field/Composition/ValueTag.d.ts +13 -0
  377. package/lib/query-form/Field/Composition/ValueTag.d.ts.map +1 -0
  378. package/lib/query-form/Field/Composition/ValueTag.js +235 -0
  379. package/lib/query-form/Field/Composition/ValueTag.js.map +1 -0
  380. package/lib/query-form/Field/Composition/index.d.ts +13 -0
  381. package/lib/query-form/Field/Composition/index.d.ts.map +1 -0
  382. package/lib/query-form/Field/Composition/index.js +425 -0
  383. package/lib/query-form/Field/Composition/index.js.map +1 -0
  384. package/lib/query-form/Field/Composition/index.less +145 -0
  385. package/lib/query-form/Field/Composition/utils.d.ts +21 -0
  386. package/lib/query-form/Field/Composition/utils.d.ts.map +1 -0
  387. package/lib/query-form/Field/Composition/utils.js +172 -0
  388. package/lib/query-form/Field/Composition/utils.js.map +1 -0
  389. package/lib/query-form/Field/Select.js +24 -31
  390. package/lib/query-form/Field/SelectInput.js +24 -31
  391. package/lib/query-form/Field/fieldsMap.d.ts +4 -3
  392. package/lib/query-form/Field/fieldsMap.d.ts.map +1 -1
  393. package/lib/query-form/Field/fieldsMap.js +5 -4
  394. package/lib/query-form/Field/fieldsMap.js.map +1 -1
  395. package/lib/query-form/Field/index.js +47 -73
  396. package/lib/query-form/createActions.js +3 -3
  397. package/lib/query-form/index.js +44 -70
  398. package/lib/query-form/useForm.js +3 -3
  399. package/lib/query-form-backup/Field/Composition/FieldPopover.less +35 -0
  400. package/lib/query-form-backup/Field/Composition/index.less +114 -0
  401. package/lib/query-form-backup/index.less +90 -0
  402. package/lib/query-form-v2/index.less +133 -0
  403. package/lib/query-list-scene/List.js +41 -61
  404. package/lib/query-list-scene/QueryForm.js +44 -70
  405. package/lib/query-list-scene/QueryListScene.js +44 -70
  406. package/lib/query-list-scene/Title.js +3 -3
  407. package/lib/query-list-scene/Toolbar.js +10 -16
  408. package/lib/query-list-scene/createActions.js +3 -3
  409. package/lib/query-list-scene/index.js +3 -3
  410. package/lib/query-list-scene/useActions.js +3 -3
  411. package/lib/radio/index.js +3 -3
  412. package/lib/radio/radio-group.js +3 -3
  413. package/lib/radio/radio.d.ts +17 -0
  414. package/lib/radio/radio.d.ts.map +1 -0
  415. package/lib/radio/radio.js +110 -0
  416. package/lib/radio/radio.js.map +1 -0
  417. package/lib/radio/radio.less +43 -0
  418. package/lib/render-empty/render-empty.js +3 -3
  419. package/lib/scroll-bar/Bar.d.ts +4 -0
  420. package/lib/scroll-bar/Bar.d.ts.map +1 -0
  421. package/lib/scroll-bar/Bar.js +168 -0
  422. package/lib/scroll-bar/Bar.js.map +1 -0
  423. package/lib/scroll-bar/Context.d.ts +7 -0
  424. package/lib/scroll-bar/Context.d.ts.map +1 -0
  425. package/lib/scroll-bar/Context.js +17 -0
  426. package/lib/scroll-bar/Context.js.map +1 -0
  427. package/lib/scroll-bar/ScrollBar.d.ts +4 -0
  428. package/lib/scroll-bar/ScrollBar.d.ts.map +1 -0
  429. package/lib/scroll-bar/ScrollBar.js +132 -0
  430. package/lib/scroll-bar/ScrollBar.js.map +1 -0
  431. package/lib/scroll-bar/Thumb.d.ts +3 -0
  432. package/lib/scroll-bar/Thumb.d.ts.map +1 -0
  433. package/lib/scroll-bar/Thumb.js +202 -0
  434. package/lib/scroll-bar/Thumb.js.map +1 -0
  435. package/lib/scroll-bar/index.d.ts +3 -0
  436. package/lib/scroll-bar/index.d.ts.map +1 -0
  437. package/lib/scroll-bar/index.js +14 -0
  438. package/lib/scroll-bar/index.js.map +1 -0
  439. package/lib/scroll-bar/scrollBar.less +59 -0
  440. package/lib/scroll-bar/util.d.ts +40 -0
  441. package/lib/scroll-bar/util.d.ts.map +1 -0
  442. package/lib/scroll-bar/util.js +66 -0
  443. package/lib/scroll-bar/util.js.map +1 -0
  444. package/lib/segmented/index.js +10 -16
  445. package/lib/select/select.js +10 -16
  446. package/lib/spin/spin.d.ts +9 -0
  447. package/lib/spin/spin.d.ts.map +1 -0
  448. package/lib/spin/spin.js +79 -0
  449. package/lib/spin/spin.js.map +1 -0
  450. package/lib/spin/spin.less +9 -0
  451. package/lib/steps/assets/background_left.svg +12 -0
  452. package/lib/steps/assets/background_right.svg +12 -0
  453. package/lib/steps/assets/horizontal_line.svg +3 -0
  454. package/lib/steps/assets/vertical_line.svg +3 -0
  455. package/lib/steps/stepStyle/icon.less +51 -0
  456. package/lib/steps/stepStyle/progress-dot.less +10 -0
  457. package/lib/steps/stepStyle/variables.less +8 -0
  458. package/lib/steps/stepStyle/vertical.less +41 -0
  459. package/lib/steps/steps.js +10 -16
  460. package/lib/svg-components/index.js +3 -3
  461. package/lib/switch/index.less +45 -0
  462. package/lib/switch/switch.js +3 -3
  463. package/lib/table/hooks/use-column-setting.js +14 -15
  464. package/lib/table/hooks/use-expand-fixed.js +30 -36
  465. package/lib/table/resizableTable/index.js +24 -31
  466. package/lib/table/table-hoc.js +3 -3
  467. package/lib/table/table.js +27 -34
  468. package/lib/table/table.stories.js +10 -16
  469. package/lib/table/total-shower.js +3 -3
  470. package/lib/table/utils.js +3 -3
  471. package/lib/table-container/index.js +3 -3
  472. package/lib/tabs/tabs.less +125 -0
  473. package/lib/tabs-container/index.js +3 -3
  474. package/lib/tag/tag.js +10 -16
  475. package/lib/time-picker/TimePicker.d.ts +9 -0
  476. package/lib/time-picker/TimePicker.d.ts.map +1 -0
  477. package/lib/time-picker/TimePicker.js +90 -0
  478. package/lib/time-picker/TimePicker.js.map +1 -0
  479. package/lib/time-picker/index.less +38 -0
  480. package/lib/title/index.js +3 -3
  481. package/lib/tntd-action/Action.d.ts +6 -0
  482. package/lib/tntd-action/Action.d.ts.map +1 -0
  483. package/lib/tntd-action/Action.js +218 -0
  484. package/lib/tntd-action/Action.js.map +1 -0
  485. package/lib/tntd-action/index.less +61 -0
  486. package/lib/tntd-cascader/AntdCascader/component/context.js +3 -3
  487. package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +3 -3
  488. package/lib/tntd-cascader/AntdCascader/component/getIcons.js +3 -3
  489. package/lib/tntd-cascader/AntdCascader/component/useCompactItemContext.js +10 -16
  490. package/lib/tntd-cascader/AntdCascader/config/utils.js +10 -16
  491. package/lib/tntd-cascader/AntdCascader/index.js +26 -33
  492. package/lib/tntd-cascader/index.js +3 -3
  493. package/lib/tntd-cascader/rc-cascader/Cascader.js +23 -24
  494. package/lib/tntd-cascader/rc-cascader/OptionList/Checkbox.js +10 -16
  495. package/lib/tntd-cascader/rc-cascader/OptionList/Column.js +26 -33
  496. package/lib/tntd-cascader/rc-cascader/OptionList/index.js +30 -37
  497. package/lib/tntd-cascader/rc-cascader/OptionList/useActive.js +17 -18
  498. package/lib/tntd-cascader/rc-cascader/OptionList/useKeyboard.js +23 -24
  499. package/lib/tntd-cascader/rc-cascader/hooks/useDisplayValues.js +16 -17
  500. package/lib/tntd-cascader/rc-cascader/hooks/useSearchConfig.js +3 -3
  501. package/lib/tntd-cascader/rc-cascader/hooks/useSearchOptions.js +23 -30
  502. package/lib/tntd-cascader/rc-cascader/index.js +3 -3
  503. package/lib/tntd-cascader/rc-cascader/utils/warningPropsUtil.js +6 -6
  504. package/lib/tntd-form/ErrorList.js +26 -33
  505. package/lib/tntd-form/Form.js +24 -31
  506. package/lib/tntd-form/FormItem/ItemHolder.js +24 -31
  507. package/lib/tntd-form/FormItem/index.js +23 -24
  508. package/lib/tntd-form/FormItemInput.js +3 -3
  509. package/lib/tntd-form/FormItemLabel.js +10 -16
  510. package/lib/tntd-form/FormList.js +3 -3
  511. package/lib/tntd-form/context.js +3 -3
  512. package/lib/tntd-form/hooks/useDebounce.js +14 -15
  513. package/lib/tntd-form/hooks/useForm.js +17 -18
  514. package/lib/tntd-form/hooks/useFormItemStatus.js +3 -3
  515. package/lib/tntd-form/hooks/useFrameState.js +17 -18
  516. package/lib/tntd-form/index.js +3 -3
  517. package/lib/tntd-icon/index.js +3 -3
  518. package/lib/tntd-layout/AppList.js +20 -24
  519. package/lib/tntd-layout/Application.js +20 -24
  520. package/lib/tntd-layout/Avatar.js +6 -9
  521. package/lib/tntd-layout/CompatibleLanguage.js +20 -24
  522. package/lib/tntd-layout/EnterpriseLayout/Avatar.js +6 -9
  523. package/lib/tntd-layout/EnterpriseLayout/Language.js +20 -24
  524. package/lib/tntd-layout/EnterpriseLayout/Theme.js +20 -24
  525. package/lib/tntd-layout/EnterpriseLayout/index.js +3 -3
  526. package/lib/tntd-layout/GlobalNavigation/NavigationPopup.js +20 -24
  527. package/lib/tntd-layout/GlobalNavigation/index.js +26 -30
  528. package/lib/tntd-layout/Header.js +6 -9
  529. package/lib/tntd-layout/HeaderActions.js +6 -9
  530. package/lib/tntd-layout/HeaderNavs.js +20 -24
  531. package/lib/tntd-layout/HeaderTabs.js +27 -37
  532. package/lib/tntd-layout/Iconfont.js +3 -3
  533. package/lib/tntd-layout/Language.js +20 -24
  534. package/lib/tntd-layout/Layout.js +20 -24
  535. package/lib/tntd-layout/Logo.js +6 -9
  536. package/lib/tntd-layout/OrgAppList.js +20 -24
  537. package/lib/tntd-layout/SideMenu.js +20 -24
  538. package/lib/tntd-layout/Theme.js +20 -24
  539. package/lib/tntd-layout/createActions.js +3 -3
  540. package/lib/tntd-layout/images/index.js +3 -3
  541. package/lib/tntd-layout/index.js +3 -3
  542. package/lib/tntd-layout/paaslayout/CompactSideMenu.js +20 -24
  543. package/lib/tntd-layout/paaslayout/Header.js +6 -9
  544. package/lib/tntd-layout/paaslayout/Logo.js +6 -9
  545. package/lib/tntd-layout/paaslayout/SideMenu.js +20 -24
  546. package/lib/tntd-layout/paaslayout/index.js +20 -24
  547. package/lib/tntd-layout/storage.js +3 -3
  548. package/lib/tntd-modal/index.js +24 -31
  549. package/lib/tntd-rc-select/_util/PurePanel.js +17 -18
  550. package/lib/tntd-rc-select/_util/context.js +3 -3
  551. package/lib/tntd-rc-select/_util/defaultRenderEmpty.js +3 -3
  552. package/lib/tntd-rc-select/_util/getIcons.js +3 -3
  553. package/lib/tntd-rc-select/_util/useCompactItemContext.js +10 -16
  554. package/lib/tntd-rc-select/index.js +10 -16
  555. package/lib/tntd-reference/AHref/index.js +3 -3
  556. package/lib/tntd-reference/ReferenceBatchCheck/index.js +3 -3
  557. package/lib/tntd-reference/ReferenceBatchDrawer/index.js +17 -18
  558. package/lib/tntd-reference/ReferenceCheck/index.js +3 -3
  559. package/lib/tntd-reference/ReferenceDrawer/index.js +17 -18
  560. package/lib/tntd-reference/ReferenceInfo/index.js +3 -3
  561. package/lib/tntd-reference/index.js +3 -3
  562. package/lib/tntd-second-page/index.js +3 -3
  563. package/lib/tntd-select/DropDownWrap.js +34 -54
  564. package/lib/tntd-select/index.js +40 -57
  565. package/lib/tntd-select/index.less +7 -0
  566. package/lib/tntd-virtual-tree/index.js +23 -24
  567. package/lib/tntd-virtual-tree/index.less +1 -1
  568. package/lib/tntd-virtual-tree/utils.js +62 -66
  569. package/lib/tntd-virtual-tree-select/index.js +22 -23
  570. package/lib/tntd-virtual-tree-select/utils.js +20 -21
  571. package/lib/tooltip/tooltip.js +3 -3
  572. package/lib/upload/index.js +41 -45
  573. package/lib/upload/svg/UploadSVG.js +3 -3
  574. package/lib/utils/checkAuth.js +6 -6
  575. package/lib/utils/index.js +20 -21
  576. package/lib/utils/lang.js +3 -3
  577. package/lib/water-mark/index.js +17 -18
  578. package/package.json +2 -2
@@ -0,0 +1,82 @@
1
+ @import '../style/themes/index.less';
2
+ @import '../style/mixins/index';
3
+ @progress-prefix-cls: ~'@{ant-prefix}-progress';
4
+ .tnt-progress.@{progress-prefix-cls} {
5
+ .ant-progress-text{
6
+ // font-family: PingFang SC;
7
+ font-weight: 500;
8
+ }
9
+ .ant-progress-cus-format-label{
10
+ .ant-progress-cus-format-label{
11
+ padding-bottom: 4px;
12
+ }
13
+ }
14
+ &-percent-bottom{
15
+ .ant-progress-outer{
16
+ padding-right: 0;
17
+ }
18
+ .ant-progress-text{
19
+ width: 100%;
20
+ display: block;
21
+ text-align: right;
22
+ margin-left: 0;
23
+ }
24
+ }
25
+ &-circle-progress{
26
+ .@{progress-prefix-cls}-cus-format{
27
+ height: 100%;
28
+ display: flex;
29
+ flex-direction: column;
30
+ justify-content: center;
31
+ align-items: center;
32
+ }
33
+ }
34
+ &-small-circle{
35
+ .ant-progress-text{
36
+ height: 100%;
37
+ }
38
+ .ant-progress-inner{
39
+ overflow:visible;
40
+ }
41
+ .tntd-ellipsis{
42
+ position: absolute;
43
+ bottom: -1.8em;
44
+ font-size: 0.75em;
45
+ // margin-bottom: 2px;
46
+ // color: #8B919E;
47
+ color:tint(@text-color, 50%);
48
+ font-family: Inter;
49
+ font-weight: 500;
50
+ text-align: center;
51
+ }
52
+ }
53
+ &-large-circle{
54
+ .ant-progress-text{
55
+ height: 100%;
56
+ }
57
+ .tntd-ellipsis{
58
+ font-size: 0.55em;
59
+ // margin-bottom: 2px;
60
+ color:tint(@text-color, 50%);
61
+ font-family: Inter;
62
+ font-weight: 500;
63
+ text-align: center;
64
+ }
65
+ }
66
+ &-small-half-circle{
67
+ .ant-progress-text{
68
+ height: 40%;
69
+ }
70
+ .tntd-ellipsis{
71
+ bottom: -1.5em;
72
+ }
73
+ }
74
+ &-large-half-circle{
75
+ .ant-progress-inner{
76
+ .ant-progress-text{
77
+ top: 42%
78
+ }
79
+ }
80
+ }
81
+ }
82
+
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports["default"] = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  var _checkbox = _interopRequireDefault(require("../../checkbox"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
10
10
  var __rest = void 0 && (void 0).__rest || function (s, e) {
11
11
  var t = {};
12
12
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
@@ -0,0 +1,341 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _find2 = _interopRequireDefault(require("lodash/find"));
9
+ var _filter2 = _interopRequireDefault(require("lodash/filter"));
10
+ var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
11
+ var _react = _interopRequireWildcard(require("react"));
12
+ var _empty = require("../../../empty");
13
+ var _popover = _interopRequireDefault(require("../../../popover"));
14
+ var _ellipsis = _interopRequireDefault(require("../../../ellipsis"));
15
+ var _Select = _interopRequireDefault(require("./Select"));
16
+ var _utils = require("./utils");
17
+ var _fieldsMap = _interopRequireDefault(require("../fieldsMap"));
18
+ require("./FieldPopover.less");
19
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
21
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
22
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
23
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
24
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
25
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
26
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
27
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
28
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
29
+ var t = {};
30
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
31
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
32
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
36
+ var FieldPopover = function FieldPopover(_a, ref) {
37
+ var visible = _a.visible,
38
+ setVisible = _a.setVisible,
39
+ searchText = _a.searchText,
40
+ children = _a.children,
41
+ value = _a.value,
42
+ regex = _a.regex,
43
+ fieldItems = _a.fieldItems,
44
+ propItem = _a.propItem,
45
+ setFieldItem = _a.setFieldItem,
46
+ onChange = _a.onChange,
47
+ form = _a.form,
48
+ locale = _a.locale,
49
+ clsPrefix = _a.clsPrefix,
50
+ props = __rest(_a, ["visible", "setVisible", "searchText", "children", "value", "regex", "fieldItems", "propItem", "setFieldItem", "onChange", "form", "locale", "clsPrefix"]);
51
+ var _useState = (0, _react.useState)(undefined),
52
+ _useState2 = _slicedToArray(_useState, 2),
53
+ searchTarget = _useState2[0],
54
+ setSearchTarget = _useState2[1];
55
+ var _useState3 = (0, _react.useState)(false),
56
+ _useState4 = _slicedToArray(_useState3, 2),
57
+ popoverContent = _useState4[0],
58
+ setPopoverContent = _useState4[1];
59
+ var onPropsClick = function onPropsClick(props) {
60
+ var _ref = props || {},
61
+ _ref$type = _ref.type,
62
+ type = _ref$type === void 0 ? 'input' : _ref$type,
63
+ component = _ref.component;
64
+ var copyValue = (0, _cloneDeep2["default"])(value);
65
+ if (!(copyValue === null || copyValue === void 0 ? void 0 : copyValue.find(function (v) {
66
+ return v.key === props.name;
67
+ }))) {
68
+ copyValue.push({
69
+ key: props.name,
70
+ value: type === 'array' ? [] : undefined
71
+ });
72
+ }
73
+ setFieldItem(props);
74
+ if ((0, _utils.isInput)(type) && !component) {
75
+ var target = copyValue.find(function (v) {
76
+ return v.key === props.name;
77
+ });
78
+ onChange(target, true);
79
+ close();
80
+ return;
81
+ }
82
+ setVisible(true);
83
+ setPopoverContent(true);
84
+ onChange(copyValue);
85
+ };
86
+ (0, _react.useImperativeHandle)(ref, function () {
87
+ return {
88
+ onPropsClick: onPropsClick
89
+ };
90
+ });
91
+ var onSelectChange = function onSelectChange(v, isMultiple) {
92
+ var _a, _b, _c, _d;
93
+ var propObj = (v === null || v === void 0 ? void 0 : v.propItem) || propItem || {};
94
+ var fieldProps = propObj.props; // 直接搜索拿v.xx的值
95
+ var copyValue = (0, _cloneDeep2["default"])(value || []);
96
+ var index;
97
+ if (v === null || v === void 0 ? void 0 : v.propItem) {
98
+ // 模糊搜索
99
+ var _index = copyValue.findIndex(function (vv) {
100
+ var _a;
101
+ return vv.key === ((_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name);
102
+ });
103
+ if (_index > -1) {
104
+ index = _index;
105
+ } else {
106
+ copyValue.push({
107
+ key: (_a = v.propItem) === null || _a === void 0 ? void 0 : _a.name,
108
+ value: isMultiple ? [] : ''
109
+ });
110
+ index = copyValue.length - 1;
111
+ }
112
+ setFieldItem(v.propItem);
113
+ } else {
114
+ // 选择值
115
+ index = copyValue.findIndex(function (v) {
116
+ return v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name);
117
+ });
118
+ }
119
+ if (isMultiple) {
120
+ if (!((_c = (_b = copyValue[index]) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.length)) {
121
+ copyValue[index].value = [v === null || v === void 0 ? void 0 : v.value];
122
+ } else {
123
+ if (((_d = copyValue[index].value) === null || _d === void 0 ? void 0 : _d.indexOf(v.value)) > -1) {
124
+ copyValue[index].value = copyValue[index].value.filter(function (val) {
125
+ return val !== v.value;
126
+ });
127
+ } else {
128
+ copyValue[index].value.push(v.value);
129
+ }
130
+ }
131
+ // 如果是模糊搜索-展开多选项
132
+ if (v === null || v === void 0 ? void 0 : v.propItem) {
133
+ setFieldItem(v === null || v === void 0 ? void 0 : v.propItem);
134
+ setVisible(true);
135
+ setPopoverContent(true);
136
+ }
137
+ } else {
138
+ copyValue[index].value = v === null || v === void 0 ? void 0 : v.value;
139
+ close();
140
+ }
141
+ onChange(copyValue, false, true);
142
+ (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
143
+ };
144
+ var onFieldChange = function onFieldChange() {
145
+ var _a;
146
+ var _ref2 = propItem || {},
147
+ _ref2$type = _ref2.type,
148
+ type = _ref2$type === void 0 ? 'input' : _ref2$type,
149
+ component = _ref2.component,
150
+ fieldProps = _ref2.props;
151
+ var copyValue = (0, _cloneDeep2["default"])(value);
152
+ var index = copyValue.findIndex(function (v) {
153
+ return v.key === (propItem === null || propItem === void 0 ? void 0 : propItem.name);
154
+ });
155
+ copyValue[index].value = arguments.length <= 0 ? undefined : arguments[0];
156
+ if (['date', 'checkbox'].includes(type) || type === 'dateRange' && ((_a = arguments.length <= 1 ? undefined : arguments[1]) === null || _a === void 0 ? void 0 : _a[1])) {
157
+ close();
158
+ }
159
+ onChange(copyValue, false, (arguments.length <= 0 ? undefined : arguments[0]) !== undefined, type !== 'selectInput');
160
+ (fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.onChange) && fieldProps.onChange(copyValue[index].value);
161
+ };
162
+ var close = function close() {
163
+ setVisible(false);
164
+ setTimeout(function () {
165
+ setFieldItem();
166
+ setPopoverContent(false);
167
+ }, 1);
168
+ };
169
+ var handleVisibleChange = function handleVisibleChange() {
170
+ if (!visible && !regex.test(searchText)) {
171
+ setVisible(true);
172
+ } else {
173
+ close();
174
+ }
175
+ };
176
+ (0, _react.useEffect)(function () {
177
+ var bool1 = false,
178
+ bool2 = false;
179
+ if (searchText && !propItem) {
180
+ fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.forEach(function (v) {
181
+ var _ref3 = v.props || {},
182
+ name = _ref3.name,
183
+ propsTitle = _ref3.propsTitle,
184
+ title = _ref3.title,
185
+ _ref3$type = _ref3.type,
186
+ type = _ref3$type === void 0 ? 'input' : _ref3$type,
187
+ props = _ref3.props;
188
+ var _propsTitle = propsTitle || title || name;
189
+ if ((_propsTitle === null || _propsTitle === void 0 ? void 0 : _propsTitle.indexOf(searchText)) > -1) {
190
+ bool1 = true;
191
+ }
192
+ var sOptions = type !== 'select' ? [] : (props === null || props === void 0 ? void 0 : props.options) || [];
193
+ var fieldNames = props === null || props === void 0 ? void 0 : props.fieldNames;
194
+ var target = sOptions === null || sOptions === void 0 ? void 0 : sOptions.find(function (item) {
195
+ var labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
196
+ var label = item instanceof Object ? item[labelKey] : item + '';
197
+ return (_react["default"].isValidElement(label) ? (0, _utils.formatLabel)(label) : label).indexOf(searchText) > -1;
198
+ });
199
+ if (target) {
200
+ bool2 = true;
201
+ }
202
+ });
203
+ setSearchTarget(!bool2 && !bool1 ? null : {
204
+ propsTitle: bool1,
205
+ propsValue: bool2
206
+ });
207
+ } else {
208
+ setSearchTarget(undefined);
209
+ }
210
+ }, [fieldItems, searchText, propItem]);
211
+ var renderFirstOptions = function renderFirstOptions() {
212
+ var firstItems = searchText ? (0, _filter2["default"])(fieldItems, function (v) {
213
+ var _ref4 = v.props || {},
214
+ name = _ref4.name,
215
+ propsTitle = _ref4.propsTitle,
216
+ title = _ref4.title;
217
+ var _propsTitle = propsTitle || title || name;
218
+ return (_propsTitle === null || _propsTitle === void 0 ? void 0 : _propsTitle.indexOf(searchText)) > -1;
219
+ }) : fieldItems;
220
+ var secondItems = searchText ? (0, _filter2["default"])(fieldItems, function (v) {
221
+ var _ref5 = v.props || {},
222
+ _ref5$type = _ref5.type,
223
+ type = _ref5$type === void 0 ? 'input' : _ref5$type,
224
+ props = _ref5.props;
225
+ var _ref6 = props || {},
226
+ options = _ref6.options,
227
+ loadData = _ref6.loadData,
228
+ fieldNames = _ref6.fieldNames;
229
+ return type === 'select' && !loadData && !!(0, _find2["default"])(options, function (item) {
230
+ var labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
231
+ var label = item instanceof Object ? item[labelKey] : item + '';
232
+ var isReactDom = _react["default"].isValidElement(label);
233
+ var _label = isReactDom ? (0, _utils.formatLabel)(label) : label;
234
+ return (_label === null || _label === void 0 ? void 0 : _label.indexOf(searchText)) > -1;
235
+ });
236
+ }) : [];
237
+ return _react["default"].createElement("div", null, firstItems.length > 0 && _react["default"].createElement(_react["default"].Fragment, null, (!searchText || (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsTitle)) && _react["default"].createElement("label", null, locale.propTitle), _react["default"].createElement("ul", {
238
+ className: "ant-select-dropdown-menu"
239
+ }, firstItems.map(function (v) {
240
+ var _ref7 = v.props || {},
241
+ name = _ref7.name,
242
+ propsTitle = _ref7.propsTitle,
243
+ title = _ref7.title,
244
+ type = _ref7.type,
245
+ props = _ref7.props;
246
+ var _propsTitle = propsTitle || title || name;
247
+ return _react["default"].createElement("li", {
248
+ className: "ant-select-dropdown-menu-item",
249
+ key: name,
250
+ value: name,
251
+ onMouseDown: function onMouseDown(e) {
252
+ return e.preventDefault();
253
+ },
254
+ onClick: function onClick() {
255
+ onPropsClick(v.props);
256
+ }
257
+ }, _react["default"].createElement(_ellipsis["default"], {
258
+ widthLimit: 220,
259
+ title: searchText ? _react["default"].createElement("span", {
260
+ dangerouslySetInnerHTML: {
261
+ __html: (0, _utils.highlightSubstring)(_propsTitle, searchText)
262
+ }
263
+ }) : _propsTitle
264
+ }));
265
+ }))), secondItems.length > 0 && _react["default"].createElement("div", null, (searchTarget === null || searchTarget === void 0 ? void 0 : searchTarget.propsValue) && _react["default"].createElement("label", null, locale.propValue), fieldItems === null || fieldItems === void 0 ? void 0 : fieldItems.map(function (v) {
266
+ var _ref8 = v.props || {},
267
+ name = _ref8.name,
268
+ _ref8$type = _ref8.type,
269
+ type = _ref8$type === void 0 ? 'input' : _ref8$type,
270
+ props = _ref8.props;
271
+ var target = value === null || value === void 0 ? void 0 : value.find(function (v) {
272
+ return v.key === name;
273
+ });
274
+ if (type === 'select') {
275
+ return _react["default"].createElement(_Select["default"], Object.assign({
276
+ key: name
277
+ }, props, {
278
+ searchText: searchText,
279
+ propItem: v.props,
280
+ onChange: onSelectChange,
281
+ value: target === null || target === void 0 ? void 0 : target.value
282
+ }));
283
+ }
284
+ return;
285
+ })), !firstItems.length && !secondItems.length && _react["default"].createElement(_empty.Empty, {
286
+ size: "mini"
287
+ }));
288
+ };
289
+ var renderSecondOptions = function renderSecondOptions() {
290
+ var _a;
291
+ var _ref9 = propItem || {},
292
+ name = _ref9.name,
293
+ propsTitle = _ref9.propsTitle,
294
+ title = _ref9.title,
295
+ _ref9$type = _ref9.type,
296
+ type = _ref9$type === void 0 ? 'input' : _ref9$type,
297
+ className = _ref9.className,
298
+ component = _ref9.component,
299
+ fieldProps = _ref9.props;
300
+ var target = value === null || value === void 0 ? void 0 : value.find(function (v) {
301
+ return v.key === name;
302
+ });
303
+ var Field = component || _fieldsMap["default"][type] || function () {
304
+ return null;
305
+ };
306
+ return _react["default"].createElement("div", {
307
+ onClick: function onClick(e) {
308
+ return e.stopPropagation();
309
+ },
310
+ className: className
311
+ }, _react["default"].createElement("label", null, propsTitle || title || name), type === 'select' ? _react["default"].createElement(_Select["default"], Object.assign({}, fieldProps, {
312
+ searchText: searchText,
313
+ propItem: propItem,
314
+ onChange: onSelectChange,
315
+ value: target === null || target === void 0 ? void 0 : target.value
316
+ })) : _react["default"].createElement("div", {
317
+ className: "".concat(clsPrefix, "-field-popover-content"),
318
+ onClick: function onClick(e) {
319
+ return e.stopPropagation();
320
+ }
321
+ }, _react["default"].createElement(Field, Object.assign({
322
+ form: form,
323
+ value: target === null || target === void 0 ? void 0 : target.value
324
+ }, fieldProps, {
325
+ style: Object.assign(Object.assign({}, fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style), {
326
+ width: ((_a = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.style) === null || _a === void 0 ? void 0 : _a.width) || '250px'
327
+ }),
328
+ close: close,
329
+ onChange: onFieldChange,
330
+ name: name
331
+ }))));
332
+ };
333
+ return _react["default"].createElement(_popover["default"], Object.assign({
334
+ trigger: "click",
335
+ visible: visible,
336
+ overlayClassName: "".concat(clsPrefix, "-field-popover"),
337
+ content: !popoverContent ? renderFirstOptions() : renderSecondOptions(),
338
+ onVisibleChange: handleVisibleChange
339
+ }, props), children);
340
+ };
341
+ var _default = exports["default"] = (0, _react.forwardRef)(FieldPopover);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FieldPopover.js","sourceRoot":"","sources":["../../../../src/query-form/Field/Composition/FieldPopover.js"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,OAAO,MAAM,kBAAkB,CAAA;AACtC,OAAO,QAAQ,MAAM,mBAAmB,CAAA;AACxC,OAAO,SAAS,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAClE,OAAO,SAAS,MAAM,cAAc,CAAA;AACpC,OAAO,qBAAqB,CAAA;AAE5B,MAAM,YAAY,GAAG,CACnB,EAeC,EACD,GAAG,EACH,EAAE;QAjBF,EACE,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,EACR,KAAK,EACL,KAAK,EACL,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,SAAS,OAEV,EADI,KAAK,cAdV,0JAeC,CADS;IAIV,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAA;IAC3D,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IA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E,KAAK,KAAI,OAAO,KAE5C,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,IAAI,IACV,CACE,CACP,CACG,CACP,CAAA;IACH,CAAC,CAAA;IAED,OAAO,CACL,oBAAC,OAAO,kBACN,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,GAAG,SAAS,gBAAgB,EAC9C,OAAO,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,mBAAmB,EAAE,EACvE,eAAe,EAAE,mBAAmB,IAChC,KAAK,GAER,QAAQ,CACD,CACX,CAAA;AACH,CAAC,CAAA;AACD,eAAe,UAAU,CAAC,YAAY,CAAC,CAAA","sourcesContent":["import React, { useEffect, useState, forwardRef, useImperativeHandle } from 'react'\nimport { cloneDeep, filter, find } from 'lodash'\nimport { Empty } from '../../../empty'\nimport Popover from '../../../popover'\nimport Ellipsis from '../../../ellipsis'\nimport SelectOpt from './Select'\nimport { highlightSubstring, formatLabel, isInput } from './utils'\nimport fieldsMap from '../fieldsMap'\nimport './FieldPopover.less'\n\nconst FieldPopover = (\n {\n visible,\n setVisible,\n searchText,\n children,\n value,\n regex,\n fieldItems,\n propItem,\n setFieldItem,\n onChange,\n form,\n locale,\n clsPrefix,\n ...props\n },\n ref\n) => {\n const [searchTarget, setSearchTarget] = useState(undefined)\n const [popoverContent, setPopoverContent] = useState(false)\n\n const onPropsClick = (props) => {\n const { type = 'input', component } = props || {}\n const copyValue = cloneDeep(value)\n if (!copyValue?.find((v) => v.key === props.name)) {\n copyValue.push({\n key: props.name,\n value: type === 'array' ? [] : undefined,\n })\n }\n setFieldItem(props)\n if (isInput(type) && !component) {\n const target = copyValue.find((v) => v.key === props.name)\n onChange(target, true)\n close()\n return\n }\n setVisible(true)\n setPopoverContent(true)\n onChange(copyValue)\n }\n\n useImperativeHandle(ref, () => ({\n onPropsClick,\n }))\n\n const onSelectChange = (v, isMultiple) => {\n const propObj = v?.propItem || propItem || {}\n const { props: fieldProps } = propObj // 直接搜索拿v.xx的值\n const copyValue = cloneDeep(value || [])\n let index\n if (v?.propItem) {\n // 模糊搜索\n const _index = copyValue.findIndex((vv) => vv.key === v.propItem?.name)\n if (_index > -1) {\n index = _index\n } else {\n copyValue.push({\n key: v.propItem?.name,\n value: isMultiple ? [] : '',\n })\n index = copyValue.length - 1\n }\n setFieldItem(v.propItem)\n } else {\n // 选择值\n index = copyValue.findIndex((v) => v.key === propItem?.name)\n }\n\n if (isMultiple) {\n if (!copyValue[index]?.value?.length) {\n copyValue[index].value = [v?.value]\n } else {\n if (copyValue[index].value?.indexOf(v.value) > -1) {\n copyValue[index].value = copyValue[index].value.filter((val) => val !== v.value)\n } else {\n copyValue[index].value.push(v.value)\n }\n }\n // 如果是模糊搜索-展开多选项\n if (v?.propItem) {\n setFieldItem(v?.propItem)\n setVisible(true)\n setPopoverContent(true)\n }\n } else {\n copyValue[index].value = v?.value\n close()\n }\n onChange(copyValue, false, true)\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const onFieldChange = (...args) => {\n const { type = 'input', component, props: fieldProps } = propItem || {}\n const copyValue = cloneDeep(value)\n const index = copyValue.findIndex((v) => v.key === propItem?.name)\n copyValue[index].value = args[0]\n if (['date', 'checkbox'].includes(type) || (type === 'dateRange' && args[1]?.[1])) {\n close()\n }\n onChange(copyValue, false, args[0] !== undefined, type !== 'selectInput')\n fieldProps?.onChange && fieldProps.onChange(copyValue[index].value)\n }\n\n const close = () => {\n setVisible(false)\n setTimeout(() => {\n setFieldItem()\n setPopoverContent(false)\n }, 1)\n }\n const handleVisibleChange = () => {\n if (!visible && !regex.test(searchText)) {\n setVisible(true)\n } else {\n close()\n }\n }\n\n useEffect(() => {\n let bool1 = false,\n bool2 = false\n\n if (searchText && !propItem) {\n fieldItems?.forEach((v) => {\n const { name, propsTitle, title, type = 'input', props } = v.props || {}\n const _propsTitle = propsTitle || title || name\n if (_propsTitle?.indexOf(searchText) > -1) {\n bool1 = true\n }\n const sOptions = type !== 'select' ? [] : props?.options || []\n const fieldNames = props?.fieldNames\n const target = sOptions?.find((item) => {\n const labelKey = fieldNames?.label || 'label'\n const label = item instanceof Object ? item[labelKey] : item + ''\n return (React.isValidElement(label) ? formatLabel(label) : label).indexOf(searchText) > -1\n })\n if (target) {\n bool2 = true\n }\n })\n setSearchTarget(!bool2 && !bool1 ? null : { propsTitle: bool1, propsValue: bool2 })\n } else {\n setSearchTarget(undefined)\n }\n }, [fieldItems, searchText, propItem])\n\n const renderFirstOptions = () => {\n const firstItems = searchText\n ? filter(fieldItems, (v) => {\n const { name, propsTitle, title } = v.props || {}\n const _propsTitle = propsTitle || title || name\n return _propsTitle?.indexOf(searchText) > -1\n })\n : fieldItems\n const secondItems = searchText\n ? filter(fieldItems, (v) => {\n const { type = 'input', props } = v.props || {}\n const { options, loadData, fieldNames } = props || {}\n return (\n type === 'select' &&\n !loadData &&\n !!find(options, (item) => {\n const labelKey = fieldNames?.label || 'label'\n const label = item instanceof Object ? item[labelKey] : item + ''\n const isReactDom = React.isValidElement(label)\n const _label = isReactDom ? formatLabel(label) : label\n return _label?.indexOf(searchText) > -1\n })\n )\n })\n : []\n return (\n <div>\n {firstItems.length > 0 && (\n <>\n {(!searchText || searchTarget?.propsTitle) && <label>{locale.propTitle}</label>}\n <ul className=\"ant-select-dropdown-menu\">\n {firstItems.map((v) => {\n const { name, propsTitle, title, type, props } = v.props || {}\n const _propsTitle = propsTitle || title || name\n return (\n <li\n className=\"ant-select-dropdown-menu-item\"\n key={name}\n value={name}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n onPropsClick(v.props)\n }}\n >\n <Ellipsis\n widthLimit={220}\n title={\n searchText ? (\n <span\n dangerouslySetInnerHTML={{\n __html: highlightSubstring(_propsTitle, searchText),\n }}\n />\n ) : (\n _propsTitle\n )\n }\n />\n </li>\n )\n })}\n </ul>\n </>\n )}\n\n {/* 可以对下拉框值筛选 */}\n {secondItems.length > 0 && (\n <div>\n {searchTarget?.propsValue && <label>{locale.propValue}</label>}\n {fieldItems?.map((v) => {\n const { name, type = 'input', props } = v.props || {}\n const target = value?.find((v) => v.key === name)\n if (type === 'select') {\n return (\n <SelectOpt\n key={name}\n {...props}\n searchText={searchText}\n propItem={v.props}\n onChange={onSelectChange}\n value={target?.value}\n />\n )\n }\n return\n })}\n </div>\n )}\n {!firstItems.length && !secondItems.length && <Empty size=\"mini\" />}\n </div>\n )\n }\n\n const renderSecondOptions = () => {\n const {\n name,\n propsTitle,\n title,\n type = 'input',\n className,\n component,\n props: fieldProps,\n } = propItem || {}\n const target = value?.find((v) => v.key === name)\n const Field = component || fieldsMap[type] || (() => null)\n return (\n <div onClick={(e) => e.stopPropagation()} className={className}>\n <label>{propsTitle || title || name}</label>\n {type === 'select' ? (\n <SelectOpt\n {...fieldProps}\n searchText={searchText}\n propItem={propItem}\n onChange={onSelectChange}\n value={target?.value}\n />\n ) : (\n <div\n className={`${clsPrefix}-field-popover-content`}\n onClick={(e) => e.stopPropagation()}\n >\n <Field\n form={form}\n value={target?.value}\n {...fieldProps}\n style={{\n ...fieldProps?.style,\n width: fieldProps?.style?.width || '250px',\n }}\n close={close}\n onChange={onFieldChange}\n name={name}\n />\n </div>\n )}\n </div>\n )\n }\n\n return (\n <Popover\n trigger=\"click\"\n visible={visible}\n overlayClassName={`${clsPrefix}-field-popover`}\n content={!popoverContent ? renderFirstOptions() : renderSecondOptions()}\n onVisibleChange={handleVisibleChange}\n {...props}\n >\n {children}\n </Popover>\n )\n}\nexport default forwardRef(FieldPopover)\n"]}
@@ -0,0 +1,35 @@
1
+ .tnt-queryform-field-popover {
2
+ min-width: 280px;
3
+ .ant-popover-inner-content {
4
+ padding: @padding-sm 0;
5
+ }
6
+ // .ant-calendar-picker {
7
+ // margin: @margin-xxs 0;
8
+ // }
9
+ label {
10
+ color: tint(@text-color, 50%);
11
+ margin-bottom: @margin-xs;
12
+ display: block;
13
+ padding: 0 @padding-sm;
14
+ }
15
+ .ant-select-dropdown-menu {
16
+ &-item {
17
+ padding: @padding-xxs @padding-sm;
18
+ &:hover {
19
+ background-color: @bg-color-quaternary;
20
+ }
21
+ }
22
+ }
23
+ &-content {
24
+ padding: @padding-xxs @padding-sm;
25
+ }
26
+ .ant-select-selected-icon {
27
+ position: absolute;
28
+ right: @margin-base;
29
+ top: @margin-xs;
30
+ color: @blue-6;
31
+ }
32
+ .tnt-highlight {
33
+ color: @blue-6;
34
+ }
35
+ }
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _isArray2 = _interopRequireDefault(require("lodash/isArray"));
9
+ var _react = _interopRequireWildcard(require("react"));
10
+ var _classnames = _interopRequireDefault(require("classnames"));
11
+ var _icon = _interopRequireDefault(require("../../../icon"));
12
+ var _ellipsis = _interopRequireDefault(require("../../../ellipsis"));
13
+ var _utils = require("./utils");
14
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
15
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
16
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
17
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
21
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
23
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
24
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
25
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
26
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
27
+ var t = {};
28
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
30
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
31
+ }
32
+ return t;
33
+ };
34
+ var _default = exports["default"] = function _default(props) {
35
+ var options = props.options,
36
+ params = props.params,
37
+ _props$queryKey = props.queryKey,
38
+ queryKey = _props$queryKey === void 0 ? 'name' : _props$queryKey,
39
+ _props$fieldNames = props.fieldNames,
40
+ fieldNames = _props$fieldNames === void 0 ? {
41
+ label: 'label',
42
+ value: 'value'
43
+ } : _props$fieldNames,
44
+ loadData = props.loadData,
45
+ onChange = props.onChange,
46
+ _value = props.value,
47
+ mode = props.mode,
48
+ propItem = props.propItem,
49
+ searchText = props.searchText,
50
+ rest = __rest(props, ["options", "params", "queryKey", "fieldNames", "loadData", "onChange", "value", "mode", "propItem", "searchText"]);
51
+ var _useState = (0, _react.useState)(options || []),
52
+ _useState2 = _slicedToArray(_useState, 2),
53
+ items = _useState2[0],
54
+ setItems = _useState2[1];
55
+ (0, _react.useEffect)(function () {
56
+ if (loadData) {
57
+ loadData(Object.assign(_defineProperty({}, queryKey, searchText), params || {})).then(function (items) {
58
+ setItems(items);
59
+ });
60
+ }
61
+ }, [params, searchText]);
62
+ (0, _react.useEffect)(function () {
63
+ setItems(options || []);
64
+ }, [options]);
65
+ var onValueChange = function onValueChange(item) {
66
+ onChange(item, mode === 'multiple' || mode === 'tags');
67
+ };
68
+ return _react["default"].createElement("ul", {
69
+ className: "ant-select-dropdown-menu"
70
+ }, items.map(function (item) {
71
+ var labelKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.label) || 'label';
72
+ var valueKey = (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.value) || 'value';
73
+ var value = item instanceof Object ? item[valueKey] : item;
74
+ var label = item instanceof Object ? item[labelKey] : item + '';
75
+ var disabled = item instanceof Object ? item['disabled'] : false;
76
+ var isSelected = (0, _isArray2["default"])(_value) ? (_value === null || _value === void 0 ? void 0 : _value.indexOf(value)) > -1 : value === _value;
77
+ if (searchText) {
78
+ var isReactDom = _react["default"].isValidElement(label);
79
+ var _label = isReactDom ? (0, _utils.formatLabel)(label) : label;
80
+ if ((_label === null || _label === void 0 ? void 0 : _label.indexOf(searchText)) > -1) {
81
+ return _react["default"].createElement("li", {
82
+ className: (0, _classnames["default"])({
83
+ 'ant-select-dropdown-menu-item': true,
84
+ 'ant-select-dropdown-menu-item-selected': isSelected,
85
+ 'ant-select-dropdown-menu-item-disabled': disabled
86
+ }),
87
+ key: value,
88
+ value: value,
89
+ onMouseDown: function onMouseDown(e) {
90
+ return e.preventDefault();
91
+ },
92
+ onClick: function onClick() {
93
+ !disabled && onValueChange({
94
+ value: value,
95
+ propItem: propItem,
96
+ options: items
97
+ });
98
+ }
99
+ }, _react["default"].createElement("span", null, (propItem === null || propItem === void 0 ? void 0 : propItem.propsTitle) || (propItem === null || propItem === void 0 ? void 0 : propItem.name), ": "), _react["default"].createElement("span", {
100
+ style: {
101
+ display: 'inline-block'
102
+ }
103
+ }, _react["default"].createElement(_ellipsis["default"], {
104
+ widthLimit: 220,
105
+ title: isReactDom ? _react["default"].createElement("span", null, label) : _react["default"].createElement("span", {
106
+ dangerouslySetInnerHTML: {
107
+ __html: (0, _utils.highlightSubstring)(label, searchText)
108
+ }
109
+ })
110
+ })), isSelected && _react["default"].createElement(_icon["default"], {
111
+ type: "check",
112
+ className: "ant-select-selected-icon"
113
+ }));
114
+ }
115
+ return null;
116
+ }
117
+ return _react["default"].createElement("li", {
118
+ className: (0, _classnames["default"])({
119
+ 'ant-select-dropdown-menu-item': true,
120
+ 'ant-select-dropdown-menu-item-selected': isSelected,
121
+ 'ant-select-dropdown-menu-item-disabled': disabled
122
+ }),
123
+ key: value,
124
+ value: value,
125
+ onMouseDown: function onMouseDown(e) {
126
+ return e.preventDefault();
127
+ },
128
+ onClick: function onClick() {
129
+ !disabled && onValueChange({
130
+ value: value,
131
+ options: items
132
+ });
133
+ }
134
+ }, _react["default"].createElement("span", {
135
+ style: {
136
+ display: 'inline-block'
137
+ }
138
+ }, _react["default"].createElement(_ellipsis["default"], {
139
+ widthLimit: 220,
140
+ title: label
141
+ })), isSelected && _react["default"].createElement(_icon["default"], {
142
+ type: "check",
143
+ className: "ant-select-selected-icon"
144
+ }));
145
+ }));
146
+ };