diginet-core-ui 1.4.60-beta.1 → 1.4.61-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.
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_2469_36)">
|
|
3
|
+
<path d="M33.6 3.09998H31V5.69998C31 7.39998 29.6 8.69998 28 8.69998C26.3 8.69998 25 7.39998 25 5.69998V3.09998H14V5.69998C14 7.39998 12.7 8.69998 11 8.69998C9.4 8.69998 8 7.39998 8 5.69998V3.09998H5.4C2.4 3.09998 0 5.49998 0 8.39998V33.6C0 36.6 2.4 39 5.4 39H33.6C36.6 39 39 36.6 39 33.6V8.39998C39 5.49998 36.6 3.09998 33.6 3.09998ZM36.5 33.1C36.5 35 34.9 36.5 33 36.5H6C4.1 36.5 2.6 35 2.6 33.1V13H36.5V33.1Z" fill="#2680EB"/>
|
|
4
|
+
<path d="M30 5.9V1.8C30 0.8 29.2 0 28.2 0H27.8C26.8 0 26 0.8 26 1.8V5.9C26 6.9 26.8 7.7 27.8 7.7H28.2C29.2 7.7 30 6.9 30 5.9Z" fill="#7BC0F9"/>
|
|
5
|
+
<path d="M13 5.9V1.8C13 0.8 12.2 0 11.2 0H10.8C9.8 0 9 0.8 9 1.8V5.9C9 6.9 9.8 7.7 10.8 7.7H11.2C12.2 7.7 13 6.9 13 5.9Z" fill="#7BC0F9"/>
|
|
6
|
+
<path d="M13 24H7.6C7.2 24 7 23.8 7 23.5V18C7 17.7 7.2 17.4 7.6 17.4H13C13.3 17.4 13.6 17.6 13.6 18V23.5C13.6 23.8 13.3 24 13 24Z" fill="#1CA261"/>
|
|
7
|
+
<path d="M22.3002 24H16.8002C16.5002 24 16.2002 23.8 16.2002 23.4V18C16.2002 17.7 16.4002 17.4 16.8002 17.4H22.3002C22.6002 17.4 22.9002 17.6 22.9002 18V23.5C22.8002 23.8 22.6002 24 22.3002 24Z" fill="#FFAA00"/>
|
|
8
|
+
<path d="M31.4999 24H25.9999C25.6999 24 25.3999 23.8 25.3999 23.4V18C25.3999 17.7 25.5999 17.4 25.9999 17.4H31.4999C31.7999 17.4 32.0999 17.6 32.0999 18V23.5C31.9999 23.8 31.7999 24 31.4999 24Z" fill="#FF4444"/>
|
|
9
|
+
<path d="M13 32.8H7.6C7.3 32.8 7 32.6 7 32.2V26.7C7 26.4 7.2 26.1 7.6 26.1H13C13.3 26.1 13.6 26.3 13.6 26.7V32.2C13.6 32.5 13.3 32.8 13 32.8Z" fill="#FFAA00"/>
|
|
10
|
+
<path d="M22.3002 32.8H16.8002C16.5002 32.8 16.2002 32.6 16.2002 32.2V26.7C16.2002 26.4 16.4002 26.1 16.8002 26.1H22.3002C22.6002 26.1 22.9002 26.3 22.9002 26.7V32.2C22.8002 32.5 22.6002 32.8 22.3002 32.8Z" fill="#FF4444"/>
|
|
11
|
+
<path d="M31.4999 32.8H25.9999C25.6999 32.8 25.3999 32.6 25.3999 32.2V26.7C25.3999 26.4 25.5999 26.1 25.9999 26.1H31.4999C31.7999 26.1 32.0999 26.3 32.0999 26.7V32.2C31.9999 32.5 31.7999 32.8 31.4999 32.8Z" fill="#1CA261"/>
|
|
12
|
+
</g>
|
|
13
|
+
<defs>
|
|
14
|
+
<clipPath id="clip0_2469_36">
|
|
15
|
+
<rect width="39" height="39" fill="white"/>
|
|
16
|
+
</clipPath>
|
|
17
|
+
</defs>
|
|
18
|
+
</svg>
|
|
@@ -5,7 +5,7 @@ import { Avatar, ButtonIcon, Checkbox, Chip, CircularProgress, HelperText, Input
|
|
|
5
5
|
import Popover from "../../popover";
|
|
6
6
|
import { getGlobal } from "../../../global";
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
8
|
+
import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState, useCallback } from 'react';
|
|
9
9
|
import ReactDOM from 'react-dom';
|
|
10
10
|
import { animation, bgColor, border, borderBottom, borderBottomColor, borderColor, borderNone, borderRadius, bottom, boxBorder, breakWord, cursorDefault, cursorNotAllowed, cursorPointer, displayBlock, displayFlex, fill, flexRow, flexWrap, inset, insetX, invisible, italic, itemsCenter, justifyCenter, justifyStart, outlineNone, overflowYScroll, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMinHeight, parseWidth, parseWidthHeight, pointerEventsNone, positionAbsolute, positionRelative, textColor, top, userSelectNone, z } from "../../../styles/general";
|
|
11
11
|
import { useTheme } from "../../../theme";
|
|
@@ -89,6 +89,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
89
89
|
multiple,
|
|
90
90
|
noDataText: noDataTextProp,
|
|
91
91
|
onChange,
|
|
92
|
+
onOpened,
|
|
92
93
|
onClosed,
|
|
93
94
|
onInput,
|
|
94
95
|
onKeyDown,
|
|
@@ -201,14 +202,14 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
201
202
|
}
|
|
202
203
|
!!blur && inputRef.current.blur();
|
|
203
204
|
};
|
|
204
|
-
const onClickInput = e => {
|
|
205
|
+
const onClickInput = useCallback(e => {
|
|
205
206
|
if (disabled || readOnly || loadingState) return;
|
|
206
207
|
if (!dropdownListRef.current) {
|
|
207
208
|
if (!multiple || !Array.from(inputRef.current.querySelectorAll('.DGN-UI-Chip')).some(item => item.contains(e === null || e === void 0 ? void 0 : e.target))) {
|
|
208
209
|
setOpenState(true);
|
|
209
210
|
}
|
|
210
211
|
}
|
|
211
|
-
};
|
|
212
|
+
}, [disabled, readOnly, loadingState]);
|
|
212
213
|
const showDropdown = () => {
|
|
213
214
|
const dropdown = children ? jsx("div", {
|
|
214
215
|
css: _DropdownListCSS,
|
|
@@ -300,10 +301,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
300
301
|
});
|
|
301
302
|
};
|
|
302
303
|
|
|
303
|
-
/**
|
|
304
|
-
* So sánh text đầu vào cáo map với txtSearch
|
|
305
|
-
* @param text
|
|
306
|
-
* @return {boolean}
|
|
304
|
+
/**
|
|
305
|
+
* So sánh text đầu vào cáo map với txtSearch
|
|
306
|
+
* @param text
|
|
307
|
+
* @return {boolean}
|
|
307
308
|
*/
|
|
308
309
|
const handleRenderBySearch = (text = '') => {
|
|
309
310
|
if (text === null || text === undefined) text = '';
|
|
@@ -316,10 +317,10 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
316
317
|
} else return text.toLowerCase().includes(txtSearch.toLowerCase());
|
|
317
318
|
};
|
|
318
319
|
|
|
319
|
-
/**
|
|
320
|
-
* 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
|
|
321
|
-
* @param data {object} rowData of dataSource
|
|
322
|
-
* @return {string}
|
|
320
|
+
/**
|
|
321
|
+
* 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
|
|
322
|
+
* @param data {object} rowData of dataSource
|
|
323
|
+
* @return {string}
|
|
323
324
|
*/
|
|
324
325
|
const displayValue = data => {
|
|
325
326
|
let text = '';
|
|
@@ -1110,6 +1111,8 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef((inProps, reference)
|
|
|
1110
1111
|
filter.current.strSearch = '';
|
|
1111
1112
|
handleActionLoadData(true);
|
|
1112
1113
|
}
|
|
1114
|
+
} else if (openState) {
|
|
1115
|
+
onOpened && onOpened();
|
|
1113
1116
|
}
|
|
1114
1117
|
}, [openState]);
|
|
1115
1118
|
useLayoutEffect(() => {
|
|
@@ -1802,9 +1805,9 @@ Dropdown.propTypes = {
|
|
|
1802
1805
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1803
1806
|
/** If `true`, the component is disabled. */
|
|
1804
1807
|
disabled: PropTypes.bool,
|
|
1805
|
-
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1806
|
-
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1807
|
-
* Note: Do not use 'id - name', as it will return undefined.
|
|
1808
|
+
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1809
|
+
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1810
|
+
* Note: Do not use 'id - name', as it will return undefined.
|
|
1808
1811
|
*/
|
|
1809
1812
|
displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1810
1813
|
/** Inline style for dropdown items. */
|
|
@@ -1813,14 +1816,14 @@ Dropdown.propTypes = {
|
|
|
1813
1816
|
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
1814
1817
|
/** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
|
|
1815
1818
|
helperTextProps: PropTypes.object,
|
|
1816
|
-
/** The field name used for displaying icons.<br/>
|
|
1817
|
-
* Example:<br/>
|
|
1818
|
-
* string: 'icon'<br/>
|
|
1819
|
-
* object: {<br/>
|
|
1820
|
-
* key: 'icon',<br/>
|
|
1821
|
-
* prefix: 'https://imglink.com',<br/>
|
|
1822
|
-
* suffix: '.jpg'<br/>
|
|
1823
|
-
* }
|
|
1819
|
+
/** The field name used for displaying icons.<br/>
|
|
1820
|
+
* Example:<br/>
|
|
1821
|
+
* string: 'icon'<br/>
|
|
1822
|
+
* object: {<br/>
|
|
1823
|
+
* key: 'icon',<br/>
|
|
1824
|
+
* prefix: 'https://imglink.com',<br/>
|
|
1825
|
+
* suffix: '.jpg'<br/>
|
|
1826
|
+
* }
|
|
1824
1827
|
*/
|
|
1825
1828
|
iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
1826
1829
|
key: PropTypes.string,
|
|
@@ -1852,10 +1855,12 @@ Dropdown.propTypes = {
|
|
|
1852
1855
|
noDataText: PropTypes.string,
|
|
1853
1856
|
/** Callback function fired when the value changes. */
|
|
1854
1857
|
onChange: PropTypes.func,
|
|
1858
|
+
/** Callback function fired when the dropdown is opened. */
|
|
1859
|
+
onOpened: PropTypes.func,
|
|
1855
1860
|
/** Callback function fired when the dropdown is closed. */
|
|
1856
1861
|
onClosed: PropTypes.func,
|
|
1857
|
-
/** Callback function fired when the input value changes.<br/>
|
|
1858
|
-
* If undefined, the filter function will run (default behavior).
|
|
1862
|
+
/** Callback function fired when the input value changes.<br/>
|
|
1863
|
+
* If undefined, the filter function will run (default behavior).
|
|
1859
1864
|
*/
|
|
1860
1865
|
onInput: PropTypes.func,
|
|
1861
1866
|
/** Callback function fired when a key is pressed down in the input. */
|
|
@@ -1868,21 +1873,21 @@ Dropdown.propTypes = {
|
|
|
1868
1873
|
placeholder: PropTypes.string,
|
|
1869
1874
|
/** If `true`, the component is read-only. */
|
|
1870
1875
|
readOnly: PropTypes.bool,
|
|
1871
|
-
/** Function used for custom rendering of items.<br/>
|
|
1872
|
-
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1873
|
-
* This can be used as an alternative to `displayExpr`
|
|
1876
|
+
/** Function used for custom rendering of items.<br/>
|
|
1877
|
+
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1878
|
+
* This can be used as an alternative to `displayExpr`
|
|
1874
1879
|
*/
|
|
1875
1880
|
renderItem: PropTypes.func,
|
|
1876
|
-
/** Function or field name used to display selected items.<br/>
|
|
1877
|
-
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1881
|
+
/** Function or field name used to display selected items.<br/>
|
|
1882
|
+
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1878
1883
|
*/
|
|
1879
1884
|
renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1880
1885
|
/** If `true`, the label will indicate that the input is required. */
|
|
1881
1886
|
required: PropTypes.bool,
|
|
1882
|
-
/**
|
|
1883
|
-
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1884
|
-
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1885
|
-
* If `true`, the default delayOnInput will be used.
|
|
1887
|
+
/**
|
|
1888
|
+
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1889
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1890
|
+
* If `true`, the default delayOnInput will be used.
|
|
1886
1891
|
*/
|
|
1887
1892
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
1888
1893
|
/** Specifies the field name or expression used to compare values with the search string. */
|
|
@@ -1915,19 +1920,19 @@ Dropdown.propTypes = {
|
|
|
1915
1920
|
viewType: PropTypes.oneOf(['underlined', 'outlined', 'none']),
|
|
1916
1921
|
/** Custom icon to override the default arrow icon. */
|
|
1917
1922
|
endIcon: PropTypes.string
|
|
1918
|
-
/**
|
|
1919
|
-
* ref methods
|
|
1920
|
-
*
|
|
1921
|
-
* how to get component element? ref.current
|
|
1922
|
-
*
|
|
1923
|
-
* how to call method? ref.current.instance.{method}
|
|
1924
|
-
*
|
|
1925
|
-
* * showDropdown(): Show dropdown
|
|
1926
|
-
* * closeDropdown(): Close dropdown
|
|
1927
|
-
* * onClear(): Clear selected value
|
|
1928
|
-
* * setPreviousValue(): Set value to previous value
|
|
1929
|
-
* * setValue(value): Set value of dropdown
|
|
1930
|
-
* * @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
|
|
1931
1936
|
*/
|
|
1932
1937
|
};
|
|
1933
1938
|
export default Dropdown;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -42,6 +42,11 @@ npm test
|
|
|
42
42
|
|
|
43
43
|
## Changelog
|
|
44
44
|
|
|
45
|
+
## 1.4.61
|
|
46
|
+
- \[Added\]: Icon – Add IconMenu MHRM38N1051
|
|
47
|
+
- \[Fixed\]: Dropdown – Dropdown multiple core has a disable bug
|
|
48
|
+
- \[Fixed\]: Dropdown – Add a prop to support callback when clicking on the Dropdown.
|
|
49
|
+
|
|
45
50
|
## 1.4.60
|
|
46
51
|
- \[Added\]: Icon – Add IconMenu MHRP09N0039, MHRP09N0040
|
|
47
52
|
- \[Fixed\]: NumberInput – Negative values can still be pasted when disabledNegative is enabled
|