linkup-lib 0.1.7 → 0.1.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.
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  export interface RootLayoutProps {
3
3
  size?: 'small' | 'middle' | 'large';
4
+ color?: string;
4
5
  children: React.ReactNode;
5
6
  }
6
- declare const RootLayout: ({ size, children }: RootLayoutProps) => import("react/jsx-runtime").JSX.Element;
7
+ declare const RootLayout: ({ size, children, color }: RootLayoutProps) => import("react/jsx-runtime").JSX.Element;
7
8
  export default RootLayout;
@@ -21,7 +21,9 @@ const theme = {
21
21
  headerSortActiveBg: '#dbeafe',
22
22
  headerSortHoverBg: '#dbeafe',
23
23
  bodySortBg: '#f5f5f5',
24
- rowHoverBg: '#f9f9f9'
24
+ rowHoverBg: '#f9f9f9',
25
+ rowSelectedBg: '#f4f4f5',
26
+ rowSelectedHoverBg: '#f4f4f5',
25
27
  },
26
28
  Input: {
27
29
  borderRadiusSM: 0,
@@ -43,5 +45,5 @@ const theme = {
43
45
  }
44
46
  }
45
47
  };
46
- const RootLayout = ({ size = 'small', children }) => ((0, jsx_runtime_1.jsx)(nextjs_registry_1.AntdRegistry, { children: (0, jsx_runtime_1.jsx)(antd_1.ConfigProvider, { componentSize: size, theme: theme, locale: ko_KR_1.default, children: children }) }));
48
+ const RootLayout = ({ size = 'small', children, color }) => ((0, jsx_runtime_1.jsx)(nextjs_registry_1.AntdRegistry, { children: (0, jsx_runtime_1.jsx)(antd_1.ConfigProvider, { componentSize: size, theme: Object.assign(Object.assign({}, theme), { token: Object.assign(Object.assign({}, theme.token), { colorPrimary: color }) }), locale: ko_KR_1.default, children: children }) }));
47
49
  exports.default = RootLayout;
@@ -1,6 +1,7 @@
1
1
  export interface Props {
2
2
  size?: 'small' | 'middle' | 'large';
3
3
  children: React.ReactNode;
4
+ color?: string;
4
5
  }
5
- declare const Component: ({ size, children }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ declare const Component: ({ size, children, color }: Props) => import("react/jsx-runtime").JSX.Element;
6
7
  export default Component;
@@ -8,7 +8,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const NextAuthRegistry_1 = __importDefault(require("../registry/NextAuthRegistry"));
9
9
  const ErrorRegistry_1 = __importDefault(require("../registry/ErrorRegistry"));
10
10
  const AntdRegistry_1 = __importDefault(require("../registry/AntdRegistry"));
11
- const Component = ({ size = 'small', children }) => {
12
- return ((0, jsx_runtime_1.jsx)(NextAuthRegistry_1.default, { session: true, children: (0, jsx_runtime_1.jsx)(AntdRegistry_1.default, { size: size, children: (0, jsx_runtime_1.jsx)(ErrorRegistry_1.default, { children: children }) }) }));
11
+ const Component = ({ size = 'small', children, color }) => {
12
+ return ((0, jsx_runtime_1.jsx)(NextAuthRegistry_1.default, { session: true, children: (0, jsx_runtime_1.jsx)(AntdRegistry_1.default, { size: size, color: color, children: (0, jsx_runtime_1.jsx)(ErrorRegistry_1.default, { children: children }) }) }));
13
13
  };
14
14
  exports.default = Component;
@@ -1,5 +1,6 @@
1
+ import React from "react";
1
2
  export interface Props {
2
- label: string;
3
+ label: React.ReactNode;
3
4
  checked: boolean;
4
5
  primaryColor: string;
5
6
  onChange: (checked: boolean) => void;
@@ -24,6 +24,6 @@ const Component = ({ label, checked, primaryColor, onChange }) => {
24
24
  background: checked ? primaryColor : 'white',
25
25
  transition: 'all 0.3s',
26
26
  overflow: 'hidden',
27
- }, children: (0, jsx_runtime_1.jsx)(im_1.ImCheckmark, { style: { fontSize: 12, color: "white", transition: 'all 0.3s', transform: checked ? 'translate(0, 0)' : 'translate(0px, -20px)' } }) }), (0, jsx_runtime_1.jsx)("p", { style: { marginTop: 2 }, children: label })] }));
27
+ }, children: (0, jsx_runtime_1.jsx)(im_1.ImCheckmark, { style: { fontSize: 12, color: "white", transition: 'all 0.3s', transform: checked ? 'translate(0, 0)' : 'translate(0px, -20px)' } }) }), (0, jsx_runtime_1.jsx)("div", { style: { marginTop: 2, flex: 1 }, children: label })] }));
28
28
  };
