linkup-lib 0.1.1 → 0.1.3

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.
Files changed (48) hide show
  1. package/dist/CustomButton.d.ts +6 -0
  2. package/dist/CustomButton.js +21 -0
  3. package/dist/LinkupButton.d.ts +7 -0
  4. package/dist/LinkupButton.js +8 -0
  5. package/dist/Registry.d.ts +9 -0
  6. package/dist/Registry.js +16 -0
  7. package/dist/color.d.ts +7 -0
  8. package/dist/color.js +15 -0
  9. package/dist/compoenets/registry/AntdRegistry.d.ts +9 -0
  10. package/dist/compoenets/registry/AntdRegistry.js +13 -0
  11. package/dist/compoenets/registry/ErrorHandler.d.ts +2 -0
  12. package/dist/compoenets/registry/ErrorHandler.js +10 -0
  13. package/dist/compoenets/registry/NextAuthRegistry.d.ts +7 -0
  14. package/dist/compoenets/registry/NextAuthRegistry.js +13 -0
  15. package/dist/compoenets/registry/ReactQueryRegistry.d.ts +6 -0
  16. package/dist/compoenets/registry/ReactQueryRegistry.js +56 -0
  17. package/dist/compoenets/ui/header.d.ts +2 -0
  18. package/dist/compoenets/ui/header.js +29 -0
  19. package/dist/components/registry/AntdRegistry.d.ts +9 -0
  20. package/dist/components/registry/AntdRegistry.js +13 -0
  21. package/dist/components/registry/ErrorHandler.d.ts +2 -0
  22. package/dist/components/registry/ErrorHandler.js +10 -0
  23. package/dist/components/registry/ErrorRegistry.d.ts +5 -0
  24. package/dist/components/registry/ErrorRegistry.js +13 -0
  25. package/dist/components/registry/NextAuthRegistry.d.ts +7 -0
  26. package/dist/components/registry/NextAuthRegistry.js +13 -0
  27. package/dist/components/registry/ReactQueryRegistry.d.ts +6 -0
  28. package/dist/components/registry/ReactQueryRegistry.js +56 -0
  29. package/dist/components/ui/Aside.d.ts +14 -0
  30. package/dist/components/ui/Aside.js +133 -0
  31. package/dist/components/ui/Checkbox.d.ts +8 -0
  32. package/dist/components/ui/Checkbox.js +29 -0
  33. package/dist/components/ui/Grid.d.ts +56 -0
  34. package/dist/components/ui/Grid.js +130 -0
  35. package/dist/components/ui/Header.d.ts +5 -0
  36. package/dist/components/ui/Header.js +45 -0
  37. package/dist/components/ui/Header2.d.ts +5 -0
  38. package/dist/components/ui/Header2.js +20 -0
  39. package/dist/components/ui/Page.d.ts +5 -0
  40. package/dist/components/ui/Page.js +15 -0
  41. package/dist/components/ui/PageTitle.d.ts +7 -0
  42. package/dist/components/ui/PageTitle.js +21 -0
  43. package/dist/image.js +55 -15
  44. package/dist/index.d.ts +35 -0
  45. package/dist/index.js +26 -4
  46. package/dist/util.d.ts +26 -0
  47. package/dist/util.js +52 -2
  48. package/package.json +24 -1
