diginet-core-ui 1.4.64 → 1.4.65-beta.2
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/images/menu/dhr/MHRM09N1404.svg +18 -0
- package/assets/images/menu/dhr/MHRP25N0010.svg +16 -0
- package/assets/images/menu/eo/WEO53APP01.svg +16 -0
- package/assets/images/menu/eo/WEO53TR001.svg +15 -0
- package/assets/images/menu/invoice/D06-2.svg +11 -0
- package/assets/images/menu/invoice/D06-4.svg +5 -0
- package/assets/images/menu/invoice/D95F3090.svg +13 -0
- package/assets/images/menu/invoice/D95F3093.svg +11 -0
- package/assets/images/menu/invoice/D95F3094.svg +11 -0
- package/assets/images/menu/invoice/W102F1000.svg +11 -0
- package/assets/images/menu/invoice/W103F1000.svg +15 -0
- package/assets/images/menu/invoice/W104F1000.svg +13 -0
- package/assets/images/menu/invoice/W105F1000.svg +12 -0
- package/assets/images/menu/invoice/W106F1000.svg +15 -0
- package/assets/images/menu/invoice/W107F1000.svg +11 -0
- package/assets/images/menu/invoice/W108F1000.svg +6 -0
- package/assets/images/menu/invoice/W109F1000.svg +12 -0
- package/assets/images/menu/invoice/W110F1000.svg +10 -0
- package/components/button/more.js +28 -14
- package/components/form-control/calendar/function.js +1 -1
- package/components/form-control/calendar/index.js +1 -1
- package/components/form-control/date-input/DateField.js +2 -2
- package/components/form-control/date-input/utils.js +3 -3
- package/components/form-control/date-picker/index.js +1 -1
- package/components/form-control/date-range-picker/index.js +36 -18
- package/components/form-control/dropdown/index.js +3 -3
- package/components/form-control/dropdown-box/index.js +63 -21
- package/components/form-control/money-input/index.js +14 -8
- package/components/form-control/number-input/index2.js +4 -1
- package/components/popup/v2/index.js +9 -5
- package/global/index.js +2 -1
- package/icons/basic.js +66 -0
- package/icons/menu/v2/index.js +2 -2
- package/package.json +78 -44
- package/readme.md +13 -0
- package/theme/settings.js +1 -1
- package/utils/date.js +56 -56
package/utils/date.js
CHANGED
|
@@ -4,11 +4,11 @@ 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
6
|
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
* @param {Date|String|Array} value is a date time
|
|
10
|
-
* @param {String} format the input date format
|
|
11
|
-
* @param {Boolean} setNow return current time if true
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {Date|String|Array} value is a date time
|
|
10
|
+
* @param {String} format the input date format
|
|
11
|
+
* @param {Boolean} setNow return current time if true
|
|
12
12
|
*/
|
|
13
13
|
const getDate = (value, format = 'MM/DD/YYYY', setNow = true) => {
|
|
14
14
|
if (value) {
|
|
@@ -52,11 +52,11 @@ const getMethodOfUnit = unit => {
|
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* check 1 value is a date
|
|
57
|
-
* @param {Date|String|Array|Number} value the value to check
|
|
58
|
-
* @param {String} formatInput the format date to check valid date
|
|
59
|
-
* @returns {Boolean} valid date
|
|
55
|
+
/**
|
|
56
|
+
* check 1 value is a date
|
|
57
|
+
* @param {Date|String|Array|Number} value the value to check
|
|
58
|
+
* @param {String} formatInput the format date to check valid date
|
|
59
|
+
* @returns {Boolean} valid date
|
|
60
60
|
*/
|
|
61
61
|
export const isValidDate = (value, formatInput) => {
|
|
62
62
|
if (typeof value === 'string' || Array.isArray(value)) {
|
|
@@ -69,11 +69,11 @@ export const isValidDate = (value, formatInput) => {
|
|
|
69
69
|
return false;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
-
/**
|
|
73
|
-
* get the end of month from month and year or from a date
|
|
74
|
-
* @param {Number|String|Date|Array} month the month of year (can also be validated as year) or a value with date type
|
|
75
|
-
* @param {Number} year the year (can also be validated as month if arg 1 is year)
|
|
76
|
-
* @returns {Number} end day
|
|
72
|
+
/**
|
|
73
|
+
* get the end of month from month and year or from a date
|
|
74
|
+
* @param {Number|String|Date|Array} month the month of year (can also be validated as year) or a value with date type
|
|
75
|
+
* @param {Number} year the year (can also be validated as month if arg 1 is year)
|
|
76
|
+
* @returns {Number} end day
|
|
77
77
|
*/
|
|
78
78
|
export const getEndDayOfMonth = (month, year) => {
|
|
79
79
|
if (!year) {
|
|
@@ -92,11 +92,11 @@ export const getEndDayOfMonth = (month, year) => {
|
|
|
92
92
|
return 'Invalid Date';
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
/**
|
|
96
|
-
* return a date time follow the concrete format
|
|
97
|
-
* @param {Date|String|Array} value is a date time
|
|
98
|
-
* @param {String} formatOutput format of date
|
|
99
|
-
* @param {Boolean} utc is utc time
|
|
95
|
+
/**
|
|
96
|
+
* return a date time follow the concrete format
|
|
97
|
+
* @param {Date|String|Array} value is a date time
|
|
98
|
+
* @param {String} formatOutput format of date
|
|
99
|
+
* @param {Boolean} utc is utc time
|
|
100
100
|
*/
|
|
101
101
|
export const formatDate = (value, formatOutput = 'DD/MM/YYYY', utc = false) => {
|
|
102
102
|
if (!value) return formatOutput;
|
|
@@ -232,21 +232,21 @@ export const formatDate = (value, formatOutput = 'DD/MM/YYYY', utc = false) => {
|
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
234
|
|
|
235
|
-
/**
|
|
236
|
-
* return a date like moment
|
|
237
|
-
* @param {Date|String|Array} value is date time
|
|
238
|
-
* @param {String} formatInput format of input date value
|
|
239
|
-
* @returns {Object} date
|
|
235
|
+
/**
|
|
236
|
+
* return a date like moment
|
|
237
|
+
* @param {Date|String|Array} value is date time
|
|
238
|
+
* @param {String} formatInput format of input date value
|
|
239
|
+
* @returns {Object} date
|
|
240
240
|
*/
|
|
241
241
|
const date = (value, formatInput = 'MM/DD/YYYY') => {
|
|
242
242
|
const originDate = getDate(value, formatInput);
|
|
243
243
|
|
|
244
|
-
/**
|
|
245
|
-
* compare two date time and return a period
|
|
246
|
-
* @param {Date|String|Array} date is a date time
|
|
247
|
-
* @param {String} unit one of milliseconds|seconds|minutes|hours|days|months|years
|
|
248
|
-
* @param {Boolean|Number} floating allow odd numbers
|
|
249
|
-
* @returns {Number} distance
|
|
244
|
+
/**
|
|
245
|
+
* compare two date time and return a period
|
|
246
|
+
* @param {Date|String|Array} date is a date time
|
|
247
|
+
* @param {String} unit one of milliseconds|seconds|minutes|hours|days|months|years
|
|
248
|
+
* @param {Boolean|Number} floating allow odd numbers
|
|
249
|
+
* @returns {Number} distance
|
|
250
250
|
*/
|
|
251
251
|
const diff = (compareDate, unit = 'days', floating = false) => {
|
|
252
252
|
compareDate = getDate(compareDate);
|
|
@@ -295,12 +295,12 @@ const date = (value, formatInput = 'MM/DD/YYYY') => {
|
|
|
295
295
|
return result.toFixed(floating ? typeof floating === 'number' ? floating : 2 : 0);
|
|
296
296
|
};
|
|
297
297
|
|
|
298
|
-
/**
|
|
299
|
-
* add or subtract date time
|
|
300
|
-
* @param {Number} num the quantity to cal for unit
|
|
301
|
-
* @param {String} unit the unit of date/time
|
|
302
|
-
* @param {String} operator operator to cal (add/subtract)
|
|
303
|
-
* @returns {Object} date
|
|
298
|
+
/**
|
|
299
|
+
* add or subtract date time
|
|
300
|
+
* @param {Number} num the quantity to cal for unit
|
|
301
|
+
* @param {String} unit the unit of date/time
|
|
302
|
+
* @param {String} operator operator to cal (add/subtract)
|
|
303
|
+
* @returns {Object} date
|
|
304
304
|
*/
|
|
305
305
|
const calculation = (num, unit, operator) => {
|
|
306
306
|
if (isNaN(num)) {
|
|
@@ -311,11 +311,11 @@ const date = (value, formatInput = 'MM/DD/YYYY') => {
|
|
|
311
311
|
return date(originDate, formatInput);
|
|
312
312
|
};
|
|
313
313
|
|
|
314
|
-
/**
|
|
315
|
-
* get the moment of time follow unit time
|
|
316
|
-
* @param {String} unit the unit of time
|
|
317
|
-
* @param {String} moment start|end to get start|end of the moment
|
|
318
|
-
* @returns {Object} date
|
|
314
|
+
/**
|
|
315
|
+
* get the moment of time follow unit time
|
|
316
|
+
* @param {String} unit the unit of time
|
|
317
|
+
* @param {String} moment start|end to get start|end of the moment
|
|
318
|
+
* @returns {Object} date
|
|
319
319
|
*/
|
|
320
320
|
const timeOf = (unit, moment) => {
|
|
321
321
|
let temp = 1;
|
|
@@ -337,12 +337,12 @@ const date = (value, formatInput = 'MM/DD/YYYY') => {
|
|
|
337
337
|
return date(originDate, formatInput);
|
|
338
338
|
};
|
|
339
339
|
|
|
340
|
-
/**
|
|
341
|
-
*
|
|
342
|
-
* @param {Date|String|Number|Array} compareDate date to calculate moment, undefined will compare with now
|
|
343
|
-
* @param {String|Array} unit year|month|day|hour|minute|second|millisecond, allow undefined
|
|
344
|
-
* @param {Boolean|Number} floating allow odd numbers
|
|
345
|
-
* @returns {String} moments
|
|
340
|
+
/**
|
|
341
|
+
*
|
|
342
|
+
* @param {Date|String|Number|Array} compareDate date to calculate moment, undefined will compare with now
|
|
343
|
+
* @param {String|Array} unit year|month|day|hour|minute|second|millisecond, allow undefined
|
|
344
|
+
* @param {Boolean|Number} floating allow odd numbers
|
|
345
|
+
* @returns {String} moments
|
|
346
346
|
*/
|
|
347
347
|
const relative = (compareDate, unit, floating) => {
|
|
348
348
|
compareDate = getDate(compareDate);
|
|
@@ -378,17 +378,17 @@ const date = (value, formatInput = 'MM/DD/YYYY') => {
|
|
|
378
378
|
};
|
|
379
379
|
return {
|
|
380
380
|
value: originDate,
|
|
381
|
-
/**
|
|
382
|
-
* return a date time follow the concrete format
|
|
383
|
-
* @param {String} formatOutput format of date
|
|
384
|
-
* @param {Boolean} utc is utc time
|
|
381
|
+
/**
|
|
382
|
+
* return a date time follow the concrete format
|
|
383
|
+
* @param {String} formatOutput format of date
|
|
384
|
+
* @param {Boolean} utc is utc time
|
|
385
385
|
*/
|
|
386
386
|
format: (formatOutput, utc) => formatDate(originDate, formatOutput, utc),
|
|
387
387
|
diff,
|
|
388
|
-
/**
|
|
389
|
-
* check 1 value is a date
|
|
390
|
-
* @param {String} formatInput the format date to check valid date
|
|
391
|
-
* @returns {Boolean} valid date
|
|
388
|
+
/**
|
|
389
|
+
* check 1 value is a date
|
|
390
|
+
* @param {String} formatInput the format date to check valid date
|
|
391
|
+
* @returns {Boolean} valid date
|
|
392
392
|
*/
|
|
393
393
|
isValid: () => isValidDate(originDate, formatInput),
|
|
394
394
|
add: (num, unit) => calculation(num, unit, 'add'),
|