dn-react-router-toolkit 0.8.1 → 0.9.0

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 (53) hide show
  1. package/dist/crud/index.d.mts +0 -20
  2. package/dist/crud/index.d.ts +0 -20
  3. package/dist/crud/index.js +12 -8587
  4. package/dist/crud/index.mjs +0 -8596
  5. package/dist/post/index.js +67 -7705
  6. package/dist/post/index.mjs +54 -7718
  7. package/dist/post/post_form_page.js +67 -7705
  8. package/dist/post/post_form_page.mjs +54 -7718
  9. package/dist/table/index.d.mts +0 -2
  10. package/dist/table/index.d.ts +0 -2
  11. package/dist/table/index.js +12 -79
  12. package/dist/table/index.mjs +12 -77
  13. package/dist/table/load_table.d.mts +1 -1
  14. package/dist/table/load_table.d.ts +1 -1
  15. package/dist/table/load_table.js +2 -2
  16. package/dist/table/load_table.mjs +2 -2
  17. package/dist/table/loader.js +2 -2
  18. package/dist/table/loader.mjs +2 -2
  19. package/dist/table/table.d.mts +2 -2
  20. package/dist/table/table.d.ts +2 -2
  21. package/dist/table/table.js +6 -23
  22. package/dist/table/table.mjs +6 -23
  23. package/dist/table/table_form.js +6 -23
  24. package/dist/table/table_form.mjs +6 -23
  25. package/package.json +2 -2
  26. package/dist/crud/crud_loader.d.mts +0 -26
  27. package/dist/crud/crud_loader.d.ts +0 -26
  28. package/dist/crud/crud_loader.js +0 -351
  29. package/dist/crud/crud_loader.mjs +0 -337
  30. package/dist/crud/crud_page.d.mts +0 -32
  31. package/dist/crud/crud_page.d.ts +0 -32
  32. package/dist/crud/crud_page.js +0 -776
  33. package/dist/crud/crud_page.mjs +0 -758
  34. package/dist/crud/generate_handlers.d.mts +0 -16
  35. package/dist/crud/generate_handlers.d.ts +0 -16
  36. package/dist/crud/generate_handlers.js +0 -39
  37. package/dist/crud/generate_handlers.mjs +0 -14
  38. package/dist/crud/generate_pages.d.mts +0 -19
  39. package/dist/crud/generate_pages.d.ts +0 -19
  40. package/dist/crud/generate_pages.js +0 -55
  41. package/dist/crud/generate_pages.mjs +0 -30
  42. package/dist/crud/generate_routes.d.mts +0 -5
  43. package/dist/crud/generate_routes.d.ts +0 -5
  44. package/dist/crud/generate_routes.js +0 -7639
  45. package/dist/crud/generate_routes.mjs +0 -7627
  46. package/dist/table/item_loader.d.mts +0 -14
  47. package/dist/table/item_loader.d.ts +0 -14
  48. package/dist/table/item_loader.js +0 -43
  49. package/dist/table/item_loader.mjs +0 -18
  50. package/dist/table/page.d.mts +0 -16
  51. package/dist/table/page.d.ts +0 -16
  52. package/dist/table/page.js +0 -375
  53. package/dist/table/page.mjs +0 -350
@@ -1,8 +1,6 @@
1
1
  export { BaseTableRepository, ColumnOf, FindAllOptions, InsertModelOf, SchemaOf, SelectModelOf, TableRepository } from './repository.mjs';
2
2
  export { TablePageButtons } from './buttons.mjs';
3
- export { TableItemLoaderOptions, tableItemloader } from './item_loader.mjs';
4
3
  export { tableLoader } from './loader.mjs';
5
- export { createTablePage } from './page.mjs';
6
4
  export { OrderedTableProps, Table, TableColumnOptions, TableColumnProps } from './table.mjs';
7
5
  export { TableLoaderOptions, loadTable } from './load_table.mjs';
8
6
  export { LoadedModel, TableForm, TablePageOptions } from './table_form.mjs';
@@ -1,8 +1,6 @@
1
1
  export { BaseTableRepository, ColumnOf, FindAllOptions, InsertModelOf, SchemaOf, SelectModelOf, TableRepository } from './repository.js';
