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