diginet-core-ui 1.3.98-beta.1 → 1.3.99-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/components/form-control/dropdown/index.js +32 -16
- package/package.json +1 -1
- package/readme.md +6 -0
- package/styles/general.js +18 -12
|
@@ -33,6 +33,16 @@ const convertData = (dt, valueExpr) => {
|
|
|
33
33
|
valueTemp = valueTemp.map(i => i[valueExpr] || i);
|
|
34
34
|
return valueTemp;
|
|
35
35
|
};
|
|
36
|
+
const convertSearchDelayTime = searchDelayTime => {
|
|
37
|
+
var _searchDelayTime$matc, _searchDelayTime$matc2;
|
|
38
|
+
if (searchDelayTime === true) return getGlobal('delayOnInput');
|
|
39
|
+
const units = {
|
|
40
|
+
m: 60000,
|
|
41
|
+
s: 1000,
|
|
42
|
+
ms: 1
|
|
43
|
+
};
|
|
44
|
+
return typeof searchDelayTime === 'number' ? searchDelayTime : (((_searchDelayTime$matc = searchDelayTime.match(/[^a-z]+/i)) === null || _searchDelayTime$matc === void 0 ? void 0 : _searchDelayTime$matc[0]) || 1) * units[((_searchDelayTime$matc2 = searchDelayTime.match(/ms|s|m/i)) === null || _searchDelayTime$matc2 === void 0 ? void 0 : _searchDelayTime$matc2[0]) || 's'];
|
|
45
|
+
};
|
|
36
46
|
const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
37
47
|
action = {},
|
|
38
48
|
allowSearch,
|
|
@@ -86,6 +96,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
86
96
|
if (!reference) reference = useRef(null);
|
|
87
97
|
if (multiple && selectBox === undefined) selectBox = true;
|
|
88
98
|
if (typeof searchExpr === 'string') searchExpr = [searchExpr];
|
|
99
|
+
searchDelayTime = convertSearchDelayTime(searchDelayTime);
|
|
89
100
|
const ref = useRef(null);
|
|
90
101
|
const dropdownRef = useRef(null);
|
|
91
102
|
const timer = useRef(null);
|
|
@@ -96,7 +107,7 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
96
107
|
const dropdownListRef = useRef(null);
|
|
97
108
|
const searchRef = useRef(null);
|
|
98
109
|
// const lastSearchRef = useRef(null);
|
|
99
|
-
const timeout = useRef(null);
|
|
110
|
+
// const timeout = useRef(null);
|
|
100
111
|
const loadMoreTimer = useRef(null);
|
|
101
112
|
const dataChosen = useRef([]);
|
|
102
113
|
const [unique] = useState(randomString(6, {
|
|
@@ -1043,21 +1054,26 @@ const Dropdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1043
1054
|
closeDropdown();
|
|
1044
1055
|
};
|
|
1045
1056
|
}, []);
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1057
|
+
|
|
1058
|
+
// useEffect(() => {
|
|
1059
|
+
// if (searchDelayTime) {
|
|
1060
|
+
// if (searchDelayTime === true) searchDelayTime = getGlobal('delayOnInput');
|
|
1061
|
+
// const units = {
|
|
1062
|
+
// m: 60000,
|
|
1063
|
+
// s: 1000,
|
|
1064
|
+
// ms: 1,
|
|
1065
|
+
// };
|
|
1066
|
+
// timeout.current =
|
|
1067
|
+
// typeof searchDelayTime === 'number'
|
|
1068
|
+
// ? searchDelayTime
|
|
1069
|
+
// : (searchDelayTime.match(/[^a-z]+/i)?.[0] || 1) *
|
|
1070
|
+
// units[searchDelayTime.match(/ms|s|m/i)?.[0] || 's'];
|
|
1071
|
+
// return () => {
|
|
1072
|
+
// timeout.current = null;
|
|
1073
|
+
// };
|
|
1074
|
+
// }
|
|
1075
|
+
// }, [searchDelayTime]);
|
|
1076
|
+
|
|
1061
1077
|
useEffect(() => {
|
|
1062
1078
|
if (allValue[unique][allValue[unique].length - 1] !== valueProp) {
|
|
1063
1079
|
allValue[unique].push(valueProp);
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,6 +38,12 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.99
|
|
42
|
+
- \[Changed\]: Typography – Add new text style
|
|
43
|
+
- \[Fixed\]: Tab – Fix background UI not match design
|
|
44
|
+
- \[Fixed\]: Dropdown – Fix case renderItem, renderSelectedItem inside Typography
|
|
45
|
+
- \[Fixed\]: Attachment – Fix bug not reset new upload data
|
|
46
|
+
|
|
41
47
|
## 1.3.98
|
|
42
48
|
- \[Changed\]: Image – Change default image
|
|
43
49
|
- \[Changed\]: Icon – Update Image, Another, Compressed, Presentation, Sheet, Word, PDF
|
package/styles/general.js
CHANGED
|
@@ -10,10 +10,10 @@ export const alphaPseudo = {
|
|
|
10
10
|
};
|
|
11
11
|
export const typographyTypes = ['t1', 't2', 't3', 't4', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p1', 'p2', 'p3', 'title1', 'title2', 'title3', 'title4', 'heading1', 'heading2', 'heading3', 'heading4', 'heading5', 'heading6', 'paragraph1', 'paragraph2', 'paragraph3'];
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* get value spacing with rootZIndex
|
|
15
|
-
* @param number
|
|
16
|
-
* @return {number}
|
|
13
|
+
/**
|
|
14
|
+
* get value spacing with rootZIndex
|
|
15
|
+
* @param number
|
|
16
|
+
* @return {number}
|
|
17
17
|
*/
|
|
18
18
|
export const zIndex = number => {
|
|
19
19
|
number = Number(number || 0);
|
|
@@ -21,10 +21,10 @@ export const zIndex = number => {
|
|
|
21
21
|
return rootZIndex + number;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
* get value spacing with rootSpacing
|
|
26
|
-
* @param {(number|number[])} vl - default 1
|
|
27
|
-
* @returns {(number|string)}
|
|
24
|
+
/**
|
|
25
|
+
* get value spacing with rootSpacing
|
|
26
|
+
* @param {(number|number[])} vl - default 1
|
|
27
|
+
* @returns {(number|string)}
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
export const getSpacing = (vl = 1) => {
|
|
@@ -34,9 +34,9 @@ export const getSpacing = (vl = 1) => {
|
|
|
34
34
|
} else return vl;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
/**
|
|
38
|
-
* replace rootZIndex
|
|
39
|
-
* @param number
|
|
37
|
+
/**
|
|
38
|
+
* replace rootZIndex
|
|
39
|
+
* @param number
|
|
40
40
|
*/
|
|
41
41
|
export const setZIndex = number => {
|
|
42
42
|
number = Number(number || 0);
|
|
@@ -51,6 +51,9 @@ const animation = ({
|
|
|
51
51
|
}) => css`
|
|
52
52
|
animation: ${keyframes} ${duration} ${timingFunction};
|
|
53
53
|
`;
|
|
54
|
+
const aspectSquare = css`
|
|
55
|
+
aspect-ratio: 1 / 1;
|
|
56
|
+
`;
|
|
54
57
|
const bgColor = cl => css`
|
|
55
58
|
background-color: ${getColor(cl)};
|
|
56
59
|
`;
|
|
@@ -90,6 +93,9 @@ const borderRadius4px = css`
|
|
|
90
93
|
const borderRadius50 = css`
|
|
91
94
|
border-radius: 50%;
|
|
92
95
|
`;
|
|
96
|
+
const borderRight = (withVl, colorVl) => css`
|
|
97
|
+
border-right: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system/dark')};
|
|
98
|
+
`;
|
|
93
99
|
const borderTop = (withVl, colorVl) => css`
|
|
94
100
|
border-top: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system/dark')};
|
|
95
101
|
`;
|
|
@@ -481,4 +487,4 @@ const whiteSpacePreWrap = css`
|
|
|
481
487
|
const z = vl => css`
|
|
482
488
|
z-index: ${zIndex(vl)};
|
|
483
489
|
`;
|
|
484
|
-
export { animation, bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderDashed, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, borderTop, borderTopColor, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, listNone, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, overflowXHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textSentence, textUnderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
|
|
490
|
+
export { animation, aspectSquare, bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderDashed, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, borderRight, borderTop, borderTopColor, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorInitial, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, listNone, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, overflowXHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textSentence, textUnderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
|