@@ -0,0 +1,56 @@
1
+ import { UseQueryResult } from "@tanstack/react-query";
2
+ import { ColumnsType } from "antd/es/table";
3
+ export declare const hideOptionAtom: import("jotai").PrimitiveAtom<boolean> & {
4
+ init: boolean;
5
+ };
6
+ interface SearchKeywordOption {
7
+ type: 'search';
8
+ title: string;
9
+ keywordType: string | undefined;
10
+ keywordTypeOption: {
11
+ label: string;
12
+ value: string;
13
+ }[];
14
+ onChangeKeywordType: (val: string) => void;
15
+ keyword: string;
16
+ onChangeKeyword: (val: string) => void;
17
+ }
18
+ interface CheckboxOption {
19
+ type: 'checkbox';
20
+ title: string;
21
+ options: {
22
+ label: string;
23
+ value: string;
24
+ color?: string;
25
+ }[];
26
+ value: string[];
27
+ onChange: (val: string[]) => void;
28
+ }
29
+ interface DateRangeOption {
30
+ type: 'dateRange';
31
+ title: string;
32
+ dateType: string | undefined;
33
+ dateTypeOption: {
34
+ label: string;
35
+ value: string;
36
+ }[];
37
+ onChangeDateType: (val: string | undefined) => void;
38
+ startDate: string | undefined;
39
+ endDate: string | undefined;
40
+ onChange: (startDate: string | undefined, endDate: string | undefined) => void;
41
+ }
42
+ type SearchFilterOption = CheckboxOption | DateRangeOption | SearchKeywordOption;
43
+ export interface Props<T> {
44
+ rowKey: keyof T;
45
+ primaryColor?: string;
46
+ searchParams: any;
47
+ fetch: UseQueryResult<any, Error>;
48
+ dataSet: T[];
49
+ columns: ColumnsType<T>;
50
+ searchFilter?: SearchFilterOption[];
51
+ onSearch: () => void;
52
+ onInitFilter: () => void;
53
+ onChangeGrid: (pagination: any, filters: any, sorter: any, extra: any) => void;
54
+ }
55
+ declare const Component: <T>({ rowKey, primaryColor, searchParams, fetch, dataSet, columns, searchFilter, onSearch, onInitFilter, onChangeGrid }: Props<T>) => import("react/jsx-runtime").JSX.Element;
56
+ export default Component;
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ "use client";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.hideOptionAtom = void 0;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const antd_1 = require("antd");
10
+ const Checkbox_1 = __importDefault(require("./Checkbox"));
11
+ const dayjs_1 = __importDefault(require("dayjs"));
12
+ const bs_1 = require("react-icons/bs");
13
+ const jotai_1 = require("jotai");
14
+ exports.hideOptionAtom = (0, jotai_1.atom)(false);
15
+ const comma = (target) => {
16
+ if (Number(target) === 0)
17
+ return 0;
18
+ else if (target)
19
+ return target.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
20
+ else
21
+ target;
22
+ };
23
+ const Component = ({ rowKey, primaryColor = '#3875F7', searchParams, fetch, dataSet, columns, searchFilter, onSearch, onInitFilter, onChangeGrid }) => {
24
+ var _a, _b;
25
+ // 상세 검색 열기/닫기
26
+ const [hideOption, setHideOption] = (0, jotai_1.useAtom)(exports.hideOptionAtom);
27
+ // 전체 데이터 수
28
+ const total = ((_a = fetch.data) === null || _a === void 0 ? void 0 : _a.total) || 0;
29
+ return ((0, jsx_runtime_1.jsxs)("div", { style: {
30
+ padding: '10px 25px'
31
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', flexDirection: 'column', gap: 4 }, children: [!hideOption && (searchFilter === null || searchFilter === void 0 ? void 0 : searchFilter.map((r, i) => {
32
+ // 체크박스
33
+ if (r.type === 'checkbox') {
34
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
35
+ background: 'white',
36
+ border: '1px solid #E3E6ED',
37
+ padding: '20px 30px 16px',
38
+ display: 'flex',
39
+ flexDirection: 'column',
40
+ gap: 16,
41
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
42
+ display: 'flex',
43
+ flexWrap: 'wrap',
44
+ alignItems: 'center',
45
+ }, children: [(0, jsx_runtime_1.jsx)("p", { style: { fontSize: 15, flexBasis: '100px' }, children: r.title }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, display: 'flex', flexWrap: 'wrap', columnGap: 12, rowGap: 4 }, children: r.options.map((o) => {
46
+ return ((0, jsx_runtime_1.jsx)(Checkbox_1.default, { primaryColor: primaryColor, label: o.label, checked: r.value.includes(String(o.value)), onChange: (checked) => {
47
+ let newStatus = [...r.value];
48
+ if (newStatus.includes(String(o.value))) {
49
+ newStatus = newStatus.filter(item => item !== String(o.value));
50
+ }
51
+ else {
52
+ newStatus.push(String(o.value));
53
+ }
54
+ r.onChange(newStatus);
55
+ } }, `checkbox-${o.value}`));
56
+ }) })] }, `filter-${i}`) }, `filter-container-${i}`));
57
+ }
58
+ // 날짜 검색
59
+ else if (r.type === 'dateRange') {
60
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
61
+ background: 'white',
62
+ border: '1px solid #E3E6ED',
63
+ padding: '20px 30px 16px',
64
+ display: 'flex',
65
+ flexDirection: 'column',
66
+ gap: 16,
67
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
68
+ display: 'flex',
69
+ flexWrap: 'wrap',
70
+ alignItems: 'center',
71
+ }, children: [(0, jsx_runtime_1.jsx)("p", { style: { fontSize: 15, flexBasis: '100px' }, children: r.title }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(antd_1.Space.Compact, { size: "middle", children: [(0, jsx_runtime_1.jsx)(antd_1.Select, { placeholder: "\uC120\uD0DD", allowClear: true, value: r.dateType, style: { width: 120 }, options: r.dateTypeOption, onChange: (val) => {
72
+ r.onChangeDateType(val);
73
+ } }), (0, jsx_runtime_1.jsx)(antd_1.Button, { disabled: !r.dateType, onClick: () => {
74
+ r.onChange((0, dayjs_1.default)().subtract(7, 'd').format('YYYYMMDD'), (0, dayjs_1.default)().format('YYYYMMDD'));
75
+ }, children: "\uC77C\uC8FC\uC77C" }), (0, jsx_runtime_1.jsx)(antd_1.Button, { disabled: !r.dateType, onClick: () => {
76
+ r.onChange((0, dayjs_1.default)().subtract(1, 'M').format('YYYYMMDD'), (0, dayjs_1.default)().format('YYYYMMDD'));
77
+ }, children: "1\uAC1C\uC6D4" }), (0, jsx_runtime_1.jsx)(antd_1.Button, { disabled: !r.dateType, onClick: () => {
78
+ r.onChange((0, dayjs_1.default)().subtract(3, 'M').format('YYYYMMDD'), (0, dayjs_1.default)().format('YYYYMMDD'));
79
+ }, children: "3\uAC1C\uC6D4" }), (0, jsx_runtime_1.jsx)(antd_1.Button, { disabled: !r.dateType, onClick: () => {
80
+ r.onChange((0, dayjs_1.default)().subtract(6, 'M').format('YYYYMMDD'), (0, dayjs_1.default)().format('YYYYMMDD'));
81
+ }, children: "6\uAC1C\uC6D4" }), (0, jsx_runtime_1.jsx)(antd_1.Button, { disabled: !r.dateType, onClick: () => {
82
+ r.onChange((0, dayjs_1.default)().subtract(1, 'y').format('YYYYMMDD'), (0, dayjs_1.default)().format('YYYYMMDD'));
83
+ }, children: "1\uB144" }), (0, jsx_runtime_1.jsx)(antd_1.DatePicker.RangePicker, { allowClear: true, allowEmpty: [true, true], disabled: !r.dateType, value: r.startDate && r.endDate ? [r.startDate ? (0, dayjs_1.default)(r.startDate) : null, r.endDate ? (0, dayjs_1.default)(r.endDate) : null] : [null, null], onChange: (dates, dateStrings) => {
84
+ if (dateStrings) {
85
+ r.onChange(dateStrings[0] ? dateStrings[0] : undefined, dateStrings[1] ? dateStrings[1] : undefined);
86
+ }
87
+ else
88
+ r.onChange(undefined, undefined);
89
+ } })] }) })] }, `filter-${i}`) }, `filter-container-${i}`));
90
+ }
91
+ // 키워드 검색
92
+ else if (r.type === 'search') {
93
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
94
+ background: 'white',
95
+ border: '1px solid #E3E6ED',
96
+ padding: '20px 30px 16px',
97
+ display: 'flex',
98
+ flexDirection: 'column',
99
+ gap: 16,
100
+ }, children: (0, jsx_runtime_1.jsxs)("div", { style: {
101
+ display: 'flex',
102
+ flexWrap: 'wrap',
103
+ alignItems: 'center',
104
+ }, children: [(0, jsx_runtime_1.jsx)("p", { style: { fontSize: 15, flexBasis: '100px' }, children: r.title }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)(antd_1.Space.Compact, { size: "middle", children: [(0, jsx_runtime_1.jsx)(antd_1.Select, { placeholder: "\uC120\uD0DD", allowClear: true, value: r.keywordType, style: { width: 120 }, options: r.keywordTypeOption, onChange: (val) => {
105
+ r.onChangeKeywordType(val);
106
+ } }), (0, jsx_runtime_1.jsx)(antd_1.Input, { placeholder: "\uAC80\uC0C9\uC5B4\uB97C \uC785\uB825\uD574\uC8FC\uC138\uC694.", value: r.keyword, onChange: (e) => {
107
+ r.onChangeKeyword(e.target.value);
108
+ }, style: { width: 250 }, onPressEnter: onSearch })] }) })] }, `filter-${i}`) }, `filter-container-${i}`));
109
+ }
110
+ })), (0, jsx_runtime_1.jsxs)("div", { style: {
111
+ width: '100%',
112
+ display: 'flex',
113
+ justifyContent: 'center',
114
+ background: 'white',
115
+ border: '1px solid #E3E6ED',
116
+ padding: '16px 30px 16px',
117
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), (0, jsx_runtime_1.jsx)(antd_1.Button, { size: "middle", style: { width: 100 }, onClick: () => {
118
+ onInitFilter();
119
+ }, children: "\uCD08\uAE30\uD654" }), (0, jsx_runtime_1.jsx)(antd_1.Button, { type: "primary", size: "middle", style: { width: 100 }, onClick: onSearch, children: "\uAC80\uC0C9" }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1, display: 'flex', justifyContent: 'flex-end' }, children: (0, jsx_runtime_1.jsxs)(antd_1.Button, { size: "middle", onClick: () => setHideOption(!hideOption), children: [hideOption ? '상세 검색 펼치기' : '상세 검색 접기', (0, jsx_runtime_1.jsx)(bs_1.BsChevronDown, { style: { color: '#999', transform: hideOption ? 'rotate(0deg)' : 'rotate(180deg)', transition: 'transform 0.3s' } })] }) })] })] }), (0, jsx_runtime_1.jsx)("div", { style: { height: 12 } }), (0, jsx_runtime_1.jsxs)("div", { style: {
120
+ background: 'white',
121
+ border: '1px solid #E3E6ED'
122
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: { padding: '20px 30px 16px', borderBottom: '1px solid #E3E6ED' }, children: (0, jsx_runtime_1.jsxs)("p", { style: { fontSize: 16 }, children: ["\uBAA9\uB85D ( \uCD1D ", (0, jsx_runtime_1.jsx)("span", { style: { color: primaryColor, fontWeight: '600' }, children: ((_b = fetch.data) === null || _b === void 0 ? void 0 : _b.total) || 0 }), " \uAC1C )"] }) }), (0, jsx_runtime_1.jsx)("div", { style: { padding: '20px 30px 16px' }, children: (0, jsx_runtime_1.jsx)(antd_1.Table, { rowKey: (r) => r[rowKey], bordered: true, loading: fetch.isLoading, dataSource: dataSet, columns: columns, scroll: { x: 1024, y: 500 }, showSorterTooltip: false, sortDirections: ['descend', 'ascend'], pagination: {
123
+ current: parseInt(searchParams.page || '1'),
124
+ pageSize: parseInt(searchParams.limit || '10'),
125
+ total: total,
126
+ showSizeChanger: true,
127
+ pageSizeOptions: ['10', '20', '50', '100'],
128
+ }, onChange: onChangeGrid }) })] })] }));
129
+ };
130
+ exports.default = Component;
@@ -0,0 +1,5 @@
1
+ export interface HeaderProps {
2
+ logo: React.ReactNode;
3
+ }
4
+ declare const Component: ({ logo }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
5
+ export default Component;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("next-auth/react");
6
+ const navigation_1 = require("next/navigation");
7
+ const color_1 = require("../../color");
8
+ const Component = ({ logo }) => {
9
+ var _a;
10
+ // 라우터
11
+ const router = (0, navigation_1.useRouter)();
12
+ // 세션
13
+ const session = (0, react_1.useSession)();
14
+ const user = (_a = session.data) === null || _a === void 0 ? void 0 : _a.user;
15
+ // 로그아웃
16
+ const handleLogout = () => {
17
+ (0, react_1.signOut)();
18
+ };
19
+ return ((0, jsx_runtime_1.jsxs)("header", { style: {
20
+ display: 'flex',
21
+ alignItems: 'center',
22
+ width: '100%',
23
+ height: '56px',
24
+ position: 'fixed',
25
+ top: 0,
26
+ left: 0,
27
+ zIndex: 20,
28
+ background: color_1.bg100,
29
+ }, children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("div", { style: {
30
+ display: 'flex',
31
+ alignItems: 'center',
32
+ justifyContent: 'center',
33
+ paddingLeft: '24px',
34
+ cursor: 'pointer',
35
+ }, onClick: () => {
36
+ router.push('/');
37
+ }, children: logo }) }), (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), (0, jsx_runtime_1.jsx)("div", { style: { paddingRight: '24px' }, children:
38
+ // 로그인 됨
39
+ user ?
40
+ (0, jsx_runtime_1.jsxs)("div", { style: { display: 'flex', alignItems: 'center', gap: '16px' }, children: [(0, jsx_runtime_1.jsx)("div", { style: { cursor: 'pointer' }, children: (0, jsx_runtime_1.jsxs)("p", { style: { color: 'white' }, children: [user.id, " \uB2D8"] }) }), (0, jsx_runtime_1.jsx)("div", { style: { cursor: 'pointer' }, onClick: handleLogout, children: (0, jsx_runtime_1.jsx)("p", { style: { color: 'white' }, children: "\uB85C\uADF8\uC544\uC6C3" }) })] })
41
+ :
42
+ // 로그인 안됨
43
+ (0, jsx_runtime_1.jsx)("div", {}) })] }));
44
+ };
45
+ exports.default = Component;
@@ -0,0 +1,5 @@
1
+ export interface Header2Props {
2
+ logo: React.ReactNode;
3
+ }
4
+ declare const Component: ({ logo }: Header2Props) => import("react/jsx-runtime").JSX.Element;
5
+ export default Component;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Component = ({ logo }) => {
6
+ return ((0, jsx_runtime_1.jsx)("header", { style: {
7
+ width: '100%',
8
+ height: '56px',
9
+ background: 'white',
10
+ borderBottom: `1px solid #E4E4E7`,
11
+ display: 'flex',
12
+ alignItems: 'center',
13
+ justifyContent: 'center',
14
+ }, children: (0, jsx_runtime_1.jsx)("div", { style: {
15
+ display: 'flex',
16
+ alignItems: 'center',
17
+ justifyContent: 'center',
18
+ }, children: logo }) }));
19
+ };
20
+ exports.default = Component;
@@ -0,0 +1,5 @@
1
+ export interface PageProps {
2
+ children?: React.ReactNode;
3
+ }
4
+ declare const Component: ({ children }: PageProps) => import("react/jsx-runtime").JSX.Element;
5
+ export default Component;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const Aside_1 = require("./Aside");
6
+ const jotai_1 = require("jotai");
7
+ const Component = ({ children }) => {
8
+ // 사이드바 열림 상태
9
+ const [asideOpen, setAsideOpen] = (0, jotai_1.useAtom)(Aside_1.asideAtom);
10
+ return ((0, jsx_runtime_1.jsx)("div", { style: {
11
+ padding: `56px 0px 0px ${asideOpen ? 210 : 0}px`, minHeight: "100dvh",
12
+ transition: 'all 0.3s',
13
+ }, children: children }));
14
+ };
15
+ exports.default = Component;
@@ -0,0 +1,7 @@
1
+ export interface PageTitleProps {
2
+ title: string;
3
+ section1?: React.ReactNode;
4
+ section2?: React.ReactNode;
5
+ }
6
+ declare const Component: ({ title, section1, section2 }: PageTitleProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default Component;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ "use client";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const cg_1 = require("react-icons/cg");
6
+ const Aside_1 = require("./Aside");
7
+ const jotai_1 = require("jotai");
8
+ const Component = ({ title, section1, section2 }) => {
9
+ // 사이드바 열림 상태
10
+ const [asideOpen, setAsideOpen] = (0, jotai_1.useAtom)(Aside_1.asideAtom);
11
+ return ((0, jsx_runtime_1.jsxs)("section", { style: {
12
+ display: 'flex', alignItems: 'center',
13
+ width: '100%', height: 60, background: '#fff',
14
+ transition: 'all 0.3s',
15
+ }, children: [(0, jsx_runtime_1.jsx)("div", { style: {
16
+ width: 26, height: 60, background: '#EEF0F5',
17
+ borderRight: '1px solid #DCDDE2', borderBottom: '1px solid #DCDDE2',
18
+ display: 'flex', justifyContent: 'center', alignItems: 'center', cursor: 'pointer'
19
+ }, onClick: () => setAsideOpen(!asideOpen), children: (0, jsx_runtime_1.jsx)(cg_1.CgChevronLeft, { style: { color: '#616673', fontSize: 16, transform: asideOpen ? 'rotate(0deg)' : 'rotate(180deg)', transition: 'transform 0.3s ease' } }) }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, display: 'flex', alignItems: 'center', height: '100%', borderBottom: '1px solid #E4E7EE', }, children: [(0, jsx_runtime_1.jsx)("div", { style: { padding: '0px 30px' }, children: (0, jsx_runtime_1.jsx)("p", { style: { fontSize: 20, fontWeight: '600' }, children: title }) }), (0, jsx_runtime_1.jsx)("section", { style: { flex: 1 }, children: section1 }), (0, jsx_runtime_1.jsx)("section", { style: { flex: 1 }, children: section2 })] })] }));
20
+ };
21
+ exports.default = Component;
package/dist/image.js CHANGED
@@ -1,4 +1,37 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
36
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
37
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -15,21 +48,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
48
  exports.deleteS3Object = exports.convertWebpAndUploadBuffer = exports.convertWebpAndUploadFile = void 0;