2
2
  export { TablePageButtons } from './buttons.js';
3
- export { TableItemLoaderOptions, tableItemloader } from './item_loader.js';
4
3
  export { tableLoader } from './loader.js';
5
- export { createTablePage } from './page.js';
6
4
  export { OrderedTableProps, Table, TableColumnOptions, TableColumnProps } from './table.js';
7
5
  export { TableLoaderOptions, loadTable } from './load_table.js';
8
6
  export { LoadedModel, TableForm, TablePageOptions } from './table_form.js';
@@ -24,9 +24,7 @@ __export(table_exports, {
24
24
  Table: () => Table,
25
25
  TableForm: () => TableForm,
26
26
  TablePageButtons: () => TablePageButtons,
27
- createTablePage: () => createTablePage,
28
27
  loadTable: () => loadTable,
29
- tableItemloader: () => tableItemloader,
30
28
  tableLoader: () => tableLoader,
31
29
  useTable: () => useTable
32
30
  });
@@ -158,22 +156,6 @@ function TablePageButtons({
158
156
  ] }) });
159
157
  }
160
158
 
161
- // src/table/item_loader.tsx
162
- var tableItemloader = ({
163
- repository
164
- }) => {
165
- return async (args) => {
166
- const { params } = args;
167
- if (params["itemId"] === "new") {
168
- return { item: void 0 };
169
- }
170
- const item = params["itemId"] ? await repository.find(params["itemId"]) : void 0;
171
- return {
172
- item
173
- };
174
- };
175
- };
176
-
177
159
  // src/table/load_table.tsx
178
160
  var import_drizzle_orm2 = require("drizzle-orm");
179
161
  async function loadTable({
@@ -184,7 +166,7 @@ async function loadTable({
184
166
  const searchParams = new URL(request.url).searchParams;
185
167
  const { where, searchKey, defaultOrderBy, defaultDirection } = options;
186
168
  const query = searchParams.get("query") ?? void 0;
187
- const limit = Number(searchParams.get("limit") ?? "20");
169
+ const limit = Number(searchParams.get("limit") ?? "10");
188
170
  const offset = Number(searchParams.get("offset") ?? "0");
189
171
  const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
190
172
  const direction = searchParams.get("direction") ?? defaultDirection;
@@ -204,7 +186,7 @@ async function loadTable({
204
186
  `%${query}%`
205
187
  ) : void 0,
206
188
  ...filterWhere,
207
- ...where ?? []
189
+ where
208
190
  );
209
191
  const total = await repository.countTotal({ where: whereClauses });
210
192
  const items = await repository.findAll({
@@ -251,13 +233,6 @@ function tableLoader({
251
233
  };
252
234
  }
253
235
 
254
- // src/table/page.tsx
255
- var import_react_router5 = require("react-router");
256
-
257
- // src/table/table_form.tsx
258
- var import_react_router4 = require("react-router");
259
- var import_go2 = require("react-icons/go");
260
-
261
236
  // src/table/table.tsx
262
237
  var import_utils2 = require("dn-react-toolkit/utils");
263
238
  var import_go = require("react-icons/go");
@@ -281,10 +256,7 @@ function Table({
281
256
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
282
257
  "table",
283
258
  {
284
- className: (0, import_utils2.cn)(
285
- className,
286
- "text-[15px] border-separate border-spacing-0"
287
- ),
259
+ className: (0, import_utils2.cn)(className, "text-[15px] border-separate border-spacing-0"),
288
260
  children: [
289
261
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: keys.map((key) => {
290
262
  const value = columns[key];
@@ -323,13 +295,11 @@ function Table({
323
295
  }
324
296
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: reactNode });
325
297
  }
326
- const filter = filters[key];
298
+ const filter = filters?.[key];
327
299
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
328
300
  "th",
329
301
  {
330
- className: (0, import_utils2.cn)(
331
- "py-4 border-y font-normal align-top"
332
- ),
302
+ className: (0, import_utils2.cn)("py-4 border-y font-normal align-top"),
333
303
  children: [
334
304
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Head, {}),
335
305
  filter && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "px-3 mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
@@ -340,12 +310,7 @@ function Table({
340
310
  const value2 = e.target.value;
341
311
  setSearchParams((prev) => {
342
312
  if (value2) {
343
- prev.set(
344
- key,
345
- encodeURIComponent(
346
- value2
347
- )
348
- );
313
+ prev.set(key, encodeURIComponent(value2));
349
314
  } else {
350
315
  prev.delete(key);
351
316
  }
@@ -354,14 +319,7 @@ function Table({
354
319
  },
355
320
  children: [
356
321
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: "", children: "\uC804\uCCB4" }),
357
- filter.map((option) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
358
- "option",
359
- {
360
- value: option,
361
- children: option
362
- },
363
- option
364
- ))
322
+ filter.map((option) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("option", { value: option, children: option }, option))
365
323
  ]
366
324
  }
367
325
  ) })
@@ -400,7 +358,7 @@ function Table({
400
358
  className: "block content-center px-4 w-full h-full",
401
359
  children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, {})
402
360
  }
403
- ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, {});
361
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "px-4 w-full h-full content-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, {}) });
404
362
  const cell = Mapper ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
405
363
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "px-0 h-14 border-b", children: cell }, key);
406
364
  }) }, i))
@@ -410,6 +368,10 @@ function Table({
410
368
  );
411
369
  }
412
370
 
371
+ // src/table/table_form.tsx
372
+ var import_react_router4 = require("react-router");
373
+ var import_go2 = require("react-icons/go");
374
+
413
375
  // src/table/use_table.tsx
414
376
  var import_react_router3 = require("react-router");
415
377
  function useTable() {
@@ -498,42 +460,13 @@ function TableForm({
498
460
  )
499
461
  ] });
