dn-react-router-toolkit 0.7.15 → 0.8.1

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 (67) hide show
  1. package/dist/api/create_api_handler.d.mts +5 -4
  2. package/dist/api/create_api_handler.d.ts +5 -4
  3. package/dist/api/create_api_handler.js +0 -1
  4. package/dist/api/create_api_handler.mjs +0 -1
  5. package/dist/api/index.d.mts +1 -0
  6. package/dist/api/index.d.ts +1 -0
  7. package/dist/api/index.js +13 -6
  8. package/dist/api/index.mjs +14 -7
  9. package/dist/api/item_api_handler.d.mts +8 -5
  10. package/dist/api/item_api_handler.d.ts +8 -5
  11. package/dist/api/item_api_handler.js +13 -5
  12. package/dist/api/item_api_handler.mjs +14 -6
  13. package/dist/crud/crud_loader.d.mts +6 -5
  14. package/dist/crud/crud_loader.d.ts +6 -5
  15. package/dist/crud/crud_loader.js +79 -38
  16. package/dist/crud/crud_loader.mjs +81 -39
  17. package/dist/crud/crud_page.d.mts +3 -2
  18. package/dist/crud/crud_page.d.ts +3 -2
  19. package/dist/crud/crud_page.js +279 -201
  20. package/dist/crud/crud_page.mjs +277 -205
  21. package/dist/crud/generate_handlers.d.mts +3 -2
  22. package/dist/crud/generate_handlers.d.ts +3 -2
  23. package/dist/crud/generate_pages.d.mts +2 -1
  24. package/dist/crud/generate_pages.d.ts +2 -1
  25. package/dist/crud/index.d.mts +5 -3
  26. package/dist/crud/index.d.ts +5 -3
  27. package/dist/crud/index.js +338 -219
  28. package/dist/crud/index.mjs +346 -232
  29. package/dist/post/index.js +71 -64
  30. package/dist/post/index.mjs +76 -74
  31. package/dist/post/post_form_page.js +71 -64
  32. package/dist/post/post_form_page.mjs +76 -74
  33. package/dist/table/index.d.mts +7 -3
  34. package/dist/table/index.d.ts +7 -3
  35. package/dist/table/index.js +233 -111
  36. package/dist/table/index.mjs +230 -116
  37. package/dist/table/item_loader.d.mts +5 -4
  38. package/dist/table/item_loader.d.ts +5 -4
  39. package/dist/table/load_table.d.mts +36 -0
  40. package/dist/table/load_table.d.ts +36 -0
  41. package/dist/table/load_table.js +87 -0
  42. package/dist/table/load_table.mjs +66 -0
  43. package/dist/table/loader.d.mts +10 -15
  44. package/dist/table/loader.d.ts +10 -15
  45. package/dist/table/loader.js +67 -31
  46. package/dist/table/loader.mjs +67 -32
  47. package/dist/table/page.d.mts +6 -16
  48. package/dist/table/page.d.ts +6 -16
  49. package/dist/table/page.js +247 -169
  50. package/dist/table/page.mjs +248 -176
  51. package/dist/table/repository.d.mts +14 -10
  52. package/dist/table/repository.d.ts +14 -10
  53. package/dist/table/repository.js +5 -1
  54. package/dist/table/repository.mjs +5 -1
  55. package/dist/table/table.d.mts +4 -1
  56. package/dist/table/table.d.ts +4 -1
  57. package/dist/table/table.js +55 -6
  58. package/dist/table/table.mjs +55 -6
  59. package/dist/table/table_form.d.mts +13 -0
  60. package/dist/table/table_form.d.ts +13 -0
  61. package/dist/table/table_form.js +345 -0
  62. package/dist/table/table_form.mjs +320 -0
  63. package/dist/table/use_table.d.mts +4 -0
  64. package/dist/table/use_table.d.ts +4 -0
  65. package/dist/table/use_table.js +34 -0
  66. package/dist/table/use_table.mjs +9 -0
  67. package/package.json +2 -2
@@ -23,87 +23,17 @@ __export(page_exports, {
23
23
  createTablePage: () => createTablePage
24
24
  });
25
25
  module.exports = __toCommonJS(page_exports);
