diginet-core-ui 1.3.24 → 1.3.29
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/fonts/SF-Pro-Display-Bold.otf +0 -0
- package/assets/fonts/SF-Pro-Display-Medium.otf +0 -0
- package/assets/fonts/SF-Pro-Display-Regular.otf +0 -0
- package/assets/images/icons/wifi.svg +3 -0
- package/assets/images/menu/dhr/MHRM09N0004.svg +14 -0
- package/assets/images/menu/dhr/MHRP09N0028.svg +6 -0
- package/assets/images/menu/dhr/MHRP09N0029.svg +14 -0
- package/assets/images/menu/dhr/MHRP09N0030.svg +4 -0
- package/assets/images/menu/dhr/MHRP09N0031.svg +5 -0
- package/assets/images/menu/dhr/MHRP29N0012.svg +7 -0
- package/assets/images/menu/dhr/MHRP29N0021.svg +8 -0
- package/assets/images/menu/dhr/MHRP29N0022.svg +9 -0
- package/assets/images/menu/dhr/MHRP29N0023.svg +22 -0
- package/assets/images/menu/dhr/MHRP39N0015.svg +5 -0
- package/assets/images/menu/dhr/TASK.svg +9 -0
- package/assets/images/menu/erp/D05.svg +8 -0
- package/assets/images/menu/erp/D06.svg +4 -0
- package/assets/images/menu/erp/D90R.svg +9 -0
- package/assets/images/menu/erp/DBC.svg +9 -0
- package/assets/images/menu/erp/{W05F0006.svg → W05F0006N0000.svg} +0 -0
- package/assets/images/menu/erp/{W05F0008.svg → W05F0008N0000.svg} +0 -0
- package/assets/images/menu/erp/{W05F4000.svg → W05F4000N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0005.svg → W06F0005N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0006.svg → W06F0006N0000.svg} +0 -0
- package/assets/images/menu/erp/{W06F0008.svg → W06F0008N0000.svg} +0 -0
- package/assets/images/menu/erp/W94F1000N0000.svg +9 -0
- package/assets/images/menu/erp/W94F1000N0001.svg +9 -0
- package/components/accordion/css.js +42 -33
- package/components/accordion/details.js +29 -17
- package/components/accordion/group.js +23 -23
- package/components/accordion/index.js +36 -27
- package/components/accordion/summary.js +10 -11
- package/components/alert/index.js +97 -91
- package/components/alert/notify.js +10 -8
- package/components/avatar/index.js +19 -17
- package/components/badge/index.js +122 -139
- package/components/button/icon.js +242 -334
- package/components/button/index.js +272 -427
- package/components/button/more.js +4 -5
- package/components/button/ripple-effect.js +4 -6
- package/components/card/body-card.js +4 -6
- package/components/card/card.js +4 -8
- package/components/card/index.js +4 -5
- package/components/chart/Pie/Sector.js +4 -5
- package/components/chart/Pie/Sectors.js +5 -5
- package/components/chart/Pie/index.js +8 -9
- package/components/chart/Pie-v2/Sector.js +4 -5
- package/components/chart/Pie-v2/Sectors.js +7 -8
- package/components/chart/Pie-v2/index.js +11 -16
- package/components/chart/bar/Bar.js +2 -3
- package/components/chart/bar/Labels.js +9 -11
- package/components/chart/bar/index.js +17 -9
- package/components/chart/bar-v2/Bar.js +2 -3
- package/components/chart/bar-v2/Labels.js +9 -11
- package/components/chart/bar-v2/index.js +17 -9
- package/components/chart/line/Labels.js +8 -10
- package/components/chart/line/Point.js +2 -3
- package/components/chart/line/index.js +17 -9
- package/components/chart/line-v2/Labels.js +8 -10
- package/components/chart/line-v2/Point.js +2 -3
- package/components/chart/line-v2/index.js +17 -9
- package/components/chip/attach.js +12 -16
- package/components/chip/index.js +8 -11
- package/components/collapse/index.js +4 -5
- package/components/divider/index.js +27 -14
- package/components/form-control/attachment/index.js +143 -87
- package/components/form-control/calendar/function.js +24 -23
- package/components/form-control/calendar/index.js +2 -4
- package/components/form-control/calendar/range.js +3 -4
- package/components/form-control/checkbox/index.js +85 -71
- package/components/form-control/control/index.js +4 -6
- package/components/form-control/date-picker/index-old.js +0 -2
- package/components/form-control/date-picker/index.js +39 -43
- package/components/form-control/date-range-picker/index.js +26 -28
- package/components/form-control/dropdown/index.js +173 -202
- package/components/form-control/dropdown-box/index.js +72 -49
- package/components/form-control/form-group/index.js +4 -5
- package/components/form-control/helper-text/index.js +4 -5
- package/components/form-control/input-base/index.js +28 -38
- package/components/form-control/label/index.js +23 -13
- package/components/form-control/money-input/index.js +6 -6
- package/components/form-control/number-input/index.js +12 -14
- package/components/form-control/phone-input/index.js +4 -5
- package/components/form-control/radio/index.js +7 -15
- package/components/form-control/text-input/index.js +14 -24
- package/components/form-control/time-picker/index.js +15 -26
- package/components/form-control/time-picker/swiper.js +2 -4
- package/components/form-control/toggle/index.js +22 -18
- package/components/form-view/helper-text.js +4 -5
- package/components/form-view/index.js +4 -5
- package/components/form-view/input.js +5 -7
- package/components/form-view/label.js +2 -6
- package/components/list/list-item-action.js +7 -8
- package/components/list/list-item-icon.js +4 -5
- package/components/list/list-item-text.js +4 -5
- package/components/list/list-item.js +4 -5
- package/components/list/list.js +4 -5
- package/components/list/sub-header.js +4 -5
- package/components/modal/body.js +4 -6
- package/components/modal/footer.js +4 -6
- package/components/modal/header.js +8 -14
- package/components/modal/index.js +4 -5
- package/components/modal/modal.js +6 -13
- package/components/others/extra/index.js +4 -8
- package/components/others/option-wrapper/index.js +57 -0
- package/components/others/scrollbar/index.js +4 -5
- package/components/paging/page-info.js +282 -231
- package/components/paging/page-selector.js +4 -7
- package/components/popover/index.js +6 -7
- package/components/popup/danger_popup.js +8 -18
- package/components/popup/index.js +26 -34
- package/components/popup/proposals_popup.js +9 -16
- package/components/popup/v2/danger-popup.js +4 -6
- package/components/popup/v2/index.js +116 -98
- package/components/popup/v2/info-popup.js +4 -6
- package/components/popup/v2/success-popup.js +4 -6
- package/components/popup/v2/warning-popup.js +4 -6
- package/components/popup/v2/yes-no-popup.js +4 -6
- package/components/progress/circular.js +17 -26
- package/components/progress/linear.js +11 -13
- package/components/rating/index.js +114 -233
- package/components/slider/slider-container.js +15 -10
- package/components/slider/slider-item.js +10 -12
- package/components/status/index.js +63 -57
- package/components/tab/tab-container.js +26 -24
- package/components/tab/tab-header.js +36 -27
- package/components/tab/tab-panel.js +32 -15
- package/components/tab/tab.js +79 -80
- package/components/tooltip/index.js +4 -4
- package/components/transfer/index.js +10 -11
- package/components/tree-view/css.js +2 -0
- package/components/tree-view/index.js +14 -13
- package/components/typography/index.js +6 -112
- package/css/styles.css +1 -1
- package/css/styles.css.map +1 -1
- package/global/index.js +2 -0
- package/icons/basic.js +1648 -959
- package/icons/effect.js +45 -103
- package/package.json +1 -1
- package/readme.md +66 -0
- package/styles/color-helper.js +7 -146
- package/styles/colors.js +6 -2
- package/styles/font.js +9 -0
- package/styles/general.js +100 -7
- package/styles/typography.js +25 -26
- package/theme/settings.js +9 -2
- package/theme/theme-provider.js +15 -7
- package/theme/with-styles.js +2 -4
- package/theme/with-theme.js +2 -4
- package/utils/isMobile.js +21 -0
- package/utils/renderHTML.js +4 -5
- package/utils/renderIcon.js +15 -11
- package/utils/updatePosition.js +2 -2
|
@@ -1,275 +1,332 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
6
|
-
import { memo, useRef, useEffect, useMemo, forwardRef
|
|
4
|
+
import { memo, useState, useRef, useEffect, useMemo, forwardRef, useImperativeHandle } from 'react';
|
|
7
5
|
import PropTypes from 'prop-types';
|
|
8
6
|
import { jsx, css } from '@emotion/core';
|
|
9
|
-
import
|
|
10
|
-
import { Typography } from '../';
|
|
11
|
-
import { ArrowLeft, ArrowRight } from '../../icons';
|
|
12
|
-
import locale from '../../locale';
|
|
7
|
+
import { ButtonIcon, NumberInput, Dropdown } from '../';
|
|
13
8
|
import { getGlobal } from '../../global';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
import { typography } from '../../styles/typography';
|
|
10
|
+
import { color as colors } from '../../styles/colors';
|
|
11
|
+
import { alignCenter, borderBox, borderRadius4px, flexRow, noMargin, noPadding, border, textCenter, outlineNone, backgroundTransparent, cursorPointer } from '../../styles/general';
|
|
12
|
+
import { hexToRGBA } from '../../styles/color-helper';
|
|
13
|
+
const {
|
|
14
|
+
paragraph2
|
|
15
|
+
} = typography;
|
|
16
|
+
const {
|
|
17
|
+
system: {
|
|
18
|
+
active
|
|
19
|
+
},
|
|
20
|
+
semantic: {
|
|
21
|
+
info
|
|
22
|
+
},
|
|
23
|
+
line: {
|
|
24
|
+
system,
|
|
25
|
+
normal
|
|
26
|
+
},
|
|
27
|
+
text: {
|
|
28
|
+
main
|
|
29
|
+
}
|
|
30
|
+
} = colors;
|
|
31
|
+
|
|
32
|
+
const getLastPage = (totalItems, itemsPerPage) => {
|
|
33
|
+
let _lastPage = 0;
|
|
34
|
+
|
|
35
|
+
if (totalItems && totalItems >= 0 && itemsPerPage && itemsPerPage > 0) {
|
|
36
|
+
_lastPage = Math.ceil(totalItems / itemsPerPage);
|
|
37
|
+
return _lastPage;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return _lastPage + 1;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
let timeout = null;
|
|
44
|
+
const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
45
|
+
typeShort,
|
|
18
46
|
bgColor,
|
|
19
47
|
style,
|
|
20
|
-
|
|
21
|
-
currentPage,
|
|
48
|
+
className,
|
|
22
49
|
totalItems,
|
|
23
50
|
itemsPerPage,
|
|
24
|
-
|
|
51
|
+
currentPage,
|
|
52
|
+
listPerPage,
|
|
25
53
|
onChangePage,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
54
|
+
onChangePerPage
|
|
55
|
+
}, ref) => {
|
|
56
|
+
if (!ref) {
|
|
57
|
+
ref = useRef(null);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const [totalItemsState, setTotalItemsState] = useState(totalItems);
|
|
61
|
+
const [itemsPerPageState, setItemsPerPageState] = useState(itemsPerPage || listPerPage[0] || 10);
|
|
62
|
+
const [currentPageState, setCurrentPageState] = useState(currentPage);
|
|
63
|
+
const [listPerPageState, setListPerPageState] = useState(listPerPage);
|
|
64
|
+
const [disablePrevState, setDisablePrevState] = useState(true);
|
|
65
|
+
const [disableNextState, setDisableNextState] = useState(!(totalItems > itemsPerPage));
|
|
33
66
|
const pagingInfo = css`
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
67
|
+
${flexRow}
|
|
68
|
+
${alignCenter}
|
|
69
|
+
${paragraph2}
|
|
70
|
+
${borderBox}
|
|
71
|
+
${border(1, system)}
|
|
72
|
+
height: 40px;
|
|
73
|
+
border-left: none;
|
|
74
|
+
border-right: none;
|
|
75
|
+
padding: 4px 0;
|
|
38
76
|
background-color: ${bgColor};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
color: ${main};
|
|
78
|
+
.inputPage {
|
|
79
|
+
${noMargin}
|
|
80
|
+
${textCenter}
|
|
81
|
+
width: 1%;
|
|
82
|
+
min-width: 24px;
|
|
83
|
+
.DGN-UI-InputBase {
|
|
84
|
+
${noPadding}
|
|
85
|
+
input {
|
|
86
|
+
${paragraph2}
|
|
87
|
+
${textCenter}
|
|
88
|
+
color: ${active};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
.slash {
|
|
93
|
+
margin: 0 4px;
|
|
94
|
+
}
|
|
95
|
+
.txt-line-number {
|
|
96
|
+
margin-left: 16px;
|
|
97
|
+
}
|
|
98
|
+
.DGN-UI-Dropdown {
|
|
99
|
+
margin-bottom: 0;
|
|
100
|
+
margin-left: ${typeShort ? 0 : '8px'};
|
|
101
|
+
min-width: 56px;
|
|
102
|
+
.DGN-UI-Dropdown-Form {
|
|
103
|
+
min-height: 32px;
|
|
104
|
+
padding: 0 0 0 8px;
|
|
105
|
+
input {
|
|
106
|
+
${paragraph2}
|
|
107
|
+
${noPadding}
|
|
108
|
+
${cursorPointer}
|
|
109
|
+
}
|
|
110
|
+
.DGN-UI-Dropdown-Icon {
|
|
111
|
+
margin-left: 6px;
|
|
112
|
+
margin-right: 6px;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/* .pagePer {
|
|
117
|
+
${borderRadius4px}
|
|
118
|
+
${borderBox}
|
|
119
|
+
${paragraph2}
|
|
120
|
+
${outlineNone}
|
|
121
|
+
${backgroundTransparent}
|
|
122
|
+
${border(1, normal)}
|
|
123
|
+
color: ${active};
|
|
124
|
+
margin-left: ${typeShort ? 0 : '8px'};
|
|
125
|
+
padding: 6px 6px 6px 8px;
|
|
126
|
+
min-width: 56px;
|
|
127
|
+
min-height: 32px;
|
|
128
|
+
width: max-content;
|
|
129
|
+
&:hover {
|
|
130
|
+
border-color: ${active};
|
|
131
|
+
background-color: ${hexToRGBA(active, 0.8)};
|
|
132
|
+
}
|
|
133
|
+
&:active,
|
|
134
|
+
&:focus {
|
|
135
|
+
border-color: ${info};
|
|
136
|
+
}
|
|
137
|
+
option {
|
|
138
|
+
${paragraph2}
|
|
139
|
+
color: ${active};
|
|
140
|
+
background-color: white;
|
|
141
|
+
}
|
|
142
|
+
} */
|
|
143
|
+
.total-items {
|
|
144
|
+
margin-left: ${typeShort ? 0 : '16px'};
|
|
66
145
|
}
|
|
67
|
-
`;
|
|
68
|
-
const lineNumberStyle = css`
|
|
69
|
-
display: inline-flex;
|
|
70
|
-
outline: none;
|
|
71
|
-
color: ${theme.colors.input};
|
|
72
|
-
margin: 0 16px;
|
|
73
|
-
font-family: inherit;
|
|
74
|
-
`;
|
|
75
|
-
const listItemsPerPageStyle = css`
|
|
76
|
-
height: 19px;
|
|
77
|
-
min-width: 44px;
|
|
78
|
-
width: max-content;
|
|
79
|
-
font-family: inherit;
|
|
80
|
-
font-style: normal;
|
|
81
|
-
font-weight: 500;
|
|
82
|
-
font-size: inherit;
|
|
83
|
-
color: ${theme.colors.primary};
|
|
84
|
-
background-color: inherit;
|
|
85
|
-
border: none;
|
|
86
|
-
outline: none;
|
|
87
146
|
`;
|
|
88
147
|
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (newPage < 1 || newPage > lastPage) return;
|
|
94
|
-
pageNumberRef.current.textContent = newPage;
|
|
95
|
-
currentPageNumber = newPage;
|
|
96
|
-
!!onChangePage && onChangePage(newPage);
|
|
97
|
-
};
|
|
148
|
+
const _onChangePage = (page, isInit = false) => {
|
|
149
|
+
const lastPage = getLastPage(totalItemsState, itemsPerPageState);
|
|
150
|
+
let disablePrev = false;
|
|
151
|
+
let disableNext = false; // If last page = 1. Disable all
|
|
98
152
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
timer = setTimeout(() => {
|
|
104
|
-
if (value !== '' && !isNaN(value)) {
|
|
105
|
-
if (value.includes('.')) {
|
|
106
|
-
const index = value.indexOf('.');
|
|
107
|
-
|
|
108
|
-
if (index !== -1) {
|
|
109
|
-
value = value.slice(0, index);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
153
|
+
if (lastPage === 1) {
|
|
154
|
+
disablePrev = true;
|
|
155
|
+
disableNext = true;
|
|
156
|
+
} // If current page = last page. Disable Next and Last
|
|
112
157
|
|
|
113
|
-
if (+value < 0) {
|
|
114
|
-
value = -value;
|
|
115
|
-
} else if (+value === 0) {
|
|
116
|
-
value = 1;
|
|
117
|
-
}
|
|
118
158
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
} else {
|
|
123
|
-
value = currentPage;
|
|
124
|
-
}
|
|
159
|
+
if (page + 1 >= lastPage) {
|
|
160
|
+
disableNext = true;
|
|
161
|
+
} // If current page = 0. Disable Previous and First
|
|
125
162
|
|
|
126
|
-
pageNumberRef.current.textContent = +value;
|
|
127
163
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
164
|
+
if (page === 0) {
|
|
165
|
+
disablePrev = true;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
setCurrentPageState(page);
|
|
169
|
+
setDisablePrevState(disablePrev);
|
|
170
|
+
setDisableNextState(disableNext);
|
|
171
|
+
if (onChangePage && !isInit) onChangePage(page);
|
|
133
172
|
};
|
|
134
173
|
|
|
135
|
-
const
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
pageNumberRef.current.parentNode.lastChild.textContent = '/ ' + newLastPage;
|
|
174
|
+
const _onChangePerPage = per => {
|
|
175
|
+
const lastPage = getLastPage(totalItemsState, per);
|
|
176
|
+
per = parseInt(per, 10);
|
|
177
|
+
let disableNext = false; // If last page = 1. Disable all
|
|
140
178
|
|
|
141
|
-
if (
|
|
142
|
-
|
|
179
|
+
if (lastPage === 1) {
|
|
180
|
+
disableNext = true;
|
|
143
181
|
}
|
|
144
182
|
|
|
145
|
-
|
|
183
|
+
setItemsPerPageState(per);
|
|
184
|
+
setCurrentPageState(0);
|
|
185
|
+
setDisablePrevState(true);
|
|
186
|
+
setDisableNextState(disableNext);
|
|
187
|
+
if (onChangePerPage) onChangePerPage(per);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const onTypePaging = (value, isInit = false) => {
|
|
191
|
+
clearTimeout(timeout);
|
|
192
|
+
const lastPage = getLastPage(totalItemsState, itemsPerPageState);
|
|
193
|
+
const page = !value || parseInt(value) < 0 ? 1 : parseInt(value) > lastPage ? lastPage : parseInt(value);
|
|
194
|
+
currentPage = page - 1;
|
|
195
|
+
timeout = setTimeout(() => {
|
|
196
|
+
_onChangePage(page - 1, isInit);
|
|
197
|
+
}, 500);
|
|
146
198
|
};
|
|
147
199
|
|
|
148
200
|
const checkKeyPress = e => {
|
|
149
|
-
if (
|
|
201
|
+
if (/,/.test(e.key)) {
|
|
150
202
|
e.preventDefault();
|
|
151
203
|
}
|
|
152
204
|
};
|
|
153
205
|
|
|
154
206
|
useEffect(() => {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
ItemsPerPageRef.current.value = itemsPerPageInput;
|
|
165
|
-
totalItemRef.current.textContent = totalItems;
|
|
207
|
+
setTotalItemsState(totalItems);
|
|
208
|
+
}, [totalItems]);
|
|
209
|
+
useEffect(() => {
|
|
210
|
+
timeout = setTimeout(() => {
|
|
211
|
+
_onChangePage(0, true);
|
|
212
|
+
}, 500);
|
|
213
|
+
}, [totalItemsState, itemsPerPageState]);
|
|
214
|
+
useEffect(() => {
|
|
215
|
+
setItemsPerPageState(itemsPerPage);
|
|
166
216
|
}, [itemsPerPage]);
|
|
167
217
|
useEffect(() => {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
218
|
+
setCurrentPageState(currentPage);
|
|
219
|
+
onTypePaging(currentPage + 1, true);
|
|
220
|
+
}, [currentPage]);
|
|
221
|
+
useEffect(() => {
|
|
222
|
+
setListPerPageState(listPerPage);
|
|
223
|
+
}, [listPerPage]);
|
|
224
|
+
useImperativeHandle(ref, () => {
|
|
225
|
+
const currentRef = ref.current || {};
|
|
171
226
|
|
|
172
|
-
|
|
173
|
-
onChangePageHandler(newLastPage - currentPageInput);
|
|
174
|
-
}
|
|
227
|
+
currentRef.onChangePage = page => _onChangePage(page);
|
|
175
228
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
onChangePageHandler(lastPage - +currentPageInput);
|
|
190
|
-
} else if (currentPage < 1) {
|
|
191
|
-
pageNumberRef.current.textContent = 1;
|
|
192
|
-
!!onChangePage && onChangePage(1);
|
|
193
|
-
} else {
|
|
194
|
-
pageNumberRef.current.textContent = currentPage;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}, [currentPage]);
|
|
198
|
-
const TotalPageComp = useMemo(() => {
|
|
199
|
-
return jsx("div", {
|
|
200
|
-
css: totalPage
|
|
201
|
-
}, jsx("div", {
|
|
202
|
-
css: iconPageCss,
|
|
203
|
-
onClick: () => onChangePageHandler(-1)
|
|
204
|
-
}, jsx(ArrowLeft, {
|
|
205
|
-
height: size === 'small' ? 20 : 24,
|
|
206
|
-
width: size === 'small' ? 20 : 24,
|
|
207
|
-
viewBox: true
|
|
208
|
-
})), jsx("div", {
|
|
209
|
-
css: pageNumber
|
|
210
|
-
}, jsx("div", {
|
|
211
|
-
ref: pageNumberRef,
|
|
212
|
-
css: currentPageNum,
|
|
213
|
-
contentEditable: true,
|
|
214
|
-
onInput: onChangePageNumber,
|
|
215
|
-
onKeyDown: checkKeyPress
|
|
216
|
-
}), jsx("span", null)), jsx("div", {
|
|
217
|
-
css: iconPageCss,
|
|
218
|
-
onClick: () => onChangePageHandler(1)
|
|
219
|
-
}, jsx(ArrowRight, {
|
|
220
|
-
height: size === 'small' ? 20 : 24,
|
|
221
|
-
width: size === 'small' ? 20 : 24,
|
|
222
|
-
viewBox: true
|
|
223
|
-
})));
|
|
224
|
-
}, [size]);
|
|
225
|
-
const LineNumber = useMemo(() => {
|
|
229
|
+
currentRef.onChangePerPage = per => _onChangePerPage(per);
|
|
230
|
+
|
|
231
|
+
currentRef.setTotalItems = items => setTotalItemsState(items);
|
|
232
|
+
|
|
233
|
+
return currentRef;
|
|
234
|
+
});
|
|
235
|
+
return useMemo(() => {
|
|
236
|
+
const lastPage = getLastPage(totalItemsState, itemsPerPageState);
|
|
237
|
+
let listPerPageData = [];
|
|
238
|
+
listPerPageState.map(item => listPerPageData = [...listPerPageData, {
|
|
239
|
+
name: item,
|
|
240
|
+
id: item
|
|
241
|
+
}]);
|
|
226
242
|
return jsx("div", {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
243
|
+
ref: ref,
|
|
244
|
+
css: pagingInfo,
|
|
245
|
+
style: style,
|
|
246
|
+
className: ['DGN-UI-PageInfo', className].join(' ').trim().replace(/\s+/g, ' ')
|
|
247
|
+
}, jsx(ButtonIcon, {
|
|
248
|
+
circular: true,
|
|
249
|
+
viewType: 'text',
|
|
250
|
+
size: 'small',
|
|
251
|
+
name: 'ArrowDoubleLeft',
|
|
252
|
+
disabled: disablePrevState,
|
|
253
|
+
onClick: () => _onChangePage(0)
|
|
254
|
+
}), jsx(ButtonIcon, {
|
|
255
|
+
circular: true,
|
|
256
|
+
viewType: 'text',
|
|
257
|
+
size: 'small',
|
|
258
|
+
name: 'ArrowLeft',
|
|
259
|
+
disabled: disablePrevState,
|
|
260
|
+
onClick: () => _onChangePage(currentPageState - 1)
|
|
261
|
+
}), jsx(NumberInput, {
|
|
262
|
+
disabledNegative: true,
|
|
263
|
+
className: 'inputPage',
|
|
264
|
+
value: currentPageState ? String(currentPageState + 1) : '1',
|
|
265
|
+
min: 1,
|
|
266
|
+
max: lastPage,
|
|
267
|
+
onKeyDown: checkKeyPress,
|
|
268
|
+
onChange: e => onTypePaging(e === null || e === void 0 ? void 0 : e.value)
|
|
269
|
+
}), "/", ` ${lastPage}`, jsx(ButtonIcon, {
|
|
270
|
+
circular: true,
|
|
271
|
+
viewType: 'text',
|
|
272
|
+
size: 'small',
|
|
273
|
+
name: 'ArrowRight',
|
|
274
|
+
disabled: disableNextState,
|
|
275
|
+
onClick: () => _onChangePage(currentPageState + 1)
|
|
276
|
+
}), jsx(ButtonIcon, {
|
|
277
|
+
circular: true,
|
|
278
|
+
viewType: 'text',
|
|
279
|
+
size: 'small',
|
|
280
|
+
name: 'ArrowDoubleRight',
|
|
281
|
+
disabled: disableNextState,
|
|
282
|
+
onClick: () => _onChangePage(lastPage - 1)
|
|
283
|
+
}), typeShort && jsx("span", {
|
|
284
|
+
className: 'slash'
|
|
285
|
+
}, "|"), !typeShort && jsx("span", {
|
|
286
|
+
className: "txt-line-number"
|
|
287
|
+
}, getGlobal('lineNumber')), jsx(Dropdown, {
|
|
288
|
+
viewType: 'outlined',
|
|
289
|
+
dataSource: listPerPageData,
|
|
290
|
+
defaultValue: itemsPerPageState,
|
|
291
|
+
onChange: e => _onChangePerPage(e === null || e === void 0 ? void 0 : e.value),
|
|
292
|
+
inputStyle: {
|
|
293
|
+
width: `${Math.max(...listPerPageState).toString().length}ch`
|
|
294
|
+
},
|
|
295
|
+
inputProps: {
|
|
296
|
+
readOnly: true
|
|
297
|
+
} // dropdownItemStyle={{padding: '4px 8px', minHeight: 18, color: active}}
|
|
298
|
+
,
|
|
299
|
+
dropdownItemStyle: {
|
|
300
|
+
color: active
|
|
301
|
+
}
|
|
302
|
+
}), typeShort && jsx("span", {
|
|
303
|
+
className: 'slash'
|
|
304
|
+
}, "|"), jsx("span", {
|
|
305
|
+
className: 'total-items'
|
|
306
|
+
}, !typeShort ? getGlobal('total') + ':' : '', " ", totalItemsState));
|
|
307
|
+
}, [typeShort, bgColor, style, className, totalItemsState, itemsPerPageState, currentPageState, listPerPageState, disablePrevState, disableNextState]);
|
|
308
|
+
}));
|
|
251
309
|
PagingInfo.defaultProps = {
|
|
252
|
-
|
|
310
|
+
typeShort: false,
|
|
253
311
|
bgColor: '#FFF',
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
currentPage: 1,
|
|
312
|
+
style: {},
|
|
313
|
+
className: '',
|
|
257
314
|
totalItems: 0,
|
|
258
|
-
|
|
259
|
-
|
|
315
|
+
currentPage: 0,
|
|
316
|
+
listPerPage: [10, 15, 20, 30, 50]
|
|
260
317
|
};
|
|
261
318
|
PagingInfo.propTypes = {
|
|
262
|
-
/**
|
|
263
|
-
|
|
319
|
+
/** compact type for mobile */
|
|
320
|
+
typeShort: PropTypes.bool,
|
|
264
321
|
|
|
265
322
|
/** background color for paging */
|
|
266
323
|
bgColor: PropTypes.string,
|
|
267
324
|
|
|
268
|
-
/**
|
|
269
|
-
|
|
325
|
+
/** style inline for Paging */
|
|
326
|
+
style: PropTypes.object,
|
|
270
327
|
|
|
271
|
-
/**
|
|
272
|
-
|
|
328
|
+
/** style inline for Paging */
|
|
329
|
+
className: PropTypes.string,
|
|
273
330
|
|
|
274
331
|
/** current of paging */
|
|
275
332
|
currentPage: PropTypes.number,
|
|
@@ -281,18 +338,12 @@ PagingInfo.propTypes = {
|
|
|
281
338
|
itemsPerPage: PropTypes.number,
|
|
282
339
|
|
|
283
340
|
/** the list to choose the number of elements to display per page */
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
/** style inline for Paging */
|
|
287
|
-
style: PropTypes.object,
|
|
341
|
+
listPerPage: PropTypes.array,
|
|
288
342
|
|
|
289
343
|
/** the function will run after change page number */
|
|
290
344
|
onChangePage: PropTypes.func,
|
|
291
345
|
|
|
292
346
|
/** the function will run after change quantity on per page */
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
/** any props else */
|
|
296
|
-
props: PropTypes.func
|
|
347
|
+
onChangePerPage: PropTypes.func
|
|
297
348
|
};
|
|
298
349
|
export default PagingInfo;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
@@ -7,6 +5,7 @@ import React, { memo, useRef, useState, useEffect, forwardRef } from 'react';
|
|
|
7
5
|
import PropTypes from 'prop-types';
|
|
8
6
|
import { jsx, css } from '@emotion/core';
|
|
9
7
|
import theme from '../../theme/settings';
|
|
8
|
+
import { typography } from '../../styles/typography';
|
|
10
9
|
const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
11
10
|
size,
|
|
12
11
|
style,
|
|
@@ -25,9 +24,7 @@ const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
25
24
|
const [paging, setPaging] = useState([1]);
|
|
26
25
|
const PageItemNum = css`
|
|
27
26
|
color: #FFF;
|
|
28
|
-
|
|
29
|
-
font-style: normal;
|
|
30
|
-
font-weight: bold;
|
|
27
|
+
${typography.heading3};
|
|
31
28
|
z-index: 1502;
|
|
32
29
|
`;
|
|
33
30
|
const morePaging = css`
|
|
@@ -238,13 +235,13 @@ const PagingSelector = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
238
235
|
css: PageItemNum
|
|
239
236
|
}, page)))), jsx("p", null, "...")) : pageNum));
|
|
240
237
|
});
|
|
241
|
-
return jsx("div",
|
|
238
|
+
return jsx("div", { ...props,
|
|
242
239
|
ref: ref,
|
|
243
240
|
style: {
|
|
244
241
|
display: 'inline-flex',
|
|
245
242
|
...style
|
|
246
243
|
}
|
|
247
|
-
}
|
|
244
|
+
}, paging.map((pageNum, index) => jsx(RenderPageItem, {
|
|
248
245
|
key: index,
|
|
249
246
|
pageNum: pageNum,
|
|
250
247
|
style: pageItemStyle
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
/** @jsxRuntime classic */
|
|
4
2
|
|
|
5
3
|
/** @jsx jsx */
|
|
@@ -8,7 +6,7 @@ import { createPortal } from 'react-dom';
|
|
|
8
6
|
import PropTypes from 'prop-types';
|
|
9
7
|
import { jsx, css } from '@emotion/core';
|
|
10
8
|
import { randomString } from '../../utils';
|
|
11
|
-
import
|
|
9
|
+
import { typography } from "../../styles/typography";
|
|
12
10
|
const timer = {};
|
|
13
11
|
const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
14
12
|
open,
|
|
@@ -55,7 +53,7 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
55
53
|
display: block;
|
|
56
54
|
position: relative;
|
|
57
55
|
background-color: ${bgColor};
|
|
58
|
-
|
|
56
|
+
${typography.paragraph1};
|
|
59
57
|
width: 100%;
|
|
60
58
|
height: 100%;
|
|
61
59
|
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
@@ -360,10 +358,11 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
360
358
|
inset: 0,
|
|
361
359
|
pointerEvents: fullScreen ? 'initial' : 'none'
|
|
362
360
|
}
|
|
363
|
-
}, jsx("div",
|
|
361
|
+
}, jsx("div", {
|
|
364
362
|
css: PopoverContainer,
|
|
365
|
-
ref: ref
|
|
366
|
-
|
|
363
|
+
ref: ref,
|
|
364
|
+
...props
|
|
365
|
+
}, jsx("div", {
|
|
367
366
|
css: PopoverRoot,
|
|
368
367
|
style: style
|
|
369
368
|
}, arrow && jsx("span", {
|