@ncds/ui-admin 0.0.8 → 0.0.9
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/const/Icon/FinanceECommerce.js +7 -15
- package/dist/const/Icon/alertAndFeedback.js +7 -1
- package/dist/const/Icon/arrow.js +7 -11
- package/dist/const/Icon/chart.js +7 -1
- package/dist/const/Icon/chevron.js +7 -1
- package/dist/const/Icon/circle.js +7 -1
- package/dist/const/Icon/communication.js +7 -1
- package/dist/const/Icon/development.js +7 -12
- package/dist/const/Icon/editor.js +7 -1
- package/dist/const/Icon/education.js +7 -1
- package/dist/const/Icon/files.js +7 -1
- package/dist/const/Icon/general.js +31 -57
- package/dist/const/Icon/index.js +37 -31
- package/dist/const/Icon/layout.js +9 -13
- package/dist/const/Icon/mapsTravel.js +7 -1
- package/dist/const/Icon/mediaDevices.js +7 -11
- package/dist/const/Icon/message.js +7 -1
- package/dist/const/Icon/sales.js +7 -1
- package/dist/const/Icon/security.js +7 -1
- package/dist/const/Icon/shapes.js +9 -4
- package/dist/const/Icon/tag.js +7 -1
- package/dist/const/Icon/time.js +7 -1
- package/dist/const/Icon/users.js +7 -11
- package/dist/const/Icon/weather.js +7 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui-admin/assets/images/sprite.png +0 -0
- package/dist/ui-admin/assets/scripts/index.js +16 -1
- package/dist/ui-admin/assets/scripts/test.js +9 -2
- package/dist/ui-admin/assets/styles/style.css +1438 -0
- package/dist/ui-admin/constant/color.js +38 -32
- package/dist/ui-admin/constant/size.js +5 -1
- package/dist/ui-admin/index.js +148 -13
- package/dist/ui-admin/src/components/button/Button.js +103 -68
- package/dist/ui-admin/src/components/button/ButtonGroup.js +93 -54
- package/dist/ui-admin/src/components/button/index.js +27 -2
- package/dist/ui-admin/src/components/checkbox/Checkbox.js +67 -26
- package/dist/ui-admin/src/components/checkbox/CheckboxInput.js +65 -30
- package/dist/ui-admin/src/components/checkbox/index.js +27 -2
- package/dist/ui-admin/src/components/index.js +115 -10
- package/dist/ui-admin/src/components/input/FileInput.js +1 -1
- package/dist/ui-admin/src/components/input/InputBase.js +162 -77
- package/dist/ui-admin/src/components/input/PasswordInput.js +84 -66
- package/dist/ui-admin/src/components/input/index.d.ts +0 -1
- package/dist/ui-admin/src/components/input/index.d.ts.map +1 -1
- package/dist/ui-admin/src/components/input/index.js +27 -3
- package/dist/ui-admin/src/components/pagination/NavButton.js +87 -60
- package/dist/ui-admin/src/components/pagination/Pagination.js +170 -104
- package/dist/ui-admin/src/components/pagination/index.js +27 -2
- package/dist/ui-admin/src/components/radio/Radio.js +62 -26
- package/dist/ui-admin/src/components/radio/RadioInput.js +48 -27
- package/dist/ui-admin/src/components/radio/index.js +27 -2
- package/dist/ui-admin/src/components/select/Select.js +96 -33
- package/dist/ui-admin/src/components/select/index.js +16 -1
- package/dist/ui-admin/src/components/shared/hintText/HintText.js +40 -25
- package/dist/ui-admin/src/components/shared/hintText/index.js +16 -1
- package/dist/ui-admin/src/components/shared/index.js +27 -2
- package/dist/ui-admin/src/components/shared/label/Label.js +40 -25
- package/dist/ui-admin/src/components/shared/label/index.js +16 -1
- package/dist/ui-admin/src/components/spinner/Spinner.js +49 -17
- package/dist/ui-admin/src/components/spinner/index.js +16 -1
- package/dist/ui-admin/src/components/svg/SvgIcon.js +62 -27
- package/dist/ui-admin/src/components/svg/const.js +792 -786
- package/dist/ui-admin/src/components/svg/index.js +27 -2
- package/dist/ui-admin/src/components/tooltip/Tooltip.js +67 -18
- package/dist/ui-admin/src/components/tooltip/index.js +16 -1
- package/dist/ui-admin/src/constant/index.js +16 -1
- package/dist/ui-admin/src/constant/size.js +7 -1
- package/package.json +1 -1
|
@@ -1,70 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PasswordInput = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _InputBase = require("./InputBase");
|
|
10
|
+
var _uiAdminIcon = require("@ncds/ui-admin-icon");
|
|
11
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
14
|
+
__assign = Object.assign || function (t) {
|
|
15
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
16
|
+
s = arguments[i];
|
|
17
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
18
|
+
}
|
|
21
19
|
return t;
|
|
20
|
+
};
|
|
21
|
+
return __assign.apply(this, arguments);
|
|
22
|
+
};
|
|
23
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
24
|
+
var t = {};
|
|
25
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
26
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
27
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
28
|
+
}
|
|
29
|
+
return t;
|
|
22
30
|
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import { forwardRef, useEffect, useRef, useState } from 'react';
|
|
25
|
-
import { InputBase } from './InputBase';
|
|
26
|
-
import { Eye, EyeOff } from '@ncds/ui-admin-icon';
|
|
27
|
-
import classNames from 'classnames';
|
|
28
31
|
var svgSize = {
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
xs: 14,
|
|
33
|
+
md: 20
|
|
31
34
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
35
|
+
var PasswordInput = exports.PasswordInput = /*#__PURE__*/(0, _react.forwardRef)(function (_a, ref) {
|
|
36
|
+
var _b = _a.size,
|
|
37
|
+
size = _b === void 0 ? 'md' : _b,
|
|
38
|
+
props = __rest(_a, ["size"]);
|
|
39
|
+
var inputRef = (0, _react.useRef)(null);
|
|
40
|
+
var _c = (0, _react.useState)(false),
|
|
41
|
+
isVisible = _c[0],
|
|
42
|
+
setIsVisible = _c[1];
|
|
43
|
+
var _d = (0, _react.useState)(false),
|
|
44
|
+
hasContent = _d[0],
|
|
45
|
+
setHasContent = _d[1];
|
|
46
|
+
var svgProps = {
|
|
47
|
+
width: svgSize[size],
|
|
48
|
+
height: svgSize[size]
|
|
49
|
+
};
|
|
50
|
+
var handleVisibilityChange = function () {
|
|
51
|
+
setIsVisible(!isVisible);
|
|
52
|
+
};
|
|
53
|
+
(0, _react.useEffect)(function () {
|
|
54
|
+
if (inputRef.current) {
|
|
55
|
+
setHasContent(!!inputRef.current.value);
|
|
56
|
+
inputRef.current.addEventListener('input', function () {
|
|
57
|
+
var _a;
|
|
58
|
+
setHasContent(!!((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.value));
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}, []);
|
|
62
|
+
return (0, _jsxRuntime.jsx)(_InputBase.InputBase, __assign({
|
|
63
|
+
ref: function (node) {
|
|
64
|
+
if (typeof ref === 'function') {
|
|
65
|
+
ref(node);
|
|
66
|
+
} else if (ref) {
|
|
67
|
+
ref.current = node;
|
|
68
|
+
}
|
|
69
|
+
inputRef.current = node;
|
|
70
|
+
},
|
|
71
|
+
type: isVisible ? 'text' : 'password',
|
|
72
|
+
leadingElement: {
|
|
73
|
+
type: 'icon',
|
|
74
|
+
icon: 'lock-01',
|
|
75
|
+
color: hasContent ? 'gray600' : 'gray300'
|
|
76
|
+
},
|
|
77
|
+
trailingElement: {
|
|
78
|
+
type: 'custom',
|
|
79
|
+
placement: 'inside',
|
|
80
|
+
children: (0, _jsxRuntime.jsx)("button", __assign({
|
|
81
|
+
className: (0, _classnames.default)('ncua-input__icon-wrap', 'ncua-input__right-icon', 'ncua-input__password-icon'),
|
|
82
|
+
onClick: handleVisibilityChange
|
|
83
|
+
}, {
|
|
84
|
+
children: isVisible ? (0, _jsxRuntime.jsx)(_uiAdminIcon.Eye, __assign({}, svgProps)) : (0, _jsxRuntime.jsx)(_uiAdminIcon.EyeOff, __assign({}, svgProps))
|
|
85
|
+
}))
|
|
86
|
+
}
|
|
87
|
+
}, props));
|
|
88
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/input/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,3 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _InputBase = require("./InputBase");
|
|
7
|
+
Object.keys(_InputBase).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _InputBase[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _InputBase[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _PasswordInput = require("./PasswordInput");
|
|
18
|
+
Object.keys(_PasswordInput).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _PasswordInput[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _PasswordInput[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -1,64 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NavButton = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _Button = require("../button/Button");
|
|
9
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
10
|
+
__assign = Object.assign || function (t) {
|
|
11
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
12
|
+
s = arguments[i];
|
|
13
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
14
|
+
}
|
|
15
|
+
return t;
|
|
16
|
+
};
|
|
17
|
+
return __assign.apply(this, arguments);
|
|
11
18
|
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { Button } from '../button/Button';
|
|
14
19
|
var NAV_BUTTON_CONFIG = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
prev: {
|
|
21
|
-
label: '이전',
|
|
22
|
-
className: 'ncua-pagination__before',
|
|
23
|
-
getIcon: function (isPC) { return (isPC ? 'chevron-left' : 'arrow-left'); },
|
|
24
|
-
},
|
|
25
|
-
next: {
|
|
26
|
-
label: '다음',
|
|
27
|
-
className: 'ncua-pagination__next',
|
|
28
|
-
getIcon: function (isPC) { return (isPC ? 'chevron-right' : 'arrow-right'); },
|
|
29
|
-
},
|
|
30
|
-
last: {
|
|
31
|
-
label: '마지막',
|
|
32
|
-
className: 'ncua-pagination__last',
|
|
33
|
-
getIcon: function (isPC) { return 'chevron-right-double'; },
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
export var NavButton = function (_a) {
|
|
37
|
-
var type = _a.type, as = _a.as, isPC = _a.isPC, noPrev = _a.noPrev, noNext = _a.noNext, href = _a.href, target = _a.target, onClick = _a.onClick;
|
|
38
|
-
var config = NAV_BUTTON_CONFIG[type];
|
|
39
|
-
var isNavigationButton = type === 'first' || type === 'prev' || type === 'next' || type === 'last';
|
|
40
|
-
var isFirstOrPrev = type === 'first' || type === 'prev';
|
|
41
|
-
var isNextOrLast = type === 'next' || type === 'last';
|
|
42
|
-
var disabled = isFirstOrPrev ? noPrev : isNextOrLast ? noNext : false;
|
|
43
|
-
// key를 제외한 공통 props
|
|
44
|
-
var buttonProps = {
|
|
45
|
-
label: config.label,
|
|
46
|
-
className: config.className,
|
|
47
|
-
onlyIcon: true,
|
|
48
|
-
leadingIcon: {
|
|
49
|
-
type: 'icon',
|
|
50
|
-
icon: config.getIcon(isPC),
|
|
51
|
-
color: disabled ? 'gray200' : 'gray700',
|
|
52
|
-
},
|
|
53
|
-
hierarchy: 'secondary-gray',
|
|
54
|
-
size: 'xs',
|
|
55
|
-
disabled: disabled,
|
|
56
|
-
onClick: onClick,
|
|
57
|
-
};
|
|
58
|
-
// key 값 별도 계산
|
|
59
|
-
var buttonKey = isNavigationButton ? "".concat(isPC ? 'pc' : 'mobile', "-").concat(type) : undefined;
|
|
60
|
-
if (as === 'a') {
|
|
61
|
-
return _jsx(Button, __assign({ as: "a", href: href, target: target }, buttonProps), buttonKey);
|
|
20
|
+
first: {
|
|
21
|
+
label: '처음',
|
|
22
|
+
className: 'ncua-pagination__first',
|
|
23
|
+
getIcon: function (isPC) {
|
|
24
|
+
return 'chevron-left-double';
|
|
62
25
|
}
|
|
63
|
-
|
|
26
|
+
},
|
|
27
|
+
prev: {
|
|
28
|
+
label: '이전',
|
|
29
|
+
className: 'ncua-pagination__before',
|
|
30
|
+
getIcon: function (isPC) {
|
|
31
|
+
return isPC ? 'chevron-left' : 'arrow-left';
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
next: {
|
|
35
|
+
label: '다음',
|
|
36
|
+
className: 'ncua-pagination__next',
|
|
37
|
+
getIcon: function (isPC) {
|
|
38
|
+
return isPC ? 'chevron-right' : 'arrow-right';
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
last: {
|
|
42
|
+
label: '마지막',
|
|
43
|
+
className: 'ncua-pagination__last',
|
|
44
|
+
getIcon: function (isPC) {
|
|
45
|
+
return 'chevron-right-double';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var NavButton = function (_a) {
|
|
50
|
+
var type = _a.type,
|
|
51
|
+
as = _a.as,
|
|
52
|
+
isPC = _a.isPC,
|
|
53
|
+
noPrev = _a.noPrev,
|
|
54
|
+
noNext = _a.noNext,
|
|
55
|
+
href = _a.href,
|
|
56
|
+
target = _a.target,
|
|
57
|
+
onClick = _a.onClick;
|
|
58
|
+
var config = NAV_BUTTON_CONFIG[type];
|
|
59
|
+
var isNavigationButton = type === 'first' || type === 'prev' || type === 'next' || type === 'last';
|
|
60
|
+
var isFirstOrPrev = type === 'first' || type === 'prev';
|
|
61
|
+
var isNextOrLast = type === 'next' || type === 'last';
|
|
62
|
+
var disabled = isFirstOrPrev ? noPrev : isNextOrLast ? noNext : false;
|
|
63
|
+
// key를 제외한 공통 props
|
|
64
|
+
var buttonProps = {
|
|
65
|
+
label: config.label,
|
|
66
|
+
className: config.className,
|
|
67
|
+
onlyIcon: true,
|
|
68
|
+
leadingIcon: {
|
|
69
|
+
type: 'icon',
|
|
70
|
+
icon: config.getIcon(isPC),
|
|
71
|
+
color: disabled ? 'gray200' : 'gray700'
|
|
72
|
+
},
|
|
73
|
+
hierarchy: 'secondary-gray',
|
|
74
|
+
size: 'xs',
|
|
75
|
+
disabled: disabled,
|
|
76
|
+
onClick: onClick
|
|
77
|
+
};
|
|
78
|
+
// key 값 별도 계산
|
|
79
|
+
var buttonKey = isNavigationButton ? "".concat(isPC ? 'pc' : 'mobile', "-").concat(type) : undefined;
|
|
80
|
+
if (as === 'a') {
|
|
81
|
+
return (0, _jsxRuntime.jsx)(_Button.Button, __assign({
|
|
82
|
+
as: "a",
|
|
83
|
+
href: href,
|
|
84
|
+
target: target
|
|
85
|
+
}, buttonProps), buttonKey);
|
|
86
|
+
}
|
|
87
|
+
return (0, _jsxRuntime.jsx)(_Button.Button, __assign({
|
|
88
|
+
as: "button"
|
|
89
|
+
}, buttonProps), buttonKey);
|
|
64
90
|
};
|
|
91
|
+
exports.NavButton = NavButton;
|
|
@@ -1,109 +1,175 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Pagination = void 0;
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
|
+
var _lodashEs = require("lodash-es");
|
|
10
|
+
var _react = require("react");
|
|
11
|
+
var _constant = require("../../constant");
|
|
12
|
+
var _NavButton = require("./NavButton");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
var __assign = void 0 && (void 0).__assign || function () {
|
|
15
|
+
__assign = Object.assign || function (t) {
|
|
16
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
17
|
+
s = arguments[i];
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
19
|
+
}
|
|
21
20
|
return t;
|
|
21
|
+
};
|
|
22
|
+
return __assign.apply(this, arguments);
|
|
23
|
+
};
|
|
24
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
25
|
+
var t = {};
|
|
26
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
27
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
28
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
22
31
|
};
|
|
23
|
-
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import classNames from 'classnames';
|
|
25
|
-
import { isFunction, range, uniqueId } from 'lodash-es';
|
|
26
|
-
import { useEffect, useState } from 'react';
|
|
27
|
-
import { MINIMUM_PC_SIZE } from '../../constant';
|
|
28
|
-
import { NavButton } from './NavButton';
|
|
29
32
|
// 네비게이션 버튼 설정
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
var Pagination = function (_a) {
|
|
34
|
+
var _b = _a.className,
|
|
35
|
+
className = _b === void 0 ? '' : _b,
|
|
36
|
+
totalCount = _a.totalCount,
|
|
37
|
+
_c = _a.itemCountPerPage,
|
|
38
|
+
itemCountPerPage = _c === void 0 ? 10 : _c,
|
|
39
|
+
_d = _a.pageCount,
|
|
40
|
+
pageCount = _d === void 0 ? 10 : _d,
|
|
41
|
+
currentPage = _a.currentPage,
|
|
42
|
+
_e = _a.as,
|
|
43
|
+
as = _e === void 0 ? 'button' : _e,
|
|
44
|
+
onPageChange = _a.onPageChange,
|
|
45
|
+
restProps = __rest(_a, ["className", "totalCount", "itemCountPerPage", "pageCount", "currentPage", "as", "onPageChange"]);
|
|
46
|
+
var totalPage = Math.ceil(totalCount / itemCountPerPage);
|
|
47
|
+
var _f = (0, _react.useState)(1),
|
|
48
|
+
start = _f[0],
|
|
49
|
+
setStart = _f[1];
|
|
50
|
+
var _g = (0, _react.useState)(globalThis.innerWidth > _constant.MINIMUM_PC_SIZE),
|
|
51
|
+
isPC = _g[0],
|
|
52
|
+
setIsPC = _g[1];
|
|
53
|
+
var noPrev = start === 1;
|
|
54
|
+
var noNext = start + pageCount - 1 >= totalPage;
|
|
55
|
+
var showJumpPageButton = totalPage > pageCount;
|
|
56
|
+
var handleClickButton = function (pageNum) {
|
|
57
|
+
(0, _lodashEs.isFunction)(onPageChange);
|
|
58
|
+
if ((0, _lodashEs.isFunction)(onPageChange)) {
|
|
59
|
+
onPageChange(pageNum);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
(0, _react.useEffect)(function () {
|
|
63
|
+
if (currentPage === start + pageCount) {
|
|
64
|
+
setStart(start + pageCount);
|
|
65
|
+
}
|
|
66
|
+
if (currentPage > start + pageCount) {
|
|
67
|
+
var newStart = Math.floor((currentPage - 1) / pageCount) * pageCount + 1;
|
|
68
|
+
setStart(newStart);
|
|
69
|
+
}
|
|
70
|
+
if (currentPage < start) {
|
|
71
|
+
setStart(start - pageCount);
|
|
72
|
+
}
|
|
73
|
+
if (currentPage === 1) {
|
|
74
|
+
setStart(1);
|
|
75
|
+
}
|
|
76
|
+
if (currentPage === totalPage) {
|
|
77
|
+
var lastGroupStart = Math.max(1, totalPage - pageCount + 1);
|
|
78
|
+
setStart(lastGroupStart);
|
|
79
|
+
}
|
|
80
|
+
}, [currentPage]);
|
|
81
|
+
(0, _react.useEffect)(function () {
|
|
82
|
+
var mql = globalThis.matchMedia("(min-width: ".concat(_constant.MINIMUM_PC_SIZE, "px)"));
|
|
83
|
+
setIsPC(mql.matches);
|
|
84
|
+
var handleResize = function (e) {
|
|
85
|
+
setIsPC(e.matches);
|
|
86
|
+
};
|
|
87
|
+
mql.addEventListener('change', handleResize);
|
|
88
|
+
return function () {
|
|
89
|
+
return mql.removeEventListener('change', handleResize);
|
|
43
90
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
91
|
+
}, []);
|
|
92
|
+
return (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
93
|
+
children: (0, _jsxRuntime.jsxs)("div", __assign({
|
|
94
|
+
className: (0, _classnames.default)('ncua-pagination', className)
|
|
95
|
+
}, {
|
|
96
|
+
children: [showJumpPageButton && (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
97
|
+
children: [(0, _NavButton.NavButton)({
|
|
98
|
+
type: 'first',
|
|
99
|
+
as: as,
|
|
100
|
+
isPC: isPC,
|
|
101
|
+
noPrev: noPrev,
|
|
102
|
+
noNext: noNext,
|
|
103
|
+
href: restProps.href || '',
|
|
104
|
+
target: restProps.target || '',
|
|
105
|
+
onClick: function () {
|
|
106
|
+
return handleClickButton(1);
|
|
107
|
+
}
|
|
108
|
+
}), (0, _NavButton.NavButton)({
|
|
109
|
+
type: 'prev',
|
|
110
|
+
as: as,
|
|
111
|
+
isPC: isPC,
|
|
112
|
+
noPrev: noPrev,
|
|
113
|
+
noNext: noNext,
|
|
114
|
+
href: restProps.href || '',
|
|
115
|
+
target: restProps.target || '',
|
|
116
|
+
onClick: function () {
|
|
117
|
+
return handleClickButton(Math.max(start - pageCount, 1));
|
|
118
|
+
}
|
|
119
|
+
})]
|
|
120
|
+
}), (0, _jsxRuntime.jsx)("ul", __assign({
|
|
121
|
+
className: "ncua-pagination__list"
|
|
122
|
+
}, {
|
|
123
|
+
children: (0, _lodashEs.range)(start, Math.min(totalPage + 1, start + pageCount)).map(function (pageNumber, i) {
|
|
124
|
+
return (0, _jsxRuntime.jsx)("li", __assign({
|
|
125
|
+
className: "ncua-pagination__item"
|
|
126
|
+
}, {
|
|
127
|
+
children: (0, _jsxRuntime.jsx)("button", __assign({
|
|
128
|
+
className: (0, _classnames.default)('ncua-pagination__page-num', {
|
|
129
|
+
'is-current': pageNumber === currentPage
|
|
130
|
+
}),
|
|
131
|
+
onClick: function () {
|
|
132
|
+
return handleClickButton(start + i);
|
|
133
|
+
}
|
|
134
|
+
}, restProps, {
|
|
135
|
+
children: start + i
|
|
136
|
+
}))
|
|
137
|
+
}), (0, _lodashEs.uniqueId)('ncua-pagination__page-num'));
|
|
138
|
+
})
|
|
139
|
+
})), (0, _jsxRuntime.jsxs)("p", __assign({
|
|
140
|
+
className: "ncua-pagination__page-info"
|
|
141
|
+
}, {
|
|
142
|
+
children: [(0, _jsxRuntime.jsx)("em", __assign({
|
|
143
|
+
className: "ncua-pagination__current-num"
|
|
144
|
+
}, {
|
|
145
|
+
children: currentPage
|
|
146
|
+
})), " / ", totalPage]
|
|
147
|
+
})), showJumpPageButton && (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
148
|
+
children: [(0, _NavButton.NavButton)({
|
|
149
|
+
type: 'next',
|
|
150
|
+
as: as,
|
|
151
|
+
isPC: isPC,
|
|
152
|
+
noPrev: noPrev,
|
|
153
|
+
noNext: noNext,
|
|
154
|
+
href: restProps.href || '',
|
|
155
|
+
target: restProps.target || '',
|
|
156
|
+
onClick: function () {
|
|
157
|
+
return handleClickButton(Math.min(start + pageCount, totalPage));
|
|
158
|
+
}
|
|
159
|
+
}), (0, _NavButton.NavButton)({
|
|
160
|
+
type: 'last',
|
|
161
|
+
as: as,
|
|
162
|
+
isPC: isPC,
|
|
163
|
+
noPrev: noPrev,
|
|
164
|
+
noNext: noNext,
|
|
165
|
+
href: restProps.href || '',
|
|
166
|
+
target: restProps.target || '',
|
|
167
|
+
onClick: function () {
|
|
168
|
+
return handleClickButton(totalPage);
|
|
169
|
+
}
|
|
170
|
+
})]
|
|
171
|
+
})]
|
|
172
|
+
}))
|
|
173
|
+
});
|
|
109
174
|
};
|
|
175
|
+
exports.Pagination = Pagination;
|