500
462
  }
501
-
502
- // src/table/page.tsx
503
- var import_jsx_runtime4 = require("react/jsx-runtime");
504
- function createTablePage({
505
- name,
506
- columns,
507
- primaryKey = "id"
508
- }) {
509
- return function TablePage({
510
- header: Header
511
- }) {
512
- const { pathname } = (0, import_react_router5.useLocation)();
513
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
514
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
515
- Header,
516
- {
517
- title: name,
518
- actions: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_router5.Link, { to: `${pathname}/new`, className: "button-primary", children: [
519
- name,
520
- " \uCD94\uAC00"
521
- ] })
522
- }
523
- ),
524
- /* @__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 }) })
525
- ] });
526
- };
527
- }
528
463
  // Annotate the CommonJS export names for ESM import in node:
529
464
  0 && (module.exports = {
530
465
  BaseTableRepository,
531
466
  Table,
532
467
  TableForm,
533
468
  TablePageButtons,
534
- createTablePage,
535
469
  loadTable,
536
- tableItemloader,
537
470
  tableLoader,
538
471
  useTable
539
472
  });
@@ -129,22 +129,6 @@ function TablePageButtons({
129
129
  ] }) });
130
130
  }
131
131
 
132
- // src/table/item_loader.tsx
133
- var tableItemloader = ({
134
- repository
135
- }) => {
136
- return async (args) => {
137
- const { params } = args;
138
- if (params["itemId"] === "new") {
139
- return { item: void 0 };
140
- }
141
- const item = params["itemId"] ? await repository.find(params["itemId"]) : void 0;
142
- return {
143
- item
144
- };
145
- };
146
- };
147
-
148
132
  // src/table/load_table.tsx
149
133
  import {
150
134
  and,
@@ -159,7 +143,7 @@ async function loadTable({
159
143
  const searchParams = new URL(request.url).searchParams;
160
144
  const { where, searchKey, defaultOrderBy, defaultDirection } = options;
161
145
  const query = searchParams.get("query") ?? void 0;
162
- const limit = Number(searchParams.get("limit") ?? "20");
146
+ const limit = Number(searchParams.get("limit") ?? "10");
163
147
  const offset = Number(searchParams.get("offset") ?? "0");
164
148
  const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
165
149
  const direction = searchParams.get("direction") ?? defaultDirection;
@@ -179,7 +163,7 @@ async function loadTable({
179
163
  `%${query}%`
180
164
  ) : void 0,
181
165
  ...filterWhere,
182
- ...where ?? []
166
+ where
183
167
  );
184
168
  const total = await repository.countTotal({ where: whereClauses });
185
169
  const items = await repository.findAll({
@@ -226,13 +210,6 @@ function tableLoader({
226
210
  };
227
211
  }
228
212
 
229
- // src/table/page.tsx
230
- import { Link as Link3, useLocation as useLocation3 } from "react-router";
231
-
232
- // src/table/table_form.tsx
233
- import { useLocation as useLocation2, useNavigate, useSearchParams as useSearchParams3 } from "react-router";
234
- import { GoSearch } from "react-icons/go";
235
-
236
213
  // src/table/table.tsx
237
214
  import { cn as cn2 } from "dn-react-toolkit/utils";
238
215
  import { GoArrowDown, GoArrowUp } from "react-icons/go";
@@ -256,10 +233,7 @@ function Table({
256
233
  return /* @__PURE__ */ jsxs2(
257
234
  "table",
258
235
  {
259
- className: cn2(
260
- className,
261
- "text-[15px] border-separate border-spacing-0"
262
- ),
236
+ className: cn2(className, "text-[15px] border-separate border-spacing-0"),
263
237
  children: [
264
238
  /* @__PURE__ */ jsx2("thead", { children: /* @__PURE__ */ jsx2("tr", { children: keys.map((key) => {
265
239
  const value = columns[key];
@@ -298,13 +272,11 @@ function Table({
298
272
  }
299
273
  return /* @__PURE__ */ jsx2(Fragment2, { children: reactNode });
300
274
  }
301
- const filter = filters[key];
275
+ const filter = filters?.[key];
302
276
  return /* @__PURE__ */ jsxs2(
303
277
  "th",
304
278
  {
305
- className: cn2(
306
- "py-4 border-y font-normal align-top"
307
- ),
279
+ className: cn2("py-4 border-y font-normal align-top"),
308
280
  children: [
309
281
  /* @__PURE__ */ jsx2(Head, {}),
310
282
  filter && /* @__PURE__ */ jsx2("div", { className: "px-3 mt-4", children: /* @__PURE__ */ jsxs2(
@@ -315,12 +287,7 @@ function Table({
315
287
  const value2 = e.target.value;
316
288
  setSearchParams((prev) => {
317
289
  if (value2) {
318
- prev.set(
319
- key,
320
- encodeURIComponent(
321
- value2
322
- )
323
- );
290
+ prev.set(key, encodeURIComponent(value2));
324
291
  } else {
325
292
  prev.delete(key);
326
293
  }
@@ -329,14 +296,7 @@ function Table({
329
296
  },
330
297
  children: [
331
298
  /* @__PURE__ */ jsx2("option", { value: "", children: "\uC804\uCCB4" }),
332
- filter.map((option) => /* @__PURE__ */ jsx2(
333
- "option",
334
- {
335
- value: option,
336
- children: option
337
- },
338
- option
339
- ))
299
+ filter.map((option) => /* @__PURE__ */ jsx2("option", { value: option, children: option }, option))
340
300
  ]
341
301
  }
342
302
  ) })
@@ -375,7 +335,7 @@ function Table({
375
335
  className: "block content-center px-4 w-full h-full",
376
336
  children: /* @__PURE__ */ jsx2(Content, {})
377
337
  }
378
- ) : /* @__PURE__ */ jsx2(Content, {});
338
+ ) : /* @__PURE__ */ jsx2("div", { className: "px-4 w-full h-full content-center", children: /* @__PURE__ */ jsx2(Content, {}) });
379
339
  const cell = Mapper ? /* @__PURE__ */ jsx2(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
380
340
  return /* @__PURE__ */ jsx2("td", { className: "px-0 h-14 border-b", children: cell }, key);
381
341
  }) }, i))
@@ -385,6 +345,10 @@ function Table({
385
345
  );
386
346
  }
387
347
 
348
+ // src/table/table_form.tsx
349
+ import { useLocation as useLocation2, useNavigate, useSearchParams as useSearchParams3 } from "react-router";
350
+ import { GoSearch } from "react-icons/go";
351
+
388
352
  // src/table/use_table.tsx
389
353
  import { useLoaderData } from "react-router";
390
354
  function useTable() {
@@ -473,41 +437,12 @@ function TableForm({
473
437
  )
474
438
  ] });
475
439
  }
476
-
477
- // src/table/page.tsx
478
- import { Fragment as Fragment4, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
479
- function createTablePage({
480
- name,
481
- columns,
482
- primaryKey = "id"
483
- }) {
484
- return function TablePage({
485
- header: Header
486
- }) {
487
- const { pathname } = useLocation3();
488
- return /* @__PURE__ */ jsxs4(Fragment4, { children: [
489
- /* @__PURE__ */ jsx4(
490
- Header,
491
- {
492
- title: name,
493
- actions: /* @__PURE__ */ jsxs4(Link3, { to: `${pathname}/new`, className: "button-primary", children: [
494
- name,
495
- " \uCD94\uAC00"
496
- ] })
497
- }
498
- ),
499
- /* @__PURE__ */ jsx4("div", { className: "max-w-7xl mx-auto w-full overflow-auto", children: /* @__PURE__ */ jsx4(TableForm, { columns, primaryKey }) })
500
- ] });
501
- };
502
- }
503
440
  export {
504
441
  BaseTableRepository,
505
442
  Table,
506
443
  TableForm,
507
444
  TablePageButtons,
508
- createTablePage,
509
445
  loadTable,
510
- tableItemloader,
511
446
  tableLoader,
512
447
  useTable
513
448
  };
@@ -4,7 +4,7 @@ import { TableRepository, ColumnOf } from './repository.mjs';
4
4
  import 'drizzle-orm/node-postgres';
5
5
 
6
6
  type TableOptions<T extends PgTableWithColumns<any>> = {
7
- where?: SQLWrapper[];
7
+ where?: SQLWrapper;
8
8
  searchKey?: ColumnOf<T>;
9
9
  defaultOrderBy: keyof InferSelectModel<T>;
10
10
  defaultDirection: "asc" | "desc";
@@ -4,7 +4,7 @@ import { TableRepository, ColumnOf } from './repository.js';
4
4
  import 'drizzle-orm/node-postgres';
5
5
 
6
6
  type TableOptions<T extends PgTableWithColumns<any>> = {
7
- where?: SQLWrapper[];
7
+ where?: SQLWrapper;
8
8
  searchKey?: ColumnOf<T>;
9
9
  defaultOrderBy: keyof InferSelectModel<T>;
10
10
  defaultDirection: "asc" | "desc";
@@ -32,7 +32,7 @@ async function loadTable({
32
32
  const searchParams = new URL(request.url).searchParams;
33
33
  const { where, searchKey, defaultOrderBy, defaultDirection } = options;
34
34
  const query = searchParams.get("query") ?? void 0;
35
- const limit = Number(searchParams.get("limit") ?? "20");
35
+ const limit = Number(searchParams.get("limit") ?? "10");
36
36
  const offset = Number(searchParams.get("offset") ?? "0");
37
37
  const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
38
38
  const direction = searchParams.get("direction") ?? defaultDirection;
@@ -52,7 +52,7 @@ async function loadTable({
52
52
  `%${query}%`
53
53
  ) : void 0,
54
54
  ...filterWhere,
55
- ...where ?? []
55
+ where
56
56
  );
57
57
  const total = await repository.countTotal({ where: whereClauses });
58
58
  const items = await repository.findAll({
@@ -12,7 +12,7 @@ async function loadTable({
12
12
  const searchParams = new URL(request.url).searchParams;
13
13
  const { where, searchKey, defaultOrderBy, defaultDirection } = options;
14
14
  const query = searchParams.get("query") ?? void 0;
15
- const limit = Number(searchParams.get("limit") ?? "20");
15
+ const limit = Number(searchParams.get("limit") ?? "10");
16
16
  const offset = Number(searchParams.get("offset") ?? "0");
17
17
  const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
18
18
  const direction = searchParams.get("direction") ?? defaultDirection;
@@ -32,7 +32,7 @@ async function loadTable({
32
32
  `%${query}%`
33
33
  ) : void 0,
34
34
  ...filterWhere,
35
- ...where ?? []
35
+ where
36
36
  );
37
37
  const total = await repository.countTotal({ where: whereClauses });
38
38
  const items = await repository.findAll({
@@ -34,7 +34,7 @@ async function loadTable({
34
34
  const searchParams = new URL(request.url).searchParams;
35
35
  const { where, searchKey, defaultOrderBy, defaultDirection } = options;
36
36
  const query = searchParams.get("query") ?? void 0;
37
- const limit = Number(searchParams.get("limit") ?? "20");
37
+ const limit = Number(searchParams.get("limit") ?? "10");
38
38
  const offset = Number(searchParams.get("offset") ?? "0");
39
39
  const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
40
40
  const direction = searchParams.get("direction") ?? defaultDirection;
@@ -54,7 +54,7 @@ async function loadTable({
54
54
  `%${query}%`
55
55
  ) : void 0,
56
56
  ...filterWhere,
57
- ...where ?? []
57
+ where
58
58
  );
59
59
  const total = await repository.countTotal({ where: whereClauses });
60
60
  const items = await repository.findAll({
@@ -12,7 +12,7 @@ async function loadTable({
12
12
  const searchParams = new URL(request.url).searchParams;
13
13
  const { where, searchKey, defaultOrderBy, defaultDirection } = options;
14
14
  const query = searchParams.get("query") ?? void 0;
15
- const limit = Number(searchParams.get("limit") ?? "20");
15
+ const limit = Number(searchParams.get("limit") ?? "10");
16
16
  const offset = Number(searchParams.get("offset") ?? "0");
17
17
  const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
18
18
  const direction = searchParams.get("direction") ?? defaultDirection;
@@ -32,7 +32,7 @@ async function loadTable({
32
32
  `%${query}%`
33
33
  ) : void 0,
34
34
  ...filterWhere,
35
- ...where ?? []
35
+ where
36
36
  );
37
37
  const total = await repository.countTotal({ where: whereClauses });
38
38
  const items = await repository.findAll({
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode, DetailedHTMLProps, TableHTMLAttributes, FC } from 'react';
2
+ import { DetailedHTMLProps, TableHTMLAttributes, ReactNode, FC } from 'react';
3
3
 
4
4
  type TableColumnProps<T> = ReactNode | {
5
5
  label: ReactNode;
@@ -22,7 +22,7 @@ type OrderedTableProps<T> = DetailedHTMLProps<TableHTMLAttributes<HTMLTableEleme
22
22
  offset?: number;
23
23
  orderBy?: string;
24
24
  direction?: string;
25
- filters: {
25
+ filters?: {
26
26
  [key: string]: unknown[];
27
27
  };
28
28
  };
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode, DetailedHTMLProps, TableHTMLAttributes, FC } from 'react';
2
+ import { DetailedHTMLProps, TableHTMLAttributes, ReactNode, FC } from 'react';
3
3
 
4
4
  type TableColumnProps<T> = ReactNode | {
5
5
  label: ReactNode;
@@ -22,7 +22,7 @@ type OrderedTableProps<T> = DetailedHTMLProps<TableHTMLAttributes<HTMLTableEleme
22
22
  offset?: number;
23
23
  orderBy?: string;
24
24
  direction?: string;
25
- filters: {
25
+ filters?: {
26
26
  [key: string]: unknown[];
27
27
  };
28
28
  };
@@ -45,10 +45,7 @@ function Table({
45
45
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
46
46
  "table",
47
47
  {
48
- className: (0, import_utils.cn)(
49
- className,
50
- "text-[15px] border-separate border-spacing-0"
51
- ),
48
+ className: (0, import_utils.cn)(className, "text-[15px] border-separate border-spacing-0"),
52
49
  children: [
53
50
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: keys.map((key) => {
54
51
  const value = columns[key];
@@ -87,13 +84,11 @@ function Table({
87
84
  }
88
85
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: reactNode });
89
86
  }
90
- const filter = filters[key];
87
+ const filter = filters?.[key];
91
88
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
92
89
  "th",
93
90
  {
94
- className: (0, import_utils.cn)(
95
- "py-4 border-y font-normal align-top"
96
- ),
91
+ className: (0, import_utils.cn)("py-4 border-y font-normal align-top"),
97
92
  children: [
98
93
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Head, {}),
99
94
  filter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "px-3 mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -104,12 +99,7 @@ function Table({
104
99
  const value2 = e.target.value;
105
100
  setSearchParams((prev) => {
106
101
  if (value2) {
107
- prev.set(
108
- key,
109
- encodeURIComponent(
110
- value2
111
- )
112
- );
102
+ prev.set(key, encodeURIComponent(value2));
113
103
  } else {
114
104
  prev.delete(key);
115
105
  }
@@ -118,14 +108,7 @@ function Table({
118
108
  },
119
109
  children: [
120
110
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "\uC804\uCCB4" }),
121
- filter.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
122
- "option",
123
- {
124
- value: option,
125
- children: option
126
- },
127
- option
128
- ))
111
+ filter.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: option, children: option }, option))
129
112
  ]
130
113
  }
131
114
  ) })
@@ -164,7 +147,7 @@ function Table({
164
147
  className: "block content-center px-4 w-full h-full",
165
148
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, {})
166
149
  }
167
- ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, {});
150
+ ) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "px-4 w-full h-full content-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, {}) });
168
151
  const cell = Mapper ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
169
152
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "px-0 h-14 border-b", children: cell }, key);
170
153
  }) }, i))
@@ -21,10 +21,7 @@ function Table({
21
21
  return /* @__PURE__ */ jsxs(
22
22
  "table",
23
23
  {
24
- className: cn(
25
- className,
26
- "text-[15px] border-separate border-spacing-0"
27
- ),
24
+ className: cn(className, "text-[15px] border-separate border-spacing-0"),
28
25
  children: [
29
26
  /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: keys.map((key) => {
30
27
  const value = columns[key];
@@ -63,13 +60,11 @@ function Table({
63
60
  }
64
61
  return /* @__PURE__ */ jsx(Fragment, { children: reactNode });
65
62
  }
66
- const filter = filters[key];
63
+ const filter = filters?.[key];
67
64
  return /* @__PURE__ */ jsxs(
68
65
  "th",
69
66
  {
70
- className: cn(
71
- "py-4 border-y font-normal align-top"
72
- ),
67
+ className: cn("py-4 border-y font-normal align-top"),
73
68
  children: [
74
69
  /* @__PURE__ */ jsx(Head, {}),
75
70
  filter && /* @__PURE__ */ jsx("div", { className: "px-3 mt-4", children: /* @__PURE__ */ jsxs(
@@ -80,12 +75,7 @@ function Table({
80
75
  const value2 = e.target.value;
81
76
  setSearchParams((prev) => {
82
77
  if (value2) {
83
- prev.set(
84
- key,
85
- encodeURIComponent(
86
- value2
87
- )
88
- );
78
+ prev.set(key, encodeURIComponent(value2));
89
79
  } else {
90
80
  prev.delete(key);
91
81
  }
@@ -94,14 +84,7 @@ function Table({
94
84
  },
95
85
  children: [
96
86
  /* @__PURE__ */ jsx("option", { value: "", children: "\uC804\uCCB4" }),
97
- filter.map((option) => /* @__PURE__ */ jsx(
98
- "option",
99
- {
100
- value: option,
101
- children: option
102
- },
103
- option
104
- ))
87
+ filter.map((option) => /* @__PURE__ */ jsx("option", { value: option, children: option }, option))
105
88
  ]
106
89
  }
107
90
  ) })
@@ -140,7 +123,7 @@ function Table({
140
123
  className: "block content-center px-4 w-full h-full",
141
124
  children: /* @__PURE__ */ jsx(Content, {})
142
125
  }
143
- ) : /* @__PURE__ */ jsx(Content, {});
126
+ ) : /* @__PURE__ */ jsx("div", { className: "px-4 w-full h-full content-center", children: /* @__PURE__ */ jsx(Content, {}) });
144
127
  const cell = Mapper ? /* @__PURE__ */ jsx(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
145
128
  return /* @__PURE__ */ jsx("td", { className: "px-0 h-14 border-b", children: cell }, key);
146
129
  }) }, i))