26
- var import_react_router3 = require("react-router");
26
+ var import_react_router5 = require("react-router");
27
+
28
+ // src/table/table_form.tsx
29
+ var import_react_router4 = require("react-router");
27
30
  var import_go2 = require("react-icons/go");
28
31
 
29
- // src/table/buttons.tsx
32
+ // src/table/table.tsx
30
33
  var import_utils = require("dn-react-toolkit/utils");
34
+ var import_go = require("react-icons/go");
31
35
  var import_react_router = require("react-router");
32
36
  var import_jsx_runtime = require("react/jsx-runtime");
33
- function TablePageButtons({
34
- MAX_PAGES_TO_SHOW,
35
- total,
36
- limit,
37
- offset
38
- }) {
39
- const pages = Math.ceil(total / limit);
40
- const { pathname } = (0, import_react_router.useLocation)();
41
- const [searchParams] = (0, import_react_router.useSearchParams)();
42
- const currentPage = Math.floor(offset / limit) + 1;
43
- const startButton = (Math.ceil(currentPage / MAX_PAGES_TO_SHOW) - 1) * MAX_PAGES_TO_SHOW;
44
- const endButton = Math.min(startButton + MAX_PAGES_TO_SHOW - 1, pages);
45
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: pages > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex justify-center items-center my-8 gap-4 text-neutral-400", children: [
46
- startButton > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
47
- import_react_router.Link,
48
- {
49
- to: (() => {
50
- searchParams.set(
51
- "offset",
52
- String((startButton - 1) * limit)
53
- );
54
- return `${pathname}?${searchParams.toString()}`;
55
- })(),
56
- className: "w-10 block text-center transition-colors hover:text-primary",
57
- children: "\uC774\uC804"
58
- }
59
- ),
60
- Array.from({
61
- length: Math.min(
62
- MAX_PAGES_TO_SHOW,
63
- pages - startButton
64
- )
65
- }).map((_, index) => {
66
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
- import_react_router.Link,
68
- {
69
- to: (() => {
70
- searchParams.set(
71
- "offset",
72
- String((startButton + index) * limit)
73
- );
74
- return `${pathname}?${searchParams.toString()}`;
75
- })(),
76
- className: (0, import_utils.cn)(
77
- "w-6 block text-center transition-colors",
78
- currentPage === startButton + index + 1 ? "font-bold text-primary" : "hover:text-primary"
79
- ),
80
- children: startButton + index + 1
81
- },
82
- index
83
- );
84
- }),
85
- endButton < pages && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
86
- import_react_router.Link,
87
- {
88
- to: (() => {
89
- searchParams.set(
90
- "offset",
91
- String((endButton + 1) * limit)
92
- );
93
- return `${pathname}?${searchParams.toString()}`;
94
- })(),
95
- className: "w-10 block text-center transition-colors hover:text-primary",
96
- children: "\uB2E4\uC74C"
97
- }
98
- )
99
- ] }) });
100
- }
101
-
102
- // src/table/table.tsx
103
- var import_utils2 = require("dn-react-toolkit/utils");
104
- var import_go = require("react-icons/go");
105
- var import_react_router2 = require("react-router");
106
- var import_jsx_runtime2 = require("react/jsx-runtime");
107
37
  function Table({
108
38
  className = "min-w-full whitespace-nowrap",
109
39
  data,
@@ -113,17 +43,21 @@ function Table({
113
43
  limit,
114
44
  offset,
115
45
  orderBy,
116
- direction
46
+ direction,
47
+ filters
117
48
  }) {
118
49
  const keys = Object.entries(columns).filter((entry) => entry[1]).map(([key]) => key);
119
50
  const sortedArray = [...data];
120
- const [_, setSearchParams] = (0, import_react_router2.useSearchParams)();
121
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
51
+ const [_, setSearchParams] = (0, import_react_router.useSearchParams)();
52
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
122
53
  "table",
123
54
  {
124
- className: (0, import_utils2.cn)(className, "text-[15px] border-separate border-spacing-0"),
55
+ className: (0, import_utils.cn)(
56
+ className,
57
+ "text-[15px] border-separate border-spacing-0"
58
+ ),
125
59
  children: [
126
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: keys.map((key) => {
60
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: keys.map((key) => {
127
61
  const value = columns[key];
128
62
  function getReactNode() {
129
63
  if (value && typeof value === "object" && "label" in value) {
@@ -134,12 +68,12 @@ function Table({
134
68
  function Head() {
135
69
  const reactNode = getReactNode();
136
70
  if (typeof reactNode === "string") {
137
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
71
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
138
72
  "button",
139
73
  {
140
- className: (0, import_utils2.cn)(
141
- orderBy === key ? "text-neutral-900 font-medium" : "text-neutral-500",
142
- "px-4 h-14 flex items-center w-full"
74
+ className: (0, import_utils.cn)(
75
+ orderBy === key ? "text-gray-900 font-medium" : "text-gray-500 font-medium",
76
+ "px-4 flex items-center w-full"
143
77
  ),
144
78
  onClick: () => {
145
79
  let newDirection = "asc";
@@ -153,25 +87,70 @@ function Table({
153
87
  },
154
88
  children: [
155
89
  reactNode,
156
- orderBy === key && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "ml-0.5", children: direction === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_go.GoArrowUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_go.GoArrowDown, {}) })
90
+ orderBy === key && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "ml-0.5", children: direction === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_go.GoArrowUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_go.GoArrowDown, {}) })
157
91
  ]
158
92
  }
159
93
  );
160
94
  }
161
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: reactNode });
95
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: reactNode });
162
96
  }
163
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: (0, import_utils2.cn)("border-y font-normal"), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Head, {}) }, key);
97
+ const filter = filters[key];
98
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
99
+ "th",
100
+ {
101
+ className: (0, import_utils.cn)(
102
+ "py-4 border-y font-normal align-top"
103
+ ),
104
+ children: [
105
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Head, {}),
106
+ filter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "px-3 mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
107
+ "select",
108
+ {
109
+ className: "w-full h-10 px-1.5 border rounded-full outline-none",
110
+ onChange: (e) => {
111
+ const value2 = e.target.value;
112
+ setSearchParams((prev) => {
113
+ if (value2) {
114
+ prev.set(
115
+ key,
116
+ encodeURIComponent(
117
+ value2
118
+ )
119
+ );
120
+ } else {
121
+ prev.delete(key);
122
+ }
123
+ return prev;
124
+ });
125
+ },
126
+ children: [
127
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "\uC804\uCCB4" }),
128
+ filter.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
129
+ "option",
130
+ {
131
+ value: option,
132
+ children: option
133
+ },
134
+ option
135
+ ))
136
+ ]
137
+ }
138
+ ) })
139
+ ]
140
+ },
141
+ key
142
+ );
164
143
  }) }) }),
