diginet-core-ui 1.3.24
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/assets/avatar/default.svg +3 -0
- package/assets/images/menu/dhr/Default.svg +13 -0
- package/assets/images/menu/dhr/MHRM00N0001.svg +14 -0
- package/assets/images/menu/dhr/MHRM09N0001.svg +1 -0
- package/assets/images/menu/dhr/MHRM09N0002.svg +3 -0
- package/assets/images/menu/dhr/MHRM09N0003.svg +25 -0
- package/assets/images/menu/dhr/MHRM25N0001.svg +26 -0
- package/assets/images/menu/dhr/MHRM29N0001.svg +30 -0
- package/assets/images/menu/dhr/MHRM29N0015.svg +63 -0
- package/assets/images/menu/dhr/MHRM39N0012.svg +43 -0
- package/assets/images/menu/dhr/MHRM39N0013.svg +24 -0
- package/assets/images/menu/dhr/MHRM39N0014.svg +14 -0
- package/assets/images/menu/dhr/MHRM39N0015.svg +36 -0
- package/assets/images/menu/dhr/MHRM39N0016.svg +23 -0
- package/assets/images/menu/dhr/MHRM77N0001.svg +28 -0
- package/assets/images/menu/dhr/MHRM84N0001.svg +27 -0
- package/assets/images/menu/dhr/MHRM84N0002.svg +24 -0
- package/assets/images/menu/dhr/MHRM89N0001.svg +16 -0
- package/assets/images/menu/dhr/MHRP00N0001.svg +10 -0
- package/assets/images/menu/dhr/MHRP09N0001.svg +22 -0
- package/assets/images/menu/dhr/MHRP09N0002.svg +19 -0
- package/assets/images/menu/dhr/MHRP09N0003.svg +12 -0
- package/assets/images/menu/dhr/MHRP09N0004.svg +6 -0
- package/assets/images/menu/dhr/MHRP09N0005.svg +10 -0
- package/assets/images/menu/dhr/MHRP09N0006.svg +17 -0
- package/assets/images/menu/dhr/MHRP09N0007.svg +15 -0
- package/assets/images/menu/dhr/MHRP09N0008.svg +8 -0
- package/assets/images/menu/dhr/MHRP09N0009.svg +10 -0
- package/assets/images/menu/dhr/MHRP09N0010.svg +12 -0
- package/assets/images/menu/dhr/MHRP09N0011.svg +16 -0
- package/assets/images/menu/dhr/MHRP09N0012.svg +6 -0
- package/assets/images/menu/dhr/MHRP09N0013.svg +8 -0
- package/assets/images/menu/dhr/MHRP09N0014.svg +11 -0
- package/assets/images/menu/dhr/MHRP09N0015.svg +12 -0
- package/assets/images/menu/dhr/MHRP09N0016.svg +18 -0
- package/assets/images/menu/dhr/MHRP09N0017.svg +18 -0
- package/assets/images/menu/dhr/MHRP09N0018.svg +12 -0
- package/assets/images/menu/dhr/MHRP09N0019.svg +13 -0
- package/assets/images/menu/dhr/MHRP09N0020.svg +17 -0
- package/assets/images/menu/dhr/MHRP09N0021.svg +10 -0
- package/assets/images/menu/dhr/MHRP09N0022.svg +16 -0
- package/assets/images/menu/dhr/MHRP09N0023.svg +8 -0
- package/assets/images/menu/dhr/MHRP09N0024.svg +15 -0
- package/assets/images/menu/dhr/MHRP09N0025.svg +16 -0
- package/assets/images/menu/dhr/MHRP09N0026.svg +13 -0
- package/assets/images/menu/dhr/MHRP09N0027.svg +10 -0
- package/assets/images/menu/dhr/MHRP13N0001.svg +9 -0
- package/assets/images/menu/dhr/MHRP21N0001.svg +12 -0
- package/assets/images/menu/dhr/MHRP21N0002.svg +13 -0
- package/assets/images/menu/dhr/MHRP25N0001.svg +13 -0
- package/assets/images/menu/dhr/MHRP25N0002.svg +16 -0
- package/assets/images/menu/dhr/MHRP25N0003.svg +38 -0
- package/assets/images/menu/dhr/MHRP25N0004.svg +17 -0
- package/assets/images/menu/dhr/MHRP25N0005.svg +20 -0
- package/assets/images/menu/dhr/MHRP29N0001.svg +18 -0
- package/assets/images/menu/dhr/MHRP29N0002.svg +15 -0
- package/assets/images/menu/dhr/MHRP29N0003.svg +20 -0
- package/assets/images/menu/dhr/MHRP29N0004.svg +21 -0
- package/assets/images/menu/dhr/MHRP29N0005.svg +21 -0
- package/assets/images/menu/dhr/MHRP29N0006.svg +14 -0
- package/assets/images/menu/dhr/MHRP29N0007.svg +19 -0
- package/assets/images/menu/dhr/MHRP29N0008.svg +20 -0
- package/assets/images/menu/dhr/MHRP29N0009.svg +11 -0
- package/assets/images/menu/dhr/MHRP29N0010.svg +11 -0
- package/assets/images/menu/dhr/MHRP29N0011.svg +12 -0
- package/assets/images/menu/dhr/MHRP29N0013.svg +27 -0
- package/assets/images/menu/dhr/MHRP29N0014.svg +32 -0
- package/assets/images/menu/dhr/MHRP29N0016.svg +54 -0
- package/assets/images/menu/dhr/MHRP29N0017.svg +24 -0
- package/assets/images/menu/dhr/MHRP29N0018.svg +44 -0
- package/assets/images/menu/dhr/MHRP29N0019.svg +17 -0
- package/assets/images/menu/dhr/MHRP29N0020.svg +11 -0
- package/assets/images/menu/dhr/MHRP38N0001.svg +13 -0
- package/assets/images/menu/dhr/MHRP38N0002.svg +14 -0
- package/assets/images/menu/dhr/MHRP39N0001.svg +15 -0
- package/assets/images/menu/dhr/MHRP39N0002.svg +13 -0
- package/assets/images/menu/dhr/MHRP39N0003.svg +16 -0
- package/assets/images/menu/dhr/MHRP39N0004.svg +22 -0
- package/assets/images/menu/dhr/MHRP39N0005.svg +16 -0
- package/assets/images/menu/dhr/MHRP39N0006.svg +17 -0
- package/assets/images/menu/dhr/MHRP39N0007.svg +13 -0
- package/assets/images/menu/dhr/MHRP39N0008.svg +3 -0
- package/assets/images/menu/dhr/MHRP39N0009.svg +3 -0
- package/assets/images/menu/dhr/MHRP39N0010.svg +7 -0
- package/assets/images/menu/dhr/MHRP39N0011.svg +14 -0
- package/assets/images/menu/dhr/MHRP39N0013.svg +10 -0
- package/assets/images/menu/dhr/MHRP39N0014.svg +11 -0
- package/assets/images/menu/dhr/MHRP39N1222.svg +12 -0
- package/assets/images/menu/dhr/MHRP51N0001.svg +9 -0
- package/assets/images/menu/dhr/MHRP51N0002.svg +13 -0
- package/assets/images/menu/dhr/MHRP52N0001.svg +21 -0
- package/assets/images/menu/dhr/MHRP52N0002.svg +21 -0
- package/assets/images/menu/dhr/MHRP52N0003.svg +16 -0
- package/assets/images/menu/dhr/MHRP75N0001.svg +19 -0
- package/assets/images/menu/dhr/MHRP75N0002.svg +25 -0
- package/assets/images/menu/dhr/MHRP75N0003.svg +3 -0
- package/assets/images/menu/dhr/MHRP75N0006.svg +14 -0
- package/assets/images/menu/dhr/MHRP75N0007.svg +19 -0
- package/assets/images/menu/dhr/MHRP75N0008.svg +19 -0
- package/assets/images/menu/dhr/MHRP77N0007.svg +28 -0
- package/assets/images/menu/dhr/MHRP77N0008.svg +17 -0
- package/assets/images/menu/dhr/MHRP77N0009.svg +19 -0
- package/assets/images/menu/dhr/MHRP77N0010.svg +20 -0
- package/assets/images/menu/dhr/MHRP89N1000.svg +6 -0
- package/assets/images/menu/dhr/MHRP89N1001.svg +6 -0
- package/assets/images/menu/dhr/W00F0001.svg +3 -0
- package/assets/images/menu/dhr/W00F0002.svg +3 -0
- package/assets/images/menu/dhr/W00F0003.svg +3 -0
- package/assets/images/menu/dhr/W00F0004.svg +3 -0
- package/assets/images/menu/dhr/W00F0005.svg +1 -0
- package/assets/images/menu/dhr/W09F2000-WEB5.svg +17 -0
- package/assets/images/menu/dhr/W09F2000.svg +6 -0
- package/assets/images/menu/dhr/W09F2002-WEB5.svg +21 -0
- package/assets/images/menu/dhr/W09F2005-WEB5.svg +13 -0
- package/assets/images/menu/dhr/W09F2020-WEB5.svg +16 -0
- package/assets/images/menu/dhr/W09F2022-WEB5.svg +20 -0
- package/assets/images/menu/dhr/W09F2150-WEB5.svg +16 -0
- package/assets/images/menu/dhr/W09F2152-WEB5.svg +20 -0
- package/assets/images/menu/dhr/W09F2160-WEB5.svg +14 -0
- package/assets/images/menu/dhr/W09F2162-WEB5.svg +18 -0
- package/assets/images/menu/dhr/W29F4006-WEB5.svg +19 -0
- package/assets/images/menu/dhr/W75F2260-WEB5.svg +15 -0
- package/assets/images/menu/dhr/W75F2261-WEB5.svg +19 -0
- package/assets/images/menu/dhr/W75F3005-WEB5.svg +13 -0
- package/assets/images/menu/dhr/W75F4070-WEB5.svg +21 -0
- package/assets/images/menu/dhr/W75F4071-WEB5.svg +17 -0
- package/assets/images/menu/dhr/W75F4100-WEB5.svg +14 -0
- package/assets/images/menu/dhr/W77F1011.svg +19 -0
- package/assets/images/menu/dhr/W77F1013.svg +22 -0
- package/assets/images/menu/erp/W00F0001.svg +3 -0
- package/assets/images/menu/erp/W00F0002.svg +3 -0
- package/assets/images/menu/erp/W00F0003.svg +3 -0
- package/assets/images/menu/erp/W00F0004.svg +3 -0
- package/assets/images/menu/erp/W05F0001.svg +16 -0
- package/assets/images/menu/erp/W05F0001N0000.svg +16 -0
- package/assets/images/menu/erp/W05F0004N0000.svg +6 -0
- package/assets/images/menu/erp/W05F0006.svg +30 -0
- package/assets/images/menu/erp/W05F0007N0000.svg +6 -0
- package/assets/images/menu/erp/W05F0008.svg +14 -0
- package/assets/images/menu/erp/W05F4000.svg +9 -0
- package/assets/images/menu/erp/W06F0001.svg +17 -0
- package/assets/images/menu/erp/W06F0001N0000.svg +17 -0
- package/assets/images/menu/erp/W06F0004N0000.svg +22 -0
- package/assets/images/menu/erp/W06F0005.svg +22 -0
- package/assets/images/menu/erp/W06F0006.svg +55 -0
- package/assets/images/menu/erp/W06F0008.svg +17 -0
- package/assets/images/menu/erp/WA3F1025.svg +5 -0
- package/assets/images/menu/erp/WA3F2100.svg +10 -0
- package/components/accordion/context.js +6 -0
- package/components/accordion/css.js +159 -0
- package/components/accordion/details.js +60 -0
- package/components/accordion/group.js +122 -0
- package/components/accordion/index.js +117 -0
- package/components/accordion/summary.js +175 -0
- package/components/alert/index.js +264 -0
- package/components/alert/notify.js +192 -0
- package/components/avatar/index.js +556 -0
- package/components/badge/index.js +223 -0
- package/components/button/icon.js +493 -0
- package/components/button/index.js +653 -0
- package/components/button/more.js +135 -0
- package/components/button/ripple-effect.js +85 -0
- package/components/card/body-card.js +67 -0
- package/components/card/card.js +127 -0
- package/components/card/context.js +6 -0
- package/components/card/index.js +50 -0
- package/components/chart/Pie/Circle.js +50 -0
- package/components/chart/Pie/Sector.js +142 -0
- package/components/chart/Pie/Sectors.js +91 -0
- package/components/chart/Pie/index.js +311 -0
- package/components/chart/Pie-v2/Circle.js +50 -0
- package/components/chart/Pie-v2/Sector.js +128 -0
- package/components/chart/Pie-v2/Sectors.js +224 -0
- package/components/chart/Pie-v2/index.js +397 -0
- package/components/chart/bar/Axis.js +79 -0
- package/components/chart/bar/Bar.js +365 -0
- package/components/chart/bar/Grid.js +115 -0
- package/components/chart/bar/Labels.js +175 -0
- package/components/chart/bar/Points.js +111 -0
- package/components/chart/bar/index.js +172 -0
- package/components/chart/bar-v2/Axis.js +79 -0
- package/components/chart/bar-v2/Bar.js +374 -0
- package/components/chart/bar-v2/Grid.js +115 -0
- package/components/chart/bar-v2/Labels.js +175 -0
- package/components/chart/bar-v2/Points.js +111 -0
- package/components/chart/bar-v2/index.js +172 -0
- package/components/chart/line/Axis.js +79 -0
- package/components/chart/line/Grid.js +115 -0
- package/components/chart/line/Labels.js +172 -0
- package/components/chart/line/Path.js +163 -0
- package/components/chart/line/Point.js +348 -0
- package/components/chart/line/Title.js +56 -0
- package/components/chart/line/index.js +174 -0
- package/components/chart/line-v2/Axis.js +79 -0
- package/components/chart/line-v2/Grid.js +115 -0
- package/components/chart/line-v2/Labels.js +172 -0
- package/components/chart/line-v2/Path.js +163 -0
- package/components/chart/line-v2/Point.js +354 -0
- package/components/chart/line-v2/Title.js +56 -0
- package/components/chart/line-v2/index.js +174 -0
- package/components/check-text/index.js +157 -0
- package/components/check-text/interview-confirmation.js +172 -0
- package/components/check-text/interview-status.js +138 -0
- package/components/chip/attach.js +180 -0
- package/components/chip/index.js +340 -0
- package/components/collapse/index.js +67 -0
- package/components/dialogs/colors.js +11 -0
- package/components/divider/index.js +71 -0
- package/components/divider/style.js +12 -0
- package/components/form-control/attachment/index.js +1890 -0
- package/components/form-control/calendar/function.js +673 -0
- package/components/form-control/calendar/index.js +248 -0
- package/components/form-control/calendar/range.js +293 -0
- package/components/form-control/checkbox/index.js +306 -0
- package/components/form-control/control/index.js +92 -0
- package/components/form-control/date-picker/index-old.js +953 -0
- package/components/form-control/date-picker/index.js +676 -0
- package/components/form-control/date-range-picker/index.js +1305 -0
- package/components/form-control/dropdown/index.js +1865 -0
- package/components/form-control/dropdown-box/index.js +292 -0
- package/components/form-control/form/context.js +5 -0
- package/components/form-control/form/index.js +41 -0
- package/components/form-control/form-group/index.js +118 -0
- package/components/form-control/helper-text/index.js +71 -0
- package/components/form-control/input-base/index.js +733 -0
- package/components/form-control/label/index.js +73 -0
- package/components/form-control/money-input/index.js +491 -0
- package/components/form-control/number-input/index.js +633 -0
- package/components/form-control/phone-input/index.js +433 -0
- package/components/form-control/radio/index.js +263 -0
- package/components/form-control/text-input/index.js +523 -0
- package/components/form-control/time-picker/index.js +829 -0
- package/components/form-control/time-picker/swiper.js +590 -0
- package/components/form-control/toggle/index.js +250 -0
- package/components/form-view/helper-text.js +33 -0
- package/components/form-view/index.js +107 -0
- package/components/form-view/input.js +129 -0
- package/components/form-view/label.js +38 -0
- package/components/index.js +100 -0
- package/components/list/list-item-action.js +82 -0
- package/components/list/list-item-icon.js +76 -0
- package/components/list/list-item-text.js +57 -0
- package/components/list/list-item.js +114 -0
- package/components/list/list.js +155 -0
- package/components/list/sub-header.js +61 -0
- package/components/modal/body.js +71 -0
- package/components/modal/context.js +6 -0
- package/components/modal/footer.js +63 -0
- package/components/modal/header.js +108 -0
- package/components/modal/index.js +69 -0
- package/components/modal/modal.js +339 -0
- package/components/others/extra/index.js +124 -0
- package/components/others/scrollbar/index.js +95 -0
- package/components/paging/page-info.js +298 -0
- package/components/paging/page-selector.js +281 -0
- package/components/paper/index.js +119 -0
- package/components/popover/index.js +417 -0
- package/components/popup/danger_popup.js +215 -0
- package/components/popup/index.js +469 -0
- package/components/popup/proposals_popup.js +364 -0
- package/components/popup/v2/danger-popup.js +17 -0
- package/components/popup/v2/index.js +460 -0
- package/components/popup/v2/info-popup.js +17 -0
- package/components/popup/v2/success-popup.js +17 -0
- package/components/popup/v2/warning-popup.js +17 -0
- package/components/popup/v2/yes-no-popup.js +20 -0
- package/components/progress/circular.js +414 -0
- package/components/progress/linear.js +327 -0
- package/components/rating/index.js +392 -0
- package/components/slider/slider-container.js +356 -0
- package/components/slider/slider-item.js +183 -0
- package/components/status/index.js +123 -0
- package/components/tab/context.js +3 -0
- package/components/tab/tab-container.js +83 -0
- package/components/tab/tab-header.js +133 -0
- package/components/tab/tab-panel.js +51 -0
- package/components/tab/tab.js +206 -0
- package/components/tooltip/index.js +602 -0
- package/components/tooltip/portal.js +13 -0
- package/components/transfer/index.js +489 -0
- package/components/tree-view/css.js +94 -0
- package/components/tree-view/index.js +1009 -0
- package/components/typography/index.js +218 -0
- package/css/styles.css +1 -0
- package/css/styles.css.map +1 -0
- package/global/index.js +175 -0
- package/icons/basic.js +6326 -0
- package/icons/effect.js +171 -0
- package/icons/general/clock/clock.js +21 -0
- package/icons/general/color-handler/background.js +41 -0
- package/icons/general/color-handler/text.js +41 -0
- package/icons/general/emoji/emoji.js +35 -0
- package/icons/general/font-properties/bold.js +21 -0
- package/icons/general/font-properties/font-family.js +35 -0
- package/icons/general/font-properties/font-size.js +27 -0
- package/icons/general/font-properties/italic.js +21 -0
- package/icons/general/font-properties/underline.js +31 -0
- package/icons/general/hyperlink/hyperlink.js +38 -0
- package/icons/general/indent/decrease.js +55 -0
- package/icons/general/indent/increase.js +55 -0
- package/icons/general/index.js +21 -0
- package/icons/general/list/bullets.js +77 -0
- package/icons/general/list/numbering.js +71 -0
- package/icons/general/picture/picture.js +21 -0
- package/icons/general/steps/redo.js +21 -0
- package/icons/general/steps/undo.js +21 -0
- package/icons/general/text-align/center.js +21 -0
- package/icons/general/text-align/justify.js +21 -0
- package/icons/general/text-align/left.js +21 -0
- package/icons/general/text-align/right.js +21 -0
- package/icons/index.js +3 -0
- package/icons/menu/dhr.js +2440 -0
- package/icons/menu/erp.js +490 -0
- package/icons/menu/index.js +5 -0
- package/icons/menu/v2/index.js +52 -0
- package/locale/index.js +11 -0
- package/package.json +45 -0
- package/readme.md +517 -0
- package/styles/animation.js +890 -0
- package/styles/color-helper.js +504 -0
- package/styles/colors.js +306 -0
- package/styles/general.js +48 -0
- package/styles/media-queries.js +10 -0
- package/styles/typography.js +122 -0
- package/styles/utils.js +10 -0
- package/theme/index.js +5 -0
- package/theme/make-styles.js +95 -0
- package/theme/set-theme.js +39 -0
- package/theme/settings.js +230 -0
- package/theme/theme-provider.js +68 -0
- package/theme/theme.js +56 -0
- package/theme/with-styles.js +17 -0
- package/theme/with-theme.js +11 -0
- package/utils/array/array.js +186 -0
- package/utils/console.js +34 -0
- package/utils/date.js +471 -0
- package/utils/error/error.js +62 -0
- package/utils/error/errors.js +247 -0
- package/utils/getFileType.js +32 -0
- package/utils/index.js +23 -0
- package/utils/iterator.js +45 -0
- package/utils/map-parent.js +53 -0
- package/utils/number.js +64 -0
- package/utils/object/extend.js +57 -0
- package/utils/object/object.js +68 -0
- package/utils/parseHTML.js +8 -0
- package/utils/promisify.js +38 -0
- package/utils/randomString.js +33 -0
- package/utils/remove-unicode.js +6 -0
- package/utils/render-portal.js +90 -0
- package/utils/renderHTML.js +21 -0
- package/utils/renderIcon.js +57 -0
- package/utils/string/capitalize.js +3 -0
- package/utils/string/capitalizeSentenceCase.js +10 -0
- package/utils/string/string.js +81 -0
- package/utils/type.js +90 -0
- package/utils/updatePosition.js +36 -0
- package/utils/useOnClickOutside.js +23 -0
- package/utils/usePortal.js +56 -0
- package/utils/validate.js +149 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
/** @jsxRuntime classic */
|
|
4
|
+
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import { Fragment, memo, useMemo, useRef, useState, forwardRef as _nonUse } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { jsx, css } from '@emotion/core';
|
|
9
|
+
import Chip from './';
|
|
10
|
+
import Icon from '../../icons';
|
|
11
|
+
import { Pdf, Word, Sheet, Presentation, Image, Compressed, Another } from '../../icons';
|
|
12
|
+
import { capitalize, getFileType } from '../../utils';
|
|
13
|
+
import { ModalSample, Slider, SliderItem } from '../';
|
|
14
|
+
const FileTypeIcon = {
|
|
15
|
+
Pdf,
|
|
16
|
+
Word,
|
|
17
|
+
Sheet,
|
|
18
|
+
Presentation,
|
|
19
|
+
Image,
|
|
20
|
+
Compressed,
|
|
21
|
+
Another
|
|
22
|
+
};
|
|
23
|
+
const AttachChip = /*#__PURE__*/memo(({
|
|
24
|
+
file,
|
|
25
|
+
maxLength,
|
|
26
|
+
onView,
|
|
27
|
+
onDownload,
|
|
28
|
+
onRemove,
|
|
29
|
+
...props
|
|
30
|
+
}) => {
|
|
31
|
+
const moreActionRef = useRef(null);
|
|
32
|
+
const [open, setOpen] = useState(false);
|
|
33
|
+
const MoreAction = css`
|
|
34
|
+
display: none;
|
|
35
|
+
justify-content: space-evenly;
|
|
36
|
+
align-items: center;
|
|
37
|
+
position: absolute;
|
|
38
|
+
top: -34px;
|
|
39
|
+
right: -1px;
|
|
40
|
+
width: 120px;
|
|
41
|
+
height: 36px;
|
|
42
|
+
background: #FFFFFF;
|
|
43
|
+
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.1);
|
|
44
|
+
border-radius: 4px;
|
|
45
|
+
&.DGN-UI-Chip-show {
|
|
46
|
+
display: flex;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
const getStartIcon = () => {
|
|
51
|
+
var _file$FileName;
|
|
52
|
+
|
|
53
|
+
const lastIndexOfDot = (_file$FileName = file.FileName) === null || _file$FileName === void 0 ? void 0 : _file$FileName.lastIndexOf('.');
|
|
54
|
+
if (!lastIndexOfDot) return null;
|
|
55
|
+
const fileExt = file.FileName.slice(lastIndexOfDot + 1);
|
|
56
|
+
if (!fileExt) return null;
|
|
57
|
+
const fileType = getFileType(fileExt);
|
|
58
|
+
const FileIcon = FileTypeIcon[capitalize(fileType)];
|
|
59
|
+
return jsx(FileIcon, {
|
|
60
|
+
size: 'small',
|
|
61
|
+
viewBox: true
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const clickOutAction = event => {
|
|
66
|
+
if (!moreActionRef.current) {
|
|
67
|
+
document.removeEventListener('click', clickOutAction);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!moreActionRef.current.contains(event.target)) {
|
|
72
|
+
moreActionRef.current.classList.remove('DGN-UI-Chip-show');
|
|
73
|
+
document.removeEventListener('click', clickOutAction);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const onShowMoreOption = () => {
|
|
78
|
+
if (!moreActionRef.current.classList.contains('DGN-UI-Chip-show')) {
|
|
79
|
+
moreActionRef.current.classList.add('DGN-UI-Chip-show');
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
document.addEventListener('click', clickOutAction);
|
|
82
|
+
}, 100);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const viewAction = (e, file) => {
|
|
87
|
+
if (onView) {
|
|
88
|
+
onView(e, file);
|
|
89
|
+
} else {
|
|
90
|
+
setOpen(true);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const downloadAction = (e, file = {}) => {
|
|
95
|
+
if (onDownload) onDownload(e, file);else if (file.URL) {
|
|
96
|
+
fetch(file.URL).then(resp => resp.blob()).then(blob => {
|
|
97
|
+
const url = window.URL.createObjectURL(blob);
|
|
98
|
+
const a = document.createElement('a');
|
|
99
|
+
a.style.display = 'none';
|
|
100
|
+
a.href = url; // the filename you want
|
|
101
|
+
|
|
102
|
+
a.download = file.FileName;
|
|
103
|
+
document.body.appendChild(a);
|
|
104
|
+
a.click();
|
|
105
|
+
window.URL.revokeObjectURL(url);
|
|
106
|
+
}).catch(() => alert('File not found'));
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const deleteAction = (e, file) => {
|
|
111
|
+
if (onRemove) onRemove(e, file);
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
if (moreActionRef.current && moreActionRef.current.parentNode) moreActionRef.current.parentNode.remove();
|
|
114
|
+
}, 0);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const renderLabel = label => {
|
|
118
|
+
if (maxLength && label && label.length > maxLength) {
|
|
119
|
+
label = label.slice(0, maxLength) + '...';
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return label;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
const attachView = useMemo(() => {
|
|
126
|
+
return jsx(ModalSample, {
|
|
127
|
+
open: open,
|
|
128
|
+
title: file.FileName,
|
|
129
|
+
onClose: () => setOpen(false)
|
|
130
|
+
}, jsx(Slider, null, jsx(SliderItem, {
|
|
131
|
+
url: file.URL
|
|
132
|
+
})));
|
|
133
|
+
}, [open]);
|
|
134
|
+
return jsx(Fragment, null, jsx(Chip, _extends({}, props, {
|
|
135
|
+
clearAble: false,
|
|
136
|
+
label: renderLabel(file.FileName),
|
|
137
|
+
startIcon: getStartIcon(),
|
|
138
|
+
endIcon: jsx(Icon, {
|
|
139
|
+
name: 'more',
|
|
140
|
+
width: 24,
|
|
141
|
+
height: 18,
|
|
142
|
+
viewBox: true,
|
|
143
|
+
onClick: onShowMoreOption
|
|
144
|
+
})
|
|
145
|
+
}), jsx("div", {
|
|
146
|
+
css: MoreAction,
|
|
147
|
+
ref: moreActionRef
|
|
148
|
+
}, jsx(Icon, {
|
|
149
|
+
name: 'view',
|
|
150
|
+
viewBox: true,
|
|
151
|
+
onClick: e => viewAction(e, file)
|
|
152
|
+
}), jsx(Icon, {
|
|
153
|
+
name: 'download',
|
|
154
|
+
viewBox: true,
|
|
155
|
+
onClick: e => downloadAction(e, file)
|
|
156
|
+
}), jsx(Icon, {
|
|
157
|
+
name: 'delete',
|
|
158
|
+
viewBox: true,
|
|
159
|
+
onClick: e => deleteAction(e, file)
|
|
160
|
+
}))), attachView);
|
|
161
|
+
});
|
|
162
|
+
AttachChip.propTypes = {
|
|
163
|
+
/** the file info, such as:<br/>
|
|
164
|
+
* {<br/>
|
|
165
|
+
* URL: https://url.com/pathname,<br/>
|
|
166
|
+
* FileName: file.name,<br/>
|
|
167
|
+
* }
|
|
168
|
+
*/
|
|
169
|
+
file: PropTypes.shape({
|
|
170
|
+
URL: PropTypes.string.isRequired,
|
|
171
|
+
FileName: PropTypes.string.isRequired
|
|
172
|
+
}).isRequired,
|
|
173
|
+
|
|
174
|
+
/** max length content to display was allowed */
|
|
175
|
+
maxLength: PropTypes.number,
|
|
176
|
+
|
|
177
|
+
/** any props else of Chip component */
|
|
178
|
+
props: PropTypes.any
|
|
179
|
+
};
|
|
180
|
+
export default AttachChip;
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
/** @jsxRuntime classic */
|
|
4
|
+
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import { memo, useRef, forwardRef, useEffect, useMemo } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { jsx, css } from '@emotion/core';
|
|
9
|
+
import { Typography } from '../';
|
|
10
|
+
import Icon from '../../icons';
|
|
11
|
+
import theme from '../../theme/settings';
|
|
12
|
+
const Chip = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
13
|
+
viewType,
|
|
14
|
+
color,
|
|
15
|
+
size,
|
|
16
|
+
label,
|
|
17
|
+
className,
|
|
18
|
+
refs,
|
|
19
|
+
onRemove,
|
|
20
|
+
onClick,
|
|
21
|
+
onDbClick,
|
|
22
|
+
onDoubleClick,
|
|
23
|
+
maxLength,
|
|
24
|
+
startIcon,
|
|
25
|
+
endIcon,
|
|
26
|
+
clearAble,
|
|
27
|
+
disabled,
|
|
28
|
+
readOnly,
|
|
29
|
+
children,
|
|
30
|
+
...props
|
|
31
|
+
}, ref) => {
|
|
32
|
+
if (!ref) {
|
|
33
|
+
ref = useRef(null);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const IconRef = useRef(null);
|
|
37
|
+
const ChipIcon = css`
|
|
38
|
+
display: flex;
|
|
39
|
+
position: relative;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
align-items: center;
|
|
42
|
+
padding: 0 2px;
|
|
43
|
+
color: inherit;
|
|
44
|
+
box-sizing: border-box;
|
|
45
|
+
img {
|
|
46
|
+
border-radius: 50%;
|
|
47
|
+
}
|
|
48
|
+
&.small {
|
|
49
|
+
width: 24px;
|
|
50
|
+
height: 24px;
|
|
51
|
+
img {
|
|
52
|
+
width: 20px;
|
|
53
|
+
height: 20px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
&.medium {
|
|
57
|
+
max-width: 32px;
|
|
58
|
+
max-height: 32px;
|
|
59
|
+
img {
|
|
60
|
+
min-width: 24px;
|
|
61
|
+
min-height: 24px;
|
|
62
|
+
}
|
|
63
|
+
&:not(.end-icon) {
|
|
64
|
+
margin-right: 4px;
|
|
65
|
+
}
|
|
66
|
+
&.end-icon {
|
|
67
|
+
width: 32px;
|
|
68
|
+
height: 26px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
.clear-icon svg {
|
|
72
|
+
padding: 0 !important;
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
const ChipLabel = css`
|
|
76
|
+
display: flex;
|
|
77
|
+
position: relative;
|
|
78
|
+
align-items: center;
|
|
79
|
+
padding-right: ${endIcon || clearAble ? 2 : 10}px;
|
|
80
|
+
padding-left: ${startIcon ? 2 : 10}px;
|
|
81
|
+
user-select: none;
|
|
82
|
+
white-space: nowrap;
|
|
83
|
+
&.small {
|
|
84
|
+
max-height: 24px;
|
|
85
|
+
}
|
|
86
|
+
&.medium {
|
|
87
|
+
max-height: 32px;
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
const ChipRoot = css`
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
position: relative;
|
|
93
|
+
align-items: center;
|
|
94
|
+
margin-right: 15px;
|
|
95
|
+
padding: 0 6px;
|
|
96
|
+
color: ${theme.colors.secondary};
|
|
97
|
+
background: #FFFFFF;
|
|
98
|
+
border: 1px solid ${theme.colors.border};
|
|
99
|
+
box-sizing: border-box;
|
|
100
|
+
border-radius: 20px;
|
|
101
|
+
cursor: ${onClick || onDbClick ? 'pointer' : 'unset'};
|
|
102
|
+
&.small {
|
|
103
|
+
height: 24px;
|
|
104
|
+
}
|
|
105
|
+
&.medium {
|
|
106
|
+
min-height: 32px;
|
|
107
|
+
padding-top: 2px;
|
|
108
|
+
padding-bottom: 2px;
|
|
109
|
+
}
|
|
110
|
+
&:hover {
|
|
111
|
+
background: ${theme.colors.hover};
|
|
112
|
+
border-color: ${theme.colors.borderHover};
|
|
113
|
+
}
|
|
114
|
+
&.disabled {
|
|
115
|
+
color: ${theme.colors.disabled} !important;
|
|
116
|
+
background-color: ${theme.colors.bgDisabled} !important;
|
|
117
|
+
pointer-events: none !important;
|
|
118
|
+
.css-${ChipIcon.name} {
|
|
119
|
+
path {
|
|
120
|
+
fill: ${theme.colors.disabled} !important;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
&.readOnly {
|
|
125
|
+
cursor: unset !important;
|
|
126
|
+
.css-${ChipIcon.name} {
|
|
127
|
+
pointer-events: none !important;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
&.outlined {
|
|
131
|
+
&.primary {
|
|
132
|
+
color: ${theme.colors.primary};
|
|
133
|
+
border-color: ${theme.colors.borderHover};
|
|
134
|
+
}
|
|
135
|
+
&.info {
|
|
136
|
+
color: ${theme.colors.info};
|
|
137
|
+
border-color: ${theme.colors.borderFocus};
|
|
138
|
+
}
|
|
139
|
+
&.success {
|
|
140
|
+
color: ${theme.colors.success};
|
|
141
|
+
border-color: ${theme.colors.success};
|
|
142
|
+
}
|
|
143
|
+
&.warning {
|
|
144
|
+
color: ${theme.colors.warning};
|
|
145
|
+
border-color: ${theme.colors.warning};
|
|
146
|
+
}
|
|
147
|
+
&.danger {
|
|
148
|
+
color: ${theme.colors.danger};
|
|
149
|
+
border-color: ${theme.colors.danger};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
&.filled {
|
|
153
|
+
color: #FFF;
|
|
154
|
+
.clear-icon {
|
|
155
|
+
color: #FFF;
|
|
156
|
+
&:hover {
|
|
157
|
+
color: ${theme.colors.danger};
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
&.primary {
|
|
161
|
+
background-color: ${theme.colors.primary};
|
|
162
|
+
border-color: #3D4D9E;
|
|
163
|
+
}
|
|
164
|
+
&.info {
|
|
165
|
+
background-color: ${theme.colors.borderFocus};
|
|
166
|
+
border-color: ${theme.colors.linkHover};
|
|
167
|
+
}
|
|
168
|
+
&.success {
|
|
169
|
+
background-color: ${theme.colors.success};
|
|
170
|
+
border-color: ${theme.colors.button.bgFilledHover.success};
|
|
171
|
+
}
|
|
172
|
+
&.warning {
|
|
173
|
+
background-color: ${theme.colors.warning};
|
|
174
|
+
border-color: ${theme.colors.button.bgFilledHover.warning};
|
|
175
|
+
}
|
|
176
|
+
&.danger {
|
|
177
|
+
background-color: ${theme.colors.danger};
|
|
178
|
+
border-color: ${theme.colors.button.bgFilledHover.danger};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
`;
|
|
182
|
+
|
|
183
|
+
const onRemoveHandler = () => {
|
|
184
|
+
if (onRemove) onRemove(ref.current);
|
|
185
|
+
setTimeout(() => {
|
|
186
|
+
ref.current && ref.current.remove();
|
|
187
|
+
}, 0);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const handleClick = e => {
|
|
191
|
+
if (!IconRef.current || !IconRef.current.contains(e.target)) {
|
|
192
|
+
!!onClick && onClick();
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const renderLabel = () => {
|
|
197
|
+
if (maxLength && label && label.length > maxLength) {
|
|
198
|
+
label = label.slice(0, maxLength) + '...';
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return label;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
useEffect(() => {
|
|
205
|
+
if (refs) refs(ref);
|
|
206
|
+
}, []);
|
|
207
|
+
useEffect(() => {
|
|
208
|
+
if (color && color !== 'default') {
|
|
209
|
+
ref.current.classList.add(viewType);
|
|
210
|
+
ref.current.classList.add(color);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
return () => {
|
|
214
|
+
if (ref.current && color && color !== 'default') {
|
|
215
|
+
ref.current.classList.remove(viewType);
|
|
216
|
+
ref.current.classList.remove(color);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}, [viewType, color]);
|
|
220
|
+
useEffect(() => {
|
|
221
|
+
if (disabled) {
|
|
222
|
+
ref.current.classList.add('disabled');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return () => {
|
|
226
|
+
if (disabled && ref.current) {
|
|
227
|
+
ref.current.classList.remove('disabled');
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}, [disabled]);
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
if (readOnly) {
|
|
233
|
+
ref.current.classList.add('readOnly');
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return () => {
|
|
237
|
+
if (readOnly && ref.current) {
|
|
238
|
+
ref.current.classList.remove('readOnly');
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
}, [readOnly]);
|
|
242
|
+
const startIconView = useMemo(() => startIcon && jsx("div", {
|
|
243
|
+
css: ChipIcon,
|
|
244
|
+
className: size
|
|
245
|
+
}, startIcon), [startIcon]);
|
|
246
|
+
const labelView = useMemo(() => jsx("div", {
|
|
247
|
+
css: ChipLabel,
|
|
248
|
+
className: size
|
|
249
|
+
}, jsx(Typography, {
|
|
250
|
+
type: size === 'small' ? 'p2' : 'p1',
|
|
251
|
+
color: 'inherit'
|
|
252
|
+
}, renderLabel())), [label]);
|
|
253
|
+
const endIconView = useMemo(() => clearAble ? jsx("div", {
|
|
254
|
+
css: ChipIcon,
|
|
255
|
+
className: 'end-icon ' + size,
|
|
256
|
+
ref: IconRef
|
|
257
|
+
}, jsx(Icon, {
|
|
258
|
+
name: 'Close',
|
|
259
|
+
className: 'clear-icon',
|
|
260
|
+
color: viewType === 'outlined' && color ? 'inherit' : undefined,
|
|
261
|
+
width: 10,
|
|
262
|
+
height: 10,
|
|
263
|
+
onClick: onRemoveHandler
|
|
264
|
+
})) : endIcon && jsx("div", {
|
|
265
|
+
css: ChipIcon,
|
|
266
|
+
className: 'end-icon ' + size,
|
|
267
|
+
ref: IconRef
|
|
268
|
+
}, endIcon), [clearAble]);
|
|
269
|
+
return jsx("div", _extends({
|
|
270
|
+
css: ChipRoot,
|
|
271
|
+
ref: ref
|
|
272
|
+
}, props, {
|
|
273
|
+
className: ['DGN-UI-Chip', size, className].join(' ').trim(),
|
|
274
|
+
onClick: readOnly ? null : handleClick,
|
|
275
|
+
onDoubleClick: onDbClick || onDoubleClick
|
|
276
|
+
}), startIconView, labelView, endIconView, children);
|
|
277
|
+
}));
|
|
278
|
+
Chip.defaultProps = {
|
|
279
|
+
label: '',
|
|
280
|
+
className: '',
|
|
281
|
+
viewType: 'outlined',
|
|
282
|
+
size: 'small',
|
|
283
|
+
clearAble: false
|
|
284
|
+
};
|
|
285
|
+
Chip.propTypes = {
|
|
286
|
+
/** content to display in Chip */
|
|
287
|
+
label: PropTypes.string,
|
|
288
|
+
|
|
289
|
+
/** class of Chip element */
|
|
290
|
+
className: PropTypes.string,
|
|
291
|
+
|
|
292
|
+
/** max length content to display was allowed */
|
|
293
|
+
maxLength: PropTypes.number,
|
|
294
|
+
|
|
295
|
+
/** the icon display at head of Chip */
|
|
296
|
+
startIcon: PropTypes.any,
|
|
297
|
+
|
|
298
|
+
/** the icon display at last of Chip */
|
|
299
|
+
endIcon: PropTypes.any,
|
|
300
|
+
|
|
301
|
+
/** type of chip */
|
|
302
|
+
viewType: PropTypes.oneOf(['outlined', 'filled']),
|
|
303
|
+
|
|
304
|
+
/** color for text or background of Chip */
|
|
305
|
+
color: PropTypes.oneOf(['default', 'primary', 'info', 'success', 'warning', 'danger']),
|
|
306
|
+
|
|
307
|
+
/** size of Chip */
|
|
308
|
+
size: PropTypes.oneOf(['small', 'medium']),
|
|
309
|
+
|
|
310
|
+
/** show clear icon if true */
|
|
311
|
+
clearAble: PropTypes.bool,
|
|
312
|
+
|
|
313
|
+
/** prevent all event and change color if true */
|
|
314
|
+
disabled: PropTypes.bool,
|
|
315
|
+
|
|
316
|
+
/** prevent all event if true */
|
|
317
|
+
readOnly: PropTypes.bool,
|
|
318
|
+
|
|
319
|
+
/** the function to get ref of Chip */
|
|
320
|
+
refs: PropTypes.func,
|
|
321
|
+
|
|
322
|
+
/** the function will run after remove chip */
|
|
323
|
+
onRemove: PropTypes.func,
|
|
324
|
+
|
|
325
|
+
/** the function will run when click on chip */
|
|
326
|
+
onClick: PropTypes.func,
|
|
327
|
+
|
|
328
|
+
/** the function will run when double click on chip */
|
|
329
|
+
onDbClick: PropTypes.func,
|
|
330
|
+
|
|
331
|
+
/** like onDbClick (priority onDbClick) */
|
|
332
|
+
onDoubleClick: PropTypes.func,
|
|
333
|
+
|
|
334
|
+
/** content to display on Chip (the same to label) */
|
|
335
|
+
children: PropTypes.node,
|
|
336
|
+
|
|
337
|
+
/** any props else */
|
|
338
|
+
props: PropTypes.any
|
|
339
|
+
};
|
|
340
|
+
export default Chip;
|