diginet-core-ui 1.4.39 → 1.4.40

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 (906) hide show
  1. package/.browserslistrc +6 -0
  2. package/.eslintrc.js +91 -0
  3. package/.husky/pre-commit +4 -0
  4. package/.prettierrc +32 -0
  5. package/.storybook/main.js +4 -0
  6. package/.storybook/manager.js +10 -0
  7. package/.storybook/preview-head.html +17 -0
  8. package/.storybook/preview.js +36 -0
  9. package/.storybook/themeDecorator.js +19 -0
  10. package/babel.config.json +17 -0
  11. package/bitbucket-pipelines.yml +18 -0
  12. package/jsconfig.json +8 -0
  13. package/package.json +78 -44
  14. package/package.json.tmp +44 -0
  15. package/postcss.config.js +9 -0
  16. package/readme.md +5 -0
  17. package/src/assets/images/menu/dhr/MHRP15N0002.svg +17 -0
  18. package/src/assets/images/menu/dhr/MHRP15N0003.svg +26 -0
  19. package/src/components/accordion/context.js +5 -0
  20. package/src/components/accordion/details.js +80 -0
  21. package/src/components/accordion/group.js +140 -0
  22. package/src/components/accordion/index.js +207 -0
  23. package/src/components/accordion/index.stories.js +278 -0
  24. package/src/components/accordion/summary.js +380 -0
  25. package/src/components/alert/index.js +312 -0
  26. package/src/components/alert/index.stories.js +109 -0
  27. package/src/components/alert/notify.js +179 -0
  28. package/src/components/avatar/index.js +472 -0
  29. package/src/components/avatar/index.stories.js +80 -0
  30. package/src/components/badge/index.js +307 -0
  31. package/src/components/badge/index.stories.js +187 -0
  32. package/src/components/breadcrumb/index.js +280 -0
  33. package/src/components/breadcrumb/index.stories.js +69 -0
  34. package/src/components/button/button.stories.js +34 -0
  35. package/src/components/button/buttonIcon.stories.js +36 -0
  36. package/src/components/button/buttonMore.stories.js +58 -0
  37. package/src/components/button/icon.js +468 -0
  38. package/src/components/button/index.js +582 -0
  39. package/src/components/button/more.js +249 -0
  40. package/src/components/button/ripple-effect.js +95 -0
  41. package/src/components/button/sample.stories.js +194 -0
  42. package/src/components/card/body.js +73 -0
  43. package/src/components/card/extra.js +73 -0
  44. package/src/components/card/footer.js +73 -0
  45. package/src/components/card/header.js +74 -0
  46. package/src/components/card/index.js +256 -0
  47. package/src/components/card/index.stories.js +242 -0
  48. package/src/components/chart/Pie/Circle.js +68 -0
  49. package/src/components/chart/Pie/Sector.js +134 -0
  50. package/src/components/chart/Pie/Sectors.js +96 -0
  51. package/src/components/chart/Pie/index.js +312 -0
  52. package/src/components/chart/Pie/index.stories.js +77 -0
  53. package/src/components/chart/Pie-v2/Circle.js +62 -0
  54. package/src/components/chart/Pie-v2/Sector.js +128 -0
  55. package/src/components/chart/Pie-v2/Sectors.js +353 -0
  56. package/src/components/chart/Pie-v2/index.js +499 -0
  57. package/src/components/chart/Pie-v2/index.stories.js +77 -0
  58. package/src/components/chart/bar/Axis.js +67 -0
  59. package/src/components/chart/bar/Bar.js +365 -0
  60. package/src/components/chart/bar/Grid.js +111 -0
  61. package/src/components/chart/bar/Labels.js +193 -0
  62. package/src/components/chart/bar/Points.js +112 -0
  63. package/src/components/chart/bar/index.js +170 -0
  64. package/src/components/chart/bar/index.stories.js +174 -0
  65. package/src/components/chart/bar-v2/Axis.js +67 -0
  66. package/src/components/chart/bar-v2/Bar.js +372 -0
  67. package/src/components/chart/bar-v2/Grid.js +111 -0
  68. package/src/components/chart/bar-v2/Labels.js +193 -0
  69. package/src/components/chart/bar-v2/Points.js +112 -0
  70. package/src/components/chart/bar-v2/index.js +170 -0
  71. package/src/components/chart/bar-v2/index.stories.js +174 -0
  72. package/src/components/chart/line/Axis.js +68 -0
  73. package/src/components/chart/line/Grid.js +98 -0
  74. package/src/components/chart/line/Labels.js +191 -0
  75. package/src/components/chart/line/Path.js +155 -0
  76. package/src/components/chart/line/Point.js +358 -0
  77. package/src/components/chart/line/Title.js +50 -0
  78. package/src/components/chart/line/index.js +202 -0
  79. package/src/components/chart/line/index.stories.js +148 -0
  80. package/src/components/chart/line-v2/Axis.js +66 -0
  81. package/src/components/chart/line-v2/Grid.js +111 -0
  82. package/src/components/chart/line-v2/Labels.js +190 -0
  83. package/src/components/chart/line-v2/Path.js +154 -0
  84. package/src/components/chart/line-v2/Point.js +336 -0
  85. package/src/components/chart/line-v2/Title.js +50 -0
  86. package/src/components/chart/line-v2/index.js +172 -0
  87. package/src/components/chart/line-v2/index.stories.js +148 -0
  88. package/src/components/check-text/index.js +168 -0
  89. package/src/components/check-text/index.stories.js +50 -0
  90. package/src/components/check-text/interview-confirmation.js +169 -0
  91. package/src/components/check-text/interview-status.js +142 -0
  92. package/src/components/chip/attach.js +156 -0
  93. package/src/components/chip/index.js +366 -0
  94. package/src/components/chip/index.stories.js +190 -0
  95. package/src/components/collapse/index.js +104 -0
  96. package/src/components/collapse/index.stories.js +35 -0
  97. package/src/components/dialogs/colors.js +13 -0
  98. package/src/components/divider/index.js +87 -0
  99. package/src/components/divider/index.stories.js +52 -0
  100. package/src/components/form-control/attachment/index.js +1770 -0
  101. package/src/components/form-control/attachment/index.stories.js +106 -0
  102. package/src/components/form-control/calendar/function.js +959 -0
  103. package/src/components/form-control/calendar/index.js +413 -0
  104. package/src/components/form-control/calendar/index.stories.js +40 -0
  105. package/src/components/form-control/calendar/range.js +329 -0
  106. package/src/components/form-control/checkbox/index.js +382 -0
  107. package/src/components/form-control/checkbox/index.stories.js +110 -0
  108. package/src/components/form-control/control/index.js +99 -0
  109. package/src/components/form-control/date-input/DateField.js +191 -0
  110. package/src/components/form-control/date-input/index.js +315 -0
  111. package/src/components/form-control/date-input/index.stories.js +96 -0
  112. package/src/components/form-control/date-input/useDateInputState.js +138 -0
  113. package/src/components/form-control/date-input/useIsFocused.js +25 -0
  114. package/src/components/form-control/date-input/useKeyboardInputEvent.js +45 -0
  115. package/src/components/form-control/date-input/utils.js +293 -0
  116. package/src/components/form-control/date-picker/index.js +429 -0
  117. package/src/components/form-control/date-picker/index.stories.js +141 -0
  118. package/src/components/form-control/date-range-picker/index.js +1349 -0
  119. package/src/components/form-control/date-range-picker/index.stories.js +43 -0
  120. package/src/components/form-control/dropdown/index.js +1858 -0
  121. package/src/components/form-control/dropdown/index.stories.js +222 -0
  122. package/src/components/form-control/dropdown-box/index.js +271 -0
  123. package/src/components/form-control/dropdown-box/index.stories.js +103 -0
  124. package/src/components/form-control/form/context.js +5 -0
  125. package/src/components/form-control/form/index.js +39 -0
  126. package/src/components/form-control/form-group/index.js +131 -0
  127. package/src/components/form-control/form-group/index.stories.js +57 -0
  128. package/src/components/form-control/helper-text/index.js +92 -0
  129. package/src/components/form-control/helper-text/index.stories.js +29 -0
  130. package/src/components/form-control/input-base/UncontrolledInputBase.js +499 -0
  131. package/src/components/form-control/input-base/index.js +706 -0
  132. package/src/components/form-control/input-base/index.stories.js +69 -0
  133. package/src/components/form-control/label/index.js +127 -0
  134. package/src/components/form-control/label/index.stories.js +69 -0
  135. package/src/components/form-control/money-input/index.js +622 -0
  136. package/src/components/form-control/money-input/index.stories.js +42 -0
  137. package/src/components/form-control/number-input/index.js +582 -0
  138. package/src/components/form-control/number-input/index.stories.js +53 -0
  139. package/src/components/form-control/number-input/index2.js +531 -0
  140. package/src/components/form-control/password-input/index.js +259 -0
  141. package/src/components/form-control/password-input/index.stories.js +32 -0
  142. package/src/components/form-control/phone-input/index.js +382 -0
  143. package/src/components/form-control/phone-input/index.stories.js +39 -0
  144. package/src/components/form-control/radio/index.js +241 -0
  145. package/src/components/form-control/radio/index.stories.js +51 -0
  146. package/src/components/form-control/text-input/index.js +254 -0
  147. package/src/components/form-control/text-input/index.stories.js +60 -0
  148. package/src/components/form-control/time-picker/index.js +782 -0
  149. package/src/components/form-control/time-picker/index.mdx +49 -0
  150. package/src/components/form-control/time-picker/index.stories.js +69 -0
  151. package/src/components/form-control/time-picker/swiper.js +568 -0
  152. package/src/components/form-control/time-picker/v2/index.js +785 -0
  153. package/src/components/form-control/time-picker/v2/index.stories.js +43 -0
  154. package/src/components/form-control/toggle/index.js +247 -0
  155. package/src/components/form-control/toggle/index.stories.js +51 -0
  156. package/src/components/form-view/helper-text.js +30 -0
  157. package/src/components/form-view/index.js +100 -0
  158. package/src/components/form-view/index.stories.js +25 -0
  159. package/src/components/form-view/input.js +134 -0
  160. package/src/components/form-view/label.js +39 -0
  161. package/src/components/grid/Col.js +89 -0
  162. package/src/components/grid/Container.js +99 -0
  163. package/src/components/grid/Row.js +97 -0
  164. package/src/components/grid/context.js +5 -0
  165. package/src/components/grid/index.js +323 -0
  166. package/src/components/grid/index.stories.js +523 -0
  167. package/src/components/image/index.js +191 -0
  168. package/src/components/image/index.stories.js +53 -0
  169. package/src/components/index.js +157 -0
  170. package/src/components/list/index.stories.js +261 -0
  171. package/src/components/list/list-item-action.js +94 -0
  172. package/src/components/list/list-item-icon.js +89 -0
  173. package/src/components/list/list-item-text.js +69 -0
  174. package/src/components/list/list-item.js +131 -0
  175. package/src/components/list/list.js +164 -0
  176. package/src/components/list/sub-header.js +79 -0
  177. package/src/components/modal/body.js +84 -0
  178. package/src/components/modal/context.js +5 -0
  179. package/src/components/modal/footer.js +90 -0
  180. package/src/components/modal/header.js +145 -0
  181. package/src/components/modal/index.js +59 -0
  182. package/src/components/modal/index.stories.js +95 -0
  183. package/src/components/modal/modal.js +330 -0
  184. package/src/components/others/date/index.stories.js +217 -0
  185. package/src/components/others/extra/index.js +129 -0
  186. package/src/components/others/extra/index.mdx +39 -0
  187. package/src/components/others/extra/index.stories.js +17 -0
  188. package/src/components/others/import/index.js +66 -0
  189. package/src/components/others/import/index.stories.js +70 -0
  190. package/src/components/others/locale/index.stories.js +42 -0
  191. package/src/components/others/option-wrapper/index.js +34 -0
  192. package/src/components/others/scrollbar/index.js +106 -0
  193. package/src/components/others/scrollbar/index.stories.js +68 -0
  194. package/src/components/others/validate/index.stories.js +113 -0
  195. package/src/components/paging/index.stories.js +76 -0
  196. package/src/components/paging/page-info.js +637 -0
  197. package/src/components/paging/page-selector.js +437 -0
  198. package/src/components/paper/index.js +128 -0
  199. package/src/components/paper/index.stories.js +37 -0
  200. package/src/components/popover/body.js +98 -0
  201. package/src/components/popover/footer.js +96 -0
  202. package/src/components/popover/header.js +99 -0
  203. package/src/components/popover/index.js +718 -0
  204. package/src/components/popover/index.stories.js +189 -0
  205. package/src/components/popup/danger_popup.js +196 -0
  206. package/src/components/popup/index.js +464 -0
  207. package/src/components/popup/v2/index.js +556 -0
  208. package/src/components/popup/v2/index.stories.js +113 -0
  209. package/src/components/progress/circular.js +326 -0
  210. package/src/components/progress/index.stories.js +51 -0
  211. package/src/components/progress/linear.js +361 -0
  212. package/src/components/rating/index.js +309 -0
  213. package/src/components/rating/index.stories.js +78 -0
  214. package/src/components/skeleton/index.js +79 -0
  215. package/src/components/skeleton/index.stories.js +29 -0
  216. package/src/components/slider/index.stories.js +50 -0
  217. package/src/components/slider/slider-container.js +415 -0
  218. package/src/components/slider/slider-item.js +222 -0
  219. package/src/components/status/index.js +145 -0
  220. package/src/components/status/index.stories.js +71 -0
  221. package/src/components/tab/context.js +5 -0
  222. package/src/components/tab/index.stories.js +123 -0
  223. package/src/components/tab/tab-container.js +109 -0
  224. package/src/components/tab/tab-header.js +177 -0
  225. package/src/components/tab/tab-panel.js +101 -0
  226. package/src/components/tab/tab.js +249 -0
  227. package/src/components/tooltip/index.js +580 -0
  228. package/src/components/tooltip/index.stories.js +282 -0
  229. package/src/components/tooltip/portal.js +10 -0
  230. package/src/components/transfer/index.js +555 -0
  231. package/src/components/transfer/index.stories.js +53 -0
  232. package/src/components/tree-view/index.js +1085 -0
  233. package/src/components/tree-view/index.stories.js +347 -0
  234. package/src/components/typography/index.js +331 -0
  235. package/src/components/typography/index.stories.js +166 -0
  236. package/src/docs/changelog/changelog.md +1354 -0
  237. package/src/docs/changelog/index.stories.js +20 -0
  238. package/src/global/index.js +247 -0
  239. package/src/icons/basic.js +5930 -0
  240. package/src/icons/basic.stories.js +178 -0
  241. package/src/icons/effect.js +167 -0
  242. package/src/icons/general/clock/clock.js +16 -0
  243. package/src/icons/general/color-handler/background.js +34 -0
  244. package/src/icons/general/color-handler/text.js +34 -0
  245. package/src/icons/general/emoji/emoji.js +27 -0
  246. package/src/icons/general/font-properties/bold.js +17 -0
  247. package/src/icons/general/font-properties/font-family.js +27 -0
  248. package/src/icons/general/font-properties/font-size.js +24 -0
  249. package/src/icons/general/font-properties/italic.js +17 -0
  250. package/src/icons/general/font-properties/underline.js +26 -0
  251. package/src/icons/general/hyperlink/hyperlink.js +33 -0
  252. package/src/icons/general/indent/decrease.js +54 -0
  253. package/src/icons/general/indent/increase.js +54 -0
  254. package/src/icons/general/index.js +21 -0
  255. package/src/icons/general/index.mdx +68 -0
  256. package/src/icons/general/list/bullets.js +76 -0
  257. package/src/icons/general/list/numbering.js +69 -0
  258. package/src/icons/general/picture/picture.js +17 -0
  259. package/src/icons/general/steps/redo.js +17 -0
  260. package/src/icons/general/steps/undo.js +17 -0
  261. package/src/icons/general/text-align/center.js +17 -0
  262. package/src/icons/general/text-align/justify.js +17 -0
  263. package/src/icons/general/text-align/left.js +17 -0
  264. package/src/icons/general/text-align/right.js +17 -0
  265. package/src/icons/index.js +3 -0
  266. package/src/icons/index.stories.js +22 -0
  267. package/src/icons/menu/dhr.js +2625 -0
  268. package/src/icons/menu/erp.js +513 -0
  269. package/src/icons/menu/index.js +6 -0
  270. package/src/icons/menu/index.stories.js +107 -0
  271. package/src/icons/menu/v2/index.js +77 -0
  272. package/src/icons/menu/v2/index.stories.js +426 -0
  273. package/src/locale/index.js +13 -0
  274. package/src/scss/styles.scss +10 -0
  275. package/src/styles/animation.js +930 -0
  276. package/src/styles/animations.js +13 -0
  277. package/src/styles/color-helper.js +364 -0
  278. package/src/styles/colors.js +504 -0
  279. package/src/styles/colors.stories.js +105 -0
  280. package/src/styles/font.js +26 -0
  281. package/src/styles/general.js +824 -0
  282. package/src/styles/sx/index.js +35 -0
  283. package/src/styles/typography.js +181 -0
  284. package/src/styles/utils.js +35 -0
  285. package/src/theme/createBreakpoints.js +95 -0
  286. package/src/theme/createSpacing.js +12 -0
  287. package/src/theme/createTheme.js +29 -0
  288. package/src/theme/createZIndex.js +10 -0
  289. package/src/theme/docs/breakpoints.md +242 -0
  290. package/src/theme/docs/colors.md +64 -0
  291. package/src/theme/docs/components.md +32 -0
  292. package/src/theme/docs/darkMode.md +20 -0
  293. package/src/theme/docs/spacing.md +52 -0
  294. package/src/theme/docs/theming.md +69 -0
  295. package/src/theme/docs/zIndex.md +27 -0
  296. package/src/theme/index.js +15 -0
  297. package/src/theme/make-styles.js +32 -0
  298. package/src/theme/settings.js +816 -0
  299. package/src/theme/stories/breakpoints.stories.js +20 -0
  300. package/src/theme/stories/colors.stories.js +20 -0
  301. package/src/theme/stories/components.stories.js +20 -0
  302. package/src/theme/stories/darkMode.stories.js +20 -0
  303. package/src/theme/stories/spacing.stories.js +20 -0
  304. package/src/theme/stories/theming.stories.js +20 -0
  305. package/src/theme/stories/zIndex.stories.js +20 -0
  306. package/src/theme/theme-provider.js +101 -0
  307. package/src/theme/theme.js +57 -0
  308. package/src/theme/use-classes.js +19 -0
  309. package/src/theme/utils/getThemeProps.js +11 -0
  310. package/src/theme/utils/resolveProps.js +16 -0
  311. package/src/theme/utils/useThemeProps.js +8 -0
  312. package/src/utils/array/array.js +197 -0
  313. package/src/utils/classNames/index.js +28 -0
  314. package/src/utils/classNames/index.stories.js +61 -0
  315. package/src/utils/console.js +30 -0
  316. package/src/utils/date.js +391 -0
  317. package/src/utils/error/error.js +65 -0
  318. package/src/utils/error/errors.js +250 -0
  319. package/src/utils/getFileType.js +24 -0
  320. package/src/utils/handleBreakpoints.js +27 -0
  321. package/src/utils/hexToRGBA/index.js +25 -0
  322. package/src/utils/hexToRGBA/index.stories.js +43 -0
  323. package/src/utils/index.js +40 -0
  324. package/src/utils/intersectionObserver.js +45 -0
  325. package/src/utils/isMobile/index.js +22 -0
  326. package/src/utils/isMobile/index.stories.js +49 -0
  327. package/src/utils/isUndefined.js +3 -0
  328. package/src/utils/iterator.js +45 -0
  329. package/src/utils/map-parent.js +49 -0
  330. package/src/utils/object/deepmerge.js +129 -0
  331. package/src/utils/object/extend.js +55 -0
  332. package/src/utils/object/object.js +61 -0
  333. package/src/utils/parseHTML.js +20 -0
  334. package/src/utils/promisify.js +37 -0
  335. package/src/utils/randomString.js +22 -0
  336. package/src/utils/refMethodType.js +9 -0
  337. package/src/utils/refType.js +5 -0
  338. package/src/utils/remove-unicode.js +13 -0
  339. package/src/utils/render-portal.js +87 -0
  340. package/src/utils/renderHTML.js +17 -0
  341. package/src/utils/renderIcon.js +41 -0
  342. package/src/utils/sb-template.js +115 -0
  343. package/src/utils/storybook/index.js +1 -0
  344. package/src/utils/storybook/refArgTypes.js +46 -0
  345. package/src/utils/string/capitalize.js +6 -0
  346. package/src/utils/string/capitalizeSentenceCase.js +9 -0
  347. package/src/utils/string/string.js +83 -0
  348. package/src/utils/type.js +121 -0
  349. package/src/utils/updatePosition.js +27 -0
  350. package/src/utils/useControlled/index.js +23 -0
  351. package/src/utils/useDelayUnmount.js +17 -0
  352. package/src/utils/useElementSize.js +59 -0
  353. package/src/utils/useEventListener.js +54 -0
  354. package/src/utils/useInput.js +39 -0
  355. package/src/utils/useMediaQuery/index.js +50 -0
  356. package/src/utils/useMediaQuery/index.stories.js +55 -0
  357. package/src/utils/useOnClickOutside.js +28 -0
  358. package/src/utils/usePortal.js +54 -0
  359. package/src/utils/validate.js +135 -0
  360. package/components/accordion/context.js +0 -6
  361. package/components/accordion/details.js +0 -76
  362. package/components/accordion/group.js +0 -135
  363. package/components/accordion/index.js +0 -178
  364. package/components/accordion/summary.js +0 -324
  365. package/components/alert/index.js +0 -257
  366. package/components/alert/notify.js +0 -140
  367. package/components/avatar/index.js +0 -388
  368. package/components/badge/index.js +0 -231
  369. package/components/breadcrumb/index.js +0 -220
  370. package/components/button/icon.js +0 -357
  371. package/components/button/index.js +0 -444
  372. package/components/button/more.js +0 -210
  373. package/components/button/ripple-effect.js +0 -81
  374. package/components/card/body.js +0 -76
  375. package/components/card/extra.js +0 -76
  376. package/components/card/footer.js +0 -76
  377. package/components/card/header.js +0 -80
  378. package/components/card/index.js +0 -203
  379. package/components/chart/Pie/Circle.js +0 -50
  380. package/components/chart/Pie/Sector.js +0 -124
  381. package/components/chart/Pie/Sectors.js +0 -81
  382. package/components/chart/Pie/index.js +0 -277
  383. package/components/chart/Pie-v2/Circle.js +0 -48
  384. package/components/chart/Pie-v2/Sector.js +0 -108
  385. package/components/chart/Pie-v2/Sectors.js +0 -204
  386. package/components/chart/Pie-v2/index.js +0 -488
  387. package/components/chart/bar/Axis.js +0 -67
  388. package/components/chart/bar/Bar.js +0 -344
  389. package/components/chart/bar/Grid.js +0 -97
  390. package/components/chart/bar/Labels.js +0 -162
  391. package/components/chart/bar/Points.js +0 -94
  392. package/components/chart/bar/index.js +0 -161
  393. package/components/chart/bar-v2/Axis.js +0 -67
  394. package/components/chart/bar-v2/Bar.js +0 -354
  395. package/components/chart/bar-v2/Grid.js +0 -97
  396. package/components/chart/bar-v2/Labels.js +0 -162
  397. package/components/chart/bar-v2/Points.js +0 -94
  398. package/components/chart/bar-v2/index.js +0 -161
  399. package/components/chart/line/Axis.js +0 -68
  400. package/components/chart/line/Grid.js +0 -99
  401. package/components/chart/line/Labels.js +0 -160
  402. package/components/chart/line/Path.js +0 -154
  403. package/components/chart/line/Point.js +0 -343
  404. package/components/chart/line/Title.js +0 -52
  405. package/components/chart/line/index.js +0 -199
  406. package/components/chart/line-v2/Axis.js +0 -66
  407. package/components/chart/line-v2/Grid.js +0 -97
  408. package/components/chart/line-v2/Labels.js +0 -160
  409. package/components/chart/line-v2/Path.js +0 -153
  410. package/components/chart/line-v2/Point.js +0 -326
  411. package/components/chart/line-v2/Title.js +0 -52
  412. package/components/chart/line-v2/index.js +0 -165
  413. package/components/check-text/index.js +0 -155
  414. package/components/check-text/interview-confirmation.js +0 -171
  415. package/components/check-text/interview-status.js +0 -137
  416. package/components/chip/attach.js +0 -167
  417. package/components/chip/index.js +0 -275
  418. package/components/collapse/index.js +0 -93
  419. package/components/dialogs/colors.js +0 -13
  420. package/components/divider/index.js +0 -89
  421. package/components/form-control/attachment/index.js +0 -1537
  422. package/components/form-control/calendar/function.js +0 -752
  423. package/components/form-control/calendar/index.js +0 -317
  424. package/components/form-control/calendar/range.js +0 -291
  425. package/components/form-control/checkbox/index.js +0 -329
  426. package/components/form-control/control/index.js +0 -91
  427. package/components/form-control/date-input/DateField.js +0 -187
  428. package/components/form-control/date-input/index.js +0 -292
  429. package/components/form-control/date-input/useDateInputState.js +0 -129
  430. package/components/form-control/date-input/useIsFocused.js +0 -20
  431. package/components/form-control/date-input/useKeyboardInputEvent.js +0 -45
  432. package/components/form-control/date-input/utils.js +0 -290
  433. package/components/form-control/date-picker/index.js +0 -357
  434. package/components/form-control/date-range-picker/index.js +0 -1183
  435. package/components/form-control/dropdown/index.js +0 -1624
  436. package/components/form-control/dropdown-box/index.js +0 -238
  437. package/components/form-control/form/context.js +0 -5
  438. package/components/form-control/form/index.js +0 -40
  439. package/components/form-control/form-group/index.js +0 -117
  440. package/components/form-control/helper-text/index.js +0 -88
  441. package/components/form-control/input-base/UncontrolledInputBase.js +0 -450
  442. package/components/form-control/input-base/index.js +0 -646
  443. package/components/form-control/label/index.js +0 -117
  444. package/components/form-control/money-input/index.js +0 -513
  445. package/components/form-control/number-input/index.js +0 -582
  446. package/components/form-control/number-input/index2.js +0 -481
  447. package/components/form-control/password-input/index.js +0 -242
  448. package/components/form-control/phone-input/index.js +0 -364
  449. package/components/form-control/radio/index.js +0 -224
  450. package/components/form-control/text-input/index.js +0 -239
  451. package/components/form-control/time-picker/index.js +0 -781
  452. package/components/form-control/time-picker/swiper.js +0 -540
  453. package/components/form-control/time-picker/v2/index.js +0 -809
  454. package/components/form-control/toggle/index.js +0 -222
  455. package/components/form-view/helper-text.js +0 -33
  456. package/components/form-view/index.js +0 -95
  457. package/components/form-view/input.js +0 -117
  458. package/components/form-view/label.js +0 -37
  459. package/components/grid/Col.js +0 -91
  460. package/components/grid/Container.js +0 -85
  461. package/components/grid/Row.js +0 -81
  462. package/components/grid/context.js +0 -3
  463. package/components/grid/index.js +0 -251
  464. package/components/image/index.js +0 -170
  465. package/components/index.js +0 -156
  466. package/components/list/list-item-action.js +0 -82
  467. package/components/list/list-item-icon.js +0 -71
  468. package/components/list/list-item-text.js +0 -56
  469. package/components/list/list-item.js +0 -108
  470. package/components/list/list.js +0 -149
  471. package/components/list/sub-header.js +0 -63
  472. package/components/modal/body.js +0 -74
  473. package/components/modal/context.js +0 -6
  474. package/components/modal/footer.js +0 -78
  475. package/components/modal/header.js +0 -128
  476. package/components/modal/index.js +0 -63
  477. package/components/modal/modal.js +0 -292
  478. package/components/others/extra/index.js +0 -116
  479. package/components/others/import/index.js +0 -71
  480. package/components/others/option-wrapper/index.js +0 -39
  481. package/components/others/scrollbar/index.js +0 -94
  482. package/components/paging/page-info.js +0 -582
  483. package/components/paging/page-selector.js +0 -381
  484. package/components/paper/index.js +0 -112
  485. package/components/popover/body.js +0 -86
  486. package/components/popover/footer.js +0 -84
  487. package/components/popover/header.js +0 -88
  488. package/components/popover/index.js +0 -663
  489. package/components/popup/danger_popup.js +0 -189
  490. package/components/popup/index.js +0 -414
  491. package/components/popup/v2/index.js +0 -398
  492. package/components/progress/circular.js +0 -296
  493. package/components/progress/linear.js +0 -324
  494. package/components/rating/index.js +0 -243
  495. package/components/skeleton/index.js +0 -79
  496. package/components/slider/slider-container.js +0 -340
  497. package/components/slider/slider-item.js +0 -205
  498. package/components/status/index.js +0 -111
  499. package/components/tab/context.js +0 -3
  500. package/components/tab/tab-container.js +0 -100
  501. package/components/tab/tab-header.js +0 -160
  502. package/components/tab/tab-panel.js +0 -91
  503. package/components/tab/tab.js +0 -210
  504. package/components/tooltip/index.js +0 -522
  505. package/components/tooltip/portal.js +0 -11
  506. package/components/transfer/index.js +0 -434
  507. package/components/tree-view/index.js +0 -1017
  508. package/components/typography/index.js +0 -193
  509. package/css/styles.css +0 -1
  510. package/css/styles.css.map +0 -1
  511. package/global/index.js +0 -194
  512. package/icons/basic.js +0 -7864
  513. package/icons/effect.js +0 -131
  514. package/icons/general/clock/clock.js +0 -20
  515. package/icons/general/color-handler/background.js +0 -40
  516. package/icons/general/color-handler/text.js +0 -40
  517. package/icons/general/emoji/emoji.js +0 -34
  518. package/icons/general/font-properties/bold.js +0 -20
  519. package/icons/general/font-properties/font-family.js +0 -34
  520. package/icons/general/font-properties/font-size.js +0 -26
  521. package/icons/general/font-properties/italic.js +0 -20
  522. package/icons/general/font-properties/underline.js +0 -30
  523. package/icons/general/hyperlink/hyperlink.js +0 -37
  524. package/icons/general/indent/decrease.js +0 -54
  525. package/icons/general/indent/increase.js +0 -54
  526. package/icons/general/index.js +0 -21
  527. package/icons/general/list/bullets.js +0 -76
  528. package/icons/general/list/numbering.js +0 -70
  529. package/icons/general/picture/picture.js +0 -20
  530. package/icons/general/steps/redo.js +0 -20
  531. package/icons/general/steps/undo.js +0 -20
  532. package/icons/general/text-align/center.js +0 -20
  533. package/icons/general/text-align/justify.js +0 -20
  534. package/icons/general/text-align/left.js +0 -20
  535. package/icons/general/text-align/right.js +0 -20
  536. package/icons/index.js +0 -3
  537. package/icons/menu/dhr.js +0 -2442
  538. package/icons/menu/erp.js +0 -491
  539. package/icons/menu/index.js +0 -5
  540. package/icons/menu/v2/index.js +0 -71
  541. package/locale/index.js +0 -11
  542. package/styles/animation.js +0 -848
  543. package/styles/animations.js +0 -13
  544. package/styles/color-helper.js +0 -343
  545. package/styles/colors.js +0 -476
  546. package/styles/font.js +0 -24
  547. package/styles/general.js +0 -568
  548. package/styles/sx/index.js +0 -28
  549. package/styles/typography.js +0 -156
  550. package/styles/utils.js +0 -35
  551. package/theme/createBreakpoints.js +0 -82
  552. package/theme/createSpacing.js +0 -10
  553. package/theme/createTheme.js +0 -26
  554. package/theme/createZIndex.js +0 -9
  555. package/theme/index.js +0 -14
  556. package/theme/make-styles.js +0 -30
  557. package/theme/settings.js +0 -861
  558. package/theme/theme-provider.js +0 -102
  559. package/theme/theme.js +0 -57
  560. package/theme/use-classes.js +0 -15
  561. package/theme/utils/getThemeProps.js +0 -12
  562. package/theme/utils/resolveProps.js +0 -17
  563. package/theme/utils/useThemeProps.js +0 -14
  564. package/utils/array/array.js +0 -169
  565. package/utils/classNames/index.js +0 -25
  566. package/utils/console.js +0 -27
  567. package/utils/date.js +0 -401
  568. package/utils/error/error.js +0 -53
  569. package/utils/error/errors.js +0 -200
  570. package/utils/getFileType.js +0 -23
  571. package/utils/handleBreakpoints.js +0 -25
  572. package/utils/hexToRGBA/index.js +0 -23
  573. package/utils/index.js +0 -38
  574. package/utils/intersectionObserver.js +0 -37
  575. package/utils/isMobile/index.js +0 -21
  576. package/utils/isUndefined.js +0 -2
  577. package/utils/iterator.js +0 -36
  578. package/utils/map-parent.js +0 -46
  579. package/utils/object/deepmerge.js +0 -103
  580. package/utils/object/extend.js +0 -47
  581. package/utils/object/object.js +0 -54
  582. package/utils/parseHTML.js +0 -18
  583. package/utils/promisify.js +0 -34
  584. package/utils/randomString.js +0 -26
  585. package/utils/refMethodType.js +0 -6
  586. package/utils/refType.js +0 -5
  587. package/utils/remove-unicode.js +0 -5
  588. package/utils/render-portal.js +0 -87
  589. package/utils/renderHTML.js +0 -18
  590. package/utils/renderIcon.js +0 -53
  591. package/utils/sb-template.js +0 -113
  592. package/utils/storybook/index.js +0 -1
  593. package/utils/storybook/refArgTypes.js +0 -41
  594. package/utils/string/capitalize.js +0 -3
  595. package/utils/string/capitalizeSentenceCase.js +0 -8
  596. package/utils/string/string.js +0 -60
  597. package/utils/type.js +0 -69
  598. package/utils/updatePosition.js +0 -35
  599. package/utils/useControlled/index.js +0 -14
  600. package/utils/useDelayUnmount.js +0 -15
  601. package/utils/useElementSize.js +0 -55
  602. package/utils/useEventListener.js +0 -51
  603. package/utils/useInput.js +0 -33
  604. package/utils/useMediaQuery/index.js +0 -44
  605. package/utils/useOnClickOutside.js +0 -21
  606. package/utils/usePortal.js +0 -49
  607. package/utils/validate.js +0 -135
  608. /package/{assets → src/assets}/avatar/default.svg +0 -0
  609. /package/{assets → src/assets}/fonts/SF-Pro-Display-Bold.otf +0 -0
  610. /package/{assets → src/assets}/fonts/SF-Pro-Display-Medium.otf +0 -0
  611. /package/{assets → src/assets}/fonts/SF-Pro-Display-Regular.otf +0 -0
  612. /package/{assets → src/assets}/fonts/text-security-disc-compat.eot +0 -0
  613. /package/{assets → src/assets}/fonts/text-security-disc-compat.ttf +0 -0
  614. /package/{assets → src/assets}/fonts/text-security-disc-compat.woff2 +0 -0
  615. /package/{assets → src/assets}/fonts/text-security-disc.woff2 +0 -0
  616. /package/{assets → src/assets}/image/default.png +0 -0
  617. /package/{assets → src/assets}/images/icons/wifi.svg +0 -0
  618. /package/{assets → src/assets}/images/menu/bem/WA3F0100.svg +0 -0
  619. /package/{assets → src/assets}/images/menu/bem/WA3F1025.svg +0 -0
  620. /package/{assets → src/assets}/images/menu/bem/WA3F2000.svg +0 -0
  621. /package/{assets → src/assets}/images/menu/bem/WA3F2020.svg +0 -0
  622. /package/{assets → src/assets}/images/menu/bem/WA3F2030.svg +0 -0
  623. /package/{assets → src/assets}/images/menu/bem/WA3F2040.svg +0 -0
  624. /package/{assets → src/assets}/images/menu/bem/WA3F2100.svg +0 -0
  625. /package/{assets → src/assets}/images/menu/dhr/ALL.svg +0 -0
  626. /package/{assets → src/assets}/images/menu/dhr/D00.svg +0 -0
  627. /package/{assets → src/assets}/images/menu/dhr/D09.svg +0 -0
  628. /package/{assets → src/assets}/images/menu/dhr/D13.svg +0 -0
  629. /package/{assets → src/assets}/images/menu/dhr/D15.svg +0 -0
  630. /package/{assets → src/assets}/images/menu/dhr/D21.svg +0 -0
  631. /package/{assets → src/assets}/images/menu/dhr/D25.svg +0 -0
  632. /package/{assets → src/assets}/images/menu/dhr/D29.svg +0 -0
  633. /package/{assets → src/assets}/images/menu/dhr/D38.svg +0 -0
  634. /package/{assets → src/assets}/images/menu/dhr/D39.svg +0 -0
  635. /package/{assets → src/assets}/images/menu/dhr/D51.svg +0 -0
  636. /package/{assets → src/assets}/images/menu/dhr/D52.svg +0 -0
  637. /package/{assets → src/assets}/images/menu/dhr/D77.svg +0 -0
  638. /package/{assets → src/assets}/images/menu/dhr/D84.svg +0 -0
  639. /package/{assets → src/assets}/images/menu/dhr/D89.svg +0 -0
  640. /package/{assets → src/assets}/images/menu/dhr/Default.svg +0 -0
  641. /package/{assets → src/assets}/images/menu/dhr/MAHR21N0000.svg +0 -0
  642. /package/{assets → src/assets}/images/menu/dhr/MAHR29N0001.svg +0 -0
  643. /package/{assets → src/assets}/images/menu/dhr/MAHR29N0002.svg +0 -0
  644. /package/{assets → src/assets}/images/menu/dhr/MAHR29N0003.svg +0 -0
  645. /package/{assets → src/assets}/images/menu/dhr/MAHR29N0004.svg +0 -0
  646. /package/{assets → src/assets}/images/menu/dhr/MAHR29N0011.svg +0 -0
  647. /package/{assets → src/assets}/images/menu/dhr/MAHR29N0012.svg +0 -0
  648. /package/{assets → src/assets}/images/menu/dhr/MAHR29N0013.svg +0 -0
  649. /package/{assets → src/assets}/images/menu/dhr/MAHR75N0005.svg +0 -0
  650. /package/{assets → src/assets}/images/menu/dhr/MAHR75N0006.svg +0 -0
  651. /package/{assets → src/assets}/images/menu/dhr/MAHR75N0007.svg +0 -0
  652. /package/{assets → src/assets}/images/menu/dhr/MAHR75N0008.svg +0 -0
  653. /package/{assets → src/assets}/images/menu/dhr/MAHR75N0009.svg +0 -0
  654. /package/{assets → src/assets}/images/menu/dhr/MAHR75N0010.svg +0 -0
  655. /package/{assets → src/assets}/images/menu/dhr/MAHR89N0014.svg +0 -0
  656. /package/{assets → src/assets}/images/menu/dhr/MAHR89N0015.svg +0 -0
  657. /package/{assets → src/assets}/images/menu/dhr/MHRM00N0001.svg +0 -0
  658. /package/{assets → src/assets}/images/menu/dhr/MHRM00N0002.svg +0 -0
  659. /package/{assets → src/assets}/images/menu/dhr/MHRM00N0003.svg +0 -0
  660. /package/{assets → src/assets}/images/menu/dhr/MHRM00N0004.svg +0 -0
  661. /package/{assets → src/assets}/images/menu/dhr/MHRM00N0005.svg +0 -0
  662. /package/{assets → src/assets}/images/menu/dhr/MHRM00N0006.svg +0 -0
  663. /package/{assets → src/assets}/images/menu/dhr/MHRM00N0007.svg +0 -0
  664. /package/{assets → src/assets}/images/menu/dhr/MHRM09N0001.svg +0 -0
  665. /package/{assets → src/assets}/images/menu/dhr/MHRM09N0002.svg +0 -0
  666. /package/{assets → src/assets}/images/menu/dhr/MHRM09N0003.svg +0 -0
  667. /package/{assets → src/assets}/images/menu/dhr/MHRM09N0004.svg +0 -0
  668. /package/{assets → src/assets}/images/menu/dhr/MHRM09N0005.svg +0 -0
  669. /package/{assets → src/assets}/images/menu/dhr/MHRM09N1010.svg +0 -0
  670. /package/{assets → src/assets}/images/menu/dhr/MHRM09N1015.svg +0 -0
  671. /package/{assets → src/assets}/images/menu/dhr/MHRM09N1020.svg +0 -0
  672. /package/{assets → src/assets}/images/menu/dhr/MHRM09N1025.svg +0 -0
  673. /package/{assets → src/assets}/images/menu/dhr/MHRM09N1030.svg +0 -0
  674. /package/{assets → src/assets}/images/menu/dhr/MHRM09N1035.svg +0 -0
  675. /package/{assets → src/assets}/images/menu/dhr/MHRM09N1040.svg +0 -0
  676. /package/{assets → src/assets}/images/menu/dhr/MHRM09N1400.svg +0 -0
  677. /package/{assets → src/assets}/images/menu/dhr/MHRM13N0001.svg +0 -0
  678. /package/{assets → src/assets}/images/menu/dhr/MHRM13N0002.svg +0 -0
  679. /package/{assets → src/assets}/images/menu/dhr/MHRM13N0003.svg +0 -0
  680. /package/{assets → src/assets}/images/menu/dhr/MHRM13N0004.svg +0 -0
  681. /package/{assets → src/assets}/images/menu/dhr/MHRM15N0001.svg +0 -0
  682. /package/{assets → src/assets}/images/menu/dhr/MHRM25N0001.svg +0 -0
  683. /package/{assets → src/assets}/images/menu/dhr/MHRM29N0001.svg +0 -0
  684. /package/{assets → src/assets}/images/menu/dhr/MHRM29N0002.svg +0 -0
  685. /package/{assets → src/assets}/images/menu/dhr/MHRM29N0003.svg +0 -0
  686. /package/{assets → src/assets}/images/menu/dhr/MHRM29N0004.svg +0 -0
  687. /package/{assets → src/assets}/images/menu/dhr/MHRM29N0005.svg +0 -0
  688. /package/{assets → src/assets}/images/menu/dhr/MHRM29N0015.svg +0 -0
  689. /package/{assets → src/assets}/images/menu/dhr/MHRM38N0001.svg +0 -0
  690. /package/{assets → src/assets}/images/menu/dhr/MHRM38N0002.svg +0 -0
  691. /package/{assets → src/assets}/images/menu/dhr/MHRM38N0003.svg +0 -0
  692. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0012.svg +0 -0
  693. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0013.svg +0 -0
  694. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0014.svg +0 -0
  695. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0015.svg +0 -0
  696. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0016.svg +0 -0
  697. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0017.svg +0 -0
  698. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0018.svg +0 -0
  699. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0019.svg +0 -0
  700. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0020.svg +0 -0
  701. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0021.svg +0 -0
  702. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0022.svg +0 -0
  703. /package/{assets → src/assets}/images/menu/dhr/MHRM39N0023.svg +0 -0
  704. /package/{assets → src/assets}/images/menu/dhr/MHRM51N0005.svg +0 -0
  705. /package/{assets → src/assets}/images/menu/dhr/MHRM51N0006.svg +0 -0
  706. /package/{assets → src/assets}/images/menu/dhr/MHRM51N0007.svg +0 -0
  707. /package/{assets → src/assets}/images/menu/dhr/MHRM77N0001.svg +0 -0
  708. /package/{assets → src/assets}/images/menu/dhr/MHRM77N0003.svg +0 -0
  709. /package/{assets → src/assets}/images/menu/dhr/MHRM82N0001.svg +0 -0
  710. /package/{assets → src/assets}/images/menu/dhr/MHRM82N0002.svg +0 -0
  711. /package/{assets → src/assets}/images/menu/dhr/MHRM84N0001.svg +0 -0
  712. /package/{assets → src/assets}/images/menu/dhr/MHRM84N0002.svg +0 -0
  713. /package/{assets → src/assets}/images/menu/dhr/MHRM89N0001.svg +0 -0
  714. /package/{assets → src/assets}/images/menu/dhr/MHRM89N0002.svg +0 -0
  715. /package/{assets → src/assets}/images/menu/dhr/MHRP00N0001.svg +0 -0
  716. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0001.svg +0 -0
  717. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0002.svg +0 -0
  718. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0003.svg +0 -0
  719. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0004.svg +0 -0
  720. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0005.svg +0 -0
  721. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0006.svg +0 -0
  722. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0007.svg +0 -0
  723. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0008.svg +0 -0
  724. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0009.svg +0 -0
  725. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0010.svg +0 -0
  726. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0011.svg +0 -0
  727. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0012.svg +0 -0
  728. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0013.svg +0 -0
  729. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0014.svg +0 -0
  730. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0015.svg +0 -0
  731. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0016.svg +0 -0
  732. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0017.svg +0 -0
  733. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0018.svg +0 -0
  734. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0019.svg +0 -0
  735. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0020.svg +0 -0
  736. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0021.svg +0 -0
  737. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0022.svg +0 -0
  738. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0023.svg +0 -0
  739. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0024.svg +0 -0
  740. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0025.svg +0 -0
  741. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0026.svg +0 -0
  742. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0027.svg +0 -0
  743. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0028.svg +0 -0
  744. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0029.svg +0 -0
  745. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0030.svg +0 -0
  746. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0031.svg +0 -0
  747. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0032.svg +0 -0
  748. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0033.svg +0 -0
  749. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0034.svg +0 -0
  750. /package/{assets → src/assets}/images/menu/dhr/MHRP09N0035.svg +0 -0
  751. /package/{assets → src/assets}/images/menu/dhr/MHRP13N0001.svg +0 -0
  752. /package/{assets → src/assets}/images/menu/dhr/MHRP13N0005.svg +0 -0
  753. /package/{assets → src/assets}/images/menu/dhr/MHRP13N0006.svg +0 -0
  754. /package/{assets → src/assets}/images/menu/dhr/MHRP21N0001.svg +0 -0
  755. /package/{assets → src/assets}/images/menu/dhr/MHRP21N0002.svg +0 -0
  756. /package/{assets → src/assets}/images/menu/dhr/MHRP25L0101.svg +0 -0
  757. /package/{assets → src/assets}/images/menu/dhr/MHRP25L0501.svg +0 -0
  758. /package/{assets → src/assets}/images/menu/dhr/MHRP25N0001.svg +0 -0
  759. /package/{assets → src/assets}/images/menu/dhr/MHRP25N0002.svg +0 -0
  760. /package/{assets → src/assets}/images/menu/dhr/MHRP25N0003.svg +0 -0
  761. /package/{assets → src/assets}/images/menu/dhr/MHRP25N0004.svg +0 -0
  762. /package/{assets → src/assets}/images/menu/dhr/MHRP25N0005.svg +0 -0
  763. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0001.svg +0 -0
  764. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0002.svg +0 -0
  765. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0003.svg +0 -0
  766. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0004.svg +0 -0
  767. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0005.svg +0 -0
  768. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0006.svg +0 -0
  769. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0007.svg +0 -0
  770. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0008.svg +0 -0
  771. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0009.svg +0 -0
  772. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0010.svg +0 -0
  773. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0011.svg +0 -0
  774. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0012.svg +0 -0
  775. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0013.svg +0 -0
  776. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0014.svg +0 -0
  777. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0016.svg +0 -0
  778. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0017.svg +0 -0
  779. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0018.svg +0 -0
  780. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0019.svg +0 -0
  781. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0020.svg +0 -0
  782. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0021.svg +0 -0
  783. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0022.svg +0 -0
  784. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0023.svg +0 -0
  785. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0026.svg +0 -0
  786. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0027.svg +0 -0
  787. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0028.svg +0 -0
  788. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0029.svg +0 -0
  789. /package/{assets → src/assets}/images/menu/dhr/MHRP29N0030.svg +0 -0
  790. /package/{assets → src/assets}/images/menu/dhr/MHRP38N0001.svg +0 -0
  791. /package/{assets → src/assets}/images/menu/dhr/MHRP38N0002.svg +0 -0
  792. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0001.svg +0 -0
  793. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0002.svg +0 -0
  794. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0003.svg +0 -0
  795. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0004.svg +0 -0
  796. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0005.svg +0 -0
  797. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0006.svg +0 -0
  798. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0007.svg +0 -0
  799. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0008.svg +0 -0
  800. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0009.svg +0 -0
  801. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0010.svg +0 -0
  802. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0011.svg +0 -0
  803. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0013.svg +0 -0
  804. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0014.svg +0 -0
  805. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0015.svg +0 -0
  806. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0017.svg +0 -0
  807. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0018.svg +0 -0
  808. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0019.svg +0 -0
  809. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0020.svg +0 -0
  810. /package/{assets → src/assets}/images/menu/dhr/MHRP39N0021.svg +0 -0
  811. /package/{assets → src/assets}/images/menu/dhr/MHRP39N1222.svg +0 -0
  812. /package/{assets → src/assets}/images/menu/dhr/MHRP51N0001.svg +0 -0
  813. /package/{assets → src/assets}/images/menu/dhr/MHRP51N0002.svg +0 -0
  814. /package/{assets → src/assets}/images/menu/dhr/MHRP51N0003.svg +0 -0
  815. /package/{assets → src/assets}/images/menu/dhr/MHRP51N0004.svg +0 -0
  816. /package/{assets → src/assets}/images/menu/dhr/MHRP52N0001.svg +0 -0
  817. /package/{assets → src/assets}/images/menu/dhr/MHRP52N0002.svg +0 -0
  818. /package/{assets → src/assets}/images/menu/dhr/MHRP52N0003.svg +0 -0
  819. /package/{assets → src/assets}/images/menu/dhr/MHRP75N0001.svg +0 -0
  820. /package/{assets → src/assets}/images/menu/dhr/MHRP75N0002.svg +0 -0
  821. /package/{assets → src/assets}/images/menu/dhr/MHRP75N0003.svg +0 -0
  822. /package/{assets → src/assets}/images/menu/dhr/MHRP75N0006.svg +0 -0
  823. /package/{assets → src/assets}/images/menu/dhr/MHRP75N0007.svg +0 -0
  824. /package/{assets → src/assets}/images/menu/dhr/MHRP75N0008.svg +0 -0
  825. /package/{assets → src/assets}/images/menu/dhr/MHRP77N0007.svg +0 -0
  826. /package/{assets → src/assets}/images/menu/dhr/MHRP77N0008.svg +0 -0
  827. /package/{assets → src/assets}/images/menu/dhr/MHRP77N0009.svg +0 -0
  828. /package/{assets → src/assets}/images/menu/dhr/MHRP77N0010.svg +0 -0
  829. /package/{assets → src/assets}/images/menu/dhr/MHRP77N0011.svg +0 -0
  830. /package/{assets → src/assets}/images/menu/dhr/MHRP89N1000.svg +0 -0
  831. /package/{assets → src/assets}/images/menu/dhr/MHRP89N1001.svg +0 -0
  832. /package/{assets → src/assets}/images/menu/dhr/TASK.svg +0 -0
  833. /package/{assets → src/assets}/images/menu/dhr/W00F0001.svg +0 -0
  834. /package/{assets → src/assets}/images/menu/dhr/W00F0002.svg +0 -0
  835. /package/{assets → src/assets}/images/menu/dhr/W00F0003.svg +0 -0
  836. /package/{assets → src/assets}/images/menu/dhr/W00F0004.svg +0 -0
  837. /package/{assets → src/assets}/images/menu/dhr/W00F0005.svg +0 -0
  838. /package/{assets → src/assets}/images/menu/dhr/W09F2000-WEB5.svg +0 -0
  839. /package/{assets → src/assets}/images/menu/dhr/W09F2000.svg +0 -0
  840. /package/{assets → src/assets}/images/menu/dhr/W09F2002-WEB5.svg +0 -0
  841. /package/{assets → src/assets}/images/menu/dhr/W09F2005-WEB5.svg +0 -0
  842. /package/{assets → src/assets}/images/menu/dhr/W09F2020-WEB5.svg +0 -0
  843. /package/{assets → src/assets}/images/menu/dhr/W09F2022-WEB5.svg +0 -0
  844. /package/{assets → src/assets}/images/menu/dhr/W09F2150-WEB5.svg +0 -0
  845. /package/{assets → src/assets}/images/menu/dhr/W09F2152-WEB5.svg +0 -0
  846. /package/{assets → src/assets}/images/menu/dhr/W09F2160-WEB5.svg +0 -0
  847. /package/{assets → src/assets}/images/menu/dhr/W09F2162-WEB5.svg +0 -0
  848. /package/{assets → src/assets}/images/menu/dhr/W29F4006-WEB5.svg +0 -0
  849. /package/{assets → src/assets}/images/menu/dhr/W75F2260-WEB5.svg +0 -0
  850. /package/{assets → src/assets}/images/menu/dhr/W75F2261-WEB5.svg +0 -0
  851. /package/{assets → src/assets}/images/menu/dhr/W75F3005-WEB5.svg +0 -0
  852. /package/{assets → src/assets}/images/menu/dhr/W75F4070-WEB5.svg +0 -0
  853. /package/{assets → src/assets}/images/menu/dhr/W75F4071-WEB5.svg +0 -0
  854. /package/{assets → src/assets}/images/menu/dhr/W75F4100-WEB5.svg +0 -0
  855. /package/{assets → src/assets}/images/menu/dhr/W77F1011.svg +0 -0
  856. /package/{assets → src/assets}/images/menu/dhr/W77F1013.svg +0 -0
  857. /package/{assets → src/assets}/images/menu/eo/W00F0001.svg +0 -0
  858. /package/{assets → src/assets}/images/menu/eo/W00F0002.svg +0 -0
  859. /package/{assets → src/assets}/images/menu/eo/W00F0003.svg +0 -0
  860. /package/{assets → src/assets}/images/menu/eo/W00F0004.svg +0 -0
  861. /package/{assets → src/assets}/images/menu/eo/WEO76APP0001.svg +0 -0
  862. /package/{assets → src/assets}/images/menu/eo/WEO76APP0002.svg +0 -0
  863. /package/{assets → src/assets}/images/menu/eo/WEO76LIS0001.svg +0 -0
  864. /package/{assets → src/assets}/images/menu/eo/WEO76LIS0002.svg +0 -0
  865. /package/{assets → src/assets}/images/menu/eo/WEO76LIS0003.svg +0 -0
  866. /package/{assets → src/assets}/images/menu/eo/WEO76LIS0004.svg +0 -0
  867. /package/{assets → src/assets}/images/menu/eo/WEO76LIS0005.svg +0 -0
  868. /package/{assets → src/assets}/images/menu/eo/WEO76LIS0006.svg +0 -0
  869. /package/{assets → src/assets}/images/menu/eo/WEO76LIS0007.svg +0 -0
  870. /package/{assets → src/assets}/images/menu/eo/WEO76REQ0001.svg +0 -0
  871. /package/{assets → src/assets}/images/menu/eo/WEO76REQ0002.svg +0 -0
  872. /package/{assets → src/assets}/images/menu/eo/WEO76REQ0003.svg +0 -0
  873. /package/{assets → src/assets}/images/menu/eo/WEO76TRA0001.svg +0 -0
  874. /package/{assets → src/assets}/images/menu/eo/WTM76ACC0001.svg +0 -0
  875. /package/{assets → src/assets}/images/menu/eo/WTM76INF0001.svg +0 -0
  876. /package/{assets → src/assets}/images/menu/eo/WTM76PRO0001.svg +0 -0
  877. /package/{assets → src/assets}/images/menu/eo/WTM76SYS0001.svg +0 -0
  878. /package/{assets → src/assets}/images/menu/erp/D05.svg +0 -0
  879. /package/{assets → src/assets}/images/menu/erp/D06.svg +0 -0
  880. /package/{assets → src/assets}/images/menu/erp/D90R.svg +0 -0
  881. /package/{assets → src/assets}/images/menu/erp/DBC.svg +0 -0
  882. /package/{assets → src/assets}/images/menu/erp/W00F0001.svg +0 -0
  883. /package/{assets → src/assets}/images/menu/erp/W00F0002.svg +0 -0
  884. /package/{assets → src/assets}/images/menu/erp/W00F0003.svg +0 -0
  885. /package/{assets → src/assets}/images/menu/erp/W00F0004.svg +0 -0
  886. /package/{assets → src/assets}/images/menu/erp/W05F0001.svg +0 -0
  887. /package/{assets → src/assets}/images/menu/erp/W05F0001N0000.svg +0 -0
  888. /package/{assets → src/assets}/images/menu/erp/W05F0004N0000.svg +0 -0
  889. /package/{assets → src/assets}/images/menu/erp/W05F0006N0000.svg +0 -0
  890. /package/{assets → src/assets}/images/menu/erp/W05F0007N0000.svg +0 -0
  891. /package/{assets → src/assets}/images/menu/erp/W05F0008N0000.svg +0 -0
  892. /package/{assets → src/assets}/images/menu/erp/W05F0011N0000.svg +0 -0
  893. /package/{assets → src/assets}/images/menu/erp/W05F0013N0000.svg +0 -0
  894. /package/{assets → src/assets}/images/menu/erp/W05F4000N0000.svg +0 -0
  895. /package/{assets → src/assets}/images/menu/erp/W06F0001.svg +0 -0
  896. /package/{assets → src/assets}/images/menu/erp/W06F0001N0000.svg +0 -0
  897. /package/{assets → src/assets}/images/menu/erp/W06F0004N0000.svg +0 -0
  898. /package/{assets → src/assets}/images/menu/erp/W06F0005N0000.svg +0 -0
  899. /package/{assets → src/assets}/images/menu/erp/W06F0006N0000.svg +0 -0
  900. /package/{assets → src/assets}/images/menu/erp/W06F0008N0000.svg +0 -0
  901. /package/{assets → src/assets}/images/menu/erp/W94F1000N0000.svg +0 -0
  902. /package/{assets → src/assets}/images/menu/erp/W94F1000N0001.svg +0 -0
  903. /package/{assets → src/assets}/images/menu/erp/WA3F1025.svg +0 -0
  904. /package/{assets → src/assets}/images/menu/erp/WA3F2100.svg +0 -0
  905. /package/{assets → src/assets}/storybook/avatar01.svg +0 -0
  906. /package/{assets → src/assets}/storybook/cover01.svg +0 -0