29
29
  exports.default = Component;
@@ -50,7 +50,8 @@ export interface Props<T> {
50
50
  onSearch: () => void;
51
51
  onInitFilter: () => void;
52
52
  onChangeGrid: (pagination: any, filters: any, sorter: any, extra: any) => void;
53
+ onChangeSelectedKey?: (selectedKeys: React.Key[]) => void;
53
54
  buttons?: React.ReactNode[];
54
55
  }
55
- declare const Component: <T>({ rowKey, primaryColor, searchParams, fetch, columns, searchFilter, onSearch, onInitFilter, onChangeGrid, buttons }: Props<T>) => import("react/jsx-runtime").JSX.Element;
56
+ declare const Component: <T>({ rowKey, primaryColor, searchParams, fetch, columns, searchFilter, onSearch, onInitFilter, onChangeGrid, onChangeSelectedKey, buttons }: Props<T>) => import("react/jsx-runtime").JSX.Element;
56
57
  export default Component;
@@ -12,7 +12,7 @@ const dayjs_1 = __importDefault(require("dayjs"));
12
12
  const bs_1 = require("react-icons/bs");
13
13
  const jotai_1 = require("jotai");
14
14
  exports.hideOptionAtom = (0, jotai_1.atom)(false);
15
- const Component = ({ rowKey, primaryColor = '#3875F7', searchParams, fetch, columns, searchFilter, onSearch, onInitFilter, onChangeGrid, buttons }) => {
15
+ const Component = ({ rowKey, primaryColor = '#3875F7', searchParams, fetch, columns, searchFilter, onSearch, onInitFilter, onChangeGrid, onChangeSelectedKey, buttons }) => {
16
16
  var _a, _b, _c;
17
17
  // 상세 검색 열기/닫기
18
18
  const [hideOption, setHideOption] = (0, jotai_1.useAtom)(exports.hideOptionAtom);
@@ -117,7 +117,11 @@ const Component = ({ rowKey, primaryColor = '#3875F7', searchParams, fetch, colu
117
117
  }, children: "\uCD08\uAE30\uD654" }), (0, jsx_runtime_1.jsx)(antd_1.Button, { loading: fetch.isFetching, 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: {
118
118
  background: 'white',
119
119
  border: '1px solid #E3E6ED'
120
- }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { padding: '20px 30px 16px', borderBottom: '1px solid #E3E6ED', display: 'flex', alignItems: 'center' }, 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: { flex: 1, display: 'flex', justifyContent: 'flex-end', gap: 8 }, children: buttons })] }), (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.isFetching, dataSource: ((_c = fetch.data) === null || _c === void 0 ? void 0 : _c.dataSet) || [], columns: columns, scroll: { x: 1024, y: 500 }, showSorterTooltip: false, sortDirections: ['descend', 'ascend'], pagination: {
120
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { padding: '20px 30px 16px', borderBottom: '1px solid #E3E6ED', display: 'flex', alignItems: 'center' }, 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: { flex: 1, display: 'flex', justifyContent: 'flex-end', gap: 8 }, children: buttons })] }), (0, jsx_runtime_1.jsx)("div", { style: { padding: '20px 30px 16px' }, children: (0, jsx_runtime_1.jsx)(antd_1.Table, { rowSelection: {
121
+ onChange: onChangeSelectedKey ? (selectedRowKeys) => {
122
+ onChangeSelectedKey(selectedRowKeys);
123
+ } : undefined,
124
+ }, rowKey: (r) => r[rowKey], bordered: true, loading: fetch.isFetching, dataSource: ((_c = fetch.data) === null || _c === void 0 ? void 0 : _c.dataSet) || [], columns: columns, scroll: { x: 1024, y: 500 }, showSorterTooltip: false, sortDirections: ['descend', 'ascend'], pagination: {
121
125
  current: parseInt(searchParams.page || '1'),
122
126
  pageSize: parseInt(searchParams.limit || '10'),
123
127
  total: total,
package/dist/db.js CHANGED
@@ -38,6 +38,11 @@ const registerService = (name, initFn) => {
38
38
  return initFn();
39
39
  };
40
40
  exports.pool = registerService('mysql', () => promise_1.default.createPool({
41
+ host: process.env.DATABASE_HOST || "",
42
+ port: 3306,
43
+ user: process.env.DATABASE_USER || "",
44
+ password: process.env.DATABASE_PASSWORD || "",
45
+ database: process.env.DATABASE_NAME || "",
41
46
  connectionLimit: 1000,
42
47
  waitForConnections: true,
43
48
  keepAliveInitialDelay: 10000, // 0 by default.
package/dist/index.d.ts CHANGED
@@ -15,6 +15,7 @@ declare const _default: {
15
15
  card: (cardNumber: string) => string;
16
16
  tel: (tel: string) => string;
17
17
  bizNum: (bizNum: string) => string;
18
+ email: (email: string) => boolean;
18
19
  };
19
20
  is: {
20
21
  isEng: (s: string) => boolean;
@@ -26,7 +27,7 @@ declare const _default: {
26
27
  onChangeBrowserUrl: (searchParams: any) => void;
27
28
  };
28
29
  get: {
29
- number: (value: string | number) => number;
30
+ number: (value: string | number) => number | RegExpMatchArray | null;
30
31
  josa: (word: string) => {
31
32
  이가: string;
32
33
  은는: string;
@@ -49,6 +50,18 @@ declare const _default: {
49
50
  message: string;
50
51
  result: boolean;
51
52
  };
53
+ tel: (value: string) => {
54
+ message: string;
55
+ result: boolean;
56
+ };
57
+ email: (value: string) => {
58
+ message: string;
59
+ result: boolean;
60
+ };
61
+ bizNum: (value: string) => {
62
+ message: string;
63
+ result: boolean;
64
+ };
52
65
  };
53
66
  };
54
67
  image: {
@@ -121,9 +134,9 @@ declare const _default: {
121
134
  Aside: ({ primaryColor, menus }: import("./components/ui/Aside").AsideProps) => import("react/jsx-runtime").JSX.Element;
122
135
  Page: ({ children }: import("./components/ui/Page").PageProps) => import("react/jsx-runtime").JSX.Element;
123
136
  PageTitle: ({ title, section1, section2 }: import("./components/ui/PageTitle").PageTitleProps) => import("react/jsx-runtime").JSX.Element;
124
- LinkupProvider: ({ size, children }: import("./components/registry/Registry").Props) => import("react/jsx-runtime").JSX.Element;
137
+ LinkupProvider: ({ size, children, color }: import("./components/registry/Registry").Props) => import("react/jsx-runtime").JSX.Element;
125
138
  Checkbox: ({ label, checked, primaryColor, onChange }: import("./components/ui/Checkbox").Props) => import("react/jsx-runtime").JSX.Element;
126
- Grid: <T>({ rowKey, primaryColor, searchParams, fetch, columns, searchFilter, onSearch, onInitFilter, onChangeGrid, buttons }: import("./components/ui/Grid").Props<T>) => import("react/jsx-runtime").JSX.Element;
139
+ Grid: <T>({ rowKey, primaryColor, searchParams, fetch, columns, searchFilter, onSearch, onInitFilter, onChangeGrid, onChangeSelectedKey, buttons }: import("./components/ui/Grid").Props<T>) => import("react/jsx-runtime").JSX.Element;
127
140
  };
128
141
  export default _default;
129
142
  export { util, image, Header, Header2, Aside, Page, PageTitle, LinkupProvider, Checkbox, Grid };
package/dist/util.d.ts CHANGED
@@ -10,6 +10,18 @@ export declare const validate: {
10
10
  message: string;
11
11
  result: boolean;
12
12
  };
13
+ tel: (value: string) => {
14
+ message: string;
15
+ result: boolean;
16
+ };
17
+ email: (value: string) => {
18
+ message: string;
19
+ result: boolean;
20
+ };
21
+ bizNum: (value: string) => {
22
+ message: string;
23
+ result: boolean;
24
+ };
13
25
  };
14
26
  export declare const format: {
15
27
  /**
@@ -19,6 +31,7 @@ export declare const format: {
19
31
  card: (cardNumber: string) => string;
20
32
  tel: (tel: string) => string;
21
33
  bizNum: (bizNum: string) => string;
34
+ email: (email: string) => boolean;
22
35
  };
23
36
  export declare const is: {
24
37
  isEng: (s: string) => boolean;
@@ -30,7 +43,7 @@ export declare const feature: {
30
43
  onChangeBrowserUrl: (searchParams: any) => void;
31
44
  };
32
45
  export declare const get: {
33
- number: (value: string | number) => number;
46
+ number: (value: string | number) => number | RegExpMatchArray | null;
34
47
  josa: (word: string) => {
35
48
  이가: string;
36
49
  은는: string;
@@ -53,6 +66,7 @@ declare const _default: {
53
66
  card: (cardNumber: string) => string;
54
67
  tel: (tel: string) => string;
55
68
  bizNum: (bizNum: string) => string;
69
+ email: (email: string) => boolean;
56
70
  };
57
71
  is: {
58
72
  isEng: (s: string) => boolean;
@@ -64,7 +78,7 @@ declare const _default: {
64
78
  onChangeBrowserUrl: (searchParams: any) => void;
65
79
  };
66
80
  get: {
67
- number: (value: string | number) => number;
81
+ number: (value: string | number) => number | RegExpMatchArray | null;
68
82
  josa: (word: string) => {
69
83
  이가: string;
70
84
  은는: string;
@@ -90,6 +104,18 @@ declare const _default: {
90
104
  message: string;
91
105
  result: boolean;
92
106
  };
107
+ tel: (value: string) => {
108
+ message: string;
109
+ result: boolean;
110
+ };
111
+ email: (value: string) => {
112
+ message: string;
113
+ result: boolean;
114
+ };
115
+ bizNum: (value: string) => {
116
+ message: string;
117
+ result: boolean;
118
+ };
93
119
  };
94
120
  };
95
121
  export default _default;
package/dist/util.js CHANGED
@@ -48,6 +48,76 @@ exports.validate = {
48
48
  result = true;
49
49
  }
50
50
  return { message, result };
51
+ },
52
+ tel: (value) => {
53
+ let message = "";
54
+ let result = false;
55
+ value = value.trim();
56
+ const telPattern = /^(01([0|1|6|7|8|9])|02|0[3-9]{1}[0-9]{1}|070)-?([0-9]{3,4})-?([0-9]{4})$/;
57
+ if (value.length === 0) {
58
+ message = "전화번호를 입력해주세요.";
59
+ result = false;
60
+ }
61
+ else if (!telPattern.test(value)) {
62
+ message = "올바른 전화번호 형식이 아닙니다.";
63
+ result = false;
64
+ }
65
+ else {
66
+ message = "";
67
+ result = true;
68
+ }
69
+ return { message, result };
70
+ },
71
+ email: (value) => {
72
+ let message = "";
73
+ let result = false;
74
+ value = value.trim();
75
+ const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
76
+ if (value.length === 0) {
77
+ message = "이메일을 입력해주세요.";
78
+ result = false;
79
+ }
80
+ else if (!emailPattern.test(value)) {
81
+ message = "올바른 이메일 형식이 아닙니다.";
82
+ result = false;
83
+ }
84
+ else {
85
+ message = "";
86
+ result = true;
87
+ }
88
+ return { message, result };
89
+ },
90
+ bizNum: (value) => {
91
+ let message = "";
92
+ let result = false;
93
+ value = value.trim().replace(/-/g, '');
94
+ if (value.length === 0) {
95
+ message = "사업자등록번호를 입력해주세요.";
96
+ result = false;
97
+ }
98
+ else if (value.length !== 10 || !/^\d{10}$/.test(value)) {
99
+ message = "사업자등록번호는 10자리 숫자여야 합니다.";
100
+ result = false;
101
+ }
102
+ else {
103
+ // 사업자등록번호 검증 알고리즘
104
+ const checkDigit = [1, 3, 7, 1, 3, 7, 1, 3, 5];
105
+ let sum = 0;
106
+ for (let i = 0; i < 9; i++) {
107
+ sum += Number(value[i]) * checkDigit[i];
108
+ }
109
+ sum += Math.floor((Number(value[8]) * 5) / 10);
110
+ const remainder = (10 - (sum % 10)) % 10;
111
+ if (remainder === Number(value[9])) {
112
+ message = "";
113
+ result = true;
114
+ }
115
+ else {
116
+ message = "유효하지 않은 사업자등록번호입니다.";
117
+ result = false;
118
+ }
119
+ }
120
+ return { message, result };
51
121
  }
52
122
  };
53
123
  exports.format = {
@@ -93,6 +163,11 @@ exports.format = {
93
163
  else {
94
164
  return bizNum;
95
165
  }
166
+ },
167
+ // 이메일 검증
168
+ email: (email) => {
169
+ const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
170
+ return emailPattern.test(email);
96
171
  }
97
172
  };
98
173
  exports.is = {
@@ -132,7 +207,7 @@ exports.get = {
132
207
  return value;
133
208
  }
134
209
  const match = value.match(/[\d.]+/g);
135
- return match ? parseFloat(match[0]) : 0;
210
+ return match;
136
211
  },
137
212
  // 한글 조사 처리
138
213
  josa: (word) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linkup-lib",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "링크업 패키지",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",