diginet-core-ui 1.3.73-beta.3 → 1.3.73-beta.4
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/accordion/details.js +19 -10
- package/components/accordion/group.js +15 -6
- package/components/accordion/index.js +20 -11
- package/components/accordion/summary.js +16 -7
- package/components/form-control/attachment/index.js +21 -21
- package/components/popover/index.js +1 -1
- package/components/tab/tab-container.js +2 -2
- package/components/tab/tab-header.js +2 -2
- package/components/tab/tab-panel.js +2 -2
- package/components/tab/tab.js +2 -2
- package/package.json +1 -1
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
import { memo, forwardRef, useRef, useMemo, useImperativeHandle } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
|
-
import { borderBox, displayBlock, overflowHidden, pointerEventsNone, positionRelative, userSelectNone } from '../../styles/general';
|
|
7
|
+
import { borderBox, displayBlock, overflowHidden, parseHeight, pointerEventsNone, positionRelative, userSelectNone } from '../../styles/general';
|
|
8
|
+
import { classNames } from '../../utils';
|
|
8
9
|
import theme from '../../theme/settings';
|
|
9
10
|
const {
|
|
10
11
|
colors: {
|
|
@@ -18,16 +19,24 @@ const {
|
|
|
18
19
|
spacing
|
|
19
20
|
} = theme;
|
|
20
21
|
const AccordionDetails = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
22
|
+
action = {},
|
|
21
23
|
children,
|
|
22
24
|
className,
|
|
23
25
|
id,
|
|
24
26
|
style
|
|
25
27
|
}, reference) => {
|
|
26
28
|
const ref = useRef(null);
|
|
27
|
-
useImperativeHandle(reference, () =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
useImperativeHandle(reference, () => {
|
|
30
|
+
const currentRef = ref.current || {};
|
|
31
|
+
currentRef.element = ref.current;
|
|
32
|
+
const _instance = { ...action
|
|
33
|
+
}; // methods
|
|
34
|
+
|
|
35
|
+
_instance.__proto__ = {}; // hidden methods
|
|
36
|
+
|
|
37
|
+
currentRef.instance = _instance;
|
|
38
|
+
return currentRef;
|
|
39
|
+
});
|
|
31
40
|
return useMemo(() => {
|
|
32
41
|
return jsx("div", {
|
|
33
42
|
css: DetailsRootCSS,
|
|
@@ -36,15 +45,15 @@ const AccordionDetails = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
36
45
|
id: id
|
|
37
46
|
}, jsx("div", {
|
|
38
47
|
style: style,
|
|
39
|
-
className:
|
|
48
|
+
className: classNames('DGN-UI-Accordion-Details-Content', className)
|
|
40
49
|
}, children));
|
|
41
|
-
}, [
|
|
50
|
+
}, [children, className, id, style]);
|
|
42
51
|
}));
|
|
43
52
|
const DetailsRootCSS = css`
|
|
44
53
|
${displayBlock};
|
|
45
54
|
${positionRelative};
|
|
46
55
|
${overflowHidden};
|
|
47
|
-
|
|
56
|
+
${parseHeight(0)};
|
|
48
57
|
transition: height 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
49
58
|
.DGN-UI-Accordion-Details-Content {
|
|
50
59
|
${borderBox};
|
|
@@ -52,8 +61,8 @@ const DetailsRootCSS = css`
|
|
|
52
61
|
padding: ${spacing([0, 6, 4, 6])};
|
|
53
62
|
color: ${main};
|
|
54
63
|
&.disabled {
|
|
55
|
-
${pointerEventsNone}
|
|
56
|
-
${userSelectNone}
|
|
64
|
+
${pointerEventsNone};
|
|
65
|
+
${userSelectNone};
|
|
57
66
|
}
|
|
58
67
|
}
|
|
59
68
|
`;
|
|
@@ -5,11 +5,13 @@ import { memo, useRef, forwardRef, Children, cloneElement, useMemo, useImperativ
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import { borderRadius4px } from '../../styles/general';
|
|
8
|
+
import classNames from '../../utils/classNames';
|
|
8
9
|
import theme from '../../theme/settings';
|
|
9
10
|
const {
|
|
10
11
|
spacing
|
|
11
12
|
} = theme;
|
|
12
13
|
const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
14
|
+
action = {},
|
|
13
15
|
children,
|
|
14
16
|
className,
|
|
15
17
|
collapseOther,
|
|
@@ -30,20 +32,27 @@ const AccordionGroup = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
30
32
|
}
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
useImperativeHandle(reference, () =>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
useImperativeHandle(reference, () => {
|
|
36
|
+
const currentRef = ref.current || {};
|
|
37
|
+
currentRef.element = ref.current;
|
|
38
|
+
const _instance = { ...action
|
|
39
|
+
}; // methods
|
|
40
|
+
|
|
41
|
+
_instance.__proto__ = {}; // hidden methods
|
|
42
|
+
|
|
43
|
+
currentRef.instance = _instance;
|
|
44
|
+
return currentRef;
|
|
45
|
+
});
|
|
37
46
|
return useMemo(() => {
|
|
38
47
|
return jsx("div", {
|
|
39
48
|
css: AccordionGroupRootCSS,
|
|
40
49
|
ref: ref,
|
|
41
50
|
style: style,
|
|
42
|
-
className:
|
|
51
|
+
className: classNames('DGN-UI-Accordion-Group', className)
|
|
43
52
|
}, Children.map(children, child => child && /*#__PURE__*/cloneElement(child, {
|
|
44
53
|
onExpand: e => onCollapseOther(e, child.props.onExpand)
|
|
45
54
|
})));
|
|
46
|
-
}, [
|
|
55
|
+
}, [children, className, collapseOther, style]);
|
|
47
56
|
}));
|
|
48
57
|
const AccordionGroupRootCSS = css`
|
|
49
58
|
${borderRadius4px};
|
|
@@ -6,7 +6,8 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import AccordionContext from './context';
|
|
8
8
|
import Divider from '../divider';
|
|
9
|
-
import { borderRadius4px, displayBlock, positionRelative } from '../../styles/general';
|
|
9
|
+
import { borderRadius4px, displayBlock, parseWidth, positionRelative } from '../../styles/general';
|
|
10
|
+
import classNames from '../../utils/classNames';
|
|
10
11
|
import theme from '../../theme/settings';
|
|
11
12
|
const {
|
|
12
13
|
colors: {
|
|
@@ -16,6 +17,7 @@ const {
|
|
|
16
17
|
}
|
|
17
18
|
} = theme;
|
|
18
19
|
const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
20
|
+
action = {},
|
|
19
21
|
boxShadow,
|
|
20
22
|
children,
|
|
21
23
|
className,
|
|
@@ -49,17 +51,24 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
49
51
|
});
|
|
50
52
|
};
|
|
51
53
|
|
|
52
|
-
useImperativeHandle(reference, () =>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
useImperativeHandle(reference, () => {
|
|
55
|
+
const currentRef = ref.current || {};
|
|
56
|
+
currentRef.element = ref.current;
|
|
57
|
+
const _instance = { ...action
|
|
58
|
+
}; // methods
|
|
59
|
+
|
|
60
|
+
_instance.__proto__ = {}; // hidden methods
|
|
61
|
+
|
|
62
|
+
currentRef.instance = _instance;
|
|
63
|
+
return currentRef;
|
|
64
|
+
});
|
|
56
65
|
return useMemo(() => {
|
|
57
66
|
return jsx("div", {
|
|
58
67
|
id: id,
|
|
59
68
|
css: AccordionRootCSS,
|
|
60
69
|
ref: ref,
|
|
61
70
|
style: style,
|
|
62
|
-
className:
|
|
71
|
+
className: classNames('DGN-UI-Accordion', disabled && 'disabled', boxShadow === true && 'boxShadow', expandState && 'expanding', className)
|
|
63
72
|
}, jsx(AccordionContext.Provider, {
|
|
64
73
|
value: {
|
|
65
74
|
expanded,
|
|
@@ -77,13 +86,13 @@ const Accordion = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
77
86
|
display: 'none'
|
|
78
87
|
}
|
|
79
88
|
})));
|
|
80
|
-
}, [
|
|
89
|
+
}, [boxShadow, children, className, disabled, expanded, id, onClick, onCollapse, onExpand, style, expandState]);
|
|
81
90
|
}));
|
|
82
91
|
const AccordionRootCSS = css`
|
|
83
92
|
${displayBlock};
|
|
84
93
|
${positionRelative};
|
|
85
94
|
${borderRadius4px};
|
|
86
|
-
|
|
95
|
+
${parseWidth('100%')};
|
|
87
96
|
transition: margin 300ms ease;
|
|
88
97
|
&.boxShadow {
|
|
89
98
|
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.25);
|
|
@@ -94,10 +103,10 @@ const AccordionRootCSS = css`
|
|
|
94
103
|
}
|
|
95
104
|
`;
|
|
96
105
|
Accordion.defaultProps = {
|
|
97
|
-
expand: false,
|
|
98
|
-
disabled: false,
|
|
99
|
-
className: '',
|
|
100
106
|
boxShadow: true,
|
|
107
|
+
className: '',
|
|
108
|
+
disabled: false,
|
|
109
|
+
expand: false,
|
|
101
110
|
style: {}
|
|
102
111
|
};
|
|
103
112
|
Accordion.propTypes = {
|
|
@@ -7,6 +7,7 @@ import { jsx } from '@emotion/core';
|
|
|
7
7
|
import { SummaryRootCSS } from './css';
|
|
8
8
|
import AccordionContext from './context';
|
|
9
9
|
import { ButtonIcon, Typography } from '..';
|
|
10
|
+
import { classNames } from '../../utils';
|
|
10
11
|
import theme from '../../theme/settings';
|
|
11
12
|
const {
|
|
12
13
|
colors: {
|
|
@@ -18,6 +19,7 @@ const {
|
|
|
18
19
|
spacing
|
|
19
20
|
} = theme;
|
|
20
21
|
const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
22
|
+
action = {},
|
|
21
23
|
background,
|
|
22
24
|
children,
|
|
23
25
|
className,
|
|
@@ -113,10 +115,17 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
113
115
|
showHideDetailHandler('hide');
|
|
114
116
|
}
|
|
115
117
|
}, [expandState]);
|
|
116
|
-
useImperativeHandle(reference, () =>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
useImperativeHandle(reference, () => {
|
|
119
|
+
const currentRef = ref.current || {};
|
|
120
|
+
currentRef.element = ref.current;
|
|
121
|
+
const _instance = { ...action
|
|
122
|
+
}; // methods
|
|
123
|
+
|
|
124
|
+
_instance.__proto__ = {}; // hidden methods
|
|
125
|
+
|
|
126
|
+
currentRef.instance = _instance;
|
|
127
|
+
return currentRef;
|
|
128
|
+
});
|
|
120
129
|
return useMemo(() => {
|
|
121
130
|
return jsx("div", {
|
|
122
131
|
id: id,
|
|
@@ -125,7 +134,7 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
125
134
|
tabIndex: "-1",
|
|
126
135
|
onClick: _onClick,
|
|
127
136
|
style: style,
|
|
128
|
-
className:
|
|
137
|
+
className: classNames('DGN-UI-Accordion-Summary', disabled && 'disabled', expandIcon && expandIconAt, expandState && 'expanding', className)
|
|
129
138
|
}, jsx("div", {
|
|
130
139
|
className: 'DGN-UI-Accordion-Summary-Content'
|
|
131
140
|
}, jsx(Typography, {
|
|
@@ -139,7 +148,7 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
139
148
|
className: 'Accordion-Icon-Root'
|
|
140
149
|
}, jsx("div", { ...expandIconProps,
|
|
141
150
|
ref: expandIconRef,
|
|
142
|
-
className:
|
|
151
|
+
className: classNames('Accordion-Icon', !collapseIcon && 'rotate-able', expandIconProps === null || expandIconProps === void 0 ? void 0 : expandIconProps.className)
|
|
143
152
|
}, typeof expandIcon === 'string' ? jsx(ButtonIcon, {
|
|
144
153
|
viewType: 'ghost',
|
|
145
154
|
name: expandIcon,
|
|
@@ -153,7 +162,7 @@ const AccordionSummary = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
153
162
|
}) : jsx("span", {
|
|
154
163
|
className: 'Accordion-Collapse-Icon effect'
|
|
155
164
|
}, collapseIcon)))));
|
|
156
|
-
}, [
|
|
165
|
+
}, [background, children, className, collapseIcon, expandIcon, expandIconAt, expandIconProps, id, onClick, style, title, disabled, expanded, expandState, onClickAccordion, onCollapse, onExpand]);
|
|
157
166
|
}));
|
|
158
167
|
AccordionSummary.defaultProps = {
|
|
159
168
|
className: '',
|
|
@@ -1793,17 +1793,17 @@ Attachment.propTypes = {
|
|
|
1793
1793
|
/** Class for component. */
|
|
1794
1794
|
className: PropTypes.string,
|
|
1795
1795
|
|
|
1796
|
-
/** List attachment:<br />
|
|
1797
|
-
* [{<br />
|
|
1798
|
-
* "AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
|
|
1799
|
-
* "URL": "https://apricot.diginet.com.vn/cdn-dev/file/8a07bee1eeff17a14eee.jpg?path=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlUGF0aCI6Ii8yMDIwLzA4LzQ0YjNhYjQ4LTMwNGQtNDQ3NC05ZDk0LWNkNGVlMDQwOGNlMy5qcGciLCJmaWxlTmFtZSI6IjhhMDdiZWUxZWVmZjE3YTE0ZWVlLmpwZyIsImZpbGVTaXplIjoyNDg4MzcsImZpbGVUeXBlIjoiaW1hZ2UvanBlZyIsImlhdCI6MTU5ODI0NDMwMiwiZXhwIjo4Nzk5ODI0NDMwMn0.fow6O5fp2z3vieA9gom5RRwQ7xxwBx9_7X2Fe8T2YI0",<br />
|
|
1800
|
-
* "FileName": "8a07bee1eeff17a14eee.jpg",<br />
|
|
1801
|
-
* "FileSize": 248837,<br />
|
|
1802
|
-
* "KeyID": "W39OAD3YGLCWAQKV1D6PGEKNW4RLGVTZTUWLYEVFQ2QG8AOCXW",<br />
|
|
1803
|
-
* "CreateUserID": "LEMONADMIN",<br />
|
|
1804
|
-
* "CreateDate": "2020-08-24T11:54:04.307Z",<br />
|
|
1805
|
-
* "UserName": "Quản trị hệ thống"<br />
|
|
1806
|
-
* }, ...]
|
|
1796
|
+
/** List attachment:<br />
|
|
1797
|
+
* [{<br />
|
|
1798
|
+
* "AttachmentID": "ATT2U8O7YPTF1KSNCW3X",<br />
|
|
1799
|
+
* "URL": "https://apricot.diginet.com.vn/cdn-dev/file/8a07bee1eeff17a14eee.jpg?path=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmaWxlUGF0aCI6Ii8yMDIwLzA4LzQ0YjNhYjQ4LTMwNGQtNDQ3NC05ZDk0LWNkNGVlMDQwOGNlMy5qcGciLCJmaWxlTmFtZSI6IjhhMDdiZWUxZWVmZjE3YTE0ZWVlLmpwZyIsImZpbGVTaXplIjoyNDg4MzcsImZpbGVUeXBlIjoiaW1hZ2UvanBlZyIsImlhdCI6MTU5ODI0NDMwMiwiZXhwIjo4Nzk5ODI0NDMwMn0.fow6O5fp2z3vieA9gom5RRwQ7xxwBx9_7X2Fe8T2YI0",<br />
|
|
1800
|
+
* "FileName": "8a07bee1eeff17a14eee.jpg",<br />
|
|
1801
|
+
* "FileSize": 248837,<br />
|
|
1802
|
+
* "KeyID": "W39OAD3YGLCWAQKV1D6PGEKNW4RLGVTZTUWLYEVFQ2QG8AOCXW",<br />
|
|
1803
|
+
* "CreateUserID": "LEMONADMIN",<br />
|
|
1804
|
+
* "CreateDate": "2020-08-24T11:54:04.307Z",<br />
|
|
1805
|
+
* "UserName": "Quản trị hệ thống"<br />
|
|
1806
|
+
* }, ...]
|
|
1807
1807
|
*/
|
|
1808
1808
|
data: PropTypes.array,
|
|
1809
1809
|
|
|
@@ -1846,16 +1846,16 @@ Attachment.propTypes = {
|
|
|
1846
1846
|
/** Download attached event, if not it will use default. */
|
|
1847
1847
|
onDownload: PropTypes.func,
|
|
1848
1848
|
|
|
1849
|
-
/**
|
|
1850
|
-
* event when removed file(s)
|
|
1851
|
-
*
|
|
1852
|
-
* return data: {<br/>
|
|
1853
|
-
* attached: [Files] (insist old and all new files )<br/>
|
|
1854
|
-
* allNewAttached: [Files]<br/>
|
|
1855
|
-
* oldAttached: [Files]<br/>
|
|
1856
|
-
* removedAttached: [Files]<br/>
|
|
1857
|
-
* element: [NodeList (just removed)]<br/>
|
|
1858
|
-
* }
|
|
1849
|
+
/**
|
|
1850
|
+
* event when removed file(s)
|
|
1851
|
+
*
|
|
1852
|
+
* return data: {<br/>
|
|
1853
|
+
* attached: [Files] (insist old and all new files )<br/>
|
|
1854
|
+
* allNewAttached: [Files]<br/>
|
|
1855
|
+
* oldAttached: [Files]<br/>
|
|
1856
|
+
* removedAttached: [Files]<br/>
|
|
1857
|
+
* element: [NodeList (just removed)]<br/>
|
|
1858
|
+
* }
|
|
1859
1859
|
*/
|
|
1860
1860
|
onRemove: PropTypes.func,
|
|
1861
1861
|
|
|
@@ -653,7 +653,7 @@ Popover.propTypes = {
|
|
|
653
653
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
654
654
|
|
|
655
655
|
/** Specifies how close to the edge of the window the popover can appear. */
|
|
656
|
-
marginThreshold: PropTypes.
|
|
656
|
+
marginThreshold: PropTypes.number,
|
|
657
657
|
|
|
658
658
|
/** Callback fired when the component requests to be closed. */
|
|
659
659
|
onClose: PropTypes.func,
|
package/components/tab/tab.js
CHANGED