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
package/utils/number.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {String} value
|
|
4
|
+
* @param {String} format
|
|
5
|
+
*/
|
|
6
|
+
export default function numberFormat(value, format) {
|
|
7
|
+
let hashCount = 0;
|
|
8
|
+
let a = '';
|
|
9
|
+
|
|
10
|
+
for (let i = 0, ln = format.length; i < ln; i++) {
|
|
11
|
+
if (format[i] === '.') {
|
|
12
|
+
format1 = format.split('.');
|
|
13
|
+
console.log(format1);
|
|
14
|
+
|
|
15
|
+
if (format1 = format.split('.').length === 3) {
|
|
16
|
+
console.log('a');
|
|
17
|
+
} else {
|
|
18
|
+
hashCount = format1[1].length;
|
|
19
|
+
|
|
20
|
+
switch (hashCount) {
|
|
21
|
+
case 3:
|
|
22
|
+
a = value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
23
|
+
break;
|
|
24
|
+
|
|
25
|
+
case 2:
|
|
26
|
+
a = value.toString().replace(/\B(?=(\d{2})+(?!\d))/g, ",");
|
|
27
|
+
break;
|
|
28
|
+
|
|
29
|
+
default:
|
|
30
|
+
return 'Invalid format';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return a;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (format[i] === ' ') {
|
|
38
|
+
const formatArray = format.split('#').filter(str => str !== '');
|
|
39
|
+
let start = 0;
|
|
40
|
+
let numStr = '';
|
|
41
|
+
|
|
42
|
+
for (let i = 0, ln = format.length; i <= ln; i++) {
|
|
43
|
+
const part = formatArray[i] || ''; //if i is the last fragment take the index of end of the value
|
|
44
|
+
//For case like +1 (911) 911 91 91 having pattern +1 (###) ### ## ##
|
|
45
|
+
|
|
46
|
+
const index = i === ln ? value.length : value.indexOf(part, start);
|
|
47
|
+
/* in any case if we don't find the pattern part in the value assume the val as numeric string
|
|
48
|
+
This will be also in case if user has started typing, in any other case it will not be -1
|
|
49
|
+
unless wrong prop value is provided */
|
|
50
|
+
|
|
51
|
+
if (index === -1) {
|
|
52
|
+
numStr = value;
|
|
53
|
+
break;
|
|
54
|
+
} else {
|
|
55
|
+
numStr += val.substring(start, index);
|
|
56
|
+
start = index + part.length;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return (numStr.toString() || []).replace(/\B(?=(\d{4})+(?!\d))/g, " ");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { isPlainObject } from '../type';
|
|
2
|
+
export const extendFromObject = (target = {}, source, overrideExistingValues) => {
|
|
3
|
+
for (const prop in source) {
|
|
4
|
+
if (Object.prototype.hasOwnProperty.call(source, prop)) {
|
|
5
|
+
const value = source[prop];
|
|
6
|
+
|
|
7
|
+
if (!(prop in target) || overrideExistingValues) {
|
|
8
|
+
target[prop] = value;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return target;
|
|
14
|
+
};
|
|
15
|
+
export const extend = function (target = {}) {
|
|
16
|
+
let i = 1;
|
|
17
|
+
let deep = false;
|
|
18
|
+
|
|
19
|
+
if (typeof target === 'boolean') {
|
|
20
|
+
deep = target;
|
|
21
|
+
target = arguments[1] || {};
|
|
22
|
+
i++;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for (; i < arguments.length; i++) {
|
|
26
|
+
const source = arguments[i];
|
|
27
|
+
|
|
28
|
+
if (source == null) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
for (const key in source) {
|
|
33
|
+
const targetValue = target[key];
|
|
34
|
+
const sourceValue = source[key];
|
|
35
|
+
let sourceValueIsArray = false;
|
|
36
|
+
let clone;
|
|
37
|
+
|
|
38
|
+
if (key === '__proto__' || key === 'constructor' || target === sourceValue) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (deep && sourceValue && (isPlainObject(sourceValue) || (sourceValueIsArray = Array.isArray(sourceValue)))) {
|
|
43
|
+
if (sourceValueIsArray) {
|
|
44
|
+
clone = targetValue && Array.isArray(targetValue) ? targetValue : [];
|
|
45
|
+
} else {
|
|
46
|
+
clone = targetValue && isPlainObject(targetValue) ? targetValue : {};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
target[key] = extend(deep, clone, sourceValue);
|
|
50
|
+
} else if (sourceValue !== undefined) {
|
|
51
|
+
target[key] = sourceValue;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return target;
|
|
57
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { isNumeric } from '../type'; // import { isNumeric, isPlainObject, isObject } from './type';
|
|
2
|
+
// import variableWrapper from './variable_wrapper';
|
|
3
|
+
|
|
4
|
+
const clone = (() => {
|
|
5
|
+
function Clone() {}
|
|
6
|
+
|
|
7
|
+
return obj => {
|
|
8
|
+
Clone.prototype = obj;
|
|
9
|
+
return new Clone();
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
|
|
13
|
+
const orderEach = function (map, func) {
|
|
14
|
+
const keys = [];
|
|
15
|
+
let key;
|
|
16
|
+
let i;
|
|
17
|
+
|
|
18
|
+
for (key in map) {
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(map, key)) {
|
|
20
|
+
keys.push(key);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
keys.sort((x, y) => {
|
|
25
|
+
const isNumberX = isNumeric(x);
|
|
26
|
+
const isNumberY = isNumeric(y);
|
|
27
|
+
if (isNumberX && isNumberY) return x - y;
|
|
28
|
+
if (isNumberX && !isNumberY) return -1;
|
|
29
|
+
if (!isNumberX && isNumberY) return 1;
|
|
30
|
+
if (x < y) return -1;
|
|
31
|
+
if (x > y) return 1;
|
|
32
|
+
return 0;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
for (i = 0; i < keys.length; i++) {
|
|
36
|
+
key = keys[i];
|
|
37
|
+
func(key, map[key]);
|
|
38
|
+
}
|
|
39
|
+
}; // const assignValueToProperty = ( target, property, value, assignByReference ) => {
|
|
40
|
+
// if (!assignByReference && variableWrapper.isWrapped(target[property])) {
|
|
41
|
+
// variableWrapper.assign(target[property], value);
|
|
42
|
+
// } else {
|
|
43
|
+
// target[property] = value;
|
|
44
|
+
// }
|
|
45
|
+
// };
|
|
46
|
+
// // B239679, http://bugs.jquery.com/ticket/9477
|
|
47
|
+
// const deepExtendArraySafe = ( target, changes, extendComplexObject, assignByReference ) => {
|
|
48
|
+
// let prevValue;
|
|
49
|
+
// let newValue;
|
|
50
|
+
// for (const name in changes) {
|
|
51
|
+
// prevValue = target[name];
|
|
52
|
+
// newValue = changes[name];
|
|
53
|
+
// if ( name === '__proto__' || name === 'constructor' || target === newValue ) { continue; }
|
|
54
|
+
// if (isPlainObject(newValue)) {
|
|
55
|
+
// const goDeeper = extendComplexObject ? isObject(prevValue) : isPlainObject(prevValue);
|
|
56
|
+
// newValue = deepExtendArraySafe( goDeeper ? prevValue : {}, newValue, extendComplexObject, assignByReference );
|
|
57
|
+
// }
|
|
58
|
+
// if (newValue !== undefined && prevValue !== newValue) {
|
|
59
|
+
// assignValueToProperty(target, name, newValue, assignByReference);
|
|
60
|
+
// }
|
|
61
|
+
// }
|
|
62
|
+
// return target;
|
|
63
|
+
// };
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export { clone, orderEach
|
|
67
|
+
/**, deepExtendArraySafe */
|
|
68
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const parseHTML = (text, output = 'innerHTML') => {
|
|
2
|
+
if (!text) return null;
|
|
3
|
+
const DOM = new DOMParser().parseFromString(text, 'text/html').querySelector('body');
|
|
4
|
+
const result = DOM[output];
|
|
5
|
+
return result && result.trim ? result.trim() : result;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export default parseHTML;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const slice = Array.prototype.slice;
|
|
2
|
+
let Promise;
|
|
3
|
+
|
|
4
|
+
if (typeof window !== 'undefined') {
|
|
5
|
+
Promise = window.Promise;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (typeof global !== 'undefined') {
|
|
9
|
+
Promise = global.Promise;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function promisify(func) {
|
|
13
|
+
if (Promise) {
|
|
14
|
+
return function () {
|
|
15
|
+
const args = slice.call(arguments);
|
|
16
|
+
const ctx = this;
|
|
17
|
+
|
|
18
|
+
if (typeof args.slice(-1) === 'function') {
|
|
19
|
+
return func.apply(ctx, args);
|
|
20
|
+
} else {
|
|
21
|
+
return new Promise(function (resolve, reject) {
|
|
22
|
+
args.push(function (err, result) {
|
|
23
|
+
if (err) {
|
|
24
|
+
reject(err);
|
|
25
|
+
} else {
|
|
26
|
+
resolve.apply(this, slice.call(arguments, 1));
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
func.apply(ctx, args);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
} else {
|
|
34
|
+
return func;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default promisify;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export default function getRandomString(length = 10, options = {}) {
|
|
2
|
+
const {
|
|
3
|
+
allowNumber = true,
|
|
4
|
+
allowLowercase = true,
|
|
5
|
+
allowUppercase = true,
|
|
6
|
+
allowSymbol = true
|
|
7
|
+
} = options;
|
|
8
|
+
let string = '';
|
|
9
|
+
|
|
10
|
+
if (allowNumber) {
|
|
11
|
+
string += '0123456789';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (allowLowercase) {
|
|
15
|
+
string += 'abcdefghijklmnopqrstuvwxyz';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (allowUppercase) {
|
|
19
|
+
string += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (allowSymbol) {
|
|
23
|
+
string += '@$%^&*_+-';
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let newString = '';
|
|
27
|
+
|
|
28
|
+
for (let i = 0; i < length; i++) {
|
|
29
|
+
newString += string[Math.floor(Math.random() * string.length)];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return newString;
|
|
33
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const removeUnicode = (str, spaceTo = ' ') => {
|
|
2
|
+
if (!str || typeof str !== 'string') return str;
|
|
3
|
+
return str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/gi, "a").replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/gi, "e").replace(/ì|í|ị|ỉ|ĩ/gi, "i").replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/gi, "o").replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/gi, "u").replace(/ỳ|ý|ỵ|ỷ|ỹ/gi, "y").replace(/đ/gi, "d").replaceAll(' ', spaceTo);
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export default removeUnicode;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Children } from 'react';
|
|
2
|
+
import { render, createPortal } from 'react-dom';
|
|
3
|
+
const idPortal = 'DGN-UI-Portal',
|
|
4
|
+
classNameCommon = 'DGN-UI-Portal';
|
|
5
|
+
export const getPortal = () => {
|
|
6
|
+
const portal = document.getElementById(idPortal);
|
|
7
|
+
if (portal) return portal;
|
|
8
|
+
const node = document.createElement('div');
|
|
9
|
+
node.id = idPortal;
|
|
10
|
+
node.style.cssText = 'position: fixed; inset: 0; pointer-events: none; z-index: 9000;';
|
|
11
|
+
return document.body.appendChild(node);
|
|
12
|
+
};
|
|
13
|
+
export const isLastChildNode = node => {
|
|
14
|
+
if (!node) return false;
|
|
15
|
+
|
|
16
|
+
if (typeof node === 'string') {
|
|
17
|
+
node = document.querySelector(node);
|
|
18
|
+
} else {
|
|
19
|
+
node = node.current || node.target || node;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const portal = getPortal();
|
|
23
|
+
const length = portal.childNodes.length;
|
|
24
|
+
return length && portal.lastChild.contains(node);
|
|
25
|
+
};
|
|
26
|
+
export const renderPortal = (node, containers, isCreate = false, options = {}) => {
|
|
27
|
+
const {
|
|
28
|
+
style = {},
|
|
29
|
+
className
|
|
30
|
+
} = options;
|
|
31
|
+
let container = getPortal();
|
|
32
|
+
Object.assign(container, style);
|
|
33
|
+
|
|
34
|
+
if (className) {
|
|
35
|
+
container.classList.add(className);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (containers) {
|
|
39
|
+
containers.classList.add(classNameCommon);
|
|
40
|
+
containers.style.pointerEvents = 'auto';
|
|
41
|
+
container = container.appendChild(containers);
|
|
42
|
+
|
|
43
|
+
if (isCreate) {
|
|
44
|
+
return /*#__PURE__*/createPortal(node, container);
|
|
45
|
+
} else {
|
|
46
|
+
render(node, container);
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
Children.forEach(node, containerChild => {
|
|
50
|
+
const parent = document.createElement(containerChild.type);
|
|
51
|
+
const children = containerChild.props.children;
|
|
52
|
+
Object.keys(containerChild.props).forEach(key => {
|
|
53
|
+
if (!/__EMOTION_TYPE_PLEASE_DO_NOT_USE__|children/.test(key)) {
|
|
54
|
+
if (key === 'css') {
|
|
55
|
+
parent.classList.add(`css-${containerChild.props[key].name}`);
|
|
56
|
+
} else if (key === 'style') {
|
|
57
|
+
Object.assign(parent.style, containerChild.props[key]);
|
|
58
|
+
} else {
|
|
59
|
+
parent[key] = containerChild.props[key];
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
parent.classList.add(classNameCommon);
|
|
64
|
+
parent.style.pointerEvents = 'auto';
|
|
65
|
+
container = container.appendChild(parent);
|
|
66
|
+
|
|
67
|
+
if (isCreate) {
|
|
68
|
+
return /*#__PURE__*/createPortal(children, container);
|
|
69
|
+
} else {
|
|
70
|
+
render(children, container);
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
export const removePortal = node => {
|
|
76
|
+
if (isLastChildNode(node)) {
|
|
77
|
+
node.remove();
|
|
78
|
+
removePortalCommon();
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return false;
|
|
83
|
+
};
|
|
84
|
+
export const removePortalCommon = () => {
|
|
85
|
+
const portals = getPortal();
|
|
86
|
+
|
|
87
|
+
if (!portals.childNodes.length) {
|
|
88
|
+
portals.remove();
|
|
89
|
+
}
|
|
90
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
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 { jsx } from '@emotion/core';
|
|
7
|
+
import parseTextToHTML from './parseHTML';
|
|
8
|
+
|
|
9
|
+
const renderHTML = (text = null, TagName = 'div', options = {}) => {
|
|
10
|
+
if (text && (text.$$typeof && String(text.$$typeof) === 'Symbol(react.element)' || Array.isArray(text) && text.some(node => node && String(node.$$typeof) === 'Symbol(react.element)'))) {
|
|
11
|
+
return jsx(TagName, options, text);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return jsx(TagName, _extends({}, options, {
|
|
15
|
+
dangerouslySetInnerHTML: {
|
|
16
|
+
__html: parseTextToHTML(String(text))
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default renderHTML;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 { jsx } from '@emotion/core';
|
|
7
|
+
import Icon, * as Icons from '../icons';
|
|
8
|
+
import { parseTextToHTML, capitalize } from './';
|
|
9
|
+
/**
|
|
10
|
+
* render icon form source (dynamic type)
|
|
11
|
+
* @param {String|jsx} source data of icon, maybe svg text | image link | name of icon in icons store or a jsx element
|
|
12
|
+
* @param {String} type text to parse text to HTML, img link to use img tag, name to use icon form icons store
|
|
13
|
+
* @param {Object} options properties of Icon component if us type is name {width, height, color, viewBox, ...}
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const renderIcon = (source, type, options = {}) => {
|
|
17
|
+
if (typeof source === 'string') {
|
|
18
|
+
switch (type) {
|
|
19
|
+
case 'name':
|
|
20
|
+
let IconComp = Icons[capitalize(source)];
|
|
21
|
+
|
|
22
|
+
if (IconComp) {
|
|
23
|
+
return jsx(IconComp, options);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return null;
|
|
27
|
+
|
|
28
|
+
case 'effect':
|
|
29
|
+
return jsx(Icon, _extends({
|
|
30
|
+
name: source
|
|
31
|
+
}, options));
|
|
32
|
+
|
|
33
|
+
case 'link':
|
|
34
|
+
case 'imgLink':
|
|
35
|
+
return jsx("img", _extends({
|
|
36
|
+
src: source
|
|
37
|
+
}, options));
|
|
38
|
+
|
|
39
|
+
default:
|
|
40
|
+
if (source.length < 20) {
|
|
41
|
+
const IconComp = Icons[capitalize(source)];
|
|
42
|
+
|
|
43
|
+
if (IconComp) {
|
|
44
|
+
return jsx(IconComp, options);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return parseTextToHTML(source, options.output || options);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return source;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default renderIcon;
|