165
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tbody", { children: [
166
- sortedArray.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
144
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tbody", { children: [
145
+ sortedArray.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
167
146
  "td",
168
147
  {
169
148
  colSpan: keys.length,
170
- className: "px-4 h-14 text-neutral-400 text-center",
149
+ className: "px-4 h-20 text-gray-400 text-center",
171
150
  children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
172
151
  }
173
152
  ) }),
174
- sortedArray.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { className: "hover:bg-gray-50 transition-colors", children: keys.map((key, i2) => {
153
+ sortedArray.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { className: "hover:bg-gray-50 transition-colors", children: keys.map((key, i2) => {
175
154
  const value = item[key];
176
155
  function Content() {
177
156
  if (key in columns) {
@@ -179,22 +158,22 @@ function Table({
179
158
  if (column && typeof column === "object" && "mapper" in column) {
180
159
  const mapper = column.mapper;
181
160
  if (mapper) {
182
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: mapper(item) });
161
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: mapper(item) });
183
162
  }
184
163
  }
185
164
  }
186
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: String(value) });
165
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: String(value) });
187
166
  }
188
- const linkedContent = getLink ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
189
- import_react_router2.Link,
167
+ const linkedContent = getLink ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
168
+ import_react_router.Link,
190
169
  {
191
170
  to: getLink(item),
192
171
  className: "block content-center px-4 w-full h-full",
193
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, {})
172
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, {})
194
173
  }
195
- ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, {});
196
- const cell = Mapper ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
197
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "px-0 h-14 border-b", children: cell }, key);
174
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, {});
175
+ const cell = Mapper ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
176
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "px-0 h-14 border-b", children: cell }, key);
198
177
  }) }, i))
199
178
  ] })
200
179
  ]
