diginet-core-ui 1.4.49 → 1.4.50-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/MHRP39N0025.svg +9 -0
- package/assets/images/menu/dhr/MHRP39N0027.svg +18 -0
- package/assets/images/menu/dhr/MHRP39N0028.svg +18 -0
- 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 +56 -47
- package/components/form-control/dropdown-box/index.js +63 -21
- package/components/form-control/number-input/index2.js +4 -1
- package/components/popover/index.js +13 -13
- package/components/tree-view/index.js +15 -1
- package/package.json +78 -44
- package/readme.md +5 -0
- package/utils/getFileType.js +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M31 2H26V4H31C32.1 4 33 4.9 33 6V35C33 36.1 32.1 37 31 37H8C6.9 37 6 36.1 6 35V6C6 4.9 6.9 4 8 4H13V2H8C5.8 2 4 3.8 4 6V35C4 37.2 5.8 39 8 39H31C33.2 39 35 37.2 35 35V6C35 3.8 33.2 2 31 2Z" fill="#2680EB"/>
|
|
3
|
+
<path d="M26 0H13C11.9 0 11 0.9 11 2V4C11 5.1 11.9 6 13 6H26C27.1 6 28 5.1 28 4V2C28 0.9 27.1 0 26 0ZM13 4V2H26V4H13Z" fill="#2680EB"/>
|
|
4
|
+
<path d="M10.5999 33.1C10.5999 32.8 10.7999 32.4 10.9999 32C11.7999 30.2 13.1999 29 14.9999 28.2C16.8999 27.4 18.8999 27.1 21.0999 27.4C22.6999 27.6 24.1999 28.1 25.4999 29C27.0999 30.1 28.0999 31.4 28.4999 33.2C28.4999 33.2 28.4999 33.3 28.4999 33.4C28.4999 33.5 28.4999 33.7 28.4999 33.9C28.2999 34.5 27.8999 34.9 27.1999 35.1C27.5999 35.1 24.7999 35.1 23.0999 35.1C18.9999 35 11.3999 35 11.7999 35C11.4999 34.9 11.0999 34.8 10.8999 34.5C10.7999 34.3 10.6999 34.2 10.5999 34C10.4999 33.8 10.4999 33.4 10.5999 33.1Z" fill="#2680EB"/>
|
|
5
|
+
<path d="M19.9999 17C20.1999 17 20.4999 17.1 20.6999 17.1C22.4999 17.6 23.5999 18.8 23.7999 20.6C23.9999 22.4 23.3999 23.9 21.9999 25C20.3999 26.3 18.3999 26.2 16.7999 24.9C15.7999 24.1 15.2999 23 15.0999 21.8C14.9999 20.7 15.0999 19.8 15.6999 18.8C16.3999 17.8 17.3999 17.2 18.5999 17C19.3999 17 19.8999 17 19.9999 17Z" fill="#2680EB"/>
|
|
6
|
+
<path d="M19.6998 7.09999L20.9998 9.79999L23.9998 10.2C24.1998 10.2 24.2998 10.5 24.0998 10.6L21.9998 12.8L22.4998 15.7C22.4998 15.9 22.2998 16.1 22.0998 16L19.4998 14.6L16.8998 16C16.6998 16.1 16.4998 15.9 16.4998 15.7L16.9998 12.8L14.8998 10.7C14.6998 10.6 14.7998 10.3 14.9998 10.3L17.9998 9.89999L19.2998 7.19999C19.3998 6.99999 19.5998 6.99999 19.6998 7.09999Z" fill="#FF8C00"/>
|
|
7
|
+
<path d="M27.6998 10.4L28.6998 12.4L30.8998 12.7C31.0998 12.7 31.0998 12.9 30.9998 13L29.3998 14.5L29.7998 16.7C29.7998 16.9 29.6998 17 29.4998 16.9L27.4998 15.9L25.4998 16.9C25.3998 17 25.1998 16.9 25.1998 16.7L25.5998 14.5L23.9998 13C23.8998 12.9 23.8998 12.7 24.0998 12.7L26.2998 12.4L27.2998 10.4C27.3998 10.3 27.5998 10.3 27.6998 10.4Z" fill="#FF8C00"/>
|
|
8
|
+
<path d="M11.6998 10.4L12.6998 12.4L14.8998 12.7C15.0998 12.7 15.0998 12.9 14.9998 13L13.3998 14.5L13.7998 16.7C13.7998 16.9 13.6998 17 13.4998 16.9L11.4998 15.9L9.49977 16.9C9.39977 17 9.19977 16.9 9.19977 16.7L9.59977 14.5L7.99977 13C7.89977 12.9 7.89977 12.7 8.09977 12.7L10.2998 12.4L11.2998 10.4C11.3998 10.3 11.5998 10.3 11.6998 10.4Z" fill="#FF8C00"/>
|
|
9
|
+
</svg>
|
|
@@ -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_2247_88)">
|
|
3
|
+
<path d="M22 27.3C22 26.7 21.5 26.2 20.9 26.2H7.1C6.5 26.2 6 26.7 6 27.3C6 27.9 6.5 28.4 7.1 28.4H20.8C21.5 28.4 22 27.9 22 27.3Z" fill="#2680EB"/>
|
|
4
|
+
<path d="M20.9 21.6H7.1C6.5 21.6 6 22.1 6 22.7C6 23.3 6.5 23.8 7.1 23.8H20.8C21.4 23.8 21.9 23.3 21.9 22.7C21.9 22.1 21.5 21.6 20.9 21.6Z" fill="#2680EB"/>
|
|
5
|
+
<path d="M7.1 30.8C6.5 30.8 6 31.2 6 31.8C6 32.4 6.5 33 7.1 33H16.2C16.8 33 17.3 32.5 17.3 31.9C17.3 31.3 16.8 30.8 16.2 30.8H7.1Z" fill="#2680EB"/>
|
|
6
|
+
<path d="M28 2H25C25 0.9 24.1 0 23 0H10C8.9 0 8 0.9 8 2H5C2.8 2 1 3.8 1 6V35C1 37.2 2.8 39 5 39H25.5C24.4 38.4 23.3 37.8 22.3 37H5C3.9 37 3 36.1 3 35V6C3 4.9 3.9 4 5 4H8C8 5.1 8.9 6 10 6H23C24.1 6 25 5.1 25 4H28C29.1 4 30 4.9 30 6V13.8C30.7 13.8 31.3 13.9 32 14.1V6C32 3.8 30.2 2 28 2ZM10 4V2H23V4H10Z" fill="#2680EB"/>
|
|
7
|
+
<path d="M30 26.9C26.8 26.9 24.2 24.2 24.2 21C24.2 17.7 26.8 15.1 30.1 15.1C33.3 15.1 35.9 17.8 35.9 21.1C35.8 24.2 33.2 26.9 30 26.9Z" fill="#2680EB"/>
|
|
8
|
+
<path d="M37.3 30.9C37.1 29.9 36.6 29.2 35.6 28.8C33.8 28.1 32.6 27.4 32.6 27.4L31.2 31.9L31 32.5L30.4 30.7C31.9 28.7 30.3 28.6 30 28.6C29.7 28.6 28.1 28.7 29.6 30.7L29 32.5L28.8 31.9L27.4 27.4C27.4 27.4 26.3 28.1 24.4 28.8C23.5 29.1 23.1 29.6 22.8 30.3L22.4 32.1C22.3 32.6 22.2 33.1 22.1 33.6C21.9 34.5 22.2 35.3 23 35.9C24.3 36.9 25.8 37.8 27.4 38.4C28.8 39 30.3 39.2 31.8 38.8C33.8 38.2 35.6 37.2 37.3 35.9C38 35.4 38.2 34.5 38.1 33.6C38 33 37.4 31.2 37.3 30.9Z" fill="#2680EB"/>
|
|
9
|
+
<path d="M16.6998 8.09999L17.9998 10.8L20.9998 11.2C21.1998 11.2 21.2998 11.5 21.0998 11.6L18.9998 13.8L19.4998 16.7C19.4998 16.9 19.2998 17.1 19.0998 17L16.4998 15.6L13.8998 17C13.6998 17.1 13.4998 16.9 13.4998 16.7L13.9998 13.8L11.8998 11.7C11.6998 11.6 11.7998 11.3 11.9998 11.3L14.9998 10.9L16.2998 8.19999C16.3998 7.99999 16.5998 7.99999 16.6998 8.09999Z" fill="#FF8C00"/>
|
|
10
|
+
<path d="M8.69977 11.4L9.69977 13.4L11.8998 13.7C12.0998 13.7 12.0998 13.9 11.9998 14L10.3998 15.5L10.7998 17.7C10.7998 17.9 10.6998 18 10.4998 17.9L8.49977 16.9L6.49977 17.9C6.39977 18 6.19977 17.9 6.19977 17.7L6.59977 15.5L4.99977 14C4.89977 13.9 4.89977 13.7 5.09977 13.7L7.29977 13.4L8.29977 11.4C8.39977 11.3 8.59977 11.3 8.69977 11.4Z" fill="#FF8C00"/>
|
|
11
|
+
<path d="M27.8998 14C27.8998 14.1 27.8998 14.1 27.8998 14C26.0998 14.6 24.6998 15.8 23.7998 17.3L22.4998 18C22.3998 18.1 22.1998 18 22.1998 17.8L22.5998 15.6L21.0998 14C20.9998 13.9 21.0998 13.7 21.1998 13.7L23.3998 13.4L24.3998 11.4C24.4998 11.3 24.6998 11.3 24.6998 11.4L25.6998 13.4L27.8998 13.7C27.9998 13.8 27.9998 13.9 27.8998 14Z" fill="#FF8C00"/>
|
|
12
|
+
</g>
|
|
13
|
+
<defs>
|
|
14
|
+
<clipPath id="clip0_2247_88">
|
|
15
|
+
<rect width="39" height="39" fill="white"/>
|
|
16
|
+
</clipPath>
|
|
17
|
+
</defs>
|
|
18
|
+
</svg>
|
|
@@ -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_2247_110)">
|
|
3
|
+
<path d="M27 2H22V4H27C28.1 4 29 4.9 29 6V18C29.7 18 30.3 18.1 31 18.2V6C31 3.8 29.2 2 27 2ZM4 37C2.9 37 2 36.1 2 35V6C2 4.9 2.9 4 4 4H9V2H4C1.8 2 0 3.8 0 6V35C0 37.2 1.8 39 4 39H24.4C23.3 38.5 22.3 37.8 21.4 37H4Z" fill="#2680EB"/>
|
|
4
|
+
<path d="M22 0H9C7.9 0 7 0.9 7 2V4C7 5.1 7.9 6 9 6H22C23.1 6 24 5.1 24 4V2C24 0.9 23.1 0 22 0ZM9 4V2H22V4H9Z" fill="#2680EB"/>
|
|
5
|
+
<path d="M18.4 26.2C18.2 26.9 18.1 27.5999 18 28.3999H6.2C5.6 28.3999 5 27.8999 5 27.2999C5 26.6999 5.5 26.2 6.2 26.2L18.4 26.2Z" fill="#2680EB"/>
|
|
6
|
+
<path d="M20.6 21.9C20.1 22.5 19.6 23.2 19.3 23.9H6.2C5.6 23.9 5 23.3999 5 22.7999C5 22.1999 5.5 21.7 6.2 21.7H19.9C20.0625 21.7 20.4 21.7 20.6 21.9Z" fill="#2680EB"/>
|
|
7
|
+
<path d="M6.1 30.7999C5.5 30.7999 5 31.1999 5 31.7999C5 32.3999 5.5 33 6.1 33H15.2C15.8 33 16.3 32.5 16.3 31.9C16.3 31.3 15.8 30.7999 15.2 30.7999H6.1Z" fill="#2680EB"/>
|
|
8
|
+
<path d="M34.4 20.6C32.8 19.6 31 19 29 19C28.5 19 28.1 19 27.7 19.1C26.9 19.2 26 19.4 25.3 19.7C24.9 19.9 24.4 20.1 24 20.3C22 21.4 20.5 23.2 19.7 25.3C19.2 26.5 19 27.7 19 29C19 34.5 23.5 39 29 39C34.5 39 39 34.5 39 29C39 25.5 37.1 22.3 34.4 20.6ZM35.2 25.8L29.3 33.8C29 34.3 28.4 34.6 27.8 34.6H27.7C27.2 34.6 26.6 34.4 26.3 34L22.8 30.2C22.3 29.6 22.3 28.7 22.9 28.1C23.2 27.8 23.5 27.7 23.9 27.7C24.3 27.7 24.7 27.9 25 28.2L27.5 30.9L27.6 31C27.7 31 27.7 31 27.7 30.9L32.7 24.1C33 23.7 33.4 23.5 33.9 23.5C34.2 23.5 34.5 23.6 34.8 23.8C35.6 24.2 35.7 25.1 35.2 25.8Z" fill="#1CA261"/>
|
|
9
|
+
<path d="M15.6998 8.09999L16.9998 10.8L19.9998 11.2C20.1998 11.2 20.2998 11.5 20.0998 11.6L17.9998 13.8L18.4998 16.7C18.4998 16.9 18.2998 17.1 18.0998 17L15.4998 15.6L12.8998 17C12.6998 17.1 12.4998 16.9 12.4998 16.7L12.9998 13.8L10.8998 11.7C10.6998 11.6 10.7998 11.3 10.9998 11.3L13.9998 10.9L15.2998 8.19999C15.3998 7.99999 15.5998 7.99999 15.6998 8.09999Z" fill="#FF8C00"/>
|
|
10
|
+
<path d="M23.6998 11.4L24.6998 13.4L26.8998 13.7C27.0998 13.7 27.0998 13.9 26.9998 14L25.3998 15.5L25.7998 17.7C25.7998 17.9 25.6998 18 25.4998 17.9L23.4998 16.9L21.4998 17.9C21.3998 18 21.1998 17.9 21.1998 17.7L21.5998 15.5L19.9998 14C19.8998 13.9 19.8998 13.7 20.0998 13.7L22.2998 13.4L23.2998 11.4C23.3998 11.3 23.5998 11.3 23.6998 11.4Z" fill="#FF8C00"/>
|
|
11
|
+
<path d="M7.69977 11.4L8.69977 13.4L10.8998 13.7C11.0998 13.7 11.0998 13.9 10.9998 14L9.39977 15.5L9.79977 17.7C9.79977 17.9 9.69977 18 9.49977 17.9L7.49977 16.9L5.49977 17.9C5.39977 18 5.19977 17.9 5.19977 17.7L5.59977 15.5L3.99977 14C3.89977 13.9 3.89977 13.7 4.09977 13.7L6.29977 13.4L7.29977 11.4C7.39977 11.3 7.59977 11.3 7.69977 11.4Z" fill="#FF8C00"/>
|
|
12
|
+
</g>
|
|
13
|
+
<defs>
|
|
14
|
+
<clipPath id="clip0_2247_110">
|
|
15
|
+
<rect width="39" height="39" fill="white"/>
|
|
16
|
+
</clipPath>
|
|
17
|
+
</defs>
|
|
18
|
+
</svg>
|
|
@@ -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: ['sentence']
|
|
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) && !value) {
|
|
230
230
|
if (isBeforeLimit(min, defaultValue)) {
|
|
231
231
|
onUpdate(min);
|
|
232
232
|
} else if (isAfterLimit(max, defaultValue)) {
|
|
@@ -7,7 +7,7 @@ import { getGlobal } from "../../../global";
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
9
9
|
import ReactDOM from 'react-dom';
|
|
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,
|
|
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";
|
|
12
12
|
import useThemeProps from "../../../theme/utils/useThemeProps";
|
|
13
13
|
import { classNames, getProp, isMobile, randomString } from "../../../utils";
|
|
@@ -135,6 +135,7 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
135
135
|
skip: skip || 0,
|
|
136
136
|
limit: limit || 50
|
|
137
137
|
});
|
|
138
|
+
const txtSearchRef = useRef(false);
|
|
138
139
|
const [unique] = useState(randomString(6, {
|
|
139
140
|
allowNumber: false,
|
|
140
141
|
allowSymbol: false
|
|
@@ -170,7 +171,7 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
170
171
|
const _IconCSS = IconCSS(viewType, theme);
|
|
171
172
|
const _DropdownFormCSS = viewType === 'outlined' ? DropdownFormOutlinedCSS(disabled, readOnly, placeholder, theme) : DropdownFormCSS(viewType, multiple, disabled, readOnly, placeholder, _DropdownInputCSS.name, theme);
|
|
172
173
|
const _DropdownListCSS = DropdownListCSS(theme);
|
|
173
|
-
const _DropdownBoxCSS = DropdownBoxCSS(loadingState, theme);
|
|
174
|
+
const _DropdownBoxCSS = DropdownBoxCSS(loadingState, theme, itemMode);
|
|
174
175
|
const _DropdownItemCSS = DropdownItemCSS(multiple, selectBox, theme);
|
|
175
176
|
const _DropdownRootCSS = DropdownRootCSS(_DropdownFormCSS.name, _DropdownInputCSS.name, theme);
|
|
176
177
|
const _CheckBoxCSS = CheckBoxCSS(theme);
|
|
@@ -286,10 +287,10 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
286
287
|
});
|
|
287
288
|
};
|
|
288
289
|
|
|
289
|
-
/**
|
|
290
|
-
* So sánh text đầu vào cáo map với txtSearch
|
|
291
|
-
* @param text
|
|
292
|
-
* @return {boolean}
|
|
290
|
+
/**
|
|
291
|
+
* So sánh text đầu vào cáo map với txtSearch
|
|
292
|
+
* @param text
|
|
293
|
+
* @return {boolean}
|
|
293
294
|
*/
|
|
294
295
|
const handleRenderBySearch = (text = '') => {
|
|
295
296
|
if (typeof text !== 'string') text = text.toString();
|
|
@@ -301,10 +302,10 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
301
302
|
} else return text.toLowerCase().includes(txtSearch.toLowerCase());
|
|
302
303
|
};
|
|
303
304
|
|
|
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}
|
|
305
|
+
/**
|
|
306
|
+
* 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
|
|
307
|
+
* @param data {object} rowData of dataSource
|
|
308
|
+
* @return {string}
|
|
308
309
|
*/
|
|
309
310
|
const displayValue = data => {
|
|
310
311
|
let text = '';
|
|
@@ -674,6 +675,7 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
674
675
|
var _e$target$value;
|
|
675
676
|
if (!dropdownRef.current) return; // Kiểm tra nếu dropdown đóng trước searchDelayTime thì không chạy
|
|
676
677
|
setTxtSearch((_e$target$value = e.target.value) !== null && _e$target$value !== void 0 ? _e$target$value : '');
|
|
678
|
+
txtSearchRef.current = !!e.target.value;
|
|
677
679
|
if (onInput) {
|
|
678
680
|
onInput(e);
|
|
679
681
|
}
|
|
@@ -938,6 +940,13 @@ const Dropdown = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference)
|
|
|
938
940
|
return () => {
|
|
939
941
|
allValue[unique] = null;
|
|
940
942
|
closeDropdown(null, 'cleanup');
|
|
943
|
+
if (onInput && txtSearchRef.current) {
|
|
944
|
+
onInput({
|
|
945
|
+
target: {
|
|
946
|
+
value: ''
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
}
|
|
941
950
|
};
|
|
942
951
|
}, []);
|
|
943
952
|
useEffect(() => {
|
|
@@ -1554,8 +1563,8 @@ const DropdownListCSS = ({
|
|
|
1554
1563
|
`;
|
|
1555
1564
|
const DropdownBoxCSS = (loading, {
|
|
1556
1565
|
colors
|
|
1557
|
-
}) => css`
|
|
1558
|
-
${loading ? overflowHidden :
|
|
1566
|
+
}, itemMode) => css`
|
|
1567
|
+
${loading || itemMode === 'treeview' ? overflowHidden : overflowYScroll};
|
|
1559
1568
|
${parseMaxHeight(280)};
|
|
1560
1569
|
&::-webkit-scrollbar {
|
|
1561
1570
|
${borderRadius(4)};
|
|
@@ -1709,9 +1718,9 @@ Dropdown.propTypes = {
|
|
|
1709
1718
|
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1710
1719
|
/** If `true`, the component is disabled. */
|
|
1711
1720
|
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.
|
|
1721
|
+
/** The field name used for displaying text in the dropdown list.<br/>
|
|
1722
|
+
* Examples: 'name', '{id} - {name}', '{age} age(s)'<br/>
|
|
1723
|
+
* Note: Do not use 'id - name', as it will return undefined.
|
|
1715
1724
|
*/
|
|
1716
1725
|
displayExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.array]),
|
|
1717
1726
|
/** Inline style for dropdown items. */
|
|
@@ -1720,14 +1729,14 @@ Dropdown.propTypes = {
|
|
|
1720
1729
|
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
1721
1730
|
/** Props applied to the [HelperText](https://core.diginet.com.vn/ui/?path=/story/form-control-text-helpertext) element. */
|
|
1722
1731
|
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
|
-
* }
|
|
1732
|
+
/** The field name used for displaying icons.<br/>
|
|
1733
|
+
* Example:<br/>
|
|
1734
|
+
* string: 'icon'<br/>
|
|
1735
|
+
* object: {<br/>
|
|
1736
|
+
* key: 'icon',<br/>
|
|
1737
|
+
* prefix: 'https://imglink.com',<br/>
|
|
1738
|
+
* suffix: '.jpg'<br/>
|
|
1739
|
+
* }
|
|
1731
1740
|
*/
|
|
1732
1741
|
iconExpr: PropTypes.oneOfType([PropTypes.string, PropTypes.shape({
|
|
1733
1742
|
key: PropTypes.string,
|
|
@@ -1761,8 +1770,8 @@ Dropdown.propTypes = {
|
|
|
1761
1770
|
onChange: PropTypes.func,
|
|
1762
1771
|
/** Callback function fired when the dropdown is closed. */
|
|
1763
1772
|
onClosed: PropTypes.func,
|
|
1764
|
-
/** Callback function fired when the input value changes.<br/>
|
|
1765
|
-
* If undefined, the filter function will run (default behavior).
|
|
1773
|
+
/** Callback function fired when the input value changes.<br/>
|
|
1774
|
+
* If undefined, the filter function will run (default behavior).
|
|
1766
1775
|
*/
|
|
1767
1776
|
onInput: PropTypes.func,
|
|
1768
1777
|
/** Callback function fired when a key is pressed down in the input. */
|
|
@@ -1775,21 +1784,21 @@ Dropdown.propTypes = {
|
|
|
1775
1784
|
placeholder: PropTypes.string,
|
|
1776
1785
|
/** If `true`, the component is read-only. */
|
|
1777
1786
|
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`
|
|
1787
|
+
/** Function used for custom rendering of items.<br/>
|
|
1788
|
+
* Example: `(data, index) => data.name + ' - ' + data.role`<br/>
|
|
1789
|
+
* This can be used as an alternative to `displayExpr`
|
|
1781
1790
|
*/
|
|
1782
1791
|
renderItem: PropTypes.func,
|
|
1783
|
-
/** Function or field name used to display selected items.<br/>
|
|
1784
|
-
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1792
|
+
/** Function or field name used to display selected items.<br/>
|
|
1793
|
+
* Example: `(data, index) => index + ' - ' + data.name`<br/>
|
|
1785
1794
|
*/
|
|
1786
1795
|
renderSelectedItem: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1787
1796
|
/** If `true`, the label will indicate that the input is required. */
|
|
1788
1797
|
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.
|
|
1798
|
+
/**
|
|
1799
|
+
* Duration to wait after entering search content before triggering a search.<br/>
|
|
1800
|
+
* Example: 700 -> 700ms, '700ms' -> 700ms, '0.7s' -> 700ms, '1m' -> 60000ms
|
|
1801
|
+
* If `true`, the default delayOnInput will be used.
|
|
1793
1802
|
*/
|
|
1794
1803
|
searchDelayTime: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]),
|
|
1795
1804
|
/** Specifies the field name or expression used to compare values with the search string. */
|
|
@@ -1816,19 +1825,19 @@ Dropdown.propTypes = {
|
|
|
1816
1825
|
valueObjectDefault: PropTypes.oneOfType([PropTypes.object, PropTypes.array]),
|
|
1817
1826
|
/** The variant to use. */
|
|
1818
1827
|
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
|
|
1828
|
+
/**
|
|
1829
|
+
* ref methods
|
|
1830
|
+
*
|
|
1831
|
+
* how to get component element? ref.current
|
|
1832
|
+
*
|
|
1833
|
+
* how to call method? ref.current.instance.{method}
|
|
1834
|
+
*
|
|
1835
|
+
* * showDropdown(): Show dropdown
|
|
1836
|
+
* * closeDropdown(): Close dropdown
|
|
1837
|
+
* * onClear(): Clear selected value
|
|
1838
|
+
* * setPreviousValue(): Set value to previous value
|
|
1839
|
+
* * setValue(value): Set value of dropdown
|
|
1840
|
+
* * @param {value} - string || number || array
|
|
1832
1841
|
*/
|
|
1833
1842
|
};
|
|
1834
1843
|
export default Dropdown;
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
-
import { ButtonIcon, InputBase, Label, Popover, PopoverBody } from "../..";
|
|
4
|
+
import { ButtonIcon, InputBase, Label, Popover, PopoverBody, HelperText } from "../..";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from 'react';
|
|
6
|
+
import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState, useMemo } 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;
|
|
11
13
|
const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, reference) => {
|
|
12
14
|
if (!reference) reference = useRef(null);
|
|
13
15
|
const theme = useTheme();
|
|
@@ -22,10 +24,14 @@ const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, referenc
|
|
|
22
24
|
});
|
|
23
25
|
const {
|
|
24
26
|
action = {},
|
|
27
|
+
allowInput,
|
|
25
28
|
bgColor: bgColorProp,
|
|
26
29
|
children,
|
|
27
30
|
className,
|
|
28
31
|
delayOnInput,
|
|
32
|
+
disabled,
|
|
33
|
+
displayExpr: displayExprProp,
|
|
34
|
+
error,
|
|
29
35
|
endIcon,
|
|
30
36
|
inputProps,
|
|
31
37
|
inputRef,
|
|
@@ -39,10 +45,19 @@ const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, referenc
|
|
|
39
45
|
placeholder,
|
|
40
46
|
startIcon,
|
|
41
47
|
style,
|
|
42
|
-
value,
|
|
43
|
-
|
|
48
|
+
value: valueProps,
|
|
49
|
+
valueExpr,
|
|
50
|
+
viewType,
|
|
51
|
+
helperTextProps
|
|
44
52
|
} = props;
|
|
53
|
+
let displayExpr = displayExprProp;
|
|
45
54
|
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]);
|
|
46
61
|
const ref = useRef(null);
|
|
47
62
|
const dropdownBoxRef = useRef(null);
|
|
48
63
|
const timer = useRef(null);
|
|
@@ -85,6 +100,28 @@ const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, referenc
|
|
|
85
100
|
onClosed === null || onClosed === void 0 ? void 0 : onClosed();
|
|
86
101
|
}
|
|
87
102
|
};
|
|
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
|
+
};
|
|
88
125
|
useLayoutEffect(() => {
|
|
89
126
|
if (ref.current) {
|
|
90
127
|
const {
|
|
@@ -130,15 +167,17 @@ const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, referenc
|
|
|
130
167
|
onClick: openOnClickAt === 'icon' ? onTriggerDropdown : null
|
|
131
168
|
}) : null;
|
|
132
169
|
};
|
|
170
|
+
const value = displayValue(valueProps);
|
|
133
171
|
return jsx(Fragment, null, jsx("div", {
|
|
134
172
|
ref: ref,
|
|
135
173
|
css: _DropdownBoxRootCSS,
|
|
136
|
-
className: classNames('DGN-UI-Dropdown-Box', className),
|
|
174
|
+
className: classNames('DGN-UI-Dropdown-Box', className, error && 'error'),
|
|
137
175
|
style: style
|
|
138
176
|
}, label ? jsx(Label, {
|
|
139
177
|
...labelProps
|
|
140
178
|
}, label) : null, jsx(InputBase, {
|
|
141
179
|
...inputProps,
|
|
180
|
+
readOnly: !allowInput,
|
|
142
181
|
style: inputStyle,
|
|
143
182
|
viewType: viewType,
|
|
144
183
|
inputRef: inputRef,
|
|
@@ -157,7 +196,7 @@ const DropdownBox = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((inProps, referenc
|
|
|
157
196
|
anchor: ref.current,
|
|
158
197
|
width: popoverWidth,
|
|
159
198
|
onClose: closeDropdownBox
|
|
160
|
-
}, jsx(PopoverBody, null, children)));
|
|
199
|
+
}, jsx(PopoverBody, null, children)), ErrorView);
|
|
161
200
|
}));
|
|
162
201
|
const DropdownBoxRootCSS = (bgColorProp, {
|
|
163
202
|
colors
|
|
@@ -166,6 +205,17 @@ const DropdownBoxRootCSS = (bgColorProp, {
|
|
|
166
205
|
${positionRelative};
|
|
167
206
|
${parseMinWidth(150)};
|
|
168
207
|
${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
|
+
}
|
|
169
219
|
.DGN-UI-InputBase {
|
|
170
220
|
background: ${bgColorProp ? bgColorProp === true ? getProp(colors, 'fill/disabled') : bgColorProp : 'inherit'} !important;
|
|
171
221
|
${openState && css`
|
|
@@ -183,20 +233,6 @@ const DropdownBoxCSS = ({
|
|
|
183
233
|
margin-top: ${spacing([1])};
|
|
184
234
|
${overflowHidden};
|
|
185
235
|
`;
|
|
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
|
-
|
|
200
236
|
DropdownBox.propTypes = {
|
|
201
237
|
/** class for dropdown */
|
|
202
238
|
className: PropTypes.string,
|
|
@@ -233,6 +269,12 @@ DropdownBox.propTypes = {
|
|
|
233
269
|
/** the function will run after open */
|
|
234
270
|
onOpened: PropTypes.func,
|
|
235
271
|
/** the function will run after close */
|
|
236
|
-
onClosed: PropTypes.func
|
|
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
|
|
237
279
|
};
|
|
238
280
|
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: minProp,
|
|
53
53
|
nonStyle,
|
|
54
54
|
onBlur,
|
|
55
55
|
onChange,
|
|
@@ -69,9 +69,12 @@ const NumberInput = /*#__PURE__*/forwardRef((inProps, reference) => {
|
|
|
69
69
|
viewType
|
|
70
70
|
} = props;
|
|
71
71
|
let max = maxProp;
|
|
72
|
+
let min = minProp;
|
|
72
73
|
let thousandSymbol = thousandSeparator;
|
|
73
74
|
let decimalSymbol = decimalSymbolProp;
|
|
74
75
|
let valueProps = valueProp;
|
|
76
|
+
if (!min && min !== 0) min = -Infinity;
|
|
77
|
+
if (!max && max !== 0) max = Infinity;
|
|
75
78
|
const pos = useRef(null);
|
|
76
79
|
const ref = useRef(null);
|
|
77
80
|
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, _anchorRect0, _anchorRect1, _anchorRect10, _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) + ((_anchorRect0 = anchorRect) === null || _anchorRect0 === void 0 ? void 0 : _anchorRect0.height) / 2 - popoverHeight && top <= ((_anchorRect1 = anchorRect) === null || _anchorRect1 === void 0 ? void 0 : _anchorRect1.bottom) - ((_anchorRect10 = anchorRect) === null || _anchorRect10 === void 0 ? void 0 : _anchorRect10.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 _anchorRect11, _anchorRect12;
|
|
347
|
+
arrowPosition.left = ((_anchorRect11 = anchorRect) === null || _anchorRect11 === void 0 ? void 0 : _anchorRect11.width) / 2 + ((_anchorRect12 = anchorRect) === null || _anchorRect12 === void 0 ? void 0 : _anchorRect12.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 _anchorRect13, _anchorRect14;
|
|
354
|
+
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';
|
|
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 _anchorRect15, _anchorRect16;
|
|
361
|
+
arrowPosition.top = ((_anchorRect15 = anchorRect) === null || _anchorRect15 === void 0 ? void 0 : _anchorRect15.height) / 2 + ((_anchorRect16 = anchorRect) === null || _anchorRect16 === void 0 ? void 0 : _anchorRect16.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 _anchorRect17, _anchorRect18;
|
|
368
|
+
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';
|
|
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 _anchor0, _anchor1, _anchor1$props;
|
|
499
|
+
if (!((_anchor0 = anchor) !== null && _anchor0 !== void 0 && _anchor0.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
|
+
...(((_anchor1 = anchor) === null || _anchor1 === void 0 ? void 0 : (_anchor1$props = _anchor1.props) === null || _anchor1$props === void 0 ? void 0 : _anchor1$props.style) || {})
|
|
507
507
|
}
|
|
508
508
|
});
|
|
509
509
|
return AnchorTag;
|
|
@@ -6,7 +6,7 @@ import { getGlobal } from "../../global";
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { Fragment, forwardRef, memo, useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
8
8
|
import { render } from 'react-dom';
|
|
9
|
-
import { bgColor, borderRadius, boxBorder, cursorNotAllowed, cursorPointer, displayBlock, displayFlex, displayInlineBlock, flexRow, itemsCenter, parseHeight, parseMinHeight, parseWidth, positionRelative, textColor, textLeft } from "../../styles/general";
|
|
9
|
+
import { bgColor, border, borderRadius, boxBorder, cursorNotAllowed, cursorPointer, displayBlock, displayFlex, displayInlineBlock, flexRow, itemsCenter, parseHeight, parseMaxHeight, parseMinHeight, parseWidth, positionRelative, textColor, textLeft, overflowYScroll } from "../../styles/general";
|
|
10
10
|
import { useTheme } from "../../theme";
|
|
11
11
|
import useThemeProps from "../../theme/utils/useThemeProps";
|
|
12
12
|
import { classNames, getProp, mapParent, randomString, removeUnicode } from "../../utils";
|
|
@@ -833,6 +833,20 @@ const TreeViewRootCSS = ({
|
|
|
833
833
|
.TreeView-Content {
|
|
834
834
|
${displayBlock};
|
|
835
835
|
${positionRelative};
|
|
836
|
+
${parseMaxHeight(240)};
|
|
837
|
+
${overflowYScroll};
|
|
838
|
+
&::-webkit-scrollbar {
|
|
839
|
+
${borderRadius(4)};
|
|
840
|
+
${parseWidth(24)};
|
|
841
|
+
}
|
|
842
|
+
&::-webkit-scrollbar-thumb {
|
|
843
|
+
${parseMinHeight(40)};
|
|
844
|
+
${borderRadius(24)};
|
|
845
|
+
${border(8, 'transparent')};
|
|
846
|
+
${bgColor(getProp(colors, 'fill/scrollbar_rest'))};
|
|
847
|
+
mix-blend-mode: normal;
|
|
848
|
+
background-clip: content-box;
|
|
849
|
+
}
|
|
836
850
|
.DGN-UI-Accordion {
|
|
837
851
|
margin-bottom: 0px;
|
|
838
852
|
}
|
package/package.json
CHANGED
|
@@ -1,44 +1,78 @@
|
|
|
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
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "diginet-core-ui",
|
|
3
|
+
"version": "1.4.50-beta.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"license": "UNLICENSED",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"start": "npm-run-all --parallel start-sb eslint-test",
|
|
9
|
+
"start-sb": "start-storybook -p 9050",
|
|
10
|
+
"build-storybook": "build-storybook -c .storybook -s src",
|
|
11
|
+
"build": "run-script-os",
|
|
12
|
+
"build:windows": "rimraf dist && mkdirp dist/components && npm run compile && sass --style=compressed src/scss:dist/css && xcopy src\\\\assets dist\\\\assets\\ /e /y",
|
|
13
|
+
"build:darwin:linux:default": "rm -rf dist && npm run compile && sass --style=compressed src/scss:dist/css && cp -rf src/assets dist/assets",
|
|
14
|
+
"compile": "babel src --out-dir dist --ignore **/*.stories.js",
|
|
15
|
+
"pack": "npm run build && cp *.md dist/ && npm run version:bump --silent && npm run version:add --silent && cd dist && npm pack",
|
|
16
|
+
"production-keep-version": "npm run build && cp *.md dist/ && cp package.json dist/ && cd dist && npm publish",
|
|
17
|
+
"beta": "npm run build && cp *.md dist/ && cp package.json dist/ && cd dist && npm publish --tag beta",
|
|
18
|
+
"production": "npm run build && cp *.md dist/ && npm run version:bump --silent && npm run version:add --silent && cd dist && npm publish",
|
|
19
|
+
"version:add": "run-script-os",
|
|
20
|
+
"version:add:windows": "cat package.json.tmp | sed \"s/0.0.0/%npm_package_version%/g\" > dist/package.json",
|
|
21
|
+
"version:add:darwin:linux:default": "VERSION=$(npm run version:extract --silent) && cat package.json.tmp | sed \"s/0.0.0/${VERSION}/g\" > dist/package.json",
|
|
22
|
+
"version:bump": "npm version patch --no-git-tag-version --silent",
|
|
23
|
+
"version:extract": "cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'",
|
|
24
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
25
|
+
"lint": "eslint --fix --config .eslintrc.js \"**/*.js\"",
|
|
26
|
+
"eslint-test": "onchange \"src/**/*.{js,jsx,json}\" -- eslint . --fix",
|
|
27
|
+
"freshtall": "npm cache clean --force && rm -rf node_modules && rm -f package-lock.json && npm install",
|
|
28
|
+
"test-storybook": "test-storybook --url http://localhost:9050",
|
|
29
|
+
"preinstall": "echo {} > package-lock.json"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@emotion/core": "^10.0.35",
|
|
33
|
+
"@emotion/css": "^11.11.0",
|
|
34
|
+
"@emotion/react": "^11.10.6",
|
|
35
|
+
"babel-plugin-module-resolver": "^4.1.0",
|
|
36
|
+
"date-fns": "^2.30.0",
|
|
37
|
+
"prop-types": "^15.7.2"
|
|
38
|
+
},
|
|
39
|
+
"lint-staged": {
|
|
40
|
+
"*/**/*.{js,jsx,json}": [
|
|
41
|
+
"prettier --write",
|
|
42
|
+
"git add"
|
|
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
|
+
}
|
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.
|
package/utils/getFileType.js
CHANGED
|
@@ -4,7 +4,7 @@ const getFileType = (FileExt, defaultValue = 'another', onlyExt = true) => {
|
|
|
4
4
|
FileExt = FileExt.slice(FileExt.lastIndexOf('.') + 1);
|
|
5
5
|
}
|
|
6
6
|
switch (true) {
|
|
7
|
-
case /jpg|png|jpeg|gif|bmp|tiff|svg|image/i.test(FileExt):
|
|
7
|
+
case /jpg|png|jpeg|gif|bmp|tiff|svg|image|heif/i.test(FileExt):
|
|
8
8
|
return 'image';
|
|
9
9
|
case /doc|word/i.test(FileExt):
|
|
10
10
|
return 'word';
|