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
|
@@ -1,1537 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-prototype-builtins */
|
|
2
|
-
/** @jsxRuntime classic */
|
|
3
|
-
/** @jsx jsx */
|
|
4
|
-
import { css, jsx } from '@emotion/core';
|
|
5
|
-
import { ButtonIcon, Grid, HelperText, Icon, Image, Label, LinearProgress, List, ListItem, ListItemText, ModalSample, Notify, Popover, Popup, ScrollBar, Slider, SliderItem, Typography } from "../..";
|
|
6
|
-
import { getGlobal } from "../../../global";
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import { forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
9
|
-
import { aspectSquare, bgColor, border, borderDashed, borderRadius4px, borderRadius50, borderRight, bottom, boxBorder, cursorPointer, displayFlex, displayInlineBlock, displayNone, flexCol, floatRight, itemsCenter, justifyBetween, justifyCenter, justifyEnd, justifyStart, left, overflowHidden, parseHeight, parseMaxWidth, parseMinHeight, parseMinWidth, parseWidth, parseWidthHeight, positionAbsolute, positionRelative, textCenter, textColor, textLeft, textRight, top, truncate, userSelectNone } from "../../../styles/general";
|
|
10
|
-
import { useTheme } from "../../../theme";
|
|
11
|
-
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
12
|
-
import { classNames, getFileType, getProp, date as moment } from "../../../utils";
|
|
13
|
-
const oldAttached = [];
|
|
14
|
-
const allNewAttached = new FormData();
|
|
15
|
-
const attached = []; // attached = [...dataState, ...newDataState]
|
|
16
|
-
const chosenItems = [];
|
|
17
|
-
const getType = data => {
|
|
18
|
-
if (!data) return null;
|
|
19
|
-
if (data !== null && data !== void 0 && data.type) {
|
|
20
|
-
var _type$match;
|
|
21
|
-
const pattern = /word|sheet|presentation|pdf|image|compressed/i;
|
|
22
|
-
let type = data.type;
|
|
23
|
-
if (!type) {
|
|
24
|
-
if (/rar/.test(data.name)) {
|
|
25
|
-
type = 'compressed';
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return ((_type$match = type.match(pattern)) === null || _type$match === void 0 ? void 0 : _type$match[0]) || 'default';
|
|
29
|
-
} else {
|
|
30
|
-
var _data$FileName;
|
|
31
|
-
const FileExt = (_data$FileName = data.FileName) === null || _data$FileName === void 0 ? void 0 : _data$FileName.slice(data.FileName.lastIndexOf('.'));
|
|
32
|
-
return getFileType(FileExt) || 'default';
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const getDateTime = date => {
|
|
36
|
-
if (!(date instanceof Date && !isNaN(date))) return 'unknown';
|
|
37
|
-
const formatter = new Intl.DateTimeFormat('en-GB', {
|
|
38
|
-
day: '2-digit',
|
|
39
|
-
month: '2-digit',
|
|
40
|
-
year: 'numeric',
|
|
41
|
-
hour: '2-digit',
|
|
42
|
-
minute: '2-digit',
|
|
43
|
-
second: '2-digit'
|
|
44
|
-
});
|
|
45
|
-
return formatter.format(date); // DD/MM/YYYY, HH:mm:ss
|
|
46
|
-
};
|
|
47
|
-
const getNewUnitSize = (sizeName, totalSize, num) => {
|
|
48
|
-
if (sizeName === 'B' && num === 1 || sizeName === 'TB' && num === -1) return [sizeName, totalSize];
|
|
49
|
-
const arraySize = ['TB', 'GB', 'MB', 'KB', 'B'];
|
|
50
|
-
const index = arraySize.indexOf(sizeName);
|
|
51
|
-
const newTotalSize = totalSize * Math.pow(1024, num);
|
|
52
|
-
// newTotalSize = Math.round(newTotalSize*100)/100;
|
|
53
|
-
return [arraySize[index + num], newTotalSize];
|
|
54
|
-
};
|
|
55
|
-
const getBit = (size, unit) => {
|
|
56
|
-
const units = {
|
|
57
|
-
B: 1,
|
|
58
|
-
KB: 1024,
|
|
59
|
-
MB: 1024 ** 2,
|
|
60
|
-
GB: 1024 ** 3,
|
|
61
|
-
TB: 1024 ** 4
|
|
62
|
-
};
|
|
63
|
-
const normalizedUnit = unit.toUpperCase();
|
|
64
|
-
const multiplier = units[normalizedUnit] || 1024 * 1024;
|
|
65
|
-
return size * multiplier;
|
|
66
|
-
};
|
|
67
|
-
const formatBytes = (bytes, decimals = 2) => {
|
|
68
|
-
if (!+bytes) return '0 Bytes';
|
|
69
|
-
const k = 1024;
|
|
70
|
-
const dm = decimals < 0 ? 0 : decimals;
|
|
71
|
-
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
72
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
73
|
-
return [parseFloat((bytes / Math.pow(k, i)).toFixed(dm)), sizes[i]];
|
|
74
|
-
};
|
|
75
|
-
const isBase64URL = url => {
|
|
76
|
-
if (typeof url !== 'string') return false;
|
|
77
|
-
// Check if the URL is a valid data URL with base64 encoding
|
|
78
|
-
const dataPrefix = 'data:';
|
|
79
|
-
const base64Prefix = 'base64,';
|
|
80
|
-
if (url.startsWith(dataPrefix)) {
|
|
81
|
-
const base64Index = url.indexOf(base64Prefix);
|
|
82
|
-
if (base64Index !== -1) {
|
|
83
|
-
const base64Data = url.slice(base64Index + base64Prefix.length);
|
|
84
|
-
const base64Chars = /^[A-Za-z0-9+/=]+$/;
|
|
85
|
-
return base64Chars.test(base64Data) && base64Data.length % 4 === 0;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return false;
|
|
89
|
-
};
|
|
90
|
-
const cloneFile = file => {
|
|
91
|
-
const clonedFile = new File([file], (file === null || file === void 0 ? void 0 : file.name) || (file === null || file === void 0 ? void 0 : file.FileName), {
|
|
92
|
-
type: file.type,
|
|
93
|
-
lastModified: file.lastModified
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// Copy custom properties
|
|
97
|
-
for (const prop in file) {
|
|
98
|
-
if (file.hasOwnProperty(prop) && !clonedFile.hasOwnProperty(prop)) {
|
|
99
|
-
clonedFile[prop] = file[prop];
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return clonedFile;
|
|
103
|
-
};
|
|
104
|
-
const handleDownload = (url, name, onDownload) => {
|
|
105
|
-
if (!url) {
|
|
106
|
-
console.error('Invalid URL');
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
fetch(url).then(resp => resp.blob()).then(blob => {
|
|
110
|
-
const objectURL = window.URL.createObjectURL(blob);
|
|
111
|
-
const downloadLink = document.createElement('a');
|
|
112
|
-
downloadLink.style.display = 'none';
|
|
113
|
-
downloadLink.href = objectURL;
|
|
114
|
-
downloadLink.download = name;
|
|
115
|
-
document.body.appendChild(downloadLink);
|
|
116
|
-
downloadLink.click();
|
|
117
|
-
document.body.removeChild(downloadLink);
|
|
118
|
-
window.URL.revokeObjectURL(objectURL);
|
|
119
|
-
}).catch(error => {
|
|
120
|
-
console.error('Error downloading file:', error);
|
|
121
|
-
alert('File download failed');
|
|
122
|
-
});
|
|
123
|
-
if (onDownload) {
|
|
124
|
-
onDownload(url);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
const divideSizeMap = new Map([['B', 1], ['KB', 1024], ['MB', 1024 ** 2], ['GB', 1024 ** 3], ['TB', 1024 ** 4]]);
|
|
128
|
-
const viewTypeIconMap = new Map([['detail', 'ListView'], ['icon', 'IconView'], ['picture', 'ModuleView']]);
|
|
129
|
-
const viewTypeSwitchMap = new Map([['detail', 'icon'], ['icon', 'picture'], ['picture', 'detail']]);
|
|
130
|
-
const Attachment = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
131
|
-
if (!reference) reference = useRef(null);
|
|
132
|
-
const theme = useTheme();
|
|
133
|
-
const {
|
|
134
|
-
spacing
|
|
135
|
-
} = useTheme();
|
|
136
|
-
|
|
137
|
-
// props priority: `inProps` > `themeDefaultProps`
|
|
138
|
-
const props = useThemeProps({
|
|
139
|
-
props: inProps,
|
|
140
|
-
name: 'Attachment'
|
|
141
|
-
});
|
|
142
|
-
const {
|
|
143
|
-
accept,
|
|
144
|
-
allowDelete,
|
|
145
|
-
allowSort,
|
|
146
|
-
className,
|
|
147
|
-
data,
|
|
148
|
-
deleteNotifyText: deleteNotifyTextProp,
|
|
149
|
-
disabled,
|
|
150
|
-
domain: domainProp,
|
|
151
|
-
error,
|
|
152
|
-
height,
|
|
153
|
-
hintText: hintTextProp,
|
|
154
|
-
id,
|
|
155
|
-
inputProps,
|
|
156
|
-
isStripDomain,
|
|
157
|
-
label: labelProp,
|
|
158
|
-
maxFile,
|
|
159
|
-
maxSize: maxSizeProp,
|
|
160
|
-
multiple: multipleProp,
|
|
161
|
-
onChange,
|
|
162
|
-
onDownload,
|
|
163
|
-
onRemove: onRemoveProp,
|
|
164
|
-
onView: onViewProp,
|
|
165
|
-
ownerName,
|
|
166
|
-
readOnly,
|
|
167
|
-
//deprecated
|
|
168
|
-
required,
|
|
169
|
-
style,
|
|
170
|
-
unitSize,
|
|
171
|
-
uploadErrorInfo: uploadErrorInfoProp,
|
|
172
|
-
viewType
|
|
173
|
-
} = props;
|
|
174
|
-
let domain = domainProp;
|
|
175
|
-
const multiple = maxFile === 1 ? false : multipleProp;
|
|
176
|
-
const deleteNotifyText = deleteNotifyTextProp || getGlobal('deleteNotifyText');
|
|
177
|
-
const hintText = hintTextProp || getGlobal('dropFileHere');
|
|
178
|
-
const label = labelProp || getGlobal('attachText');
|
|
179
|
-
const maxSize = maxSizeProp || getGlobal('maxSizeUpload');
|
|
180
|
-
const uploadErrorInfo = uploadErrorInfoProp || {
|
|
181
|
-
maxFile: getGlobal(['errorDefault', 'maxFile']),
|
|
182
|
-
maxSize: getGlobal(['errorDefault', 'maxSize']),
|
|
183
|
-
fileType: getGlobal(['errorDefault', 'fileType']),
|
|
184
|
-
existingFile: getGlobal(['errorDefault', 'existingFile'])
|
|
185
|
-
};
|
|
186
|
-
const ref = useRef(null);
|
|
187
|
-
const attachmentHandleIconRef = useRef(null);
|
|
188
|
-
const attachmentInputRef = useRef(null);
|
|
189
|
-
const attachedRef = useRef(null);
|
|
190
|
-
const popupRef = useRef(null);
|
|
191
|
-
const popoverRef = useRef(null);
|
|
192
|
-
const isDeleteAll = useRef(false);
|
|
193
|
-
const notifyRef = useRef(null);
|
|
194
|
-
const removedAttachedRef = useRef([]);
|
|
195
|
-
const prevent = useRef(null);
|
|
196
|
-
const existClickOutOfItem = useRef(null);
|
|
197
|
-
const maxSizeRef = useRef(Infinity);
|
|
198
|
-
const timer = useRef(null);
|
|
199
|
-
const [showModal, setShowModal] = useState(false);
|
|
200
|
-
const [showPopup, setShowPopup] = useState(false);
|
|
201
|
-
const [viewTypeState, setViewTypeState] = useState(viewType);
|
|
202
|
-
const [newDataState, setNewDataState] = useState([]);
|
|
203
|
-
const [dataState, setDataState] = useState([]);
|
|
204
|
-
const [sizeByHeight, setSizeByHeight] = useState(true);
|
|
205
|
-
const isSpecialCase = viewTypeState === 'picture' && maxFile === 1;
|
|
206
|
-
const isEnable = !readOnly && !disabled;
|
|
207
|
-
const isEmpty = !((dataState === null || dataState === void 0 ? void 0 : dataState.length) + (newDataState === null || newDataState === void 0 ? void 0 : newDataState.length));
|
|
208
|
-
const _AttachmentRootCSS = AttachmentRootCSS(isEmpty, isEnable, height, theme);
|
|
209
|
-
const _AttachmentHandleIconCSS = AttachmentHandleIconCSS(theme);
|
|
210
|
-
const _ButtonAttachmentCSS = ButtonAttachmentCSS(theme);
|
|
211
|
-
const _DotNewFileDetailCSS = DotNewFileDetailCSS(theme);
|
|
212
|
-
const _DotNewFileIconCSS = DotNewFileIconCSS(theme);
|
|
213
|
-
const _AttachedItemOwnerCSS = AttachedItemOwnerCSS(theme);
|
|
214
|
-
const _AttachedLinearCSS = AttachedLinearCSS(theme);
|
|
215
|
-
const _AttachedItemCSS = AttachedItemCSS(theme);
|
|
216
|
-
const _AttachedItemPictureCSS = AttachedItemPictureCSS(theme);
|
|
217
|
-
const _ItemPictureInfoCSS = ItemPictureInfoCSS(theme);
|
|
218
|
-
const _AttachmentInfoCSS = AttachmentInfoCSS(theme);
|
|
219
|
-
const _AttachedItemInfoCSS = AttachedItemInfoCSS(theme);
|
|
220
|
-
const _AttachmentListCSS = AttachmentListCSS(theme);
|
|
221
|
-
|
|
222
|
-
// Start handler
|
|
223
|
-
const onSortElement = (e, type) => {
|
|
224
|
-
const _attached = [...dataState, ...newDataState];
|
|
225
|
-
let multi = 1;
|
|
226
|
-
const currentActive = popoverRef.current.querySelector('.DGN-Active');
|
|
227
|
-
if (currentActive) {
|
|
228
|
-
if (e.currentTarget.classList.contains('DGN-Active')) {
|
|
229
|
-
if (e.currentTarget.classList.contains('DGN-Decrease')) {
|
|
230
|
-
e.currentTarget.classList.remove('DGN-Decrease');
|
|
231
|
-
} else {
|
|
232
|
-
multi = -1;
|
|
233
|
-
e.currentTarget.classList.add('DGN-Decrease');
|
|
234
|
-
}
|
|
235
|
-
} else {
|
|
236
|
-
currentActive.classList.remove('DGN-Decrease');
|
|
237
|
-
currentActive.classList.remove('DGN-Active');
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
e.currentTarget.classList.add('DGN-Active');
|
|
241
|
-
const attachedList = Array.from(attachedRef.current.querySelectorAll('.attachment-row'));
|
|
242
|
-
attachedList.sort((a, b) => {
|
|
243
|
-
let textA = a.querySelector('.' + (type === 'filesize' ? 'filename' : type)).textContent;
|
|
244
|
-
let textB = b.querySelector('.' + (type === 'filesize' ? 'filename' : type)).textContent;
|
|
245
|
-
if (type === 'datetime') {
|
|
246
|
-
textA = textA.replace(/.{10}/, text => moment(text, 'DD/MM/YYYY').format('YYYY/MM/DD'));
|
|
247
|
-
textB = textB.replace(/.{10}/, text => moment(text, 'DD/MM/YYYY').format('YYYY/MM/DD'));
|
|
248
|
-
} else if (type === 'filesize') {
|
|
249
|
-
const objA = _attached.find(attach => attach.FileName === textA);
|
|
250
|
-
const objB = _attached.find(attach => attach.FileName === textB);
|
|
251
|
-
textA = (objA.size || objA.FileSize).toString();
|
|
252
|
-
textB = (objB.size || objB.FileSize).toString();
|
|
253
|
-
}
|
|
254
|
-
return multi * textA.localeCompare(textB, 'en', {
|
|
255
|
-
numeric: type === 'filesize'
|
|
256
|
-
});
|
|
257
|
-
});
|
|
258
|
-
_attached.sort((a, b) => {
|
|
259
|
-
let valueA, valueB;
|
|
260
|
-
if (type === 'filesize' || type === 'datetime') {
|
|
261
|
-
if (type === 'filesize') {
|
|
262
|
-
valueA = a.size || a.FileSize;
|
|
263
|
-
valueB = b.size || b.FileSize;
|
|
264
|
-
} else {
|
|
265
|
-
valueA = new Date(a.CreateDate).getTime();
|
|
266
|
-
valueB = new Date(b.CreateDate).getTime();
|
|
267
|
-
}
|
|
268
|
-
} else if (type === 'filetype') {
|
|
269
|
-
// filetype
|
|
270
|
-
valueA = getType(a);
|
|
271
|
-
valueB = getType(b);
|
|
272
|
-
} else {
|
|
273
|
-
valueA = a[type === 'filename' ? 'FileName' : 'UserName'] || ownerName;
|
|
274
|
-
valueB = b[type === 'filename' ? 'FileName' : 'UserName'] || ownerName;
|
|
275
|
-
}
|
|
276
|
-
return multi * valueA.toString().localeCompare(valueB.toString(), 'en', {
|
|
277
|
-
numeric: type === 'filesize' || type === 'datetime'
|
|
278
|
-
});
|
|
279
|
-
});
|
|
280
|
-
attachedList.forEach(el => {
|
|
281
|
-
attachedRef.current.appendChild(el);
|
|
282
|
-
});
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
// const afterChangeFile = (length = 0) => {
|
|
286
|
-
// setIsEmpty(!length);
|
|
287
|
-
// };
|
|
288
|
-
|
|
289
|
-
const onChangeFiles = async e => {
|
|
290
|
-
var _e$target, _e$target$files;
|
|
291
|
-
if (!isEnable) return;
|
|
292
|
-
e.persist();
|
|
293
|
-
if (e !== null && e !== void 0 && (_e$target = e.target) !== null && _e$target !== void 0 && (_e$target$files = _e$target.files) !== null && _e$target$files !== void 0 && _e$target$files.length) {
|
|
294
|
-
var _ref;
|
|
295
|
-
let files = e.target.files;
|
|
296
|
-
// const lengthAttached = attached.length;
|
|
297
|
-
const lengthAttached = (_ref = [...dataState, ...newDataState]) === null || _ref === void 0 ? void 0 : _ref.length;
|
|
298
|
-
for (let i = 0; i < files.length; i++) {
|
|
299
|
-
if (i + 1 > maxFile - lengthAttached && !isSpecialCase || files[i].size > maxSizeRef.current || checkExistingFile(files[i]) || !checkAcceptFileType(files[i])) {
|
|
300
|
-
if (i + 1 > maxFile - lengthAttached && !isSpecialCase) {
|
|
301
|
-
var _files$i;
|
|
302
|
-
notifyRef.current.instance.show(`${(_files$i = files[i]) === null || _files$i === void 0 ? void 0 : _files$i.name} - ${uploadErrorInfo['maxFile']}`);
|
|
303
|
-
} else if (files[i].size > maxSizeRef.current) {
|
|
304
|
-
var _files$i2;
|
|
305
|
-
notifyRef.current.instance.show(`${(_files$i2 = files[i]) === null || _files$i2 === void 0 ? void 0 : _files$i2.name} - ${uploadErrorInfo['maxSize']}`);
|
|
306
|
-
} else if (!checkAcceptFileType(files[i])) {
|
|
307
|
-
var _files$i3;
|
|
308
|
-
notifyRef.current.instance.show(`${(_files$i3 = files[i]) === null || _files$i3 === void 0 ? void 0 : _files$i3.name} - ${uploadErrorInfo['fileType']}`);
|
|
309
|
-
} else {
|
|
310
|
-
var _files$i4;
|
|
311
|
-
notifyRef.current.instance.show(`${(_files$i4 = files[i]) === null || _files$i4 === void 0 ? void 0 : _files$i4.name} - ${uploadErrorInfo['existingFile']}`);
|
|
312
|
-
}
|
|
313
|
-
files = removeFileOutInputFiles(i, true);
|
|
314
|
-
i--;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
const length = files.length;
|
|
318
|
-
if (!lengthAttached && !length) {
|
|
319
|
-
// afterChangeFile();
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
// afterChangeFile(lengthAttached + length);
|
|
323
|
-
if (multiple || inputProps && inputProps.multiple) {
|
|
324
|
-
for (let i = 0; i < length; i++) {
|
|
325
|
-
files[i].FileName = files[i].name;
|
|
326
|
-
attached.push(files[i]);
|
|
327
|
-
}
|
|
328
|
-
// setNewDataState([...newDataState, ...Array.from(files)]);
|
|
329
|
-
for (let i = 0; i < length; i++) {
|
|
330
|
-
files[i].URL = await onProgressing(files[i]);
|
|
331
|
-
}
|
|
332
|
-
} else if (length) {
|
|
333
|
-
files[0].FileName = files[0].name;
|
|
334
|
-
if (isSpecialCase) attached.splice(0, 1);
|
|
335
|
-
attached.push(files[0]);
|
|
336
|
-
files[0].URL = await onProgressing(files[0]);
|
|
337
|
-
}
|
|
338
|
-
insertAttached(files);
|
|
339
|
-
stripDomain();
|
|
340
|
-
if (onChange) onChange({
|
|
341
|
-
element: e.target,
|
|
342
|
-
attached: isSpecialCase ? Array.from(files) : [...dataState, ...newDataState, ...Array.from(files)],
|
|
343
|
-
oldAttached,
|
|
344
|
-
newAttached: files,
|
|
345
|
-
allNewAttached: [...newDataState, ...Array.from(files)]
|
|
346
|
-
});
|
|
347
|
-
if (maxFile === 1) updateSize();
|
|
348
|
-
}
|
|
349
|
-
// else if (!attached.length) {
|
|
350
|
-
// afterChangeFile();
|
|
351
|
-
// }
|
|
352
|
-
};
|
|
353
|
-
const onProgressing = file => {
|
|
354
|
-
const key = (file === null || file === void 0 ? void 0 : file.lastModified) + (file === null || file === void 0 ? void 0 : file.size);
|
|
355
|
-
return new Promise((resolve, reject) => {
|
|
356
|
-
const reader = new FileReader();
|
|
357
|
-
let url;
|
|
358
|
-
reader.readAsDataURL(file);
|
|
359
|
-
reader.onload = e => {
|
|
360
|
-
url = e.target.result;
|
|
361
|
-
};
|
|
362
|
-
reader.onloadstart = () => {
|
|
363
|
-
const LinearProgressEl = attachedRef.current.querySelector(`.DGN-UI-LinearProgress-${key}`);
|
|
364
|
-
if (LinearProgressEl) {
|
|
365
|
-
LinearProgressEl.parentNode.style.display = 'flex';
|
|
366
|
-
LinearProgressEl.childNodes[0].style.width = '0%';
|
|
367
|
-
}
|
|
368
|
-
};
|
|
369
|
-
reader.onprogress = e => {
|
|
370
|
-
const LinearProgressEl = attachedRef.current.querySelector(`.DGN-UI-LinearProgress-${key}`);
|
|
371
|
-
if (LinearProgressEl) {
|
|
372
|
-
LinearProgressEl.childNodes[0].style.width = e.loaded / e.total * 100 + '%';
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
reader.onloadend = () => {
|
|
376
|
-
const LinearProgressEl = attachedRef.current.querySelector(`.DGN-UI-LinearProgress-${key}`);
|
|
377
|
-
if (LinearProgressEl) {
|
|
378
|
-
LinearProgressEl.parentNode.style.display = 'none';
|
|
379
|
-
}
|
|
380
|
-
resolve(url);
|
|
381
|
-
};
|
|
382
|
-
reader.onerror = () => {
|
|
383
|
-
console.log('Upload file fail');
|
|
384
|
-
reject(false);
|
|
385
|
-
};
|
|
386
|
-
});
|
|
387
|
-
};
|
|
388
|
-
const calculateSize = size => {
|
|
389
|
-
if (!size && size !== 0) return 'unknown';
|
|
390
|
-
let totalSize;
|
|
391
|
-
let unitSizeName;
|
|
392
|
-
const divideSize = unitSize ? divideSizeMap.get(unitSize.toUpperCase()) : null;
|
|
393
|
-
if (divideSize) {
|
|
394
|
-
totalSize = size / divideSize;
|
|
395
|
-
unitSizeName = unitSize.toUpperCase();
|
|
396
|
-
while (totalSize < 0.01 && unitSizeName !== 'B') {
|
|
397
|
-
[unitSizeName, totalSize] = getNewUnitSize(unitSizeName, totalSize, 1);
|
|
398
|
-
}
|
|
399
|
-
} else {
|
|
400
|
-
// auto-detect unit size name
|
|
401
|
-
[totalSize, unitSizeName] = formatBytes(size);
|
|
402
|
-
}
|
|
403
|
-
if (totalSize < 1000) {
|
|
404
|
-
totalSize = Math.round(totalSize * 100) / 100;
|
|
405
|
-
} else {
|
|
406
|
-
totalSize = Math.round(totalSize);
|
|
407
|
-
}
|
|
408
|
-
return totalSize + ' ' + unitSizeName;
|
|
409
|
-
};
|
|
410
|
-
const onShowPopup = () => {
|
|
411
|
-
setShowPopup(true);
|
|
412
|
-
};
|
|
413
|
-
const onClosePopup = () => {
|
|
414
|
-
setShowPopup(false);
|
|
415
|
-
if (isDeleteAll.current) {
|
|
416
|
-
isDeleteAll.current = false;
|
|
417
|
-
chosenItems.length = 0;
|
|
418
|
-
removeActiveChosenItem();
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
const _onDownload = () => {
|
|
422
|
-
var _ref2;
|
|
423
|
-
console.log('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA');
|
|
424
|
-
const index = chosenItems[0];
|
|
425
|
-
const file = mountDomain((_ref2 = [...dataState, ...newDataState]) === null || _ref2 === void 0 ? void 0 : _ref2[index]);
|
|
426
|
-
handleDownload(file === null || file === void 0 ? void 0 : file.URL, file === null || file === void 0 ? void 0 : file.FileName, onDownload);
|
|
427
|
-
};
|
|
428
|
-
const onRemoveMultiple = () => {
|
|
429
|
-
const attachedItems = [...dataState, ...newDataState];
|
|
430
|
-
const nodeList = attachedRef.current.querySelectorAll('.chosen');
|
|
431
|
-
const recentRemovedAttached = [];
|
|
432
|
-
const tempDataState = [...dataState];
|
|
433
|
-
const tempNewDataState = [...newDataState];
|
|
434
|
-
nodeList.forEach(itemEl => {
|
|
435
|
-
const index = Array.from(attachedRef.current.children).indexOf(itemEl.parentNode);
|
|
436
|
-
const deletedFile = attachedItems[index];
|
|
437
|
-
removedAttachedRef.current.push(deletedFile);
|
|
438
|
-
recentRemovedAttached.push(deletedFile);
|
|
439
|
-
if (Object.prototype.toString.call(deletedFile) === '[object File]' && tempNewDataState !== null && tempNewDataState !== void 0 && tempNewDataState.length) {
|
|
440
|
-
removeFileOutInputFiles(tempNewDataState.findIndex(attach => (attach === null || attach === void 0 ? void 0 : attach.FileName) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.FileName) && (attach === null || attach === void 0 ? void 0 : attach.CreateDate) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.CreateDate)));
|
|
441
|
-
tempNewDataState.splice(tempNewDataState.findIndex(attach => (attach === null || attach === void 0 ? void 0 : attach.FileName) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.FileName) && (attach === null || attach === void 0 ? void 0 : attach.CreateDate) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.CreateDate)), 1);
|
|
442
|
-
setNewDataState(tempNewDataState);
|
|
443
|
-
} else {
|
|
444
|
-
oldAttached.splice(oldAttached.findIndex(attach => (attach === null || attach === void 0 ? void 0 : attach.FileName) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.FileName) && (attach === null || attach === void 0 ? void 0 : attach.CreateDate) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.CreateDate)), 1);
|
|
445
|
-
tempDataState.splice(tempDataState.findIndex(attach => (attach === null || attach === void 0 ? void 0 : attach.FileName) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.FileName) && (attach === null || attach === void 0 ? void 0 : attach.CreateDate) === (deletedFile === null || deletedFile === void 0 ? void 0 : deletedFile.CreateDate)), 1);
|
|
446
|
-
setDataState(tempDataState);
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
const tempAttachedItems = [...tempDataState, ...tempNewDataState];
|
|
450
|
-
// if (tempAttachedItems.length < 2) {
|
|
451
|
-
// afterChangeFile(tempAttachedItems?.length || 0);
|
|
452
|
-
// }
|
|
453
|
-
stripDomain();
|
|
454
|
-
if (onChange) onChange({
|
|
455
|
-
element: nodeList,
|
|
456
|
-
attached: tempAttachedItems,
|
|
457
|
-
recentRemovedAttached,
|
|
458
|
-
removedAttached: removedAttachedRef.current,
|
|
459
|
-
oldAttached,
|
|
460
|
-
allNewAttached: tempNewDataState
|
|
461
|
-
});
|
|
462
|
-
!!onRemoveProp && onRemoveProp(recentRemovedAttached);
|
|
463
|
-
onClosePopup();
|
|
464
|
-
};
|
|
465
|
-
const clearAllAttached = (confirmPopup = false) => {
|
|
466
|
-
const allAttachEl = Array.from(attachedRef.current.querySelectorAll('.attachment-row')).map(item => item.firstChild);
|
|
467
|
-
if (allAttachEl && allAttachEl.length) {
|
|
468
|
-
allAttachEl.forEach(attachEl => attachEl.classList.add('chosen'));
|
|
469
|
-
isDeleteAll.current = true;
|
|
470
|
-
confirmPopup ? onShowPopup() : onRemoveMultiple();
|
|
471
|
-
}
|
|
472
|
-
};
|
|
473
|
-
const onGetViewItem = (i = 0) => {
|
|
474
|
-
var _attached$index;
|
|
475
|
-
const index = chosenItems[i];
|
|
476
|
-
const node = attachedRef.current.childNodes[index];
|
|
477
|
-
const AttachmentID = ((_attached$index = attached[index]) === null || _attached$index === void 0 ? void 0 : _attached$index.AttachmentID) || null;
|
|
478
|
-
onView(node, AttachmentID);
|
|
479
|
-
};
|
|
480
|
-
const onView = (node, AttachmentID) => {
|
|
481
|
-
const index = Array.from(attachedRef.current.children).indexOf(node === null || node === void 0 ? void 0 : node.parentNode);
|
|
482
|
-
if (onViewProp) onViewProp(AttachmentID, index);else {
|
|
483
|
-
setShowModal(true);
|
|
484
|
-
}
|
|
485
|
-
};
|
|
486
|
-
const removeFileOutInputFiles = (index, keeping) => {
|
|
487
|
-
const dt = new DataTransfer();
|
|
488
|
-
for (let file of attachmentInputRef.current.files) {
|
|
489
|
-
if (file !== attachmentInputRef.current.files[index]) {
|
|
490
|
-
dt.items.add(file);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
if (!keeping) {
|
|
494
|
-
const files = allNewAttached.getAll('files');
|
|
495
|
-
files.splice(index, 1);
|
|
496
|
-
allNewAttached.delete('files');
|
|
497
|
-
files.forEach(file => allNewAttached.append('files', file));
|
|
498
|
-
}
|
|
499
|
-
attachmentInputRef.current.files = dt.files;
|
|
500
|
-
return dt.files;
|
|
501
|
-
};
|
|
502
|
-
const insertAttached = files => {
|
|
503
|
-
if (multiple || inputProps && inputProps.multiple) {
|
|
504
|
-
let tempArr = [];
|
|
505
|
-
for (let file of files) {
|
|
506
|
-
allNewAttached.append('files', file);
|
|
507
|
-
tempArr.push(file);
|
|
508
|
-
}
|
|
509
|
-
setNewDataState([...newDataState, ...tempArr]);
|
|
510
|
-
} else if (files[0]) {
|
|
511
|
-
allNewAttached.delete('files');
|
|
512
|
-
allNewAttached.append('files', files[0]);
|
|
513
|
-
if (isSpecialCase) setDataState([]);
|
|
514
|
-
setTimeout(() => {
|
|
515
|
-
setNewDataState(files[0] ? [files[0]] : []);
|
|
516
|
-
});
|
|
517
|
-
}
|
|
518
|
-
// attachmentInputRef.current.files = allNewAttached.getAll('files');
|
|
519
|
-
};
|
|
520
|
-
const checkExistingFile = newFile => {
|
|
521
|
-
const files = [...dataState, ...newDataState];
|
|
522
|
-
return files.some(file => ((file === null || file === void 0 ? void 0 : file.FileName) || (file === null || file === void 0 ? void 0 : file.name)) === ((newFile === null || newFile === void 0 ? void 0 : newFile.FileName) || (newFile === null || newFile === void 0 ? void 0 : newFile.name)) && ((file === null || file === void 0 ? void 0 : file.FileSize) || (file === null || file === void 0 ? void 0 : file.size)) === ((newFile === null || newFile === void 0 ? void 0 : newFile.FileSize) || (newFile === null || newFile === void 0 ? void 0 : newFile.size)));
|
|
523
|
-
};
|
|
524
|
-
const checkAcceptFileType = newFile => {
|
|
525
|
-
if (!accept || !accept.length) return true;
|
|
526
|
-
const type = typeof accept === 'string' ? accept : accept.join('-');
|
|
527
|
-
if (typeof accept === 'string') {
|
|
528
|
-
const acceptType = type.replace('/*', '');
|
|
529
|
-
return newFile.type.includes(acceptType);
|
|
530
|
-
}
|
|
531
|
-
const extFile = newFile.name.slice(newFile.name.lastIndexOf('.') + 1);
|
|
532
|
-
return accept.join('-').includes(extFile);
|
|
533
|
-
};
|
|
534
|
-
const onChooseItem = (e, idx) => {
|
|
535
|
-
const ctrlKey = e.ctrlKey;
|
|
536
|
-
const shiftKey = e.shiftKey;
|
|
537
|
-
const itemEl = e.currentTarget.firstChild;
|
|
538
|
-
// timer.current = setTimeout(() => {
|
|
539
|
-
if (!prevent.current) {
|
|
540
|
-
if (shiftKey && !ctrlKey) {
|
|
541
|
-
let startIndex = chosenItems[chosenItems.length - 1] || 0;
|
|
542
|
-
let endIndex = idx;
|
|
543
|
-
if (startIndex > endIndex) {
|
|
544
|
-
endIndex = startIndex;
|
|
545
|
-
startIndex = idx;
|
|
546
|
-
}
|
|
547
|
-
chosenItems.length = 0;
|
|
548
|
-
attachedRef.current.querySelectorAll(`.DGN-UI-Attachment-List-Attached-Row`).forEach((itemEl, indexEl) => {
|
|
549
|
-
const _itemEl = itemEl.firstChild;
|
|
550
|
-
if (startIndex <= indexEl && indexEl <= endIndex) {
|
|
551
|
-
if (!_itemEl.classList.contains('chosen')) {
|
|
552
|
-
_itemEl.classList.add('chosen');
|
|
553
|
-
}
|
|
554
|
-
chosenItems.push(indexEl);
|
|
555
|
-
} else if (_itemEl.classList.contains('chosen')) {
|
|
556
|
-
_itemEl.classList.remove('chosen');
|
|
557
|
-
}
|
|
558
|
-
});
|
|
559
|
-
if (chosenItems[chosenItems.length - 1] !== idx) {
|
|
560
|
-
chosenItems.shift();
|
|
561
|
-
chosenItems.push(idx);
|
|
562
|
-
}
|
|
563
|
-
} else if (!ctrlKey) {
|
|
564
|
-
chosenItems.length = 0;
|
|
565
|
-
removeActiveChosenItem();
|
|
566
|
-
chosenItems.push(idx);
|
|
567
|
-
itemEl.classList.add('chosen');
|
|
568
|
-
} else if (itemEl.classList.contains('chosen')) {
|
|
569
|
-
chosenItems.splice(chosenItems.indexOf(idx));
|
|
570
|
-
itemEl.classList.remove('chosen');
|
|
571
|
-
if (!chosenItems.length) {
|
|
572
|
-
setTimeout(() => {
|
|
573
|
-
removeAllChosenItems();
|
|
574
|
-
}, 0);
|
|
575
|
-
}
|
|
576
|
-
} else {
|
|
577
|
-
chosenItems.push(idx);
|
|
578
|
-
itemEl.classList.add('chosen');
|
|
579
|
-
}
|
|
580
|
-
// Add event listener click out of item
|
|
581
|
-
if (!existClickOutOfItem.current) {
|
|
582
|
-
existClickOutOfItem.current = true;
|
|
583
|
-
attachmentHandleIconRef.current.style.display = 'block';
|
|
584
|
-
document.addEventListener('keydown', onKeyDown);
|
|
585
|
-
document.addEventListener('click', clickOutOfItem);
|
|
586
|
-
}
|
|
587
|
-
checkChosenMultiple();
|
|
588
|
-
}
|
|
589
|
-
prevent.current = false;
|
|
590
|
-
// }, 100);
|
|
591
|
-
};
|
|
592
|
-
const removeActiveChosenItem = () => {
|
|
593
|
-
attachedRef.current.querySelectorAll('.chosen').forEach(itemEl => {
|
|
594
|
-
itemEl.classList.remove('chosen');
|
|
595
|
-
});
|
|
596
|
-
};
|
|
597
|
-
const checkChosenMultiple = () => {
|
|
598
|
-
const actionIcons = attachmentHandleIconRef.current.childNodes;
|
|
599
|
-
if (chosenItems.length > 1 && actionIcons[0].style.display !== 'none') {
|
|
600
|
-
actionIcons[0].style.display = 'none';
|
|
601
|
-
actionIcons[1].style.display = 'none';
|
|
602
|
-
} else if (chosenItems.length === 1 && actionIcons[0].style.display === 'none') {
|
|
603
|
-
actionIcons[0].style.display = null;
|
|
604
|
-
actionIcons[1].style.display = null;
|
|
605
|
-
}
|
|
606
|
-
};
|
|
607
|
-
const onKeyDown = event => {
|
|
608
|
-
const key = event.key;
|
|
609
|
-
if (key === 'Delete') {
|
|
610
|
-
// Press Delete key to delete item(s)
|
|
611
|
-
onShowPopup();
|
|
612
|
-
} else if (key === 'Enter') {
|
|
613
|
-
if (popupRef.current.style.display !== 'flex') {
|
|
614
|
-
onGetViewItem(chosenItems.length - 1);
|
|
615
|
-
}
|
|
616
|
-
} else if (/a/i.test(key) && event.ctrlKey) {
|
|
617
|
-
chosenItems.length = 0;
|
|
618
|
-
const allAttachEl = Array.from(attachedRef.current.querySelectorAll('.attachment-row')).map(item => item.firstChild);
|
|
619
|
-
if (allAttachEl && allAttachEl.length) {
|
|
620
|
-
allAttachEl.forEach((attachEl, index) => chosenItems.push(index) & attachEl.classList.add('chosen'));
|
|
621
|
-
}
|
|
622
|
-
event.preventDefault();
|
|
623
|
-
return false;
|
|
624
|
-
} else if (/Arrow/.test(key)) {
|
|
625
|
-
// Press Arrow key to select another item
|
|
626
|
-
event.preventDefault();
|
|
627
|
-
const itemsNode = Array.from(attachedRef.current.querySelectorAll('.attachment-row')).map(item => item.firstChild);
|
|
628
|
-
const chosenItemsNode = Array.from(itemsNode).filter(el => el.classList.contains('chosen'));
|
|
629
|
-
const length = itemsNode.length;
|
|
630
|
-
let index;
|
|
631
|
-
if (key === 'ArrowDown' || key === 'ArrowRight') {
|
|
632
|
-
for (let id = length - 1; id >= 0; id--) {
|
|
633
|
-
if (Array.from(itemsNode)[id].classList.contains('chosen')) {
|
|
634
|
-
index = id;
|
|
635
|
-
break;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
if (index === length - 1) {
|
|
639
|
-
if (chosenItemsNode.length !== 1 && !event.shiftKey) {
|
|
640
|
-
chosenItemsNode.forEach((node, i) => {
|
|
641
|
-
if (i !== index) {
|
|
642
|
-
node.classList.remove('chosen');
|
|
643
|
-
}
|
|
644
|
-
});
|
|
645
|
-
chosenItems.length = 0;
|
|
646
|
-
chosenItems.push(index);
|
|
647
|
-
Array.from(itemsNode)[index].scrollIntoView({
|
|
648
|
-
block: 'center',
|
|
649
|
-
behavior: 'smooth'
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
return;
|
|
653
|
-
}
|
|
654
|
-
Array.from(itemsNode)[index + 1].scrollIntoView({
|
|
655
|
-
block: 'center',
|
|
656
|
-
behavior: 'smooth'
|
|
657
|
-
});
|
|
658
|
-
if (!event.shiftKey) {
|
|
659
|
-
itemsNode.forEach(node => {
|
|
660
|
-
node.classList.remove('chosen');
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
itemsNode[index + 1].classList.add('chosen');
|
|
664
|
-
chosenItems.push(index + 1);
|
|
665
|
-
} else if (key === 'ArrowUp' || key === 'ArrowLeft') {
|
|
666
|
-
index = Array.from(itemsNode).findIndex(el => el.classList.contains('chosen'));
|
|
667
|
-
if (index === 0) {
|
|
668
|
-
if (chosenItemsNode.length !== 1 && !event.shiftKey) {
|
|
669
|
-
chosenItemsNode.forEach((node, i) => {
|
|
670
|
-
if (i !== index) {
|
|
671
|
-
node.classList.remove('chosen');
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
chosenItems.length = 0;
|
|
675
|
-
chosenItems.push(index);
|
|
676
|
-
Array.from(itemsNode)[index].scrollIntoView({
|
|
677
|
-
block: 'center',
|
|
678
|
-
behavior: 'smooth'
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
return;
|
|
682
|
-
}
|
|
683
|
-
Array.from(itemsNode)[index - 1].scrollIntoView({
|
|
684
|
-
block: 'center',
|
|
685
|
-
behavior: 'smooth'
|
|
686
|
-
});
|
|
687
|
-
if (!event.shiftKey) {
|
|
688
|
-
chosenItemsNode.forEach(node => {
|
|
689
|
-
node.classList.remove('chosen');
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
itemsNode[index - 1].classList.add('chosen');
|
|
693
|
-
chosenItems.push(index - 1);
|
|
694
|
-
}
|
|
695
|
-
if (!event.shiftKey) {
|
|
696
|
-
chosenItems.length = 1;
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
};
|
|
700
|
-
const clickOutOfItem = e => {
|
|
701
|
-
var _popupRef$current, _popupRef$current$sty;
|
|
702
|
-
if (!attachedRef || !attachedRef.current) {
|
|
703
|
-
document.removeEventListener('keydown', onKeyDown);
|
|
704
|
-
document.removeEventListener('click', clickOutOfItem);
|
|
705
|
-
return;
|
|
706
|
-
}
|
|
707
|
-
if (!(attachedRef.current.contains(e.target) && attachedRef.current !== e.target) && !attachmentHandleIconRef.current.contains(e.target) && !isDeleteAll.current && (((_popupRef$current = popupRef.current) === null || _popupRef$current === void 0 ? void 0 : (_popupRef$current$sty = _popupRef$current.style) === null || _popupRef$current$sty === void 0 ? void 0 : _popupRef$current$sty.display) !== 'flex' || popupRef.current.querySelector('button.filled.info').contains(e.target))) {
|
|
708
|
-
removeAllChosenItems();
|
|
709
|
-
removeActiveChosenItem();
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
const removeAllChosenItems = () => {
|
|
713
|
-
chosenItems.length = 0;
|
|
714
|
-
existClickOutOfItem.current = false;
|
|
715
|
-
attachmentHandleIconRef.current.style.display = null;
|
|
716
|
-
document.removeEventListener('keydown', onKeyDown);
|
|
717
|
-
document.removeEventListener('click', clickOutOfItem);
|
|
718
|
-
};
|
|
719
|
-
const mountDomain = item => {
|
|
720
|
-
if (!item) return item;
|
|
721
|
-
const cloneItem = cloneFile(item);
|
|
722
|
-
if (domain) {
|
|
723
|
-
if (!/\/$/.test(domain)) {
|
|
724
|
-
domain = domain + '/';
|
|
725
|
-
}
|
|
726
|
-
if (cloneItem !== null && cloneItem !== void 0 && cloneItem.URL && !isBase64URL(cloneItem === null || cloneItem === void 0 ? void 0 : cloneItem.URL)) {
|
|
727
|
-
const hasDomain = /^(?:https?:\/\/)?[^\s/$.?#]+\.[^\s]+$/.test(cloneItem.URL);
|
|
728
|
-
cloneItem.URL = hasDomain ? cloneItem.URL : domain + cloneItem.URL;
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
return cloneItem;
|
|
732
|
-
};
|
|
733
|
-
const stripDomain = () => {
|
|
734
|
-
if (isStripDomain && domain) {
|
|
735
|
-
const re = new RegExp(domain + '/?');
|
|
736
|
-
attached.forEach(item => {
|
|
737
|
-
var _item$URL;
|
|
738
|
-
item.URL = (item === null || item === void 0 ? void 0 : (_item$URL = item.URL) === null || _item$URL === void 0 ? void 0 : _item$URL.replace(re, '')) || '';
|
|
739
|
-
});
|
|
740
|
-
oldAttached.forEach(item => {
|
|
741
|
-
var _item$URL2;
|
|
742
|
-
item.URL = (item === null || item === void 0 ? void 0 : (_item$URL2 = item.URL) === null || _item$URL2 === void 0 ? void 0 : _item$URL2.replace(re, '')) || '';
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
};
|
|
746
|
-
useEffect(() => {
|
|
747
|
-
if (attached !== null && attached !== void 0 && attached.length) {
|
|
748
|
-
attached.length = 0;
|
|
749
|
-
}
|
|
750
|
-
return () => {
|
|
751
|
-
existClickOutOfItem.current = false;
|
|
752
|
-
};
|
|
753
|
-
}, []);
|
|
754
|
-
useEffect(() => {
|
|
755
|
-
setViewTypeState(viewType);
|
|
756
|
-
}, [viewType]);
|
|
757
|
-
useEffect(() => {
|
|
758
|
-
if (maxSize) {
|
|
759
|
-
if (!isNaN(maxSize)) {
|
|
760
|
-
maxSizeRef.current = maxSize * 1024 * 1024;
|
|
761
|
-
} else {
|
|
762
|
-
const [numberSize = ''] = maxSize.match(/\d+/) || [];
|
|
763
|
-
const [unitMaxSize = ''] = maxSize.match(/\D+/) || [];
|
|
764
|
-
maxSizeRef.current = getBit(numberSize, unitMaxSize);
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
return () => {
|
|
768
|
-
maxSizeRef.current = Infinity;
|
|
769
|
-
};
|
|
770
|
-
}, [maxSize]);
|
|
771
|
-
useEffect(() => {
|
|
772
|
-
if (multiple && maxFile > 1) attachmentInputRef.current.multiple = multiple;
|
|
773
|
-
}, [multiple, maxFile]);
|
|
774
|
-
useEffect(() => {
|
|
775
|
-
if (accept && typeof accept === 'string') {
|
|
776
|
-
attachmentInputRef.current.accept = `${accept}/*`.replace('/*/*', '/*');
|
|
777
|
-
}
|
|
778
|
-
}, [accept]);
|
|
779
|
-
useEffect(() => {
|
|
780
|
-
oldAttached.length = 0;
|
|
781
|
-
// afterChangeFile((data?.length || 0) + (newDataState?.length || 0));
|
|
782
|
-
if (data !== null && data !== void 0 && data.length && !(dataState !== null && dataState !== void 0 && dataState.length) && !(newDataState !== null && newDataState !== void 0 && newDataState.length)) {
|
|
783
|
-
// Load files data was uploaded
|
|
784
|
-
const length = data.length;
|
|
785
|
-
for (let i = 0; i < length; i++) {
|
|
786
|
-
if (Object.prototype.toString.call(data[i]) === '[object File]') {
|
|
787
|
-
allNewAttached.append('files', data[i]);
|
|
788
|
-
attached.push(data[i]);
|
|
789
|
-
} else {
|
|
790
|
-
const item = mountDomain(data[i]);
|
|
791
|
-
oldAttached.push(item);
|
|
792
|
-
attached.push(item);
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
setDataState(data);
|
|
796
|
-
setTimeout(() => {
|
|
797
|
-
setNewDataState([]);
|
|
798
|
-
});
|
|
799
|
-
} else if ((data === null || data === void 0 ? void 0 : data.length) === 0) {
|
|
800
|
-
setDataState([]);
|
|
801
|
-
setTimeout(() => {
|
|
802
|
-
setNewDataState([]);
|
|
803
|
-
});
|
|
804
|
-
}
|
|
805
|
-
return () => {
|
|
806
|
-
oldAttached.length = 0;
|
|
807
|
-
attached.length = 0;
|
|
808
|
-
chosenItems.length = 0;
|
|
809
|
-
allNewAttached.delete('files');
|
|
810
|
-
if (attachmentInputRef.current) {
|
|
811
|
-
attachmentInputRef.current.value = '';
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
|
-
}, [data]);
|
|
815
|
-
useEffect(() => {
|
|
816
|
-
if (inputProps && Object.keys(inputProps).length) {
|
|
817
|
-
Object.keys(inputProps).forEach(name => {
|
|
818
|
-
if (typeof inputProps[name] === 'boolean') {
|
|
819
|
-
attachmentInputRef.current[name] = inputProps[name];
|
|
820
|
-
} else {
|
|
821
|
-
attachmentInputRef.current.setAttribute(name, inputProps[name]);
|
|
822
|
-
}
|
|
823
|
-
});
|
|
824
|
-
return () => {
|
|
825
|
-
if (attachmentInputRef.current) {
|
|
826
|
-
Object.keys(inputProps).forEach(name => {
|
|
827
|
-
if (typeof inputProps[name] === 'boolean') {
|
|
828
|
-
attachmentInputRef.current[name] = false;
|
|
829
|
-
} else {
|
|
830
|
-
attachmentInputRef.current.removeAttribute(name);
|
|
831
|
-
}
|
|
832
|
-
});
|
|
833
|
-
}
|
|
834
|
-
};
|
|
835
|
-
}
|
|
836
|
-
}, [inputProps]);
|
|
837
|
-
const triggerClickInput = () => {
|
|
838
|
-
attachmentInputRef.current.click();
|
|
839
|
-
};
|
|
840
|
-
const onDragFileStart = () => {
|
|
841
|
-
attachmentInputRef.current.style.display = 'block';
|
|
842
|
-
};
|
|
843
|
-
const onDropInput = e => {
|
|
844
|
-
attachmentInputRef.current.style.display = 'none';
|
|
845
|
-
e.target.value = null; // Fix not fire onChange when select same file
|
|
846
|
-
};
|
|
847
|
-
// End handler
|
|
848
|
-
|
|
849
|
-
useImperativeHandle(reference, () => {
|
|
850
|
-
stripDomain();
|
|
851
|
-
const currentRef = ref.current || {};
|
|
852
|
-
currentRef.element = ref.current;
|
|
853
|
-
const _instance = {
|
|
854
|
-
oldAttached: oldAttached,
|
|
855
|
-
allNewAttached: newDataState,
|
|
856
|
-
attached: isSpecialCase ? newDataState : [...dataState, ...newDataState],
|
|
857
|
-
clear: confirmPopup => clearAllAttached(confirmPopup),
|
|
858
|
-
openFileDialog: triggerClickInput
|
|
859
|
-
}; // methods
|
|
860
|
-
_instance.__proto__ = {}; // hidden methods
|
|
861
|
-
currentRef.instance = _instance;
|
|
862
|
-
currentRef.oldAttached = oldAttached;
|
|
863
|
-
currentRef.allNewAttached = newDataState;
|
|
864
|
-
currentRef.attached = [...dataState, ...newDataState];
|
|
865
|
-
currentRef.clear = confirmPopup => clearAllAttached(confirmPopup);
|
|
866
|
-
currentRef.openFileDialog = triggerClickInput;
|
|
867
|
-
return currentRef;
|
|
868
|
-
});
|
|
869
|
-
|
|
870
|
-
// Start view
|
|
871
|
-
const AttachHeaderView = jsx("div", {
|
|
872
|
-
css: AttachmentHeaderCSS(theme),
|
|
873
|
-
className: 'DGN-UI-Attachment-Header'
|
|
874
|
-
}, jsx("div", {
|
|
875
|
-
css: _AttachmentInfoCSS
|
|
876
|
-
}, jsx(Label, {
|
|
877
|
-
uppercase: true,
|
|
878
|
-
required: required,
|
|
879
|
-
type: 'h5',
|
|
880
|
-
color: 'text/sub'
|
|
881
|
-
}, label), error ? jsx(HelperText, null, error) : null), jsx("div", {
|
|
882
|
-
css: AttachmentHeaderIconCSS
|
|
883
|
-
}, jsx("div", {
|
|
884
|
-
css: _AttachmentHandleIconCSS,
|
|
885
|
-
ref: attachmentHandleIconRef
|
|
886
|
-
}, jsx(ButtonIcon, {
|
|
887
|
-
viewType: 'ghost',
|
|
888
|
-
className: 'view',
|
|
889
|
-
name: 'view',
|
|
890
|
-
onClick: () => onGetViewItem()
|
|
891
|
-
}), jsx(ButtonIcon, {
|
|
892
|
-
viewType: 'ghost',
|
|
893
|
-
className: 'download',
|
|
894
|
-
name: 'download',
|
|
895
|
-
onClick: _onDownload
|
|
896
|
-
}), allowDelete && isEnable ? jsx(ButtonIcon, {
|
|
897
|
-
viewType: 'ghost',
|
|
898
|
-
className: 'delete',
|
|
899
|
-
name: 'delete',
|
|
900
|
-
onClick: onShowPopup
|
|
901
|
-
}) : null), jsx("div", {
|
|
902
|
-
css: isEmpty ? AttachmentImageEmptyCSS : css`
|
|
903
|
-
margin-right: ${spacing([isSpecialCase ? 0 : 2])};
|
|
904
|
-
`
|
|
905
|
-
}, jsx("div", {
|
|
906
|
-
css: [AttachmentImageCenterCSS, !isEnable && [parseHeight('calc(100% - 32px)'), justifyEnd]]
|
|
907
|
-
}, isEnable ? jsx("div", {
|
|
908
|
-
css: AttachmentImageCenterCSS
|
|
909
|
-
}, jsx(ButtonIcon, {
|
|
910
|
-
css: isEmpty && _ButtonAttachmentCSS,
|
|
911
|
-
circular: isEmpty,
|
|
912
|
-
viewType: isEmpty ? 'text' : 'ghost',
|
|
913
|
-
name: 'Attachment',
|
|
914
|
-
size: isEmpty ? 'extraGiant' : 'medium',
|
|
915
|
-
onClick: triggerClickInput
|
|
916
|
-
}), isEmpty ? jsx(Typography, {
|
|
917
|
-
css: userSelectNone,
|
|
918
|
-
type: 'p3',
|
|
919
|
-
color: 'system/rest'
|
|
920
|
-
}, hintText) : null) : isEmpty ? jsx(Typography, {
|
|
921
|
-
css: userSelectNone,
|
|
922
|
-
type: 'p3',
|
|
923
|
-
color: 'system/rest'
|
|
924
|
-
}, getGlobal('noFileText')) : null)), allowSort && !isEmpty && !isSpecialCase ? jsx(Popover, {
|
|
925
|
-
ref: popoverRef,
|
|
926
|
-
anchor: jsx(ButtonIcon, {
|
|
927
|
-
viewType: 'ghost',
|
|
928
|
-
name: 'Sort',
|
|
929
|
-
style: {
|
|
930
|
-
marginRight: 8
|
|
931
|
-
}
|
|
932
|
-
}),
|
|
933
|
-
anchorOrigin: {
|
|
934
|
-
vertical: 'bottom',
|
|
935
|
-
horizontal: 'right'
|
|
936
|
-
},
|
|
937
|
-
transformOrigin: {
|
|
938
|
-
vertical: 'top',
|
|
939
|
-
horizontal: 'right'
|
|
940
|
-
}
|
|
941
|
-
}, jsx(List, null, jsx(ListItem, {
|
|
942
|
-
onClick: e => onSortElement(e, 'filename')
|
|
943
|
-
}, jsx(ListItemText, null, getGlobal('byName'))), jsx(ListItem, {
|
|
944
|
-
onClick: e => onSortElement(e, 'filetype')
|
|
945
|
-
}, jsx(ListItemText, null, getGlobal('byType'))), jsx(ListItem, {
|
|
946
|
-
onClick: e => onSortElement(e, 'filesize')
|
|
947
|
-
}, jsx(ListItemText, null, getGlobal('bySize'))), jsx(ListItem, {
|
|
948
|
-
onClick: e => onSortElement(e, 'datetime')
|
|
949
|
-
}, jsx(ListItemText, null, getGlobal('byDate'))), jsx(ListItem, {
|
|
950
|
-
onClick: e => onSortElement(e, 'username')
|
|
951
|
-
}, jsx(ListItemText, null, getGlobal('byOwner'))))) : null, !isEmpty && !isSpecialCase ? jsx(ButtonIcon, {
|
|
952
|
-
viewType: 'ghost',
|
|
953
|
-
name: viewTypeIconMap.get(viewTypeState),
|
|
954
|
-
onClick: () => setViewTypeState(viewTypeSwitchMap.get(viewTypeState))
|
|
955
|
-
}) : null));
|
|
956
|
-
const AttachmentInputView = jsx("input", {
|
|
957
|
-
ref: attachmentInputRef,
|
|
958
|
-
type: "file",
|
|
959
|
-
style: {
|
|
960
|
-
display: 'none'
|
|
961
|
-
},
|
|
962
|
-
css: css`
|
|
963
|
-
${positionAbsolute};
|
|
964
|
-
${parseWidthHeight('100%')};
|
|
965
|
-
opacity: 0;
|
|
966
|
-
`,
|
|
967
|
-
className: 'DGN-UI-Attachment-Input',
|
|
968
|
-
title: "",
|
|
969
|
-
onDrop: onDropInput,
|
|
970
|
-
onDragLeave: onDropInput,
|
|
971
|
-
onClick: e => e.target.value = null // Fix not fire onChange when select same file
|
|
972
|
-
,
|
|
973
|
-
onChange: onChangeFiles,
|
|
974
|
-
...inputProps
|
|
975
|
-
});
|
|
976
|
-
const renderAttachmentItemDetail = (item, idx, isNew) => {
|
|
977
|
-
const date = isNew ? new Date() : new Date(item.CreateDate);
|
|
978
|
-
if (isNew) item.CreateDate = date.toISOString();
|
|
979
|
-
const type = getType(item);
|
|
980
|
-
const name = isNew ? item.name : item.FileName;
|
|
981
|
-
const key = (item === null || item === void 0 ? void 0 : item.lastModified) + (item === null || item === void 0 ? void 0 : item.size);
|
|
982
|
-
return jsx(Grid, {
|
|
983
|
-
item: true,
|
|
984
|
-
xs: 12,
|
|
985
|
-
key: idx,
|
|
986
|
-
onClick: e => onChooseItem(e, idx),
|
|
987
|
-
onDoubleClick: e => onView(e.currentTarget, isNew ? null : item.AttachmentID),
|
|
988
|
-
className: classNames('DGN-UI-Attachment-List-Attached-Row', 'attachment-row')
|
|
989
|
-
}, jsx("div", {
|
|
990
|
-
css: [_AttachedItemCSS, AttachedItemDetailCSS(theme)]
|
|
991
|
-
}, jsx("span", {
|
|
992
|
-
css: _AttachedItemInfoCSS
|
|
993
|
-
}, jsx(Icon, {
|
|
994
|
-
css: (item.lastModifiedDate || isNew) && _DotNewFileDetailCSS,
|
|
995
|
-
width: 16,
|
|
996
|
-
height: 16,
|
|
997
|
-
name: type === 'default' ? 'another' : type
|
|
998
|
-
}), jsx("span", {
|
|
999
|
-
css: displayNone,
|
|
1000
|
-
className: 'filetype'
|
|
1001
|
-
}, type), jsx(Typography, {
|
|
1002
|
-
className: 'filename',
|
|
1003
|
-
css: css`
|
|
1004
|
-
margin-left: ${spacing([3])};
|
|
1005
|
-
`,
|
|
1006
|
-
type: 'p1',
|
|
1007
|
-
lineClamp: 1
|
|
1008
|
-
}, name)), jsx("span", {
|
|
1009
|
-
css: _AttachedItemOwnerCSS
|
|
1010
|
-
}, jsx("span", {
|
|
1011
|
-
css: DetailInfoCSS
|
|
1012
|
-
}, jsx(Typography, {
|
|
1013
|
-
className: 'username',
|
|
1014
|
-
type: 'p2',
|
|
1015
|
-
color: 'text/sub'
|
|
1016
|
-
}, (item === null || item === void 0 ? void 0 : item.UserName) || item.lastModifiedDate && ownerName || ''), jsx(Typography, {
|
|
1017
|
-
className: 'datetime',
|
|
1018
|
-
type: 'p2',
|
|
1019
|
-
color: 'text/sub'
|
|
1020
|
-
}, getDateTime(date)), jsx(Typography, {
|
|
1021
|
-
className: 'filesize',
|
|
1022
|
-
type: 'p2',
|
|
1023
|
-
color: 'text/sub'
|
|
1024
|
-
}, calculateSize(item.FileSize || item.size))), isNew ? jsx("span", {
|
|
1025
|
-
css: [_AttachedLinearCSS, displayNone]
|
|
1026
|
-
}, jsx(LinearProgress, {
|
|
1027
|
-
className: `DGN-UI-LinearProgress-${key}`,
|
|
1028
|
-
determinate: true,
|
|
1029
|
-
percent: 0
|
|
1030
|
-
})) : null)));
|
|
1031
|
-
};
|
|
1032
|
-
const renderAttachmentItemIcon = (item, idx, isNew) => {
|
|
1033
|
-
const date = isNew ? new Date() : new Date(item.CreateDate);
|
|
1034
|
-
if (isNew) item.CreateDate = date.toISOString();
|
|
1035
|
-
const type = getType(item);
|
|
1036
|
-
const name = isNew ? item.name : item.FileName;
|
|
1037
|
-
const key = (item === null || item === void 0 ? void 0 : item.lastModified) + (item === null || item === void 0 ? void 0 : item.size);
|
|
1038
|
-
return jsx(Grid, {
|
|
1039
|
-
item: true,
|
|
1040
|
-
xs: 'auto',
|
|
1041
|
-
key: idx,
|
|
1042
|
-
onClick: e => onChooseItem(e, idx),
|
|
1043
|
-
onDoubleClick: e => onView(e.currentTarget, isNew ? null : item.AttachmentID),
|
|
1044
|
-
className: classNames('DGN-UI-Attachment-List-Attached-Row', 'attachment-row')
|
|
1045
|
-
}, jsx("div", {
|
|
1046
|
-
css: _AttachedItemCSS
|
|
1047
|
-
}, jsx("span", {
|
|
1048
|
-
css: AttachedItemIconInfoCSS(theme)
|
|
1049
|
-
}, jsx(Icon, {
|
|
1050
|
-
css: [(item.lastModifiedDate || isNew) && _DotNewFileIconCSS],
|
|
1051
|
-
width: 40,
|
|
1052
|
-
height: 40,
|
|
1053
|
-
name: type === 'default' ? 'another' : type
|
|
1054
|
-
}), jsx(Typography, {
|
|
1055
|
-
className: 'filename',
|
|
1056
|
-
css: [textLeft, parseMaxWidth(64)],
|
|
1057
|
-
type: 'p3',
|
|
1058
|
-
lineClamp: 2
|
|
1059
|
-
}, name), jsx("span", {
|
|
1060
|
-
css: displayNone,
|
|
1061
|
-
className: 'filetype'
|
|
1062
|
-
}, type), jsx("span", {
|
|
1063
|
-
css: displayNone,
|
|
1064
|
-
className: 'username'
|
|
1065
|
-
}, (item === null || item === void 0 ? void 0 : item.UserName) || item.lastModifiedDate && ownerName || ''), jsx("span", {
|
|
1066
|
-
css: displayNone,
|
|
1067
|
-
className: 'datetime'
|
|
1068
|
-
}, getDateTime(date)), jsx("span", {
|
|
1069
|
-
css: displayNone,
|
|
1070
|
-
className: 'filesize'
|
|
1071
|
-
}, calculateSize(item.FileSize || item.size))), isNew ? jsx("span", {
|
|
1072
|
-
css: [_AttachedLinearCSS, displayNone]
|
|
1073
|
-
}, jsx(LinearProgress, {
|
|
1074
|
-
className: `DGN-UI-LinearProgress-${key}`,
|
|
1075
|
-
determinate: true,
|
|
1076
|
-
percent: 0
|
|
1077
|
-
})) : null));
|
|
1078
|
-
};
|
|
1079
|
-
const updateSize = () => {
|
|
1080
|
-
if (timer.current) {
|
|
1081
|
-
clearTimeout(timer.current);
|
|
1082
|
-
}
|
|
1083
|
-
timer.current = setTimeout(() => {
|
|
1084
|
-
if (ref.current) {
|
|
1085
|
-
setSizeByHeight(ref.current.offsetHeight < ref.current.offsetWidth);
|
|
1086
|
-
}
|
|
1087
|
-
}, 300);
|
|
1088
|
-
};
|
|
1089
|
-
useLayoutEffect(() => {
|
|
1090
|
-
window.addEventListener('resize', updateSize);
|
|
1091
|
-
updateSize();
|
|
1092
|
-
return () => window.removeEventListener('resize', updateSize);
|
|
1093
|
-
}, []);
|
|
1094
|
-
const renderAttachmentItemPicture = (item, idx, isNew) => {
|
|
1095
|
-
const date = isNew ? new Date() : new Date(item.CreateDate);
|
|
1096
|
-
if (isNew) item.CreateDate = date.toISOString();
|
|
1097
|
-
const type = getType(item);
|
|
1098
|
-
const name = isNew ? item.name : item.FileName;
|
|
1099
|
-
const key = (item === null || item === void 0 ? void 0 : item.lastModified) + (item === null || item === void 0 ? void 0 : item.size);
|
|
1100
|
-
const isTypeImage = type === 'image';
|
|
1101
|
-
const isSpecialByHeight = sizeByHeight && isSpecialCase;
|
|
1102
|
-
const specialBreakpointColumn = isSpecialByHeight ? 'auto' : 12;
|
|
1103
|
-
return jsx(Grid, {
|
|
1104
|
-
item: true,
|
|
1105
|
-
xs: isSpecialCase ? specialBreakpointColumn : 6,
|
|
1106
|
-
sm: isSpecialCase ? specialBreakpointColumn : 4,
|
|
1107
|
-
md: isSpecialCase ? specialBreakpointColumn : 3,
|
|
1108
|
-
lg: isSpecialCase ? specialBreakpointColumn : 2,
|
|
1109
|
-
xl: isSpecialCase ? specialBreakpointColumn : 2,
|
|
1110
|
-
key: idx,
|
|
1111
|
-
onClick: e => onChooseItem(e, idx),
|
|
1112
|
-
onDoubleClick: e => onView(e.currentTarget, isNew ? null : item.AttachmentID),
|
|
1113
|
-
className: classNames('DGN-UI-Attachment-List-Attached-Row', 'attachment-row')
|
|
1114
|
-
}, jsx("div", {
|
|
1115
|
-
css: [_AttachedItemPictureCSS, !isTypeImage && AttachedItemPictureImageCSS, isSpecialByHeight && parseWidthHeight(height - 56 - 8 - 2)]
|
|
1116
|
-
}, isTypeImage ? jsx(Image, {
|
|
1117
|
-
square: true,
|
|
1118
|
-
src: item.URL,
|
|
1119
|
-
width: isSpecialByHeight ? 'auto' : '100%',
|
|
1120
|
-
height: isSpecialByHeight ? '100%' : 'auto'
|
|
1121
|
-
}) : jsx(Icon, {
|
|
1122
|
-
css: parseWidthHeight('100%'),
|
|
1123
|
-
name: type === 'default' ? 'another' : type,
|
|
1124
|
-
width: '50%',
|
|
1125
|
-
height: '50%'
|
|
1126
|
-
}), jsx(Typography, {
|
|
1127
|
-
css: _ItemPictureInfoCSS,
|
|
1128
|
-
type: 'p2',
|
|
1129
|
-
color: 'text/tooltip',
|
|
1130
|
-
lineClamp: 10,
|
|
1131
|
-
className: 'DGN-UI-Attachment-Item-Picture-Info'
|
|
1132
|
-
}, name), jsx("span", {
|
|
1133
|
-
css: displayNone,
|
|
1134
|
-
className: 'filetype'
|
|
1135
|
-
}, type), jsx("span", {
|
|
1136
|
-
css: displayNone,
|
|
1137
|
-
className: 'filename'
|
|
1138
|
-
}, name), jsx("span", {
|
|
1139
|
-
css: displayNone,
|
|
1140
|
-
className: 'username'
|
|
1141
|
-
}, (item === null || item === void 0 ? void 0 : item.UserName) || item.lastModifiedDate && ownerName || ''), jsx("span", {
|
|
1142
|
-
css: displayNone,
|
|
1143
|
-
className: 'datetime'
|
|
1144
|
-
}, getDateTime(date)), jsx("span", {
|
|
1145
|
-
css: displayNone,
|
|
1146
|
-
className: 'filesize'
|
|
1147
|
-
}, calculateSize(item.FileSize || item.size)), isNew ? jsx("span", {
|
|
1148
|
-
css: [_AttachedLinearCSS, displayNone]
|
|
1149
|
-
}, jsx(LinearProgress, {
|
|
1150
|
-
className: `DGN-UI-LinearProgress-${key}`,
|
|
1151
|
-
determinate: true,
|
|
1152
|
-
percent: 0
|
|
1153
|
-
})) : null));
|
|
1154
|
-
};
|
|
1155
|
-
const renderAttachmentItem = (item, idx, isNew = false) => {
|
|
1156
|
-
if (!item) return;
|
|
1157
|
-
const date = isNew ? new Date() : new Date(item.CreateDate);
|
|
1158
|
-
if (isNew) item.CreateDate = date.toISOString();
|
|
1159
|
-
return viewTypeState === 'detail' ? renderAttachmentItemDetail(item, idx, isNew) : viewTypeState === 'icon' ? renderAttachmentItemIcon(item, idx, isNew) : renderAttachmentItemPicture(item, idx, isNew);
|
|
1160
|
-
};
|
|
1161
|
-
const AttachedView = useMemo(() => {
|
|
1162
|
-
return jsx(ScrollBar, {
|
|
1163
|
-
css: _AttachmentListCSS,
|
|
1164
|
-
className: 'DGN-UI-Attachment-List'
|
|
1165
|
-
}, jsx(Grid, {
|
|
1166
|
-
container: true,
|
|
1167
|
-
css: isSpecialCase && justifyCenter,
|
|
1168
|
-
ref: attachedRef,
|
|
1169
|
-
className: classNames('DGN-UI-Attachment-List-Attached'),
|
|
1170
|
-
spacing: 2
|
|
1171
|
-
}, dataState.map((item, idx) => {
|
|
1172
|
-
return renderAttachmentItem(mountDomain(item), idx);
|
|
1173
|
-
}), newDataState.map((item, idx) => {
|
|
1174
|
-
return renderAttachmentItem(mountDomain(item), (dataState === null || dataState === void 0 ? void 0 : dataState.length) + idx, true);
|
|
1175
|
-
})));
|
|
1176
|
-
}, [data, domain, onViewProp, unitSize, dataState, newDataState, viewTypeState, sizeByHeight, theme]);
|
|
1177
|
-
const PopupView = jsx(Popup, {
|
|
1178
|
-
open: showPopup,
|
|
1179
|
-
ref: popupRef,
|
|
1180
|
-
type: 'yesno',
|
|
1181
|
-
description: deleteNotifyText,
|
|
1182
|
-
pressESCToClose: true,
|
|
1183
|
-
onClose: onClosePopup,
|
|
1184
|
-
onConfirm: onRemoveMultiple,
|
|
1185
|
-
onCancel: onClosePopup
|
|
1186
|
-
});
|
|
1187
|
-
const ModalView = useMemo(() => {
|
|
1188
|
-
if (!chosenItems.length) return setShowModal(false);
|
|
1189
|
-
const index = chosenItems[0];
|
|
1190
|
-
const data = mountDomain([...dataState, ...newDataState][index]);
|
|
1191
|
-
const dataType = getType(data);
|
|
1192
|
-
if (isBase64URL(data === null || data === void 0 ? void 0 : data.URL) && !['image', 'pdf'].includes(dataType)) setShowModal(false);
|
|
1193
|
-
|
|
1194
|
-
// let data = oldAttached[index] || allNewAttached.getAll('files')[index-oldAttached.length];
|
|
1195
|
-
return jsx(ModalSample, {
|
|
1196
|
-
open: showModal,
|
|
1197
|
-
title: data === null || data === void 0 ? void 0 : data.FileName,
|
|
1198
|
-
onClose: () => setShowModal(false)
|
|
1199
|
-
}, jsx(Slider, null, jsx(SliderItem, {
|
|
1200
|
-
dataType: dataType,
|
|
1201
|
-
url: data === null || data === void 0 ? void 0 : data.URL
|
|
1202
|
-
})));
|
|
1203
|
-
}, [domain, showModal]);
|
|
1204
|
-
const NotifyView = jsx(Notify, {
|
|
1205
|
-
ref: notifyRef,
|
|
1206
|
-
progressing: true,
|
|
1207
|
-
autoDisappear: true,
|
|
1208
|
-
color: 'danger'
|
|
1209
|
-
});
|
|
1210
|
-
// End view
|
|
1211
|
-
|
|
1212
|
-
return jsx("div", {
|
|
1213
|
-
ref: ref,
|
|
1214
|
-
css: _AttachmentRootCSS,
|
|
1215
|
-
id: id,
|
|
1216
|
-
className: classNames('DGN-UI-Attachment', className),
|
|
1217
|
-
style: style,
|
|
1218
|
-
onDragEnter: onDragFileStart
|
|
1219
|
-
}, AttachHeaderView, AttachedView, AttachmentInputView, PopupView, ModalView, NotifyView);
|
|
1220
|
-
}));
|
|
1221
|
-
const AttachmentHandleIconCSS = ({
|
|
1222
|
-
colors,
|
|
1223
|
-
spacing
|
|
1224
|
-
}) => css`
|
|
1225
|
-
${displayNone};
|
|
1226
|
-
${parseHeight(24)};
|
|
1227
|
-
margin-right: ${spacing([2])};
|
|
1228
|
-
${borderRight(1, getProp(colors, 'line/normal'))};
|
|
1229
|
-
button {
|
|
1230
|
-
margin-right: ${spacing([2])};
|
|
1231
|
-
}
|
|
1232
|
-
`;
|
|
1233
|
-
const AttachmentHeaderCSS = ({
|
|
1234
|
-
spacing
|
|
1235
|
-
}) => css`
|
|
1236
|
-
${displayFlex};
|
|
1237
|
-
${itemsCenter};
|
|
1238
|
-
${justifyBetween};
|
|
1239
|
-
${boxBorder};
|
|
1240
|
-
${parseWidth('100%')};
|
|
1241
|
-
padding: ${spacing([4, 4])};
|
|
1242
|
-
`;
|
|
1243
|
-
const AttachmentInfoCSS = ({
|
|
1244
|
-
spacing
|
|
1245
|
-
}) => css`
|
|
1246
|
-
${displayFlex};
|
|
1247
|
-
gap: ${spacing([2])};
|
|
1248
|
-
`;
|
|
1249
|
-
const AttachmentHeaderIconCSS = css`
|
|
1250
|
-
${displayFlex};
|
|
1251
|
-
${itemsCenter};
|
|
1252
|
-
`;
|
|
1253
|
-
const AttachmentImageCenterCSS = css`
|
|
1254
|
-
${displayFlex};
|
|
1255
|
-
${flexCol};
|
|
1256
|
-
${justifyCenter};
|
|
1257
|
-
${itemsCenter};
|
|
1258
|
-
${parseWidthHeight('100%')};
|
|
1259
|
-
`;
|
|
1260
|
-
const ButtonAttachmentCSS = ({
|
|
1261
|
-
colors,
|
|
1262
|
-
spacing
|
|
1263
|
-
}) => css`
|
|
1264
|
-
${border(1, getProp(colors, 'line/normal'))};
|
|
1265
|
-
${borderDashed};
|
|
1266
|
-
margin: ${spacing([0, 'auto', 4])};
|
|
1267
|
-
`;
|
|
1268
|
-
const AttachmentImageEmptyCSS = css`
|
|
1269
|
-
${positionAbsolute};
|
|
1270
|
-
${parseWidthHeight('100%')};
|
|
1271
|
-
${top(0)};
|
|
1272
|
-
${left(0)};
|
|
1273
|
-
`;
|
|
1274
|
-
const AttachedItemInfoCSS = ({
|
|
1275
|
-
spacing
|
|
1276
|
-
}) => css`
|
|
1277
|
-
${displayFlex};
|
|
1278
|
-
${itemsCenter};
|
|
1279
|
-
${userSelectNone};
|
|
1280
|
-
${parseMinWidth('calc(50% - 10px)')};
|
|
1281
|
-
margin-right: ${spacing([2])};
|
|
1282
|
-
`;
|
|
1283
|
-
const DotNewFileDetailCSS = ({
|
|
1284
|
-
colors
|
|
1285
|
-
}) => css`
|
|
1286
|
-
:after {
|
|
1287
|
-
content: '';
|
|
1288
|
-
${positionAbsolute};
|
|
1289
|
-
${borderRadius50};
|
|
1290
|
-
${parseWidthHeight(4, 4)};
|
|
1291
|
-
${bgColor(getProp(colors, 'semantic/success'))};
|
|
1292
|
-
${top(0)};
|
|
1293
|
-
${left(4)};
|
|
1294
|
-
}
|
|
1295
|
-
`;
|
|
1296
|
-
const DotNewFileIconCSS = ({
|
|
1297
|
-
colors
|
|
1298
|
-
}) => css`
|
|
1299
|
-
:after {
|
|
1300
|
-
content: '';
|
|
1301
|
-
${positionAbsolute};
|
|
1302
|
-
${borderRadius50};
|
|
1303
|
-
${parseWidthHeight(6, 6)};
|
|
1304
|
-
${bgColor(getProp(colors, 'semantic/success'))};
|
|
1305
|
-
${top(3)};
|
|
1306
|
-
${left(14)};
|
|
1307
|
-
}
|
|
1308
|
-
`;
|
|
1309
|
-
const AttachedItemOwnerCSS = ({
|
|
1310
|
-
colors
|
|
1311
|
-
}) => css`
|
|
1312
|
-
${displayFlex};
|
|
1313
|
-
${positionRelative};
|
|
1314
|
-
${itemsCenter};
|
|
1315
|
-
${userSelectNone};
|
|
1316
|
-
${parseHeight('100%')};
|
|
1317
|
-
${textColor(getProp(colors, 'text/sub'))};
|
|
1318
|
-
`;
|
|
1319
|
-
const DetailInfoCSS = css`
|
|
1320
|
-
${displayFlex};
|
|
1321
|
-
${parseMinWidth(333)};
|
|
1322
|
-
.username {
|
|
1323
|
-
${displayInlineBlock};
|
|
1324
|
-
${truncate};
|
|
1325
|
-
${parseMinWidth(120)};
|
|
1326
|
-
${parseMaxWidth(120)};
|
|
1327
|
-
}
|
|
1328
|
-
.datetime {
|
|
1329
|
-
${displayInlineBlock};
|
|
1330
|
-
${parseMinWidth('max-content')};
|
|
1331
|
-
${parseMaxWidth('max-content')};
|
|
1332
|
-
}
|
|
1333
|
-
.filesize {
|
|
1334
|
-
${floatRight};
|
|
1335
|
-
${textRight};
|
|
1336
|
-
margin-left: auto;
|
|
1337
|
-
}
|
|
1338
|
-
`;
|
|
1339
|
-
const AttachedLinearCSS = ({
|
|
1340
|
-
colors
|
|
1341
|
-
}) => css`
|
|
1342
|
-
${displayFlex};
|
|
1343
|
-
${positionAbsolute};
|
|
1344
|
-
${itemsCenter};
|
|
1345
|
-
${bgColor(getProp(colors, 'system/standard'))};
|
|
1346
|
-
${parseWidthHeight('100%')};
|
|
1347
|
-
${top(0)};
|
|
1348
|
-
`;
|
|
1349
|
-
const AttachedItemCSS = ({
|
|
1350
|
-
colors
|
|
1351
|
-
}) => css`
|
|
1352
|
-
${positionRelative};
|
|
1353
|
-
${borderRadius4px};
|
|
1354
|
-
${cursorPointer};
|
|
1355
|
-
transition: padding 0.5s ease;
|
|
1356
|
-
&:hover {
|
|
1357
|
-
${bgColor(getProp(colors, 'fill/hover'))};
|
|
1358
|
-
}
|
|
1359
|
-
&:active {
|
|
1360
|
-
${bgColor(getProp(colors, 'fill/pressed'))};
|
|
1361
|
-
}
|
|
1362
|
-
&.chosen {
|
|
1363
|
-
${bgColor(getProp(colors, 'fill/focus'))};
|
|
1364
|
-
}
|
|
1365
|
-
`;
|
|
1366
|
-
const AttachedItemDetailCSS = ({
|
|
1367
|
-
spacing
|
|
1368
|
-
}) => css`
|
|
1369
|
-
${displayFlex};
|
|
1370
|
-
${justifyBetween};
|
|
1371
|
-
${itemsCenter};
|
|
1372
|
-
${parseMinHeight(24)};
|
|
1373
|
-
padding: ${spacing([0, 2])};
|
|
1374
|
-
`;
|
|
1375
|
-
const AttachedItemIconInfoCSS = ({
|
|
1376
|
-
spacing
|
|
1377
|
-
}) => css`
|
|
1378
|
-
${displayFlex};
|
|
1379
|
-
${flexCol};
|
|
1380
|
-
${itemsCenter};
|
|
1381
|
-
${positionRelative};
|
|
1382
|
-
${textCenter};
|
|
1383
|
-
padding: ${spacing([1, 2])};
|
|
1384
|
-
`;
|
|
1385
|
-
const AttachmentListCSS = ({
|
|
1386
|
-
spacing
|
|
1387
|
-
}) => css`
|
|
1388
|
-
${boxBorder};
|
|
1389
|
-
margin-right: ${spacing([1.25])};
|
|
1390
|
-
padding: ${spacing([0, 1, 2, 4])};
|
|
1391
|
-
overflow-y: scroll;
|
|
1392
|
-
`;
|
|
1393
|
-
const AttachmentRootCSS = (isEmpty, isEnable, height, {
|
|
1394
|
-
colors
|
|
1395
|
-
}) => css`
|
|
1396
|
-
${displayFlex};
|
|
1397
|
-
${flexCol};
|
|
1398
|
-
${justifyStart};
|
|
1399
|
-
${positionRelative};
|
|
1400
|
-
${borderRadius4px};
|
|
1401
|
-
${boxBorder};
|
|
1402
|
-
${border(1, getProp(colors, 'line/normal'))};
|
|
1403
|
-
${parseMinHeight(isEmpty && !isEnable ? 120 : isEmpty ? 280 : null)};
|
|
1404
|
-
${parseHeight(height)};
|
|
1405
|
-
${bgColor(getProp(colors, 'system/standard'))};
|
|
1406
|
-
`;
|
|
1407
|
-
const AttachedItemPictureCSS = ({
|
|
1408
|
-
colors
|
|
1409
|
-
}) => css`
|
|
1410
|
-
${displayFlex};
|
|
1411
|
-
${positionRelative};
|
|
1412
|
-
${boxBorder};
|
|
1413
|
-
${borderRadius4px};
|
|
1414
|
-
${cursorPointer};
|
|
1415
|
-
${overflowHidden};
|
|
1416
|
-
${userSelectNone};
|
|
1417
|
-
${border(1, getProp(colors, 'line/category'))};
|
|
1418
|
-
&:focus,
|
|
1419
|
-
&:active,
|
|
1420
|
-
&.chosen {
|
|
1421
|
-
${border(2, getProp(colors, 'line/focus'))};
|
|
1422
|
-
}
|
|
1423
|
-
&:not(:hover) {
|
|
1424
|
-
.DGN-UI-Attachment-Item-Picture-Info {
|
|
1425
|
-
${displayNone};
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
`;
|
|
1429
|
-
const AttachedItemPictureImageCSS = css`
|
|
1430
|
-
${itemsCenter};
|
|
1431
|
-
${justifyCenter};
|
|
1432
|
-
${aspectSquare};
|
|
1433
|
-
`;
|
|
1434
|
-
const ItemPictureInfoCSS = ({
|
|
1435
|
-
colors,
|
|
1436
|
-
spacing
|
|
1437
|
-
}) => css`
|
|
1438
|
-
${positionAbsolute};
|
|
1439
|
-
${boxBorder};
|
|
1440
|
-
${bottom(0)};
|
|
1441
|
-
${left(0)};
|
|
1442
|
-
padding: ${spacing([1, 2])};
|
|
1443
|
-
${bgColor(getProp(colors, 'fill/tooltip'))};
|
|
1444
|
-
${parseWidth('100%')};
|
|
1445
|
-
`;
|
|
1446
|
-
|
|
1447
|
-
// Attachment.defaultProps = {
|
|
1448
|
-
// allowDelete: true,
|
|
1449
|
-
// allowSort: true,
|
|
1450
|
-
// className: '',
|
|
1451
|
-
// data: [],
|
|
1452
|
-
// disabled: false,
|
|
1453
|
-
// height: 280,
|
|
1454
|
-
// maxFile: Infinity,
|
|
1455
|
-
// multiple: true,
|
|
1456
|
-
// style: {},
|
|
1457
|
-
// viewType: 'detail',
|
|
1458
|
-
// };
|
|
1459
|
-
|
|
1460
|
-
Attachment.propTypes = {
|
|
1461
|
-
/** File types that can be accepted. */
|
|
1462
|
-
accept: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
|
|
1463
|
-
/** If `true`, allow delete attachment. */
|
|
1464
|
-
allowDelete: PropTypes.bool,
|
|
1465
|
-
/** If `true`, allow sort. */
|
|
1466
|
-
allowSort: PropTypes.bool,
|
|
1467
|
-
/** Class for component. */
|
|
1468
|
-
className: PropTypes.string,
|
|
1469
|
-
/** List attachment:<br />
|
|
1470
|
-
* [{<br />
|
|
1471
|
-
* "AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
|
|
1472
|
-
* "URL": "https://apricot.diginet.com.vn/cdn-dev/file/demo.jpg",<br />
|
|
1473
|
-
* "FileName": "8a07bee1eeff17a14eee.jpg",<br />
|
|
1474
|
-
* "FileSize": 248837,<br />
|
|
1475
|
-
* "KeyID": "W39OAD3YGLCWAQKV1D6PGEKNW4RLGVTZTUWLYEVFQ2QG8AOCXW",<br />
|
|
1476
|
-
* "CreateUserID": "LEMONADMIN",<br />
|
|
1477
|
-
* "CreateDate": "2020-08-24T11:54:04.307Z",<br />
|
|
1478
|
-
* "UserName": "Quản trị hệ thống"<br />
|
|
1479
|
-
* }, ...]
|
|
1480
|
-
*/
|
|
1481
|
-
data: PropTypes.array,
|
|
1482
|
-
/** The message to display when deleting files. */
|
|
1483
|
-
deleteNotifyText: PropTypes.string,
|
|
1484
|
-
/** If `true`, the component is disabled. */
|
|
1485
|
-
disabled: PropTypes.bool,
|
|
1486
|
-
/** Domain of attachments. */
|
|
1487
|
-
domain: PropTypes.string,
|
|
1488
|
-
/** Error of attachment. */
|
|
1489
|
-
error: PropTypes.string,
|
|
1490
|
-
/** Height of the component. */
|
|
1491
|
-
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
1492
|
-
/** Suggested passage attached. */
|
|
1493
|
-
hintText: PropTypes.string,
|
|
1494
|
-
/** [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attributes) applied to the input element. */
|
|
1495
|
-
inputProps: PropTypes.object,
|
|
1496
|
-
/** If `true`, strip domain of attachments. */
|
|
1497
|
-
isStripDomain: PropTypes.bool,
|
|
1498
|
-
/** Label of the component. */
|
|
1499
|
-
label: PropTypes.string,
|
|
1500
|
-
/** Limit the number of uploaded files. */
|
|
1501
|
-
maxFile: PropTypes.number,
|
|
1502
|
-
/** Limit the size of uploaded files. */
|
|
1503
|
-
maxSize: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
1504
|
-
/** Allows to attach multiple files. */
|
|
1505
|
-
multiple: PropTypes.bool,
|
|
1506
|
-
/** Callback fired when the files attached is changed. */
|
|
1507
|
-
onChange: PropTypes.func,
|
|
1508
|
-
/** Download attached event, if not it will use default. */
|
|
1509
|
-
onDownload: PropTypes.func,
|
|
1510
|
-
/**
|
|
1511
|
-
* event when removed file(s)
|
|
1512
|
-
*
|
|
1513
|
-
* return data: {<br/>
|
|
1514
|
-
* attached: [Files] (insist old and all new files )<br/>
|
|
1515
|
-
* allNewAttached: [Files]<br/>
|
|
1516
|
-
* oldAttached: [Files]<br/>
|
|
1517
|
-
* removedAttached: [Files]<br/>
|
|
1518
|
-
* element: [NodeList (just removed)]<br/>
|
|
1519
|
-
* }
|
|
1520
|
-
*/
|
|
1521
|
-
onRemove: PropTypes.func,
|
|
1522
|
-
/** View attached event, if not it will use default. */
|
|
1523
|
-
onView: PropTypes.func,
|
|
1524
|
-
/** Name of the person who attached the file when uploading the file. */
|
|
1525
|
-
ownerName: PropTypes.string,
|
|
1526
|
-
/** At least one attachment is required. */
|
|
1527
|
-
required: PropTypes.bool,
|
|
1528
|
-
/** Style inline of component. */
|
|
1529
|
-
style: PropTypes.object,
|
|
1530
|
-
/** Unit size name, default auto-detect. */
|
|
1531
|
-
unitSize: PropTypes.string,
|
|
1532
|
-
/** Errors show up when the file upload is corrupted. */
|
|
1533
|
-
uploadErrorInfo: PropTypes.object,
|
|
1534
|
-
/** The view type of files. */
|
|
1535
|
-
viewType: PropTypes.oneOf(['detail', 'icon', 'picture'])
|
|
1536
|
-
};
|
|
1537
|
-
export default Attachment;
|