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,215 @@
|
|
|
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, useEffect, useRef } from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { jsx, css } from '@emotion/core';
|
|
9
|
+
import Popup from './';
|
|
10
|
+
import { Button } from '../';
|
|
11
|
+
import { renderHTML } from '../../utils';
|
|
12
|
+
import { Warning } from '../../icons';
|
|
13
|
+
import theme from '../../theme/settings';
|
|
14
|
+
|
|
15
|
+
const DangerPopup = ({
|
|
16
|
+
open,
|
|
17
|
+
warningText,
|
|
18
|
+
warningIconColor,
|
|
19
|
+
warningDescription,
|
|
20
|
+
confirmText,
|
|
21
|
+
cancelText,
|
|
22
|
+
timing,
|
|
23
|
+
buttonTimingColor,
|
|
24
|
+
onConfirm,
|
|
25
|
+
onCancel,
|
|
26
|
+
popupStyle,
|
|
27
|
+
...props
|
|
28
|
+
}) => {
|
|
29
|
+
const popupActionRef = useRef(null);
|
|
30
|
+
const popupStyles = {
|
|
31
|
+
backgroundColor: '#FFDCD8',
|
|
32
|
+
color: "#E7000F",
|
|
33
|
+
width: 486,
|
|
34
|
+
height: 'max-content',
|
|
35
|
+
...popupStyle
|
|
36
|
+
};
|
|
37
|
+
const PopupContent = css`
|
|
38
|
+
display: block;
|
|
39
|
+
position: relative;
|
|
40
|
+
color: inherit;
|
|
41
|
+
margin: 24px 58px;
|
|
42
|
+
width: 100%;
|
|
43
|
+
`;
|
|
44
|
+
const PopupInfo = css`
|
|
45
|
+
display: flex;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
align-items: center;
|
|
48
|
+
color: inherit;
|
|
49
|
+
.popup-icon {
|
|
50
|
+
width: 48px;
|
|
51
|
+
height: 44px;
|
|
52
|
+
margin-right: 13px;
|
|
53
|
+
}
|
|
54
|
+
.popup-title {
|
|
55
|
+
font-family: ${theme.typography.fontFamily};
|
|
56
|
+
font-style: normal;
|
|
57
|
+
font-weight: bold;
|
|
58
|
+
font-size: 20px;
|
|
59
|
+
line-height: 22px;
|
|
60
|
+
color: inherit;
|
|
61
|
+
}
|
|
62
|
+
`;
|
|
63
|
+
const PopupWarning = css`
|
|
64
|
+
font-family: ${theme.typography.fontFamily};
|
|
65
|
+
font-style: normal;
|
|
66
|
+
font-weight: 500;
|
|
67
|
+
font-size: 16px;
|
|
68
|
+
line-height: 22px;
|
|
69
|
+
text-align: center;
|
|
70
|
+
color: inherit;
|
|
71
|
+
`;
|
|
72
|
+
const PopupAction = css`
|
|
73
|
+
margin-top: 15px;
|
|
74
|
+
display: flex;
|
|
75
|
+
justify-content: space-between;
|
|
76
|
+
button {
|
|
77
|
+
min-width: 176px;
|
|
78
|
+
font-size: 14px;
|
|
79
|
+
font-family: ${theme.typography.fontFamily};
|
|
80
|
+
&.button-confirm {
|
|
81
|
+
&.popup-timing {
|
|
82
|
+
color: ${buttonTimingColor};
|
|
83
|
+
background-color: white;
|
|
84
|
+
border: 1px solid ${buttonTimingColor};
|
|
85
|
+
box-shadow: none;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
const onConfirmHandler = () => {
|
|
92
|
+
if (onConfirm) onConfirm();
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const onCancelHandler = () => {
|
|
96
|
+
if (onCancel) onCancel();
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
let timer = null;
|
|
101
|
+
|
|
102
|
+
if (open) {
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
if (popupActionRef.current) {
|
|
105
|
+
const button = popupActionRef.current.querySelector('button.button-confirm');
|
|
106
|
+
if (!button) return;
|
|
107
|
+
const childNode = button.querySelector('.button-text');
|
|
108
|
+
let time = timing;
|
|
109
|
+
button.classList.add('popup-timing');
|
|
110
|
+
button.disabled = true;
|
|
111
|
+
childNode.textContent += ` (${time}s)`;
|
|
112
|
+
timer = setInterval(() => {
|
|
113
|
+
if (time === 0) {
|
|
114
|
+
button.classList.remove('popup-timing');
|
|
115
|
+
button.disabled = false;
|
|
116
|
+
childNode.textContent = confirmText;
|
|
117
|
+
clearInterval(timer);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
time--;
|
|
122
|
+
childNode.textContent = `${confirmText} (${time}s)`;
|
|
123
|
+
}, 1000);
|
|
124
|
+
}
|
|
125
|
+
}, 0);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return () => {
|
|
129
|
+
if (open && popupActionRef.current) {
|
|
130
|
+
const button = popupActionRef.current.querySelector('button.button-confirm');
|
|
131
|
+
if (!button) return;
|
|
132
|
+
const childNode = button.querySelector('.button-text');
|
|
133
|
+
setTimeout(() => {
|
|
134
|
+
button.classList.remove('popup-timing');
|
|
135
|
+
button.disabled = false;
|
|
136
|
+
childNode.textContent = confirmText;
|
|
137
|
+
}, 300);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (timer) clearInterval(timer);
|
|
141
|
+
};
|
|
142
|
+
}, [open]);
|
|
143
|
+
return jsx(Popup, _extends({
|
|
144
|
+
popupStyle: popupStyles,
|
|
145
|
+
type: 'custom',
|
|
146
|
+
open: open
|
|
147
|
+
}, props), jsx("div", {
|
|
148
|
+
css: PopupContent
|
|
149
|
+
}, jsx("div", {
|
|
150
|
+
css: PopupInfo
|
|
151
|
+
}, jsx("span", {
|
|
152
|
+
className: 'popup-icon'
|
|
153
|
+
}, jsx(Warning, {
|
|
154
|
+
width: 40,
|
|
155
|
+
height: 40,
|
|
156
|
+
color: warningIconColor,
|
|
157
|
+
viewBox: true
|
|
158
|
+
})), jsx("span", {
|
|
159
|
+
className: 'popup-title'
|
|
160
|
+
}, warningText)), jsx("div", {
|
|
161
|
+
css: PopupWarning
|
|
162
|
+
}, renderHTML(warningDescription)), jsx("div", {
|
|
163
|
+
css: PopupAction,
|
|
164
|
+
ref: popupActionRef
|
|
165
|
+
}, jsx(Button, {
|
|
166
|
+
viewType: 'outlined',
|
|
167
|
+
color: 'danger',
|
|
168
|
+
className: 'button-confirm',
|
|
169
|
+
onClick: onConfirmHandler
|
|
170
|
+
}, confirmText), jsx(Button, {
|
|
171
|
+
viewType: 'outlined',
|
|
172
|
+
color: 'primary',
|
|
173
|
+
onClick: onCancelHandler
|
|
174
|
+
}, cancelText))));
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
DangerPopup.defaultProps = {
|
|
178
|
+
warningText: 'CẢNH BÁO NGUY HIỂM',
|
|
179
|
+
warningIconColor: '#E7000F',
|
|
180
|
+
warningDescription: `Hành động này sẽ xóa tất cả các công việc bên trong dự án và không thể khôi phục.<br/>
|
|
181
|
+
Bạn có chắn chắn muốn xóa dự án này không?`,
|
|
182
|
+
confirmText: 'XÁC NHẬN XOÁ',
|
|
183
|
+
cancelText: 'HUỶ THAO TÁC',
|
|
184
|
+
timing: 10,
|
|
185
|
+
buttonTimingColor: 'rgba(231, 0, 15, 0.5)'
|
|
186
|
+
};
|
|
187
|
+
DangerPopup.propTypes = {
|
|
188
|
+
/** the title of Popup */
|
|
189
|
+
warningText: PropTypes.string,
|
|
190
|
+
|
|
191
|
+
/** the title of Popup */
|
|
192
|
+
warningIconColor: PropTypes.string,
|
|
193
|
+
|
|
194
|
+
/** the content to description for warning title */
|
|
195
|
+
warningDescription: PropTypes.string,
|
|
196
|
+
|
|
197
|
+
/** the content to display in confirm button */
|
|
198
|
+
confirmText: PropTypes.string,
|
|
199
|
+
|
|
200
|
+
/** the content to display in cancel button */
|
|
201
|
+
cancelText: PropTypes.string,
|
|
202
|
+
|
|
203
|
+
/** the color of button when timing */
|
|
204
|
+
buttonTimingColor: PropTypes.string,
|
|
205
|
+
|
|
206
|
+
/** the period to prevent click confirm button */
|
|
207
|
+
timing: PropTypes.number,
|
|
208
|
+
|
|
209
|
+
/** the function run when click confirm button */
|
|
210
|
+
onConfirm: PropTypes.func,
|
|
211
|
+
|
|
212
|
+
/** the function run when click cancel button */
|
|
213
|
+
onCancel: PropTypes.func
|
|
214
|
+
};
|
|
215
|
+
export default /*#__PURE__*/memo(DangerPopup);
|
|
@@ -0,0 +1,469 @@
|
|
|
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 React, { memo, useEffect, useMemo, useRef, forwardRef, useState } from 'react';
|
|
7
|
+
import ReactDOM, { createPortal } from 'react-dom';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { jsx, css, keyframes } from '@emotion/core';
|
|
10
|
+
import { Button, Typography } from '../';
|
|
11
|
+
import Icon, { Info, Archive, Warning, Failed } from '../../icons';
|
|
12
|
+
import theme from '../../theme/settings';
|
|
13
|
+
import { getGlobal } from '../../global';
|
|
14
|
+
export const icons = {
|
|
15
|
+
info: jsx(Info, {
|
|
16
|
+
viewBox: true
|
|
17
|
+
}),
|
|
18
|
+
success: jsx(Archive, {
|
|
19
|
+
viewBox: true
|
|
20
|
+
}),
|
|
21
|
+
warning: jsx(Warning, {
|
|
22
|
+
viewBox: true
|
|
23
|
+
}),
|
|
24
|
+
danger: jsx(Failed, {
|
|
25
|
+
viewBox: true
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
const Popup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
29
|
+
open,
|
|
30
|
+
type,
|
|
31
|
+
icon,
|
|
32
|
+
title,
|
|
33
|
+
className,
|
|
34
|
+
clearAble,
|
|
35
|
+
fullScreen,
|
|
36
|
+
pressESCToClose,
|
|
37
|
+
autoFocusOKButton,
|
|
38
|
+
style,
|
|
39
|
+
popupStyle,
|
|
40
|
+
clearIconStyle,
|
|
41
|
+
confirmProps,
|
|
42
|
+
cancelProps,
|
|
43
|
+
refs,
|
|
44
|
+
getPopup,
|
|
45
|
+
onClose,
|
|
46
|
+
onConfirm,
|
|
47
|
+
onCancel,
|
|
48
|
+
children,
|
|
49
|
+
width,
|
|
50
|
+
top,
|
|
51
|
+
confirmText,
|
|
52
|
+
cancelText,
|
|
53
|
+
yesText,
|
|
54
|
+
noText,
|
|
55
|
+
...props
|
|
56
|
+
}, ref) => {
|
|
57
|
+
if (!ref) {
|
|
58
|
+
ref = useRef(null);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const [openState, setOpenState] = useState(open);
|
|
62
|
+
const [custom, setCustom] = useState(null);
|
|
63
|
+
const PopupContainer = css`
|
|
64
|
+
position: fixed;
|
|
65
|
+
display: none;
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 100vh;
|
|
68
|
+
background-color: ${!fullScreen ? 'transparent' : 'rgba(21, 26, 48, 0.5)'};
|
|
69
|
+
top: 0;
|
|
70
|
+
left: 0;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
padding-top: ${isNaN(top) ? top : top + 'px'};
|
|
73
|
+
pointer-events: ${!fullScreen ? 'none' : 'auto'};
|
|
74
|
+
opacity: 0;
|
|
75
|
+
transition: opacity 0.3s ease;
|
|
76
|
+
z-index: 9001;
|
|
77
|
+
`;
|
|
78
|
+
const fadeInDown = keyframes`
|
|
79
|
+
from {
|
|
80
|
+
opacity: 0;
|
|
81
|
+
transform: translateY(-30px);
|
|
82
|
+
}
|
|
83
|
+
to {
|
|
84
|
+
opacity: 1;
|
|
85
|
+
transform: translateY(0);
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
const fadeOutUp = keyframes`
|
|
89
|
+
from {
|
|
90
|
+
opacity: 1;
|
|
91
|
+
}
|
|
92
|
+
to {
|
|
93
|
+
opacity: 0;
|
|
94
|
+
transform: translateY(-30px);
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
97
|
+
const PopupFrame = css`
|
|
98
|
+
display: flex;
|
|
99
|
+
position: relative;
|
|
100
|
+
color: ${theme.colors.default};
|
|
101
|
+
background-color: white;
|
|
102
|
+
width: ${width};
|
|
103
|
+
height: max-content;
|
|
104
|
+
min-width: 150px;
|
|
105
|
+
max-width: 480px;
|
|
106
|
+
min-height: 68px;
|
|
107
|
+
border-radius: 4px;
|
|
108
|
+
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
109
|
+
box-sizing: border-box;
|
|
110
|
+
pointer-events: auto;
|
|
111
|
+
animation: ${fadeOutUp} 0.2s ease;
|
|
112
|
+
animation-fill-mode: forwards;
|
|
113
|
+
&.animate_fadeInDown {
|
|
114
|
+
animation: ${fadeInDown} 0.2s ease;
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
const PopupContent = css`
|
|
118
|
+
display: block;
|
|
119
|
+
position: relative;
|
|
120
|
+
color: inherit;
|
|
121
|
+
width: 100%;
|
|
122
|
+
margin: 24px 48px;
|
|
123
|
+
`;
|
|
124
|
+
const PopupInfo = css`
|
|
125
|
+
/* width: max-content; */
|
|
126
|
+
display: flex;
|
|
127
|
+
color: inherit;
|
|
128
|
+
justify-content: center;
|
|
129
|
+
.popup-icon {
|
|
130
|
+
display: inline-flex;
|
|
131
|
+
margin-top: 2px;
|
|
132
|
+
width: auto;
|
|
133
|
+
height: auto
|
|
134
|
+
}
|
|
135
|
+
.popup-title {
|
|
136
|
+
/* width: 100%; */
|
|
137
|
+
display: inline-flex;
|
|
138
|
+
margin-left: 8px;
|
|
139
|
+
margin-right: 8px;
|
|
140
|
+
color: inherit;
|
|
141
|
+
text-align: center;
|
|
142
|
+
align-items: center;
|
|
143
|
+
font-family: ${theme.typography.fontFamily};
|
|
144
|
+
font-size: 16px;
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
147
|
+
const PopupYesNo = css`
|
|
148
|
+
display: flex;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
margin-top: 21px;
|
|
151
|
+
`;
|
|
152
|
+
const PopupClearIcon = css`
|
|
153
|
+
display: block;
|
|
154
|
+
position: absolute;
|
|
155
|
+
width: 24px;
|
|
156
|
+
height: 24px;
|
|
157
|
+
top: 16px;
|
|
158
|
+
right: 16px;
|
|
159
|
+
color: ${theme.colors.secondary};
|
|
160
|
+
cursor: pointer;
|
|
161
|
+
`;
|
|
162
|
+
|
|
163
|
+
const onShowPopup = (message, options = {}, cb, autoClose = true) => {
|
|
164
|
+
if (!message && (!options || JSON.stringify(options) === '{}') && !cb) {
|
|
165
|
+
setCustom(false);
|
|
166
|
+
setOpenState(true);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
message = message || title;
|
|
171
|
+
|
|
172
|
+
if (Object.keys(options).length) {
|
|
173
|
+
type = options.type || type;
|
|
174
|
+
icon = options.icon || icon;
|
|
175
|
+
confirmText = options.confirmText || confirmText;
|
|
176
|
+
cancelText = options.cancelText || cancelText;
|
|
177
|
+
yesText = options.yesText || yesText;
|
|
178
|
+
noText = options.noText || noText;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const confirmHandler = () => {
|
|
182
|
+
if (cb && typeof cb === 'function') cb(true);else onConfirmHandler();
|
|
183
|
+
|
|
184
|
+
if (autoClose) {
|
|
185
|
+
onClosePopup();
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
const cancelHandler = () => {
|
|
190
|
+
if (cb && typeof cb === 'function') cb(false);else onCancelHandler();
|
|
191
|
+
|
|
192
|
+
if (autoClose) {
|
|
193
|
+
onClosePopup();
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const newContent = jsx("div", {
|
|
198
|
+
css: PopupContent
|
|
199
|
+
}, jsx("div", {
|
|
200
|
+
css: PopupInfo
|
|
201
|
+
}, icon ? jsx("span", {
|
|
202
|
+
className: 'popup-icon'
|
|
203
|
+
}, icons[icon]) : null, jsx("span", {
|
|
204
|
+
className: 'popup-title'
|
|
205
|
+
}, jsx(Typography, null, message))), /(yes.*?no)|(confirm)/i.test(type) && jsx("div", {
|
|
206
|
+
css: PopupYesNo
|
|
207
|
+
}, jsx(Button, _extends({
|
|
208
|
+
viewType: 'filled',
|
|
209
|
+
color: 'info',
|
|
210
|
+
style: {
|
|
211
|
+
minWidth: 104
|
|
212
|
+
}
|
|
213
|
+
}, confirmProps, {
|
|
214
|
+
onClick: confirmHandler
|
|
215
|
+
}), /confirm/i.test(type) ? confirmText : yesText), jsx(Button, _extends({
|
|
216
|
+
viewType: 'outlined',
|
|
217
|
+
style: {
|
|
218
|
+
minWidth: 104,
|
|
219
|
+
marginLeft: 24
|
|
220
|
+
}
|
|
221
|
+
}, cancelProps, {
|
|
222
|
+
onClick: cancelHandler
|
|
223
|
+
}), /confirm/i.test(type) ? cancelText : noText)));
|
|
224
|
+
setCustom(newContent);
|
|
225
|
+
setOpenState(true);
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const onClosePopup = (action = false) => {
|
|
229
|
+
if (onClose && action) {
|
|
230
|
+
onClose();
|
|
231
|
+
} else {
|
|
232
|
+
if (ref.current) {
|
|
233
|
+
setTimeout(() => {
|
|
234
|
+
setOpenState(false);
|
|
235
|
+
}, 300);
|
|
236
|
+
ref.current.style.opacity = null;
|
|
237
|
+
ref.current.firstChild.classList.remove('animate_fadeInDown');
|
|
238
|
+
|
|
239
|
+
if (fullScreen) {
|
|
240
|
+
document.body.style.overflow = null;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const onConfirmHandler = () => {
|
|
249
|
+
if (onConfirm) onConfirm();else setOpenState(false);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
const onCancelHandler = () => {
|
|
253
|
+
if (onCancel) onCancel();else setOpenState(false);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const pressESCHandler = event => {
|
|
257
|
+
if (event.key === 'Escape') {
|
|
258
|
+
onClosePopup(custom === null);
|
|
259
|
+
document.removeEventListener('keydown', pressESCHandler);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
useEffect(() => {
|
|
266
|
+
if (refs) refs(ref);
|
|
267
|
+
}, []);
|
|
268
|
+
useEffect(() => {
|
|
269
|
+
if (getPopup && typeof getPopup === 'function') getPopup({
|
|
270
|
+
show: onShowPopup,
|
|
271
|
+
close: onClosePopup
|
|
272
|
+
});
|
|
273
|
+
}, [getPopup]);
|
|
274
|
+
useEffect(() => {
|
|
275
|
+
if (open) {
|
|
276
|
+
setOpenState(open);
|
|
277
|
+
} else {
|
|
278
|
+
onClosePopup();
|
|
279
|
+
}
|
|
280
|
+
}, [open]);
|
|
281
|
+
useEffect(() => {
|
|
282
|
+
if (openState) {
|
|
283
|
+
ref.current.style.display = 'flex';
|
|
284
|
+
const titleEl = ref.current.querySelector('.popup-title');
|
|
285
|
+
const iconEl = ref.current.querySelector('.popup-icon');
|
|
286
|
+
|
|
287
|
+
if (iconEl && titleEl) {
|
|
288
|
+
titleEl.style.marginRight = '32px';
|
|
289
|
+
const height = titleEl.offsetHeight;
|
|
290
|
+
|
|
291
|
+
if (height && height > 39) {
|
|
292
|
+
iconEl.style.height = '40px';
|
|
293
|
+
iconEl.style.width = '40px';
|
|
294
|
+
iconEl.firstChild.style.height = '40px';
|
|
295
|
+
iconEl.firstChild.style.width = '40px';
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
setTimeout(() => {
|
|
300
|
+
ref.current.style.opacity = 1;
|
|
301
|
+
ref.current.firstChild.classList.add('animate_fadeInDown');
|
|
302
|
+
}, 0); // Allow press ESC to close popup
|
|
303
|
+
|
|
304
|
+
if (pressESCToClose) {
|
|
305
|
+
document.addEventListener('keydown', pressESCHandler);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (autoFocusOKButton && type !== 'info' && ref.current.querySelector('button')) {
|
|
309
|
+
ref.current.querySelector('button').focus();
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (fullScreen) {
|
|
313
|
+
document.body.style.overflow = 'hidden';
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return () => {
|
|
317
|
+
setCustom(null);
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
}, [openState]);
|
|
321
|
+
const Popup = useMemo(() => openState && /*#__PURE__*/createPortal(jsx("div", {
|
|
322
|
+
css: PopupContainer,
|
|
323
|
+
className: 'DGN-UI-Portal',
|
|
324
|
+
ref: ref,
|
|
325
|
+
style: style
|
|
326
|
+
}, jsx("div", _extends({
|
|
327
|
+
css: PopupFrame
|
|
328
|
+
}, props, {
|
|
329
|
+
style: popupStyle,
|
|
330
|
+
className: 'DGN-UI-Popup ' + className
|
|
331
|
+
}), custom ? custom : /^custom$/i.test(type) ? children : jsx("div", {
|
|
332
|
+
css: PopupContent,
|
|
333
|
+
className: 'DGN-UI-Popup-Content'
|
|
334
|
+
}, jsx("div", {
|
|
335
|
+
css: PopupInfo
|
|
336
|
+
}, icon ? jsx("span", {
|
|
337
|
+
className: 'popup-icon'
|
|
338
|
+
}, icons[icon]) : null, jsx("span", {
|
|
339
|
+
className: 'popup-title'
|
|
340
|
+
}, jsx(Typography, null, title))), /(yes.*?no)|(confirm)/i.test(type) && jsx("div", {
|
|
341
|
+
css: PopupYesNo
|
|
342
|
+
}, jsx(Button, _extends({
|
|
343
|
+
viewType: 'filled',
|
|
344
|
+
color: 'info',
|
|
345
|
+
style: {
|
|
346
|
+
minWidth: 104
|
|
347
|
+
}
|
|
348
|
+
}, confirmProps, {
|
|
349
|
+
onClick: onConfirmHandler
|
|
350
|
+
}), /confirm/i.test(type) ? confirmText : yesText), jsx(Button, _extends({
|
|
351
|
+
viewType: 'outlined',
|
|
352
|
+
style: {
|
|
353
|
+
minWidth: 104,
|
|
354
|
+
marginLeft: 24
|
|
355
|
+
}
|
|
356
|
+
}, cancelProps, {
|
|
357
|
+
onClick: onCancelHandler
|
|
358
|
+
}), /confirm/i.test(type) ? cancelText : noText))), (clearAble || /info/i.test(type)) && jsx("div", {
|
|
359
|
+
css: PopupClearIcon,
|
|
360
|
+
style: clearIconStyle
|
|
361
|
+
}, jsx(Icon, {
|
|
362
|
+
name: 'close',
|
|
363
|
+
width: "12",
|
|
364
|
+
height: "12",
|
|
365
|
+
color: "currentColor",
|
|
366
|
+
onClick: e => onClosePopup(custom === false ? false : e),
|
|
367
|
+
style: {
|
|
368
|
+
width: '100%',
|
|
369
|
+
height: '100%'
|
|
370
|
+
}
|
|
371
|
+
})))), document.body), [openState, custom, title, icon, type, onClose, onConfirm, onCancel]);
|
|
372
|
+
return Popup;
|
|
373
|
+
}));
|
|
374
|
+
Popup.defaultProps = {
|
|
375
|
+
type: 'info',
|
|
376
|
+
width: '450px',
|
|
377
|
+
title: '',
|
|
378
|
+
className: '',
|
|
379
|
+
yesText: getGlobal('yes'),
|
|
380
|
+
noText: getGlobal('no'),
|
|
381
|
+
confirmText: getGlobal('ok'),
|
|
382
|
+
cancelText: getGlobal('cancel'),
|
|
383
|
+
clearAble: true,
|
|
384
|
+
open: false,
|
|
385
|
+
pressESCToClose: false,
|
|
386
|
+
autoFocusOKButton: true,
|
|
387
|
+
fullScreen: false,
|
|
388
|
+
top: 50
|
|
389
|
+
};
|
|
390
|
+
Popup.propTypes = {
|
|
391
|
+
/** type of Popup, corresponding to the content inside */
|
|
392
|
+
type: PropTypes.oneOf(['info', 'yes-no', 'confirm', 'custom']),
|
|
393
|
+
|
|
394
|
+
/** the icon to display before content */
|
|
395
|
+
icon: PropTypes.oneOf(['info', 'success', 'warning', 'danger']),
|
|
396
|
+
|
|
397
|
+
/** the main content to display */
|
|
398
|
+
title: PropTypes.node,
|
|
399
|
+
|
|
400
|
+
/** class of Popup component */
|
|
401
|
+
className: PropTypes.string,
|
|
402
|
+
|
|
403
|
+
/** the text to display in agree button */
|
|
404
|
+
yesText: PropTypes.string,
|
|
405
|
+
|
|
406
|
+
/** the text to display in deny button */
|
|
407
|
+
noText: PropTypes.string,
|
|
408
|
+
|
|
409
|
+
/** the text to display in confirm button */
|
|
410
|
+
confirmText: PropTypes.string,
|
|
411
|
+
|
|
412
|
+
/** the text to display in cancel button */
|
|
413
|
+
cancelText: PropTypes.string,
|
|
414
|
+
|
|
415
|
+
/** the width of Popup */
|
|
416
|
+
width: PropTypes.string,
|
|
417
|
+
|
|
418
|
+
/** display clear icon if true */
|
|
419
|
+
clearAble: PropTypes.bool,
|
|
420
|
+
|
|
421
|
+
/** show Popup if true */
|
|
422
|
+
open: PropTypes.bool,
|
|
423
|
+
|
|
424
|
+
/** allow close Popup when press ESC */
|
|
425
|
+
pressESCToClose: PropTypes.bool,
|
|
426
|
+
|
|
427
|
+
/** auto focus in OK button */
|
|
428
|
+
autoFocusOKButton: PropTypes.bool,
|
|
429
|
+
|
|
430
|
+
/** style inline for Popup container */
|
|
431
|
+
style: PropTypes.object,
|
|
432
|
+
|
|
433
|
+
/** style inline for Popup */
|
|
434
|
+
popupStyle: PropTypes.object,
|
|
435
|
+
|
|
436
|
+
/** style inline for clear icon */
|
|
437
|
+
clearIconStyle: PropTypes.object,
|
|
438
|
+
|
|
439
|
+
/** the props of confirm button */
|
|
440
|
+
confirmProps: PropTypes.object,
|
|
441
|
+
|
|
442
|
+
/** the props of cancel button */
|
|
443
|
+
cancelProps: PropTypes.object,
|
|
444
|
+
|
|
445
|
+
/** the function to get ref of Popup */
|
|
446
|
+
refs: PropTypes.func,
|
|
447
|
+
|
|
448
|
+
/** the function to get events of Popup (show/close) */
|
|
449
|
+
getPopup: PropTypes.func,
|
|
450
|
+
|
|
451
|
+
/** the function run when close Popup */
|
|
452
|
+
onClose: PropTypes.func,
|
|
453
|
+
|
|
454
|
+
/** the function run when click confirm button */
|
|
455
|
+
onConfirm: PropTypes.func,
|
|
456
|
+
|
|
457
|
+
/** the function run when click cancel button */
|
|
458
|
+
onCancel: PropTypes.func,
|
|
459
|
+
|
|
460
|
+
/** set top position for Popup */
|
|
461
|
+
top: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
462
|
+
|
|
463
|
+
/** show a dark background under the popup if true */
|
|
464
|
+
fullScreen: PropTypes.bool,
|
|
465
|
+
|
|
466
|
+
/** the full content will display in Popup if set */
|
|
467
|
+
children: PropTypes.any
|
|
468
|
+
};
|
|
469
|
+
export default Popup;
|