@ncds/ui-admin 1.8.26-alpha.9 → 1.8.26
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/dist/cjs/src/components/feedback-and-status/badge/Badge.js +1 -1
- package/dist/cjs/src/components/navigation/pagination/Pagination.js +14 -14
- package/dist/cjs/src/components/navigation/pagination/__tests__/Pagination.test.js +0 -17
- package/dist/cjs/src/generated/scoped-css.js +1 -1
- package/dist/cjs/vitest.config.js +1 -12
- package/dist/esm/src/components/feedback-and-status/badge/Badge.js +1 -1
- package/dist/esm/src/components/navigation/pagination/Pagination.js +14 -14
- package/dist/esm/src/components/navigation/pagination/__tests__/Pagination.test.js +0 -17
- package/dist/esm/src/generated/scoped-css.js +1 -1
- package/dist/esm/vitest.config.js +1 -12
- package/dist/temp/src/components/feedback-and-status/badge/Badge.d.ts +1 -1
- package/dist/temp/src/components/feedback-and-status/badge/Badge.js +1 -1
- package/dist/temp/src/components/navigation/pagination/Pagination.js +14 -14
- package/dist/temp/src/components/navigation/pagination/__tests__/Pagination.test.js +0 -7
- package/dist/temp/src/generated/scoped-css.js +1 -1
- package/dist/temp/vitest.config.js +0 -11
- package/dist/types/src/components/feedback-and-status/badge/Badge.d.ts +1 -1
- package/dist/ui-admin/assets/styles/style.css +18 -15
- package/package.json +1 -1
- package/dist/cjs/src/components/layout/page-title/__tests__/pageTitleStyle.test.js +0 -94
- package/dist/esm/src/components/layout/page-title/__tests__/pageTitleStyle.test.js +0 -91
- package/dist/temp/src/components/layout/page-title/__tests__/pageTitleStyle.test.d.ts +0 -1
- package/dist/temp/src/components/layout/page-title/__tests__/pageTitleStyle.test.js +0 -94
- package/dist/types/src/components/layout/page-title/__tests__/pageTitleStyle.test.d.ts +0 -1
|
@@ -36,28 +36,28 @@ const Pagination = _ref => {
|
|
|
36
36
|
};
|
|
37
37
|
(0, _react.useEffect)(() => {
|
|
38
38
|
const lastGroupStart = Math.max(1, Math.floor((totalPage - 1) / pageCount) * pageCount + 1);
|
|
39
|
-
// totalPage/pageCount 가 줄어 start 가 마지막 그룹을 넘으면 마지막
|
|
39
|
+
// totalPage/pageCount 가 줄어 start 가 마지막 그룹을 넘으면 마지막 그룹으로 보정한다.
|
|
40
40
|
// (예: 100→50 페이지로 축소 시 start 가 91 에 머물러 범위 밖 버튼을 표시하던 문제)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (currentPage === baseStart + pageCount) {
|
|
45
|
-
nextStart = baseStart + pageCount;
|
|
41
|
+
if (start > lastGroupStart) {
|
|
42
|
+
setStart(lastGroupStart);
|
|
43
|
+
return;
|
|
46
44
|
}
|
|
47
|
-
if (currentPage
|
|
48
|
-
|
|
45
|
+
if (currentPage === start + pageCount) {
|
|
46
|
+
setStart(start + pageCount);
|
|
49
47
|
}
|
|
50
|
-
if (currentPage
|
|
51
|
-
|
|
48
|
+
if (currentPage > start + pageCount) {
|
|
49
|
+
const newStart = Math.floor((currentPage - 1) / pageCount) * pageCount + 1;
|
|
50
|
+
setStart(newStart);
|
|
51
|
+
}
|
|
52
|
+
if (currentPage < start) {
|
|
53
|
+
setStart(Math.max(1, start - pageCount));
|
|
52
54
|
}
|
|
53
55
|
if (currentPage === 1) {
|
|
54
|
-
|
|
56
|
+
setStart(1);
|
|
55
57
|
}
|
|
56
58
|
if (currentPage === totalPage) {
|
|
57
|
-
|
|
59
|
+
setStart(lastGroupStart);
|
|
58
60
|
}
|
|
59
|
-
// currentPage 가 totalPage 를 넘는 값이어도 마지막 그룹을 넘지 않는다
|
|
60
|
-
setStart(Math.min(nextStart, lastGroupStart));
|
|
61
61
|
// start 는 이 effect 가 setStart 로 갱신하는 대상이라 deps 에서 제외한다(넣으면 자기 갱신으로
|
|
62
62
|
// 재실행). currentPage 외에 totalPage/pageCount 도 추적해, 이들이 줄어 start 가 범위를 벗어나면
|
|
63
63
|
// 위에서 보정한다.
|
|
@@ -67,23 +67,6 @@ const nextOf = el => el.querySelector('.ncua-pagination__next');
|
|
|
67
67
|
(0, _vitest.expect)(nums[0]).toBe(GROUP_START_50_PAGES);
|
|
68
68
|
(0, _vitest.expect)(Math.max(...nums)).toBeLessThanOrEqual(LAST_PAGE_50);
|
|
69
69
|
});
|
|
70
|
-
(0, _vitest.it)('totalPage 가 줄면서 currentPage 가 1 로 돌아오면 1 이 든 첫 그룹을 보인다 (PR #603 리뷰)', () => {
|
|
71
|
-
// 50 페이지 중 35 페이지(31~40 그룹) → 새 검색으로 25 페이지 결과의 1 페이지
|
|
72
|
-
const el = render({
|
|
73
|
-
totalCount: 750,
|
|
74
|
-
itemCountPerPage: 15,
|
|
75
|
-
pageCount: PAGE_GROUP_SIZE,
|
|
76
|
-
currentPage: 35
|
|
77
|
-
});
|
|
78
|
-
render({
|
|
79
|
-
totalCount: 375,
|
|
80
|
-
itemCountPerPage: 15,
|
|
81
|
-
pageCount: PAGE_GROUP_SIZE,
|
|
82
|
-
currentPage: 1
|
|
83
|
-
});
|
|
84
|
-
(0, _vitest.expect)(pageNums(el)[0]).toBe(1);
|
|
85
|
-
(0, _vitest.expect)(el.querySelector('.ncua-pagination__page-num.is-current')?.textContent).toBe('1');
|
|
86
|
-
});
|
|
87
70
|
});
|
|
88
71
|
(0, _vitest.describe)('Pagination — mo 모드 이전/다음 버튼 노출', () => {
|
|
89
72
|
(0, _vitest.it)('페이지가 그룹 크기 이하여도 mo 에서는 이전·다음 버튼이 노출된다', () => {
|