diginet-core-ui 1.3.66 → 1.3.68
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/storybook/avatar01.svg +9 -0
- package/assets/storybook/cover01.svg +9 -0
- package/components/accordion/css.js +6 -6
- package/components/accordion/details.js +13 -18
- package/components/accordion/group.js +16 -17
- package/components/accordion/index.js +17 -22
- package/components/accordion/summary.js +55 -32
- package/components/avatar/index.js +4 -9
- package/components/badge/index.js +4 -9
- package/components/button/icon.js +4 -9
- package/components/button/index.js +287 -292
- package/components/card/body.js +47 -0
- package/components/card/extra.js +47 -0
- package/components/card/footer.js +47 -0
- package/components/card/header.js +50 -0
- package/components/card/index.js +175 -37
- package/components/chart/Pie-v2/Sector.js +2 -2
- package/components/chip/attach.js +5 -5
- package/components/form-control/attachment/index.js +5 -3
- package/components/form-control/calendar/function.js +20 -10
- package/components/form-control/calendar/index.js +16 -16
- package/components/form-control/dropdown/index.js +71 -10
- package/components/form-control/helper-text/index.js +8 -3
- package/components/form-control/input-base/index.js +47 -10
- package/components/form-control/money-input/index.js +6 -2
- package/components/form-control/number-input/index.js +11 -11
- package/components/form-control/number-input/index2.js +13 -4
- package/components/form-control/phone-input/index.js +13 -9
- package/components/form-control/text-input/index.js +13 -3
- package/components/grid/Container.js +110 -0
- package/components/grid/Row.js +1 -1
- package/components/grid/index.js +35 -5
- package/components/index.js +7 -2
- package/components/others/option-wrapper/index.js +21 -27
- package/components/paging/page-info.js +263 -88
- package/components/paging/page-selector2.js +95 -56
- package/components/popover/index.js +8 -6
- package/components/progress/circular.js +12 -12
- package/components/transfer/index.js +3 -3
- package/components/tree-view/index.js +10 -6
- package/icons/basic.js +120 -0
- package/icons/effect.js +19 -24
- package/package.json +1 -1
- package/readme.md +20 -0
- package/styles/color-helper.js +103 -103
- package/styles/utils.js +14 -2
- package/utils/classNames.js +30 -0
- package/utils/error/error.js +2 -2
- package/utils/index.js +1 -0
- package/utils/renderIcon.js +5 -5
- package/utils/useInput.js +1 -8
- package/components/card/body-card.js +0 -65
- package/components/card/card.js +0 -125
- package/components/card/context.js +0 -6
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { memo, useState, useRef, useEffect, useMemo, forwardRef, useImperativeHandle } from 'react';
|
|
4
|
+
import { memo, useState, useRef, useEffect, useMemo, forwardRef, useImperativeHandle, useLayoutEffect, useCallback } from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { jsx, css } from '@emotion/core';
|
|
7
7
|
import OptionWrapper from '../others/option-wrapper';
|
|
8
8
|
import { ButtonIcon, NumberInput, Dropdown, Typography, Divider } from '../';
|
|
9
9
|
import { getGlobal } from '../../global';
|
|
10
10
|
import theme from '../../theme/settings';
|
|
11
|
-
import { alignCenter, borderBox, flexRow,
|
|
11
|
+
import { alignCenter, borderBox, flexRow, noPadding, textCenter, cursorPointer, parseHeight, whiteSpaceNoWrap, justifyCenter } from '../../styles/general';
|
|
12
12
|
const {
|
|
13
13
|
colors: {
|
|
14
14
|
system: {
|
|
@@ -42,37 +42,42 @@ const getLastPage = (totalItems, itemsPerPage) => {
|
|
|
42
42
|
|
|
43
43
|
const delayOnInput = getGlobal('delayOnInput');
|
|
44
44
|
const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
45
|
-
id,
|
|
46
|
-
typeShort,
|
|
47
45
|
bgColor,
|
|
48
|
-
style,
|
|
49
46
|
className,
|
|
50
|
-
totalItems,
|
|
51
|
-
itemsPerPage,
|
|
52
47
|
currentPage,
|
|
48
|
+
hideWithPage,
|
|
49
|
+
id,
|
|
50
|
+
itemsPerPage,
|
|
53
51
|
listPerPage,
|
|
54
52
|
onChangePage,
|
|
55
53
|
onChangePerPage,
|
|
56
54
|
onChangingPage,
|
|
57
|
-
onChangingPerPage
|
|
55
|
+
onChangingPerPage,
|
|
56
|
+
style,
|
|
57
|
+
totalItems,
|
|
58
|
+
typeShort
|
|
58
59
|
}, reference) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const ref = useRef(null);
|
|
60
|
+
let ref = useRef(null);
|
|
62
61
|
const timer = useRef(null);
|
|
63
62
|
const currentPageRef = useRef(null);
|
|
63
|
+
const numberRef = useRef(null);
|
|
64
|
+
const totalRef = useRef(null);
|
|
64
65
|
const [totalItemsState, setTotalItemsState] = useState(totalItems);
|
|
65
66
|
const [itemsPerPageState, setItemsPerPageState] = useState(itemsPerPage || listPerPage[0] || 10);
|
|
66
67
|
const [currentPageState, setCurrentPageState] = useState(currentPage);
|
|
67
68
|
const [listPerPageState, setListPerPageState] = useState(listPerPage);
|
|
68
69
|
const [disablePrevState, setDisablePrevState] = useState(true);
|
|
69
70
|
const [disableNextState, setDisableNextState] = useState(!(totalItems > itemsPerPage));
|
|
71
|
+
const [inputPageValue, setInputPageValue] = useState(currentPage);
|
|
70
72
|
|
|
71
|
-
const _pagingInfoCSS = pagingInfoCSS(bgColor, typeShort);
|
|
73
|
+
const _pagingInfoCSS = pagingInfoCSS(bgColor, typeShort); // const _dynamicWidthCSS = dynamicWidthCSS(currentPageState.toString()?.length || 3);
|
|
72
74
|
|
|
73
|
-
const _dynamicWidthCSS = dynamicWidthCSS(((_currentPageState$toS = currentPageState.toString()) === null || _currentPageState$toS === void 0 ? void 0 : _currentPageState$toS.length) || 3);
|
|
74
75
|
|
|
75
|
-
const _onChangePage = async (
|
|
76
|
+
const _onChangePage = async ({
|
|
77
|
+
page,
|
|
78
|
+
e,
|
|
79
|
+
changeBy
|
|
80
|
+
}) => {
|
|
76
81
|
const lastPage = getLastPage(totalItemsState, itemsPerPageState);
|
|
77
82
|
let disablePrev = false;
|
|
78
83
|
let disableNext = false; // If last page = 1. Disable all
|
|
@@ -92,29 +97,36 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
92
97
|
disablePrev = true;
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
|
|
100
|
+
setDisablePrevState(disablePrev);
|
|
101
|
+
setDisableNextState(disableNext);
|
|
102
|
+
if (page === currentPageState) return;
|
|
103
|
+
|
|
104
|
+
if (onChangingPage) {
|
|
96
105
|
const event = { ...e,
|
|
97
106
|
cancel: false,
|
|
98
107
|
prevPage: currentPageState,
|
|
99
|
-
newPage: page
|
|
108
|
+
newPage: page,
|
|
109
|
+
changeBy: changeBy
|
|
100
110
|
};
|
|
101
111
|
await onChangingPage(event);
|
|
102
112
|
|
|
103
113
|
if (event.cancel) {
|
|
104
114
|
if (e !== null && e !== void 0 && e.reset) e.reset();
|
|
115
|
+
currentPageRef.current = currentPageState;
|
|
105
116
|
setCurrentPageState(currentPageState);
|
|
117
|
+
setInputPageValue(currentPageState);
|
|
106
118
|
return;
|
|
107
119
|
}
|
|
108
120
|
}
|
|
109
121
|
|
|
110
122
|
currentPageRef.current = page;
|
|
111
123
|
setCurrentPageState(page);
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
if (onChangePage && !isInit) onChangePage(page);
|
|
124
|
+
setInputPageValue(page);
|
|
125
|
+
if (onChangePage) onChangePage(page);
|
|
115
126
|
};
|
|
116
127
|
|
|
117
128
|
const _onChangePerPage = async per => {
|
|
129
|
+
if (per === itemsPerPageState) return;
|
|
118
130
|
const lastPage = getLastPage(totalItemsState, per);
|
|
119
131
|
per = parseInt(per, 10);
|
|
120
132
|
let disableNext = false; // If last page = 1. Disable all
|
|
@@ -136,14 +148,20 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
136
148
|
}
|
|
137
149
|
}
|
|
138
150
|
|
|
139
|
-
currentPageRef.current = 0;
|
|
140
|
-
|
|
151
|
+
setItemsPerPageState(per); // currentPageRef.current = 0;
|
|
152
|
+
// setCurrentPageState(0);
|
|
153
|
+
// setInputPageValue(0);
|
|
154
|
+
|
|
155
|
+
_onChangePage({
|
|
156
|
+
page: 0
|
|
157
|
+
});
|
|
158
|
+
|
|
141
159
|
setDisablePrevState(true);
|
|
142
160
|
setDisableNextState(disableNext);
|
|
143
161
|
if (onChangePerPage) onChangePerPage(per);
|
|
144
162
|
};
|
|
145
163
|
|
|
146
|
-
const onTypePaging =
|
|
164
|
+
const onTypePaging = e => {
|
|
147
165
|
var _e$value;
|
|
148
166
|
|
|
149
167
|
if (timer.current) {
|
|
@@ -155,7 +173,10 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
155
173
|
const page = !value || parseInt(value) < 0 ? 1 : parseInt(value) > lastPage ? lastPage : parseInt(value);
|
|
156
174
|
currentPage = page - 1;
|
|
157
175
|
timer.current = setTimeout(() => {
|
|
158
|
-
_onChangePage(
|
|
176
|
+
_onChangePage({
|
|
177
|
+
page: page - 1,
|
|
178
|
+
e: e
|
|
179
|
+
});
|
|
159
180
|
}, delayOnInput);
|
|
160
181
|
};
|
|
161
182
|
|
|
@@ -169,44 +190,127 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
169
190
|
setTotalItemsState(totalItems);
|
|
170
191
|
}, [totalItems]);
|
|
171
192
|
useEffect(() => {
|
|
172
|
-
|
|
173
|
-
clearTimeout(timer.current);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
timer.current = setTimeout(() => {
|
|
177
|
-
_onChangePage(0, true);
|
|
178
|
-
}, delayOnInput);
|
|
179
|
-
}, [totalItemsState, itemsPerPageState]);
|
|
180
|
-
useEffect(() => {
|
|
181
|
-
setItemsPerPageState(itemsPerPage);
|
|
193
|
+
_onChangePerPage(itemsPerPage);
|
|
182
194
|
}, [itemsPerPage]);
|
|
183
195
|
useEffect(() => {
|
|
184
|
-
|
|
185
|
-
|
|
196
|
+
_onChangePage({
|
|
197
|
+
page: currentPage,
|
|
198
|
+
changeBy: 'currentPage'
|
|
199
|
+
});
|
|
186
200
|
}, [currentPage]);
|
|
187
201
|
useEffect(() => {
|
|
188
202
|
setListPerPageState(listPerPage);
|
|
189
203
|
}, [listPerPage]);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
204
|
+
useEffect(() => {
|
|
205
|
+
_onChangePage({
|
|
206
|
+
page: totalItemsState / itemsPerPageState < currentPageState - 1 ? 0 : currentPageState,
|
|
207
|
+
changeBy: 'totalItems'
|
|
208
|
+
});
|
|
209
|
+
}, [totalItemsState]);
|
|
210
|
+
useEffect(() => {
|
|
211
|
+
_onChangePage({
|
|
212
|
+
page: totalItemsState / itemsPerPageState < currentPageState - 1 ? 0 : currentPageState,
|
|
213
|
+
changeBy: 'itemsPerPage'
|
|
214
|
+
});
|
|
215
|
+
}, [itemsPerPageState]);
|
|
216
|
+
useImperativeHandle(reference, () => ({
|
|
217
|
+
element: ref.current,
|
|
218
|
+
instance: {
|
|
219
|
+
onChangePage: page => _onChangePage({
|
|
220
|
+
page: page,
|
|
221
|
+
changeBy: 'ref'
|
|
222
|
+
}),
|
|
194
223
|
onChangePerPage: per => _onChangePerPage(per),
|
|
195
224
|
setTotalItems: items => setTotalItemsState(items)
|
|
196
|
-
}
|
|
225
|
+
},
|
|
226
|
+
onChangePage: page => _onChangePage({
|
|
227
|
+
page: page,
|
|
228
|
+
changeBy: 'ref'
|
|
229
|
+
}),
|
|
230
|
+
onChangePerPage: per => _onChangePerPage(per),
|
|
231
|
+
setTotalItems: items => setTotalItemsState(items)
|
|
232
|
+
}));
|
|
233
|
+
|
|
234
|
+
const updateSize = () => {
|
|
235
|
+
if (timer.current) {
|
|
236
|
+
clearTimeout(timer.current);
|
|
237
|
+
}
|
|
197
238
|
|
|
198
|
-
|
|
239
|
+
timer.current = setTimeout(() => {
|
|
240
|
+
var _ref$current;
|
|
199
241
|
|
|
200
|
-
|
|
242
|
+
let conti = true;
|
|
243
|
+
[...(((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.children) || [])].reverse().forEach(item => {
|
|
244
|
+
if (item !== null && item !== void 0 && item.style) {
|
|
245
|
+
item.style.display = 'flex';
|
|
201
246
|
|
|
202
|
-
|
|
247
|
+
if (!conti) {
|
|
248
|
+
item.style.opacity = 1;
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
conti = hiddenEle(item);
|
|
254
|
+
});
|
|
255
|
+
}, 300);
|
|
256
|
+
};
|
|
203
257
|
|
|
204
|
-
|
|
258
|
+
useLayoutEffect(() => {
|
|
259
|
+
window.addEventListener('resize', updateSize);
|
|
260
|
+
updateSize();
|
|
261
|
+
return () => window.removeEventListener('resize', updateSize);
|
|
262
|
+
}, []);
|
|
205
263
|
|
|
206
|
-
|
|
264
|
+
const hiddenEle = child => {
|
|
265
|
+
setTimeout(() => {
|
|
266
|
+
var _ref$current2;
|
|
267
|
+
|
|
268
|
+
const infoChild = child === null || child === void 0 ? void 0 : child.getBoundingClientRect();
|
|
269
|
+
const infoParent = (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.getBoundingClientRect();
|
|
270
|
+
if (!infoChild || !infoParent) return; // getBoundingClientRect includes margin => phải trừ đi margin
|
|
271
|
+
|
|
272
|
+
const style = window.getComputedStyle(child) || child.currentStyle;
|
|
273
|
+
const margin = parseInt((style === null || style === void 0 ? void 0 : style.marginLeft) || 0) + parseInt((style === null || style === void 0 ? void 0 : style.marginRight) || 0);
|
|
274
|
+
|
|
275
|
+
if (infoChild.right - margin >= infoParent.width) {
|
|
276
|
+
child.style.opacity = 0;
|
|
277
|
+
child.style.setProperty('display', 'none', 'important');
|
|
278
|
+
} else {
|
|
279
|
+
child.style.opacity = 1;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return infoChild.right >= infoParent.width;
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const setWithNumber = useCallback((totalRefs = totalRef, numberRefs = numberRef) => {
|
|
287
|
+
var _totalRefs;
|
|
288
|
+
|
|
289
|
+
if (!totalRefs) totalRefs = totalRef.current;
|
|
290
|
+
if (!numberRefs) numberRefs = numberRef.current;
|
|
291
|
+
if (!totalRefs || !numberRefs) return;
|
|
292
|
+
const infoText = (_totalRefs = totalRefs) === null || _totalRefs === void 0 ? void 0 : _totalRefs.getBoundingClientRect();
|
|
293
|
+
|
|
294
|
+
if (infoText && numberRefs) {
|
|
295
|
+
numberRefs.style.width = `${infoText.width * 2 + 6}px`;
|
|
296
|
+
numberRefs.style.minWidth = `${infoText.width * 2 + 6}px`;
|
|
297
|
+
}
|
|
298
|
+
}, [totalRef, numberRef]);
|
|
299
|
+
|
|
300
|
+
const checkShowPaging = () => {
|
|
301
|
+
switch (hideWithPage) {
|
|
302
|
+
case 'empty':
|
|
303
|
+
return totalItemsState !== 0;
|
|
304
|
+
|
|
305
|
+
case 'single':
|
|
306
|
+
return totalItemsState / itemsPerPageState > 1;
|
|
307
|
+
|
|
308
|
+
case 'none':
|
|
309
|
+
default:
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
};
|
|
207
313
|
|
|
208
|
-
return currentRef;
|
|
209
|
-
});
|
|
210
314
|
return useMemo(() => {
|
|
211
315
|
const lastPage = getLastPage(totalItemsState, itemsPerPageState);
|
|
212
316
|
let listPerPageData = !listPerPageState.includes(itemsPerPageState) ? [{
|
|
@@ -219,7 +323,8 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
219
323
|
}]);
|
|
220
324
|
listPerPageData = [...new Map(listPerPageData.map(v => [JSON.stringify(v), v])).values()];
|
|
221
325
|
listPerPageData.sort((a, b) => a.id - b.id);
|
|
222
|
-
|
|
326
|
+
const showPaging = checkShowPaging();
|
|
327
|
+
return showPaging && jsx("div", {
|
|
223
328
|
ref: ref,
|
|
224
329
|
css: _pagingInfoCSS,
|
|
225
330
|
id: id,
|
|
@@ -227,73 +332,127 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
227
332
|
className: ['DGN-UI-PagingInfo', className].join(' ').trim().replace(/\s+/g, ' ')
|
|
228
333
|
}, jsx(ButtonIcon, {
|
|
229
334
|
circular: true,
|
|
230
|
-
viewType: '
|
|
335
|
+
viewType: 'ghost',
|
|
231
336
|
size: 'small',
|
|
232
337
|
name: 'ArrowDoubleLeft',
|
|
233
338
|
disabled: disablePrevState,
|
|
234
|
-
onClick: e =>
|
|
339
|
+
onClick: e => {
|
|
340
|
+
setInputPageValue(0);
|
|
341
|
+
currentPageRef.current = 0;
|
|
342
|
+
|
|
343
|
+
if (timer.current) {
|
|
344
|
+
clearTimeout(timer.current);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
timer.current = setTimeout(() => {
|
|
348
|
+
_onChangePage({
|
|
349
|
+
page: 0,
|
|
350
|
+
e: e
|
|
351
|
+
});
|
|
352
|
+
}, delayOnInput);
|
|
353
|
+
}
|
|
235
354
|
}), jsx(ButtonIcon, {
|
|
236
355
|
circular: true,
|
|
237
|
-
viewType: '
|
|
356
|
+
viewType: 'ghost',
|
|
238
357
|
size: 'small',
|
|
239
358
|
name: 'ArrowLeft',
|
|
240
359
|
disabled: disablePrevState,
|
|
241
360
|
onClick: e => {
|
|
242
|
-
|
|
361
|
+
setInputPageValue(inputPageValue - 1);
|
|
362
|
+
currentPageRef.current = currentPageRef.current === 0 ? 0 : currentPageRef.current - 1;
|
|
243
363
|
|
|
244
364
|
if (timer.current) {
|
|
245
365
|
clearTimeout(timer.current);
|
|
246
366
|
}
|
|
247
367
|
|
|
248
368
|
timer.current = setTimeout(() => {
|
|
249
|
-
_onChangePage(
|
|
369
|
+
_onChangePage({
|
|
370
|
+
page: currentPageRef.current,
|
|
371
|
+
e: e
|
|
372
|
+
});
|
|
250
373
|
}, delayOnInput);
|
|
251
374
|
}
|
|
252
|
-
}), jsx(
|
|
253
|
-
css:
|
|
375
|
+
}), jsx("div", {
|
|
376
|
+
css: ViewNumberInput,
|
|
377
|
+
ref: refs => {
|
|
378
|
+
numberRef.current = refs;
|
|
379
|
+
setWithNumber(null, refs);
|
|
380
|
+
}
|
|
381
|
+
}, jsx(NumberInput, {
|
|
254
382
|
disabledNegative: true,
|
|
255
383
|
className: 'inputPage',
|
|
256
|
-
value:
|
|
384
|
+
value: inputPageValue ? String(inputPageValue + 1) : '1',
|
|
257
385
|
min: 1,
|
|
386
|
+
autoWidth: true,
|
|
387
|
+
inputStyle: {
|
|
388
|
+
minWidth: 10
|
|
389
|
+
},
|
|
390
|
+
width: 'auto',
|
|
391
|
+
placeholder: '',
|
|
258
392
|
max: lastPage,
|
|
259
393
|
onKeyDown: checkKeyPress,
|
|
260
|
-
onChange: e => onTypePaging(e
|
|
394
|
+
onChange: e => onTypePaging(e)
|
|
261
395
|
}), "/", jsx(Typography, {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
|
|
396
|
+
ref: refs => {
|
|
397
|
+
totalRef.current = refs;
|
|
398
|
+
setWithNumber(refs, null);
|
|
399
|
+
},
|
|
400
|
+
css: css`
|
|
401
|
+
${whiteSpaceNoWrap}
|
|
402
|
+
`,
|
|
403
|
+
type: 'p2'
|
|
404
|
+
}, lastPage)), jsx(ButtonIcon, {
|
|
267
405
|
circular: true,
|
|
268
|
-
viewType: '
|
|
406
|
+
viewType: 'ghost',
|
|
269
407
|
size: 'small',
|
|
270
408
|
name: 'ArrowRight',
|
|
271
409
|
disabled: disableNextState,
|
|
272
410
|
onClick: e => {
|
|
273
|
-
|
|
411
|
+
setInputPageValue(inputPageValue + 1);
|
|
412
|
+
currentPageRef.current = currentPageRef.current === lastPage ? lastPage : currentPageRef.current + 1;
|
|
274
413
|
|
|
275
414
|
if (timer.current) {
|
|
276
415
|
clearTimeout(timer.current);
|
|
277
416
|
}
|
|
278
417
|
|
|
279
418
|
timer.current = setTimeout(() => {
|
|
280
|
-
_onChangePage(
|
|
419
|
+
_onChangePage({
|
|
420
|
+
page: currentPageRef.current,
|
|
421
|
+
e: e
|
|
422
|
+
});
|
|
281
423
|
}, delayOnInput);
|
|
282
424
|
}
|
|
283
425
|
}), jsx(ButtonIcon, {
|
|
284
426
|
circular: true,
|
|
285
|
-
viewType: '
|
|
427
|
+
viewType: 'ghost',
|
|
286
428
|
size: 'small',
|
|
287
429
|
name: 'ArrowDoubleRight',
|
|
288
430
|
disabled: disableNextState,
|
|
289
|
-
onClick: e =>
|
|
290
|
-
|
|
431
|
+
onClick: e => {
|
|
432
|
+
setInputPageValue(lastPage - 1);
|
|
433
|
+
currentPageRef.current = lastPage - 1;
|
|
434
|
+
|
|
435
|
+
if (timer.current) {
|
|
436
|
+
clearTimeout(timer.current);
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
timer.current = setTimeout(() => {
|
|
440
|
+
_onChangePage({
|
|
441
|
+
page: lastPage - 1,
|
|
442
|
+
e: e
|
|
443
|
+
});
|
|
444
|
+
}, delayOnInput);
|
|
445
|
+
}
|
|
446
|
+
}), jsx(Typography, {
|
|
447
|
+
type: 'p2',
|
|
448
|
+
ref: hiddenEle,
|
|
449
|
+
className: "txt-line-number"
|
|
450
|
+
}, typeShort ? jsx(Divider, {
|
|
291
451
|
direction: 'vertical',
|
|
292
452
|
height: 24,
|
|
293
453
|
color: category
|
|
294
|
-
})
|
|
295
|
-
|
|
296
|
-
}, getGlobal('lineNumber')), jsx(Dropdown, {
|
|
454
|
+
}) : getGlobal('lineNumber'), jsx(Dropdown, {
|
|
455
|
+
allowSearch: false,
|
|
297
456
|
viewType: 'underlined',
|
|
298
457
|
dataSource: listPerPageData,
|
|
299
458
|
value: itemsPerPageState,
|
|
@@ -307,32 +466,38 @@ const PagingInfo = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
307
466
|
dropdownItemStyle: {
|
|
308
467
|
color: active
|
|
309
468
|
}
|
|
310
|
-
}),
|
|
469
|
+
})), jsx(Typography, {
|
|
470
|
+
type: 'p2',
|
|
471
|
+
ref: hiddenEle,
|
|
472
|
+
className: 'total-items'
|
|
473
|
+
}, typeShort ? jsx(Divider, {
|
|
311
474
|
direction: 'vertical',
|
|
312
475
|
height: 24,
|
|
313
476
|
color: category
|
|
314
|
-
})
|
|
315
|
-
|
|
316
|
-
}, !typeShort && getGlobal('total') + ':', " ", totalItemsState));
|
|
317
|
-
}, [typeShort, bgColor, style, className, totalItemsState, itemsPerPageState, currentPageState, listPerPageState, disablePrevState, disableNextState]);
|
|
477
|
+
}) : getGlobal('total') + ':', totalItemsState));
|
|
478
|
+
}, [typeShort, bgColor, style, className, hideWithPage, totalItemsState, itemsPerPageState, currentPageState, listPerPageState, disablePrevState, disableNextState, inputPageValue]);
|
|
318
479
|
}));
|
|
480
|
+
const ViewNumberInput = css`
|
|
481
|
+
${flexRow};
|
|
482
|
+
${alignCenter};
|
|
483
|
+
${justifyCenter};
|
|
484
|
+
transition: all 0.1s;
|
|
485
|
+
margin: ${spacing([0, 1])};
|
|
486
|
+
`;
|
|
319
487
|
|
|
320
488
|
const pagingInfoCSS = (bgColor, typeShort) => css`
|
|
321
489
|
${flexRow};
|
|
322
490
|
${alignCenter};
|
|
323
491
|
${paragraph2};
|
|
324
492
|
${borderBox};
|
|
325
|
-
${border(1, system)};
|
|
326
493
|
${parseHeight(40)}
|
|
327
|
-
border-
|
|
328
|
-
border-right: none;
|
|
494
|
+
border-top: solid 1px ${system};
|
|
329
495
|
padding: ${spacing([1, 0])};
|
|
330
496
|
background-color: ${bgColor};
|
|
331
497
|
color: ${main};
|
|
332
498
|
.inputPage {
|
|
333
|
-
${noMargin};
|
|
334
499
|
${textCenter};
|
|
335
|
-
|
|
500
|
+
margin: ${spacing([0, 0.5])};
|
|
336
501
|
.DGN-UI-InputBase {
|
|
337
502
|
${noPadding};
|
|
338
503
|
input {
|
|
@@ -344,7 +509,11 @@ const pagingInfoCSS = (bgColor, typeShort) => css`
|
|
|
344
509
|
}
|
|
345
510
|
}
|
|
346
511
|
.txt-line-number {
|
|
347
|
-
|
|
512
|
+
${whiteSpaceNoWrap};
|
|
513
|
+
${alignCenter};
|
|
514
|
+
opacity: 0;
|
|
515
|
+
display: flex !important;
|
|
516
|
+
transition: opacity 0.3s ease;
|
|
348
517
|
}
|
|
349
518
|
.DGN-UI-Divider {
|
|
350
519
|
margin: ${spacing([0, 2])};
|
|
@@ -356,7 +525,8 @@ const pagingInfoCSS = (bgColor, typeShort) => css`
|
|
|
356
525
|
.DGN-UI-Dropdown-Form {
|
|
357
526
|
min-height: 24px;
|
|
358
527
|
padding: 0;
|
|
359
|
-
input
|
|
528
|
+
input,
|
|
529
|
+
span {
|
|
360
530
|
${paragraph2};
|
|
361
531
|
${noPadding};
|
|
362
532
|
${cursorPointer};
|
|
@@ -375,14 +545,15 @@ const pagingInfoCSS = (bgColor, typeShort) => css`
|
|
|
375
545
|
}
|
|
376
546
|
}
|
|
377
547
|
.total-items {
|
|
548
|
+
${whiteSpaceNoWrap};
|
|
549
|
+
${flexRow};
|
|
550
|
+
${alignCenter};
|
|
378
551
|
margin-left: ${`${spacing(typeShort ? [0] : [4])}`};
|
|
552
|
+
opacity: 0;
|
|
553
|
+
transition: opacity 0.3s ease;
|
|
379
554
|
}
|
|
380
555
|
`;
|
|
381
556
|
|
|
382
|
-
const dynamicWidthCSS = characters => css`
|
|
383
|
-
width: ${characters}ch;
|
|
384
|
-
`;
|
|
385
|
-
|
|
386
557
|
PagingInfo.defaultProps = {
|
|
387
558
|
typeShort: false,
|
|
388
559
|
bgColor: white,
|
|
@@ -390,7 +561,8 @@ PagingInfo.defaultProps = {
|
|
|
390
561
|
className: '',
|
|
391
562
|
totalItems: 0,
|
|
392
563
|
currentPage: 0,
|
|
393
|
-
listPerPage: [10, 15, 20, 30, 50]
|
|
564
|
+
listPerPage: [10, 15, 20, 30, 50],
|
|
565
|
+
hideWithPage: 'none'
|
|
394
566
|
};
|
|
395
567
|
PagingInfo.propTypes = {
|
|
396
568
|
/** Background color for component. */
|
|
@@ -402,6 +574,9 @@ PagingInfo.propTypes = {
|
|
|
402
574
|
/** Specifies the current page. */
|
|
403
575
|
currentPage: PropTypes.number,
|
|
404
576
|
|
|
577
|
+
/** Hidden mode for page selector. */
|
|
578
|
+
hideWithPage: PropTypes.oneOf(['none', 'empty', 'single']),
|
|
579
|
+
|
|
405
580
|
/** The quantity of items per page. */
|
|
406
581
|
itemsPerPage: PropTypes.number,
|
|
407
582
|
|