diginet-core-ui 1.3.55-beta.1 → 1.3.57-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.
- package/assets/images/menu/dhr/MHRM29N0005.svg +13 -0
- package/components/button/icon.js +21 -21
- package/components/form-control/checkbox/index.js +8 -6
- package/components/form-control/dropdown/index.js +37 -38
- package/components/tree-view/index.js +170 -80
- package/icons/basic.js +48 -0
- package/package.json +1 -1
- package/readme.md +14 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M30.85 17.94V9.33C30.85 9.12 30.76 8.9 30.62 8.74L22.1 0.23C21.93 0.09 21.72 0 21.51 0H6.6C4.97 0 3.63 1.33 3.63 2.95V3.16H2.95C1.33 3.16 0 4.49 0 6.12V36.04C0 37.66 1.33 39 2.95 39H24.26C25.89 39 27.21 37.66 27.21 36.04V35.83H27.89C29.53 35.83 30.85 34.5 30.85 32.87V31.4H29.19V32.87C29.19 33.59 28.61 34.17 27.89 34.17H6.6C5.89 34.17 5.3 33.59 5.3 32.87V2.95C5.3 2.24 5.89 1.66 6.6 1.66H20.67V7.2C20.67 7.52 20.72 7.83 20.82 8.12C21.11 9.03 21.83 9.74 22.74 10.04H22.75C23.03 10.12 23.33 10.17 23.63 10.17H27.43L28.95 10.16H29.19V17.94H30.85ZM6.6 35.83H25.55V36.04C25.55 36.75 24.97 37.33 24.26 37.33H2.95C2.25 37.33 1.67 36.75 1.67 36.04V6.12C1.67 5.4 2.25 4.82 2.95 4.82H3.63V32.87C3.63 34.5 4.97 35.83 6.6 35.83Z" fill="#2680EB"/>
|
|
3
|
+
<path d="M25.3298 22.8899L24.6498 25.2699H26.0398L25.3598 22.8899H25.3298Z" fill="#FF8C00"/>
|
|
4
|
+
<path d="M37.0798 18.9399H16.1998C15.1398 18.9399 14.2798 19.7999 14.2798 20.8599V28.4799C14.2798 29.5399 15.1398 30.3999 16.1998 30.3999H37.0798C38.1398 30.3999 38.9998 29.5399 38.9998 28.4799V20.8599C38.9998 19.7999 38.1398 18.9399 37.0798 18.9399ZM20.3798 27.7499L19.3298 25.5899H18.5398V27.7499H16.9898V21.5799H19.5998C21.1198 21.5799 21.9398 22.3399 21.9398 23.6099C21.9398 24.3699 21.5598 25.0599 20.8998 25.3499L22.1198 27.7399H20.3798V27.7499ZM26.7298 27.7499L26.3498 26.3999H24.3598L23.9698 27.7499H22.3898L24.4398 21.5799H26.3398L28.3898 27.7499H26.7298ZM34.6898 27.7499H33.2298L32.1998 23.8999H32.1698L31.1398 27.7499H29.6798L28.0898 21.5799H29.6898L30.5098 25.7499H30.5398L31.5598 21.5799H32.7998L33.8198 25.7499H33.8498L34.6698 21.5799H36.2698L34.6898 27.7499Z" fill="#FF8C00"/>
|
|
5
|
+
<path d="M19.4498 22.7699H18.5498V24.5199H19.4598C20.0298 24.5199 20.3698 24.1799 20.3698 23.6499C20.3598 23.1199 19.9998 22.7699 19.4498 22.7699Z" fill="#FF8C00"/>
|
|
6
|
+
<path d="M7.49984 20.99C7.00984 20.99 6.60984 21.39 6.60984 21.88C6.60984 22.37 7.00984 22.77 7.49984 22.77H11.9498C12.4398 22.77 12.8398 22.37 12.8398 21.88C12.8398 21.39 12.4398 20.99 11.9498 20.99H7.49984Z" fill="#2680EB"/>
|
|
7
|
+
<path d="M7.47984 26.56C6.98984 26.56 6.58984 26.96 6.58984 27.45C6.58984 27.94 6.98984 28.34 7.47984 28.34H11.9298C12.4198 28.34 12.8198 27.94 12.8198 27.45C12.8198 26.96 12.4198 26.56 11.9298 26.56H7.47984Z" fill="#2680EB"/>
|
|
8
|
+
<path d="M13.5401 9.06006C13.5401 10.1301 13.5401 11.2101 13.5401 12.2801C13.5401 12.8201 13.3601 13.0101 12.8301 13.0101C12.3901 13.0101 11.9501 13.0201 11.5101 13.0101C11.0701 13.0001 10.8701 12.7901 10.8701 12.3401C10.8701 10.1501 10.8701 7.96006 10.8701 5.77006C10.8701 5.25006 11.0601 5.06006 11.5601 5.06006C12.0001 5.06006 12.4401 5.06006 12.8801 5.06006C13.3501 5.07006 13.5401 5.25006 13.5401 5.74006C13.5401 6.85006 13.5401 7.95006 13.5401 9.06006Z" fill="#2680EB"/>
|
|
9
|
+
<path d="M17.5501 9.49006C17.5501 10.4401 17.5501 11.4001 17.5501 12.3501C17.5501 12.8001 17.3601 13.0001 16.9101 13.0101C16.4501 13.0201 15.9901 13.0201 15.5301 13.0101C15.1001 13.0001 14.9001 12.7901 14.9001 12.3701C14.9001 10.4701 14.9001 8.58006 14.9001 6.68006C14.9001 6.17006 15.0801 6.00006 15.5701 5.99006C16.0201 5.99006 16.4701 5.99006 16.9201 5.99006C17.3501 5.99006 17.5501 6.19006 17.5501 6.62006C17.5501 7.58006 17.5401 8.54006 17.5501 9.49006Z" fill="#2680EB"/>
|
|
10
|
+
<path d="M6.81006 10.2501C6.81006 9.55006 6.81006 8.84006 6.81006 8.14006C6.81006 7.65006 6.98006 7.48006 7.47006 7.47006C7.94006 7.46006 8.41006 7.46006 8.88006 7.47006C9.26006 7.48006 9.45006 7.67006 9.46006 8.06006C9.47006 9.51006 9.47006 10.9701 9.46006 12.4201C9.46006 12.7801 9.27006 13.0001 8.91006 13.0101C8.40006 13.0301 7.88006 13.0301 7.37006 13.0101C7.01006 13.0001 6.81006 12.7701 6.81006 12.4001C6.81006 11.6801 6.81006 10.9701 6.81006 10.2501Z" fill="#2680EB"/>
|
|
11
|
+
<path d="M20.2401 10.5001C20.5001 10.5001 20.7501 10.4901 21.0101 10.5001C21.3501 10.5201 21.5501 10.7101 21.5601 11.0601C21.5801 11.5301 21.5801 11.9901 21.5601 12.4601C21.5501 12.7901 21.3501 12.9901 21.0301 13.0001C20.5101 13.0201 19.9801 13.0201 19.4601 13.0001C19.1401 12.9901 18.9101 12.7501 18.9001 12.4001C18.8901 11.9601 18.8901 11.5101 18.9001 11.0701C18.9101 10.7201 19.1201 10.5101 19.4701 10.5001C19.7301 10.4901 19.9801 10.5001 20.2401 10.5001Z" fill="#2680EB"/>
|
|
12
|
+
<path d="M21.0801 15.8601H7.30006C7.03006 15.8601 6.81006 15.6401 6.81006 15.3701C6.81006 15.1001 7.03006 14.8801 7.30006 14.8801H21.0801C21.3501 14.8801 21.5701 15.1001 21.5701 15.3701C21.5701 15.6401 21.3501 15.8601 21.0801 15.8601Z" fill="#2680EB"/>
|
|
13
|
+
</svg>
|
|
@@ -370,14 +370,14 @@ ButtonIcon.propTypes = {
|
|
|
370
370
|
/** Name of [icon](https://core.diginet.com.vn/ui/?path=/story/icon-basic). */
|
|
371
371
|
name: PropTypes.string,
|
|
372
372
|
|
|
373
|
-
/**
|
|
374
|
-
* The size of the component.
|
|
375
|
-
*
|
|
376
|
-
* * tiny (button 24px, icon 16px)
|
|
377
|
-
* * small (button 32px, icon 20px)
|
|
378
|
-
* * medium (button 40px, icon 24px)
|
|
379
|
-
* * large (button 48px, icon 32px)
|
|
380
|
-
* * giant (button 56px, icon 40px)
|
|
373
|
+
/**
|
|
374
|
+
* The size of the component.
|
|
375
|
+
*
|
|
376
|
+
* * tiny (button 24px, icon 16px)
|
|
377
|
+
* * small (button 32px, icon 20px)
|
|
378
|
+
* * medium (button 40px, icon 24px)
|
|
379
|
+
* * large (button 48px, icon 32px)
|
|
380
|
+
* * giant (button 56px, icon 40px)
|
|
381
381
|
* */
|
|
382
382
|
size: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'giant']),
|
|
383
383
|
|
|
@@ -393,19 +393,19 @@ ButtonIcon.propTypes = {
|
|
|
393
393
|
/** Width of the component. */
|
|
394
394
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
395
395
|
|
|
396
|
-
/**
|
|
397
|
-
* ref methods (ref.current.instance.*method*)
|
|
398
|
-
*
|
|
399
|
-
* * option(): Gets all UI component properties
|
|
400
|
-
* * Returns value - object
|
|
401
|
-
* * option(optionName): Gets the value of a single property
|
|
402
|
-
* * @param {optionName} - string
|
|
403
|
-
* * Returns value - any
|
|
404
|
-
* * option(optionName, optionValue): Updates the value of a single property
|
|
405
|
-
* * @param {optionName} - string
|
|
406
|
-
* * @param {optionValue} - any
|
|
407
|
-
* * option(options): Updates the values of several properties
|
|
408
|
-
* * @param {options} - object
|
|
396
|
+
/**
|
|
397
|
+
* ref methods (ref.current.instance.*method*)
|
|
398
|
+
*
|
|
399
|
+
* * option(): Gets all UI component properties
|
|
400
|
+
* * Returns value - object
|
|
401
|
+
* * option(optionName): Gets the value of a single property
|
|
402
|
+
* * @param {optionName} - string
|
|
403
|
+
* * Returns value - any
|
|
404
|
+
* * option(optionName, optionValue): Updates the value of a single property
|
|
405
|
+
* * @param {optionName} - string
|
|
406
|
+
* * @param {optionValue} - any
|
|
407
|
+
* * option(options): Updates the values of several properties
|
|
408
|
+
* * @param {options} - object
|
|
409
409
|
*/
|
|
410
410
|
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
411
411
|
current: PropTypes.instanceOf(Element)
|
|
@@ -44,6 +44,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
44
44
|
forTreeView,
|
|
45
45
|
labelProps,
|
|
46
46
|
width,
|
|
47
|
+
stopPropagation,
|
|
47
48
|
...props
|
|
48
49
|
}, reference) => {
|
|
49
50
|
if (!inputRef) {
|
|
@@ -68,7 +69,7 @@ const Checkbox = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
68
69
|
const _CheckBoxInputCSS = CheckBoxInputCSS(_CheckBoxSquareCSS.name, clMain);
|
|
69
70
|
|
|
70
71
|
const handleChange = event => {
|
|
71
|
-
event.stopPropagation();
|
|
72
|
+
stopPropagation && event.stopPropagation();
|
|
72
73
|
if (readOnly || inputProps.readOnly || disabled || inputProps.disabled) return;
|
|
73
74
|
const oldLogicChecked = inputRef.current.checked; //Use for TreeView
|
|
74
75
|
|
|
@@ -278,7 +279,8 @@ Checkbox.defaultProps = {
|
|
|
278
279
|
determinate: true,
|
|
279
280
|
inputProps: {},
|
|
280
281
|
labelProps: {},
|
|
281
|
-
width: 18
|
|
282
|
+
width: 18,
|
|
283
|
+
stopPropagation: true
|
|
282
284
|
};
|
|
283
285
|
Checkbox.propTypes = {
|
|
284
286
|
/** If `true`, the component is checked. */
|
|
@@ -314,10 +316,10 @@ Checkbox.propTypes = {
|
|
|
314
316
|
/** The name of the Checkbox corresponds to the label displayed on the interface. */
|
|
315
317
|
name: PropTypes.string,
|
|
316
318
|
|
|
317
|
-
/**
|
|
318
|
-
* Callback fired when the state is changed.
|
|
319
|
-
*
|
|
320
|
-
* You can pull out the new checked state by accessing `event.value` or `event.target.checked` (boolean).
|
|
319
|
+
/**
|
|
320
|
+
* Callback fired when the state is changed.
|
|
321
|
+
*
|
|
322
|
+
* You can pull out the new checked state by accessing `event.value` or `event.target.checked` (boolean).
|
|
321
323
|
*/
|
|
322
324
|
onChange: PropTypes.func,
|
|
323
325
|
|
|
@@ -124,9 +124,9 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
124
124
|
|
|
125
125
|
const _isMobile = isMobile.any();
|
|
126
126
|
|
|
127
|
-
const _InputCSS = InputCSS(multiple, renderSelectedItem);
|
|
127
|
+
const _InputCSS = InputCSS(multiple, typeof renderSelectedItem === 'function');
|
|
128
128
|
|
|
129
|
-
const _DropdownInputCSS = DropdownInputCSS(viewType, multiple, placeholder, itemMultipleSize, renderSelectedItem, disabled);
|
|
129
|
+
const _DropdownInputCSS = DropdownInputCSS(viewType, multiple, placeholder, itemMultipleSize, typeof renderSelectedItem === 'function', disabled);
|
|
130
130
|
|
|
131
131
|
const _IconCSS = IconCSS(viewType, loading, showClear);
|
|
132
132
|
|
|
@@ -1746,7 +1746,6 @@ Dropdown.defaultProps = {
|
|
|
1746
1746
|
required: false,
|
|
1747
1747
|
multiple: false,
|
|
1748
1748
|
allowSearch: false,
|
|
1749
|
-
closeAfterSelect: true,
|
|
1750
1749
|
inputProps: {},
|
|
1751
1750
|
formStyle: {},
|
|
1752
1751
|
dataSource: [],
|
|
@@ -1786,14 +1785,14 @@ Dropdown.propTypes = {
|
|
|
1786
1785
|
/** The icon to display if not found the icon follow `iconExpr`. */
|
|
1787
1786
|
iconDefault: PropTypes.string,
|
|
1788
1787
|
|
|
1789
|
-
/** Field name used for icon display.<br/>
|
|
1790
|
-
* Example:<br/>
|
|
1791
|
-
* string: 'icon'<br/>
|
|
1792
|
-
* object: {<br/>
|
|
1793
|
-
* key: 'icon',<br/>
|
|
1794
|
-
* prefix: 'https://imglink.com',<br/>
|
|
1795
|
-
* suffix: '.jpg'<br/>
|
|
1796
|
-
* }
|
|
1788
|
+
/** Field name used for icon display.<br/>
|
|
1789
|
+
* Example:<br/>
|
|
1790
|
+
* string: 'icon'<br/>
|
|
1791
|
+
* object: {<br/>
|
|
1792
|
+
* key: 'icon',<br/>
|
|
1793
|
+
* prefix: 'https://imglink.com',<br/>
|
|
1794
|
+
* suffix: '.jpg'<br/>
|
|
1795
|
+
* }
|
|
1797
1796
|
*/
|
|
1798
1797
|
iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
1799
1798
|
key: PropTypes.string,
|
|
@@ -1808,9 +1807,9 @@ Dropdown.propTypes = {
|
|
|
1808
1807
|
/** The displayed value of component. */
|
|
1809
1808
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1810
1809
|
|
|
1811
|
-
/** Field name used for text display in dropdown list.<br/>
|
|
1812
|
-
* Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1813
|
-
* Note: don't use 'id - name', return undefined
|
|
1810
|
+
/** Field name used for text display in dropdown list.<br/>
|
|
1811
|
+
* Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1812
|
+
* Note: don't use 'id - name', return undefined
|
|
1814
1813
|
*/
|
|
1815
1814
|
displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1816
1815
|
|
|
@@ -1820,10 +1819,10 @@ Dropdown.propTypes = {
|
|
|
1820
1819
|
/** The field name used for the returned result. */
|
|
1821
1820
|
valueExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
1822
1821
|
|
|
1823
|
-
/**
|
|
1824
|
-
* Duration wait enter search content on search.<br/>
|
|
1825
|
-
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1826
|
-
* If `true`, used default delayOnInput.
|
|
1822
|
+
/**
|
|
1823
|
+
* Duration wait enter search content on search.<br/>
|
|
1824
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1825
|
+
* If `true`, used default delayOnInput.
|
|
1827
1826
|
*/
|
|
1828
1827
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
1829
1828
|
|
|
@@ -1890,19 +1889,19 @@ Dropdown.propTypes = {
|
|
|
1890
1889
|
/** The array of elements that appear in the dropdown list. */
|
|
1891
1890
|
dataSource: PropTypes.array,
|
|
1892
1891
|
|
|
1893
|
-
/** Function displays items by custom.<br/>
|
|
1894
|
-
* renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
|
|
1895
|
-
* --> such as: displayExpr={'name - role'}
|
|
1892
|
+
/** Function displays items by custom.<br/>
|
|
1893
|
+
* renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
|
|
1894
|
+
* --> such as: displayExpr={'name - role'}
|
|
1896
1895
|
*/
|
|
1897
1896
|
renderItem: PropTypes.func,
|
|
1898
1897
|
|
|
1899
|
-
/** Function
|
|
1900
|
-
* renderSelectedItem={(data, index) => index + ' - ' + data.name}<br/>
|
|
1898
|
+
/** Function or field name used for display selected items, example:<br/>
|
|
1899
|
+
* renderSelectedItem={(data, index) => index + ' - ' + data.name}<br/>
|
|
1901
1900
|
*/
|
|
1902
1901
|
renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1903
1902
|
|
|
1904
|
-
/** Callback fired when the input value changes.<br/>
|
|
1905
|
-
* if undefined: the filter function will run (default)
|
|
1903
|
+
/** Callback fired when the input value changes.<br/>
|
|
1904
|
+
* if undefined: the filter function will run (default)
|
|
1906
1905
|
*/
|
|
1907
1906
|
onInput: PropTypes.func,
|
|
1908
1907
|
|
|
@@ -1921,19 +1920,19 @@ Dropdown.propTypes = {
|
|
|
1921
1920
|
/** The contents in Dropdown box (Exp: TreeView). */
|
|
1922
1921
|
children: PropTypes.node,
|
|
1923
1922
|
|
|
1924
|
-
/**
|
|
1925
|
-
* ref methods
|
|
1926
|
-
*
|
|
1927
|
-
* how to get component element? ref.current
|
|
1928
|
-
*
|
|
1929
|
-
* how to call method? ref.current.instance.{method}
|
|
1930
|
-
*
|
|
1931
|
-
* * showDropdown(): Show dropdown
|
|
1932
|
-
* * closeDropdown(): Close dropdown
|
|
1933
|
-
* * onClear(): Clear selected value
|
|
1934
|
-
* * setPreviousValue(): Set value to previous value
|
|
1935
|
-
* * setValue(value): Set value of dropdown
|
|
1936
|
-
* * @param {value} - string || number || array
|
|
1923
|
+
/**
|
|
1924
|
+
* ref methods
|
|
1925
|
+
*
|
|
1926
|
+
* how to get component element? ref.current
|
|
1927
|
+
*
|
|
1928
|
+
* how to call method? ref.current.instance.{method}
|
|
1929
|
+
*
|
|
1930
|
+
* * showDropdown(): Show dropdown
|
|
1931
|
+
* * closeDropdown(): Close dropdown
|
|
1932
|
+
* * onClear(): Clear selected value
|
|
1933
|
+
* * setPreviousValue(): Set value to previous value
|
|
1934
|
+
* * setValue(value): Set value of dropdown
|
|
1935
|
+
* * @param {value} - string || number || array
|
|
1937
1936
|
*/
|
|
1938
1937
|
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
1939
1938
|
current: PropTypes.instanceOf(Element)
|
|
@@ -4,18 +4,27 @@
|
|
|
4
4
|
import { memo, useMemo, useState, useEffect, useRef, forwardRef, Fragment, useImperativeHandle } from 'react';
|
|
5
5
|
import { render } from 'react-dom';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { jsx } from '@emotion/core';
|
|
8
|
-
import { TreeViewRootCSS } from './css';
|
|
7
|
+
import { jsx, css } from '@emotion/core';
|
|
9
8
|
import { Accordion, AccordionSummary, AccordionDetails, Typography, Checkbox, Divider, InputBase, ButtonIcon } from '..';
|
|
10
9
|
import { mapParent, randomString, removeUnicode } from '../../utils';
|
|
11
10
|
import { getGlobal } from '../../global';
|
|
11
|
+
import { alignCenter, borderBox, cursorPointer, displayBlock, displayInlineBlock, flexRow, positionRelative } from '../../styles/general';
|
|
12
|
+
import theme from '../../theme/settings';
|
|
13
|
+
const {
|
|
14
|
+
colors: {
|
|
15
|
+
fill: {
|
|
16
|
+
focus: fillFocus,
|
|
17
|
+
hover: fillHover,
|
|
18
|
+
pressed: fillPressed
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} = theme;
|
|
12
22
|
const separatorPattern = /\{\w+\}/g;
|
|
13
23
|
const currentValue = {},
|
|
14
24
|
itemsRenderAsync = {};
|
|
15
25
|
const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
16
26
|
expand,
|
|
17
27
|
disabled,
|
|
18
|
-
disabledMap,
|
|
19
28
|
selectBox,
|
|
20
29
|
multiple,
|
|
21
30
|
selectAll,
|
|
@@ -60,22 +69,20 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
60
69
|
if (multipleValueMode === 'multiple' || disabledRelevantValue) {
|
|
61
70
|
input.classList[determinate ? 'add' : 'remove']('determinate');
|
|
62
71
|
input.classList[determinate ? 'remove' : 'add']('indeterminate');
|
|
63
|
-
input.nextElementSibling.classList[determinate ? 'add' : 'remove']('determinate');
|
|
64
|
-
input.nextElementSibling.classList[determinate ? 'remove' : 'add']('indeterminate');
|
|
72
|
+
input.nextElementSibling.firstChild.classList[determinate ? 'add' : 'remove']('determinate');
|
|
73
|
+
input.nextElementSibling.firstChild.classList[determinate ? 'remove' : 'add']('indeterminate');
|
|
65
74
|
}
|
|
66
|
-
}; //
|
|
67
|
-
|
|
75
|
+
}; // const triggerCheckboxRecursion = (nodes, isChecked) => {
|
|
76
|
+
// nodes.forEach(el => {
|
|
77
|
+
// if (el.classList.contains('non-child')) {
|
|
78
|
+
// el.querySelector('input').checked = isChecked;
|
|
79
|
+
// } else {
|
|
80
|
+
// el.firstChild.querySelector('input').checked = isChecked;
|
|
81
|
+
// triggerCheckboxRecursion(Array.from(el.lastChild.firstChild.childNodes), isChecked);
|
|
82
|
+
// }
|
|
83
|
+
// });
|
|
84
|
+
// };
|
|
68
85
|
|
|
69
|
-
const triggerCheckboxRecursion = (nodes, isChecked) => {
|
|
70
|
-
nodes.forEach(el => {
|
|
71
|
-
if (el.classList.contains('non-child')) {
|
|
72
|
-
el.querySelector('input').checked = isChecked;
|
|
73
|
-
} else {
|
|
74
|
-
el.firstChild.querySelector('input').checked = isChecked;
|
|
75
|
-
triggerCheckboxRecursion(Array.from(el.lastChild.firstChild.childNodes), isChecked);
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
86
|
|
|
80
87
|
const checkedParentFollowValue = nodes => {
|
|
81
88
|
if (nodes && nodes !== null && nodes !== void 0 && nodes.length) {
|
|
@@ -331,6 +338,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
331
338
|
};
|
|
332
339
|
|
|
333
340
|
const onClickHandler = (e, data) => {
|
|
341
|
+
if (disabled) return;
|
|
334
342
|
const target = e.target;
|
|
335
343
|
const currentTarget = e.currentTarget;
|
|
336
344
|
let value = typeof data === 'object' ? data[valueExpr] : data;
|
|
@@ -665,9 +673,9 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
665
673
|
}, jsx(Checkbox, {
|
|
666
674
|
forTreeView: true,
|
|
667
675
|
checked: isTrue,
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
676
|
+
value: typeof data === 'object' ? data[valueExpr] : data,
|
|
677
|
+
stopPropagation: false,
|
|
678
|
+
disabled: disabled
|
|
671
679
|
})), renderContent(data, keyArr, index))), jsx(AccordionDetails, {
|
|
672
680
|
id: id
|
|
673
681
|
}, childItems.map((child, i) => renderTreeView(child, index + i, level + 1, sync, id))));
|
|
@@ -686,9 +694,9 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
686
694
|
}, jsx(Checkbox, {
|
|
687
695
|
forTreeView: true,
|
|
688
696
|
checked: isTrue,
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
697
|
+
value: typeof data === 'object' ? data[valueExpr] : data,
|
|
698
|
+
stopPropagation: false,
|
|
699
|
+
disabled: disabled
|
|
692
700
|
})), renderContent(data, keyArr, index));
|
|
693
701
|
};
|
|
694
702
|
|
|
@@ -702,6 +710,7 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
702
710
|
if (searchDelayTime) {
|
|
703
711
|
var _searchDelayTime$matc, _searchDelayTime$matc2;
|
|
704
712
|
|
|
713
|
+
if (searchDelayTime === true) searchDelayTime = getGlobal('delayOnInput');
|
|
705
714
|
const units = {
|
|
706
715
|
m: 60000,
|
|
707
716
|
s: 1000,
|
|
@@ -781,19 +790,6 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
781
790
|
};
|
|
782
791
|
}
|
|
783
792
|
}, [dataSource, value, multiple, selectBox]);
|
|
784
|
-
useEffect(() => {
|
|
785
|
-
if (disabled && ref.current) {
|
|
786
|
-
const childNodes = ref.current.childNodes;
|
|
787
|
-
Array.from(childNodes).forEach(node => {
|
|
788
|
-
node.classList.add('disabled');
|
|
789
|
-
});
|
|
790
|
-
return () => {
|
|
791
|
-
Array.from(childNodes).forEach(node => {
|
|
792
|
-
node.classList.remove('disabled');
|
|
793
|
-
});
|
|
794
|
-
};
|
|
795
|
-
}
|
|
796
|
-
}, [disabled]);
|
|
797
793
|
useEffect(() => {
|
|
798
794
|
var _Object$keys;
|
|
799
795
|
|
|
@@ -860,14 +856,111 @@ const TreeView = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
860
856
|
forTreeView: true,
|
|
861
857
|
label: selectAllLabel,
|
|
862
858
|
onChange: onSelectAll,
|
|
863
|
-
inputRef: selectAllRef
|
|
859
|
+
inputRef: selectAllRef,
|
|
860
|
+
stopPropagation: false,
|
|
861
|
+
disabled: disabled
|
|
864
862
|
})), jsx(Divider, null)), jsx("div", {
|
|
865
863
|
ref: ref,
|
|
866
864
|
...props,
|
|
867
865
|
className: ['TreeView-Content', disabled ? 'disabled' : '', className].join(' ').trim().replace(/\s+/g, ' ')
|
|
868
|
-
},
|
|
869
|
-
}, [dataSource, value, multiple, selectBox, disabledBoldResult, autoExpandToResult, showChildrenOfResult, searchMode, onChange, searchProps]);
|
|
866
|
+
}, mapParent(dataSource, id, parentID, true).map((data, index) => renderTreeView(data, index.toString(), 0, sync))));
|
|
867
|
+
}, [dataSource, value, renderAsyncWithLength, disabled, showSelectedItems, allowSearch, multiple, selectAll, selectAllLabel, className, selectBox, id, parentID, disabledBoldResult, autoExpandToResult, showChildrenOfResult, searchMode, onChange, searchProps]);
|
|
870
868
|
}));
|
|
869
|
+
const TreeViewRootCSS = css`
|
|
870
|
+
${displayBlock};
|
|
871
|
+
${positionRelative};
|
|
872
|
+
.DGN-UI-Accordion {
|
|
873
|
+
box-shadow: none !important;
|
|
874
|
+
.DGN-UI-Accordion-Summary {
|
|
875
|
+
${alignCenter};
|
|
876
|
+
min-height: 40px;
|
|
877
|
+
padding: 0;
|
|
878
|
+
border-radius: 0;
|
|
879
|
+
&.focus {
|
|
880
|
+
background-color: ${theme.colors.focus};
|
|
881
|
+
}
|
|
882
|
+
.Accordion-Icon-Root {
|
|
883
|
+
${flexRow};
|
|
884
|
+
margin-right: 4px;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
.DGN-UI-Accordion-Details-Content {
|
|
888
|
+
padding: 0;
|
|
889
|
+
border-radius: 0;
|
|
890
|
+
}
|
|
891
|
+
.Accordion-Icon-Root {
|
|
892
|
+
${flexRow};
|
|
893
|
+
transition: opacity 0.2s ease-out;
|
|
894
|
+
opacity: 1;
|
|
895
|
+
&.DGN-Invisible {
|
|
896
|
+
opacity: 0;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
&.DGN-Hidden {
|
|
900
|
+
display: none !important;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
.TreeView-All,
|
|
904
|
+
.TreeView-Content {
|
|
905
|
+
${displayBlock};
|
|
906
|
+
${positionRelative};
|
|
907
|
+
.DGN-UI-Accordion {
|
|
908
|
+
margin-bottom: 0;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
.TreeView-Item-Checkbox {
|
|
912
|
+
${displayInlineBlock};
|
|
913
|
+
${positionRelative};
|
|
914
|
+
height: 100%;
|
|
915
|
+
margin-right: 8px;
|
|
916
|
+
}
|
|
917
|
+
.TreeView-Item {
|
|
918
|
+
${flexRow};
|
|
919
|
+
${positionRelative};
|
|
920
|
+
${alignCenter};
|
|
921
|
+
${borderBox};
|
|
922
|
+
min-height: 40px;
|
|
923
|
+
text-align: left;
|
|
924
|
+
color: ${theme.colors.text.main};
|
|
925
|
+
width: 100%;
|
|
926
|
+
&.non-child {
|
|
927
|
+
${cursorPointer};
|
|
928
|
+
transition: background-color 300ms ease;
|
|
929
|
+
&.disabled {
|
|
930
|
+
color: ${theme.colors.disabled};
|
|
931
|
+
cursor: no-drop;
|
|
932
|
+
}
|
|
933
|
+
&:not(.disabled) {
|
|
934
|
+
&:hover {
|
|
935
|
+
background-color: ${fillHover};
|
|
936
|
+
}
|
|
937
|
+
&:focus {
|
|
938
|
+
background-color: ${fillFocus};
|
|
939
|
+
}
|
|
940
|
+
&:active {
|
|
941
|
+
background-color: ${fillPressed};
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
&.DGN-Hidden {
|
|
945
|
+
display: none !important;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
&.focus {
|
|
949
|
+
background-color: ${theme.colors.focus};
|
|
950
|
+
}
|
|
951
|
+
&.TreeView-Item-active .DGN-UI-Typography {
|
|
952
|
+
font-weight: bold;
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
&.expand-able {
|
|
956
|
+
.TreeView-All {
|
|
957
|
+
margin-left: 34px;
|
|
958
|
+
}
|
|
959
|
+
.TreeView-Item.non-child {
|
|
960
|
+
padding-left: 34px;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
`;
|
|
871
964
|
TreeView.defaultProps = {
|
|
872
965
|
expand: false,
|
|
873
966
|
disabled: false,
|
|
@@ -903,9 +996,6 @@ TreeView.propTypes = {
|
|
|
903
996
|
/** prevent all event if true */
|
|
904
997
|
disabled: PropTypes.bool,
|
|
905
998
|
|
|
906
|
-
/** Will not map parent from data */
|
|
907
|
-
disabledMap: PropTypes.bool,
|
|
908
|
-
|
|
909
999
|
/** show checkbox in each item */
|
|
910
1000
|
selectBox: PropTypes.bool,
|
|
911
1001
|
|
|
@@ -942,10 +1032,10 @@ TreeView.propTypes = {
|
|
|
942
1032
|
/** class on element */
|
|
943
1033
|
className: PropTypes.string,
|
|
944
1034
|
|
|
945
|
-
/**
|
|
946
|
-
* field name used for text display<br/>
|
|
947
|
-
* Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
948
|
-
* Note: don't use 'id - name', return undefined
|
|
1035
|
+
/**
|
|
1036
|
+
* field name used for text display<br/>
|
|
1037
|
+
* Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1038
|
+
* Note: don't use 'id - name', return undefined
|
|
949
1039
|
*/
|
|
950
1040
|
displayExpr: PropTypes.string,
|
|
951
1041
|
|
|
@@ -955,19 +1045,19 @@ TreeView.propTypes = {
|
|
|
955
1045
|
/** return value for the select multiple use case */
|
|
956
1046
|
multipleValueMode: PropTypes.oneOf(['single', 'multiple', 'inheritance']),
|
|
957
1047
|
|
|
958
|
-
/**
|
|
959
|
-
* return value for the select multiple use case
|
|
960
|
-
* * contains: "Công ty" contains "công", but not contains "cong"
|
|
961
|
-
* * similar: "Công ty" contains "công" and "cong"
|
|
1048
|
+
/**
|
|
1049
|
+
* return value for the select multiple use case
|
|
1050
|
+
* * contains: "Công ty" contains "công", but not contains "cong"
|
|
1051
|
+
* * similar: "Công ty" contains "công" and "cong"
|
|
962
1052
|
*/
|
|
963
1053
|
searchMode: PropTypes.oneOf(['contains', 'similar']),
|
|
964
1054
|
|
|
965
1055
|
/** The content display for label of checkbox select all */
|
|
966
1056
|
selectAllLabel: PropTypes.string,
|
|
967
1057
|
|
|
968
|
-
/**
|
|
969
|
-
* duration wait enter search content on search<br/>
|
|
970
|
-
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1058
|
+
/**
|
|
1059
|
+
* duration wait enter search content on search<br/>
|
|
1060
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
971
1061
|
*/
|
|
972
1062
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
973
1063
|
|
|
@@ -983,20 +1073,20 @@ TreeView.propTypes = {
|
|
|
983
1073
|
/** the value was selected */
|
|
984
1074
|
value: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
985
1075
|
|
|
986
|
-
/** function displays items by custom<br/>
|
|
987
|
-
* renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
|
|
988
|
-
* --> such as: displayExpr={'name - role'}
|
|
1076
|
+
/** function displays items by custom<br/>
|
|
1077
|
+
* renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
|
|
1078
|
+
* --> such as: displayExpr={'name - role'}
|
|
989
1079
|
*/
|
|
990
1080
|
renderItem: PropTypes.func,
|
|
991
1081
|
|
|
992
|
-
/**
|
|
993
|
-
* on change value function<br />
|
|
994
|
-
* return 2 parameters (e, data)<br />
|
|
995
|
-
* * e: element (insist {value, justSelected, data})<br/>
|
|
996
|
-
* + value is one or an array of selected values<br />
|
|
997
|
-
* + justSelected is value has just been selected (either true or false))<br />
|
|
998
|
-
* + data is one or an array of selected values with full information<br />
|
|
999
|
-
* * data: array of selected values (not recommend because it's the same e.value)
|
|
1082
|
+
/**
|
|
1083
|
+
* on change value function<br />
|
|
1084
|
+
* return 2 parameters (e, data)<br />
|
|
1085
|
+
* * e: element (insist {value, justSelected, data})<br/>
|
|
1086
|
+
* + value is one or an array of selected values<br />
|
|
1087
|
+
* + justSelected is value has just been selected (either true or false))<br />
|
|
1088
|
+
* + data is one or an array of selected values with full information<br />
|
|
1089
|
+
* * data: array of selected values (not recommend because it's the same e.value)
|
|
1000
1090
|
*/
|
|
1001
1091
|
onChange: PropTypes.func,
|
|
1002
1092
|
|
|
@@ -1009,22 +1099,22 @@ TreeView.propTypes = {
|
|
|
1009
1099
|
/** the icon to display for collapse icon */
|
|
1010
1100
|
collapseIcon: PropTypes.any,
|
|
1011
1101
|
|
|
1012
|
-
/**
|
|
1013
|
-
* get ref of TreeView component, insist:<br/>
|
|
1014
|
-
* {<br/>
|
|
1015
|
-
* disabled: true/false,<br/>
|
|
1016
|
-
* displayExpr: string,<br/>
|
|
1017
|
-
* valueExpr: string,<br/>
|
|
1018
|
-
* id: string,<br/>
|
|
1019
|
-
* parentID: string,<br/>
|
|
1020
|
-
* value: string/array<br/>
|
|
1021
|
-
* getValue: get selected values (instead of onChange function),<br/>
|
|
1022
|
-
* setValue: set array of value (only multiple),<br/>
|
|
1023
|
-
* handleCheckbox: checked/unchecked a Checkbox, includes 2 parameters (isChecked, value):<br/>
|
|
1024
|
-
* + isChecked: checked if true (default is false) <br/>
|
|
1025
|
-
* + value: selected values, use 'all' for all values (default is 'all') <br/>
|
|
1026
|
-
* get: get DOM of TreeView component<br/>
|
|
1027
|
-
* }
|
|
1102
|
+
/**
|
|
1103
|
+
* get ref of TreeView component, insist:<br/>
|
|
1104
|
+
* {<br/>
|
|
1105
|
+
* disabled: true/false,<br/>
|
|
1106
|
+
* displayExpr: string,<br/>
|
|
1107
|
+
* valueExpr: string,<br/>
|
|
1108
|
+
* id: string,<br/>
|
|
1109
|
+
* parentID: string,<br/>
|
|
1110
|
+
* value: string/array<br/>
|
|
1111
|
+
* getValue: get selected values (instead of onChange function),<br/>
|
|
1112
|
+
* setValue: set array of value (only multiple),<br/>
|
|
1113
|
+
* handleCheckbox: checked/unchecked a Checkbox, includes 2 parameters (isChecked, value):<br/>
|
|
1114
|
+
* + isChecked: checked if true (default is false) <br/>
|
|
1115
|
+
* + value: selected values, use 'all' for all values (default is 'all') <br/>
|
|
1116
|
+
* get: get DOM of TreeView component<br/>
|
|
1117
|
+
* }
|
|
1028
1118
|
*/
|
|
1029
1119
|
ref: PropTypes.any
|
|
1030
1120
|
};
|
package/icons/basic.js
CHANGED
|
@@ -1342,6 +1342,54 @@ export const ChatBubble = /*#__PURE__*/memo(({
|
|
|
1342
1342
|
fill: colors[color] || color
|
|
1343
1343
|
}));
|
|
1344
1344
|
});
|
|
1345
|
+
export const Checkin = /*#__PURE__*/memo(({
|
|
1346
|
+
width,
|
|
1347
|
+
height,
|
|
1348
|
+
color = '#7F828E',
|
|
1349
|
+
viewBox = false
|
|
1350
|
+
}) => {
|
|
1351
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
1352
|
+
width: width || 24,
|
|
1353
|
+
height: height || 24,
|
|
1354
|
+
viewBox: "0 0 24 24",
|
|
1355
|
+
fill: "none"
|
|
1356
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1357
|
+
d: "M11 7L9.6 8.4L12.2 11H2V13H12.2L9.6 15.6L11 17L16 12L11 7ZM20 19H12V21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3H12V5H20V19Z",
|
|
1358
|
+
fill: colors[color] || color
|
|
1359
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
1360
|
+
width: width || 20,
|
|
1361
|
+
height: height || 18,
|
|
1362
|
+
viewBox: "0 0 20 18",
|
|
1363
|
+
fill: "none"
|
|
1364
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1365
|
+
d: "M9 4L7.6 5.4L10.2 8H0V10H10.2L7.6 12.6L9 14L14 9L9 4ZM18 16H10V18H18C19.1 18 20 17.1 20 16V2C20 0.9 19.1 0 18 0H10V2H18V16Z",
|
|
1366
|
+
fill: colors[color] || color
|
|
1367
|
+
}));
|
|
1368
|
+
});
|
|
1369
|
+
export const Checkout = /*#__PURE__*/memo(({
|
|
1370
|
+
width,
|
|
1371
|
+
height,
|
|
1372
|
+
color = '#7F828E',
|
|
1373
|
+
viewBox = false
|
|
1374
|
+
}) => {
|
|
1375
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
1376
|
+
width: width || 24,
|
|
1377
|
+
height: height || 24,
|
|
1378
|
+
viewBox: "0 0 24 24",
|
|
1379
|
+
fill: "none"
|
|
1380
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1381
|
+
d: "M17 7L15.59 8.41L18.17 11H8V13H18.17L15.59 15.58L17 17L22 12L17 7ZM4 5H12V3H4C2.9 3 2 3.9 2 5V19C2 20.1 2.9 21 4 21H12V19H4V5Z",
|
|
1382
|
+
fill: colors[color] || color
|
|
1383
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
1384
|
+
width: width || 20,
|
|
1385
|
+
height: height || 18,
|
|
1386
|
+
viewBox: "0 0 20 18",
|
|
1387
|
+
fill: "none"
|
|
1388
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1389
|
+
d: "M15 4L13.59 5.41L16.17 8H6V10H16.17L13.59 12.58L15 14L20 9L15 4ZM2 2H10V0H2C0.9 0 0 0.9 0 2V16C0 17.1 0.9 18 2 18H10V16H2V2Z",
|
|
1390
|
+
fill: colors[color] || color
|
|
1391
|
+
}));
|
|
1392
|
+
});
|
|
1345
1393
|
export const CheckList = /*#__PURE__*/memo(({
|
|
1346
1394
|
width,
|
|
1347
1395
|
height,
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,6 +38,20 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.57
|
|
42
|
+
- \[Added\]: MenuIcon – MHRM29N0005
|
|
43
|
+
- \[Changed\]: MoneyInput – Update PagingSelector with new design
|
|
44
|
+
- \[Fixed\]: Attachment – Fix bug not set overflow when close
|
|
45
|
+
- \[Fixed\]: Alert, Notify – Fix bug not set overflow when close
|
|
46
|
+
- \[Fixed\]: Datepicker – Fix bug not set overflow when close
|
|
47
|
+
|
|
48
|
+
## 1.3.56
|
|
49
|
+
- \[Changed\]: PagingSelector – Update PagingSelector with new design
|
|
50
|
+
- \[Changed\]: NumberInput – Return e.valueString
|
|
51
|
+
- \[Fixed\]: Modal – Fix bug not set overflow when close
|
|
52
|
+
- \[Fixed\]: Dropdown – Replace keyExpr with renderSelectedItem; Fix clear icon show wrong when not use prop value
|
|
53
|
+
- \[Fixed\]: Dropdown – Fix bug search, load more
|
|
54
|
+
|
|
41
55
|
## 1.3.55
|
|
42
56
|
- \[Added\]: MenuIcon – MHRM09N1040
|
|
43
57
|
- \[Added\]: Icon – CalendarAdd
|