@@ -1,1624 +0,0 @@
1
- /** @jsxRuntime classic */
2
- /** @jsx jsx */
3
- import { css, jsx } from '@emotion/core';
4
- import { Avatar, ButtonIcon, Checkbox, Chip, CircularProgress, HelperText, InputBase, Label, Popup, TreeView, Typography } from "../..";
5
- import Popover from "../../popover";
6
- import { getGlobal } from "../../../global";
7
- import PropTypes from 'prop-types';
8
- import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
9
- import ReactDOM from 'react-dom';
10
- import { animation, bgColor, border, borderBottom, borderBottomColor, borderColor, borderNone, borderRadius, bottom, boxBorder, breakWord, cursorDefault, cursorNotAllowed, cursorPointer, displayBlock, displayFlex, fill, flexRow, flexWrap, inset, insetX, invisible, italic, itemsCenter, justifyCenter, justifyStart, outlineNone, overflowAuto, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMinHeight, parseWidth, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, textColor, top, userSelectNone, z } from "../../../styles/general";
11
- import { useTheme } from "../../../theme";
12
- import useThemeProps from "../../../theme/utils/useThemeProps";
13
- import { classNames, getProp, isMobile, randomString } from "../../../utils";
14
- const currentValue = {},
15
- isSearch = {},
16
- allValue = {};
17
- const separatorPattern = /\{\w+\}/g;
18
- const regexBetween = /[^{}]+(?=})/g;
19
- const regexInclude = /{|}/g;
20
- const checkHasValue = value => {
21
- return Array.isArray(value) ? value.length > 0 : value === 0 || !!value;
22
- };
23
- const convertData = (dt, valueExpr) => {
24
- let data = dt || [];
25
- let valueTemp = Array.isArray(data) ? data : [data];
26
- valueTemp = valueTemp.map(i => i[valueExpr] || i);
27
- return valueTemp;
28
- };
29
- const convertSearchDelayTime = searchDelayTime => {
30
- var _searchDelayTime$matc, _searchDelayTime$matc2;
31
- if (searchDelayTime === true) return getGlobal('delayOnInput');
32
- const units = {
33
- m: 60000,
34
- s: 1000,
35
- ms: 1
36
- };
37
- return typeof searchDelayTime === 'number' ? searchDelayTime : (((_searchDelayTime$matc = searchDelayTime.match(/[^a-z]+/i)) === null || _searchDelayTime$matc === void 0 ? void 0 : _searchDelayTime$matc[0]) || 1) * units[((_searchDelayTime$matc2 = searchDelayTime.match(/ms|s|m/i)) === null || _searchDelayTime$matc2 === void 0 ? void 0 : _searchDelayTime$matc2[0]) || 's'];
38
- };
39
- const uniqBy = (arr, iteratee) => {
40
- const seen = new Set();
41
- return arr.filter(item => {
42
- const val = iteratee(item);
43
- if (seen.has(val)) {
44
- return false;
45
- }
46
- seen.add(val);
47
- return true;
48
- });
49
- };
50
- const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
51
- if (!reference) reference = useRef(null);
52
- const theme = useTheme();
53
- const {
54
- spacing
55
- } = theme;
56
-
57
- // props priority: `inProps` > `themeDefaultProps`
58
- const props = useThemeProps({
59
- props: inProps,
60
- name: 'Dropdown'
61
- });
62
- const {
63
- action = {},
64
- allowSearch,
65
- children,
66
- className,
67
- clearAble,
68
- closeAfterSelect,
69
- dataSource,
70
- displayExpr: displayExprProp,
71
- dropdownItemStyle,
72
- error,
73
- helperTextProps,
74
- iconExpr,
75
- inputProps,
76
- inputStyle,
77
- itemMode,
78
- label,
79
- labelProps,
80
- limit,
81
- loading,
82
- maximumSelectionLength,
83
- multilineSelectedItem,
84
- multiple,
85
- noDataText: noDataTextProp,
86
- onChange,
87
- onClosed,
88
- onInput,
89
- onKeyDown,
90
- onLoadMore,
91
- placeholder: placeholderProp,
92
- readOnly,
93
- renderItem,
94
- renderSelectedItem,
95
- required,
96
- searchDelayTime: searchDelayTimeProp,
97
- searchExpr: searchExprProp,
98
- searchMode,
99
- selectBox: selectBoxProp,
100
- skip,
101
- style,
102
- subText,
103
- total,
104
- treeViewID,
105
- treeViewParentID,
106
- value: valueProp,
107
- valueExpr,
108
- valueObjectDefault,
109
- viewType,
110
- defaultValue,
111
- disabled
112
- } = props;
113
- const selectBox = multiple && selectBoxProp === undefined ? true : selectBoxProp;
114
- const searchExpr = typeof searchExprProp === 'string' ? [searchExprProp] : searchExprProp;
115
- const searchDelayTime = convertSearchDelayTime(searchDelayTimeProp === undefined ? getGlobal('delayOnInput') : searchDelayTimeProp);
116
- let displayExpr = displayExprProp;
117
- const noDataText = noDataTextProp || getGlobal('noDataText');
118
- const placeholder = placeholderProp || getGlobal('dropdownPlaceholder');
119
- const ref = useRef(null);
120
- const dropdownRef = useRef(null);
121
- const timer = useRef(null);
122
- const timerRef = useRef(null);
123
- const formRef = useRef(null);
124
- const inputRef = useRef(null);
125
- const iconRef = useRef(null);
126
- const dropdownListRef = useRef(null);
127
- const searchRef = useRef(null);
128
- const loadMoreTimer = useRef(null);
129
- const dataChosen = useRef([]);
130
- const popupRef = useRef(null);
131
- const filter = useRef({
132
- skip: skip || 0,
133
- limit: limit || 50
134
- });
135
- const [unique] = useState(randomString(6, {
136
- allowNumber: false,
137
- allowSymbol: false
138
- }));
139
- const [openState, setOpenState] = useState(false);
140
- const [showClear, setShowClear] = useState(false);
141
- const [valueSingle, setValueSingle] = useState('');
142
- const [txtSearch, setTxtSearch] = useState('');
143
- const [popoverWidth, setPopoverWidth] = useState(0);
144
- const [loadingState, setLoadingState] = useState(loading);
145
- const [totalState, setTotalState] = useState(total);
146
- const [dataSourceState, setDataSourceState] = useState(dataSource || []);
147
- const [popupDataState, setPopupDataState] = useState({
148
- title: '',
149
- substitle: '',
150
- description: ''
151
- });
152
- const [vlObjDefaultState, setVlObjDefaultState] = useState([]);
153
- let valueTemp = valueProp || defaultValue || [];
154
-
155
- // only mode multi
156
- if (multiple) {
157
- valueTemp = convertData(valueTemp, valueExpr);
158
- }
159
- const [valueMulti, setValueMulti] = useState(valueTemp);
160
- const _isMobile = isMobile.any();
161
- const _InputCSS = InputCSS(multiple, typeof renderSelectedItem === 'function');
162
- const _DropdownInputCSS = DropdownInputCSS(viewType, multiple, placeholder, disabled, readOnly, multilineSelectedItem, theme);
163
- const _IconCSS = IconCSS(viewType, theme);
164
- const _DropdownFormCSS = viewType === 'outlined' ? DropdownFormOutlinedCSS(disabled, readOnly, placeholder, theme) : DropdownFormCSS(viewType, multiple, disabled, readOnly, placeholder, _DropdownInputCSS.name, theme);
165
- const _DropdownListCSS = DropdownListCSS(loadingState, theme);
166
- const _DropdownItemCSS = DropdownItemCSS(multiple, selectBox, theme);
167
- const _DropdownRootCSS = DropdownRootCSS(_DropdownFormCSS.name, _DropdownInputCSS.name, theme);
168
- const _CheckBoxCSS = CheckBoxCSS(theme);
169
-
170
- /* Start handler */
171
- const setShowDropdown = () => {
172
- setOpenState(!openState);
173
- };
174
- const triggerBlur = (blur = true) => {
175
- if ((currentValue[unique] || currentValue[unique] === 0) && !multiple) {
176
- setValueIntoInput(currentValue[unique]);
177
- } else if (!multiple) {
178
- setValueIntoInput('');
179
- }
180
- !!blur && inputRef.current.blur();
181
- };
182
- const onClickInput = e => {
183
- if (disabled || readOnly || loadingState) return;
184
- if (!dropdownListRef.current) {
185
- if (!multiple || !Array.from(inputRef.current.querySelectorAll('.DGN-UI-Chip')).some(item => item.contains(e === null || e === void 0 ? void 0 : e.target))) {
186
- setOpenState(true);
187
- }
188
- }
189
- };
190
- const showDropdown = () => {
191
- const dropdown = children ? jsx("div", {
192
- css: _DropdownListCSS,
193
- ref: dropdownListRef,
194
- className: 'DGN-Dropdown-List',
195
- onKeyDown: moveOnItem,
196
- onScroll: onLoadMoreHandler,
197
- tabIndex: -1
198
- }, dataSourceState !== null && dataSourceState !== void 0 && dataSourceState.length ? children : EmptyDataText) : itemMode === 'normal' ? mapDropdown() : mapTreeView();
199
- return jsx(Fragment, null, (multiple || allowSearch) && itemMode === 'normal' && !children ? jsx("div", {
200
- className: 'DGN-Dropdown-Search'
201
- }, jsx(InputBase, {
202
- inputRef: searchRef,
203
- delayOnChange: searchDelayTime,
204
- viewType: 'outlined',
205
- defaultValue: txtSearch,
206
- onChange: onChangeInput,
207
- style: {
208
- marginBottom: 1
209
- },
210
- onKeyDown: pressESCHandler,
211
- readOnly: loadingState,
212
- autoFocus: true
213
- })) : null, multiple && maximumSelectionLength ? jsx(Typography, {
214
- css: css`
215
- padding: ${spacing([2, 4])};
216
- `
217
- }, getGlobal('selected'), " ", (valueMulti === null || valueMulti === void 0 ? void 0 : valueMulti.length) || 0, "/", maximumSelectionLength) : null, jsx("div", {
218
- className: 'DGN-Dropdown-Box'
219
- }, dropdown), loadingState ? jsx("div", {
220
- css: LoadingProgressCSS,
221
- className: 'DGN-Dropdown-Loading-Progress'
222
- }, jsx(CircularProgress, {
223
- size: 24
224
- })) : null);
225
- };
226
- const moveOnItem = e => {
227
- if (e.key === 'Tab') {
228
- closeDropdown(e, `key${e.key}`);
229
- triggerBlur();
230
- }
231
- if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
232
- let activeEl = document.activeElement;
233
- activeEl = e.key === 'ArrowDown' ? activeEl.nextElementSibling : activeEl.previousElementSibling;
234
- if (activeEl) {
235
- activeEl.focus();
236
- activeEl.scrollIntoView({
237
- block: 'center',
238
- behavior: 'smooth'
239
- });
240
- }
241
- }
242
- };
243
- const pressESCHandler = e => {
244
- if (e.key === 'Tab') {
245
- closeDropdown(e, `key${e.key}`);
246
- triggerBlur();
247
- } else if (e.key === 'ArrowDown' && dropdownListRef.current) {
248
- e.preventDefault();
249
- dropdownListRef.current.firstChild.focus();
250
- }
251
- };
252
- const closeDropdown = (event, reason, value) => {
253
- var _searchRef$current;
254
- if (dropdownRef.current) {
255
- setOpenState(false);
256
- }
257
- onClosed === null || onClosed === void 0 ? void 0 : onClosed({
258
- event,
259
- reason,
260
- recentSearch: (_searchRef$current = searchRef.current) === null || _searchRef$current === void 0 ? void 0 : _searchRef$current.value,
261
- value
262
- });
263
- };
264
-
265
- /**
266
- * So sánh text đầu vào cáo map với txtSearch
267
- * @param text
268
- * @return {boolean}
269
- */
270
- const handleRenderBySearch = (text = '') => {
271
- if (typeof text !== 'string') text = text.toString();
272
- if (!txtSearch) return true;
273
- if (searchMode === 'startswith') {
274
- return text.toLowerCase().startsWith(txtSearch.toLowerCase());
275
- } else if (searchMode === 'equals') {
276
- return text.toLowerCase() === txtSearch.toLowerCase();
277
- } else return text.toLowerCase().includes(txtSearch.toLowerCase());
278
- };
279
-
280
- /**
281
- * Chuyển đổi data thành giá trị cần hiện thị dựa vào displayExpr [string, string object {field} - {field}], renderSelectedItem, displayExpr, valueExpr
282
- * @param data {object} rowData of dataSource
283
- * @return {string}
284
- */
285
- const displayValue = data => {
286
- let text = '';
287
- if (data || data === 0) {
288
- displayExpr = displayExpr || valueExpr;
289
- let mask = data === null || data === void 0 ? void 0 : data[displayExpr];
290
- // convert {id} - {name} to {<data[id]>} - {<data[name]>}
291
- if (!mask && regexBetween.test(displayExpr)) {
292
- var _displayExpr;
293
- mask = (_displayExpr = displayExpr) === null || _displayExpr === void 0 ? void 0 : _displayExpr.replace(regexBetween, _ => (data === null || data === void 0 ? void 0 : data[_]) || '');
294
- } else if (!mask) {
295
- mask = typeof data !== 'object' ? data : '';
296
- }
297
- text = mask.toString().replace(regexInclude, '');
298
- }
299
- return text;
300
- };
301
- const mapDropdown = () => {
302
- var _dataSourceUsable2;
303
- const items = [];
304
- let dataSourceUsable = [...dataSourceState];
305
-
306
- // search dataSource dựa trên txtSearch
307
- if (!onInput || action !== null && action !== void 0 && action.loadData) {
308
- var _dataSourceUsable;
309
- dataSourceUsable = (_dataSourceUsable = dataSourceUsable) === null || _dataSourceUsable === void 0 ? void 0 : _dataSourceUsable.filter(i => {
310
- if (searchExpr) {
311
- // nếu map đc vs 1 trong những <key>(data[key]) của searchExpr
312
- return !!searchExpr.find(j => handleRenderBySearch(i[j]));
313
- } else {
314
- // nếu map đc vs displayValue
315
- return handleRenderBySearch(displayValue(i)) || handleRenderBySearch(i === null || i === void 0 ? void 0 : i[valueExpr]);
316
- }
317
- });
318
- }
319
- if (vlObjDefaultState && vlObjDefaultState !== null && vlObjDefaultState !== void 0 && vlObjDefaultState.length) {
320
- const length = vlObjDefaultState === null || vlObjDefaultState === void 0 ? void 0 : vlObjDefaultState.length;
321
- let existItemQuantity = 0;
322
- for (let index = length - 1; index >= 0; index--) {
323
- if ((vlObjDefaultState[index][valueExpr] || vlObjDefaultState[index][valueExpr] === 0) && !dataSourceUsable.some(data => data[valueExpr] === vlObjDefaultState[index][valueExpr])) {
324
- dataSourceUsable.unshift(vlObjDefaultState[index]);
325
- } else {
326
- // Nếu số lượng phần tử của valueObjectDefault tồn tại trong dataSource nhiều hơn hoặc bằng limit thì không remove nữa
327
- if (++existItemQuantity > limit) {
328
- continue;
329
- }
330
- }
331
- }
332
- }
333
- const length = (_dataSourceUsable2 = dataSourceUsable) === null || _dataSourceUsable2 === void 0 ? void 0 : _dataSourceUsable2.length;
334
- for (let index = 0; index < length; index++) {
335
- const data = dataSourceUsable[index];
336
- if (!data) continue;
337
- const itemHidden = typeof data === 'object' ? data['hidden'] : false;
338
- if (itemHidden) continue;
339
- let displayText = displayValue(data);
340
- if (subText) {
341
- displayText = jsx(Fragment, null, jsx(Typography, {
342
- className: 'DGN-UI-Dropdown-PrimaryText',
343
- type: 'p1'
344
- }, displayText), jsx(Typography, {
345
- className: 'DGN-UI-Dropdown-SubText',
346
- type: 'p3',
347
- color: 'text/sub'
348
- }, typeof subText === 'function' ? subText({
349
- data,
350
- index
351
- }) : data[subText] || subText));
352
- }
353
- const value = typeof data === 'object' ? data[valueExpr] : data;
354
- let itemDisabled = typeof data === 'object' ? data['disabled'] : false;
355
- const icon = getIconFromData(data);
356
- const text = renderItem && typeof renderItem === 'function' ? renderItem({
357
- data,
358
- index
359
- }) : jsx(Typography, {
360
- type: 'p1'
361
- }, displayText);
362
- if (multiple && selectBox) {
363
- const checked = Array.isArray(valueMulti) ? valueMulti.includes(value) : valueMulti.includes(value);
364
- const isMaximumSelection = maximumSelectionLength === (valueMulti === null || valueMulti === void 0 ? void 0 : valueMulti.length);
365
- itemDisabled = itemDisabled || isMaximumSelection && !checked;
366
- items.push(jsx("div", {
367
- key: index,
368
- css: !itemDisabled ? _DropdownItemCSS : [DisabledCSS, _DropdownItemCSS],
369
- className: 'DGN-UI-Dropdown-Item',
370
- onKeyDown: e => {
371
- if (itemDisabled) return;
372
- if (e.key === 'Enter') e.currentTarget.firstChild.click();
373
- },
374
- tabIndex: -1
375
- }, jsx(Checkbox, {
376
- css: _CheckBoxCSS,
377
- forTreeView: true,
378
- checked: checked,
379
- value: value,
380
- disabled: itemDisabled,
381
- onChange: e => onChangeValue(e, displayText, value, icon, data, index)
382
- }, icon, text)));
383
- } else {
384
- items.push(jsx("div", {
385
- key: index,
386
- css: !itemDisabled ? _DropdownItemCSS : [DisabledCSS, _DropdownItemCSS],
387
- className: 'DGN-UI-Dropdown-Item',
388
- onClick: e => {
389
- if (itemDisabled) return;
390
- onChangeValue(e, displayText, value, icon, data, index);
391
- },
392
- onKeyDown: e => {
393
- if (itemDisabled) return;
394
- if (e.key === 'Enter') onChangeValue(e, displayText, value, icon, data, index);
395
- },
396
- tabIndex: -1,
397
- style: dropdownItemStyle
398
- }, icon, text));
399
- }
400
- }
401
- return jsx("div", {
402
- css: _DropdownListCSS,
403
- ref: dropdownListRef,
404
- className: 'DGN-Dropdown-List',
405
- onKeyDown: moveOnItem,
406
- onScroll: onLoadMoreHandler,
407
- tabIndex: -1
408
- }, items !== null && items !== void 0 && items.length ? items : EmptyDataText);
409
- };
410
- const mapTreeView = () => {
411
- return jsx("div", {
412
- css: _DropdownListCSS,
413
- ref: dropdownListRef,
414
- className: 'DGN-Dropdown-List',
415
- onKeyDown: moveOnItem,
416
- onScroll: onLoadMoreHandler,
417
- tabIndex: -1
418
- }, dataSourceState !== null && dataSourceState !== void 0 && dataSourceState.length ? jsx(TreeView, {
419
- dataSource: dataSourceState,
420
- displayExpr: displayExpr,
421
- valueExpr: valueExpr,
422
- multiple: multiple,
423
- selectBox: selectBox,
424
- allowSearch: allowSearch,
425
- searchProps: {
426
- autoFocus: true,
427
- inputRef: searchRef
428
- },
429
- searchDelayTime: searchDelayTime,
430
- id: treeViewID,
431
- parentID: treeViewParentID,
432
- value: typeof currentValue[unique] === 'string' ? [currentValue[unique]] : currentValue[unique],
433
- onChange: (e, value) => onChangeValue(e, '', multiple ? value : e.value),
434
- renderItem: renderItem
435
- }) : EmptyDataText);
436
- };
437
-
438
- // remove item cũ và append child item mới khi load more
439
- const loadMoreItemsDropdown = (i = 0, pattern) => {
440
- var _displayExpr2;
441
- const dataSourceUsable = [...dataSourceState];
442
- // Nếu có load more thì đẩy đội tượng mặc định lên đầu
443
- let notExistItem = 0;
444
- if (onLoadMore && vlObjDefaultState !== null && vlObjDefaultState !== void 0 && vlObjDefaultState.length) {
445
- const length = vlObjDefaultState.length;
446
- for (let index = length - 1; index >= 0; index--) {
447
- if (!dataSourceUsable.some(data => data[valueExpr] === vlObjDefaultState[index][valueExpr])) {
448
- notExistItem++;
449
- dataSourceUsable.unshift(vlObjDefaultState[index]);
450
- }
451
- }
452
- }
453
- const length = dataSourceUsable === null || dataSourceUsable === void 0 ? void 0 : dataSourceUsable.length;
454
- let num = 0;
455
- if (displayExpr && Array.isArray(displayExpr)) {
456
- displayExpr = displayExpr.join(' - ');
457
- }
458
- const keyArr = (_displayExpr2 = displayExpr) === null || _displayExpr2 === void 0 ? void 0 : _displayExpr2.match(separatorPattern);
459
- for (i; i < length; i++) {
460
- const data = {
461
- ...dataSourceUsable[i]
462
- };
463
- // Nếu đối tượng đã được hiển thị ở trên rồi thì không hiển thị ra nữa
464
- if (onLoadMore && i > notExistItem && vlObjDefaultState.some(valueObject => valueObject[valueExpr] === data[valueExpr])) continue;
465
- let displayText = typeof data === 'object' ? keyArr ? displayValue(data) : data[displayExpr] || data[valueExpr] : data;
466
- if (pattern && !new RegExp(pattern).test(displayText.normalize())) continue;
467
- const value = typeof data === 'object' ? data[valueExpr] : data;
468
- const icon = getIconFromData(data);
469
- const text = jsx(Typography, {
470
- type: 'p1'
471
- }, displayText);
472
- if (renderItem && typeof renderItem === 'function') {
473
- displayText = renderItem({
474
- data,
475
- index: i
476
- });
477
- } else if (subText) {
478
- displayText = jsx(Fragment, null, jsx(Typography, {
479
- className: 'DGN-UI-Dropdown-PrimaryText',
480
- type: 'p1'
481
- }, displayText), jsx(Typography, {
482
- className: 'DGN-UI-Dropdown-SubText',
483
- type: 'p3',
484
- color: 'text/sub'
485
- }, typeof subText === 'function' ? subText({
486
- data,
487
- index: i
488
- }) : data[subText] || subText));
489
- }
490
- const dropdownItem = document.createElement('div');
491
- dropdownItem.className = `DGN-UI-Dropdown-Item css-${_DropdownItemCSS.name}`;
492
- dropdownItem.tabIndex = -1;
493
- dropdownItem.addEventListener('click', e => onChangeValue(e, displayText, value, icon, data, i));
494
- dropdownItem.addEventListener('keypress', e => {
495
- if (e.key === 'Enter') dropdownItem.firstChild.click();
496
- });
497
- let item = null;
498
- if (multiple && selectBox) {
499
- const checked = Array.isArray(currentValue[unique]) ? currentValue[unique].includes(value) : [currentValue[unique]].includes(value);
500
- item = jsx(Checkbox, {
501
- css: _CheckBoxCSS,
502
- forTreeView: true,
503
- checked: checked
504
- }, icon, text);
505
- } else {
506
- item = jsx(Fragment, null, icon, text);
507
- }
508
- if (!dropdownListRef.current) {
509
- return;
510
- }
511
- ReactDOM.render(item, dropdownListRef.current.appendChild(dropdownItem));
512
- if (++num === 100) {
513
- timerRef.current = setTimeout(() => {
514
- loadMoreItemsDropdown(i + 1, pattern);
515
- }, 1000);
516
- break;
517
- }
518
- }
519
- };
520
- const getIconFromData = (data, insideChip = false) => {
521
- if (!data || !iconExpr || iconExpr === 'none') return null;
522
- let _src;
523
- if (typeof iconExpr === 'string') _src = data[iconExpr];else {
524
- let prefix = iconExpr.prefix || '';
525
- const suffix = iconExpr.suffix || '';
526
- const url = data[iconExpr.key];
527
- if (prefix && /^http/i.test(prefix) && /^http/i.test(url)) {
528
- prefix = '';
529
- }
530
- _src = prefix + url + suffix;
531
- }
532
- return jsx(Avatar, {
533
- css: css`
534
- margin-right: ${spacing([insideChip ? 0 : 2])};
535
- `,
536
- disabled: true,
537
- src: _src,
538
- width: insideChip ? 20 : 24,
539
- height: insideChip ? 20 : 24,
540
- style: {
541
- ...iconExpr.style
542
- }
543
- });
544
- };
545
- const customizeWidthDropdown = () => {
546
- if (timer.current) {
547
- clearTimeout(timer.current);
548
- }
549
- timer.current = setTimeout(() => {
550
- if (ref.current) {
551
- const {
552
- width
553
- } = ref.current.getBoundingClientRect();
554
- setPopoverWidth(width);
555
- }
556
- }, 300);
557
- };
558
- const handleActionLoadData = isReset => {
559
- const {
560
- skip,
561
- limit,
562
- strSearch: search
563
- } = filter.current;
564
- const params = onLoadMore ? {
565
- skip,
566
- limit,
567
- search
568
- } : {
569
- search
570
- };
571
- const callbackSave = (error, data) => {
572
- setLoadingState(false);
573
- if (error) {
574
- let _data = {};
575
- if (error.originalError) {
576
- const {
577
- message,
578
- originalError,
579
- customMessage,
580
- code: codeError
581
- } = error;
582
- const _customMessage = customMessage && typeof customMessage === 'object' ? customMessage[codeError] : customMessage;
583
- let messageError = '';
584
- Object.keys(originalError).forEach(key => {
585
- messageError += `${key}: ${JSON.stringify(originalError[key], null, 8)}\n`;
586
- });
587
- _data = {
588
- title: getGlobal('error') + (codeError ? `: ${codeError}` : ''),
589
- subtitle: _customMessage || message || getGlobal('unknownError'),
590
- description: messageError
591
- };
592
- } else {
593
- var _data$data;
594
- const message = (data === null || data === void 0 ? void 0 : data.message) || (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.Message) || data;
595
- _data = {
596
- description: message || getGlobal('unknownError')
597
- };
598
- }
599
- setPopupDataState(_data);
600
- popupRef.current.instance.show();
601
- return false;
602
- } else if (data) {
603
- let rows = [];
604
- if (Array.isArray(data)) {
605
- rows = data;
606
- } else {
607
- rows = data && data.rows ? data.rows : dataSourceState;
608
- const total = data && data.total ? data.total : data === null || data === void 0 ? void 0 : data.length;
609
- setTotalState(total);
610
- }
611
- setDataSourceState(isReset ? rows : dataSourceState.concat(rows));
612
- }
613
- };
614
- setLoadingState(true);
615
- action.loadData(params, callbackSave);
616
- };
617
- const onLoadMoreHandler = e => {
618
- e.persist();
619
- if (loadMoreTimer.current) {
620
- clearTimeout(loadMoreTimer.current);
621
- }
622
- loadMoreTimer.current = setTimeout(() => {
623
- if (onLoadMore && (dataSourceState === null || dataSourceState === void 0 ? void 0 : dataSourceState.length) < totalState && !loadingState) {
624
- const {
625
- scrollTop,
626
- scrollHeight,
627
- offsetHeight
628
- } = e.target;
629
- if (scrollHeight === Math.ceil(scrollTop) + offsetHeight && dropdownListRef.current) {
630
- var _dropdownListRef$curr;
631
- const length = ((_dropdownListRef$curr = dropdownListRef.current.children) === null || _dropdownListRef$curr === void 0 ? void 0 : _dropdownListRef$curr.length) - ((vlObjDefaultState === null || vlObjDefaultState === void 0 ? void 0 : vlObjDefaultState.length) || 0);
632
- // dropdownListRef.current.removeEventListener('scroll', onLoadMoreHandler);
633
- if (!!onLoadMore && typeof onLoadMore === 'boolean' && action !== null && action !== void 0 && action.loadData) {
634
- filter.current.skip = length;
635
- filter.current.limit = limit;
636
- handleActionLoadData();
637
- } else !!onLoadMore && onLoadMore({
638
- skip: length,
639
- limit: limit
640
- });
641
- }
642
- }
643
- }, 300);
644
- };
645
- const onPreventKeyDownHandler = e => {
646
- e.preventDefault();
647
- return false;
648
- };
649
- const onChangeInput = e => {
650
- var _e$target$value;
651
- if (!dropdownRef.current) return; // Kiểm tra nếu dropdown đóng trước searchDelayTime thì không chạy
652
- setTxtSearch((_e$target$value = e.target.value) !== null && _e$target$value !== void 0 ? _e$target$value : '');
653
- if (onInput) {
654
- onInput(e);
655
- }
656
- if (action !== null && action !== void 0 && action.loadData && !!onLoadMore) {
657
- filter.current.strSearch = e.target.value;
658
- handleActionLoadData(true);
659
- }
660
- };
661
- const onChangeValue = (e, displayText, value, icon, data) => {
662
- if (itemMode === 'treeview') {
663
- if (valueProp === undefined) {
664
- setValueMulti(value);
665
- setValueIntoInput(value);
666
- setShowClear(clearAble && checkHasValue(value) && !disabled && !readOnly && !loadingState);
667
- }
668
- !!onChange && onChange({
669
- value
670
- });
671
- } else if (multiple) {
672
- if (!Array.isArray(currentValue[unique])) currentValue[unique] = [];
673
- // const newValueArr = [...currentValue[unique]];
674
- const newValueArrState = [...valueMulti];
675
- if (!newValueArrState.some(v => JSON.stringify(v) === JSON.stringify(value))) {
676
- // newValueArr.push(value);
677
- newValueArrState.push(value);
678
- } else {
679
- const index = newValueArrState.indexOf(value);
680
- newValueArrState.splice(index, 1);
681
- }
682
- setValueMulti(newValueArrState);
683
- !!onChange && onChange({
684
- value: newValueArrState,
685
- data
686
- });
687
- } else {
688
- const isChanged = currentValue[unique] !== value;
689
- if (isChanged) {
690
- if (valueProp === undefined) {
691
- allValue[unique].push(value);
692
- setValueIntoInput(value);
693
- setShowClear(clearAble && checkHasValue(value) && !disabled && !readOnly && !loading);
694
- }
695
- !!onChange && onChange({
696
- value,
697
- data
698
- });
699
- } else {
700
- // Fix lost icon when select same value
701
- triggerBlur(false);
702
- }
703
- }
704
- if (closeAfterSelect === true || closeAfterSelect === undefined && !multiple) {
705
- closeDropdown(e, 'changeValue', value);
706
- }
707
- };
708
- const onRemove = (e, value) => {
709
- var _ref;
710
- if (readOnly || disabled) return;
711
- const index = currentValue[unique].findIndex(v => JSON.stringify(v) === JSON.stringify(value));
712
- if (index !== -1) {
713
- currentValue[unique].splice(index, 1);
714
- }
715
-
716
- // logic mới
717
- const newValueArrState = ((_ref = [...valueMulti]) === null || _ref === void 0 ? void 0 : _ref.filter(i => i !== value)) || [];
718
- setValueMulti(newValueArrState);
719
- !!onChange && onChange({
720
- value: newValueArrState,
721
- removed: value
722
- });
723
- };
724
- const onClear = e => {
725
- if (disabled || readOnly || loadingState || !clearAble) return;
726
- currentValue[unique] = multiple ? [] : '';
727
- if (multiple) {
728
- setValueMulti([]);
729
- } else {
730
- setValueSingle('');
731
- }
732
- setValueMulti([]);
733
- setShowClear(false);
734
- e && e.target && e.target.blur();
735
- onInput === null || onInput === void 0 ? void 0 : onInput({
736
- ...(inputRef === null || inputRef === void 0 ? void 0 : inputRef.current),
737
- target: {
738
- value: ''
739
- }
740
- });
741
- !!onChange && onChange({
742
- value: currentValue[unique]
743
- });
744
- };
745
- const setPreviousValue = () => {
746
- var _allValue$unique;
747
- allValue[unique].pop();
748
- setValueIntoInput(allValue[unique][((_allValue$unique = allValue[unique]) === null || _allValue$unique === void 0 ? void 0 : _allValue$unique.length) - 1]);
749
- };
750
- const setValueIntoInput = source => {
751
- if (!source && source !== 0) {
752
- if (multiple) {
753
- currentValue[unique] = [];
754
- } else {
755
- currentValue[unique] = '';
756
- setValueSingle('');
757
- }
758
- return;
759
- }
760
- const length = dataSourceState === null || dataSourceState === void 0 ? void 0 : dataSourceState.length;
761
- const displayKey = typeof renderSelectedItem === 'string' ? renderSelectedItem : displayExpr;
762
- if (displayKey && Array.isArray(displayKey)) {
763
- displayExpr = displayExpr.join(' - ');
764
- }
765
- const keyArr = displayKey === null || displayKey === void 0 ? void 0 : displayKey.match(separatorPattern);
766
- if (multiple) {
767
- let valueArr = source;
768
- if (!Array.isArray(valueArr)) {
769
- valueArr = [valueArr];
770
- }
771
- valueArr = [...new Set(valueArr)];
772
- currentValue[unique] = [];
773
- valueArr.forEach(v => {
774
- for (let i = 0; i < length; i++) {
775
- if (!dataSourceState[i]) continue;
776
- if (typeof dataSourceState[i] === 'object' && dataSourceState[i][valueExpr] === v || dataSourceState[i] === v) {
777
- setMultipleValueHandler(dataSourceState[i], v, keyArr, i);
778
- return;
779
- }
780
- }
781
- if (vlObjDefaultState !== null && vlObjDefaultState !== void 0 && vlObjDefaultState.length) {
782
- const itemOfValue = vlObjDefaultState.find(valueObject => valueObject[valueExpr] === v || valueObject === v);
783
- if (itemOfValue) {
784
- setMultipleValueHandler(itemOfValue, v, keyArr);
785
- }
786
- }
787
- });
788
- } else {
789
- currentValue[unique] = source;
790
- for (let i = 0; i < length; i++) {
791
- if (!dataSourceState[i]) continue;
792
- if (dataSourceState[i][valueExpr] === source || dataSourceState[i] === source) {
793
- setSingleValueHandler(dataSourceState[i], keyArr);
794
- return;
795
- }
796
- }
797
- if (vlObjDefaultState !== null && vlObjDefaultState !== void 0 && vlObjDefaultState.length) {
798
- const itemOfValue = vlObjDefaultState.find(valueObject => valueObject[valueExpr] === source || valueObject === source);
799
- if (itemOfValue) {
800
- setSingleValueHandler(itemOfValue, keyArr);
801
- return;
802
- }
803
- }
804
- }
805
- };
806
- const setMultipleValueHandler = (data, value) => {
807
- currentValue[unique].push(value);
808
- };
809
- const setSingleValueHandler = (data, keyArr) => {
810
- const text = keyArr ? displayValue(data) : typeof renderSelectedItem === 'string' ? data[renderSelectedItem] : data[displayExpr] || data[valueExpr] || data;
811
- const renderContent = content => jsx(Typography, {
812
- type: 'p1',
813
- lineClamp: multilineSelectedItem ? undefined : 1,
814
- hoverTooltip: !_isMobile
815
- }, content);
816
- if (typeof renderSelectedItem === 'function') {
817
- const item = renderSelectedItem({
818
- data
819
- });
820
- const el = jsx("div", {
821
- css: [displayFlex, parseWidth('100%'), parseMinHeight(24), !multilineSelectedItem && parseMaxHeight(24)]
822
- }, item);
823
- setValueSingle(el);
824
- } else if (iconExpr && iconExpr !== 'none') {
825
- const icon = getIconFromData(data);
826
- const valueWithIcon = jsx(Fragment, null, icon ? icon : null, renderContent(text));
827
- const el = jsx("div", {
828
- css: [displayFlex, itemsCenter, parseMinHeight(24)]
829
- }, valueWithIcon);
830
- setValueSingle(el);
831
- } else {
832
- setValueSingle(text);
833
- }
834
- };
835
- useImperativeHandle(reference, () => {
836
- const currentRef = ref.current || {};
837
- const _instance = {
838
- ...action,
839
- closeDropdown: () => {
840
- closeDropdown(null, 'ref');
841
- },
842
- showDropdown: () => {
843
- setOpenState(true);
844
- },
845
- onClear,
846
- setPreviousValue,
847
- setValue: value => {
848
- var _allValue$unique2;
849
- if (allValue[unique][((_allValue$unique2 = allValue[unique]) === null || _allValue$unique2 === void 0 ? void 0 : _allValue$unique2.length) - 1] !== value) {
850
- allValue[unique].push(value);
851
- }
852
- setValueIntoInput(value);
853
- }
854
- }; // methods
855
- _instance.__proto__ = {}; // hidden methods
856
- currentRef.instance = _instance;
857
- // keep old method
858
- currentRef.closeDropdown = () => closeDropdown(null, 'ref');
859
- currentRef.showDropdown = () => setOpenState(true);
860
- currentRef.onClear = onClear;
861
- currentRef.setPreviousValue = setPreviousValue;
862
- currentRef.setValue = value => {
863
- var _allValue$unique3;
864
- if (allValue[unique][((_allValue$unique3 = allValue[unique]) === null || _allValue$unique3 === void 0 ? void 0 : _allValue$unique3.length) - 1] !== value) {
865
- allValue[unique].push(value);
866
- }
867
- setValueIntoInput(value);
868
- };
869
- currentRef.DOM = ref.current;
870
- return currentRef;
871
- });
872
- useLayoutEffect(() => {
873
- window.addEventListener('resize', customizeWidthDropdown);
874
- return () => {
875
- window.removeEventListener('resize', customizeWidthDropdown);
876
- };
877
- }, []);
878
- useEffect(() => {
879
- setLoadingState(loading);
880
- }, [loading]);
881
- useEffect(() => {
882
- setTotalState(total);
883
- }, [total]);
884
- useEffect(() => {
885
- setDataSourceState(dataSource || []);
886
- }, [dataSource]);
887
- useEffect(() => {
888
- setShowClear(clearAble && checkHasValue(valueProp !== null && valueProp !== void 0 ? valueProp : defaultValue) && !disabled && !readOnly && !loadingState);
889
- }, [clearAble, valueProp, defaultValue, disabled, readOnly, loadingState]);
890
- useEffect(() => {
891
- if (multiple) {
892
- if (valueMulti !== null && valueMulti !== void 0 && valueMulti.length) {
893
- const dataFilter = getData();
894
- dataChosen.current = [...dataFilter].filter(i => [...valueMulti].includes(i === null || i === void 0 ? void 0 : i[valueExpr]));
895
- } else dataChosen.current = [];
896
- }
897
- if (valueObjectDefault) {
898
- if (Array.isArray(valueObjectDefault)) {
899
- setVlObjDefaultState([...dataChosen.current, ...valueObjectDefault]);
900
- } else if (typeof valueObjectDefault === 'object') {
901
- var _Object$keys;
902
- setVlObjDefaultState(((_Object$keys = Object.keys(valueObjectDefault)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) !== 0 ? [...dataChosen.current, valueObjectDefault] : [...dataChosen.current]);
903
- }
904
- } else {
905
- setVlObjDefaultState([...dataChosen.current]);
906
- }
907
- }, [valueObjectDefault, valueMulti]);
908
- useEffect(() => {
909
- allValue[unique] = [];
910
- if (action !== null && action !== void 0 && action.loadData) handleActionLoadData(true);else if (defaultValue !== undefined && JSON.stringify(defaultValue) !== '[]') {
911
- setValueIntoInput(defaultValue);
912
- setShowClear(clearAble && checkHasValue(defaultValue) && !disabled && !readOnly && !loadingState);
913
- }
914
- return () => {
915
- allValue[unique] = null;
916
- closeDropdown(null, 'cleanup');
917
- };
918
- }, []);
919
- useEffect(() => {
920
- var _allValue$unique4;
921
- if (allValue[unique][((_allValue$unique4 = allValue[unique]) === null || _allValue$unique4 === void 0 ? void 0 : _allValue$unique4.length) - 1] !== valueProp) {
922
- allValue[unique].push(valueProp);
923
- }
924
- if (multiple && valueProp) {
925
- setValueMulti(convertData(valueProp, valueExpr));
926
- }
927
- // Close dropdown treeview by children when select item
928
- if (children && (closeAfterSelect === true || closeAfterSelect === undefined && !multiple)) {
929
- closeDropdown(null, 'treeView');
930
- }
931
- }, [valueProp]);
932
- useEffect(() => {
933
- if (valueProp !== undefined && (!dropdownListRef.current || children || JSON.stringify(valueProp) !== JSON.stringify(currentValue[unique]))) {
934
- setValueIntoInput(valueProp);
935
- }
936
- }, [valueProp, dataSourceState, vlObjDefaultState]);
937
- useEffect(() => {
938
- inputRef.current.readOnly = readOnly || inputProps.readOnly;
939
- if (disabled || readOnly || children) {
940
- inputRef.current.addEventListener('keydown', onPreventKeyDownHandler);
941
- } else {
942
- inputRef.current.addEventListener('keydown', onKeyDown);
943
- }
944
- return () => {
945
- if (!ref.current || !inputRef.current || !iconRef.current) return;
946
- if (disabled || readOnly || children) {
947
- inputRef.current.removeEventListener('keydown', onPreventKeyDownHandler);
948
- } else {
949
- inputRef.current.removeEventListener('keydown', onKeyDown);
950
- }
951
- closeDropdown(null, 'cleanup');
952
- };
953
- }, [disabled, readOnly, displayExpr, multiple, allowSearch, viewType, closeAfterSelect, selectBox]);
954
- useEffect(() => {
955
- if (!disabled && !readOnly) {
956
- inputRef.current.addEventListener('click', onClickInput);
957
- inputRef.current.addEventListener('input', onChangeInput);
958
- }
959
- return () => {
960
- if (!disabled && !readOnly && inputRef.current) {
961
- inputRef.current.removeEventListener('click', onClickInput);
962
- inputRef.current.removeEventListener('input', onChangeInput);
963
- }
964
- };
965
- }, [onChange, children]);
966
- useEffect(() => {
967
- if (!disabled && !readOnly) {
968
- inputRef.current.addEventListener('click', onClickInput);
969
- }
970
- if (dropdownListRef.current) {
971
- var _dropdownListRef$curr2, _dropdownListRef$curr3;
972
- if (!disabled && !readOnly) {
973
- inputRef.current.addEventListener('input', onChangeInput);
974
- }
975
- const length = (_dropdownListRef$curr2 = dropdownListRef.current) === null || _dropdownListRef$curr2 === void 0 ? void 0 : (_dropdownListRef$curr3 = _dropdownListRef$curr2.children) === null || _dropdownListRef$curr3 === void 0 ? void 0 : _dropdownListRef$curr3.length;
976
- if (length < (dataSourceState === null || dataSourceState === void 0 ? void 0 : dataSourceState.length) + (vlObjDefaultState === null || vlObjDefaultState === void 0 ? void 0 : vlObjDefaultState.length) && !isSearch[unique]) {
977
- loadMoreItemsDropdown(length);
978
- } else {
979
- isSearch[unique] = false;
980
- }
981
- } else {
982
- if (!multiple && !disabled && !readOnly) {
983
- inputRef.current.addEventListener('input', onChangeInput);
984
- }
985
- }
986
- // Fix set defaultValue before action loadData
987
- if (action !== null && action !== void 0 && action.loadData && (!valueSingle || (valueMulti === null || valueMulti === void 0 ? void 0 : valueMulti.length) === 0) && defaultValue !== undefined && JSON.stringify(defaultValue) !== '[]') {
988
- setValueIntoInput(defaultValue);
989
- setShowClear(clearAble && checkHasValue(defaultValue) && !disabled && !readOnly && !loadingState);
990
- }
991
- return () => {
992
- if (inputRef.current) {
993
- inputRef.current.removeEventListener('input', onChangeInput);
994
- inputRef.current.removeEventListener('click', onClickInput);
995
- }
996
- };
997
- }, [dataSourceState]);
998
- useEffect(() => {
999
- if (!openState && txtSearch) {
1000
- setTxtSearch('');
1001
- if (action !== null && action !== void 0 && action.loadData && !!onLoadMore) {
1002
- filter.current.strSearch = '';
1003
- handleActionLoadData(true);
1004
- }
1005
- }
1006
- }, [openState]);
1007
- useLayoutEffect(() => {
1008
- if (ref.current) {
1009
- const {
1010
- width
1011
- } = ref.current.getBoundingClientRect();
1012
- setPopoverWidth(width);
1013
- }
1014
- });
1015
- /* End handler */
1016
-
1017
- /* Start component */
1018
- const EmptyDataText = jsx("div", {
1019
- css: _DropdownItemCSS,
1020
- className: 'no-data'
1021
- }, noDataText);
1022
- const LabelView = useMemo(() => label ? jsx(Label, {
1023
- required: required,
1024
- disabled: disabled,
1025
- ...labelProps
1026
- }, label) : null, [label, required, disabled, labelProps]);
1027
- const getData = () => {
1028
- let dataFilter = JSON.parse(JSON.stringify(dataSourceState));
1029
- dataFilter = uniqBy([...vlObjDefaultState, ...dataFilter], data => data === null || data === void 0 ? void 0 : data[valueExpr]);
1030
- return dataFilter;
1031
- };
1032
- const InputView = jsx("div", {
1033
- css: _DropdownFormCSS,
1034
- ref: formRef,
1035
- className: classNames('DGN-UI-Dropdown-Form', openState && 'dropdown-showing')
1036
- }, jsx("div", {
1037
- css: _InputCSS,
1038
- className: 'DGN-UI-Dropdown-Form-Input'
1039
- }, multiple && valueMulti !== null && valueMulti !== void 0 && valueMulti.length ? jsx("div", {
1040
- ...inputProps,
1041
- style: inputStyle,
1042
- ref: inputRef,
1043
- css: [_DropdownInputCSS],
1044
- className: classNames('dgn-dropdown-multiple', inputProps.className),
1045
- onChange: e => {
1046
- e.preventDefault();
1047
- return false;
1048
- }
1049
- }, valueMulti.map((vl, index) => {
1050
- const dataFilter = getData();
1051
- const data = dataFilter.find(v => v[valueExpr] === vl || v === vl);
1052
- if (data) {
1053
- const displayText = displayValue(data);
1054
- let item;
1055
- if (typeof renderSelectedItem === 'function') {
1056
- item = renderSelectedItem({
1057
- data,
1058
- index
1059
- });
1060
- } else {
1061
- item = jsx(Chip, {
1062
- css: [parseWidth('100%'), parseMaxWidth('max-content')],
1063
- key: index,
1064
- startIcon: getIconFromData(data, true),
1065
- label: displayText,
1066
- size: 'medium',
1067
- disabled: disabled,
1068
- clearAble: !readOnly && !disabled,
1069
- onRemove: e => onRemove(e, vl)
1070
- });
1071
- }
1072
- return item;
1073
- }
1074
- })) : typeof renderSelectedItem === 'function' || iconExpr && iconExpr !== 'none' ? jsx("div", {
1075
- ...inputProps,
1076
- style: inputStyle,
1077
- ref: inputRef,
1078
- css: _DropdownInputCSS,
1079
- className: classNames('dgn-dropdown-multiple', inputProps.className),
1080
- onKeyDown: e => {
1081
- if (e.key === 'Enter') {
1082
- e.preventDefault();
1083
- return false;
1084
- }
1085
- }
1086
- }, valueSingle) : jsx("div", {
1087
- css: _DropdownInputCSS,
1088
- onClick: onClickInput
1089
- }, jsx(Typography, {
1090
- ...inputProps,
1091
- ref: inputRef,
1092
- hoverTooltip: true,
1093
- lineClamp: multilineSelectedItem ? undefined : 1,
1094
- type: 'p1',
1095
- style: {
1096
- lineHeight: multiple ? '30px' : '24px',
1097
- ...inputStyle
1098
- },
1099
- tabIndex: -1
1100
- }, valueSingle))), jsx("div", {
1101
- ref: iconRef,
1102
- css: _IconCSS,
1103
- className: 'DGN-UI-Dropdown-Icon'
1104
- }, loadingState ? jsx(CircularProgress, {
1105
- size: 24
1106
- }) : null, showClear ? jsx(ButtonIcon, {
1107
- css: css`
1108
- margin-right: ${spacing([1])};
1109
- `,
1110
- viewType: 'ghost',
1111
- name: 'Close',
1112
- onClick: onClear
1113
- }) : null, !loadingState ? jsx(ButtonIcon, {
1114
- key: openState,
1115
- css: animation,
1116
- viewType: 'ghost',
1117
- name: openState ? 'ArrowUp' : 'ArrowDown',
1118
- onClick: setShowDropdown,
1119
- disabled: disabled || readOnly
1120
- }) : null));
1121
- const ErrorView = useMemo(() => {
1122
- return error ? jsx(HelperText, {
1123
- ...helperTextProps,
1124
- disabled: disabled
1125
- }, error) : null;
1126
- }, [disabled, error, helperTextProps]);
1127
- const DropdownView = jsx(Popover, {
1128
- css: PopoverCSS(theme),
1129
- ref: dropdownRef,
1130
- open: openState,
1131
- anchor: ref.current,
1132
- width: popoverWidth,
1133
- onClose: closeDropdown
1134
- }, showDropdown());
1135
-
1136
- /* End component */
1137
-
1138
- return jsx(Fragment, null, jsx("div", {
1139
- ref: ref,
1140
- css: _DropdownRootCSS,
1141
- style: style,
1142
- className: classNames('DGN-UI-Dropdown', className, error && 'error', loadingState && 'dgn-dropdown-loading', disabled ? 'disabled' : readOnly && 'readOnly')
1143
- }, LabelView, InputView, ErrorView), DropdownView, jsx(Popup, {
1144
- ref: popupRef,
1145
- type: 'danger',
1146
- ...popupDataState
1147
- }));
1148
- }));
1149
-
1150
- /* Start styled */
1151
- const InputCSS = (multiple, renderSelectedItem) => css`
1152
- ${displayFlex};
1153
- ${positionRelative};
1154
- ${parseWidth(!multiple && renderSelectedItem ? 'calc(100% - 34px)' : '100%')};
1155
- `;
1156
- const PopoverCSS = ({
1157
- spacing
1158
- }) => css`
1159
- margin-top: ${spacing([1])};
1160
- ${overflowHidden};
1161
- `;
1162
- const DropdownInputCSS = (viewType, multiple, placeholder, disabled, readOnly, multilineSelectedItem, {
1163
- colors,
1164
- spacing,
1165
- typography
1166
- }) => css`
1167
- ${displayFlex};
1168
- ${itemsCenter};
1169
- ${outlineNone};
1170
- ${bgColor('transparent')};
1171
- ${borderNone};
1172
- ${typography.paragraph1};
1173
- ${disabled ? cursorNotAllowed : readOnly ? cursorDefault : cursorPointer};
1174
- ${parseWidth('100%')};
1175
- ${textColor(getProp(colors, 'text/main'))};
1176
- padding-top: ${spacing([0])};
1177
- padding-bottom: ${spacing([viewType !== 'outlined' ? 0 : 'inherit'])};
1178
- padding-left: ${spacing([viewType !== 'outlined' ? 0 : 4])};
1179
- gap: ${spacing([0.5])};
1180
- ${parseMinHeight(multiple ? 30 : 24)};
1181
- &.dgn-dropdown-multiple {
1182
- ${displayFlex};
1183
- ${flexWrap};
1184
- ${overflowHidden};
1185
- ${breakWord};
1186
- ${!multiple && css`
1187
- ${parseMinHeight(24)};
1188
- ${parseMaxWidth('100%')};
1189
- ${!multilineSelectedItem && parseMaxHeight(24)};
1190
- `};
1191
- &::after {
1192
- ${displayFlex};
1193
- ${flexRow};
1194
- ${positionAbsolute};
1195
- ${itemsCenter};
1196
- ${justifyCenter};
1197
- content: '${placeholder}';
1198
- ${textColor(getProp(colors, 'text/sub'))};
1199
- }
1200
- &:not(:empty)::after {
1201
- ${invisible};
1202
- }
1203
- }
1204
- &:focus {
1205
- ${bgColor('transparent')};
1206
- }
1207
- .dropdown-item {
1208
- &:not(:last-child) {
1209
- margin-right: ${spacing([1.25])};
1210
- }
1211
- svg {
1212
- ${boxBorder};
1213
- padding: ${spacing([0.5])};
1214
- }
1215
- }
1216
- .DGN-UI-Typography {
1217
- ${disabled && textColor(getProp(colors, 'system/disabled'))};
1218
- }
1219
- `;
1220
- const IconCSS = (viewType, {
1221
- spacing
1222
- }) => css`
1223
- ${displayFlex};
1224
- ${itemsCenter};
1225
- margin-left: ${spacing([2])};
1226
- margin-right: ${spacing([viewType !== 'outlined' ? 0 : 4])};
1227
- `;
1228
- const DropdownFormOutlinedCSS = (disabled, readOnly, placeholder, {
1229
- colors,
1230
- spacing
1231
- }) => css`
1232
- ${displayFlex};
1233
- ${flexRow};
1234
- ${itemsCenter};
1235
- ${positionRelative};
1236
- ${borderRadius(4)};
1237
- ${boxBorder};
1238
- ${border(1, disabled ? getProp(colors, 'system/disabled') : getProp(colors, 'system/rest'))};
1239
- ${parseWidth('100%')};
1240
- ${parseMinHeight(40)};
1241
- margin-top: ${spacing([0.5])};
1242
- ${!disabled && !readOnly && css`
1243
- &:not(:focus-within):hover {
1244
- ${bgColor(getProp(colors, 'fill/hover'))};
1245
- ${borderColor(getProp(colors, 'system/active'))};
1246
- input {
1247
- ${bgColor(getProp(colors, 'fill/hover'))};
1248
- }
1249
- }
1250
- `}
1251
- &:focus-within {
1252
- ${borderColor(getProp(colors, 'line/focus'))};
1253
- }
1254
- span:empty:before {
1255
- content: '${placeholder}';
1256
- ${parseHeight('100%')};
1257
- ${overflowHidden};
1258
- ${textColor(getProp(colors, 'text/sub'))};
1259
- display: -webkit-box;
1260
- -webkit-line-clamp: 1;
1261
- -webkit-box-orient: vertical;
1262
- }
1263
- &::placeholder {
1264
- ${textColor(getProp(colors, 'text/sub'))};
1265
- }
1266
- &::after {
1267
- ${positionAbsolute};
1268
- ${pointerEventsNone};
1269
- ${borderRadius(4)};
1270
- ${border(2, 'transparent')};
1271
- ${inset(-2)};
1272
- content: '';
1273
- }
1274
- `;
1275
- const DropdownFormCSS = (viewType, multiple, disabled, readOnly, placeholder, DropdownInputCSSName, {
1276
- colors,
1277
- spacing
1278
- }) => css`
1279
- ${displayFlex};
1280
- ${flexRow};
1281
- ${itemsCenter};
1282
- ${positionRelative};
1283
- ${boxBorder};
1284
- ${parseWidth('100%')};
1285
- padding-top: ${spacing([multiple ? 0.25 : 1])};
1286
- padding-bottom: ${spacing([multiple ? 0.25 : 1])};
1287
- ${!disabled && !readOnly && css`
1288
- &:not(:focus-within):hover {
1289
- &::before {
1290
- ${borderBottomColor(getProp(colors, 'system/active'))};
1291
- }
1292
- .css-${DropdownInputCSSName} {
1293
- ${textColor(getProp(colors, 'system/active'))};
1294
- }
1295
- }
1296
- `}
1297
- &:focus-within {
1298
- ${borderBottomColor(getProp(colors, 'line/focus'))};
1299
- &::after {
1300
- ${borderBottomColor('inherit')};
1301
- transform: scaleX(1);
1302
- }
1303
- .css-${DropdownInputCSSName} {
1304
- ${textColor(getProp(colors, 'system/active'))};
1305
- }
1306
- }
1307
- span:empty:before {
1308
- content: '${placeholder}';
1309
- ${parseHeight('100%')};
1310
- ${overflowHidden};
1311
- ${textColor(getProp(colors, 'text/sub'))};
1312
- display: -webkit-box;
1313
- -webkit-line-clamp: 1;
1314
- -webkit-box-orient: vertical;
1315
- }
1316
- &::placeholder {
1317
- ${textColor(getProp(colors, 'text/sub'))};
1318
- }
1319
- &::before {
1320
- ${positionAbsolute};
1321
- content: '';
1322
- ${insetX(0)};
1323
- ${bottom(0)};
1324
- ${viewType === 'underlined' && borderBottom(1, disabled ? getProp(colors, 'system/disabled') : getProp(colors, 'system/rest'))}
1325
- }
1326
- &::after {
1327
- ${positionAbsolute};
1328
- content: '';
1329
- ${insetX(0)};
1330
- ${bottom(-1)};
1331
- ${borderBottom(2, 'transparent')};
1332
- transform: scaleX(0);
1333
- transform-origin: center;
1334
- transition: all 0.2s ease;
1335
- }
1336
- `;
1337
- const DropdownListCSS = (loading, {
1338
- colors,
1339
- spacing
1340
- }) => css`
1341
- ${displayBlock};
1342
- ${positionRelative};
1343
- ${boxBorder};
1344
- ${borderRadius(4)};
1345
- ${parseWidth('100%')};
1346
- ${parseMaxHeight(280)};
1347
- ${loading ? overflowHidden : overflowAuto};
1348
- ${bgColor(getProp(colors, 'system/standard'))};
1349
- box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
1350
- ${z(1)};
1351
- &::-webkit-scrollbar {
1352
- ${borderRadius(4)};
1353
- ${parseWidth(24)};
1354
- ${bgColor(getProp(colors, 'system/standard'))};
1355
- }
1356
- &::-webkit-scrollbar-thumb {
1357
- ${parseMinHeight(40)};
1358
- ${borderRadius(24)};
1359
- ${border(8, 'transparent')};
1360
- ${bgColor(getProp(colors, 'fill/scrollbar_rest'))};
1361
- mix-blend-mode: normal;
1362
- background-clip: content-box;
1363
- }
1364
- .DGN-UI-TreeView {
1365
- padding: ${spacing([0.25])};
1366
- }
1367
- `;
1368
- const DropdownItemCSS = (multiple, selectBox, {
1369
- colors,
1370
- spacing
1371
- }) => css`
1372
- ${displayFlex};
1373
- ${flexRow};
1374
- ${positionRelative};
1375
- ${itemsCenter};
1376
- ${justifyStart};
1377
- ${boxBorder};
1378
- ${cursorPointer};
1379
- ${userSelectNone};
1380
- ${parseMinHeight(40)};
1381
- ${parseWidth('100%')};
1382
- ${bgColor(getProp(colors, 'system/standard'))};
1383
- padding: ${spacing([2, multiple && selectBox ? 0 : 4])};
1384
- ${textColor(getProp(colors, 'text/main'))};
1385
- &.no-data {
1386
- ${justifyCenter};
1387
- ${cursorDefault};
1388
- ${italic};
1389
- }
1390
- &:not(.no-data):hover,
1391
- &:not(.no-data):focus {
1392
- ${outlineNone};
1393
- ${bgColor(getProp(colors, 'fill/hover'))};
1394
- ${textColor(getProp(colors, 'system/active'))};
1395
- }
1396
- `;
1397
- const DropdownRootCSS = (DropdownFormCSSName, DropdownInputCSSName, {
1398
- colors,
1399
- spacing
1400
- }) => css`
1401
- ${displayBlock};
1402
- ${positionRelative};
1403
- margin-bottom: ${spacing([5])};
1404
- ${parseHeight('max-content')};
1405
- &.error {
1406
- .css-${DropdownFormCSSName} {
1407
- ${borderColor(getProp(colors, 'semantic/danger'))};
1408
- path {
1409
- ${fill(getProp(colors, 'semantic/danger'))};
1410
- }
1411
- &::before {
1412
- ${borderColor(getProp(colors, 'semantic/danger'))};
1413
- }
1414
- }
1415
- }
1416
- &.dgn-dropdown-loading,
1417
- &.disabled {
1418
- .css-${DropdownFormCSSName} {
1419
- ${borderColor(getProp(colors, 'system/disabled'))};
1420
- &::before {
1421
- ${borderColor(getProp(colors, 'system/disabled'))};
1422
- }
1423
- }
1424
- }
1425
- &.readOnly {
1426
- .css-${DropdownInputCSSName} {
1427
- .dropdown-item {
1428
- ${pointerEventsNone};
1429
- }
1430
- }
1431
- }
1432
- `;
1433
- const LoadingProgressCSS = css`
1434
- ${displayFlex};
1435
- ${flexRow};
1436
- ${justifyCenter};
1437
- ${itemsCenter};
1438
- ${positionAbsolute};
1439
- ${borderRadius(4)};
1440
- ${parseWidthHeight('100%')}
1441
- ${bgColor('rgba(255, 255, 255, 0.6)')};
1442
- ${z(2)};
1443
- ${top(0)};
1444
- `;
1445
- const DisabledCSS = css`
1446
- pointer-events: none !important;
1447
- opacity: 0.4 !important;
1448
- `;
1449
- const CheckBoxCSS = ({
1450
- spacing
1451
- }) => css`
1452
- ${parseWidthHeight('100%')};
1453
- padding: ${spacing([0, 4])};
1454
- `;
1455
- /* End styled */
1456
-
1457
- // Dropdown.defaultProps = {
1458
- // allowSearch: true,
1459
- // className: '',
1460
- // clearAble: false,
1461
- // dataSource: [],
1462
- // disabled: false,
1463
- // displayExpr: 'name',
1464
- // error: '',
1465
- // iconExpr: 'none',
1466
- // inputProps: {},
1467
- // itemMode: 'normal',
1468
- // label: '',
1469
- // limit: 50,
1470
- // loading: false,
1471
- // multilineSelectedItem: false,
1472
- // multiple: false,
1473
- // noDataText: getGlobal('noDataText'),
1474
- // placeholder: getGlobal('dropdownPlaceholder'),
1475
- // readOnly: false,
1476
- // required: false,
1477
- // searchDelayTime: getGlobal('delayOnInput'),
1478
- // searchMode: 'contains',
1479
- // total: Number.MAX_SAFE_INTEGER,
1480
- // valueExpr: 'id',
1481
- // viewType: 'underlined',
1482
- // };
1483
-
1484
- Dropdown.propTypes = {
1485
- action: PropTypes.shape({
1486
- loadData: PropTypes.func
1487
- }),
1488
- /** If `true`, the input box for searching will be displayed. */
1489
- allowSearch: PropTypes.bool,
1490
- /** The content to be displayed inside the Dropdown box, such as TreeView. */
1491
- children: PropTypes.node,
1492
- /** The CSS class for the component. */
1493
- className: PropTypes.string,
1494
- /** If `true`, the clear button will be displayed. */
1495
- clearAble: PropTypes.bool,
1496
- /** If `true`, the dropdown will automatically close after selecting an item. */
1497
- closeAfterSelect: PropTypes.bool,
1498
- /** The array of elements that appear in the dropdown list. */
1499
- dataSource: PropTypes.array,
1500
- /** The default value to be displayed when the Dropdown first renders. */
1501
- defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
1502
- /** If `true`, the component is disabled. */
1503
- disabled: PropTypes.bool,
1504
- /** The field name used for displaying text in the dropdown list.<br/>
1505
- * Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
1506
- * Note: Do not use 'id - name', as it will return undefined.
1507
- */
1508
- displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
1509
- /** Inline style for dropdown items. */
1510
- dropdownItemStyle: PropTypes.object,
1511
- /** Error message displayed below the input. */
1512
- error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
1513
- /** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
1514
- helperTextProps: PropTypes.object,
1515
- /** The field name used for displaying icons.<br/>
1516
- * Example:<br/>
1517
- * &nbsp;&nbsp;string: 'icon'<br/>
1518
- * &nbsp;&nbsp;object: {<br/>
1519
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key: 'icon',<br/>
1520
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;prefix: 'https://imglink.com',<br/>
1521
- * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;suffix: '.jpg'<br/>
1522
- * &nbsp;&nbsp;}
1523
- */
1524
- iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
1525
- key: PropTypes.string,
1526
- prefix: PropTypes.string,
1527
- suffix: PropTypes.string,
1528
- style: PropTypes.object
1529
- })]),
1530
- /** Attributes applied to the input element. */
1531
- inputProps: PropTypes.object,
1532
- /** Inline style for the input element. */
1533
- inputStyle: PropTypes.object,
1534
- /** The mode of rendering for items. */
1535
- itemMode: PropTypes.oneOf(['normal', 'table', 'treeview']),
1536
- /** The label for the input. */
1537
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
1538
- /** [Props](https://core.diginet.com.vn/ui/?path=/docs/form-control-text-label--simple) applied to the label element. */
1539
- labelProps: PropTypes.object,
1540
- /** Number of items to render at a time. */
1541
- limit: PropTypes.number,
1542
- /** If `true`, a loading indicator is shown. */
1543
- loading: PropTypes.bool,
1544
- /** Maximum number of options that can be selected (used with `multiple` prop).*/
1545
- maximumSelectionLength: PropTypes.number,
1546
- /** If `true`, multi-line selected item(s) will be shown. */
1547
- multilineSelectedItem: PropTypes.bool,
1548
- /** If `true`, the Dropdown supports multiple selections (value must be an array). */
1549
- multiple: PropTypes.bool,
1550
- /** Text shown when there is no data. */
1551
- noDataText: PropTypes.string,
1552
- /** Callback function fired when the value changes. */
1553
- onChange: PropTypes.func,
1554
- /** Callback function fired when the dropdown is closed. */
1555
- onClosed: PropTypes.func,
1556
- /** Callback function fired when the input value changes.<br/>
1557
- * If undefined, the filter function will run (default behavior).
1558
- */
1559
- onInput: PropTypes.func,
1560
- /** Callback function fired when a key is pressed down in the input. */
1561
- onKeyDown: PropTypes.func,
1562
- /** Callback function fired when scrolling near the end of the dropdown. */
1563
- onLoadMore: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
1564
- /** The short hint displayed in the input before the user selects a value. */
1565
- placeholder: PropTypes.string,
1566
- /** If `true`, the component is read-only. */
1567
- readOnly: PropTypes.bool,
1568
- /** Function used for custom rendering of items.<br/>
1569
- * Example: `(data, index) => data.name + ' - ' + data.role`<br/>
1570
- * This can be used as an alternative to `displayExpr`
1571
- */
1572
- renderItem: PropTypes.func,
1573
- /** Function or field name used to display selected items.<br/>
1574
- * Example: `(data, index) => index + ' - ' + data.name`<br/>
1575
- */
1576
- renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
1577
- /** If `true`, the label will indicate that the input is required. */
1578
- required: PropTypes.bool,
1579
- /**
1580
- * Duration to wait after entering search content before triggering a search.<br/>
1581
- * Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
1582
- * If `true`, the default delayOnInput will be used.
1583
- */
1584
- searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
1585
- /** Specifies the field name or expression used to compare values with the search string. */
1586
- searchExpr: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
1587
- /** Specifies the comparison operation used to search items. */
1588
- searchMode: PropTypes.oneOf(['contains', 'startswith', 'equals']),
1589
- /** If `true`, checkboxes will be shown next to each dropdown item. */
1590
- selectBox: PropTypes.bool,
1591
- /** Inline style for the component. */
1592
- style: PropTypes.object,
1593
- /** Sub content to display. */
1594
- subText: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
1595
- /** The total number of items in the dropdown list. */
1596
- total: PropTypes.number,
1597
- /** Used to identify the parent key (only used when `itemMode` is 'treeview'). */
1598
- treeViewID: PropTypes.string,
1599
- /** Used for mapping into a nested list (only used when `itemMode` is 'treeview'). */
1600
- treeViewParentID: PropTypes.string,
1601
- /** The displayed value of the component. */
1602
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
1603
- /** The field name used for the returned result. */
1604
- valueExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
1605
- /** An object default for value (used for load more). */
1606
- valueObjectDefault: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
1607
- /** The variant to use. */
1608
- viewType: PropTypes.oneOf(['underlined', 'outlined', 'none'])
1609
- /**
1610
- * ref methods
1611
- *
1612
- * how to get component element? ref.current
1613
- *
1614
- * how to call method? ref.current.instance.{method}
1615
- *
1616
- * * showDropdown(): Show dropdown
1617
- * * closeDropdown(): Close dropdown
1618
- * * onClear(): Clear selected value
1619
- * * setPreviousValue(): Set value to previous value
1620
- * * setValue(value): Set value of dropdown
1621
- * * @param {value} - string || number || array
1622
- */
1623
- };
1624
- export default Dropdown;