@@ -202,8 +181,170 @@ function Table({
202
181
  );
203
182
  }
204
183
 
205
- // src/table/page.tsx
184
+ // src/table/use_table.tsx
185
+ var import_react_router2 = require("react-router");
186
+ function useTable() {
187
+ const { table } = (0, import_react_router2.useLoaderData)();
188
+ return table;
189
+ }
190
+
191
+ // src/table/buttons.tsx
192
+ var import_utils2 = require("dn-react-toolkit/utils");
193
+ var import_react_router3 = require("react-router");
194
+ var import_jsx_runtime2 = require("react/jsx-runtime");
195
+ function TablePageButtons({
196
+ MAX_PAGES_TO_SHOW,
197
+ total,
198
+ limit,
199
+ offset
200
+ }) {
201
+ const pages = Math.ceil(total / limit);
202
+ const { pathname } = (0, import_react_router3.useLocation)();
203
+ const [searchParams] = (0, import_react_router3.useSearchParams)();
204
+ const currentPage = Math.floor(offset / limit) + 1;
205
+ const startButton = (Math.ceil(currentPage / MAX_PAGES_TO_SHOW) - 1) * MAX_PAGES_TO_SHOW;
206
+ const endButton = Math.min(startButton + MAX_PAGES_TO_SHOW - 1, pages);
207
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: pages > 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex justify-center items-center my-8 gap-4 text-neutral-400", children: [
208
+ startButton > 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
209
+ import_react_router3.Link,
210
+ {
211
+ to: (() => {
212
+ searchParams.set(
213
+ "offset",
214
+ String((startButton - 1) * limit)
215
+ );
216
+ return `${pathname}?${searchParams.toString()}`;
217
+ })(),
218
+ className: "w-10 block text-center transition-colors hover:text-primary",
219
+ children: "\uC774\uC804"
220
+ }
221
+ ),
222
+ Array.from({
223
+ length: Math.min(
224
+ MAX_PAGES_TO_SHOW,
225
+ pages - startButton
226
+ )
227
+ }).map((_, index) => {
228
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
229
+ import_react_router3.Link,
230
+ {
231
+ to: (() => {
232
+ searchParams.set(
233
+ "offset",
234
+ String((startButton + index) * limit)
235
+ );
236
+ return `${pathname}?${searchParams.toString()}`;
237
+ })(),
238
+ className: (0, import_utils2.cn)(
239
+ "w-6 block text-center transition-colors",
240
+ currentPage === startButton + index + 1 ? "font-bold text-primary" : "hover:text-primary"
241
+ ),
242
+ children: startButton + index + 1
243
+ },
244
+ index
245
+ );
246
+ }),
247
+ endButton < pages && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
248
+ import_react_router3.Link,
249
+ {
250
+ to: (() => {
251
+ searchParams.set(
252
+ "offset",
253
+ String((endButton + 1) * limit)
254
+ );
255
+ return `${pathname}?${searchParams.toString()}`;
256
+ })(),
257
+ className: "w-10 block text-center transition-colors hover:text-primary",
258
+ children: "\uB2E4\uC74C"
259
+ }
260
+ )
261
+ ] }) });
262
+ }
263
+
264
+ // src/table/table_form.tsx
206
265
  var import_jsx_runtime3 = require("react/jsx-runtime");
