diginet-core-ui 1.3.36 → 1.3.38
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 -3
- package/assets/images/icons/wifi.svg +3 -3
- package/assets/images/menu/dhr/ALL.svg +6 -6
- package/assets/images/menu/dhr/D00.svg +12 -12
- package/assets/images/menu/dhr/D09.svg +8 -8
- package/assets/images/menu/dhr/D13.svg +10 -10
- package/assets/images/menu/dhr/D15.svg +10 -10
- package/assets/images/menu/dhr/D21.svg +10 -10
- package/assets/images/menu/dhr/D25.svg +11 -11
- package/assets/images/menu/dhr/D29.svg +11 -11
- package/assets/images/menu/dhr/D38.svg +6 -6
- package/assets/images/menu/dhr/D39.svg +10 -10
- package/assets/images/menu/dhr/D51.svg +12 -12
- package/assets/images/menu/dhr/D52.svg +16 -16
- package/assets/images/menu/dhr/D77.svg +16 -16
- package/assets/images/menu/dhr/D84.svg +12 -12
- package/assets/images/menu/dhr/D89.svg +8 -8
- package/assets/images/menu/dhr/Default.svg +13 -13
- package/assets/images/menu/dhr/MHRM00N0001.svg +14 -14
- package/assets/images/menu/dhr/MHRM09N0002.svg +3 -3
- package/assets/images/menu/dhr/MHRM09N0003.svg +25 -25
- package/assets/images/menu/dhr/MHRM09N0004.svg +14 -14
- package/assets/images/menu/dhr/MHRM09N0005.svg +7 -7
- package/assets/images/menu/dhr/MHRM13N0001.svg +16 -16
- package/assets/images/menu/dhr/MHRM25N0001.svg +26 -26
- package/assets/images/menu/dhr/MHRM29N0001.svg +30 -30
- package/assets/images/menu/dhr/MHRM29N0002.svg +13 -0
- package/assets/images/menu/dhr/MHRM29N0003.svg +17 -0
- package/assets/images/menu/dhr/MHRM29N0015.svg +63 -63
- package/assets/images/menu/dhr/MHRM39N0012.svg +43 -43
- package/assets/images/menu/dhr/MHRM39N0013.svg +24 -24
- package/assets/images/menu/dhr/MHRM39N0014.svg +14 -14
- package/assets/images/menu/dhr/MHRM39N0015.svg +36 -36
- package/assets/images/menu/dhr/MHRM39N0016.svg +23 -23
- package/assets/images/menu/dhr/MHRM77N0001.svg +28 -28
- package/assets/images/menu/dhr/MHRM84N0001.svg +27 -27
- package/assets/images/menu/dhr/MHRM84N0002.svg +24 -24
- package/assets/images/menu/dhr/MHRM89N0001.svg +16 -16
- package/assets/images/menu/dhr/MHRP00N0001.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0001.svg +22 -22
- package/assets/images/menu/dhr/MHRP09N0002.svg +19 -19
- package/assets/images/menu/dhr/MHRP09N0003.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0004.svg +6 -6
- package/assets/images/menu/dhr/MHRP09N0005.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0006.svg +17 -17
- package/assets/images/menu/dhr/MHRP09N0007.svg +15 -15
- package/assets/images/menu/dhr/MHRP09N0008.svg +8 -8
- package/assets/images/menu/dhr/MHRP09N0009.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0010.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0011.svg +16 -16
- package/assets/images/menu/dhr/MHRP09N0012.svg +6 -6
- package/assets/images/menu/dhr/MHRP09N0013.svg +8 -8
- package/assets/images/menu/dhr/MHRP09N0014.svg +11 -11
- package/assets/images/menu/dhr/MHRP09N0015.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0016.svg +18 -18
- package/assets/images/menu/dhr/MHRP09N0017.svg +18 -18
- package/assets/images/menu/dhr/MHRP09N0018.svg +12 -12
- package/assets/images/menu/dhr/MHRP09N0019.svg +13 -13
- package/assets/images/menu/dhr/MHRP09N0020.svg +17 -17
- package/assets/images/menu/dhr/MHRP09N0021.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0022.svg +16 -16
- package/assets/images/menu/dhr/MHRP09N0023.svg +8 -8
- package/assets/images/menu/dhr/MHRP09N0024.svg +15 -15
- package/assets/images/menu/dhr/MHRP09N0025.svg +16 -16
- package/assets/images/menu/dhr/MHRP09N0026.svg +13 -13
- package/assets/images/menu/dhr/MHRP09N0027.svg +10 -10
- package/assets/images/menu/dhr/MHRP09N0028.svg +6 -6
- package/assets/images/menu/dhr/MHRP09N0029.svg +14 -14
- package/assets/images/menu/dhr/MHRP09N0030.svg +4 -4
- package/assets/images/menu/dhr/MHRP09N0031.svg +5 -5
- package/assets/images/menu/dhr/MHRP09N0032.svg +7 -7
- package/assets/images/menu/dhr/MHRP13N0001.svg +9 -9
- package/assets/images/menu/dhr/MHRP21N0001.svg +12 -12
- package/assets/images/menu/dhr/MHRP21N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRP25N0001.svg +13 -13
- package/assets/images/menu/dhr/MHRP25N0002.svg +16 -16
- package/assets/images/menu/dhr/MHRP25N0003.svg +38 -38
- package/assets/images/menu/dhr/MHRP25N0004.svg +17 -17
- package/assets/images/menu/dhr/MHRP25N0005.svg +20 -20
- package/assets/images/menu/dhr/MHRP29N0001.svg +18 -18
- package/assets/images/menu/dhr/MHRP29N0002.svg +15 -15
- package/assets/images/menu/dhr/MHRP29N0003.svg +20 -20
- package/assets/images/menu/dhr/MHRP29N0004.svg +21 -21
- package/assets/images/menu/dhr/MHRP29N0005.svg +21 -21
- package/assets/images/menu/dhr/MHRP29N0006.svg +14 -14
- package/assets/images/menu/dhr/MHRP29N0007.svg +19 -19
- package/assets/images/menu/dhr/MHRP29N0008.svg +20 -20
- package/assets/images/menu/dhr/MHRP29N0009.svg +11 -11
- package/assets/images/menu/dhr/MHRP29N0010.svg +11 -11
- package/assets/images/menu/dhr/MHRP29N0011.svg +12 -12
- package/assets/images/menu/dhr/MHRP29N0012.svg +7 -7
- package/assets/images/menu/dhr/MHRP29N0013.svg +27 -27
- package/assets/images/menu/dhr/MHRP29N0014.svg +32 -32
- package/assets/images/menu/dhr/MHRP29N0016.svg +54 -54
- package/assets/images/menu/dhr/MHRP29N0017.svg +24 -24
- package/assets/images/menu/dhr/MHRP29N0018.svg +44 -44
- package/assets/images/menu/dhr/MHRP29N0019.svg +17 -17
- package/assets/images/menu/dhr/MHRP29N0020.svg +11 -11
- package/assets/images/menu/dhr/MHRP29N0021.svg +8 -8
- package/assets/images/menu/dhr/MHRP29N0022.svg +9 -9
- package/assets/images/menu/dhr/MHRP29N0023.svg +22 -22
- package/assets/images/menu/dhr/MHRP38N0001.svg +13 -13
- package/assets/images/menu/dhr/MHRP38N0002.svg +14 -14
- package/assets/images/menu/dhr/MHRP39N0001.svg +15 -15
- package/assets/images/menu/dhr/MHRP39N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRP39N0003.svg +16 -16
- package/assets/images/menu/dhr/MHRP39N0004.svg +22 -22
- package/assets/images/menu/dhr/MHRP39N0005.svg +16 -16
- package/assets/images/menu/dhr/MHRP39N0006.svg +17 -17
- package/assets/images/menu/dhr/MHRP39N0007.svg +13 -13
- package/assets/images/menu/dhr/MHRP39N0008.svg +3 -3
- package/assets/images/menu/dhr/MHRP39N0009.svg +3 -3
- package/assets/images/menu/dhr/MHRP39N0010.svg +7 -7
- package/assets/images/menu/dhr/MHRP39N0011.svg +14 -14
- package/assets/images/menu/dhr/MHRP39N0013.svg +10 -10
- package/assets/images/menu/dhr/MHRP39N0014.svg +11 -11
- package/assets/images/menu/dhr/MHRP39N0015.svg +5 -5
- package/assets/images/menu/dhr/MHRP39N0017.svg +11 -11
- package/assets/images/menu/dhr/MHRP39N0018.svg +11 -0
- package/assets/images/menu/dhr/MHRP39N1222.svg +12 -12
- package/assets/images/menu/dhr/MHRP51N0001.svg +9 -9
- package/assets/images/menu/dhr/MHRP51N0002.svg +13 -13
- package/assets/images/menu/dhr/MHRP52N0001.svg +21 -21
- package/assets/images/menu/dhr/MHRP52N0002.svg +21 -21
- package/assets/images/menu/dhr/MHRP52N0003.svg +16 -16
- package/assets/images/menu/dhr/MHRP75N0001.svg +19 -19
- package/assets/images/menu/dhr/MHRP75N0002.svg +25 -25
- package/assets/images/menu/dhr/MHRP75N0003.svg +3 -3
- package/assets/images/menu/dhr/MHRP75N0006.svg +14 -14
- package/assets/images/menu/dhr/MHRP75N0007.svg +19 -19
- package/assets/images/menu/dhr/MHRP75N0008.svg +19 -19
- package/assets/images/menu/dhr/MHRP77N0007.svg +28 -28
- package/assets/images/menu/dhr/MHRP77N0008.svg +17 -17
- package/assets/images/menu/dhr/MHRP77N0009.svg +19 -19
- package/assets/images/menu/dhr/MHRP77N0010.svg +20 -20
- package/assets/images/menu/dhr/MHRP89N1000.svg +6 -6
- package/assets/images/menu/dhr/MHRP89N1001.svg +6 -6
- package/assets/images/menu/dhr/TASK.svg +9 -9
- package/assets/images/menu/dhr/W00F0001.svg +3 -3
- package/assets/images/menu/dhr/W00F0002.svg +3 -3
- package/assets/images/menu/dhr/W00F0003.svg +3 -3
- package/assets/images/menu/dhr/W00F0004.svg +3 -3
- package/assets/images/menu/dhr/W09F2000-WEB5.svg +17 -17
- package/assets/images/menu/dhr/W09F2000.svg +6 -6
- package/assets/images/menu/dhr/W09F2002-WEB5.svg +21 -21
- package/assets/images/menu/dhr/W09F2005-WEB5.svg +13 -13
- package/assets/images/menu/dhr/W09F2020-WEB5.svg +16 -16
- package/assets/images/menu/dhr/W09F2022-WEB5.svg +20 -20
- package/assets/images/menu/dhr/W09F2150-WEB5.svg +16 -16
- package/assets/images/menu/dhr/W09F2152-WEB5.svg +20 -20
- package/assets/images/menu/dhr/W09F2160-WEB5.svg +14 -14
- package/assets/images/menu/dhr/W09F2162-WEB5.svg +18 -18
- package/assets/images/menu/dhr/W29F4006-WEB5.svg +19 -19
- package/assets/images/menu/dhr/W75F2260-WEB5.svg +15 -15
- package/assets/images/menu/dhr/W75F2261-WEB5.svg +19 -19
- package/assets/images/menu/dhr/W75F3005-WEB5.svg +13 -13
- package/assets/images/menu/dhr/W75F4070-WEB5.svg +21 -21
- package/assets/images/menu/dhr/W75F4071-WEB5.svg +17 -17
- package/assets/images/menu/dhr/W75F4100-WEB5.svg +14 -14
- package/assets/images/menu/dhr/W77F1011.svg +19 -19
- package/assets/images/menu/dhr/W77F1013.svg +22 -22
- package/assets/images/menu/erp/D05.svg +8 -8
- package/assets/images/menu/erp/D06.svg +4 -4
- package/assets/images/menu/erp/D90R.svg +9 -9
- package/assets/images/menu/erp/DBC.svg +9 -9
- package/assets/images/menu/erp/W00F0001.svg +3 -3
- package/assets/images/menu/erp/W00F0002.svg +3 -3
- package/assets/images/menu/erp/W00F0003.svg +3 -3
- package/assets/images/menu/erp/W00F0004.svg +3 -3
- package/assets/images/menu/erp/W05F0001.svg +16 -16
- package/assets/images/menu/erp/W05F0001N0000.svg +16 -16
- package/assets/images/menu/erp/W05F0004N0000.svg +6 -6
- package/assets/images/menu/erp/W05F0006N0000.svg +30 -30
- package/assets/images/menu/erp/W05F0007N0000.svg +6 -6
- package/assets/images/menu/erp/W05F0008N0000.svg +14 -14
- package/assets/images/menu/erp/W05F0011N0000.svg +20 -20
- package/assets/images/menu/erp/W05F0013N0000.svg +9 -9
- package/assets/images/menu/erp/W05F4000N0000.svg +9 -9
- package/assets/images/menu/erp/W06F0001.svg +17 -17
- package/assets/images/menu/erp/W06F0001N0000.svg +17 -17
- package/assets/images/menu/erp/W06F0004N0000.svg +22 -22
- package/assets/images/menu/erp/W06F0005N0000.svg +22 -22
- package/assets/images/menu/erp/W06F0006N0000.svg +55 -55
- package/assets/images/menu/erp/W06F0008N0000.svg +17 -17
- package/assets/images/menu/erp/W94F1000N0000.svg +9 -9
- package/assets/images/menu/erp/W94F1000N0001.svg +9 -9
- package/assets/images/menu/erp/WA3F1025.svg +5 -5
- package/assets/images/menu/erp/WA3F2100.svg +10 -10
- package/components/accordion/css.js +42 -35
- package/components/accordion/details.js +48 -42
- package/components/accordion/group.js +88 -82
- package/components/accordion/index.js +54 -48
- package/components/accordion/summary.js +52 -43
- package/components/alert/index.js +115 -103
- package/components/alert/notify.js +16 -18
- package/components/badge/index.js +5 -5
- package/components/button/icon.js +21 -21
- package/components/button/index.js +13 -13
- package/components/chart/Pie/Sector.js +2 -2
- package/components/chart/Pie-v2/Sector.js +2 -2
- package/components/chip/attach.js +5 -5
- package/components/chip/index.js +13 -10
- package/components/divider/index.js +17 -15
- package/components/form-control/attachment/index.js +1 -0
- package/components/form-control/calendar/function.js +295 -289
- package/components/form-control/calendar/index.js +16 -16
- package/components/form-control/checkbox/index.js +5 -5
- package/components/form-control/date-picker/index.js +7 -3
- package/components/form-control/date-range-picker/index.js +12 -8
- package/components/form-control/dropdown/index.js +139 -81
- package/components/form-control/input-base/index.js +32 -27
- package/components/form-control/money-input/index.js +17 -17
- package/components/form-control/number-input/index.js +11 -11
- package/components/form-control/number-input/index2.js +432 -0
- package/components/form-control/phone-input/index.js +7 -7
- package/components/form-control/radio/index.js +98 -146
- package/components/form-control/text-input/index.js +4 -4
- package/components/form-control/time-picker/index.js +305 -300
- package/components/form-control/toggle/index.js +92 -90
- package/components/index.js +1 -1
- package/components/modal/header.js +63 -65
- package/components/modal/modal.js +84 -130
- package/components/paging/page-selector.js +53 -49
- package/components/popup/index.js +5 -1
- package/components/popup/proposals_popup.js +5 -1
- package/components/popup/v2/index.js +12 -8
- package/components/progress/circular.js +12 -12
- package/components/rating/index.js +3 -3
- package/components/slider/slider-item.js +65 -25
- package/components/tab/tab-container.js +2 -2
- package/components/tab/tab-header.js +2 -2
- package/components/tab/tab-panel.js +2 -2
- package/components/tab/tab.js +2 -2
- package/components/transfer/index.js +3 -3
- package/components/tree-view/index.js +38 -38
- package/components/typography/index.js +10 -10
- package/icons/basic.js +75 -408
- package/icons/effect.js +15 -15
- package/package.json +45 -45
- package/readme.md +677 -654
- package/styles/color-helper.js +103 -103
- package/styles/colors.js +7 -7
- package/styles/general.js +40 -12
- package/styles/utils.js +5 -5
- package/theme/set-theme.js +3 -3
- package/theme/settings.js +3 -2
- package/utils/array/array.js +36 -36
- package/utils/date.js +56 -56
- package/utils/error/error.js +2 -2
- package/utils/error/errors.js +99 -99
- package/utils/number.js +6 -6
- package/utils/render-portal.js +5 -1
- package/utils/renderIcon.js +5 -5
- package/utils/useOnClickOutside.js +2 -2
- package/utils/usePortal.js +9 -9
- package/utils/validate.js +33 -33
package/utils/date.js
CHANGED
|
@@ -3,11 +3,11 @@ import locale from '../locale';
|
|
|
3
3
|
const language = locale.get();
|
|
4
4
|
const localeName = language === 'en' ? 'en-US' : 'vi-VN';
|
|
5
5
|
const units = ['year', 'month', 'day', 'hour', 'minute', 'second', 'millisecond'];
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @param {Date|String|Array} value is a date time
|
|
9
|
-
* @param {String} format the input date format
|
|
10
|
-
* @param {Boolean} setNow return current time if true
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param {Date|String|Array} value is a date time
|
|
9
|
+
* @param {String} format the input date format
|
|
10
|
+
* @param {Boolean} setNow return current time if true
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
const getDate = (value, format = 'MM/DD/YYYY', setNow = true) => {
|
|
@@ -61,11 +61,11 @@ const getMethodOfUnit = unit => {
|
|
|
61
61
|
return 'Date';
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
/**
|
|
65
|
-
* check 1 value is a date
|
|
66
|
-
* @param {Date|String|Array|Number} value the value to check
|
|
67
|
-
* @param {String} formatInput the format date to check valid date
|
|
68
|
-
* @returns {Boolean} valid date
|
|
64
|
+
/**
|
|
65
|
+
* check 1 value is a date
|
|
66
|
+
* @param {Date|String|Array|Number} value the value to check
|
|
67
|
+
* @param {String} formatInput the format date to check valid date
|
|
68
|
+
* @returns {Boolean} valid date
|
|
69
69
|
*/
|
|
70
70
|
|
|
71
71
|
|
|
@@ -80,11 +80,11 @@ export const isValidDate = (value, formatInput) => {
|
|
|
80
80
|
|
|
81
81
|
return false;
|
|
82
82
|
};
|
|
83
|
-
/**
|
|
84
|
-
* get the end of month from month and year or from a date
|
|
85
|
-
* @param {Number|String|Date|Array} month the month of year (can also be validated as year) or a value with date type
|
|
86
|
-
* @param {Number} year the year (can also be validated as month if arg 1 is year)
|
|
87
|
-
* @returns {Number} end day
|
|
83
|
+
/**
|
|
84
|
+
* get the end of month from month and year or from a date
|
|
85
|
+
* @param {Number|String|Date|Array} month the month of year (can also be validated as year) or a value with date type
|
|
86
|
+
* @param {Number} year the year (can also be validated as month if arg 1 is year)
|
|
87
|
+
* @returns {Number} end day
|
|
88
88
|
*/
|
|
89
89
|
|
|
90
90
|
export const getEndDayOfMonth = (month, year) => {
|
|
@@ -106,11 +106,11 @@ export const getEndDayOfMonth = (month, year) => {
|
|
|
106
106
|
|
|
107
107
|
return 'Invalid Date';
|
|
108
108
|
};
|
|
109
|
-
/**
|
|
110
|
-
* return a date time follow the concrete format
|
|
111
|
-
* @param {Date|String|Array} value is a date time
|
|
112
|
-
* @param {String} formatOutput format of date
|
|
113
|
-
* @param {Boolean} utc is utc time
|
|
109
|
+
/**
|
|
110
|
+
* return a date time follow the concrete format
|
|
111
|
+
* @param {Date|String|Array} value is a date time
|
|
112
|
+
* @param {String} formatOutput format of date
|
|
113
|
+
* @param {Boolean} utc is utc time
|
|
114
114
|
*/
|
|
115
115
|
|
|
116
116
|
export const formatDate = (value, formatOutput = 'DD/MM/YYYY', utc = false) => {
|
|
@@ -268,21 +268,21 @@ export const formatDate = (value, formatOutput = 'DD/MM/YYYY', utc = false) => {
|
|
|
268
268
|
return formatOutput;
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
|
-
/**
|
|
272
|
-
* return a date like moment
|
|
273
|
-
* @param {Date|String|Array} value is date time
|
|
274
|
-
* @param {String} formatInput format of input date value
|
|
275
|
-
* @returns {Object} date
|
|
271
|
+
/**
|
|
272
|
+
* return a date like moment
|
|
273
|
+
* @param {Date|String|Array} value is date time
|
|
274
|
+
* @param {String} formatInput format of input date value
|
|
275
|
+
* @returns {Object} date
|
|
276
276
|
*/
|
|
277
277
|
|
|
278
278
|
const date = (value, formatInput = 'MM/DD/YYYY') => {
|
|
279
279
|
const originDate = getDate(value, formatInput);
|
|
280
|
-
/**
|
|
281
|
-
* compare two date time and return a period
|
|
282
|
-
* @param {Date|String|Array} date is a date time
|
|
283
|
-
* @param {String} unit one of milliseconds|seconds|minutes|hours|days|months|years
|
|
284
|
-
* @param {Boolean|Number} floating allow odd numbers
|
|
285
|
-
* @returns {Number} distance
|
|
280
|
+
/**
|
|
281
|
+
* compare two date time and return a period
|
|
282
|
+
* @param {Date|String|Array} date is a date time
|
|
283
|
+
* @param {String} unit one of milliseconds|seconds|minutes|hours|days|months|years
|
|
284
|
+
* @param {Boolean|Number} floating allow odd numbers
|
|
285
|
+
* @returns {Number} distance
|
|
286
286
|
*/
|
|
287
287
|
|
|
288
288
|
const diff = (compareDate, unit = 'days', floating = false) => {
|
|
@@ -345,12 +345,12 @@ const date = (value, formatInput = 'MM/DD/YYYY') => {
|
|
|
345
345
|
|
|
346
346
|
return result.toFixed(floating ? typeof floating === 'number' ? floating : 2 : 0);
|
|
347
347
|
};
|
|
348
|
-
/**
|
|
349
|
-
* add or subtract date time
|
|
350
|
-
* @param {Number} num the quantity to cal for unit
|
|
351
|
-
* @param {String} unit the unit of date/time
|
|
352
|
-
* @param {String} operator operator to cal (add/subtract)
|
|
353
|
-
* @returns {Object} date
|
|
348
|
+
/**
|
|
349
|
+
* add or subtract date time
|
|
350
|
+
* @param {Number} num the quantity to cal for unit
|
|
351
|
+
* @param {String} unit the unit of date/time
|
|
352
|
+
* @param {String} operator operator to cal (add/subtract)
|
|
353
|
+
* @returns {Object} date
|
|
354
354
|
*/
|
|
355
355
|
|
|
356
356
|
|
|
@@ -363,11 +363,11 @@ const date = (value, formatInput = 'MM/DD/YYYY') => {
|
|
|
363
363
|
originDate['set' + getMethodOfUnit(unit)](originDate['get' + getMethodOfUnit(unit)]() + (operator === 'add' ? +num : -num));
|
|
364
364
|
return date(originDate, formatInput);
|
|
365
365
|
};
|
|
366
|
-
/**
|
|
367
|
-
* get the moment of time follow unit time
|
|
368
|
-
* @param {String} unit the unit of time
|
|
369
|
-
* @param {String} moment start|end to get start|end of the moment
|
|
370
|
-
* @returns {Object} date
|
|
366
|
+
/**
|
|
367
|
+
* get the moment of time follow unit time
|
|
368
|
+
* @param {String} unit the unit of time
|
|
369
|
+
* @param {String} moment start|end to get start|end of the moment
|
|
370
|
+
* @returns {Object} date
|
|
371
371
|
*/
|
|
372
372
|
|
|
373
373
|
|
|
@@ -393,12 +393,12 @@ const date = (value, formatInput = 'MM/DD/YYYY') => {
|
|
|
393
393
|
});
|
|
394
394
|
return date(originDate, formatInput);
|
|
395
395
|
};
|
|
396
|
-
/**
|
|
397
|
-
*
|
|
398
|
-
* @param {Date|String|Number|Array} compareDate date to calculate moment, undefined will compare with now
|
|
399
|
-
* @param {String|Array} unit year|month|day|hour|minute|second|millisecond, allow undefined
|
|
400
|
-
* @param {Boolean|Number} floating allow odd numbers
|
|
401
|
-
* @returns {String} moments
|
|
396
|
+
/**
|
|
397
|
+
*
|
|
398
|
+
* @param {Date|String|Number|Array} compareDate date to calculate moment, undefined will compare with now
|
|
399
|
+
* @param {String|Array} unit year|month|day|hour|minute|second|millisecond, allow undefined
|
|
400
|
+
* @param {Boolean|Number} floating allow odd numbers
|
|
401
|
+
* @returns {String} moments
|
|
402
402
|
*/
|
|
403
403
|
|
|
404
404
|
|
|
@@ -446,18 +446,18 @@ const date = (value, formatInput = 'MM/DD/YYYY') => {
|
|
|
446
446
|
return {
|
|
447
447
|
value: originDate,
|
|
448
448
|
|
|
449
|
-
/**
|
|
450
|
-
* return a date time follow the concrete format
|
|
451
|
-
* @param {String} formatOutput format of date
|
|
452
|
-
* @param {Boolean} utc is utc time
|
|
449
|
+
/**
|
|
450
|
+
* return a date time follow the concrete format
|
|
451
|
+
* @param {String} formatOutput format of date
|
|
452
|
+
* @param {Boolean} utc is utc time
|
|
453
453
|
*/
|
|
454
454
|
format: (formatOutput, utc) => formatDate(originDate, formatOutput, utc),
|
|
455
455
|
diff,
|
|
456
456
|
|
|
457
|
-
/**
|
|
458
|
-
* check 1 value is a date
|
|
459
|
-
* @param {String} formatInput the format date to check valid date
|
|
460
|
-
* @returns {Boolean} valid date
|
|
457
|
+
/**
|
|
458
|
+
* check 1 value is a date
|
|
459
|
+
* @param {String} formatInput the format date to check valid date
|
|
460
|
+
* @returns {Boolean} valid date
|
|
461
461
|
*/
|
|
462
462
|
isValid: () => isValidDate(originDate, formatInput),
|
|
463
463
|
add: (num, unit) => calculation(num, unit, 'add'),
|
package/utils/error/error.js
CHANGED
package/utils/error/errors.js
CHANGED
|
@@ -1,247 +1,247 @@
|
|
|
1
1
|
import errorUtils from './error';
|
|
2
|
-
/**
|
|
3
|
-
* @docid
|
|
4
|
-
* @name ErrorsCore
|
|
2
|
+
/**
|
|
3
|
+
* @docid
|
|
4
|
+
* @name ErrorsCore
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export default errorUtils({
|
|
8
|
-
/**
|
|
9
|
-
* @name ErrorsCore.E0001
|
|
8
|
+
/**
|
|
9
|
+
* @name ErrorsCore.E0001
|
|
10
10
|
*/
|
|
11
11
|
E0001: 'Method is not implemented',
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* @name ErrorsCore.E0002
|
|
13
|
+
/**
|
|
14
|
+
* @name ErrorsCore.E0002
|
|
15
15
|
*/
|
|
16
16
|
E0002: 'Member name collision: {0}',
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* @name ErrorsCore.E0003
|
|
18
|
+
/**
|
|
19
|
+
* @name ErrorsCore.E0003
|
|
20
20
|
*/
|
|
21
21
|
E0003: 'A class must be instantiated using the \'new\' keyword',
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* @name ErrorsCore.E0004
|
|
23
|
+
/**
|
|
24
|
+
* @name ErrorsCore.E0004
|
|
25
25
|
*/
|
|
26
26
|
E0004: 'The NAME property of the component is not specified',
|
|
27
27
|
|
|
28
|
-
/**
|
|
29
|
-
* @name ErrorsCore.E0005
|
|
28
|
+
/**
|
|
29
|
+
* @name ErrorsCore.E0005
|
|
30
30
|
*/
|
|
31
31
|
E0005: 'Unknown device',
|
|
32
32
|
|
|
33
|
-
/**
|
|
34
|
-
* @name ErrorsCore.E0006
|
|
33
|
+
/**
|
|
34
|
+
* @name ErrorsCore.E0006
|
|
35
35
|
*/
|
|
36
36
|
E0006: 'Unknown endpoint key is requested',
|
|
37
37
|
|
|
38
|
-
/**
|
|
39
|
-
* @name ErrorsCore.E0007
|
|
38
|
+
/**
|
|
39
|
+
* @name ErrorsCore.E0007
|
|
40
40
|
*/
|
|
41
41
|
E0007: '\'Invalidate\' method is called outside the update transaction',
|
|
42
42
|
|
|
43
|
-
/**
|
|
44
|
-
* @name ErrorsCore.E0008
|
|
43
|
+
/**
|
|
44
|
+
* @name ErrorsCore.E0008
|
|
45
45
|
*/
|
|
46
46
|
E0008: 'Type of the option name is not appropriate to create an action',
|
|
47
47
|
|
|
48
|
-
/**
|
|
49
|
-
* @name ErrorsCore.E0009
|
|
48
|
+
/**
|
|
49
|
+
* @name ErrorsCore.E0009
|
|
50
50
|
*/
|
|
51
51
|
E0009: 'Component \'{0}\' has not been initialized for an element',
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
* @name ErrorsCore.E0010
|
|
53
|
+
/**
|
|
54
|
+
* @name ErrorsCore.E0010
|
|
55
55
|
*/
|
|
56
56
|
E0010: 'Animation configuration with the \'{0}\' type requires \'{1}\' configuration as {2}',
|
|
57
57
|
|
|
58
|
-
/**
|
|
59
|
-
* @name ErrorsCore.E0011
|
|
58
|
+
/**
|
|
59
|
+
* @name ErrorsCore.E0011
|
|
60
60
|
*/
|
|
61
61
|
E0011: 'Unknown animation type \'{0}\'',
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
* @name ErrorsCore.E0012
|
|
63
|
+
/**
|
|
64
|
+
* @name ErrorsCore.E0012
|
|
65
65
|
*/
|
|
66
66
|
E0012: 'jQuery version is too old. Please upgrade jQuery to 1.10.0 or later',
|
|
67
67
|
|
|
68
|
-
/**
|
|
69
|
-
* @name ErrorsCore.E0013
|
|
68
|
+
/**
|
|
69
|
+
* @name ErrorsCore.E0013
|
|
70
70
|
*/
|
|
71
71
|
E0013: 'KnockoutJS version is too old. Please upgrade KnockoutJS to 2.3.0 or later',
|
|
72
72
|
|
|
73
|
-
/**
|
|
74
|
-
* @name ErrorsCore.E0014
|
|
73
|
+
/**
|
|
74
|
+
* @name ErrorsCore.E0014
|
|
75
75
|
*/
|
|
76
76
|
E0014: 'The \'release\' method shouldn\'t be called for an unlocked Lock object',
|
|
77
77
|
|
|
78
|
-
/**
|
|
79
|
-
* @name ErrorsCore.E0015
|
|
78
|
+
/**
|
|
79
|
+
* @name ErrorsCore.E0015
|
|
80
80
|
*/
|
|
81
81
|
E0015: 'Queued task returned an unexpected result',
|
|
82
82
|
|
|
83
|
-
/**
|
|
84
|
-
* @name ErrorsCore.E0017
|
|
83
|
+
/**
|
|
84
|
+
* @name ErrorsCore.E0017
|
|
85
85
|
*/
|
|
86
86
|
E0017: 'Event namespace is not defined',
|
|
87
87
|
|
|
88
|
-
/**
|
|
89
|
-
* @name ErrorsCore.E0018
|
|
88
|
+
/**
|
|
89
|
+
* @name ErrorsCore.E0018
|
|
90
90
|
*/
|
|
91
91
|
E0018: 'DGN-UI-Popup widget is required',
|
|
92
92
|
|
|
93
|
-
/**
|
|
94
|
-
* @name ErrorsCore.E0020
|
|
93
|
+
/**
|
|
94
|
+
* @name ErrorsCore.E0020
|
|
95
95
|
*/
|
|
96
96
|
E0020: 'Template engine \'{0}\' is not supported',
|
|
97
97
|
|
|
98
|
-
/**
|
|
99
|
-
* @name ErrorsCore.E0021
|
|
98
|
+
/**
|
|
99
|
+
* @name ErrorsCore.E0021
|
|
100
100
|
*/
|
|
101
101
|
E0021: 'Unknown theme is set: {0}',
|
|
102
102
|
|
|
103
|
-
/**
|
|
104
|
-
* @name ErrorsCore.E0022
|
|
103
|
+
/**
|
|
104
|
+
* @name ErrorsCore.E0022
|
|
105
105
|
*/
|
|
106
106
|
E0022: 'LINK[rel=DGN-UI-theme] tags must go before DGN-UI included scripts',
|
|
107
107
|
|
|
108
|
-
/**
|
|
109
|
-
* @name ErrorsCore.E0023
|
|
108
|
+
/**
|
|
109
|
+
* @name ErrorsCore.E0023
|
|
110
110
|
*/
|
|
111
111
|
E0023: 'Template name is not specified',
|
|
112
112
|
|
|
113
|
-
/**
|
|
114
|
-
* @name ErrorsCore.E0024
|
|
113
|
+
/**
|
|
114
|
+
* @name ErrorsCore.E0024
|
|
115
115
|
*/
|
|
116
116
|
E0024: 'DGN-UI bundle already included',
|
|
117
117
|
|
|
118
|
-
/**
|
|
119
|
-
* @name ErrorsCore.E0025
|
|
118
|
+
/**
|
|
119
|
+
* @name ErrorsCore.E0025
|
|
120
120
|
*/
|
|
121
121
|
E0025: 'Unexpected argument type',
|
|
122
122
|
|
|
123
|
-
/**
|
|
124
|
-
* @name ErrorsCore.E0100
|
|
123
|
+
/**
|
|
124
|
+
* @name ErrorsCore.E0100
|
|
125
125
|
*/
|
|
126
126
|
E0100: 'Unknown validation type is detected',
|
|
127
127
|
|
|
128
|
-
/**
|
|
129
|
-
* @name ErrorsCore.E0101
|
|
128
|
+
/**
|
|
129
|
+
* @name ErrorsCore.E0101
|
|
130
130
|
*/
|
|
131
131
|
E0101: 'Misconfigured range validation rule is detected',
|
|
132
132
|
|
|
133
|
-
/**
|
|
134
|
-
* @name ErrorsCore.E0102
|
|
133
|
+
/**
|
|
134
|
+
* @name ErrorsCore.E0102
|
|
135
135
|
*/
|
|
136
136
|
E0102: 'Misconfigured comparison validation rule is detected',
|
|
137
137
|
|
|
138
|
-
/**
|
|
139
|
-
* @name ErrorsCore.E0103
|
|
138
|
+
/**
|
|
139
|
+
* @name ErrorsCore.E0103
|
|
140
140
|
*/
|
|
141
141
|
E0103: 'validationCallback of an asynchronous rule should return a jQuery or a native promise',
|
|
142
142
|
|
|
143
|
-
/**
|
|
144
|
-
* @name ErrorsCore.E0110
|
|
143
|
+
/**
|
|
144
|
+
* @name ErrorsCore.E0110
|
|
145
145
|
*/
|
|
146
146
|
E0110: 'Unknown validation group is detected',
|
|
147
147
|
|
|
148
|
-
/**
|
|
149
|
-
* @name ErrorsCore.E0120
|
|
148
|
+
/**
|
|
149
|
+
* @name ErrorsCore.E0120
|
|
150
150
|
*/
|
|
151
151
|
E0120: 'Adapter for a DGN-UI-Validator component cannot be configured',
|
|
152
152
|
|
|
153
|
-
/**
|
|
154
|
-
* @name ErrorsCore.E0121
|
|
153
|
+
/**
|
|
154
|
+
* @name ErrorsCore.E0121
|
|
155
155
|
*/
|
|
156
156
|
E0121: 'The \'customItem\' field of the \'onCustomItemCreating\' function\'s parameter should contain a custom item or Promise that is resolved after the item is created.',
|
|
157
157
|
|
|
158
|
-
/**
|
|
159
|
-
* @name ErrorsCore.W0000
|
|
158
|
+
/**
|
|
159
|
+
* @name ErrorsCore.W0000
|
|
160
160
|
*/
|
|
161
161
|
W0000: '\'{0}\' is deprecated in {1}. {2}',
|
|
162
162
|
|
|
163
|
-
/**
|
|
164
|
-
* @name ErrorsCore.W0001
|
|
163
|
+
/**
|
|
164
|
+
* @name ErrorsCore.W0001
|
|
165
165
|
*/
|
|
166
166
|
W0001: '{0} - \'{1}\' option is deprecated in {2}. {3}',
|
|
167
167
|
|
|
168
|
-
/**
|
|
169
|
-
* @name ErrorsCore.W0002
|
|
168
|
+
/**
|
|
169
|
+
* @name ErrorsCore.W0002
|
|
170
170
|
*/
|
|
171
171
|
W0002: '{0} - \'{1}\' method is deprecated in {2}. {3}',
|
|
172
172
|
|
|
173
|
-
/**
|
|
174
|
-
* @name ErrorsCore.W0003
|
|
173
|
+
/**
|
|
174
|
+
* @name ErrorsCore.W0003
|
|
175
175
|
*/
|
|
176
176
|
W0003: '{0} - \'{1}\' property is deprecated in {2}. {3}',
|
|
177
177
|
|
|
178
|
-
/**
|
|
179
|
-
* @name ErrorsCore.W0004
|
|
178
|
+
/**
|
|
179
|
+
* @name ErrorsCore.W0004
|
|
180
180
|
*/
|
|
181
181
|
W0004: 'Timeout for theme loading is over: {0}',
|
|
182
182
|
|
|
183
|
-
/**
|
|
184
|
-
* @name ErrorsCore.W0005
|
|
183
|
+
/**
|
|
184
|
+
* @name ErrorsCore.W0005
|
|
185
185
|
*/
|
|
186
186
|
W0005: '\'{0}\' event is deprecated in {1}. {2}',
|
|
187
187
|
|
|
188
|
-
/**
|
|
189
|
-
* @name ErrorsCore.W0006
|
|
188
|
+
/**
|
|
189
|
+
* @name ErrorsCore.W0006
|
|
190
190
|
*/
|
|
191
191
|
W0006: 'Invalid recurrence rule: \'{0}\'',
|
|
192
192
|
|
|
193
|
-
/**
|
|
194
|
-
* @name ErrorsCore.W0007
|
|
193
|
+
/**
|
|
194
|
+
* @name ErrorsCore.W0007
|
|
195
195
|
*/
|
|
196
196
|
W0007: '\'{0}\' Globalize culture is not defined',
|
|
197
197
|
|
|
198
|
-
/**
|
|
199
|
-
* @name ErrorsCore.W0008
|
|
198
|
+
/**
|
|
199
|
+
* @name ErrorsCore.W0008
|
|
200
200
|
*/
|
|
201
201
|
W0008: 'Invalid view name: \'{0}\'',
|
|
202
202
|
|
|
203
|
-
/**
|
|
204
|
-
* @name ErrorsCore.W0009
|
|
203
|
+
/**
|
|
204
|
+
* @name ErrorsCore.W0009
|
|
205
205
|
*/
|
|
206
206
|
W0009: 'Invalid time zone name: \'{0}\'',
|
|
207
207
|
|
|
208
|
-
/**
|
|
209
|
-
* @name ErrorsCore.W0010
|
|
208
|
+
/**
|
|
209
|
+
* @name ErrorsCore.W0010
|
|
210
210
|
*/
|
|
211
211
|
W0010: '{0} is deprecated in {1}. {2}',
|
|
212
212
|
|
|
213
|
-
/**
|
|
214
|
-
* @name ErrorsCore.W0011
|
|
213
|
+
/**
|
|
214
|
+
* @name ErrorsCore.W0011
|
|
215
215
|
*/
|
|
216
216
|
W0011: 'Number parsing is invoked while the parser is not defined',
|
|
217
217
|
|
|
218
|
-
/**
|
|
219
|
-
* @name ErrorsCore.W0012
|
|
218
|
+
/**
|
|
219
|
+
* @name ErrorsCore.W0012
|
|
220
220
|
*/
|
|
221
221
|
W0012: 'Date parsing is invoked while the parser is not defined',
|
|
222
222
|
|
|
223
|
-
/**
|
|
224
|
-
* @name ErrorsCore.W0013
|
|
223
|
+
/**
|
|
224
|
+
* @name ErrorsCore.W0013
|
|
225
225
|
*/
|
|
226
226
|
W0013: '\'{0}\' file is deprecated in {1}. {2}',
|
|
227
227
|
|
|
228
|
-
/**
|
|
229
|
-
* @name ErrorsCore.W0014
|
|
228
|
+
/**
|
|
229
|
+
* @name ErrorsCore.W0014
|
|
230
230
|
*/
|
|
231
231
|
W0014: '{0} - \'{1}\' type is deprecated in {2}. {3}',
|
|
232
232
|
|
|
233
|
-
/**
|
|
234
|
-
* @name ErrorsCore.W0015
|
|
233
|
+
/**
|
|
234
|
+
* @name ErrorsCore.W0015
|
|
235
235
|
*/
|
|
236
236
|
W0015: 'Instead of returning a value from the \'{0}\' function, write it into the \'{1}\' field of the function\'s parameter.',
|
|
237
237
|
|
|
238
|
-
/**
|
|
239
|
-
* @name ErrorsCore.W0016
|
|
238
|
+
/**
|
|
239
|
+
* @name ErrorsCore.W0016
|
|
240
240
|
*/
|
|
241
241
|
W0016: 'The "{0}" option does not accept the "{1}" value since v.{2}. {3}.',
|
|
242
242
|
|
|
243
|
-
/**
|
|
244
|
-
* @name ErrorsCore.W0017
|
|
243
|
+
/**
|
|
244
|
+
* @name ErrorsCore.W0017
|
|
245
245
|
*/
|
|
246
246
|
W0017: 'Filter query string exceeds maximum length limit of {0} characters.'
|
|
247
247
|
});
|
package/utils/number.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {String} value
|
|
4
|
-
* @param {String} format
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {String} value
|
|
4
|
+
* @param {String} format
|
|
5
5
|
*/
|
|
6
6
|
export default function numberFormat(value, format) {
|
|
7
7
|
let hashCount = 0;
|
|
@@ -44,8 +44,8 @@ export default function numberFormat(value, format) {
|
|
|
44
44
|
//For case like +1 (911) 911 91 91 having pattern +1 (###) ### ## ##
|
|
45
45
|
|
|
46
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
|
|
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
49
|
unless wrong prop value is provided */
|
|
50
50
|
|
|
51
51
|
if (index === -1) {
|
package/utils/render-portal.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { Children } from 'react';
|
|
2
2
|
import { render, createPortal } from 'react-dom';
|
|
3
|
+
import { useTheme } from '../theme';
|
|
3
4
|
const idPortal = 'DGN-UI-Portal',
|
|
4
5
|
classNameCommon = 'DGN-UI-Portal';
|
|
6
|
+
const {
|
|
7
|
+
zIndex
|
|
8
|
+
} = useTheme();
|
|
5
9
|
export const getPortal = () => {
|
|
6
10
|
const portal = document.getElementById(idPortal);
|
|
7
11
|
if (portal) return portal;
|
|
8
12
|
const node = document.createElement('div');
|
|
9
13
|
node.id = idPortal;
|
|
10
|
-
node.style.cssText =
|
|
14
|
+
node.style.cssText = `position: fixed; inset: 0; pointer-events: none; z-index: ${zIndex()};`;
|
|
11
15
|
return document.body.appendChild(node);
|
|
12
16
|
};
|
|
13
17
|
export const isLastChildNode = node => {
|
package/utils/renderIcon.js
CHANGED
|
@@ -5,11 +5,11 @@ import { jsx } from '@emotion/core';
|
|
|
5
5
|
import { ButtonIcon } from '../components';
|
|
6
6
|
import * as Icons from '../icons';
|
|
7
7
|
import { parseTextToHTML, capitalize } from './';
|
|
8
|
-
/**
|
|
9
|
-
* render icon form source (dynamic type)
|
|
10
|
-
* @param {String|jsx} source data of icon, maybe svg text | image link | name of icon in icons store or a jsx element
|
|
11
|
-
* @param {String} type text to parse text to HTML, img link to use img tag, name to use icon form icons store
|
|
12
|
-
* @param {Object} options properties of Icon component if us type is name {width, height, color, viewBox, ...}
|
|
8
|
+
/**
|
|
9
|
+
* render icon form source (dynamic type)
|
|
10
|
+
* @param {String|jsx} source data of icon, maybe svg text | image link | name of icon in icons store or a jsx element
|
|
11
|
+
* @param {String} type text to parse text to HTML, img link to use img tag, name to use icon form icons store
|
|
12
|
+
* @param {Object} options properties of Icon component if us type is name {width, height, color, viewBox, ...}
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
const renderIcon = (source, type, options = {}) => {
|
package/utils/usePortal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Create a element with id
|
|
4
|
-
* @param {string} id
|
|
2
|
+
/**
|
|
3
|
+
* Create a element with id
|
|
4
|
+
* @param {string} id
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
export const createEl = id => {
|
|
@@ -9,17 +9,17 @@ export const createEl = id => {
|
|
|
9
9
|
createdEl.setAttribute('id', id);
|
|
10
10
|
return createdEl;
|
|
11
11
|
};
|
|
12
|
-
/**
|
|
13
|
-
* Insert into document.body at last
|
|
14
|
-
* @param {Element} rootElem
|
|
12
|
+
/**
|
|
13
|
+
* Insert into document.body at last
|
|
14
|
+
* @param {Element} rootElem
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
export const addRootEl = rootElem => {
|
|
18
18
|
document.body.insertBefore(rootElem, document.body.lastElementChild.nextElementSibling);
|
|
19
19
|
};
|
|
20
|
-
/**
|
|
21
|
-
* Create a portal with id
|
|
22
|
-
* @param {string} id
|
|
20
|
+
/**
|
|
21
|
+
* Create a portal with id
|
|
22
|
+
* @param {string} id
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
const usePortal = id => {
|