diginet-core-ui 1.3.84 → 1.3.85
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.
|
@@ -1078,6 +1078,8 @@ const Attachment = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
1078
1078
|
title: "",
|
|
1079
1079
|
onDrop: onDropInput,
|
|
1080
1080
|
onDragLeave: onDropInput,
|
|
1081
|
+
onClick: e => e.target.value = null // Fix not fire onChange when select same file
|
|
1082
|
+
,
|
|
1081
1083
|
...inputProps
|
|
1082
1084
|
})), [inputProps]);
|
|
1083
1085
|
const AttachedView = useMemo(() => jsx(ScrollBar, {
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { jsx, css } from '@emotion/core';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { ButtonIcon, Divider, Dropdown, NumberInput, Typography } from "./..";
|
|
6
5
|
import OptionWrapper from "../others/option-wrapper";
|
|
7
|
-
import { ButtonIcon, NumberInput, Dropdown, Typography, Divider } from "../";
|
|
8
6
|
import { getGlobal } from "../../global";
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
9
|
+
import { alignCenter, borderBox, cursorPointer, flexRow, justifyCenter, noPadding, parseHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidthHeight, textCenter, whiteSpaceNoWrap } from "../../styles/general";
|
|
10
|
+
import { useTheme } from "../../theme";
|
|
11
|
+
import { classNames, refType as ref } from "../../utils";
|
|
11
12
|
const {
|
|
12
13
|
colors: {
|
|
13
14
|
system: {
|
|
14
|
-
active,
|
|
15
|
-
white
|
|
15
|
+
active: systemActive,
|
|
16
|
+
white: systemWhite
|
|
16
17
|
},
|
|
17
18
|
line: {
|
|
18
|
-
system,
|
|
19
|
-
category
|
|
19
|
+
system: lineSystem,
|
|
20
|
+
category: lineCategory
|
|
20
21
|
},
|
|
21
22
|
text: {
|
|
22
|
-
main
|
|
23
|
+
main: textMain
|
|
23
24
|
}
|
|
24
25
|
},
|
|
25
26
|
typography: {
|
|
26
27
|
paragraph2
|
|
27
28
|
},
|
|
28
29
|
spacing
|
|
29
|
-
} =
|
|
30
|
+
} = useTheme();
|
|
30
31
|
const getLastPage = (totalItems, itemsPerPage) => {
|
|
31
32
|
let _lastPage = 0;
|
|
32
33
|
if (totalItems && totalItems >= 0 && itemsPerPage && itemsPerPage > 0) {
|
|
@@ -53,7 +54,8 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
53
54
|
totalItems,
|
|
54
55
|
typeShort
|
|
55
56
|
}, reference) => {
|
|
56
|
-
|
|
57
|
+
if (!reference) reference = useRef(null);
|
|
58
|
+
const ref = useRef(null);
|
|
57
59
|
const timer = useRef(null);
|
|
58
60
|
const currentPageRef = useRef(null);
|
|
59
61
|
const numberRef = useRef(null);
|
|
@@ -66,8 +68,6 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
66
68
|
const [disableNextState, setDisableNextState] = useState(!(totalItems > itemsPerPage));
|
|
67
69
|
const [inputPageValue, setInputPageValue] = useState(currentPage);
|
|
68
70
|
const _pagingInfoCSS = pagingInfoCSS(bgColor, typeShort);
|
|
69
|
-
// const _dynamicWidthCSS = dynamicWidthCSS(currentPageState.toString()?.length || 3);
|
|
70
|
-
|
|
71
71
|
const _onChangePage = async ({
|
|
72
72
|
page,
|
|
73
73
|
e,
|
|
@@ -139,9 +139,6 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
setItemsPerPageState(per);
|
|
142
|
-
// currentPageRef.current = 0;
|
|
143
|
-
// setCurrentPageState(0);
|
|
144
|
-
// setInputPageValue(0);
|
|
145
142
|
_onChangePage({
|
|
146
143
|
page: 0
|
|
147
144
|
});
|
|
@@ -253,13 +250,13 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
253
250
|
// getBoundingClientRect includes margin => phải trừ đi margin
|
|
254
251
|
const style = window.getComputedStyle(child) || child.currentStyle;
|
|
255
252
|
const margin = parseInt((style === null || style === void 0 ? void 0 : style.marginLeft) || 0) + parseInt((style === null || style === void 0 ? void 0 : style.marginRight) || 0);
|
|
256
|
-
if (infoChild.right - margin >= infoParent.
|
|
253
|
+
if (infoChild.right - margin >= infoParent.right) {
|
|
257
254
|
child.style.opacity = 0;
|
|
258
255
|
child.style.setProperty('display', 'none', 'important');
|
|
259
256
|
} else {
|
|
260
257
|
child.style.opacity = 1;
|
|
261
258
|
}
|
|
262
|
-
return infoChild.right >= infoParent.
|
|
259
|
+
return infoChild.right >= infoParent.right;
|
|
263
260
|
});
|
|
264
261
|
};
|
|
265
262
|
const setWithNumber = useCallback((totalRefs = totalRef, numberRefs = numberRef) => {
|
|
@@ -297,12 +294,12 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
297
294
|
listPerPageData = [...new Map(listPerPageData.map(v => [JSON.stringify(v), v])).values()];
|
|
298
295
|
listPerPageData.sort((a, b) => a.id - b.id);
|
|
299
296
|
const showPaging = checkShowPaging();
|
|
300
|
-
return showPaging
|
|
297
|
+
return showPaging ? jsx("div", {
|
|
301
298
|
ref: ref,
|
|
302
299
|
css: _pagingInfoCSS,
|
|
303
300
|
id: id,
|
|
304
301
|
style: style,
|
|
305
|
-
className:
|
|
302
|
+
className: classNames('DGN-UI-PagingInfo', className)
|
|
306
303
|
}, jsx(ButtonIcon, {
|
|
307
304
|
circular: true,
|
|
308
305
|
viewType: 'ghost',
|
|
@@ -360,15 +357,15 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
360
357
|
placeholder: '',
|
|
361
358
|
max: lastPage,
|
|
362
359
|
onKeyDown: checkKeyPress,
|
|
363
|
-
onChange:
|
|
360
|
+
onChange: onTypePaging
|
|
364
361
|
}), "/", jsx(Typography, {
|
|
365
362
|
ref: refs => {
|
|
366
363
|
totalRef.current = refs;
|
|
367
364
|
setWithNumber(refs, null);
|
|
368
365
|
},
|
|
369
366
|
css: css`
|
|
370
|
-
|
|
371
|
-
|
|
367
|
+
${whiteSpaceNoWrap}
|
|
368
|
+
`,
|
|
372
369
|
type: 'p2'
|
|
373
370
|
}, lastPage)), jsx(ButtonIcon, {
|
|
374
371
|
circular: true,
|
|
@@ -415,7 +412,7 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
415
412
|
}, typeShort ? jsx(Divider, {
|
|
416
413
|
direction: 'vertical',
|
|
417
414
|
height: 24,
|
|
418
|
-
color:
|
|
415
|
+
color: lineCategory
|
|
419
416
|
}) : getGlobal('lineNumber'), jsx(Dropdown, {
|
|
420
417
|
allowSearch: false,
|
|
421
418
|
viewType: 'underlined',
|
|
@@ -429,7 +426,7 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
429
426
|
readOnly: true
|
|
430
427
|
},
|
|
431
428
|
dropdownItemStyle: {
|
|
432
|
-
color:
|
|
429
|
+
color: systemActive
|
|
433
430
|
}
|
|
434
431
|
})), jsx(Typography, {
|
|
435
432
|
type: 'p2',
|
|
@@ -438,9 +435,9 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
438
435
|
}, typeShort ? jsx(Divider, {
|
|
439
436
|
direction: 'vertical',
|
|
440
437
|
height: 24,
|
|
441
|
-
color:
|
|
442
|
-
}) : getGlobal('total') + ':', totalItemsState));
|
|
443
|
-
}, [
|
|
438
|
+
color: lineCategory
|
|
439
|
+
}) : getGlobal('total') + ':', totalItemsState)) : null;
|
|
440
|
+
}, [bgColor, className, hideWithPage, style, typeShort, currentPageState, disableNextState, disablePrevState, inputPageValue, itemsPerPageState, listPerPageState, totalItemsState]);
|
|
444
441
|
}));
|
|
445
442
|
const ViewNumberInput = css`
|
|
446
443
|
${flexRow};
|
|
@@ -454,11 +451,11 @@ const pagingInfoCSS = (bgColor, typeShort) => css`
|
|
|
454
451
|
${alignCenter};
|
|
455
452
|
${paragraph2};
|
|
456
453
|
${borderBox};
|
|
457
|
-
${parseHeight(40)}
|
|
458
|
-
border-top: solid 1px ${
|
|
454
|
+
${parseHeight(40)};
|
|
455
|
+
border-top: solid 1px ${lineSystem};
|
|
459
456
|
padding: ${spacing([1, 0])};
|
|
460
457
|
background-color: ${bgColor};
|
|
461
|
-
color: ${
|
|
458
|
+
color: ${textMain};
|
|
462
459
|
.inputPage {
|
|
463
460
|
${textCenter};
|
|
464
461
|
margin: ${spacing([0, 0.5])};
|
|
@@ -467,7 +464,7 @@ const pagingInfoCSS = (bgColor, typeShort) => css`
|
|
|
467
464
|
input {
|
|
468
465
|
${paragraph2};
|
|
469
466
|
${textCenter};
|
|
470
|
-
color: ${
|
|
467
|
+
color: ${systemActive};
|
|
471
468
|
text-align: left;
|
|
472
469
|
}
|
|
473
470
|
}
|
|
@@ -485,9 +482,9 @@ const pagingInfoCSS = (bgColor, typeShort) => css`
|
|
|
485
482
|
.DGN-UI-Dropdown {
|
|
486
483
|
margin-left: ${`${spacing(typeShort ? [0] : [2])}`};
|
|
487
484
|
margin-bottom: 0;
|
|
488
|
-
|
|
485
|
+
${parseMinWidth(52)};
|
|
489
486
|
.DGN-UI-Dropdown-Form {
|
|
490
|
-
|
|
487
|
+
${parseMinHeight(24)};
|
|
491
488
|
padding: 0;
|
|
492
489
|
input,
|
|
493
490
|
span {
|
|
@@ -496,14 +493,12 @@ const pagingInfoCSS = (bgColor, typeShort) => css`
|
|
|
496
493
|
${cursorPointer};
|
|
497
494
|
}
|
|
498
495
|
.DGN-UI-Dropdown-Icon {
|
|
499
|
-
margin-left:
|
|
496
|
+
margin-left: ${spacing([1.5])};
|
|
500
497
|
div,
|
|
501
498
|
span,
|
|
502
499
|
svg {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
height: 20px;
|
|
506
|
-
min-height: 20px;
|
|
500
|
+
${parseWidthHeight(20)};
|
|
501
|
+
${parseMinWidthHeight(20)};
|
|
507
502
|
}
|
|
508
503
|
}
|
|
509
504
|
}
|
|
@@ -518,14 +513,14 @@ const pagingInfoCSS = (bgColor, typeShort) => css`
|
|
|
518
513
|
}
|
|
519
514
|
`;
|
|
520
515
|
PagingInfo.defaultProps = {
|
|
521
|
-
|
|
522
|
-
bgColor: white,
|
|
523
|
-
style: {},
|
|
516
|
+
bgColor: systemWhite,
|
|
524
517
|
className: '',
|
|
525
|
-
totalItems: 0,
|
|
526
518
|
currentPage: 0,
|
|
519
|
+
hideWithPage: 'none',
|
|
527
520
|
listPerPage: [10, 15, 20, 30, 50],
|
|
528
|
-
|
|
521
|
+
style: {},
|
|
522
|
+
totalItems: 0,
|
|
523
|
+
typeShort: false
|
|
529
524
|
};
|
|
530
525
|
PagingInfo.propTypes = {
|
|
531
526
|
/** Background color for component. */
|
|
@@ -578,9 +573,7 @@ PagingInfo.propTypes = {
|
|
|
578
573
|
* * setTotalItems(items): Set total items
|
|
579
574
|
* * @param {items} - number
|
|
580
575
|
*/
|
|
581
|
-
reference:
|
|
582
|
-
current: PropTypes.instanceOf(Element)
|
|
583
|
-
})])
|
|
576
|
+
reference: ref
|
|
584
577
|
};
|
|
585
578
|
export { PagingInfo };
|
|
586
579
|
export default OptionWrapper(PagingInfo);
|
|
@@ -1,51 +1,46 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { Icon, Typography } from "./..";
|
|
5
|
+
import OptionWrapper from "../others/option-wrapper";
|
|
4
6
|
import PropTypes from 'prop-types';
|
|
5
7
|
import { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import theme from "../../theme/settings";
|
|
10
|
-
import OptionWrapper from "../others/option-wrapper";
|
|
8
|
+
import { alignCenter, backgroundTransparent, borderBox, flexRow, parseMinHeight, parseWidth } from "../../styles/general";
|
|
9
|
+
import { useTheme, useColor as colors } from "../../theme";
|
|
10
|
+
import { classNames } from "../../utils";
|
|
11
11
|
const {
|
|
12
12
|
colors: {
|
|
13
13
|
system: {
|
|
14
|
-
|
|
15
|
-
rest
|
|
16
|
-
},
|
|
17
|
-
semantic: {
|
|
18
|
-
success,
|
|
19
|
-
warning,
|
|
20
|
-
danger,
|
|
21
|
-
info
|
|
14
|
+
rest: systemRest
|
|
22
15
|
},
|
|
23
16
|
fill: {
|
|
24
|
-
sidebar
|
|
17
|
+
sidebar: fillSidebar
|
|
25
18
|
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
},
|
|
20
|
+
spacing
|
|
21
|
+
} = useTheme();
|
|
22
|
+
const colorMap = new Map([['default', systemRest]]);
|
|
29
23
|
const iconSizeMap = new Map([['small', '16px'], ['medium', '20px'], ['large', '24px']]);
|
|
30
24
|
const typographySizeMap = new Map([['small', 'p3'], ['medium', 'p2'], ['large', 'p1']]);
|
|
31
|
-
const filledPaddingSizeMap = new Map([['small',
|
|
25
|
+
const filledPaddingSizeMap = new Map([['small', spacing([0.5, 2])], ['medium', spacing([0.5, 2])], ['large', spacing([0.5, 3])]]);
|
|
32
26
|
const Status = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
33
27
|
action = {},
|
|
34
28
|
className,
|
|
35
|
-
color,
|
|
29
|
+
color: colorProp,
|
|
36
30
|
icon,
|
|
31
|
+
id,
|
|
37
32
|
size,
|
|
33
|
+
style,
|
|
38
34
|
text,
|
|
39
|
-
viewType
|
|
40
|
-
id,
|
|
41
|
-
style
|
|
35
|
+
viewType
|
|
42
36
|
}, reference) => {
|
|
37
|
+
if (!reference) reference = useRef(null);
|
|
43
38
|
const ref = useRef(null);
|
|
44
39
|
const outlinedPaddingSize = filledPaddingSizeMap.get(size);
|
|
45
|
-
const
|
|
40
|
+
const color = colorMap.get(colorProp) || colors[colorProp] || colorProp || systemRest;
|
|
46
41
|
const iconSize = iconSizeMap.get(size);
|
|
47
42
|
const typographySize = typographySizeMap.get(size);
|
|
48
|
-
const
|
|
43
|
+
const _StatusRootCSS = StatusRootCSS(iconSize, color, size, outlinedPaddingSize);
|
|
49
44
|
useImperativeHandle(reference, () => {
|
|
50
45
|
const currentRef = ref.current || {};
|
|
51
46
|
currentRef.element = ref.current;
|
|
@@ -56,40 +51,41 @@ const Status = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
56
51
|
currentRef.instance = _instance;
|
|
57
52
|
return currentRef;
|
|
58
53
|
});
|
|
59
|
-
const
|
|
54
|
+
const StatusIconView = typeof icon === 'string' ? jsx(Icon, {
|
|
60
55
|
name: icon,
|
|
61
56
|
width: iconSize,
|
|
62
57
|
height: iconSize,
|
|
63
58
|
color: 'currentColor',
|
|
64
59
|
viewBox: true
|
|
65
60
|
}) : icon;
|
|
66
|
-
const
|
|
61
|
+
const StatusTextView = jsx(Typography, {
|
|
67
62
|
css: TextCSS,
|
|
68
63
|
type: typographySize,
|
|
69
64
|
color: 'inherit'
|
|
70
65
|
}, text);
|
|
71
66
|
return useMemo(() => {
|
|
72
67
|
return jsx("div", {
|
|
73
|
-
css:
|
|
68
|
+
css: _StatusRootCSS,
|
|
74
69
|
ref: ref,
|
|
75
70
|
id: id,
|
|
76
71
|
style: style,
|
|
77
|
-
className:
|
|
78
|
-
},
|
|
79
|
-
}, [className,
|
|
72
|
+
className: classNames('DGN-UI-Status', viewType, size, className)
|
|
73
|
+
}, StatusIconView, StatusTextView);
|
|
74
|
+
}, [className, colorProp, icon, id, size, style, text, viewType]);
|
|
80
75
|
}));
|
|
81
|
-
const
|
|
76
|
+
const StatusRootCSS = (iconSize, color, size, outlinedPaddingSize) => css`
|
|
82
77
|
${flexRow};
|
|
83
78
|
${alignCenter};
|
|
84
79
|
${backgroundTransparent};
|
|
85
80
|
${borderBox};
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
${parseWidth('fit-content')};
|
|
82
|
+
${parseMinHeight(iconSize)};
|
|
83
|
+
gap: ${spacing([size === 'small' ? 0.5 : 1])};
|
|
88
84
|
color: ${color};
|
|
89
85
|
&.filled {
|
|
90
|
-
color: ${
|
|
86
|
+
color: ${fillSidebar};
|
|
91
87
|
background-color: ${color};
|
|
92
|
-
border-radius:
|
|
88
|
+
border-radius: 20px;
|
|
93
89
|
&.${size} {
|
|
94
90
|
padding: ${outlinedPaddingSize};
|
|
95
91
|
}
|
|
@@ -99,12 +95,12 @@ const TextCSS = css`
|
|
|
99
95
|
white-space: nowrap;
|
|
100
96
|
`;
|
|
101
97
|
Status.defaultProps = {
|
|
102
|
-
|
|
103
|
-
text: '',
|
|
98
|
+
className: '',
|
|
104
99
|
icon: '',
|
|
105
100
|
size: 'medium',
|
|
106
|
-
|
|
107
|
-
|
|
101
|
+
style: {},
|
|
102
|
+
text: '',
|
|
103
|
+
viewType: 'ghost'
|
|
108
104
|
};
|
|
109
105
|
Status.propTypes = {
|
|
110
106
|
/** Class for component. */
|
|
@@ -115,12 +111,12 @@ Status.propTypes = {
|
|
|
115
111
|
icon: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
116
112
|
/** The size of the component. */
|
|
117
113
|
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
114
|
+
/** Style inline of component. */
|
|
115
|
+
style: PropTypes.object,
|
|
118
116
|
/** The content of the component. */
|
|
119
117
|
text: PropTypes.string,
|
|
120
118
|
/** The variant to use. */
|
|
121
|
-
viewType: PropTypes.oneOf(['filled', '
|
|
122
|
-
/** Style inline of component. */
|
|
123
|
-
style: PropTypes.object
|
|
119
|
+
viewType: PropTypes.oneOf(['filled', 'ghost'])
|
|
124
120
|
};
|
|
125
121
|
export { Status };
|
|
126
122
|
export default OptionWrapper(Status);
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,6 +38,11 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.85
|
|
42
|
+
- \[Fixed\]: Attachment – Fix not fire onChange when select same file
|
|
43
|
+
- \[Fixed\]: PagingInfo – Fix responsive auto hide element wrong
|
|
44
|
+
- \[Fixed\]: Status – Fix css not match design
|
|
45
|
+
|
|
41
46
|
## 1.3.84
|
|
42
47
|
- \[Fixed\]: Badge – Remove animation, conditional rendering with prop invisible
|
|
43
48
|
- \[Fixed\]: InputBase – Fix css focus when readOnly
|