266
+ function TableForm({
267
+ columns,
268
+ primaryKey = "id"
269
+ }) {
270
+ const { pathname } = (0, import_react_router4.useLocation)();
271
+ const {
272
+ items,
273
+ total,
274
+ limit,
275
+ offset,
276
+ orderBy,
277
+ direction,
278
+ searchKey,
279
+ filters
280
+ } = useTable();
281
+ const navigate = (0, import_react_router4.useNavigate)();
282
+ const search = (query) => {
283
+ const searchParams2 = new URLSearchParams(window.location.search);
284
+ searchParams2.set("query", query);
285
+ searchParams2.set("offset", "0");
286
+ navigate(`${pathname}?${searchParams2.toString()}`);
287
+ };
288
+ const [searchParams] = (0, import_react_router4.useSearchParams)();
289
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
290
+ searchKey && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
291
+ "form",
292
+ {
293
+ className: "h-20 px-4 flex items-center border-t",
294
+ onSubmit: (e) => {
295
+ e.preventDefault();
296
+ const formData = new FormData(e.currentTarget);
297
+ const query = formData.get("query");
298
+ search(query);
299
+ },
300
+ children: [
301
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
302
+ "button",
303
+ {
304
+ type: "submit",
305
+ className: "w-10 h-10 flex justify-center items-center",
306
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_go2.GoSearch, { className: "text-xl mr-4" })
307
+ }
308
+ ),
309
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
310
+ "input",
311
+ {
312
+ className: "outline-none h-full flex-1",
313
+ placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
314
+ name: "query",
315
+ defaultValue: searchParams.get("query") ?? ""
316
+ }
317
+ )
318
+ ]
319
+ }
320
+ ),
321
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
322
+ Table,
323
+ {
324
+ data: items,
325
+ columns,
326
+ getLink: primaryKey ? (item) => `${pathname}/${item[primaryKey]}` : void 0,
327
+ limit,
328
+ offset,
329
+ orderBy,
330
+ direction,
331
+ filters
332
+ }
333
+ ),
334
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
335
+ TablePageButtons,
336
+ {
337
+ total,
338
+ limit,
339
+ offset,
340
+ MAX_PAGES_TO_SHOW: 10
341
+ }
342
+ )
343
+ ] });
344
+ }
345
+
346
+ // src/table/page.tsx
347
+ var import_jsx_runtime4 = require("react/jsx-runtime");
207
348
  function createTablePage({
208
349
  name,
209
350
  columns,
@@ -212,82 +353,19 @@ function createTablePage({
212
353
  return function TablePage({
213
354
  header: Header
214
355
  }) {
215
- const { pathname } = (0, import_react_router3.useLocation)();
216
- const { table } = (0, import_react_router3.useLoaderData)();
217
- const { items, total, limit, offset, orderBy, direction, searchKey } = table;
218
- const navigate = (0, import_react_router3.useNavigate)();
219
- const search = (query) => {
220
- const searchParams2 = new URLSearchParams(window.location.search);
221
- searchParams2.set("query", query);
222
- searchParams2.set("offset", "0");
223
- navigate(`${pathname}?${searchParams2.toString()}`);
224
- };
225
- const [searchParams] = (0, import_react_router3.useSearchParams)();
226
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
227
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
356
+ const { pathname } = (0, import_react_router5.useLocation)();
357
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
358
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
228
359
  Header,
229
360
  {
230
361
  title: name,
231
- actions: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_router3.Link, { to: `${pathname}/new`, className: "button-primary", children: [
362
+ actions: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_router5.Link, { to: `${pathname}/new`, className: "button-primary", children: [
232
363
  name,
233
364
  " \uCD94\uAC00"
234
365
  ] })
235
366
  }
236
367
  ),
237
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "max-w-7xl mx-auto w-full overflow-auto", children: [
238
- searchKey && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
239
- "form",
240
- {
241
- className: "h-18 px-4 flex items-center border-t",
242
- onSubmit: (e) => {
243
- e.preventDefault();
244
- const formData = new FormData(e.currentTarget);
245
- const query = formData.get("query");
246
- search(query);
247
- },
248
- children: [
249
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
250
- "button",
251
- {
252
- type: "submit",
253
- className: "w-10 h-10 flex justify-center items-center",
254
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_go2.GoSearch, { className: "text-xl mr-4" })
255
- }
256
- ),
257
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
258
- "input",
259
- {
260
- className: "outline-none h-full flex-1",
261
- placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
262
- name: "query",
263
- defaultValue: searchParams.get("query") ?? ""
264
- }
265
- )
266
- ]
267
- }
268
- ),
269
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
270
- Table,
271
- {
272
- data: items,
273
- columns,
274
- getLink: primaryKey ? (item) => `${pathname}/${item[primaryKey]}` : void 0,
275
- limit,
276
- offset,
277
- orderBy,
278
- direction
279
- }
280
- ),
281
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
282
- TablePageButtons,
283
- {
284
- total,
285
- limit,
286
- offset,
287
- MAX_PAGES_TO_SHOW: 10
288
- }
289
- )
290
- ] })
368
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "max-w-7xl mx-auto w-full overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TableForm, { columns, primaryKey }) })
291
369
  ] });
292
370
  };
293
371
  }