diginet-core-ui 1.3.73 → 1.3.74
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/MHRP29N0026.svg +13 -0
- package/assets/images/menu/dhr/MHRP29N0027.svg +14 -0
- package/assets/images/menu/dhr/MHRP29N0028.svg +15 -0
- 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 +18 -9
- package/components/avatar/index.js +1 -1
- package/components/badge/index.js +17 -9
- package/components/button/icon.js +33 -25
- package/components/button/index.js +25 -17
- package/components/card/body.js +12 -4
- package/components/card/extra.js +12 -4
- package/components/card/footer.js +12 -4
- package/components/card/header.js +12 -4
- package/components/card/index.js +12 -4
- package/components/chip/index.js +6 -6
- package/components/form-control/attachment/index.js +197 -192
- package/components/form-control/date-picker/index.js +4 -2
- package/components/form-control/date-range-picker/index.js +15 -8
- package/components/form-control/dropdown/index.js +34 -13
- package/components/form-control/input-base/index.js +505 -483
- package/components/form-control/label/index.js +27 -21
- package/components/form-control/text-input/index.js +4 -1
- package/components/grid/Col.js +8 -7
- package/components/grid/Container.js +16 -15
- package/components/grid/Row.js +16 -15
- package/components/grid/index.js +17 -36
- package/components/image/index.js +164 -0
- package/components/index.js +3 -1
- package/components/modal/body.js +12 -9
- package/components/modal/footer.js +22 -11
- package/components/modal/header.js +25 -13
- package/components/modal/index.js +32 -30
- package/components/modal/modal.js +29 -25
- package/components/others/option-wrapper/index.js +5 -18
- package/components/paging/page-info.js +45 -33
- package/components/paging/page-selector2.js +45 -33
- package/components/popover/body.js +14 -6
- package/components/popover/footer.js +15 -6
- package/components/popover/header.js +17 -7
- package/components/popover/index.js +242 -109
- package/components/status/index.js +12 -4
- package/components/tab/tab-container.js +29 -27
- package/components/tab/tab-header.js +33 -28
- package/components/tab/tab-panel.js +31 -27
- package/components/tab/tab.js +45 -35
- package/components/tree-view/index.js +108 -73
- package/components/typography/index.js +36 -25
- package/icons/basic.js +248 -0
- package/icons/effect.js +44 -36
- package/package.json +1 -1
- package/readme.md +40 -0
- package/styles/general.js +23 -0
- package/theme/index.js +1 -1
- package/theme/set-theme.js +2 -1
- package/utils/index.js +13 -10
- package/utils/useMediaQuery.js +4 -2
package/components/modal/body.js
CHANGED
|
@@ -4,18 +4,20 @@
|
|
|
4
4
|
import { memo, useMemo, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
|
-
import { borderBox, displayBlock, overflowAuto, positionRelative } from '../../styles/general';
|
|
7
|
+
import { border, borderBox, displayBlock, overflowAuto, parseWidthHeight, positionRelative } from '../../styles/general';
|
|
8
|
+
import { classNames } from '../../utils';
|
|
8
9
|
import theme from '../../theme/settings';
|
|
10
|
+
import { responsivePaddingCSS } from './header';
|
|
9
11
|
const {
|
|
10
12
|
colors: {
|
|
11
13
|
fill: {
|
|
12
14
|
'scrollbar-rest': scrollbarRest,
|
|
13
15
|
'scrollbar-active': scrollbarActive
|
|
14
16
|
}
|
|
15
|
-
}
|
|
16
|
-
spacing
|
|
17
|
+
}
|
|
17
18
|
} = theme;
|
|
18
19
|
const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
20
|
+
action = {},
|
|
19
21
|
children,
|
|
20
22
|
className,
|
|
21
23
|
id,
|
|
@@ -24,7 +26,9 @@ const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
24
26
|
const ref = useRef(null);
|
|
25
27
|
useImperativeHandle(reference, () => {
|
|
26
28
|
const currentRef = ref.current || {};
|
|
27
|
-
|
|
29
|
+
currentRef.element = ref.current;
|
|
30
|
+
const _instance = { ...action
|
|
31
|
+
}; // methods
|
|
28
32
|
|
|
29
33
|
_instance.__proto__ = {}; // hidden methods
|
|
30
34
|
|
|
@@ -34,7 +38,7 @@ const ModalBody = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
34
38
|
return useMemo(() => jsx("div", {
|
|
35
39
|
css: ModalBodyCSS,
|
|
36
40
|
id: id,
|
|
37
|
-
className:
|
|
41
|
+
className: classNames('DGN-UI-Modal-Body', className),
|
|
38
42
|
style: style,
|
|
39
43
|
ref: ref
|
|
40
44
|
}, children), [children, className, id, style]);
|
|
@@ -44,23 +48,22 @@ const ModalBodyCSS = css`
|
|
|
44
48
|
${positionRelative};
|
|
45
49
|
${borderBox};
|
|
46
50
|
${overflowAuto};
|
|
47
|
-
|
|
48
|
-
height: auto;
|
|
49
|
-
padding: ${spacing([2, 4])};
|
|
51
|
+
${parseWidthHeight('100%', 'auto')};
|
|
50
52
|
order: 2;
|
|
51
53
|
&::-webkit-scrollbar {
|
|
52
54
|
width: 24px;
|
|
53
55
|
}
|
|
54
56
|
&::-webkit-scrollbar-thumb {
|
|
57
|
+
${border(8, 'transparent')};
|
|
55
58
|
border-radius: 10px;
|
|
56
59
|
mix-blend-mode: normal;
|
|
57
60
|
background-color: ${scrollbarRest};
|
|
58
61
|
background-clip: content-box;
|
|
59
|
-
border: 8px solid transparent;
|
|
60
62
|
:hover {
|
|
61
63
|
background-color: ${scrollbarActive};
|
|
62
64
|
}
|
|
63
65
|
}
|
|
66
|
+
${responsivePaddingCSS};
|
|
64
67
|
`;
|
|
65
68
|
ModalBody.defaultProps = {
|
|
66
69
|
className: '',
|
|
@@ -5,20 +5,25 @@ import { memo, useMemo, useRef, forwardRef, useImperativeHandle } from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import { alignCenter, borderBox, flexRow, justifyEnd, positionRelative } from '../../styles/general';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
spacing
|
|
11
|
-
} = theme;
|
|
8
|
+
import { classNames } from '../../utils';
|
|
9
|
+
import { responsivePaddingCSS } from './header';
|
|
12
10
|
const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
11
|
+
action = {},
|
|
12
|
+
boxShadow,
|
|
13
13
|
children,
|
|
14
14
|
className,
|
|
15
15
|
id,
|
|
16
16
|
style
|
|
17
17
|
}, reference) => {
|
|
18
18
|
const ref = useRef(null);
|
|
19
|
+
|
|
20
|
+
const _ModalFooterCSS = ModalFooterCSS(boxShadow);
|
|
21
|
+
|
|
19
22
|
useImperativeHandle(reference, () => {
|
|
20
23
|
const currentRef = ref.current || {};
|
|
21
|
-
|
|
24
|
+
currentRef.element = ref.current;
|
|
25
|
+
const _instance = { ...action
|
|
26
|
+
}; // methods
|
|
22
27
|
|
|
23
28
|
_instance.__proto__ = {}; // hidden methods
|
|
24
29
|
|
|
@@ -26,14 +31,15 @@ const ModalFooter = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
26
31
|
return currentRef;
|
|
27
32
|
});
|
|
28
33
|
return useMemo(() => jsx("div", {
|
|
29
|
-
css:
|
|
34
|
+
css: _ModalFooterCSS,
|
|
30
35
|
id: id,
|
|
31
|
-
className:
|
|
36
|
+
className: classNames('DGN-UI-Modal-Footer', className),
|
|
32
37
|
style: style,
|
|
33
38
|
ref: ref
|
|
34
|
-
}, children), [children, className, id, style]);
|
|
39
|
+
}, children), [boxShadow, children, className, id, style]);
|
|
35
40
|
}));
|
|
36
|
-
|
|
41
|
+
|
|
42
|
+
const ModalFooterCSS = boxShadow => css`
|
|
37
43
|
${flexRow};
|
|
38
44
|
${positionRelative};
|
|
39
45
|
${alignCenter};
|
|
@@ -41,16 +47,21 @@ const ModalFooterCSS = css`
|
|
|
41
47
|
${borderBox};
|
|
42
48
|
width: 100%;
|
|
43
49
|
min-height: 56px;
|
|
44
|
-
padding: ${spacing([4, 6])};
|
|
45
50
|
border-radius: 0px 0px 4px 4px;
|
|
46
|
-
box-shadow:
|
|
51
|
+
box-shadow: ${boxShadow};
|
|
47
52
|
order: 3;
|
|
53
|
+
${responsivePaddingCSS};
|
|
48
54
|
`;
|
|
55
|
+
|
|
49
56
|
ModalFooter.defaultProps = {
|
|
57
|
+
boxShadow: '0px -1px 1px rgba(0, 0, 0, 0.25)',
|
|
50
58
|
className: '',
|
|
51
59
|
style: {}
|
|
52
60
|
};
|
|
53
61
|
ModalFooter.propTypes = {
|
|
62
|
+
/** The box-shadow of component. */
|
|
63
|
+
boxShadow: PropTypes.string,
|
|
64
|
+
|
|
54
65
|
/** The content of the component. */
|
|
55
66
|
children: PropTypes.node,
|
|
56
67
|
|
|
@@ -6,7 +6,8 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import ModalContext from './context';
|
|
8
8
|
import { ButtonIcon, Typography } from '../';
|
|
9
|
-
import { alignCenter, borderBox, flexRow, justifyBetween, positionRelative } from '../../styles/general';
|
|
9
|
+
import { alignCenter, borderBox, flexRow, justifyBetween, parseWidthHeight, positionRelative } from '../../styles/general';
|
|
10
|
+
import { classNames, handleBreakpoints } from '../../utils';
|
|
10
11
|
import theme from '../../theme/settings';
|
|
11
12
|
const {
|
|
12
13
|
colors: {
|
|
@@ -14,15 +15,25 @@ const {
|
|
|
14
15
|
headerbar
|
|
15
16
|
}
|
|
16
17
|
},
|
|
18
|
+
boxShadows: {
|
|
19
|
+
small: smallBoxShadow
|
|
20
|
+
},
|
|
17
21
|
spacing
|
|
18
22
|
} = theme;
|
|
23
|
+
export const responsivePaddingCSS = handleBreakpoints({
|
|
24
|
+
xs: 4,
|
|
25
|
+
md: 6
|
|
26
|
+
}, propValue => {
|
|
27
|
+
return `padding: ${spacing([4, propValue])};`;
|
|
28
|
+
});
|
|
19
29
|
const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
20
|
-
|
|
21
|
-
title,
|
|
22
|
-
className,
|
|
30
|
+
action = {},
|
|
23
31
|
children,
|
|
32
|
+
className,
|
|
33
|
+
id,
|
|
34
|
+
showClose,
|
|
24
35
|
style,
|
|
25
|
-
|
|
36
|
+
title
|
|
26
37
|
}, reference) => {
|
|
27
38
|
const modal = useContext(ModalContext);
|
|
28
39
|
const ref = useRef(null);
|
|
@@ -31,7 +42,9 @@ const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
31
42
|
|
|
32
43
|
useImperativeHandle(reference, () => {
|
|
33
44
|
const currentRef = ref.current || {};
|
|
34
|
-
|
|
45
|
+
currentRef.element = ref.current;
|
|
46
|
+
const _instance = { ...action
|
|
47
|
+
}; // methods
|
|
35
48
|
|
|
36
49
|
_instance.__proto__ = {}; // hidden methods
|
|
37
50
|
|
|
@@ -41,7 +54,7 @@ const ModalHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
41
54
|
return useMemo(() => jsx("div", {
|
|
42
55
|
css: _ModalHeaderCSS,
|
|
43
56
|
id: id,
|
|
44
|
-
className:
|
|
57
|
+
className: classNames('DGN-UI-Modal-Header', className),
|
|
45
58
|
style: style,
|
|
46
59
|
onMouseDown: modal.onMoveModal,
|
|
47
60
|
ref: ref
|
|
@@ -69,21 +82,20 @@ const ModalHeaderCSS = modal => css`
|
|
|
69
82
|
${justifyBetween};
|
|
70
83
|
${alignCenter};
|
|
71
84
|
${borderBox};
|
|
85
|
+
${parseWidthHeight('100%', 56)};
|
|
72
86
|
background-color: ${headerbar};
|
|
73
|
-
width: 100%;
|
|
74
|
-
height: 56px;
|
|
75
|
-
padding: ${spacing([4, 6])};
|
|
76
87
|
border-radius: 4px 4px 0px 0px;
|
|
77
|
-
box-shadow:
|
|
88
|
+
box-shadow: ${smallBoxShadow};
|
|
78
89
|
cursor: ${modal.onMoveModal ? 'move' : 'inherit'};
|
|
79
90
|
order: 1;
|
|
91
|
+
${responsivePaddingCSS};
|
|
80
92
|
`;
|
|
81
93
|
|
|
82
94
|
ModalHeader.defaultProps = {
|
|
83
|
-
title: '',
|
|
84
95
|
className: '',
|
|
96
|
+
showClose: true,
|
|
85
97
|
style: {},
|
|
86
|
-
|
|
98
|
+
title: ''
|
|
87
99
|
};
|
|
88
100
|
ModalHeader.propTypes = {
|
|
89
101
|
/** The content of the component. */
|
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
/* eslint-disable react/display-name */
|
|
2
|
-
import React, { memo,
|
|
2
|
+
import React, { forwardRef, memo, useImperativeHandle, useRef } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import Modal from './modal';
|
|
5
5
|
import Header from './header';
|
|
6
6
|
import Body from './body';
|
|
7
7
|
import Footer from './footer';
|
|
8
8
|
const ModalSample = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
9
|
-
|
|
10
|
-
style,
|
|
11
|
-
headerStyle,
|
|
9
|
+
action = {},
|
|
12
10
|
bodyStyle,
|
|
13
|
-
footerStyle,
|
|
14
|
-
refs,
|
|
15
11
|
children,
|
|
16
12
|
footer,
|
|
13
|
+
footerStyle,
|
|
14
|
+
headerStyle,
|
|
15
|
+
style,
|
|
16
|
+
title,
|
|
17
17
|
...props
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
}, reference) => {
|
|
19
|
+
const ref = useRef(null);
|
|
20
|
+
useImperativeHandle(reference, () => {
|
|
21
|
+
const currentRef = ref.current || {};
|
|
22
|
+
currentRef.element = ref.current;
|
|
23
|
+
const _instance = { ...action
|
|
24
|
+
}; // methods
|
|
25
|
+
|
|
26
|
+
_instance.__proto__ = {}; // hidden methods
|
|
22
27
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
28
|
+
currentRef.instance = _instance;
|
|
29
|
+
return currentRef;
|
|
30
|
+
});
|
|
26
31
|
return /*#__PURE__*/React.createElement(Modal, {
|
|
27
32
|
ref: ref,
|
|
28
33
|
style: style,
|
|
@@ -39,31 +44,28 @@ ModalSample.defaultProps = {
|
|
|
39
44
|
title: ''
|
|
40
45
|
};
|
|
41
46
|
ModalSample.propTypes = {
|
|
42
|
-
/**
|
|
43
|
-
|
|
47
|
+
/** Style inline of the body component. */
|
|
48
|
+
bodyStyle: PropTypes.object,
|
|
44
49
|
|
|
45
|
-
/**
|
|
46
|
-
|
|
50
|
+
/** The content of the body component. */
|
|
51
|
+
children: PropTypes.node,
|
|
47
52
|
|
|
48
|
-
/**
|
|
49
|
-
|
|
53
|
+
/** The content of the footer component. */
|
|
54
|
+
footer: PropTypes.node,
|
|
50
55
|
|
|
51
|
-
/**
|
|
56
|
+
/** Style inline of the footer component. */
|
|
52
57
|
footerStyle: PropTypes.object,
|
|
53
58
|
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/** title for header */
|
|
58
|
-
title: PropTypes.node,
|
|
59
|
+
/** Style inline of the header component. */
|
|
60
|
+
headerStyle: PropTypes.object,
|
|
59
61
|
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
+
/** Style inline of component. */
|
|
63
|
+
style: PropTypes.object,
|
|
62
64
|
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
+
/** The content of the header component. */
|
|
66
|
+
title: PropTypes.node,
|
|
65
67
|
|
|
66
|
-
/**
|
|
68
|
+
/** Any props else. */
|
|
67
69
|
props: PropTypes.any
|
|
68
70
|
};
|
|
69
71
|
export default ModalSample;
|
|
@@ -8,8 +8,9 @@ import { jsx, css } from '@emotion/core';
|
|
|
8
8
|
import useDelayUnmount from '../../utils/useDelayUnmount';
|
|
9
9
|
import ModalContext from './context';
|
|
10
10
|
import { animations } from '../../styles/animation';
|
|
11
|
-
import { borderBox, borderRadius4px, flexCol, flexRow, justifyCenter, parseWidth, positionFixed, positionRelative } from '../../styles/general';
|
|
11
|
+
import { borderBox, borderRadius4px, flexCol, flexRow, justifyCenter, parseWidth, parseWidthHeight, positionFixed, positionRelative } from '../../styles/general';
|
|
12
12
|
import theme from '../../theme/settings';
|
|
13
|
+
import { classNames } from '../../utils';
|
|
13
14
|
const {
|
|
14
15
|
colors: {
|
|
15
16
|
system: {
|
|
@@ -19,26 +20,28 @@ const {
|
|
|
19
20
|
typography: {
|
|
20
21
|
paragraph1
|
|
21
22
|
},
|
|
23
|
+
spacing,
|
|
22
24
|
zIndex: zIndexCORE
|
|
23
25
|
} = theme;
|
|
24
26
|
const fadeInDown = animations.fadeInDown;
|
|
25
27
|
const fadeOutUp = animations.fadeOutUp;
|
|
26
28
|
const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
29
|
+
action = {},
|
|
30
|
+
alignment,
|
|
31
|
+
autoFocus,
|
|
32
|
+
children,
|
|
33
|
+
className,
|
|
34
|
+
darkTheme,
|
|
35
|
+
dragAnyWhere,
|
|
27
36
|
id,
|
|
28
|
-
open,
|
|
29
37
|
moveable,
|
|
30
|
-
dragAnyWhere,
|
|
31
38
|
moveOutScreen,
|
|
32
|
-
style,
|
|
33
|
-
zIndex,
|
|
34
|
-
pressESCToClose,
|
|
35
|
-
darkTheme,
|
|
36
|
-
autoFocus,
|
|
37
39
|
onClose,
|
|
38
|
-
|
|
40
|
+
open,
|
|
41
|
+
pressESCToClose,
|
|
42
|
+
style,
|
|
39
43
|
width,
|
|
40
|
-
|
|
41
|
-
className
|
|
44
|
+
zIndex
|
|
42
45
|
}, reference) => {
|
|
43
46
|
const ref = useRef(null);
|
|
44
47
|
const overflow = useRef(null);
|
|
@@ -172,7 +175,9 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
172
175
|
}, [openState]);
|
|
173
176
|
useImperativeHandle(reference, () => {
|
|
174
177
|
const currentRef = ref.current || {};
|
|
175
|
-
|
|
178
|
+
currentRef.element = ref.current;
|
|
179
|
+
const _instance = { ...action
|
|
180
|
+
}; // methods
|
|
176
181
|
|
|
177
182
|
_instance.__proto__ = {}; // hidden methods
|
|
178
183
|
|
|
@@ -197,7 +202,7 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
197
202
|
css: _ModalBoxCSS,
|
|
198
203
|
ref: modalBoxRef,
|
|
199
204
|
onMouseDown: moveable && dragAnyWhere ? dragMouseDown : null,
|
|
200
|
-
className:
|
|
205
|
+
className: classNames('DGN-UI-Modal-Box', openState ? 'DGN-UI-Modal-Show' : 'DGN-UI-Modal-Hide', className),
|
|
201
206
|
style: style
|
|
202
207
|
}, jsx(ModalContext.Provider, {
|
|
203
208
|
value: {
|
|
@@ -210,19 +215,18 @@ const Modal = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
210
215
|
}
|
|
211
216
|
|
|
212
217
|
return null;
|
|
213
|
-
}, [
|
|
218
|
+
}, [children, className, dragAnyWhere, id, moveable, moveOutScreen, onClose, style, openState, showModal]);
|
|
214
219
|
}));
|
|
215
220
|
|
|
216
221
|
const ModalContainerCSS = (zIndex, alignment, darkTheme) => css`
|
|
217
222
|
${flexRow};
|
|
218
223
|
${positionFixed};
|
|
219
224
|
${justifyCenter};
|
|
225
|
+
${parseWidthHeight('100%', '100vh')};
|
|
220
226
|
z-index: ${zIndex};
|
|
221
227
|
align-items: ${alignment === 'top' ? 'inherit' : 'center'};
|
|
222
|
-
padding-top: ${alignment === 'top' ?
|
|
228
|
+
padding-top: ${alignment === 'top' ? spacing([3]) : 0};
|
|
223
229
|
background-color: ${darkTheme ? 'rgba(21, 26, 48, 0.5)' : 'transparent'};
|
|
224
|
-
width: 100%;
|
|
225
|
-
height: 100vh;
|
|
226
230
|
top: 0;
|
|
227
231
|
left: 0;
|
|
228
232
|
`;
|
|
@@ -256,18 +260,18 @@ const ModalBoxCSS = (width, moveable, dragAnyWhere) => css`
|
|
|
256
260
|
`;
|
|
257
261
|
|
|
258
262
|
Modal.defaultProps = {
|
|
263
|
+
alignment: 'top',
|
|
264
|
+
autoFocus: true,
|
|
265
|
+
className: '',
|
|
259
266
|
darkTheme: true,
|
|
260
|
-
open: false,
|
|
261
|
-
pressESCToClose: true,
|
|
262
|
-
moveable: false,
|
|
263
267
|
dragAnyWhere: false,
|
|
268
|
+
moveable: false,
|
|
264
269
|
moveOutScreen: false,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
width: '80%',
|
|
268
|
-
zIndex: zIndexCORE(),
|
|
270
|
+
open: false,
|
|
271
|
+
pressESCToClose: true,
|
|
269
272
|
style: {},
|
|
270
|
-
|
|
273
|
+
width: '80%',
|
|
274
|
+
zIndex: zIndexCORE()
|
|
271
275
|
};
|
|
272
276
|
Modal.propTypes = {
|
|
273
277
|
/** The component alignment. */
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import {
|
|
4
|
+
import { useState, forwardRef, useEffect } from 'react';
|
|
5
5
|
import { jsx } from '@emotion/core';
|
|
6
6
|
|
|
7
7
|
const OptionWrapper = WrappedComponent => {
|
|
8
8
|
return /*#__PURE__*/forwardRef((props, ref) => {
|
|
9
|
-
if (!ref) {
|
|
10
|
-
ref = useRef(null);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
9
|
const [options, setOptions] = useState({});
|
|
14
|
-
const componentRef = useRef(null);
|
|
15
10
|
|
|
16
11
|
const option = (option, optionValue) => {
|
|
17
12
|
if (typeof option === 'undefined') {
|
|
@@ -30,20 +25,12 @@ const OptionWrapper = WrappedComponent => {
|
|
|
30
25
|
useEffect(() => {
|
|
31
26
|
setOptions({});
|
|
32
27
|
}, [props]);
|
|
33
|
-
useImperativeHandle(ref, () => ({ ...componentRef.current,
|
|
34
|
-
instance: { ...componentRef.current.instance,
|
|
35
|
-
option
|
|
36
|
-
} // const currentRef = componentRef.current || {};
|
|
37
|
-
// const _instance = { ...componentRef.current.instance, option }; // methods
|
|
38
|
-
// _instance.__proto__ = { ...componentRef.current.instance?.__proto__ }; // hidden methods
|
|
39
|
-
// currentRef.instance = _instance;
|
|
40
|
-
// console.log('currentRef', currentRef.instance);
|
|
41
|
-
// return currentRef;
|
|
42
|
-
|
|
43
|
-
}));
|
|
44
28
|
return jsx(WrappedComponent, { ...props,
|
|
45
29
|
...options,
|
|
46
|
-
|
|
30
|
+
action: {
|
|
31
|
+
option
|
|
32
|
+
},
|
|
33
|
+
ref: ref
|
|
47
34
|
});
|
|
48
35
|
});
|
|
49
36
|
};
|
|
@@ -42,6 +42,7 @@ const getLastPage = (totalItems, itemsPerPage) => {
|
|
|
42
42
|
|
|
43
43
|
const delayOnInput = getGlobal('delayOnInput');
|
|
44
44
|
const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
45
|
+
action = {},
|
|
45
46
|
bgColor,
|
|
46
47
|
className,
|
|
47
48
|
currentPage,
|
|
@@ -213,23 +214,34 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
213
214
|
changeBy: 'itemsPerPage'
|
|
214
215
|
});
|
|
215
216
|
}, [itemsPerPageState]);
|
|
216
|
-
useImperativeHandle(reference, () =>
|
|
217
|
-
|
|
218
|
-
|
|
217
|
+
useImperativeHandle(reference, () => {
|
|
218
|
+
const currentRef = ref.current || {};
|
|
219
|
+
currentRef.element = ref.current;
|
|
220
|
+
const _instance = {
|
|
219
221
|
onChangePage: page => _onChangePage({
|
|
220
222
|
page: page,
|
|
221
223
|
changeBy: 'ref'
|
|
222
224
|
}),
|
|
223
225
|
onChangePerPage: per => _onChangePerPage(per),
|
|
224
|
-
setTotalItems: items => setTotalItemsState(items)
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
setTotalItems: items => setTotalItemsState(items),
|
|
227
|
+
...action
|
|
228
|
+
}; // methods
|
|
229
|
+
|
|
230
|
+
_instance.__proto__ = {}; // hidden methods
|
|
231
|
+
|
|
232
|
+
currentRef.instance = _instance;
|
|
233
|
+
|
|
234
|
+
currentRef.onChangePage = page => _onChangePage({
|
|
227
235
|
page: page,
|
|
228
236
|
changeBy: 'ref'
|
|
229
|
-
})
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
currentRef.onChangePerPage = per => _onChangePerPage(per);
|
|
240
|
+
|
|
241
|
+
currentRef.setTotalItems = items => setTotalItemsState(items);
|
|
242
|
+
|
|
243
|
+
return currentRef;
|
|
244
|
+
});
|
|
233
245
|
|
|
234
246
|
const updateSize = () => {
|
|
235
247
|
if (timer.current) {
|
|
@@ -589,23 +601,23 @@ PagingInfo.propTypes = {
|
|
|
589
601
|
/** Callback fired when quantity on per page changed. */
|
|
590
602
|
onChangePerPage: PropTypes.func,
|
|
591
603
|
|
|
592
|
-
/**
|
|
593
|
-
* Callback fired when page number is changing.
|
|
594
|
-
*
|
|
595
|
-
* * prevPage: Page before changed
|
|
596
|
-
* * newPage: Page after changed
|
|
597
|
-
* * cancel(value): Function cancel change page
|
|
598
|
-
* * @param {value} - bool
|
|
604
|
+
/**
|
|
605
|
+
* Callback fired when page number is changing.
|
|
606
|
+
*
|
|
607
|
+
* * prevPage: Page before changed
|
|
608
|
+
* * newPage: Page after changed
|
|
609
|
+
* * cancel(value): Function cancel change page
|
|
610
|
+
* * @param {value} - bool
|
|
599
611
|
*/
|
|
600
612
|
onChangingPage: PropTypes.func,
|
|
601
613
|
|
|
602
|
-
/**
|
|
603
|
-
* Callback fired when quantity on item per page is changing.
|
|
604
|
-
*
|
|
605
|
-
* * prevPerPage: Items per page before changed
|
|
606
|
-
* * newPerPage: Items per page after changed
|
|
607
|
-
* * cancel(value): Function cancel change items per page
|
|
608
|
-
* * @param {value} - bool
|
|
614
|
+
/**
|
|
615
|
+
* Callback fired when quantity on item per page is changing.
|
|
616
|
+
*
|
|
617
|
+
* * prevPerPage: Items per page before changed
|
|
618
|
+
* * newPerPage: Items per page after changed
|
|
619
|
+
* * cancel(value): Function cancel change items per page
|
|
620
|
+
* * @param {value} - bool
|
|
609
621
|
*/
|
|
610
622
|
onChangingPerPage: PropTypes.func,
|
|
611
623
|
|
|
@@ -618,15 +630,15 @@ PagingInfo.propTypes = {
|
|
|
618
630
|
/** Compact type for mobile. */
|
|
619
631
|
typeShort: PropTypes.bool,
|
|
620
632
|
|
|
621
|
-
/**
|
|
622
|
-
* ref methods (ref.current.instance.*method*)
|
|
623
|
-
*
|
|
624
|
-
* * onChangePage(page): Change page number
|
|
625
|
-
* * @param {page} - number
|
|
626
|
-
* * onChangePerPage(per): Change quantity on per page
|
|
627
|
-
* * @param {per} - number
|
|
628
|
-
* * setTotalItems(items): Set total items
|
|
629
|
-
* * @param {items} - number
|
|
633
|
+
/**
|
|
634
|
+
* ref methods (ref.current.instance.*method*)
|
|
635
|
+
*
|
|
636
|
+
* * onChangePage(page): Change page number
|
|
637
|
+
* * @param {page} - number
|
|
638
|
+
* * onChangePerPage(per): Change quantity on per page
|
|
639
|
+
* * @param {per} - number
|
|
640
|
+
* * setTotalItems(items): Set total items
|
|
641
|
+
* * @param {items} - number
|
|
630
642
|
*/
|
|
631
643
|
reference: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
632
644
|
current: PropTypes.instanceOf(Element)
|