16
49
  const dayjs_1 = __importDefault(require("dayjs"));
17
50
  const client_s3_1 = require("@aws-sdk/client-s3");
18
- const sharp_1 = __importDefault(require("sharp"));
19
51
  const Bucket = process.env.AWS_S3_BUCKET || ""; // 'secret-order';
20
- const s3 = new client_s3_1.S3Client({
21
- region: process.env.AWS_REGION || "",
22
- credentials: {
23
- accessKeyId: process.env.AWS_ACCESS_KEY_ID || "",
24
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || "",
25
- },
26
- });
52
+ let s3 = null;
53
+ const getS3Client = () => {
54
+ if (!s3) {
55
+ s3 = new client_s3_1.S3Client({
56
+ region: process.env.AWS_REGION || "",
57
+ credentials: {
58
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID || "",
59
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || "",
60
+ },
61
+ });
62
+ }
63
+ return s3;
64
+ };
27
65
  // 이미지를 webp로 변환 후 업로드
28
66
  const convertWebpAndUploadFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file, path, fileName, size }) {
29
67
  try {
30
68
  const buffer = yield file.arrayBuffer();
31
69
  // 이미지를 webp로 변환
32
- const convert = yield (0, sharp_1.default)(buffer).webp({
70
+ const sharp = (yield Promise.resolve().then(() => __importStar(require("sharp")))).default;
71
+ const convert = yield sharp(buffer).webp({
33
72
  quality: 90,
34
73
  // lossless: true,
35
74
  // nearLossless: true,
@@ -39,7 +78,7 @@ const convertWebpAndUploadFile = (_a) => __awaiter(void 0, [_a], void 0, functio
39
78
  if (!convert) {
40
79
  throw new Error('이미지 변환에 실패했습니다.');
41
80
  }
42
- const resized = size ? yield (0, sharp_1.default)(convert)
81
+ const resized = size ? yield sharp(convert)
43
82
  .resize({ width: size, withoutEnlargement: true })
44
83
  .toBuffer() : convert;
45
84
  if (!fileName)
@@ -47,7 +86,7 @@ const convertWebpAndUploadFile = (_a) => __awaiter(void 0, [_a], void 0, functio
47
86
  // 스트림을 사용하여 S3에 업로드
48
87
  const Key = `${path}/${fileName}.webp`;
49
88
  // S3에 업로드하고 결과 출력
50
- const res = yield s3.send(new client_s3_1.PutObjectCommand({
89
+ const res = yield getS3Client().send(new client_s3_1.PutObjectCommand({
51
90
  Bucket,
52
91
  Key,
53
92
  Body: resized,
@@ -65,7 +104,8 @@ exports.convertWebpAndUploadFile = convertWebpAndUploadFile;
65
104
  const convertWebpAndUploadBuffer = (_a) => __awaiter(void 0, [_a], void 0, function* ({ buffer, path, fileName, size }) {
66
105
  try {
67
106
  // 이미지를 webp로 변환
68
- const convert = yield (0, sharp_1.default)(buffer).webp({
107
+ const sharp = (yield Promise.resolve().then(() => __importStar(require("sharp")))).default;
108
+ const convert = yield sharp(buffer).webp({
69
109
  quality: 90,
70
110
  // lossless: true,
71
111
  // nearLossless: true,
@@ -75,7 +115,7 @@ const convertWebpAndUploadBuffer = (_a) => __awaiter(void 0, [_a], void 0, funct
75
115
  if (!convert) {
76
116
  throw new Error('이미지 변환에 실패했습니다.');
77
117
  }
78
- const resized = size ? yield (0, sharp_1.default)(convert)
118
+ const resized = size ? yield sharp(convert)
79
119
  .resize({ width: size, withoutEnlargement: true })
80
120
  .toBuffer() : convert;
81
121
  if (!fileName)
@@ -83,7 +123,7 @@ const convertWebpAndUploadBuffer = (_a) => __awaiter(void 0, [_a], void 0, funct
83
123
  // 스트림을 사용하여 S3에 업로드
84
124
  const Key = `${path}/${fileName}.webp`;
85
125
  // S3에 업로드하고 결과 출력
86
- const res = yield s3.send(new client_s3_1.PutObjectCommand({
126
+ const res = yield getS3Client().send(new client_s3_1.PutObjectCommand({
87
127
  Bucket,
88
128
  Key,
89
129
  Body: resized,
@@ -99,7 +139,7 @@ const convertWebpAndUploadBuffer = (_a) => __awaiter(void 0, [_a], void 0, funct
99
139
  exports.convertWebpAndUploadBuffer = convertWebpAndUploadBuffer;
100
140
  const deleteS3Object = (key) => __awaiter(void 0, void 0, void 0, function* () {
101
141
  try {
102
- const res = yield s3.send(new client_s3_1.DeleteObjectCommand({
142
+ const res = yield getS3Client().send(new client_s3_1.DeleteObjectCommand({
103
143
  Bucket,
104
144
  Key: key,
105
145
  }));
package/dist/index.d.ts CHANGED
@@ -1,3 +1,16 @@
1
+ import util from './util';
2
+ import image from './image';
3
+ import ReactQueryRegistry from './components/registry/ReactQueryRegistry';
4
+ import AntdRegistry from "./components/registry/AntdRegistry";
5
+ import NextAuthRegistry from './components/registry/NextAuthRegistry';
6
+ import ErrorRegistry from './components/registry/ErrorRegistry';
7
+ import PageTitle from './components/ui/PageTitle';
8
+ import Header from './components/ui/Header';
9
+ import Header2 from './components/ui/Header2';
10
+ import Aside from './components/ui/Aside';
11
+ import Page from './components/ui/Page';
12
+ import Checkbox from './components/ui/Checkbox';
13
+ import Grid from './components/ui/Grid';
1
14
  declare const _default: {
2
15
  util: {
3
16
  format: {
@@ -30,6 +43,16 @@ declare const _default: {
30
43
  time: (sec: number) => string;
31
44
  diffProperties: (prev: any, next: any) => any;
32
45
  };
46
+ validate: {
47
+ id: (value: string) => {
48
+ message: string;
49
+ result: boolean;
50
+ };
51
+ password: (value: string) => {
52
+ message: string;
53
+ result: boolean;
54
+ };
55
+ };
33
56
  };
34
57
  image: {
35
58
  convertWebpAndUploadFile: ({ file, path, fileName, size }: {
@@ -96,5 +119,17 @@ declare const _default: {
96
119
  $metadata: import("@smithy/types").ResponseMetadata;
97
120
  }>;
98
121
  };
122
+ Header: ({ logo }: import("./components/ui/Header").HeaderProps) => import("react/jsx-runtime").JSX.Element;
123
+ Header2: ({ logo }: import("./components/ui/Header2").Header2Props) => import("react/jsx-runtime").JSX.Element;
124
+ Aside: ({ primaryColor, menus }: import("./components/ui/Aside").AsideProps) => import("react/jsx-runtime").JSX.Element;
125
+ Page: ({ children }: import("./components/ui/Page").PageProps) => import("react/jsx-runtime").JSX.Element;
126
+ PageTitle: ({ title, section1, section2 }: import("./components/ui/PageTitle").PageTitleProps) => import("react/jsx-runtime").JSX.Element;
127
+ ReactQueryRegistry: import("react").MemoExoticComponent<({ children }: import("./components/registry/ReactQueryRegistry").Props) => import("react/jsx-runtime").JSX.Element>;
128
+ AntdRegistry: ({ size, theme, children }: import("./components/registry/AntdRegistry").RootLayoutProps) => import("react/jsx-runtime").JSX.Element;
129
+ NextAuthRegistry: import("react").MemoExoticComponent<({ children }: import("./components/registry/NextAuthRegistry").Props) => import("react/jsx-runtime").JSX.Element>;
130
+ ErrorRegistry: ({ children }: import("./components/registry/ErrorRegistry").Props) => import("react/jsx-runtime").JSX.Element;
131
+ Checkbox: ({ label, checked, primaryColor, onChange }: import("./components/ui/Checkbox").Props) => import("react/jsx-runtime").JSX.Element;
132
+ Grid: <T>({ rowKey, primaryColor, searchParams, fetch, dataSet, columns, searchFilter, onSearch, onInitFilter, onChangeGrid }: import("./components/ui/Grid").Props<T>) => import("react/jsx-runtime").JSX.Element;
99
133
  };
100
134
  export default _default;
135
+ export { util, image, Header, Header2, Aside, Page, PageTitle, ReactQueryRegistry, AntdRegistry, NextAuthRegistry, ErrorRegistry, Checkbox, Grid };
package/dist/index.js CHANGED
@@ -3,9 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Grid = exports.Checkbox = exports.ErrorRegistry = exports.NextAuthRegistry = exports.AntdRegistry = exports.ReactQueryRegistry = exports.PageTitle = exports.Page = exports.Aside = exports.Header2 = exports.Header = exports.image = exports.util = void 0;
6
7
  const util_1 = __importDefault(require("./util"));
8
+ exports.util = util_1.default;
7
9
  const image_1 = __importDefault(require("./image"));
8
- exports.default = {
9
- util: util_1.default,
10
- image: image_1.default,
11
- };
10
+ exports.image = image_1.default;
11
+ const ReactQueryRegistry_1 = __importDefault(require("./components/registry/ReactQueryRegistry"));
12
+ exports.ReactQueryRegistry = ReactQueryRegistry_1.default;
13
+ const AntdRegistry_1 = __importDefault(require("./components/registry/AntdRegistry"));
14
+ exports.AntdRegistry = AntdRegistry_1.default;
15
+ const NextAuthRegistry_1 = __importDefault(require("./components/registry/NextAuthRegistry"));
16
+ exports.NextAuthRegistry = NextAuthRegistry_1.default;
17
+ const ErrorRegistry_1 = __importDefault(require("./components/registry/ErrorRegistry"));
18
+ exports.ErrorRegistry = ErrorRegistry_1.default;
19
+ const PageTitle_1 = __importDefault(require("./components/ui/PageTitle"));
20
+ exports.PageTitle = PageTitle_1.default;
21
+ const Header_1 = __importDefault(require("./components/ui/Header"));
22
+ exports.Header = Header_1.default;
23
+ const Header2_1 = __importDefault(require("./components/ui/Header2"));
24
+ exports.Header2 = Header2_1.default;
25
+ const Aside_1 = __importDefault(require("./components/ui/Aside"));
26
+ exports.Aside = Aside_1.default;
27
+ const Page_1 = __importDefault(require("./components/ui/Page"));
28
+ exports.Page = Page_1.default;
29
+ const Checkbox_1 = __importDefault(require("./components/ui/Checkbox"));
30
+ exports.Checkbox = Checkbox_1.default;
31
+ const Grid_1 = __importDefault(require("./components/ui/Grid"));
32
+ exports.Grid = Grid_1.default;
33
+ exports.default = { util: util_1.default, image: image_1.default, Header: Header_1.default, Header2: Header2_1.default, Aside: Aside_1.default, Page: Page_1.default, PageTitle: PageTitle_1.default, ReactQueryRegistry: ReactQueryRegistry_1.default, AntdRegistry: AntdRegistry_1.default, NextAuthRegistry: NextAuthRegistry_1.default, ErrorRegistry: ErrorRegistry_1.default, Checkbox: Checkbox_1.default, Grid: Grid_1.default };
package/dist/util.d.ts CHANGED
@@ -1,3 +1,16 @@
1
+ export declare const validate: {
2
+ /**
3
+ * 아이디 검증
4
+ */
5
+ id: (value: string) => {
6
+ message: string;
7
+ result: boolean;
8
+ };
9
+ password: (value: string) => {
10
+ message: string;
11
+ result: boolean;
12
+ };
13
+ };
1
14
  export declare const format: {
2
15
  /**
3
16
  * 숫자에 3자리마다 콤마(,) 추가
@@ -65,5 +78,18 @@ declare const _default: {
65
78
  time: (sec: number) => string;
66
79
  diffProperties: (prev: any, next: any) => any;
67
80
  };
81
+ validate: {
82
+ /**
83
+ * 아이디 검증
84
+ */
85
+ id: (value: string) => {
86
+ message: string;
87
+ result: boolean;
88
+ };
89
+ password: (value: string) => {
90
+ message: string;
91
+ result: boolean;
92
+ };
93
+ };
68
94
  };
69
95
  export default _default;
package/dist/util.js CHANGED
@@ -1,6 +1,55 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.get = exports.feature = exports.is = exports.format = void 0;
3
+ exports.get = exports.feature = exports.is = exports.format = exports.validate = void 0;
4
+ exports.validate = {
5
+ /**
6
+ * 아이디 검증
7
+ */
8
+ id: (value) => {
9
+ let message = "";
10
+ let result = false;
11
+ value = value.trim();
12
+ if (value.length === 0) {
13
+ message = "아이디를 입력해주세요.";
14
+ result = false;
15
+ }
16
+ else if (value.length < 5 || value.length >= 50) {
17
+ message = "아이디는 5자 이상 50자 미만이어야 합니다.";
18
+ result = false;
19
+ }
20
+ else if (!/^[a-z]/.test(value)) {
21
+ message = "아이디는 영소문자로 시작해야 합니다.";
22
+ result = false;
23
+ }
24
+ else {
25
+ message = "";
26
+ result = true;
27
+ }
28
+ return { message, result };
29
+ },
30
+ password: (value) => {
31
+ let message = "";
32
+ let result = false;
33
+ value = value.trim();
34
+ if (value.length === 0) {
35
+ message = "비밀번호를 입력해주세요.";
36
+ result = false;
37
+ }
38
+ else if (value.length < 6 || value.length > 20) {
39
+ message = "비밀번호는 6자 이상 20자 이하이어야 합니다.";
40
+ result = false;
41
+ }
42
+ else if (!/^(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[!@#$%^&*()_+|<>?:{}])/.test(value)) {
43
+ message = "비밀번호는 영문, 숫자, 특수문자를 포함해야 합니다.";
44
+ result = false;
45
+ }
46
+ else {
47
+ message = "";
48
+ result = true;
49
+ }
50
+ return { message, result };
51
+ }
52
+ };
4
53
  exports.format = {
5
54
  /**
6
55
  * 숫자에 3자리마다 콤마(,) 추가
@@ -200,5 +249,6 @@ exports.default = {
200
249
  format: exports.format,
201
250
  is: exports.is,
202
251
  feature: exports.feature,
203
- get: exports.get
252
+ get: exports.get,
253
+ validate: exports.validate,
204
254
  };