diginet-core-ui 1.4.49-beta.4 → 1.4.50
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/components/form-control/calendar/function.js +1 -1
- package/components/form-control/calendar/index.js +1 -1
- package/components/form-control/dropdown/index.js +43 -43
- package/components/form-control/dropdown-box/index.js +21 -63
- package/components/form-control/number-input/index2.js +1 -4
- package/components/popover/index.js +13 -13
- package/components/tree-view/index.js +34 -34
- package/package.json +44 -78
- package/readme.md +5 -0
|
@@ -652,7 +652,7 @@ const renderNavigator = (className, refs, dbLeftFn, leftFn, rightFn, dbRightFn,
|
|
|
652
652
|
color: 'primary',
|
|
653
653
|
type: 'h3',
|
|
654
654
|
ref: refs.content,
|
|
655
|
-
format: ['
|
|
655
|
+
format: ['lowercase']
|
|
656
656
|
}))), jsx("div", {
|
|
657
657
|
className: className.navigator.around
|
|
658
658
|
}, jsx(ButtonIcon, {
|
|
@@ -226,7 +226,7 @@ const Calendar = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
226
226
|
* START EFFECT
|
|
227
227
|
*/
|
|
228
228
|
useEffect(() => {
|
|
229
|
-
if (defaultValue && defaultValue !== '' && isValidDate(defaultValue)
|
|
229
|
+
if (defaultValue && defaultValue !== '' && isValidDate(defaultValue)) {
|
|
230
230
|
if (isBeforeLimit(min, defaultValue)) {
|
|
231
231
|
onUpdate(min);
|
|
232
232
|
} else if (isAfterLimit(max, defaultValue)) {
|
|
@@ -286,10 +286,10 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
286
286
|
});
|
|
287
287
|
};
|
|
288
288
|
|
|
289
|
-
/**
|
|
290
|
-
* So sánh text đầu vào cáo map với txtSearch
|
|
291
|
-
* @param text
|
|
292
|
-
* @return {boolean}
|
|
289
|
+
/**
|
|
290
|
+
* So sánh text đầu vào cáo map với txtSearch
|
|
291
|
+
* @param text
|
|
292
|
+
* @return {boolean}
|
|
293
293
|
*/
|
|
294
294
|
const handleRenderBySearch = (text = '') => {
|
|
295
295
|
if (typeof text !== 'string') text = text.toString();
|
|
@@ -301,10 +301,10 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
301
301
|
} else return text.toLowerCase().includes(txtSearch.toLowerCase());
|
|
302
302
|
};
|
|
303
303
|
|
|
304
|
-
/**
|
|
305
|
-
* 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
|
|
306
|
-
* @param data {object} rowData of dataSource
|
|
307
|
-
* @return {string}
|
|
304
|
+
/**
|
|
305
|
+
* 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
|
|
306
|
+
* @param data {object} rowData of dataSource
|
|
307
|
+
* @return {string}
|
|
308
308
|
*/
|
|
309
309
|
const displayValue = data => {
|
|
310
310
|
let text = '';
|
|
@@ -1709,9 +1709,9 @@ Dropdown.propTypes = {
|
|
|
1709
1709
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1710
1710
|
/** If `true`, the component is disabled. */
|
|
1711
1711
|
disabled: PropTypes.bool,
|
|
1712
|
-
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1713
|
-
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1714
|
-
* Note: Do not use 'id - name', as it will return undefined.
|
|
1712
|
+
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1713
|
+
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1714
|
+
* Note: Do not use 'id - name', as it will return undefined.
|
|
1715
1715
|
*/
|
|
1716
1716
|
displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1717
1717
|
/** Inline style for dropdown items. */
|
|
@@ -1720,14 +1720,14 @@ Dropdown.propTypes = {
|
|
|
1720
1720
|
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
1721
1721
|
/** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
|
|
1722
1722
|
helperTextProps: PropTypes.object,
|
|
1723
|
-
/** The field name used for displaying icons.<br/>
|
|
1724
|
-
* Example:<br/>
|
|
1725
|
-
* string: 'icon'<br/>
|
|
1726
|
-
* object: {<br/>
|
|
1727
|
-
* key: 'icon',<br/>
|
|
1728
|
-
* prefix: 'https://imglink.com',<br/>
|
|
1729
|
-
* suffix: '.jpg'<br/>
|
|
1730
|
-
* }
|
|
1723
|
+
/** The field name used for displaying icons.<br/>
|
|
1724
|
+
* Example:<br/>
|
|
1725
|
+
* string: 'icon'<br/>
|
|
1726
|
+
* object: {<br/>
|
|
1727
|
+
* key: 'icon',<br/>
|
|
1728
|
+
* prefix: 'https://imglink.com',<br/>
|
|
1729
|
+
* suffix: '.jpg'<br/>
|
|
1730
|
+
* }
|
|
1731
1731
|
*/
|
|
1732
1732
|
iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
1733
1733
|
key: PropTypes.string,
|
|
@@ -1761,8 +1761,8 @@ Dropdown.propTypes = {
|
|
|
1761
1761
|
onChange: PropTypes.func,
|
|
1762
1762
|
/** Callback function fired when the dropdown is closed. */
|
|
1763
1763
|
onClosed: PropTypes.func,
|
|
1764
|
-
/** Callback function fired when the input value changes.<br/>
|
|
1765
|
-
* If undefined, the filter function will run (default behavior).
|
|
1764
|
+
/** Callback function fired when the input value changes.<br/>
|
|
1765
|
+
* If undefined, the filter function will run (default behavior).
|
|
1766
1766
|
*/
|
|
1767
1767
|
onInput: PropTypes.func,
|
|
1768
1768
|
/** Callback function fired when a key is pressed down in the input. */
|
|
@@ -1775,21 +1775,21 @@ Dropdown.propTypes = {
|
|
|
1775
1775
|
placeholder: PropTypes.string,
|
|
1776
1776
|
/** If `true`, the component is read-only. */
|
|
1777
1777
|
readOnly: PropTypes.bool,
|
|
1778
|
-
/** Function used for custom rendering of items.<br/>
|
|
1779
|
-
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1780
|
-
* This can be used as an alternative to `displayExpr`
|
|
1778
|
+
/** Function used for custom rendering of items.<br/>
|
|
1779
|
+
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1780
|
+
* This can be used as an alternative to `displayExpr`
|
|
1781
1781
|
*/
|
|
1782
1782
|
renderItem: PropTypes.func,
|
|
1783
|
-
/** Function or field name used to display selected items.<br/>
|
|
1784
|
-
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1783
|
+
/** Function or field name used to display selected items.<br/>
|
|
1784
|
+
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1785
1785
|
*/
|
|
1786
1786
|
renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1787
1787
|
/** If `true`, the label will indicate that the input is required. */
|
|
1788
1788
|
required: PropTypes.bool,
|
|
1789
|
-
/**
|
|
1790
|
-
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1791
|
-
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1792
|
-
* If `true`, the default delayOnInput will be used.
|
|
1789
|
+
/**
|
|
1790
|
+
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1791
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1792
|
+
* If `true`, the default delayOnInput will be used.
|
|
1793
1793
|
*/
|
|
1794
1794
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
1795
1795
|
/** Specifies the field name or expression used to compare values with the search string. */
|
|
@@ -1816,19 +1816,19 @@ Dropdown.propTypes = {
|
|
|
1816
1816
|
valueObjectDefault: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
1817
1817
|
/** The variant to use. */
|
|
1818
1818
|
viewType: PropTypes.oneOf(['underlined', 'outlined', 'none'])
|
|
1819
|
-
/**
|
|
1820
|
-
* ref methods
|
|
1821
|
-
*
|
|
1822
|
-
* how to get component element? ref.current
|
|
1823
|
-
*
|
|
1824
|
-
* how to call method? ref.current.instance.{method}
|
|
1825
|
-
*
|
|
1826
|
-
* * showDropdown(): Show dropdown
|
|
1827
|
-
* * closeDropdown(): Close dropdown
|
|
1828
|
-
* * onClear(): Clear selected value
|
|
1829
|
-
* * setPreviousValue(): Set value to previous value
|
|
1830
|
-
* * setValue(value): Set value of dropdown
|
|
1831
|
-
* * @param {value} - string || number || array
|
|
1819
|
+
/**
|
|
1820
|
+
* ref methods
|
|
1821
|
+
*
|
|
1822
|
+
* how to get component element? ref.current
|
|
1823
|
+
*
|
|
1824
|
+
* how to call method? ref.current.instance.{method}
|
|
1825
|
+
*
|
|
1826
|
+
* * showDropdown(): Show dropdown
|
|
1827
|
+
* * closeDropdown(): Close dropdown
|
|
1828
|
+
* * onClear(): Clear selected value
|
|
1829
|
+
* * setPreviousValue(): Set value to previous value
|
|
1830
|
+
* * setValue(value): Set value of dropdown
|
|
1831
|
+
* * @param {value} - string || number || array
|
|
1832
1832
|
*/
|
|
1833
1833
|
};
|
|
1834
1834
|
export default Dropdown;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
-
import { ButtonIcon, InputBase, Label, Popover, PopoverBody
|
|
4
|
+
import { ButtonIcon, InputBase, Label, Popover, PopoverBody } from "../..";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState
|
|
6
|
+
import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react';
|
|
7
7
|
import { animation, borderColor, displayBlock, overflowHidden, parseHeight, parseMinWidth, positionRelative, scaleX } from "../../../styles/general";
|
|
8
8
|
import { useTheme } from "../../../theme";
|
|
9
9
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
10
10
|
import { classNames, getProp } from "../../../utils";
|
|
11
|
-
const regexBetween = /[^{}]+(?=})/g;
|
|
12
|
-
const regexInclude = /{|}/g;
|
|
13
11
|
const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
14
12
|
if (!reference) reference = useRef(null);
|
|
15
13
|
const theme = useTheme();
|
|
@@ -24,14 +22,10 @@ const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, referenc
|
|
|
24
22
|
});
|
|
25
23
|
const {
|
|
26
24
|
action = {},
|
|
27
|
-
allowInput,
|
|
28
25
|
bgColor: bgColorProp,
|
|
29
26
|
children,
|
|
30
27
|
className,
|
|
31
28
|
delayOnInput,
|
|
32
|
-
disabled,
|
|
33
|
-
displayExpr: displayExprProp,
|
|
34
|
-
error,
|
|
35
29
|
endIcon,
|
|
36
30
|
inputProps,
|
|
37
31
|
inputRef,
|
|
@@ -45,19 +39,10 @@ const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, referenc
|
|
|
45
39
|
placeholder,
|
|
46
40
|
startIcon,
|
|
47
41
|
style,
|
|
48
|
-
value
|
|
49
|
-
|
|
50
|
-
viewType,
|
|
51
|
-
helperTextProps
|
|
42
|
+
value,
|
|
43
|
+
viewType
|
|
52
44
|
} = props;
|
|
53
|
-
let displayExpr = displayExprProp;
|
|
54
45
|
const bgColor = typeof bgColorProp === 'string' ? getProp(colors, bgColorProp, bgColorProp) : bgColorProp;
|
|
55
|
-
const ErrorView = useMemo(() => {
|
|
56
|
-
return error ? jsx(HelperText, {
|
|
57
|
-
...helperTextProps,
|
|
58
|
-
disabled: disabled
|
|
59
|
-
}, error) : null;
|
|
60
|
-
}, [disabled, error, helperTextProps]);
|
|
61
46
|
const ref = useRef(null);
|
|
62
47
|
const dropdownBoxRef = useRef(null);
|
|
63
48
|
const timer = useRef(null);
|
|
@@ -100,28 +85,6 @@ const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, referenc
|
|
|
100
85
|
onClosed === null || onClosed === void 0 ? void 0 : onClosed();
|
|
101
86
|
}
|
|
102
87
|
};
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* 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
|
|
106
|
-
* @param data {object} rowData of dataSource
|
|
107
|
-
* @return {string}
|
|
108
|
-
*/
|
|
109
|
-
const displayValue = data => {
|
|
110
|
-
let text = '';
|
|
111
|
-
if (data || data === 0) {
|
|
112
|
-
displayExpr = displayExpr || valueExpr;
|
|
113
|
-
let mask = data === null || data === void 0 ? void 0 : data[displayExpr];
|
|
114
|
-
// convert {id} - {name} to {<data[id]>} - {<data[name]>}
|
|
115
|
-
if (!mask && regexBetween.test(displayExpr)) {
|
|
116
|
-
var _displayExpr;
|
|
117
|
-
mask = (_displayExpr = displayExpr) === null || _displayExpr === void 0 ? void 0 : _displayExpr.replace(regexBetween, _ => (data === null || data === void 0 ? void 0 : data[_]) || '');
|
|
118
|
-
} else if (!mask) {
|
|
119
|
-
mask = typeof data !== 'object' ? data : '';
|
|
120
|
-
}
|
|
121
|
-
text = mask.toString().replace(regexInclude, '');
|
|
122
|
-
}
|
|
123
|
-
return text;
|
|
124
|
-
};
|
|
125
88
|
useLayoutEffect(() => {
|
|
126
89
|
if (ref.current) {
|
|
127
90
|
const {
|
|
@@ -167,17 +130,15 @@ const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, referenc
|
|
|
167
130
|
onClick: openOnClickAt === 'icon' ? onTriggerDropdown : null
|
|
168
131
|
}) : null;
|
|
169
132
|
};
|
|
170
|
-
const value = displayValue(valueProps);
|
|
171
133
|
return jsx(Fragment, null, jsx("div", {
|
|
172
134
|
ref: ref,
|
|
173
135
|
css: _DropdownBoxRootCSS,
|
|
174
|
-
className: classNames('DGN-UI-Dropdown-Box', className
|
|
136
|
+
className: classNames('DGN-UI-Dropdown-Box', className),
|
|
175
137
|
style: style
|
|
176
138
|
}, label ? jsx(Label, {
|
|
177
139
|
...labelProps
|
|
178
140
|
}, label) : null, jsx(InputBase, {
|
|
179
141
|
...inputProps,
|
|
180
|
-
readOnly: !allowInput,
|
|
181
142
|
style: inputStyle,
|
|
182
143
|
viewType: viewType,
|
|
183
144
|
inputRef: inputRef,
|
|
@@ -196,7 +157,7 @@ const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, referenc
|
|
|
196
157
|
anchor: ref.current,
|
|
197
158
|
width: popoverWidth,
|
|
198
159
|
onClose: closeDropdownBox
|
|
199
|
-
}, jsx(PopoverBody, null, children))
|
|
160
|
+
}, jsx(PopoverBody, null, children)));
|
|
200
161
|
}));
|
|
201
162
|
const DropdownBoxRootCSS = (bgColorProp, {
|
|
202
163
|
colors
|
|
@@ -205,17 +166,6 @@ const DropdownBoxRootCSS = (bgColorProp, {
|
|
|
205
166
|
${positionRelative};
|
|
206
167
|
${parseMinWidth(150)};
|
|
207
168
|
${parseHeight('max-content')};
|
|
208
|
-
&.error {
|
|
209
|
-
.DGN-UI-InputBase {
|
|
210
|
-
${borderColor(getProp(colors, 'semantic/danger'))};
|
|
211
|
-
&::before {
|
|
212
|
-
${borderColor(getProp(colors, 'semantic/danger'))};
|
|
213
|
-
}
|
|
214
|
-
&::after {
|
|
215
|
-
${borderColor(getProp(colors, 'semantic/danger'))};
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
169
|
.DGN-UI-InputBase {
|
|
220
170
|
background: ${bgColorProp ? bgColorProp === true ? getProp(colors, 'fill/disabled') : bgColorProp : 'inherit'} !important;
|
|
221
171
|
${openState && css`
|
|
@@ -233,6 +183,20 @@ const DropdownBoxCSS = ({
|
|
|
233
183
|
margin-top: ${spacing([1])};
|
|
234
184
|
${overflowHidden};
|
|
235
185
|
`;
|
|
186
|
+
|
|
187
|
+
// DropdownBox.defaultProps = {
|
|
188
|
+
// className: '',
|
|
189
|
+
// label: '',
|
|
190
|
+
// placeholder: '',
|
|
191
|
+
// startIcon: 'Search',
|
|
192
|
+
// endIcon: 'ArrowDown',
|
|
193
|
+
// openOnClickAt: 'icon',
|
|
194
|
+
// viewType: 'underlined',
|
|
195
|
+
// inputProps: {},
|
|
196
|
+
// delayOnInput: 700,
|
|
197
|
+
// zIndex: zIndexCORE(1),
|
|
198
|
+
// };
|
|
199
|
+
|
|
236
200
|
DropdownBox.propTypes = {
|
|
237
201
|
/** class for dropdown */
|
|
238
202
|
className: PropTypes.string,
|
|
@@ -269,12 +233,6 @@ DropdownBox.propTypes = {
|
|
|
269
233
|
/** the function will run after open */
|
|
270
234
|
onOpened: PropTypes.func,
|
|
271
235
|
/** the function will run after close */
|
|
272
|
-
onClosed: PropTypes.func
|
|
273
|
-
/** Error message displayed below the input. */
|
|
274
|
-
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
275
|
-
/** If `true`, the component is disabled. */
|
|
276
|
-
disabled: PropTypes.bool,
|
|
277
|
-
/** If `true`, the input is enable. */
|
|
278
|
-
allowInput: PropTypes.bool
|
|
236
|
+
onClosed: PropTypes.func
|
|
279
237
|
};
|
|
280
238
|
export default DropdownBox;
|
|
@@ -49,7 +49,7 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
49
49
|
labelProps,
|
|
50
50
|
max: maxProp,
|
|
51
51
|
maxDigit,
|
|
52
|
-
min
|
|
52
|
+
min,
|
|
53
53
|
nonStyle,
|
|
54
54
|
onBlur,
|
|
55
55
|
onChange,
|
|
@@ -69,12 +69,9 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
69
69
|
viewType
|
|
70
70
|
} = props;
|
|
71
71
|
let max = maxProp;
|
|
72
|
-
let min = minProp;
|
|
73
72
|
let thousandSymbol = thousandSeparator;
|
|
74
73
|
let decimalSymbol = decimalSymbolProp;
|
|
75
74
|
let valueProps = valueProp;
|
|
76
|
-
if (!min && min !== 0) min = -Infinity;
|
|
77
|
-
if (!max && max !== 0) max = Infinity;
|
|
78
75
|
const pos = useRef(null);
|
|
79
76
|
const ref = useRef(null);
|
|
80
77
|
const globalRef = useRef({});
|
|
@@ -202,7 +202,7 @@ const Popover = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) =
|
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
204
|
const updatePositionPopover = (el = null, cb) => {
|
|
205
|
-
var _window, _window2, _anchor6, _anchorRect, _anchorRect2, _anchor7, _anchorRect3, _anchorRect4, _anchorRect5, _anchorRect6, _anchorRect7, _anchorRect8, _anchorRect9,
|
|
205
|
+
var _window, _window2, _anchor6, _anchorRect, _anchorRect2, _anchor7, _anchorRect3, _anchorRect4, _anchorRect5, _anchorRect6, _anchorRect7, _anchorRect8, _anchorRect9, _anchorRect10, _anchorRect11, _anchorRect12, _newDirectionObject, _newDirectionObject$t, _transformOrigin, _newDirectionObject2, _newDirectionObject2$, _transformOrigin2;
|
|
206
206
|
if (el instanceof Element) setElement(el);
|
|
207
207
|
if (!ref.current) {
|
|
208
208
|
window.removeEventListener('resize', updatePositionPopover);
|
|
@@ -336,36 +336,36 @@ const Popover = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) =
|
|
|
336
336
|
|
|
337
337
|
// Valid mean popover not at top-left, top-right, bottom-left, bottom-right
|
|
338
338
|
const validVerticalArrow = left >= ((_anchorRect5 = anchorRect) === null || _anchorRect5 === void 0 ? void 0 : _anchorRect5.left) + ((_anchorRect6 = anchorRect) === null || _anchorRect6 === void 0 ? void 0 : _anchorRect6.width) / 2 - popoverWidth && left <= ((_anchorRect7 = anchorRect) === null || _anchorRect7 === void 0 ? void 0 : _anchorRect7.right) - ((_anchorRect8 = anchorRect) === null || _anchorRect8 === void 0 ? void 0 : _anchorRect8.width) / 2 + popoverWidth;
|
|
339
|
-
const validHorizontalArrow = top >= ((_anchorRect9 = anchorRect) === null || _anchorRect9 === void 0 ? void 0 : _anchorRect9.top) + ((
|
|
339
|
+
const validHorizontalArrow = top >= ((_anchorRect9 = anchorRect) === null || _anchorRect9 === void 0 ? void 0 : _anchorRect9.top) + ((_anchorRect10 = anchorRect) === null || _anchorRect10 === void 0 ? void 0 : _anchorRect10.height) / 2 - popoverHeight && top <= ((_anchorRect11 = anchorRect) === null || _anchorRect11 === void 0 ? void 0 : _anchorRect11.bottom) - ((_anchorRect12 = anchorRect) === null || _anchorRect12 === void 0 ? void 0 : _anchorRect12.height) / 2;
|
|
340
340
|
|
|
341
341
|
// Get arrow's position
|
|
342
342
|
if (arrow && translate) {
|
|
343
343
|
switch (aPosition) {
|
|
344
344
|
case 'top':
|
|
345
345
|
if (validVerticalArrow) {
|
|
346
|
-
var
|
|
347
|
-
arrowPosition.left = ((
|
|
346
|
+
var _anchorRect13, _anchorRect14;
|
|
347
|
+
arrowPosition.left = ((_anchorRect13 = anchorRect) === null || _anchorRect13 === void 0 ? void 0 : _anchorRect13.width) / 2 + ((_anchorRect14 = anchorRect) === null || _anchorRect14 === void 0 ? void 0 : _anchorRect14.left) - arrowSize + 'px';
|
|
348
348
|
arrowPosition.top = Math.round(top) - arrowSize + 'px';
|
|
349
349
|
}
|
|
350
350
|
break;
|
|
351
351
|
case 'bottom':
|
|
352
352
|
if (validVerticalArrow) {
|
|
353
|
-
var
|
|
354
|
-
arrowPosition.left = ((
|
|
353
|
+
var _anchorRect15, _anchorRect16;
|
|
354
|
+
arrowPosition.left = ((_anchorRect15 = anchorRect) === null || _anchorRect15 === void 0 ? void 0 : _anchorRect15.width) / 2 + ((_anchorRect16 = anchorRect) === null || _anchorRect16 === void 0 ? void 0 : _anchorRect16.left) - arrowSize + 'px';
|
|
355
355
|
arrowPosition.top = Math.round(top) + popoverHeight + 'px';
|
|
356
356
|
}
|
|
357
357
|
break;
|
|
358
358
|
case 'left':
|
|
359
359
|
if (validHorizontalArrow) {
|
|
360
|
-
var
|
|
361
|
-
arrowPosition.top = ((
|
|
360
|
+
var _anchorRect17, _anchorRect18;
|
|
361
|
+
arrowPosition.top = ((_anchorRect17 = anchorRect) === null || _anchorRect17 === void 0 ? void 0 : _anchorRect17.height) / 2 + ((_anchorRect18 = anchorRect) === null || _anchorRect18 === void 0 ? void 0 : _anchorRect18.top) - arrowSize / 2 + 'px';
|
|
362
362
|
arrowPosition.left = Math.round(left) - 1.5 * arrowSize + 'px';
|
|
363
363
|
}
|
|
364
364
|
break;
|
|
365
365
|
case 'right':
|
|
366
366
|
if (validHorizontalArrow) {
|
|
367
|
-
var
|
|
368
|
-
arrowPosition.top = ((
|
|
367
|
+
var _anchorRect19, _anchorRect20;
|
|
368
|
+
arrowPosition.top = ((_anchorRect19 = anchorRect) === null || _anchorRect19 === void 0 ? void 0 : _anchorRect19.height) / 2 + ((_anchorRect20 = anchorRect) === null || _anchorRect20 === void 0 ? void 0 : _anchorRect20.top) - arrowSize / 2 + 'px';
|
|
369
369
|
arrowPosition.left = Math.round(left) + popoverWidth - arrowSize / 2 + 'px';
|
|
370
370
|
}
|
|
371
371
|
break;
|
|
@@ -495,15 +495,15 @@ const Popover = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) =
|
|
|
495
495
|
return currentRef;
|
|
496
496
|
});
|
|
497
497
|
const renderAnchor = () => {
|
|
498
|
-
var
|
|
499
|
-
if (!((
|
|
498
|
+
var _anchor10, _anchor11, _anchor11$props;
|
|
499
|
+
if (!((_anchor10 = anchor) !== null && _anchor10 !== void 0 && _anchor10.type)) return null;
|
|
500
500
|
const AnchorTag = /*#__PURE__*/React.cloneElement(anchor, {
|
|
501
501
|
ref: ref => {
|
|
502
502
|
anchor = ref;
|
|
503
503
|
},
|
|
504
504
|
style: {
|
|
505
505
|
cursor: 'pointer',
|
|
506
|
-
...(((
|
|
506
|
+
...(((_anchor11 = anchor) === null || _anchor11 === void 0 ? void 0 : (_anchor11$props = _anchor11.props) === null || _anchor11$props === void 0 ? void 0 : _anchor11$props.style) || {})
|
|
507
507
|
}
|
|
508
508
|
});
|
|
509
509
|
return AnchorTag;
|
|
@@ -950,9 +950,9 @@ TreeView.propTypes = {
|
|
|
950
950
|
disabledBoldResult: PropTypes.bool,
|
|
951
951
|
/** If `true`, disabled parent and children item (only supported for multipleValueMode is single). */
|
|
952
952
|
disabledRelevantValue: PropTypes.bool,
|
|
953
|
-
/** Field name used for text display in dropdown list.<br/>
|
|
954
|
-
* Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
955
|
-
* Note: don't use 'id - name', return undefined
|
|
953
|
+
/** Field name used for text display in dropdown list.<br/>
|
|
954
|
+
* Example: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
955
|
+
* Note: don't use 'id - name', return undefined
|
|
956
956
|
*/
|
|
957
957
|
displayExpr: PropTypes.string,
|
|
958
958
|
/** If `true`, expand immediate after render (shouldn't use this). */
|
|
@@ -963,14 +963,14 @@ TreeView.propTypes = {
|
|
|
963
963
|
multiple: PropTypes.bool,
|
|
964
964
|
/** Return value for the select multiple use case. */
|
|
965
965
|
multipleValueMode: PropTypes.oneOf(['single', 'multiple', 'inheritance']),
|
|
966
|
-
/**
|
|
967
|
-
* Callback fired when the value changes.<br />
|
|
968
|
-
* return 2 parameters (e, data)<br />
|
|
969
|
-
* * e: element (insist {value, justSelected, data})<br/>
|
|
970
|
-
* + value is one or an array of selected values<br />
|
|
971
|
-
* + justSelected is value has just been selected (either true or false))<br />
|
|
972
|
-
* + data is one or an array of selected values with full information<br />
|
|
973
|
-
* * data: array of selected values (not recommend because it's the same e.value)
|
|
966
|
+
/**
|
|
967
|
+
* Callback fired when the value changes.<br />
|
|
968
|
+
* return 2 parameters (e, data)<br />
|
|
969
|
+
* * e: element (insist {value, justSelected, data})<br/>
|
|
970
|
+
* + value is one or an array of selected values<br />
|
|
971
|
+
* + justSelected is value has just been selected (either true or false))<br />
|
|
972
|
+
* + data is one or an array of selected values with full information<br />
|
|
973
|
+
* * data: array of selected values (not recommend because it's the same e.value)
|
|
974
974
|
*/
|
|
975
975
|
onChange: PropTypes.func,
|
|
976
976
|
/** Used for mapping into a nested list. */
|
|
@@ -979,15 +979,15 @@ TreeView.propTypes = {
|
|
|
979
979
|
renderAsyncFromLevel: PropTypes.oneOf([2, 3, 4, 5]),
|
|
980
980
|
/** Will render asynchronously if the number of elements is greater than this number. */
|
|
981
981
|
renderAsyncWithLength: PropTypes.number,
|
|
982
|
-
/** Function displays items by custom.<br/>
|
|
983
|
-
* renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
|
|
984
|
-
* --> such as: displayExpr={'name - role'}
|
|
982
|
+
/** Function displays items by custom.<br/>
|
|
983
|
+
* renderItem={(data, index) => data.name + ' - ' + data.role}<br/>
|
|
984
|
+
* --> such as: displayExpr={'name - role'}
|
|
985
985
|
*/
|
|
986
986
|
renderItem: PropTypes.func,
|
|
987
|
-
/**
|
|
988
|
-
* Duration wait enter search content on search.<br/>
|
|
989
|
-
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
990
|
-
* If `true`, used default delayOnInput.
|
|
987
|
+
/**
|
|
988
|
+
* Duration wait enter search content on search.<br/>
|
|
989
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
990
|
+
* If `true`, used default delayOnInput.
|
|
991
991
|
*/
|
|
992
992
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
993
993
|
/** Specifies a comparison operation used to search items. */
|
|
@@ -1010,22 +1010,22 @@ TreeView.propTypes = {
|
|
|
1010
1010
|
value: PropTypes.oneOfType([PropTypes.array, PropTypes.string]),
|
|
1011
1011
|
/** The field name used for the returned result. */
|
|
1012
1012
|
valueExpr: PropTypes.string
|
|
1013
|
-
/**
|
|
1014
|
-
* get ref of TreeView component, insist:<br/>
|
|
1015
|
-
* {<br/>
|
|
1016
|
-
* disabled: true/false,<br/>
|
|
1017
|
-
* displayExpr: string,<br/>
|
|
1018
|
-
* valueExpr: string,<br/>
|
|
1019
|
-
* id: string,<br/>
|
|
1020
|
-
* parentID: string,<br/>
|
|
1021
|
-
* value: string/array<br/>
|
|
1022
|
-
* getValue: get selected values (instead of onChange function),<br/>
|
|
1023
|
-
* setValue: set array of value (only multiple),<br/>
|
|
1024
|
-
* handleCheckbox: checked/unchecked a Checkbox, includes 2 parameters (isChecked, value):<br/>
|
|
1025
|
-
* + isChecked: checked if true (default is false) <br/>
|
|
1026
|
-
* + value: selected values, use 'all' for all values (default is 'all') <br/>
|
|
1027
|
-
* get: get DOM of TreeView component<br/>
|
|
1028
|
-
* }
|
|
1013
|
+
/**
|
|
1014
|
+
* get ref of TreeView component, insist:<br/>
|
|
1015
|
+
* {<br/>
|
|
1016
|
+
* disabled: true/false,<br/>
|
|
1017
|
+
* displayExpr: string,<br/>
|
|
1018
|
+
* valueExpr: string,<br/>
|
|
1019
|
+
* id: string,<br/>
|
|
1020
|
+
* parentID: string,<br/>
|
|
1021
|
+
* value: string/array<br/>
|
|
1022
|
+
* getValue: get selected values (instead of onChange function),<br/>
|
|
1023
|
+
* setValue: set array of value (only multiple),<br/>
|
|
1024
|
+
* handleCheckbox: checked/unchecked a Checkbox, includes 2 parameters (isChecked, value):<br/>
|
|
1025
|
+
* + isChecked: checked if true (default is false) <br/>
|
|
1026
|
+
* + value: selected values, use 'all' for all values (default is 'all') <br/>
|
|
1027
|
+
* get: get DOM of TreeView component<br/>
|
|
1028
|
+
* }
|
|
1029
1029
|
*/
|
|
1030
1030
|
};
|
|
1031
1031
|
export default TreeView;
|
package/package.json
CHANGED
|
@@ -1,78 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "diginet-core-ui",
|
|
3
|
-
"version": "1.4.
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"scripts": {
|
|
8
|
-
"start": "
|
|
9
|
-
"start
|
|
10
|
-
"build
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"devDependencies": {
|
|
46
|
-
"@babel/cli": "^7.14.3",
|
|
47
|
-
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
|
48
|
-
"@babel/plugin-proposal-logical-assignment-operators": "^7.16.0",
|
|
49
|
-
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0",
|
|
50
|
-
"@babel/plugin-proposal-optional-chaining": "^7.14.2",
|
|
51
|
-
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
|
52
|
-
"@babel/plugin-proposal-private-property-in-object": "^7.18.6",
|
|
53
|
-
"@babel/preset-react": "^7.13.13",
|
|
54
|
-
"@storybook/addon-actions": "6.2.9",
|
|
55
|
-
"@storybook/addon-essentials": "6.2.9",
|
|
56
|
-
"@storybook/addon-links": "6.2.9",
|
|
57
|
-
"@storybook/addon-postcss": "^2.0.0",
|
|
58
|
-
"@storybook/react": "6.2.9",
|
|
59
|
-
"@storybook/test-runner": "^0.7.1",
|
|
60
|
-
"autoprefixer": "^10.3.1",
|
|
61
|
-
"babel-loader": "^8.2.2",
|
|
62
|
-
"eslint": "^8.4.1",
|
|
63
|
-
"eslint-plugin-react": "^7.27.1",
|
|
64
|
-
"eslint-plugin-regex": "^1.10.0",
|
|
65
|
-
"husky": "^7.0.4",
|
|
66
|
-
"jest": "^27.5.1",
|
|
67
|
-
"lint-staged": "^12.1.2",
|
|
68
|
-
"mkdirp": "^1.0.4",
|
|
69
|
-
"npm-run-all": "^4.1.5",
|
|
70
|
-
"onchange": "^7.1.0",
|
|
71
|
-
"postcss-flexbugs-fixes": "^5.0.2",
|
|
72
|
-
"react": "^17.0.1",
|
|
73
|
-
"react-dom": "^17.0.1",
|
|
74
|
-
"rimraf": "^3.0.2",
|
|
75
|
-
"run-script-os": "^1.1.6",
|
|
76
|
-
"sass": "1.58.3"
|
|
77
|
-
}
|
|
78
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "diginet-core-ui",
|
|
3
|
+
"version": "1.4.50",
|
|
4
|
+
"description": "The DigiNet core ui",
|
|
5
|
+
"homepage": "https://diginet.com.vn",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start-js": "react-scripts start --max_old_space_size=4096",
|
|
9
|
+
"start": "npx npm-run-all -p start-js",
|
|
10
|
+
"build": "GENERATE_SOURCEMAP=false && react-scripts build --env=production --max_old_space_size=8192",
|
|
11
|
+
"eject": "react-scripts eject",
|
|
12
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@emotion/core": "^10.0.35",
|
|
16
|
+
"prop-types": "^15.7.2",
|
|
17
|
+
"@emotion/css": "^11.11.0",
|
|
18
|
+
"@emotion/react": "^11.10.6"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://diginetvn@bitbucket.org/diginetvn/diginet-core-ui.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"core ui",
|
|
26
|
+
"diginet"
|
|
27
|
+
],
|
|
28
|
+
"author": "rocachien",
|
|
29
|
+
"contributors": [
|
|
30
|
+
{
|
|
31
|
+
"name": "Chien Do",
|
|
32
|
+
"email": "rocachien@gmail.com"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "Nhat Tran",
|
|
36
|
+
"email": "tranminhnhat1005@gmail.com"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "Thuan Nguyen",
|
|
40
|
+
"email": "nt.thuan.hutech@gmail.com"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"license": "MIT"
|
|
44
|
+
}
|
package/readme.md
CHANGED
|
@@ -42,6 +42,11 @@ npm test
|
|
|
42
42
|
|
|
43
43
|
## Changelog
|
|
44
44
|
|
|
45
|
+
## 1.4.50
|
|
46
|
+
- \[Added\]: Icon – Add IconMenu MHRP39N0025, MHRP39N0027, MHRP39N0028
|
|
47
|
+
- \[Added\]: Attachment – Add HEIF support to getFileType in Attachment
|
|
48
|
+
- \[Fixed\]: Dropdown – Dropdown Treeview keep the search input fixed while scrolling through the list
|
|
49
|
+
|
|
45
50
|
## 1.4.49
|
|
46
51
|
- \[Added\]: Icon – Add Icon Fire
|
|
47
52
|
- \[Added\]: Dropdown – Add allowInput to the multiple-select dropdown.
|