dn-react-router-toolkit 0.7.6 → 0.7.8
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 +5 -5
- package/dist/api/create_api_handler.d.ts +5 -5
- package/dist/api/index.d.mts +7 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.js +163 -2
- package/dist/api/index.mjs +169 -1
- package/dist/client/env_loader.d.mts +2 -2
- package/dist/client/env_loader.d.ts +2 -2
- package/dist/client/env_loader.js +2 -12
- package/dist/client/env_loader.mjs +2 -2
- package/dist/client/file_input.d.mts +3 -2
- package/dist/client/file_input.d.ts +3 -2
- package/dist/client/file_input.js +30 -37
- package/dist/client/file_input.mjs +33 -28
- package/dist/client/index.d.mts +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +38 -44
- package/dist/client/index.mjs +39 -33
- package/dist/client/store_text_editor.d.mts +2 -2
- package/dist/client/store_text_editor.d.ts +2 -2
- package/dist/client/store_text_editor.js +3 -12
- package/dist/client/store_text_editor.mjs +3 -2
- package/dist/crud/crud_form.d.mts +5 -4
- package/dist/crud/crud_form.d.ts +5 -4
- package/dist/crud/crud_form.js +74 -72
- package/dist/crud/crud_form.mjs +79 -62
- package/dist/crud/crud_form_provider.d.mts +9 -7
- package/dist/crud/crud_form_provider.d.ts +9 -7
- package/dist/crud/crud_form_provider.js +2 -12
- package/dist/crud/crud_form_provider.mjs +6 -3
- package/dist/crud/crud_page.d.mts +10 -6
- package/dist/crud/crud_page.d.ts +10 -6
- package/dist/crud/crud_page.js +272 -409
- package/dist/crud/crud_page.mjs +277 -399
- package/dist/crud/generate_pages.d.mts +10 -2
- package/dist/crud/generate_pages.d.ts +10 -2
- package/dist/crud/generate_pages.js +17 -14
- package/dist/crud/generate_pages.mjs +17 -4
- package/dist/crud/index.d.mts +2 -1
- package/dist/crud/index.d.ts +2 -1
- package/dist/crud/index.js +290 -404
- package/dist/crud/index.mjs +295 -404
- package/dist/form/create_form_component.d.mts +3 -2
- package/dist/form/create_form_component.d.ts +3 -2
- package/dist/form/create_form_component.js +3 -12
- package/dist/form/create_form_component.mjs +3 -2
- package/dist/form/form_components.d.mts +5 -4
- package/dist/form/form_components.d.ts +5 -4
- package/dist/form/form_components.js +3 -12
- package/dist/form/form_components.mjs +3 -2
- package/dist/form/index.d.mts +1 -0
- package/dist/form/index.d.ts +1 -0
- package/dist/form/index.js +3 -12
- package/dist/form/index.mjs +3 -2
- package/dist/post/editor_toolbar.d.mts +4 -3
- package/dist/post/editor_toolbar.d.ts +4 -3
- package/dist/post/editor_toolbar.js +116 -273
- package/dist/post/editor_toolbar.mjs +123 -263
- package/dist/post/index.d.mts +1 -0
- package/dist/post/index.d.ts +1 -0
- package/dist/post/index.js +329 -411
- package/dist/post/index.mjs +337 -409
- package/dist/post/post_form_page.d.mts +5 -4
- package/dist/post/post_form_page.d.ts +5 -4
- package/dist/post/post_form_page.js +331 -413
- package/dist/post/post_form_page.mjs +337 -409
- package/dist/post/thumbnail_picker.d.mts +3 -2
- package/dist/post/thumbnail_picker.d.ts +3 -2
- package/dist/post/thumbnail_picker.js +14 -23
- package/dist/post/thumbnail_picker.mjs +14 -13
- package/dist/seo/index.d.mts +1 -1
- package/dist/seo/index.d.ts +1 -1
- package/dist/seo/index.js +2 -2
- package/dist/seo/index.mjs +2 -2
- package/dist/seo/seo.d.mts +2 -2
- package/dist/seo/seo.d.ts +2 -2
- package/dist/seo/seo.js +2 -2
- package/dist/seo/seo.mjs +2 -2
- package/dist/table/buttons.d.mts +2 -2
- package/dist/table/buttons.d.ts +2 -2
- package/dist/table/buttons.js +42 -57
- package/dist/table/buttons.mjs +42 -47
- package/dist/table/index.d.mts +1 -0
- package/dist/table/index.d.ts +1 -0
- package/dist/table/index.js +185 -338
- package/dist/table/index.mjs +185 -328
- package/dist/table/page.d.mts +5 -4
- package/dist/table/page.d.ts +5 -4
- package/dist/table/page.js +185 -338
- package/dist/table/page.mjs +185 -328
- package/dist/table/table.d.mts +5 -4
- package/dist/table/table.d.ts +5 -4
- package/dist/table/table.js +77 -237
- package/dist/table/table.mjs +77 -227
- package/package.json +7 -5
package/dist/table/page.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/table/page.tsx
|
|
@@ -34,160 +24,12 @@ __export(page_exports, {
|
|
|
34
24
|
});
|
|
35
25
|
module.exports = __toCommonJS(page_exports);
|
|
36
26
|
var import_react_router3 = require("react-router");
|
|
37
|
-
|
|
38
|
-
// node_modules/react-icons/lib/iconBase.mjs
|
|
39
|
-
var import_react2 = __toESM(require("react"), 1);
|
|
40
|
-
|
|
41
|
-
// node_modules/react-icons/lib/iconContext.mjs
|
|
42
|
-
var import_react = __toESM(require("react"), 1);
|
|
43
|
-
var DefaultContext = {
|
|
44
|
-
color: void 0,
|
|
45
|
-
size: void 0,
|
|
46
|
-
className: void 0,
|
|
47
|
-
style: void 0,
|
|
48
|
-
attr: void 0
|
|
49
|
-
};
|
|
50
|
-
var IconContext = import_react.default.createContext && /* @__PURE__ */ import_react.default.createContext(DefaultContext);
|
|
51
|
-
|
|
52
|
-
// node_modules/react-icons/lib/iconBase.mjs
|
|
53
|
-
var _excluded = ["attr", "size", "title"];
|
|
54
|
-
function _objectWithoutProperties(source, excluded) {
|
|
55
|
-
if (source == null) return {};
|
|
56
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
57
|
-
var key, i;
|
|
58
|
-
if (Object.getOwnPropertySymbols) {
|
|
59
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
60
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
61
|
-
key = sourceSymbolKeys[i];
|
|
62
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
63
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
64
|
-
target[key] = source[key];
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return target;
|
|
68
|
-
}
|
|
69
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
70
|
-
if (source == null) return {};
|
|
71
|
-
var target = {};
|
|
72
|
-
for (var key in source) {
|
|
73
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
74
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
75
|
-
target[key] = source[key];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return target;
|
|
79
|
-
}
|
|
80
|
-
function _extends() {
|
|
81
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
82
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
83
|
-
var source = arguments[i];
|
|
84
|
-
for (var key in source) {
|
|
85
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
86
|
-
target[key] = source[key];
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return target;
|
|
91
|
-
};
|
|
92
|
-
return _extends.apply(this, arguments);
|
|
93
|
-
}
|
|
94
|
-
function ownKeys(e, r) {
|
|
95
|
-
var t = Object.keys(e);
|
|
96
|
-
if (Object.getOwnPropertySymbols) {
|
|
97
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
98
|
-
r && (o = o.filter(function(r2) {
|
|
99
|
-
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
100
|
-
})), t.push.apply(t, o);
|
|
101
|
-
}
|
|
102
|
-
return t;
|
|
103
|
-
}
|
|
104
|
-
function _objectSpread(e) {
|
|
105
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
106
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
107
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
108
|
-
_defineProperty(e, r2, t[r2]);
|
|
109
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
110
|
-
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
return e;
|
|
114
|
-
}
|
|
115
|
-
function _defineProperty(obj, key, value) {
|
|
116
|
-
key = _toPropertyKey(key);
|
|
117
|
-
if (key in obj) {
|
|
118
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
119
|
-
} else {
|
|
120
|
-
obj[key] = value;
|
|
121
|
-
}
|
|
122
|
-
return obj;
|
|
123
|
-
}
|
|
124
|
-
function _toPropertyKey(t) {
|
|
125
|
-
var i = _toPrimitive(t, "string");
|
|
126
|
-
return "symbol" == typeof i ? i : i + "";
|
|
127
|
-
}
|
|
128
|
-
function _toPrimitive(t, r) {
|
|
129
|
-
if ("object" != typeof t || !t) return t;
|
|
130
|
-
var e = t[Symbol.toPrimitive];
|
|
131
|
-
if (void 0 !== e) {
|
|
132
|
-
var i = e.call(t, r || "default");
|
|
133
|
-
if ("object" != typeof i) return i;
|
|
134
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
135
|
-
}
|
|
136
|
-
return ("string" === r ? String : Number)(t);
|
|
137
|
-
}
|
|
138
|
-
function Tree2Element(tree) {
|
|
139
|
-
return tree && tree.map((node, i) => /* @__PURE__ */ import_react2.default.createElement(node.tag, _objectSpread({
|
|
140
|
-
key: i
|
|
141
|
-
}, node.attr), Tree2Element(node.child)));
|
|
142
|
-
}
|
|
143
|
-
function GenIcon(data) {
|
|
144
|
-
return (props) => /* @__PURE__ */ import_react2.default.createElement(IconBase, _extends({
|
|
145
|
-
attr: _objectSpread({}, data.attr)
|
|
146
|
-
}, props), Tree2Element(data.child));
|
|
147
|
-
}
|
|
148
|
-
function IconBase(props) {
|
|
149
|
-
var elem = (conf) => {
|
|
150
|
-
var {
|
|
151
|
-
attr,
|
|
152
|
-
size,
|
|
153
|
-
title
|
|
154
|
-
} = props, svgProps = _objectWithoutProperties(props, _excluded);
|
|
155
|
-
var computedSize = size || conf.size || "1em";
|
|
156
|
-
var className;
|
|
157
|
-
if (conf.className) className = conf.className;
|
|
158
|
-
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
159
|
-
return /* @__PURE__ */ import_react2.default.createElement("svg", _extends({
|
|
160
|
-
stroke: "currentColor",
|
|
161
|
-
fill: "currentColor",
|
|
162
|
-
strokeWidth: "0"
|
|
163
|
-
}, conf.attr, attr, svgProps, {
|
|
164
|
-
className,
|
|
165
|
-
style: _objectSpread(_objectSpread({
|
|
166
|
-
color: props.color || conf.color
|
|
167
|
-
}, conf.style), props.style),
|
|
168
|
-
height: computedSize,
|
|
169
|
-
width: computedSize,
|
|
170
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
171
|
-
}), title && /* @__PURE__ */ import_react2.default.createElement("title", null, title), props.children);
|
|
172
|
-
};
|
|
173
|
-
return IconContext !== void 0 ? /* @__PURE__ */ import_react2.default.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// node_modules/react-icons/go/index.mjs
|
|
177
|
-
function GoArrowDown(props) {
|
|
178
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M4.97 13.22a.75.75 0 0 1 1.06 0L11 18.19V3.75a.75.75 0 0 1 1.5 0v14.44l4.97-4.97a.749.749 0 0 1 1.275.326.749.749 0 0 1-.215.734l-6.25 6.25a.75.75 0 0 1-1.06 0l-6.25-6.25a.75.75 0 0 1 0-1.06Z" }, "child": [] }] })(props);
|
|
179
|
-
}
|
|
180
|
-
function GoArrowUp(props) {
|
|
181
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M18.655 10.405a.75.75 0 0 1-1.06 0l-4.97-4.97v14.44a.75.75 0 0 1-1.5 0V5.435l-4.97 4.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l6.25-6.25a.75.75 0 0 1 1.06 0l6.25 6.25a.75.75 0 0 1 0 1.06Z" }, "child": [] }] })(props);
|
|
182
|
-
}
|
|
183
|
-
function GoSearch(props) {
|
|
184
|
-
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M10.25 2a8.25 8.25 0 0 1 6.34 13.53l5.69 5.69a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215l-5.69-5.69A8.25 8.25 0 1 1 10.25 2ZM3.5 10.25a6.75 6.75 0 1 0 13.5 0 6.75 6.75 0 0 0-13.5 0Z" }, "child": [] }] })(props);
|
|
185
|
-
}
|
|
27
|
+
var import_go2 = require("react-icons/go");
|
|
186
28
|
|
|
187
29
|
// src/table/buttons.tsx
|
|
188
30
|
var import_utils = require("dn-react-toolkit/utils");
|
|
189
31
|
var import_react_router = require("react-router");
|
|
190
|
-
var
|
|
32
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
191
33
|
function TablePageButtons({
|
|
192
34
|
MAX_PAGES_TO_SHOW,
|
|
193
35
|
total,
|
|
@@ -200,63 +42,59 @@ function TablePageButtons({
|
|
|
200
42
|
const currentPage = Math.floor(offset / limit) + 1;
|
|
201
43
|
const startButton = (Math.ceil(currentPage / MAX_PAGES_TO_SHOW) - 1) * MAX_PAGES_TO_SHOW;
|
|
202
44
|
const endButton = Math.min(startButton + MAX_PAGES_TO_SHOW - 1, pages);
|
|
203
|
-
return /* @__PURE__ */
|
|
204
|
-
|
|
205
|
-
{
|
|
206
|
-
to: (() => {
|
|
207
|
-
searchParams.set(
|
|
208
|
-
"offset",
|
|
209
|
-
String((startButton - 1) * limit)
|
|
210
|
-
);
|
|
211
|
-
return `${pathname}?${searchParams.toString()}`;
|
|
212
|
-
})(),
|
|
213
|
-
className: "w-10 block text-center transition-colors hover:text-primary"
|
|
214
|
-
},
|
|
215
|
-
"\uC774\uC804"
|
|
216
|
-
), Array.from({
|
|
217
|
-
length: Math.min(
|
|
218
|
-
MAX_PAGES_TO_SHOW,
|
|
219
|
-
pages - startButton
|
|
220
|
-
)
|
|
221
|
-
}).map((_, index) => {
|
|
222
|
-
return /* @__PURE__ */ import_react3.default.createElement(
|
|
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)(
|
|
223
47
|
import_react_router.Link,
|
|
224
48
|
{
|
|
225
|
-
key: index,
|
|
226
49
|
to: (() => {
|
|
227
|
-
searchParams.set(
|
|
228
|
-
"offset",
|
|
229
|
-
String((startButton + index) * limit)
|
|
230
|
-
);
|
|
50
|
+
searchParams.set("offset", String((startButton - 1) * limit));
|
|
231
51
|
return `${pathname}?${searchParams.toString()}`;
|
|
232
52
|
})(),
|
|
233
|
-
className:
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
)
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
53
|
+
className: "w-10 block text-center transition-colors hover:text-primary",
|
|
54
|
+
children: "\uC774\uC804"
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
Array.from({
|
|
58
|
+
length: Math.min(MAX_PAGES_TO_SHOW, pages - startButton)
|
|
59
|
+
}).map((_, index) => {
|
|
60
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
61
|
+
import_react_router.Link,
|
|
62
|
+
{
|
|
63
|
+
to: (() => {
|
|
64
|
+
searchParams.set(
|
|
65
|
+
"offset",
|
|
66
|
+
String((startButton + index) * limit)
|
|
67
|
+
);
|
|
68
|
+
return `${pathname}?${searchParams.toString()}`;
|
|
69
|
+
})(),
|
|
70
|
+
className: (0, import_utils.cn)(
|
|
71
|
+
"w-6 block text-center transition-colors",
|
|
72
|
+
currentPage === startButton + index + 1 ? "font-bold text-primary" : "hover:text-primary"
|
|
73
|
+
),
|
|
74
|
+
children: startButton + index + 1
|
|
75
|
+
},
|
|
76
|
+
index
|
|
77
|
+
);
|
|
78
|
+
}),
|
|
79
|
+
endButton < pages && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
80
|
+
import_react_router.Link,
|
|
81
|
+
{
|
|
82
|
+
to: (() => {
|
|
83
|
+
searchParams.set("offset", String((endButton + 1) * limit));
|
|
84
|
+
return `${pathname}?${searchParams.toString()}`;
|
|
85
|
+
})(),
|
|
86
|
+
className: "w-10 block text-center transition-colors hover:text-primary",
|
|
87
|
+
children: "\uB2E4\uC74C"
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
] }) });
|
|
254
91
|
}
|
|
255
92
|
|
|
256
93
|
// src/table/table.tsx
|
|
257
94
|
var import_utils2 = require("dn-react-toolkit/utils");
|
|
95
|
+
var import_go = require("react-icons/go");
|
|
258
96
|
var import_react_router2 = require("react-router");
|
|
259
|
-
var
|
|
97
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
260
98
|
function Table({
|
|
261
99
|
className = "min-w-full whitespace-nowrap",
|
|
262
100
|
data,
|
|
@@ -271,95 +109,92 @@ function Table({
|
|
|
271
109
|
const keys = Object.entries(columns).filter((entry) => entry[1]).map(([key]) => key);
|
|
272
110
|
const sortedArray = [...data];
|
|
273
111
|
const [_, setSearchParams] = (0, import_react_router2.useSearchParams)();
|
|
274
|
-
return /* @__PURE__ */
|
|
112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
275
113
|
"table",
|
|
276
114
|
{
|
|
277
|
-
className: (0, import_utils2.cn)(
|
|
278
|
-
|
|
279
|
-
"
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
115
|
+
className: (0, import_utils2.cn)(className, "text-[15px] border-separate border-spacing-0"),
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: keys.map((key) => {
|
|
118
|
+
const value = columns[key];
|
|
119
|
+
function getReactNode() {
|
|
120
|
+
if (value && typeof value === "object" && "label" in value) {
|
|
121
|
+
return value.label;
|
|
122
|
+
}
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
125
|
+
function Head() {
|
|
126
|
+
const reactNode = getReactNode();
|
|
127
|
+
if (typeof reactNode === "string") {
|
|
128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
className: (0, import_utils2.cn)(
|
|
132
|
+
orderBy === key ? "text-neutral-900 font-medium" : "text-neutral-500",
|
|
133
|
+
"px-4 h-14 flex items-center w-full"
|
|
134
|
+
),
|
|
135
|
+
onClick: () => {
|
|
136
|
+
let newDirection = "asc";
|
|
137
|
+
if (orderBy === key) {
|
|
138
|
+
newDirection = direction === "asc" ? "desc" : "asc";
|
|
139
|
+
}
|
|
140
|
+
setSearchParams({
|
|
141
|
+
orderBy: key,
|
|
142
|
+
direction: newDirection
|
|
143
|
+
});
|
|
144
|
+
},
|
|
145
|
+
children: [
|
|
146
|
+
reactNode,
|
|
147
|
+
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, {}) })
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: reactNode });
|
|
153
|
+
}
|
|
154
|
+
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);
|
|
155
|
+
}) }) }),
|
|
156
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tbody", { children: [
|
|
157
|
+
sortedArray.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
158
|
+
"td",
|
|
295
159
|
{
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
160
|
+
colSpan: keys.length,
|
|
161
|
+
className: "px-4 h-14 text-neutral-400 text-center",
|
|
162
|
+
children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
163
|
+
}
|
|
164
|
+
) }),
|
|
165
|
+
sortedArray.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { className: "hover:bg-gray-50 transition-colors", children: keys.map((key, i2) => {
|
|
166
|
+
const value = item[key];
|
|
167
|
+
function Content() {
|
|
168
|
+
if (key in columns) {
|
|
169
|
+
const column = columns[key];
|
|
170
|
+
if (column && typeof column === "object" && "mapper" in column) {
|
|
171
|
+
const mapper = column.mapper;
|
|
172
|
+
if (mapper) {
|
|
173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: mapper(item) });
|
|
174
|
+
}
|
|
304
175
|
}
|
|
305
|
-
setSearchParams({
|
|
306
|
-
orderBy: key,
|
|
307
|
-
direction: newDirection
|
|
308
|
-
});
|
|
309
176
|
}
|
|
310
|
-
|
|
311
|
-
reactNode,
|
|
312
|
-
orderBy === key && /* @__PURE__ */ import_react4.default.createElement("div", { className: "ml-0.5" }, direction === "asc" ? /* @__PURE__ */ import_react4.default.createElement(GoArrowUp, null) : /* @__PURE__ */ import_react4.default.createElement(GoArrowDown, null))
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, reactNode);
|
|
316
|
-
}
|
|
317
|
-
return /* @__PURE__ */ import_react4.default.createElement(
|
|
318
|
-
"th",
|
|
319
|
-
{
|
|
320
|
-
key,
|
|
321
|
-
className: (0, import_utils2.cn)("border-y font-normal")
|
|
322
|
-
},
|
|
323
|
-
/* @__PURE__ */ import_react4.default.createElement(Head, null)
|
|
324
|
-
);
|
|
325
|
-
}))),
|
|
326
|
-
/* @__PURE__ */ import_react4.default.createElement("tbody", null, sortedArray.length === 0 && /* @__PURE__ */ import_react4.default.createElement("tr", null, /* @__PURE__ */ import_react4.default.createElement(
|
|
327
|
-
"td",
|
|
328
|
-
{
|
|
329
|
-
colSpan: keys.length,
|
|
330
|
-
className: "px-4 h-14 text-neutral-400 text-center"
|
|
331
|
-
},
|
|
332
|
-
"\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
333
|
-
)), sortedArray.map((item, i) => /* @__PURE__ */ import_react4.default.createElement("tr", { key: i, className: "hover:bg-gray-50 transition-colors" }, keys.map((key, i2) => {
|
|
334
|
-
const value = item[key];
|
|
335
|
-
function Content() {
|
|
336
|
-
if (key in columns) {
|
|
337
|
-
const column = columns[key];
|
|
338
|
-
if (column && typeof column === "object" && "mapper" in column) {
|
|
339
|
-
const mapper = column.mapper;
|
|
340
|
-
if (mapper) {
|
|
341
|
-
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, mapper(item));
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: String(value) });
|
|
342
178
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}))))
|
|
179
|
+
const linkedContent = getLink ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
180
|
+
import_react_router2.Link,
|
|
181
|
+
{
|
|
182
|
+
to: getLink(item),
|
|
183
|
+
className: "block content-center px-4 w-full h-full",
|
|
184
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, {})
|
|
185
|
+
}
|
|
186
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, {});
|
|
187
|
+
const cell = Mapper ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
|
|
188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "px-0 h-14 border-b", children: cell }, key);
|
|
189
|
+
}) }, i))
|
|
190
|
+
] })
|
|
191
|
+
]
|
|
192
|
+
}
|
|
358
193
|
);
|
|
359
194
|
}
|
|
360
195
|
|
|
361
196
|
// src/table/page.tsx
|
|
362
|
-
var
|
|
197
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
363
198
|
function createTablePage({
|
|
364
199
|
name,
|
|
365
200
|
columns,
|
|
@@ -379,60 +214,72 @@ function createTablePage({
|
|
|
379
214
|
navigate(`${pathname}?${searchParams2.toString()}`);
|
|
380
215
|
};
|
|
381
216
|
const [searchParams] = (0, import_react_router3.useSearchParams)();
|
|
382
|
-
return /* @__PURE__ */
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
title: name,
|
|
386
|
-
actions: /* @__PURE__ */ import_react5.default.createElement(import_react_router3.Link, { to: `${pathname}/new`, className: "button-primary" }, name, " \uCD94\uAC00")
|
|
387
|
-
}
|
|
388
|
-
), /* @__PURE__ */ import_react5.default.createElement("div", { className: "max-w-7xl mx-auto w-full overflow-auto" }, searchKey && /* @__PURE__ */ import_react5.default.createElement(
|
|
389
|
-
"form",
|
|
390
|
-
{
|
|
391
|
-
className: "h-18 px-4 flex items-center border-t",
|
|
392
|
-
onSubmit: (e) => {
|
|
393
|
-
e.preventDefault();
|
|
394
|
-
const formData = new FormData(e.currentTarget);
|
|
395
|
-
const query = formData.get("query");
|
|
396
|
-
search(query);
|
|
397
|
-
}
|
|
398
|
-
},
|
|
399
|
-
/* @__PURE__ */ import_react5.default.createElement(
|
|
400
|
-
"button",
|
|
217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
218
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
219
|
+
Header,
|
|
401
220
|
{
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
/* @__PURE__ */ import_react5.default.createElement(
|
|
408
|
-
"input",
|
|
409
|
-
{
|
|
410
|
-
className: "outline-none h-full flex-1",
|
|
411
|
-
placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
|
|
412
|
-
name: "query",
|
|
413
|
-
defaultValue: searchParams.get("query") ?? ""
|
|
221
|
+
title: name,
|
|
222
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_router3.Link, { to: `${pathname}/new`, className: "button-primary", children: [
|
|
223
|
+
name,
|
|
224
|
+
" \uCD94\uAC00"
|
|
225
|
+
] })
|
|
414
226
|
}
|
|
415
|
-
)
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
227
|
+
),
|
|
228
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "max-w-7xl mx-auto w-full overflow-auto", children: [
|
|
229
|
+
searchKey && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
230
|
+
"form",
|
|
231
|
+
{
|
|
232
|
+
className: "h-18 px-4 flex items-center border-t",
|
|
233
|
+
onSubmit: (e) => {
|
|
234
|
+
e.preventDefault();
|
|
235
|
+
const formData = new FormData(e.currentTarget);
|
|
236
|
+
const query = formData.get("query");
|
|
237
|
+
search(query);
|
|
238
|
+
},
|
|
239
|
+
children: [
|
|
240
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
241
|
+
"button",
|
|
242
|
+
{
|
|
243
|
+
type: "submit",
|
|
244
|
+
className: "w-10 h-10 flex justify-center items-center",
|
|
245
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_go2.GoSearch, { className: "text-xl mr-4" })
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
249
|
+
"input",
|
|
250
|
+
{
|
|
251
|
+
className: "outline-none h-full flex-1",
|
|
252
|
+
placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
|
|
253
|
+
name: "query",
|
|
254
|
+
defaultValue: searchParams.get("query") ?? ""
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
),
|
|
260
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
261
|
+
Table,
|
|
262
|
+
{
|
|
263
|
+
data: items,
|
|
264
|
+
columns,
|
|
265
|
+
getLink: primaryKey ? (item) => `${pathname}/${item[primaryKey]}` : void 0,
|
|
266
|
+
limit,
|
|
267
|
+
offset,
|
|
268
|
+
orderBy,
|
|
269
|
+
direction
|
|
270
|
+
}
|
|
271
|
+
),
|
|
272
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
273
|
+
TablePageButtons,
|
|
274
|
+
{
|
|
275
|
+
total,
|
|
276
|
+
limit,
|
|
277
|
+
offset,
|
|
278
|
+
MAX_PAGES_TO_SHOW: 10
|
|
279
|
+
}
|
|
280
|
+
)
|
|
281
|
+
] })
|
|
282
|
+
] });
|
|
436
283
|
};
|
|
437
284
|
}
|
|
438
285
|
// Annotate the CommonJS export names for ESM import in node:
|