dn-react-router-toolkit 0.8.1 → 0.9.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.
- package/dist/api/create_api_handler.d.mts +2 -2
- package/dist/api/create_api_handler.d.ts +2 -2
- package/dist/api/create_api_handler.js +55 -52
- package/dist/api/create_api_handler.mjs +61 -59
- package/dist/api/create_handler.d.mts +5 -5
- package/dist/api/create_handler.d.ts +5 -5
- package/dist/api/create_handler.js +41 -44
- package/dist/api/create_handler.mjs +41 -44
- package/dist/api/index.d.mts +4 -3
- package/dist/api/index.d.ts +4 -3
- package/dist/api/index.js +118 -102
- package/dist/api/index.mjs +130 -109
- package/dist/api/item_api_handler.d.mts +4 -3
- package/dist/api/item_api_handler.d.ts +4 -3
- package/dist/api/item_api_handler.js +22 -6
- package/dist/api/item_api_handler.mjs +28 -6
- package/dist/auth/cookie_manager.d.mts +1 -1
- package/dist/auth/cookie_manager.d.ts +1 -1
- package/dist/auth/index.d.mts +2 -2
- package/dist/auth/index.d.ts +2 -2
- package/dist/auth/index.js +18 -18
- package/dist/auth/index.mjs +18 -18
- package/dist/auth/with_auth.d.mts +2 -2
- package/dist/auth/with_auth.d.ts +2 -2
- package/dist/auth/with_auth.js +18 -18
- package/dist/auth/with_auth.mjs +18 -18
- package/dist/client/editor.d.mts +2 -2
- package/dist/client/editor.d.ts +2 -2
- package/dist/client/editor.js +9 -3
- package/dist/client/editor.mjs +9 -3
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/client/index.js +9 -3
- package/dist/client/index.mjs +9 -3
- package/dist/crud/crud_form.js +22 -4
- package/dist/crud/crud_form.mjs +11 -3
- package/dist/crud/crud_form_provider.js +16 -3
- package/dist/crud/crud_form_provider.mjs +14 -1
- package/dist/crud/index.d.mts +0 -20
- package/dist/crud/index.d.ts +0 -20
- package/dist/crud/index.js +32 -8589
- package/dist/crud/index.mjs +11 -8599
- package/dist/db/backup/index.d.mts +1 -1
- package/dist/db/backup/index.d.ts +1 -1
- package/dist/form/create_form_component.js +21 -2
- package/dist/form/create_form_component.mjs +10 -1
- package/dist/form/form_components.js +21 -2
- package/dist/form/form_components.mjs +10 -1
- package/dist/form/index.js +21 -2
- package/dist/form/index.mjs +10 -1
- package/dist/post/editor_toolbar.js +20 -3
- package/dist/post/editor_toolbar.mjs +9 -2
- package/dist/post/index.js +93 -7711
- package/dist/post/index.mjs +69 -7723
- package/dist/post/post_form_page.js +91 -7711
- package/dist/post/post_form_page.mjs +69 -7725
- package/dist/post/thumbnail_picker.js +21 -2
- package/dist/post/thumbnail_picker.mjs +10 -1
- package/dist/table/buttons.js +11 -14
- package/dist/table/buttons.mjs +10 -13
- package/dist/table/index.d.mts +0 -2
- package/dist/table/index.d.ts +0 -2
- package/dist/table/index.js +24 -95
- package/dist/table/index.mjs +23 -92
- package/dist/table/load_table.d.mts +1 -1
- package/dist/table/load_table.d.ts +1 -1
- package/dist/table/load_table.js +2 -2
- package/dist/table/load_table.mjs +2 -2
- package/dist/table/loader.js +2 -2
- package/dist/table/loader.mjs +2 -2
- package/dist/table/table.d.mts +2 -2
- package/dist/table/table.d.ts +2 -2
- package/dist/table/table.js +14 -25
- package/dist/table/table.mjs +11 -24
- package/dist/table/table_form.js +16 -39
- package/dist/table/table_form.mjs +15 -38
- package/dist/utils/cn.d.mts +3 -0
- package/dist/utils/cn.d.ts +3 -0
- package/dist/utils/cn.js +32 -0
- package/dist/utils/cn.mjs +7 -0
- package/dist/utils/date.d.mts +5 -0
- package/dist/utils/date.d.ts +5 -0
- package/dist/utils/date.js +65 -0
- package/dist/utils/date.mjs +29 -0
- package/dist/utils/index.d.mts +7 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +116 -0
- package/dist/utils/index.mjs +73 -0
- package/dist/utils/korean.d.mts +6 -0
- package/dist/utils/korean.d.ts +6 -0
- package/dist/{crud/generate_pages.js → utils/korean.js} +16 -30
- package/dist/utils/korean.mjs +16 -0
- package/dist/utils/singleton.d.mts +3 -0
- package/dist/utils/singleton.d.ts +3 -0
- package/dist/utils/singleton.js +37 -0
- package/dist/utils/singleton.mjs +12 -0
- package/dist/utils/sleep.d.mts +3 -0
- package/dist/utils/sleep.d.ts +3 -0
- package/dist/{table/item_loader.js → utils/sleep.js} +8 -19
- package/dist/utils/sleep.mjs +7 -0
- package/dist/utils/slug.d.mts +3 -0
- package/dist/utils/slug.d.ts +3 -0
- package/dist/{crud/generate_handlers.js → utils/slug.js} +8 -15
- package/dist/utils/slug.mjs +7 -0
- package/package.json +7 -3
- package/dist/crud/crud_loader.d.mts +0 -26
- package/dist/crud/crud_loader.d.ts +0 -26
- package/dist/crud/crud_loader.js +0 -351
- package/dist/crud/crud_loader.mjs +0 -337
- package/dist/crud/crud_page.d.mts +0 -32
- package/dist/crud/crud_page.d.ts +0 -32
- package/dist/crud/crud_page.js +0 -776
- package/dist/crud/crud_page.mjs +0 -758
- package/dist/crud/generate_handlers.d.mts +0 -16
- package/dist/crud/generate_handlers.d.ts +0 -16
- package/dist/crud/generate_handlers.mjs +0 -14
- package/dist/crud/generate_pages.d.mts +0 -19
- package/dist/crud/generate_pages.d.ts +0 -19
- package/dist/crud/generate_pages.mjs +0 -30
- package/dist/crud/generate_routes.d.mts +0 -5
- package/dist/crud/generate_routes.d.ts +0 -5
- package/dist/crud/generate_routes.js +0 -7639
- package/dist/crud/generate_routes.mjs +0 -7627
- package/dist/table/item_loader.d.mts +0 -14
- package/dist/table/item_loader.d.ts +0 -14
- package/dist/table/item_loader.mjs +0 -18
- package/dist/table/page.d.mts +0 -16
- package/dist/table/page.d.ts +0 -16
- package/dist/table/page.js +0 -375
- package/dist/table/page.mjs +0 -350
|
@@ -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";
|
package/dist/table/load_table.js
CHANGED
|
@@ -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") ?? "
|
|
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
|
-
|
|
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") ?? "
|
|
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
|
-
|
|
35
|
+
where
|
|
36
36
|
);
|
|
37
37
|
const total = await repository.countTotal({ where: whereClauses });
|
|
38
38
|
const items = await repository.findAll({
|
package/dist/table/loader.js
CHANGED
|
@@ -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") ?? "
|
|
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
|
-
|
|
57
|
+
where
|
|
58
58
|
);
|
|
59
59
|
const total = await repository.countTotal({ where: whereClauses });
|
|
60
60
|
const items = await repository.findAll({
|
package/dist/table/loader.mjs
CHANGED
|
@@ -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") ?? "
|
|
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
|
-
|
|
35
|
+
where
|
|
36
36
|
);
|
|
37
37
|
const total = await repository.countTotal({ where: whereClauses });
|
|
38
38
|
const items = await repository.findAll({
|
package/dist/table/table.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
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
|
};
|
package/dist/table/table.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
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
|
};
|
package/dist/table/table.js
CHANGED
|
@@ -23,7 +23,13 @@ __export(table_exports, {
|
|
|
23
23
|
Table: () => Table
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(table_exports);
|
|
26
|
-
|
|
26
|
+
|
|
27
|
+
// src/utils/cn.ts
|
|
28
|
+
function cn(...classes) {
|
|
29
|
+
return classes.filter(Boolean).join(" ").trim();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// src/table/table.tsx
|
|
27
33
|
var import_go = require("react-icons/go");
|
|
28
34
|
var import_react_router = require("react-router");
|
|
29
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -45,10 +51,7 @@ function Table({
|
|
|
45
51
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
46
52
|
"table",
|
|
47
53
|
{
|
|
48
|
-
className: (
|
|
49
|
-
className,
|
|
50
|
-
"text-[15px] border-separate border-spacing-0"
|
|
51
|
-
),
|
|
54
|
+
className: cn(className, "text-[15px] border-separate border-spacing-0"),
|
|
52
55
|
children: [
|
|
53
56
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: keys.map((key) => {
|
|
54
57
|
const value = columns[key];
|
|
@@ -64,7 +67,7 @@ function Table({
|
|
|
64
67
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
65
68
|
"button",
|
|
66
69
|
{
|
|
67
|
-
className:
|
|
70
|
+
className: cn(
|
|
68
71
|
orderBy === key ? "text-gray-900 font-medium" : "text-gray-500 font-medium",
|
|
69
72
|
"px-4 flex items-center w-full"
|
|
70
73
|
),
|
|
@@ -87,13 +90,11 @@ function Table({
|
|
|
87
90
|
}
|
|
88
91
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: reactNode });
|
|
89
92
|
}
|
|
90
|
-
const filter = filters[key];
|
|
93
|
+
const filter = filters?.[key];
|
|
91
94
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
92
95
|
"th",
|
|
93
96
|
{
|
|
94
|
-
className: (
|
|
95
|
-
"py-4 border-y font-normal align-top"
|
|
96
|
-
),
|
|
97
|
+
className: cn("py-4 border-y font-normal align-top"),
|
|
97
98
|
children: [
|
|
98
99
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Head, {}),
|
|
99
100
|
filter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "px-3 mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -104,12 +105,7 @@ function Table({
|
|
|
104
105
|
const value2 = e.target.value;
|
|
105
106
|
setSearchParams((prev) => {
|
|
106
107
|
if (value2) {
|
|
107
|
-
prev.set(
|
|
108
|
-
key,
|
|
109
|
-
encodeURIComponent(
|
|
110
|
-
value2
|
|
111
|
-
)
|
|
112
|
-
);
|
|
108
|
+
prev.set(key, encodeURIComponent(value2));
|
|
113
109
|
} else {
|
|
114
110
|
prev.delete(key);
|
|
115
111
|
}
|
|
@@ -118,14 +114,7 @@ function Table({
|
|
|
118
114
|
},
|
|
119
115
|
children: [
|
|
120
116
|
/* @__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
|
-
))
|
|
117
|
+
filter.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: option, children: option }, option))
|
|
129
118
|
]
|
|
130
119
|
}
|
|
131
120
|
) })
|
|
@@ -164,7 +153,7 @@ function Table({
|
|
|
164
153
|
className: "block content-center px-4 w-full h-full",
|
|
165
154
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, {})
|
|
166
155
|
}
|
|
167
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, {});
|
|
156
|
+
) : /* @__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
157
|
const cell = Mapper ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
|
|
169
158
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "px-0 h-14 border-b", children: cell }, key);
|
|
170
159
|
}) }, i))
|
package/dist/table/table.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
// src/utils/cn.ts
|
|
2
|
+
function cn(...classes) {
|
|
3
|
+
return classes.filter(Boolean).join(" ").trim();
|
|
4
|
+
}
|
|
5
|
+
|
|
1
6
|
// src/table/table.tsx
|
|
2
|
-
import { cn } from "dn-react-toolkit/utils";
|
|
3
7
|
import { GoArrowDown, GoArrowUp } from "react-icons/go";
|
|
4
8
|
import { Link, useSearchParams } from "react-router";
|
|
5
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -21,10 +25,7 @@ function Table({
|
|
|
21
25
|
return /* @__PURE__ */ jsxs(
|
|
22
26
|
"table",
|
|
23
27
|
{
|
|
24
|
-
className: cn(
|
|
25
|
-
className,
|
|
26
|
-
"text-[15px] border-separate border-spacing-0"
|
|
27
|
-
),
|
|
28
|
+
className: cn(className, "text-[15px] border-separate border-spacing-0"),
|
|
28
29
|
children: [
|
|
29
30
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: keys.map((key) => {
|
|
30
31
|
const value = columns[key];
|
|
@@ -63,13 +64,11 @@ function Table({
|
|
|
63
64
|
}
|
|
64
65
|
return /* @__PURE__ */ jsx(Fragment, { children: reactNode });
|
|
65
66
|
}
|
|
66
|
-
const filter = filters[key];
|
|
67
|
+
const filter = filters?.[key];
|
|
67
68
|
return /* @__PURE__ */ jsxs(
|
|
68
69
|
"th",
|
|
69
70
|
{
|
|
70
|
-
className: cn(
|
|
71
|
-
"py-4 border-y font-normal align-top"
|
|
72
|
-
),
|
|
71
|
+
className: cn("py-4 border-y font-normal align-top"),
|
|
73
72
|
children: [
|
|
74
73
|
/* @__PURE__ */ jsx(Head, {}),
|
|
75
74
|
filter && /* @__PURE__ */ jsx("div", { className: "px-3 mt-4", children: /* @__PURE__ */ jsxs(
|
|
@@ -80,12 +79,7 @@ function Table({
|
|
|
80
79
|
const value2 = e.target.value;
|
|
81
80
|
setSearchParams((prev) => {
|
|
82
81
|
if (value2) {
|
|
83
|
-
prev.set(
|
|
84
|
-
key,
|
|
85
|
-
encodeURIComponent(
|
|
86
|
-
value2
|
|
87
|
-
)
|
|
88
|
-
);
|
|
82
|
+
prev.set(key, encodeURIComponent(value2));
|
|
89
83
|
} else {
|
|
90
84
|
prev.delete(key);
|
|
91
85
|
}
|
|
@@ -94,14 +88,7 @@ function Table({
|
|
|
94
88
|
},
|
|
95
89
|
children: [
|
|
96
90
|
/* @__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
|
-
))
|
|
91
|
+
filter.map((option) => /* @__PURE__ */ jsx("option", { value: option, children: option }, option))
|
|
105
92
|
]
|
|
106
93
|
}
|
|
107
94
|
) })
|
|
@@ -140,7 +127,7 @@ function Table({
|
|
|
140
127
|
className: "block content-center px-4 w-full h-full",
|
|
141
128
|
children: /* @__PURE__ */ jsx(Content, {})
|
|
142
129
|
}
|
|
143
|
-
) : /* @__PURE__ */ jsx(Content, {});
|
|
130
|
+
) : /* @__PURE__ */ jsx("div", { className: "px-4 w-full h-full content-center", children: /* @__PURE__ */ jsx(Content, {}) });
|
|
144
131
|
const cell = Mapper ? /* @__PURE__ */ jsx(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
|
|
145
132
|
return /* @__PURE__ */ jsx("td", { className: "px-0 h-14 border-b", children: cell }, key);
|
|
146
133
|
}) }, i))
|
package/dist/table/table_form.js
CHANGED
|
@@ -26,8 +26,12 @@ module.exports = __toCommonJS(table_form_exports);
|
|
|
26
26
|
var import_react_router4 = require("react-router");
|
|
27
27
|
var import_go2 = require("react-icons/go");
|
|
28
28
|
|
|
29
|
+
// src/utils/cn.ts
|
|
30
|
+
function cn(...classes) {
|
|
31
|
+
return classes.filter(Boolean).join(" ").trim();
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
// src/table/table.tsx
|
|
30
|
-
var import_utils = require("dn-react-toolkit/utils");
|
|
31
35
|
var import_go = require("react-icons/go");
|
|
32
36
|
var import_react_router = require("react-router");
|
|
33
37
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -49,10 +53,7 @@ function Table({
|
|
|
49
53
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
50
54
|
"table",
|
|
51
55
|
{
|
|
52
|
-
className: (
|
|
53
|
-
className,
|
|
54
|
-
"text-[15px] border-separate border-spacing-0"
|
|
55
|
-
),
|
|
56
|
+
className: cn(className, "text-[15px] border-separate border-spacing-0"),
|
|
56
57
|
children: [
|
|
57
58
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: keys.map((key) => {
|
|
58
59
|
const value = columns[key];
|
|
@@ -68,7 +69,7 @@ function Table({
|
|
|
68
69
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
69
70
|
"button",
|
|
70
71
|
{
|
|
71
|
-
className:
|
|
72
|
+
className: cn(
|
|
72
73
|
orderBy === key ? "text-gray-900 font-medium" : "text-gray-500 font-medium",
|
|
73
74
|
"px-4 flex items-center w-full"
|
|
74
75
|
),
|
|
@@ -91,13 +92,11 @@ function Table({
|
|
|
91
92
|
}
|
|
92
93
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: reactNode });
|
|
93
94
|
}
|
|
94
|
-
const filter = filters[key];
|
|
95
|
+
const filter = filters?.[key];
|
|
95
96
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
96
97
|
"th",
|
|
97
98
|
{
|
|
98
|
-
className: (
|
|
99
|
-
"py-4 border-y font-normal align-top"
|
|
100
|
-
),
|
|
99
|
+
className: cn("py-4 border-y font-normal align-top"),
|
|
101
100
|
children: [
|
|
102
101
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Head, {}),
|
|
103
102
|
filter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "px-3 mt-4", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -108,12 +107,7 @@ function Table({
|
|
|
108
107
|
const value2 = e.target.value;
|
|
109
108
|
setSearchParams((prev) => {
|
|
110
109
|
if (value2) {
|
|
111
|
-
prev.set(
|
|
112
|
-
key,
|
|
113
|
-
encodeURIComponent(
|
|
114
|
-
value2
|
|
115
|
-
)
|
|
116
|
-
);
|
|
110
|
+
prev.set(key, encodeURIComponent(value2));
|
|
117
111
|
} else {
|
|
118
112
|
prev.delete(key);
|
|
119
113
|
}
|
|
@@ -122,14 +116,7 @@ function Table({
|
|
|
122
116
|
},
|
|
123
117
|
children: [
|
|
124
118
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "\uC804\uCCB4" }),
|
|
125
|
-
filter.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
126
|
-
"option",
|
|
127
|
-
{
|
|
128
|
-
value: option,
|
|
129
|
-
children: option
|
|
130
|
-
},
|
|
131
|
-
option
|
|
132
|
-
))
|
|
119
|
+
filter.map((option) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: option, children: option }, option))
|
|
133
120
|
]
|
|
134
121
|
}
|
|
135
122
|
) })
|
|
@@ -168,7 +155,7 @@ function Table({
|
|
|
168
155
|
className: "block content-center px-4 w-full h-full",
|
|
169
156
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, {})
|
|
170
157
|
}
|
|
171
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, {});
|
|
158
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "px-4 w-full h-full content-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Content, {}) });
|
|
172
159
|
const cell = Mapper ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
|
|
173
160
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { className: "px-0 h-14 border-b", children: cell }, key);
|
|
174
161
|
}) }, i))
|
|
@@ -186,7 +173,6 @@ function useTable() {
|
|
|
186
173
|
}
|
|
187
174
|
|
|
188
175
|
// src/table/buttons.tsx
|
|
189
|
-
var import_utils2 = require("dn-react-toolkit/utils");
|
|
190
176
|
var import_react_router3 = require("react-router");
|
|
191
177
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
192
178
|
function TablePageButtons({
|
|
@@ -206,10 +192,7 @@ function TablePageButtons({
|
|
|
206
192
|
import_react_router3.Link,
|
|
207
193
|
{
|
|
208
194
|
to: (() => {
|
|
209
|
-
searchParams.set(
|
|
210
|
-
"offset",
|
|
211
|
-
String((startButton - 1) * limit)
|
|
212
|
-
);
|
|
195
|
+
searchParams.set("offset", String((startButton - 1) * limit));
|
|
213
196
|
return `${pathname}?${searchParams.toString()}`;
|
|
214
197
|
})(),
|
|
215
198
|
className: "w-10 block text-center transition-colors hover:text-primary",
|
|
@@ -217,10 +200,7 @@ function TablePageButtons({
|
|
|
217
200
|
}
|
|
218
201
|
),
|
|
219
202
|
Array.from({
|
|
220
|
-
length: Math.min(
|
|
221
|
-
MAX_PAGES_TO_SHOW,
|
|
222
|
-
pages - startButton
|
|
223
|
-
)
|
|
203
|
+
length: Math.min(MAX_PAGES_TO_SHOW, pages - startButton)
|
|
224
204
|
}).map((_, index) => {
|
|
225
205
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
226
206
|
import_react_router3.Link,
|
|
@@ -232,7 +212,7 @@ function TablePageButtons({
|
|
|
232
212
|
);
|
|
233
213
|
return `${pathname}?${searchParams.toString()}`;
|
|
234
214
|
})(),
|
|
235
|
-
className:
|
|
215
|
+
className: cn(
|
|
236
216
|
"w-6 block text-center transition-colors",
|
|
237
217
|
currentPage === startButton + index + 1 ? "font-bold text-primary" : "hover:text-primary"
|
|
238
218
|
),
|
|
@@ -245,10 +225,7 @@ function TablePageButtons({
|
|
|
245
225
|
import_react_router3.Link,
|
|
246
226
|
{
|
|
247
227
|
to: (() => {
|
|
248
|
-
searchParams.set(
|
|
249
|
-
"offset",
|
|
250
|
-
String((endButton + 1) * limit)
|
|
251
|
-
);
|
|
228
|
+
searchParams.set("offset", String((endButton + 1) * limit));
|
|
252
229
|
return `${pathname}?${searchParams.toString()}`;
|
|
253
230
|
})(),
|
|
254
231
|
className: "w-10 block text-center transition-colors hover:text-primary",
|
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
import { useLocation as useLocation2, useNavigate, useSearchParams as useSearchParams3 } from "react-router";
|
|
3
3
|
import { GoSearch } from "react-icons/go";
|
|
4
4
|
|
|
5
|
+
// src/utils/cn.ts
|
|
6
|
+
function cn(...classes) {
|
|
7
|
+
return classes.filter(Boolean).join(" ").trim();
|
|
8
|
+
}
|
|
9
|
+
|
|
5
10
|
// src/table/table.tsx
|
|
6
|
-
import { cn } from "dn-react-toolkit/utils";
|
|
7
11
|
import { GoArrowDown, GoArrowUp } from "react-icons/go";
|
|
8
12
|
import { Link, useSearchParams } from "react-router";
|
|
9
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -25,10 +29,7 @@ function Table({
|
|
|
25
29
|
return /* @__PURE__ */ jsxs(
|
|
26
30
|
"table",
|
|
27
31
|
{
|
|
28
|
-
className: cn(
|
|
29
|
-
className,
|
|
30
|
-
"text-[15px] border-separate border-spacing-0"
|
|
31
|
-
),
|
|
32
|
+
className: cn(className, "text-[15px] border-separate border-spacing-0"),
|
|
32
33
|
children: [
|
|
33
34
|
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: keys.map((key) => {
|
|
34
35
|
const value = columns[key];
|
|
@@ -67,13 +68,11 @@ function Table({
|
|
|
67
68
|
}
|
|
68
69
|
return /* @__PURE__ */ jsx(Fragment, { children: reactNode });
|
|
69
70
|
}
|
|
70
|
-
const filter = filters[key];
|
|
71
|
+
const filter = filters?.[key];
|
|
71
72
|
return /* @__PURE__ */ jsxs(
|
|
72
73
|
"th",
|
|
73
74
|
{
|
|
74
|
-
className: cn(
|
|
75
|
-
"py-4 border-y font-normal align-top"
|
|
76
|
-
),
|
|
75
|
+
className: cn("py-4 border-y font-normal align-top"),
|
|
77
76
|
children: [
|
|
78
77
|
/* @__PURE__ */ jsx(Head, {}),
|
|
79
78
|
filter && /* @__PURE__ */ jsx("div", { className: "px-3 mt-4", children: /* @__PURE__ */ jsxs(
|
|
@@ -84,12 +83,7 @@ function Table({
|
|
|
84
83
|
const value2 = e.target.value;
|
|
85
84
|
setSearchParams((prev) => {
|
|
86
85
|
if (value2) {
|
|
87
|
-
prev.set(
|
|
88
|
-
key,
|
|
89
|
-
encodeURIComponent(
|
|
90
|
-
value2
|
|
91
|
-
)
|
|
92
|
-
);
|
|
86
|
+
prev.set(key, encodeURIComponent(value2));
|
|
93
87
|
} else {
|
|
94
88
|
prev.delete(key);
|
|
95
89
|
}
|
|
@@ -98,14 +92,7 @@ function Table({
|
|
|
98
92
|
},
|
|
99
93
|
children: [
|
|
100
94
|
/* @__PURE__ */ jsx("option", { value: "", children: "\uC804\uCCB4" }),
|
|
101
|
-
filter.map((option) => /* @__PURE__ */ jsx(
|
|
102
|
-
"option",
|
|
103
|
-
{
|
|
104
|
-
value: option,
|
|
105
|
-
children: option
|
|
106
|
-
},
|
|
107
|
-
option
|
|
108
|
-
))
|
|
95
|
+
filter.map((option) => /* @__PURE__ */ jsx("option", { value: option, children: option }, option))
|
|
109
96
|
]
|
|
110
97
|
}
|
|
111
98
|
) })
|
|
@@ -144,7 +131,7 @@ function Table({
|
|
|
144
131
|
className: "block content-center px-4 w-full h-full",
|
|
145
132
|
children: /* @__PURE__ */ jsx(Content, {})
|
|
146
133
|
}
|
|
147
|
-
) : /* @__PURE__ */ jsx(Content, {});
|
|
134
|
+
) : /* @__PURE__ */ jsx("div", { className: "px-4 w-full h-full content-center", children: /* @__PURE__ */ jsx(Content, {}) });
|
|
148
135
|
const cell = Mapper ? /* @__PURE__ */ jsx(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
|
|
149
136
|
return /* @__PURE__ */ jsx("td", { className: "px-0 h-14 border-b", children: cell }, key);
|
|
150
137
|
}) }, i))
|
|
@@ -162,7 +149,6 @@ function useTable() {
|
|
|
162
149
|
}
|
|
163
150
|
|
|
164
151
|
// src/table/buttons.tsx
|
|
165
|
-
import { cn as cn2 } from "dn-react-toolkit/utils";
|
|
166
152
|
import { Link as Link2, useLocation, useSearchParams as useSearchParams2 } from "react-router";
|
|
167
153
|
import { Fragment as Fragment2, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
168
154
|
function TablePageButtons({
|
|
@@ -182,10 +168,7 @@ function TablePageButtons({
|
|
|
182
168
|
Link2,
|
|
183
169
|
{
|
|
184
170
|
to: (() => {
|
|
185
|
-
searchParams.set(
|
|
186
|
-
"offset",
|
|
187
|
-
String((startButton - 1) * limit)
|
|
188
|
-
);
|
|
171
|
+
searchParams.set("offset", String((startButton - 1) * limit));
|
|
189
172
|
return `${pathname}?${searchParams.toString()}`;
|
|
190
173
|
})(),
|
|
191
174
|
className: "w-10 block text-center transition-colors hover:text-primary",
|
|
@@ -193,10 +176,7 @@ function TablePageButtons({
|
|
|
193
176
|
}
|
|
194
177
|
),
|
|
195
178
|
Array.from({
|
|
196
|
-
length: Math.min(
|
|
197
|
-
MAX_PAGES_TO_SHOW,
|
|
198
|
-
pages - startButton
|
|
199
|
-
)
|
|
179
|
+
length: Math.min(MAX_PAGES_TO_SHOW, pages - startButton)
|
|
200
180
|
}).map((_, index) => {
|
|
201
181
|
return /* @__PURE__ */ jsx2(
|
|
202
182
|
Link2,
|
|
@@ -208,7 +188,7 @@ function TablePageButtons({
|
|
|
208
188
|
);
|
|
209
189
|
return `${pathname}?${searchParams.toString()}`;
|
|
210
190
|
})(),
|
|
211
|
-
className:
|
|
191
|
+
className: cn(
|
|
212
192
|
"w-6 block text-center transition-colors",
|
|
213
193
|
currentPage === startButton + index + 1 ? "font-bold text-primary" : "hover:text-primary"
|
|
214
194
|
),
|
|
@@ -221,10 +201,7 @@ function TablePageButtons({
|
|
|
221
201
|
Link2,
|
|
222
202
|
{
|
|
223
203
|
to: (() => {
|
|
224
|
-
searchParams.set(
|
|
225
|
-
"offset",
|
|
226
|
-
String((endButton + 1) * limit)
|
|
227
|
-
);
|
|
204
|
+
searchParams.set("offset", String((endButton + 1) * limit));
|
|
228
205
|
return `${pathname}?${searchParams.toString()}`;
|
|
229
206
|
})(),
|
|
230
207
|
className: "w-10 block text-center transition-colors hover:text-primary",
|
package/dist/utils/cn.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/cn.ts
|
|
21
|
+
var cn_exports = {};
|
|
22
|
+
__export(cn_exports, {
|
|
23
|
+
cn: () => cn
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(cn_exports);
|
|
26
|
+
function cn(...classes) {
|
|
27
|
+
return classes.filter(Boolean).join(" ").trim();
|
|
28
|
+
}
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
cn
|
|
32
|
+
});
|