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,676 @@
|
|
|
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 { css, jsx } from '@emotion/core';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
9
|
+
import { render } from 'react-dom';
|
|
10
|
+
import { getGlobal } from '../../../global';
|
|
11
|
+
import { date as moment, capitalizeSentenceCase, randomString, updatePosition } from '../../../utils';
|
|
12
|
+
import CalendarComp from '../calendar';
|
|
13
|
+
import ControlComp from '../control';
|
|
14
|
+
import theme from '../../../theme/settings';
|
|
15
|
+
import Icon from '../../../icons/';
|
|
16
|
+
import { HelperText, InputBase, Label } from '../../index';
|
|
17
|
+
import Button from '../../button';
|
|
18
|
+
import Tooltip from '../../tooltip';
|
|
19
|
+
const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
20
|
+
actionIconAt,
|
|
21
|
+
clearAble,
|
|
22
|
+
controls,
|
|
23
|
+
defaultValue,
|
|
24
|
+
disabled,
|
|
25
|
+
displayAnotherMonth,
|
|
26
|
+
displayFormat,
|
|
27
|
+
error,
|
|
28
|
+
errorProps,
|
|
29
|
+
inputProps,
|
|
30
|
+
inputStyle,
|
|
31
|
+
label,
|
|
32
|
+
labelProps,
|
|
33
|
+
max,
|
|
34
|
+
min,
|
|
35
|
+
onChange,
|
|
36
|
+
placeholder,
|
|
37
|
+
pressESCToClose,
|
|
38
|
+
readOnly,
|
|
39
|
+
required,
|
|
40
|
+
returnFormat,
|
|
41
|
+
style,
|
|
42
|
+
textAlign,
|
|
43
|
+
value,
|
|
44
|
+
viewType,
|
|
45
|
+
...props
|
|
46
|
+
}, reference) => {
|
|
47
|
+
var _ipRef$current, _ipRef$current2;
|
|
48
|
+
|
|
49
|
+
const [id] = useState(randomString(6, {
|
|
50
|
+
allowSymbol: false
|
|
51
|
+
}));
|
|
52
|
+
const unique = {
|
|
53
|
+
disabled: 'DGN-UI-DatePicker-disabled',
|
|
54
|
+
error: 'DGN-UI-DatePicker-error',
|
|
55
|
+
focus: 'DGN-UI-DatePicker-focus',
|
|
56
|
+
footer: 'DGN-UI-DatePicker-Footer',
|
|
57
|
+
cancel: 'DGN-UI-DatePicker-cancel',
|
|
58
|
+
confirm: 'DGN-UI-DatePicker-confirm',
|
|
59
|
+
backGr: 'DGN-UI-DatePicker-Background',
|
|
60
|
+
icon: 'DGN-UI-DatePicker-Icon',
|
|
61
|
+
picker: `DGN-UI-DatePicker-Picker-${id}`,
|
|
62
|
+
portal: 'DGN-UI-Portal'
|
|
63
|
+
};
|
|
64
|
+
const calRef = useRef(null);
|
|
65
|
+
const footerRef = useRef(null);
|
|
66
|
+
const iconRef = useRef(null);
|
|
67
|
+
const ipConRef = useRef(null);
|
|
68
|
+
const ipRef = useRef(null);
|
|
69
|
+
const ref = useRef(null);
|
|
70
|
+
const displayValue = useRef();
|
|
71
|
+
const focusedValue = useRef(null);
|
|
72
|
+
const [, setDisplayValue] = useState(Date.now());
|
|
73
|
+
const [, setFocusedValue] = useState(Date.now()); // const [actionsState, setActionsState] = useState(true);
|
|
74
|
+
|
|
75
|
+
useImperativeHandle(reference, () => ({
|
|
76
|
+
get: () => {
|
|
77
|
+
return ref.current;
|
|
78
|
+
},
|
|
79
|
+
getInputContainer: () => {
|
|
80
|
+
return ipConRef.current;
|
|
81
|
+
},
|
|
82
|
+
getInput: () => {
|
|
83
|
+
return ipRef.current;
|
|
84
|
+
},
|
|
85
|
+
getCalendar: () => {
|
|
86
|
+
return calRef.current;
|
|
87
|
+
},
|
|
88
|
+
getIcon: () => {
|
|
89
|
+
return iconRef.current;
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
const confirmText = getGlobal(['confirm']);
|
|
93
|
+
const cancelText = getGlobal(['cancel']);
|
|
94
|
+
const iconAreaCSS = css`
|
|
95
|
+
align-items : center;
|
|
96
|
+
color : inherit;
|
|
97
|
+
display : flex;
|
|
98
|
+
width : 24px;
|
|
99
|
+
& span {
|
|
100
|
+
padding: 0;
|
|
101
|
+
}
|
|
102
|
+
.${unique.icon} {
|
|
103
|
+
cursor : pointer;
|
|
104
|
+
opacity : 0;
|
|
105
|
+
transition : visibility 50ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, opacity 300ms cubic-bezier(0.4, 0, 0.2, 1) 50ms;
|
|
106
|
+
visibility : hidden;
|
|
107
|
+
will-change: visibility, opacity;
|
|
108
|
+
}
|
|
109
|
+
.${unique.icon}-cancel {
|
|
110
|
+
transform : translateX(-100%);
|
|
111
|
+
}
|
|
112
|
+
.${unique.icon}-accept {
|
|
113
|
+
opacity : 1;
|
|
114
|
+
visibility: visible;
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
const hiddenStyle = {
|
|
118
|
+
opacity: 0,
|
|
119
|
+
visibility: 'hidden'
|
|
120
|
+
};
|
|
121
|
+
const activeStyle = {
|
|
122
|
+
opacity: 1,
|
|
123
|
+
pointerEvents: 'none',
|
|
124
|
+
visibility: 'visible'
|
|
125
|
+
};
|
|
126
|
+
const pickerCSS = {
|
|
127
|
+
backGr: 'background-color: transparent; inset: 0px; pointer-events: auto; position: fixed; z-index: 9001;',
|
|
128
|
+
picker: (position, left, width) => css`
|
|
129
|
+
background-color: ${theme.colors.white};
|
|
130
|
+
border-radius : ${theme.border.radius};
|
|
131
|
+
height : max-content;
|
|
132
|
+
left : ${left}px;
|
|
133
|
+
max-width : 400px;
|
|
134
|
+
min-width : ${window.innerWidth <= 599 ? 280 : 314}px;
|
|
135
|
+
opacity : 0;
|
|
136
|
+
position : fixed;
|
|
137
|
+
top : ${position.top}px;
|
|
138
|
+
transform : scale(0);
|
|
139
|
+
transform-origin: ${position.transformOrigin};
|
|
140
|
+
transition : opacity 120ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
141
|
+
width : ${width}px;
|
|
142
|
+
z-index : 9002;
|
|
143
|
+
`,
|
|
144
|
+
active: {
|
|
145
|
+
opacity: 1,
|
|
146
|
+
transform: 'scale(1)'
|
|
147
|
+
},
|
|
148
|
+
remove: {
|
|
149
|
+
opacity: 0,
|
|
150
|
+
pointerEvents: 'none',
|
|
151
|
+
transform: 'scale(0)'
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const controlContainerCSS = css`
|
|
155
|
+
display : flex;
|
|
156
|
+
justify-content: flex-end;
|
|
157
|
+
margin : 0 16px 16px;
|
|
158
|
+
`;
|
|
159
|
+
const buttonProps = {
|
|
160
|
+
style: {
|
|
161
|
+
margin: '0 2px',
|
|
162
|
+
padding: '7px 8px'
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const isValid = time => {
|
|
167
|
+
return !isNaN(Date.parse(typeof time !== 'date' ? new Date(time) : time));
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const handleDisplayValue = useCallback(value => {
|
|
171
|
+
displayValue.current = new Date(value);
|
|
172
|
+
setDisplayValue();
|
|
173
|
+
}, [displayValue]);
|
|
174
|
+
const handleFocusedValue = useCallback(value => {
|
|
175
|
+
focusedValue.current = new Date(value);
|
|
176
|
+
setFocusedValue();
|
|
177
|
+
}, [focusedValue]);
|
|
178
|
+
|
|
179
|
+
const setButtonState = () => {
|
|
180
|
+
if (!footerRef.current || focusedValue.current === undefined || !isValid(focusedValue.current)) return;
|
|
181
|
+
const isEqual = focusedValue.current === null || Date.parse(new Date(focusedValue.current)) === Date.parse(new Date(displayValue.current));
|
|
182
|
+
footerRef.current.querySelector(`.${unique.cancel}`).disabled = isEqual;
|
|
183
|
+
footerRef.current.querySelector(`.${unique.confirm}`).disabled = isEqual;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const onConfirm = () => {
|
|
187
|
+
displayValue.current = focusedValue.current;
|
|
188
|
+
setButtonState();
|
|
189
|
+
onChangeValue({
|
|
190
|
+
value: focusedValue.current
|
|
191
|
+
});
|
|
192
|
+
closePicker();
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const onCancel = () => {
|
|
196
|
+
focusedValue.current = null;
|
|
197
|
+
setButtonState();
|
|
198
|
+
closePicker();
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
const formatValue = (value, format, utc = false) => {
|
|
202
|
+
return moment(value).format(format, utc);
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const setInputValue = e => {
|
|
206
|
+
ipRef.current.value = capitalizeSentenceCase(formatValue(e.value, displayFormat));
|
|
207
|
+
if (clearAble) onSwap(false);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const onChangeValue = e => {
|
|
211
|
+
setInputValue(e);
|
|
212
|
+
!!onChange && onChange({
|
|
213
|
+
value: formatValue(e.value, returnFormat)
|
|
214
|
+
});
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
const onCalendarClick = e => {
|
|
218
|
+
handleFocusedValue(e.value);
|
|
219
|
+
controls ? setButtonState() : onChangeValue(e);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
const getPickerStyle = () => {
|
|
223
|
+
const {
|
|
224
|
+
innerHeight
|
|
225
|
+
} = window;
|
|
226
|
+
const {
|
|
227
|
+
left,
|
|
228
|
+
height,
|
|
229
|
+
top,
|
|
230
|
+
width
|
|
231
|
+
} = ipConRef.current.getBoundingClientRect();
|
|
232
|
+
const pickerHeight = controls ? 310 : 256;
|
|
233
|
+
let style = {};
|
|
234
|
+
style.top = top + height + 4;
|
|
235
|
+
style.transformOrigin = '50% 20%';
|
|
236
|
+
|
|
237
|
+
if (style.top + pickerHeight > innerHeight) {
|
|
238
|
+
if (top - pickerHeight > 0) {
|
|
239
|
+
style.top = top - pickerHeight - 4;
|
|
240
|
+
style.transformOrigin = '50% 80%';
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return pickerCSS.picker(style, left, width).styles;
|
|
245
|
+
}; // const createPortal = () => {
|
|
246
|
+
// let portal = document.getElementById(unique.portal);
|
|
247
|
+
// if (!portal) {
|
|
248
|
+
// portal = document.createElement('div');
|
|
249
|
+
// portal.id = unique.portal;
|
|
250
|
+
// document.body.appendChild(portal);
|
|
251
|
+
// }
|
|
252
|
+
// portal.style.cssText = pickerCSS.portal;
|
|
253
|
+
// return portal;
|
|
254
|
+
// };
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
const createBackground = () => {
|
|
258
|
+
let background = document.getElementById(unique.backGr);
|
|
259
|
+
|
|
260
|
+
if (!background) {
|
|
261
|
+
background = document.createElement('div');
|
|
262
|
+
background.id = unique.backGr;
|
|
263
|
+
background.classList.add(unique.portal, unique.backGr);
|
|
264
|
+
document.body.appendChild(background);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
background.style.cssText = pickerCSS.backGr;
|
|
268
|
+
return background;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const createPicker = () => {
|
|
272
|
+
const picker = document.createElement('div');
|
|
273
|
+
picker.id = unique.picker;
|
|
274
|
+
picker.style.cssText = getPickerStyle();
|
|
275
|
+
return picker;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
const pressESCHandler = event => {
|
|
279
|
+
if (event.key === 'Escape') {
|
|
280
|
+
onClickOutside({
|
|
281
|
+
target: null
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
const onScroll = () => {
|
|
289
|
+
const node = document.getElementById(unique.picker);
|
|
290
|
+
|
|
291
|
+
if (!ipConRef.current || !node) {
|
|
292
|
+
window.removeEventListener('scroll', onScroll);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
updatePosition(ipConRef.current, node, closePicker);
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const onResize = () => {
|
|
300
|
+
if (!ref.current) return;
|
|
301
|
+
const {
|
|
302
|
+
width
|
|
303
|
+
} = ref.current.getBoundingClientRect();
|
|
304
|
+
const node = document.getElementById(unique.picker);
|
|
305
|
+
|
|
306
|
+
if (node) {
|
|
307
|
+
node.style.width = width + 'px';
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
onScroll();
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
const openPicker = () => {
|
|
314
|
+
const backGr = createBackground();
|
|
315
|
+
const picker = createPicker();
|
|
316
|
+
render(jsx(CalendarComp, {
|
|
317
|
+
ref: calRef,
|
|
318
|
+
actions: controls && footerMemo,
|
|
319
|
+
defaultValue: displayValue.current,
|
|
320
|
+
value: focusedValue.current,
|
|
321
|
+
max: max,
|
|
322
|
+
min: min,
|
|
323
|
+
displayAnotherMonth: displayAnotherMonth,
|
|
324
|
+
onClick: onCalendarClick
|
|
325
|
+
}), backGr.appendChild(picker));
|
|
326
|
+
setTimeout(() => {
|
|
327
|
+
Object.assign(picker.style, { ...pickerCSS.active
|
|
328
|
+
});
|
|
329
|
+
window.addEventListener('resize', onResize);
|
|
330
|
+
window.addEventListener('scroll', onScroll);
|
|
331
|
+
document.addEventListener('mousedown', onClickOutside);
|
|
332
|
+
|
|
333
|
+
if (pressESCToClose) {
|
|
334
|
+
document.addEventListener('keydown', pressESCHandler);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
setButtonState();
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
const closePicker = () => {
|
|
342
|
+
const backGr = document.getElementById(unique.backGr);
|
|
343
|
+
if (!backGr) return;
|
|
344
|
+
const picker = backGr.querySelector(`#${unique.picker}`);
|
|
345
|
+
if (!picker) return;
|
|
346
|
+
Object.assign(picker.style, { ...pickerCSS.remove
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
if (pressESCToClose) {
|
|
350
|
+
document.removeEventListener('keydown', pressESCHandler);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
document.removeEventListener('mousedown', onClickOutside);
|
|
354
|
+
window.removeEventListener('scroll', onScroll);
|
|
355
|
+
window.removeEventListener('resize', onResize);
|
|
356
|
+
setTimeout(() => {
|
|
357
|
+
backGr.remove();
|
|
358
|
+
}, 200);
|
|
359
|
+
|
|
360
|
+
if (ipConRef.current) {
|
|
361
|
+
ipConRef.current.classList.remove(unique.focus);
|
|
362
|
+
ipConRef.current.style.zIndex = null;
|
|
363
|
+
} // iconRef.current && onSwap(true);
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
ipRef.current && ipRef.current.blur();
|
|
367
|
+
}; // const updatePicker = () => {
|
|
368
|
+
// const portal = document.body.querySelector(`#${unique.portal}`);
|
|
369
|
+
// if (!portal) return;
|
|
370
|
+
// const backGr = portal.querySelector(`#${unique.backGr}`);
|
|
371
|
+
// if (!backGr) return;
|
|
372
|
+
// const node = portal.querySelector(`#${unique.picker}`);
|
|
373
|
+
// if (!node || !node.firstChild) return;
|
|
374
|
+
// unmountComponentAtNode(node);
|
|
375
|
+
// render(
|
|
376
|
+
// <CalendarComp
|
|
377
|
+
// ref={calRef}
|
|
378
|
+
// actions={footerMemo}
|
|
379
|
+
// defaultValue={displayValue.current}
|
|
380
|
+
// value={focusedValue.current}
|
|
381
|
+
// max={max}
|
|
382
|
+
// min={min}
|
|
383
|
+
// displayAnotherMonth={displayAnotherMonth}
|
|
384
|
+
// onClick={onCalendarClick}
|
|
385
|
+
// />, node);
|
|
386
|
+
// };
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
const onSwap = open => {
|
|
390
|
+
const t = iconRef.current.childNodes[+open];
|
|
391
|
+
|
|
392
|
+
if (open) {
|
|
393
|
+
Object.assign(t.style, { ...hiddenStyle
|
|
394
|
+
});
|
|
395
|
+
Object.assign(t.previousSibling.style, { ...activeStyle
|
|
396
|
+
});
|
|
397
|
+
setTimeout(() => {
|
|
398
|
+
t.previousSibling.style.pointerEvents = null;
|
|
399
|
+
}, 200);
|
|
400
|
+
} else {
|
|
401
|
+
Object.assign(t.style, { ...hiddenStyle
|
|
402
|
+
});
|
|
403
|
+
Object.assign(t.nextSibling.style, { ...activeStyle
|
|
404
|
+
});
|
|
405
|
+
setTimeout(() => {
|
|
406
|
+
t.nextSibling.style.pointerEvents = null;
|
|
407
|
+
}, 200);
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
const onInputFocus = () => {
|
|
412
|
+
const el = ipConRef.current;
|
|
413
|
+
|
|
414
|
+
if (!el.classList.contains(unique.focus)) {
|
|
415
|
+
el.classList.add(unique.focus);
|
|
416
|
+
el.style.zIndex = 9001;
|
|
417
|
+
openPicker();
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
const onClickOutside = e => {
|
|
422
|
+
if (ipConRef.current && !ipConRef.current.contains(e.target) && ipRef.current && !ipRef.current.contains(e.target) && calRef.current && !calRef.current.contains(e.target)) {
|
|
423
|
+
controls ? onCancel() : closePicker();
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
const triggerFocus = () => {
|
|
428
|
+
if (!ipConRef.current.classList.contains(unique.focus)) {
|
|
429
|
+
ipRef.current.focus();
|
|
430
|
+
} else {
|
|
431
|
+
onClickOutside({
|
|
432
|
+
target: null
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
const onClear = () => {
|
|
438
|
+
if (!clearAble && !ipRef.current) return;
|
|
439
|
+
ipRef.current.value = '';
|
|
440
|
+
focusedValue.current = null;
|
|
441
|
+
setButtonState();
|
|
442
|
+
const e = {
|
|
443
|
+
value: null
|
|
444
|
+
};
|
|
445
|
+
!!onChange && onChange(e);
|
|
446
|
+
onSwap(true);
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
const iconComp = jsx("div", {
|
|
450
|
+
css: iconAreaCSS,
|
|
451
|
+
ref: iconRef
|
|
452
|
+
}, jsx(Icon, {
|
|
453
|
+
onClick: triggerFocus,
|
|
454
|
+
className: `${unique.icon} ${unique.icon}-accept`,
|
|
455
|
+
viewBox: true,
|
|
456
|
+
name: 'CalendarNew'
|
|
457
|
+
}), jsx(Icon, {
|
|
458
|
+
onClick: onClear,
|
|
459
|
+
className: `${unique.icon} ${unique.icon}-cancel`,
|
|
460
|
+
viewBox: true,
|
|
461
|
+
name: 'Close'
|
|
462
|
+
}));
|
|
463
|
+
const endIcon = actionIconAt === 'end' && iconComp;
|
|
464
|
+
const startIcon = actionIconAt === 'start' && iconComp;
|
|
465
|
+
const footerMemo = jsx("div", {
|
|
466
|
+
css: controlContainerCSS,
|
|
467
|
+
className: unique.footer,
|
|
468
|
+
ref: footerRef
|
|
469
|
+
}, jsx(Button, _extends({}, buttonProps, {
|
|
470
|
+
className: unique.cancel,
|
|
471
|
+
onClick: onCancel
|
|
472
|
+
}), cancelText), jsx(Button, _extends({}, buttonProps, {
|
|
473
|
+
color: 'info',
|
|
474
|
+
className: unique.confirm,
|
|
475
|
+
onClick: onConfirm
|
|
476
|
+
}), confirmText));
|
|
477
|
+
const isError = !!error && (!value || !isValid(value));
|
|
478
|
+
useEffect(() => {
|
|
479
|
+
if (defaultValue && isValid(defaultValue)) {
|
|
480
|
+
handleDisplayValue(defaultValue);
|
|
481
|
+
setInputValue({
|
|
482
|
+
value: displayValue.current
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
return () => {
|
|
487
|
+
closePicker();
|
|
488
|
+
};
|
|
489
|
+
}, []);
|
|
490
|
+
useEffect(() => {
|
|
491
|
+
if (value && isValid(value)) {
|
|
492
|
+
handleFocusedValue(value);
|
|
493
|
+
handleDisplayValue(value);
|
|
494
|
+
setInputValue({
|
|
495
|
+
value: displayValue.current
|
|
496
|
+
});
|
|
497
|
+
setButtonState();
|
|
498
|
+
closePicker();
|
|
499
|
+
} else {
|
|
500
|
+
if (ipRef.current) ipRef.current.value = '';
|
|
501
|
+
|
|
502
|
+
if (clearAble) {
|
|
503
|
+
onSwap(true);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
setButtonState();
|
|
507
|
+
closePicker();
|
|
508
|
+
}
|
|
509
|
+
}, [value]);
|
|
510
|
+
useEffect(() => {
|
|
511
|
+
if (!readOnly) {
|
|
512
|
+
ipRef.current.addEventListener('focus', onInputFocus);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
return () => {
|
|
516
|
+
if (!ipRef.current) return;
|
|
517
|
+
|
|
518
|
+
if (!readOnly) {
|
|
519
|
+
ipRef.current.removeEventListener('focus', onInputFocus);
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
}, [onChange]);
|
|
523
|
+
useEffect(() => {
|
|
524
|
+
if (ipRef.current.value !== '') {
|
|
525
|
+
const e = {
|
|
526
|
+
value: focusedValue.current || displayValue.current
|
|
527
|
+
};
|
|
528
|
+
setInputValue(e, displayFormat);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
if (disabled) {
|
|
532
|
+
iconRef.current.childNodes[0].style.pointerEvents = 'none';
|
|
533
|
+
closePicker();
|
|
534
|
+
} else if (!readOnly) {
|
|
535
|
+
ipRef.current.addEventListener('focus', onInputFocus);
|
|
536
|
+
} else {
|
|
537
|
+
iconRef.current.childNodes[0].style.pointerEvents = 'none';
|
|
538
|
+
closePicker();
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
return () => {
|
|
542
|
+
if (!iconRef.current || !ipRef.current) return;
|
|
543
|
+
|
|
544
|
+
if (disabled) {
|
|
545
|
+
iconRef.current.childNodes[0].style.pointerEvents = null;
|
|
546
|
+
} else if (!readOnly) {
|
|
547
|
+
ipRef.current.removeEventListener('focus', onInputFocus);
|
|
548
|
+
} else {
|
|
549
|
+
iconRef.current.childNodes[0].style.pointerEvents = null;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
closePicker();
|
|
553
|
+
};
|
|
554
|
+
}, [actionIconAt, clearAble, controls, disabled, displayFormat, displayAnotherMonth, max, min, readOnly, returnFormat, viewType]);
|
|
555
|
+
return jsx(ControlComp, _extends({}, props, {
|
|
556
|
+
disabled: disabled,
|
|
557
|
+
error: isError,
|
|
558
|
+
ref: ref,
|
|
559
|
+
style: style
|
|
560
|
+
}), !!label && jsx(Label, _extends({}, labelProps, {
|
|
561
|
+
disabled: disabled,
|
|
562
|
+
required: required
|
|
563
|
+
}), label), jsx(Tooltip, {
|
|
564
|
+
title: (ipRef === null || ipRef === void 0 ? void 0 : (_ipRef$current = ipRef.current) === null || _ipRef$current === void 0 ? void 0 : _ipRef$current.clientWidth) < 200 ? ipRef === null || ipRef === void 0 ? void 0 : (_ipRef$current2 = ipRef.current) === null || _ipRef$current2 === void 0 ? void 0 : _ipRef$current2.value : '',
|
|
565
|
+
style: {
|
|
566
|
+
width: 'none'
|
|
567
|
+
}
|
|
568
|
+
}, jsx(InputBase, _extends({
|
|
569
|
+
placeholder: placeholder
|
|
570
|
+
}, inputProps, {
|
|
571
|
+
readOnly: true,
|
|
572
|
+
ref: ipConRef,
|
|
573
|
+
inputRef: ipRef,
|
|
574
|
+
disabled: disabled,
|
|
575
|
+
viewType: viewType,
|
|
576
|
+
inputStyle: {
|
|
577
|
+
textAlign: textAlign,
|
|
578
|
+
...inputStyle
|
|
579
|
+
},
|
|
580
|
+
startIcon: startIcon,
|
|
581
|
+
startIconProps: {
|
|
582
|
+
className: 'non-effect allow-disabled'
|
|
583
|
+
},
|
|
584
|
+
endIcon: endIcon
|
|
585
|
+
}))), isError && jsx(HelperText, _extends({}, errorProps, {
|
|
586
|
+
disabled: disabled
|
|
587
|
+
}), error));
|
|
588
|
+
}));
|
|
589
|
+
DatePicker.defaultProps = {
|
|
590
|
+
actionIconAt: 'end',
|
|
591
|
+
clearAble: false,
|
|
592
|
+
controls: false,
|
|
593
|
+
disabled: false,
|
|
594
|
+
displayAnotherMonth: true,
|
|
595
|
+
displayFormat: 'dddd, DD MMMM YYYY',
|
|
596
|
+
pressESCToClose: true,
|
|
597
|
+
readOnly: false,
|
|
598
|
+
required: false,
|
|
599
|
+
textAlign: 'start',
|
|
600
|
+
returnFormat: 'YYYY-MM-DD',
|
|
601
|
+
viewType: 'underlined'
|
|
602
|
+
};
|
|
603
|
+
DatePicker.propTypes = {
|
|
604
|
+
/** action icons position */
|
|
605
|
+
actionIconAt: PropTypes.oneOf(['end', 'start']),
|
|
606
|
+
|
|
607
|
+
/** display the clear icon if true */
|
|
608
|
+
clearAble: PropTypes.bool,
|
|
609
|
+
|
|
610
|
+
/** if 'true' the calendar will have a footer controls */
|
|
611
|
+
controls: PropTypes.bool,
|
|
612
|
+
|
|
613
|
+
/** the default value of the component */
|
|
614
|
+
defaultValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
|
615
|
+
|
|
616
|
+
/** if 'true' the form control will be disabled */
|
|
617
|
+
disabled: PropTypes.bool,
|
|
618
|
+
|
|
619
|
+
/** format to display value */
|
|
620
|
+
displayFormat: PropTypes.oneOfType([PropTypes.oneOf(['DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD', 'DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD']), PropTypes.string]),
|
|
621
|
+
|
|
622
|
+
/** view days of previous or next month */
|
|
623
|
+
displayAnotherMonth: PropTypes.bool,
|
|
624
|
+
|
|
625
|
+
/** error of the form control */
|
|
626
|
+
error: PropTypes.string,
|
|
627
|
+
|
|
628
|
+
/** inputProps are properties of the input element */
|
|
629
|
+
inputProps: PropTypes.object,
|
|
630
|
+
|
|
631
|
+
/** inputStyle is style of input element */
|
|
632
|
+
inputStyle: PropTypes.object,
|
|
633
|
+
|
|
634
|
+
/** content of the label element */
|
|
635
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
636
|
+
|
|
637
|
+
/** labelProps are properties if the label element */
|
|
638
|
+
labelProps: PropTypes.object,
|
|
639
|
+
|
|
640
|
+
/** min value of date picker */
|
|
641
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
|
642
|
+
|
|
643
|
+
/** max value of date picker */
|
|
644
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
|
|
645
|
+
|
|
646
|
+
/** a callback function when value input change */
|
|
647
|
+
onChange: PropTypes.func,
|
|
648
|
+
|
|
649
|
+
/** hints for input */
|
|
650
|
+
placeholder: PropTypes.string,
|
|
651
|
+
|
|
652
|
+
/** allow close Popup when press ESC */
|
|
653
|
+
pressESCToClose: PropTypes.bool,
|
|
654
|
+
|
|
655
|
+
/** status read only of input */
|
|
656
|
+
readOnly: PropTypes.bool,
|
|
657
|
+
|
|
658
|
+
/** required state of the form control */
|
|
659
|
+
required: PropTypes.bool,
|
|
660
|
+
|
|
661
|
+
/** format of the returned value */
|
|
662
|
+
returnFormat: PropTypes.oneOfType([PropTypes.oneOf(['DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD', 'DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD']), PropTypes.string]),
|
|
663
|
+
|
|
664
|
+
/** style of the component */
|
|
665
|
+
style: PropTypes.object,
|
|
666
|
+
|
|
667
|
+
/** text align of the input */
|
|
668
|
+
textAlign: PropTypes.oneOf(['center', 'end', 'start']),
|
|
669
|
+
|
|
670
|
+
/** value of the component */
|
|
671
|
+
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string, PropTypes.array]),
|
|
672
|
+
|
|
673
|
+
/** view type of the form control */
|
|
674
|
+
viewType: PropTypes.oneOf(['outlined', 'underlined'])
|
|
675
|
+
};
|
|
676
|
+
export default DatePicker;
|