diginet-core-ui 1.4.67-beta.2 → 1.4.68-beta.1
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.
|
@@ -14,6 +14,7 @@ import { capitalizeSentenceCase, classNames, isValidDate, useControlled } from "
|
|
|
14
14
|
import Calendar from "../calendar";
|
|
15
15
|
import { lowerCaseDayYear } from "../date-input/utils";
|
|
16
16
|
import { parseDateString } from "../../../utils/getLang";
|
|
17
|
+
import { detectDateFormat } from "../../../utils/type";
|
|
17
18
|
const unique = {
|
|
18
19
|
footer: 'DGN-UI-DatePicker-Footer',
|
|
19
20
|
cancel: 'DGN-UI-DatePicker-cancel',
|
|
@@ -230,7 +231,11 @@ const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, referenc
|
|
|
230
231
|
return value;
|
|
231
232
|
} else if (value === null) {
|
|
232
233
|
return null;
|
|
233
|
-
} else
|
|
234
|
+
} else {
|
|
235
|
+
let formatType = returnFormat;
|
|
236
|
+
if (detectDateFormat(value) !== returnFormat) formatType = detectDateFormat(value);
|
|
237
|
+
return parse(value, lowerCaseDayYear(formatType), new Date());
|
|
238
|
+
}
|
|
234
239
|
}, [value]);
|
|
235
240
|
return jsx(Fragment, null, jsx("div", {
|
|
236
241
|
ref: ref,
|
|
@@ -98,13 +98,13 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
98
98
|
|
|
99
99
|
// if (valueProps || valueProps === 0) valueProps = clamp(valueProps, min, max);
|
|
100
100
|
|
|
101
|
-
/**
|
|
102
|
-
* Convert number to format money
|
|
103
|
-
* @param vl {number} - value
|
|
104
|
-
* @type {function}
|
|
105
|
-
* @return {string}
|
|
106
|
-
* @example 1200300.123 => 1,200,300.123
|
|
107
|
-
* @example 1200300,123 => 1.200.300,123
|
|
101
|
+
/**
|
|
102
|
+
* Convert number to format money
|
|
103
|
+
* @param vl {number} - value
|
|
104
|
+
* @type {function}
|
|
105
|
+
* @return {string}
|
|
106
|
+
* @example 1200300.123 => 1,200,300.123
|
|
107
|
+
* @example 1200300,123 => 1.200.300,123
|
|
108
108
|
*/
|
|
109
109
|
const parseNumberToMoney = useCallback((vl, isNumber) => {
|
|
110
110
|
var _number, _number2, _number$, _number3;
|
|
@@ -152,13 +152,13 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
152
152
|
return number;
|
|
153
153
|
}, [decimalSymbol, max, value, decimalDigit, fixedDecimalDigit]);
|
|
154
154
|
|
|
155
|
-
/**
|
|
156
|
-
* Convert money to format number
|
|
157
|
-
* @param vl {string} - value
|
|
158
|
-
* @type {function}
|
|
159
|
-
* @return {number}
|
|
160
|
-
* @example 1,200,300.123 => 1200300.123
|
|
161
|
-
* @example 1.200.300,123 => 1200300.123
|
|
155
|
+
/**
|
|
156
|
+
* Convert money to format number
|
|
157
|
+
* @param vl {string} - value
|
|
158
|
+
* @type {function}
|
|
159
|
+
* @return {number}
|
|
160
|
+
* @example 1,200,300.123 => 1200300.123
|
|
161
|
+
* @example 1.200.300,123 => 1200300.123
|
|
162
162
|
*/
|
|
163
163
|
const convertMoneyToNumber = useCallback((vl, isNumber) => {
|
|
164
164
|
var _number4, _number4$toString, _number4$toString$rep, _number4$toString$rep2, _number4$toString$rep3;
|
|
@@ -320,13 +320,12 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
320
320
|
const target = e.target;
|
|
321
321
|
target.value = globalRef.current.valueString;
|
|
322
322
|
target.valueString = globalRef.current.returnValue;
|
|
323
|
+
let value = globalRef.current.value;
|
|
323
324
|
// eslint-disable-next-line no-extra-boolean-cast
|
|
324
|
-
if (String(e.target.valueString).slice(-1) === decimalSymbol)
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
325
|
+
if (String(e.target.valueString).slice(-1) === decimalSymbol) return;else if (value > Number.MAX_SAFE_INTEGER) value = Number.MAX_SAFE_INTEGER;else if (value < Number.MIN_SAFE_INTEGER) value = Number.MIN_SAFE_INTEGER;
|
|
327
326
|
onChange({
|
|
328
327
|
...e,
|
|
329
|
-
value
|
|
328
|
+
value,
|
|
330
329
|
target
|
|
331
330
|
});
|
|
332
331
|
};
|
|
@@ -518,10 +517,10 @@ NumberInput.propTypes = {
|
|
|
518
517
|
style: PropTypes.object,
|
|
519
518
|
/** Thousand separator character. */
|
|
520
519
|
thousandSeparator: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['.', ','])]),
|
|
521
|
-
/** Validation value, argument can:<br/>
|
|
522
|
-
* * string: the validation rule. Example required.<br/>
|
|
523
|
-
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
524
|
-
* * array: the validation rule list, insist object/string
|
|
520
|
+
/** Validation value, argument can:<br/>
|
|
521
|
+
* * string: the validation rule. Example required.<br/>
|
|
522
|
+
* * object: the validation rule insist name, property, message. Example {name: 'min', compareValue: 9, message: 'Error'} or {max: 99}<br/>
|
|
523
|
+
* * array: the validation rule list, insist object/string
|
|
525
524
|
*/
|
|
526
525
|
validates: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.array, PropTypes.func]),
|
|
527
526
|
/** The value of the input element, required for a controlled component. */
|
|
@@ -201,7 +201,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
201
201
|
determinateCheckbox(selectAllRef.current, false);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
selectAllRef.current.checked =
|
|
204
|
+
selectAllRef.current.checked = isCheckedAll;
|
|
205
205
|
} else if (selectAllRef.current.checked) {
|
|
206
206
|
selectAllRef.current.checked = false;
|
|
207
207
|
}
|
|
@@ -729,7 +729,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
729
729
|
}, [isChanged, isChecked]);
|
|
730
730
|
useEffect(() => {
|
|
731
731
|
if (selectAllRef.current) {
|
|
732
|
-
checkedSelectAllCheckbox();
|
|
732
|
+
setTimeout(() => checkedSelectAllCheckbox());
|
|
733
733
|
}
|
|
734
734
|
if (ref.current.querySelector('.DGN-UI-Accordion-Details-Content')) {
|
|
735
735
|
if (!ref.current.parentNode.classList.contains('expand-able')) {
|
|
@@ -806,7 +806,13 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
806
806
|
viewType: 'outlined',
|
|
807
807
|
...searchProps
|
|
808
808
|
}) : null, multiple && selectAll ? jsx(Fragment, null, jsx("div", {
|
|
809
|
-
className: 'TreeView-All'
|
|
809
|
+
className: 'TreeView-All',
|
|
810
|
+
style: {
|
|
811
|
+
display: 'flex',
|
|
812
|
+
alignItems: 'center',
|
|
813
|
+
minHeight: '40px',
|
|
814
|
+
paddingLeft: '4px'
|
|
815
|
+
}
|
|
810
816
|
}, jsx(Checkbox, {
|
|
811
817
|
label: selectAllLabel,
|
|
812
818
|
onChange: onSelectAll,
|
|
@@ -931,9 +937,6 @@ const TreeViewRootCSS = ({
|
|
|
931
937
|
}
|
|
932
938
|
}
|
|
933
939
|
&.expand-able {
|
|
934
|
-
.TreeView-All {
|
|
935
|
-
margin-left: ${spacing([8.5])};
|
|
936
|
-
}
|
|
937
940
|
.TreeView-Item.non-child {
|
|
938
941
|
padding-left: ${spacing([8.5])};
|
|
939
942
|
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -41,6 +41,12 @@ npm test
|
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
## Changelog
|
|
44
|
+
|
|
45
|
+
## 1.4.68
|
|
46
|
+
- \[Added\]: Icon – Add Icon PersonEdit
|
|
47
|
+
- \[Fixed\]: TreeView - Fix unchecked values are restored unexpectedly
|
|
48
|
+
- \[Fixed\]: Dropdown - Fix Displays incorrect selected value
|
|
49
|
+
|
|
44
50
|
## 1.4.67
|
|
45
51
|
- \[Added\]: ButtonIcon – Add the title prop to ButtonIcon to display the text as a tooltip on hover.
|
|
46
52
|
- \[Added\]: Icon – Add IconMenu MHRP75N0025
|
package/utils/type.js
CHANGED
|
@@ -94,4 +94,10 @@ const isDeferred = object => {
|
|
|
94
94
|
const isEvent = object => {
|
|
95
95
|
return !!(object && object.preventDefault);
|
|
96
96
|
};
|
|
97
|
-
|
|
97
|
+
const detectDateFormat = dateStr => {
|
|
98
|
+
if (!dateStr || typeof dateStr !== 'string') return null;
|
|
99
|
+
if (/^\d{2}\/\d{2}\/\d{4}$/.test(dateStr)) return 'DD/MM/YYYY';
|
|
100
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) return 'YYYY-MM-DD';
|
|
101
|
+
return null;
|
|
102
|
+
};
|
|
103
|
+
export { isBoolean, isExponential, isDate, isDefined, isFunction, isString, isNumeric, isObject, isEmptyObject, isPlainObject, isPrimitive, isWindow, isRenderer, isPromise, isDeferred, type, isEvent, isEmpty, typeOf, detectDateFormat };
|