diginet-core-ui 1.4.53-beta.7 → 1.4.53-beta.9
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.
|
@@ -62,7 +62,7 @@ const getDateFormats = (locale, minZoom) => {
|
|
|
62
62
|
formatMap = pickerReturnFormat; // fallback
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
|
-
return formatMap.get(minZoom)
|
|
65
|
+
return formatMap.get(minZoom);
|
|
66
66
|
};
|
|
67
67
|
const DatePicker = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
68
68
|
var _getDateFormats, _pickerReturnFormat$g, _ipRef$current, _ipRef$current2;
|
|
@@ -288,12 +288,13 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
288
288
|
});
|
|
289
289
|
};
|
|
290
290
|
|
|
291
|
-
/**
|
|
292
|
-
* So sánh text đầu vào cáo map với txtSearch
|
|
293
|
-
* @param text
|
|
294
|
-
* @return {boolean}
|
|
291
|
+
/**
|
|
292
|
+
* So sánh text đầu vào cáo map với txtSearch
|
|
293
|
+
* @param text
|
|
294
|
+
* @return {boolean}
|
|
295
295
|
*/
|
|
296
296
|
const handleRenderBySearch = (text = '') => {
|
|
297
|
+
if (text === null || text === undefined) text = '';
|
|
297
298
|
if (typeof text !== 'string') text = text.toString();
|
|
298
299
|
if (!txtSearch) return true;
|
|
299
300
|
if (searchMode === 'startswith') {
|
|
@@ -303,10 +304,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
303
304
|
} else return text.toLowerCase().includes(txtSearch.toLowerCase());
|
|
304
305
|
};
|
|
305
306
|
|
|
306
|
-
/**
|
|
307
|
-
* Chuyển đổi data thành giá trị cần hiện thị dựa vào displayExpr [string, string object {field} - {field}], renderSelectedItem, displayExpr, valueExpr
|
|
308
|
-
* @param data {object} rowData of dataSource
|
|
309
|
-
* @return {string}
|
|
307
|
+
/**
|
|
308
|
+
* Chuyển đổi data thành giá trị cần hiện thị dựa vào displayExpr [string, string object {field} - {field}], renderSelectedItem, displayExpr, valueExpr
|
|
309
|
+
* @param data {object} rowData of dataSource
|
|
310
|
+
* @return {string}
|
|
310
311
|
*/
|
|
311
312
|
const displayValue = data => {
|
|
312
313
|
let text = '';
|
|
@@ -1721,9 +1722,9 @@ Dropdown.propTypes = {
|
|
|
1721
1722
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1722
1723
|
/** If `true`, the component is disabled. */
|
|
1723
1724
|
disabled: PropTypes.bool,
|
|
1724
|
-
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1725
|
-
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1726
|
-
* Note: Do not use 'id - name', as it will return undefined.
|
|
1725
|
+
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1726
|
+
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1727
|
+
* Note: Do not use 'id - name', as it will return undefined.
|
|
1727
1728
|
*/
|
|
1728
1729
|
displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1729
1730
|
/** Inline style for dropdown items. */
|
|
@@ -1732,14 +1733,14 @@ Dropdown.propTypes = {
|
|
|
1732
1733
|
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
1733
1734
|
/** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
|
|
1734
1735
|
helperTextProps: PropTypes.object,
|
|
1735
|
-
/** The field name used for displaying icons.<br/>
|
|
1736
|
-
* Example:<br/>
|
|
1737
|
-
* string: 'icon'<br/>
|
|
1738
|
-
* object: {<br/>
|
|
1739
|
-
* key: 'icon',<br/>
|
|
1740
|
-
* prefix: 'https://imglink.com',<br/>
|
|
1741
|
-
* suffix: '.jpg'<br/>
|
|
1742
|
-
* }
|
|
1736
|
+
/** The field name used for displaying icons.<br/>
|
|
1737
|
+
* Example:<br/>
|
|
1738
|
+
* string: 'icon'<br/>
|
|
1739
|
+
* object: {<br/>
|
|
1740
|
+
* key: 'icon',<br/>
|
|
1741
|
+
* prefix: 'https://imglink.com',<br/>
|
|
1742
|
+
* suffix: '.jpg'<br/>
|
|
1743
|
+
* }
|
|
1743
1744
|
*/
|
|
1744
1745
|
iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
1745
1746
|
key: PropTypes.string,
|
|
@@ -1773,8 +1774,8 @@ Dropdown.propTypes = {
|
|
|
1773
1774
|
onChange: PropTypes.func,
|
|
1774
1775
|
/** Callback function fired when the dropdown is closed. */
|
|
1775
1776
|
onClosed: PropTypes.func,
|
|
1776
|
-
/** Callback function fired when the input value changes.<br/>
|
|
1777
|
-
* If undefined, the filter function will run (default behavior).
|
|
1777
|
+
/** Callback function fired when the input value changes.<br/>
|
|
1778
|
+
* If undefined, the filter function will run (default behavior).
|
|
1778
1779
|
*/
|
|
1779
1780
|
onInput: PropTypes.func,
|
|
1780
1781
|
/** Callback function fired when a key is pressed down in the input. */
|
|
@@ -1787,21 +1788,21 @@ Dropdown.propTypes = {
|
|
|
1787
1788
|
placeholder: PropTypes.string,
|
|
1788
1789
|
/** If `true`, the component is read-only. */
|
|
1789
1790
|
readOnly: PropTypes.bool,
|
|
1790
|
-
/** Function used for custom rendering of items.<br/>
|
|
1791
|
-
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1792
|
-
* This can be used as an alternative to `displayExpr`
|
|
1791
|
+
/** Function used for custom rendering of items.<br/>
|
|
1792
|
+
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1793
|
+
* This can be used as an alternative to `displayExpr`
|
|
1793
1794
|
*/
|
|
1794
1795
|
renderItem: PropTypes.func,
|
|
1795
|
-
/** Function or field name used to display selected items.<br/>
|
|
1796
|
-
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1796
|
+
/** Function or field name used to display selected items.<br/>
|
|
1797
|
+
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1797
1798
|
*/
|
|
1798
1799
|
renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1799
1800
|
/** If `true`, the label will indicate that the input is required. */
|
|
1800
1801
|
required: PropTypes.bool,
|
|
1801
|
-
/**
|
|
1802
|
-
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1803
|
-
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1804
|
-
* If `true`, the default delayOnInput will be used.
|
|
1802
|
+
/**
|
|
1803
|
+
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1804
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1805
|
+
* If `true`, the default delayOnInput will be used.
|
|
1805
1806
|
*/
|
|
1806
1807
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
1807
1808
|
/** Specifies the field name or expression used to compare values with the search string. */
|
|
@@ -1828,19 +1829,19 @@ Dropdown.propTypes = {
|
|
|
1828
1829
|
valueObjectDefault: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
1829
1830
|
/** The variant to use. */
|
|
1830
1831
|
viewType: PropTypes.oneOf(['underlined', 'outlined', 'none'])
|
|
1831
|
-
/**
|
|
1832
|
-
* ref methods
|
|
1833
|
-
*
|
|
1834
|
-
* how to get component element? ref.current
|
|
1835
|
-
*
|
|
1836
|
-
* how to call method? ref.current.instance.{method}
|
|
1837
|
-
*
|
|
1838
|
-
* * showDropdown(): Show dropdown
|
|
1839
|
-
* * closeDropdown(): Close dropdown
|
|
1840
|
-
* * onClear(): Clear selected value
|
|
1841
|
-
* * setPreviousValue(): Set value to previous value
|
|
1842
|
-
* * setValue(value): Set value of dropdown
|
|
1843
|
-
* * @param {value} - string || number || array
|
|
1832
|
+
/**
|
|
1833
|
+
* ref methods
|
|
1834
|
+
*
|
|
1835
|
+
* how to get component element? ref.current
|
|
1836
|
+
*
|
|
1837
|
+
* how to call method? ref.current.instance.{method}
|
|
1838
|
+
*
|
|
1839
|
+
* * showDropdown(): Show dropdown
|
|
1840
|
+
* * closeDropdown(): Close dropdown
|
|
1841
|
+
* * onClear(): Clear selected value
|
|
1842
|
+
* * setPreviousValue(): Set value to previous value
|
|
1843
|
+
* * setValue(value): Set value of dropdown
|
|
1844
|
+
* * @param {value} - string || number || array
|
|
1844
1845
|
*/
|
|
1845
1846
|
};
|
|
1846
1847
|
export default Dropdown;
|
|
@@ -239,8 +239,10 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
239
239
|
// // Trường hợp phải set về false để xét các input đã check không bao gồm node này
|
|
240
240
|
checkbox.firstChild.checked = isChecked;
|
|
241
241
|
determinateCheckbox(checkbox.firstChild, !mustDisabled);
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
setTimeout(() => {
|
|
243
|
+
// Nếu có ít nhất một input con được check thì phải checked cho input này
|
|
244
|
+
checkbox.firstChild.checked = mustDisabled;
|
|
245
|
+
}, 200);
|
|
244
246
|
node.classList[mustDisabled || isChecked ? 'add' : 'remove']('disabled');
|
|
245
247
|
checkbox.classList[mustDisabled || isChecked ? 'add' : 'remove']('disabled');
|
|
246
248
|
Array.from(node.childNodes).forEach(e => {
|
|
@@ -691,16 +693,16 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
691
693
|
}
|
|
692
694
|
};
|
|
693
695
|
} else if (disabledRelevantValue) {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
if (
|
|
697
|
-
|
|
696
|
+
setTimeout(() => {
|
|
697
|
+
Array.from(ref.current.querySelectorAll('.TreeView-Item.non-child, .DGN-UI-Accordion')).forEach(el => {
|
|
698
|
+
if (el.firstChild.querySelector('input').checked) {
|
|
699
|
+
if (!el.classList.contains('non-child')) {
|
|
698
700
|
handleDisabledChildren(el, true);
|
|
699
|
-
}
|
|
701
|
+
}
|
|
702
|
+
handleDisabledParent(el.parentNode, true);
|
|
700
703
|
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
});
|
|
704
|
+
});
|
|
705
|
+
}, 200);
|
|
704
706
|
}
|
|
705
707
|
}
|
|
706
708
|
}, []);
|