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/index.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, desc2) => {
|
|
|
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/index.ts
|
|
@@ -90,7 +80,7 @@ var BaseTableRepository = class {
|
|
|
90
80
|
// src/table/buttons.tsx
|
|
91
81
|
var import_utils = require("dn-react-toolkit/utils");
|
|
92
82
|
var import_react_router = require("react-router");
|
|
93
|
-
var
|
|
83
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
94
84
|
function TablePageButtons({
|
|
95
85
|
MAX_PAGES_TO_SHOW,
|
|
96
86
|
total,
|
|
@@ -103,57 +93,52 @@ function TablePageButtons({
|
|
|
103
93
|
const currentPage = Math.floor(offset / limit) + 1;
|
|
104
94
|
const startButton = (Math.ceil(currentPage / MAX_PAGES_TO_SHOW) - 1) * MAX_PAGES_TO_SHOW;
|
|
105
95
|
const endButton = Math.min(startButton + MAX_PAGES_TO_SHOW - 1, pages);
|
|
106
|
-
return /* @__PURE__ */
|
|
107
|
-
|
|
108
|
-
{
|
|
109
|
-
to: (() => {
|
|
110
|
-
searchParams.set(
|
|
111
|
-
"offset",
|
|
112
|
-
String((startButton - 1) * limit)
|
|
113
|
-
);
|
|
114
|
-
return `${pathname}?${searchParams.toString()}`;
|
|
115
|
-
})(),
|
|
116
|
-
className: "w-10 block text-center transition-colors hover:text-primary"
|
|
117
|
-
},
|
|
118
|
-
"\uC774\uC804"
|
|
119
|
-
), Array.from({
|
|
120
|
-
length: Math.min(
|
|
121
|
-
MAX_PAGES_TO_SHOW,
|
|
122
|
-
pages - startButton
|
|
123
|
-
)
|
|
124
|
-
}).map((_, index) => {
|
|
125
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
96
|
+
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: [
|
|
97
|
+
startButton > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
126
98
|
import_react_router.Link,
|
|
127
99
|
{
|
|
128
|
-
key: index,
|
|
129
100
|
to: (() => {
|
|
130
|
-
searchParams.set(
|
|
131
|
-
"offset",
|
|
132
|
-
String((startButton + index) * limit)
|
|
133
|
-
);
|
|
101
|
+
searchParams.set("offset", String((startButton - 1) * limit));
|
|
134
102
|
return `${pathname}?${searchParams.toString()}`;
|
|
135
103
|
})(),
|
|
136
|
-
className:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
104
|
+
className: "w-10 block text-center transition-colors hover:text-primary",
|
|
105
|
+
children: "\uC774\uC804"
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
Array.from({
|
|
109
|
+
length: Math.min(MAX_PAGES_TO_SHOW, pages - startButton)
|
|
110
|
+
}).map((_, index) => {
|
|
111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
112
|
+
import_react_router.Link,
|
|
113
|
+
{
|
|
114
|
+
to: (() => {
|
|
115
|
+
searchParams.set(
|
|
116
|
+
"offset",
|
|
117
|
+
String((startButton + index) * limit)
|
|
118
|
+
);
|
|
119
|
+
return `${pathname}?${searchParams.toString()}`;
|
|
120
|
+
})(),
|
|
121
|
+
className: (0, import_utils.cn)(
|
|
122
|
+
"w-6 block text-center transition-colors",
|
|
123
|
+
currentPage === startButton + index + 1 ? "font-bold text-primary" : "hover:text-primary"
|
|
124
|
+
),
|
|
125
|
+
children: startButton + index + 1
|
|
126
|
+
},
|
|
127
|
+
index
|
|
128
|
+
);
|
|
129
|
+
}),
|
|
130
|
+
endButton < pages && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
131
|
+
import_react_router.Link,
|
|
132
|
+
{
|
|
133
|
+
to: (() => {
|
|
134
|
+
searchParams.set("offset", String((endButton + 1) * limit));
|
|
135
|
+
return `${pathname}?${searchParams.toString()}`;
|
|
136
|
+
})(),
|
|
137
|
+
className: "w-10 block text-center transition-colors hover:text-primary",
|
|
138
|
+
children: "\uB2E4\uC74C"
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
] }) });
|
|
157
142
|
}
|
|
158
143
|
|
|
159
144
|
// src/table/item_loader.tsx
|
|
@@ -217,160 +202,13 @@ function tableLoader({
|
|
|
217
202
|
|
|
218
203
|
// src/table/page.tsx
|
|
219
204
|
var import_react_router3 = require("react-router");
|
|
220
|
-
|
|
221
|
-
// node_modules/react-icons/lib/iconBase.mjs
|
|
222
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
223
|
-
|
|
224
|
-
// node_modules/react-icons/lib/iconContext.mjs
|
|
225
|
-
var import_react2 = __toESM(require("react"), 1);
|
|
226
|
-
var DefaultContext = {
|
|
227
|
-
color: void 0,
|
|
228
|
-
size: void 0,
|
|
229
|
-
className: void 0,
|
|
230
|
-
style: void 0,
|
|
231
|
-
attr: void 0
|
|
232
|
-
};
|
|
233
|
-
var IconContext = import_react2.default.createContext && /* @__PURE__ */ import_react2.default.createContext(DefaultContext);
|
|
234
|
-
|
|
235
|
-
// node_modules/react-icons/lib/iconBase.mjs
|
|
236
|
-
var _excluded = ["attr", "size", "title"];
|
|
237
|
-
function _objectWithoutProperties(source, excluded) {
|
|
238
|
-
if (source == null) return {};
|
|
239
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
240
|
-
var key, i;
|
|
241
|
-
if (Object.getOwnPropertySymbols) {
|
|
242
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
243
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
244
|
-
key = sourceSymbolKeys[i];
|
|
245
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
246
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
247
|
-
target[key] = source[key];
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
return target;
|
|
251
|
-
}
|
|
252
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
253
|
-
if (source == null) return {};
|
|
254
|
-
var target = {};
|
|
255
|
-
for (var key in source) {
|
|
256
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
257
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
258
|
-
target[key] = source[key];
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
return target;
|
|
262
|
-
}
|
|
263
|
-
function _extends() {
|
|
264
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
265
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
266
|
-
var source = arguments[i];
|
|
267
|
-
for (var key in source) {
|
|
268
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
269
|
-
target[key] = source[key];
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return target;
|
|
274
|
-
};
|
|
275
|
-
return _extends.apply(this, arguments);
|
|
276
|
-
}
|
|
277
|
-
function ownKeys(e, r) {
|
|
278
|
-
var t = Object.keys(e);
|
|
279
|
-
if (Object.getOwnPropertySymbols) {
|
|
280
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
281
|
-
r && (o = o.filter(function(r2) {
|
|
282
|
-
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
283
|
-
})), t.push.apply(t, o);
|
|
284
|
-
}
|
|
285
|
-
return t;
|
|
286
|
-
}
|
|
287
|
-
function _objectSpread(e) {
|
|
288
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
289
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
290
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
291
|
-
_defineProperty(e, r2, t[r2]);
|
|
292
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
293
|
-
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
return e;
|
|
297
|
-
}
|
|
298
|
-
function _defineProperty(obj, key, value) {
|
|
299
|
-
key = _toPropertyKey(key);
|
|
300
|
-
if (key in obj) {
|
|
301
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
302
|
-
} else {
|
|
303
|
-
obj[key] = value;
|
|
304
|
-
}
|
|
305
|
-
return obj;
|
|
306
|
-
}
|
|
307
|
-
function _toPropertyKey(t) {
|
|
308
|
-
var i = _toPrimitive(t, "string");
|
|
309
|
-
return "symbol" == typeof i ? i : i + "";
|
|
310
|
-
}
|
|
311
|
-
function _toPrimitive(t, r) {
|
|
312
|
-
if ("object" != typeof t || !t) return t;
|
|
313
|
-
var e = t[Symbol.toPrimitive];
|
|
314
|
-
if (void 0 !== e) {
|
|
315
|
-
var i = e.call(t, r || "default");
|
|
316
|
-
if ("object" != typeof i) return i;
|
|
317
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
318
|
-
}
|
|
319
|
-
return ("string" === r ? String : Number)(t);
|
|
320
|
-
}
|
|
321
|
-
function Tree2Element(tree) {
|
|
322
|
-
return tree && tree.map((node, i) => /* @__PURE__ */ import_react3.default.createElement(node.tag, _objectSpread({
|
|
323
|
-
key: i
|
|
324
|
-
}, node.attr), Tree2Element(node.child)));
|
|
325
|
-
}
|
|
326
|
-
function GenIcon(data) {
|
|
327
|
-
return (props) => /* @__PURE__ */ import_react3.default.createElement(IconBase, _extends({
|
|
328
|
-
attr: _objectSpread({}, data.attr)
|
|
329
|
-
}, props), Tree2Element(data.child));
|
|
330
|
-
}
|
|
331
|
-
function IconBase(props) {
|
|
332
|
-
var elem = (conf) => {
|
|
333
|
-
var {
|
|
334
|
-
attr,
|
|
335
|
-
size,
|
|
336
|
-
title
|
|
337
|
-
} = props, svgProps = _objectWithoutProperties(props, _excluded);
|
|
338
|
-
var computedSize = size || conf.size || "1em";
|
|
339
|
-
var className;
|
|
340
|
-
if (conf.className) className = conf.className;
|
|
341
|
-
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
342
|
-
return /* @__PURE__ */ import_react3.default.createElement("svg", _extends({
|
|
343
|
-
stroke: "currentColor",
|
|
344
|
-
fill: "currentColor",
|
|
345
|
-
strokeWidth: "0"
|
|
346
|
-
}, conf.attr, attr, svgProps, {
|
|
347
|
-
className,
|
|
348
|
-
style: _objectSpread(_objectSpread({
|
|
349
|
-
color: props.color || conf.color
|
|
350
|
-
}, conf.style), props.style),
|
|
351
|
-
height: computedSize,
|
|
352
|
-
width: computedSize,
|
|
353
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
354
|
-
}), title && /* @__PURE__ */ import_react3.default.createElement("title", null, title), props.children);
|
|
355
|
-
};
|
|
356
|
-
return IconContext !== void 0 ? /* @__PURE__ */ import_react3.default.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
// node_modules/react-icons/go/index.mjs
|
|
360
|
-
function GoArrowDown(props) {
|
|
361
|
-
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);
|
|
362
|
-
}
|
|
363
|
-
function GoArrowUp(props) {
|
|
364
|
-
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);
|
|
365
|
-
}
|
|
366
|
-
function GoSearch(props) {
|
|
367
|
-
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);
|
|
368
|
-
}
|
|
205
|
+
var import_go2 = require("react-icons/go");
|
|
369
206
|
|
|
370
207
|
// src/table/table.tsx
|
|
371
208
|
var import_utils2 = require("dn-react-toolkit/utils");
|
|
209
|
+
var import_go = require("react-icons/go");
|
|
372
210
|
var import_react_router2 = require("react-router");
|
|
373
|
-
var
|
|
211
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
374
212
|
function Table({
|
|
375
213
|
className = "min-w-full whitespace-nowrap",
|
|
376
214
|
data,
|
|
@@ -385,95 +223,92 @@ function Table({
|
|
|
385
223
|
const keys = Object.entries(columns).filter((entry) => entry[1]).map(([key]) => key);
|
|
386
224
|
const sortedArray = [...data];
|
|
387
225
|
const [_, setSearchParams] = (0, import_react_router2.useSearchParams)();
|
|
388
|
-
return /* @__PURE__ */
|
|
226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
389
227
|
"table",
|
|
390
228
|
{
|
|
391
|
-
className: (0, import_utils2.cn)(
|
|
392
|
-
|
|
393
|
-
"
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
229
|
+
className: (0, import_utils2.cn)(className, "text-[15px] border-separate border-spacing-0"),
|
|
230
|
+
children: [
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: keys.map((key) => {
|
|
232
|
+
const value = columns[key];
|
|
233
|
+
function getReactNode() {
|
|
234
|
+
if (value && typeof value === "object" && "label" in value) {
|
|
235
|
+
return value.label;
|
|
236
|
+
}
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
function Head() {
|
|
240
|
+
const reactNode = getReactNode();
|
|
241
|
+
if (typeof reactNode === "string") {
|
|
242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
243
|
+
"button",
|
|
244
|
+
{
|
|
245
|
+
className: (0, import_utils2.cn)(
|
|
246
|
+
orderBy === key ? "text-neutral-900 font-medium" : "text-neutral-500",
|
|
247
|
+
"px-4 h-14 flex items-center w-full"
|
|
248
|
+
),
|
|
249
|
+
onClick: () => {
|
|
250
|
+
let newDirection = "asc";
|
|
251
|
+
if (orderBy === key) {
|
|
252
|
+
newDirection = direction === "asc" ? "desc" : "asc";
|
|
253
|
+
}
|
|
254
|
+
setSearchParams({
|
|
255
|
+
orderBy: key,
|
|
256
|
+
direction: newDirection
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
children: [
|
|
260
|
+
reactNode,
|
|
261
|
+
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, {}) })
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: reactNode });
|
|
267
|
+
}
|
|
268
|
+
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);
|
|
269
|
+
}) }) }),
|
|
270
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tbody", { children: [
|
|
271
|
+
sortedArray.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
272
|
+
"td",
|
|
409
273
|
{
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
274
|
+
colSpan: keys.length,
|
|
275
|
+
className: "px-4 h-14 text-neutral-400 text-center",
|
|
276
|
+
children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
277
|
+
}
|
|
278
|
+
) }),
|
|
279
|
+
sortedArray.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { className: "hover:bg-gray-50 transition-colors", children: keys.map((key, i2) => {
|
|
280
|
+
const value = item[key];
|
|
281
|
+
function Content() {
|
|
282
|
+
if (key in columns) {
|
|
283
|
+
const column = columns[key];
|
|
284
|
+
if (column && typeof column === "object" && "mapper" in column) {
|
|
285
|
+
const mapper = column.mapper;
|
|
286
|
+
if (mapper) {
|
|
287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: mapper(item) });
|
|
288
|
+
}
|
|
418
289
|
}
|
|
419
|
-
setSearchParams({
|
|
420
|
-
orderBy: key,
|
|
421
|
-
direction: newDirection
|
|
422
|
-
});
|
|
423
290
|
}
|
|
424
|
-
|
|
425
|
-
reactNode,
|
|
426
|
-
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))
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, reactNode);
|
|
430
|
-
}
|
|
431
|
-
return /* @__PURE__ */ import_react4.default.createElement(
|
|
432
|
-
"th",
|
|
433
|
-
{
|
|
434
|
-
key,
|
|
435
|
-
className: (0, import_utils2.cn)("border-y font-normal")
|
|
436
|
-
},
|
|
437
|
-
/* @__PURE__ */ import_react4.default.createElement(Head, null)
|
|
438
|
-
);
|
|
439
|
-
}))),
|
|
440
|
-
/* @__PURE__ */ import_react4.default.createElement("tbody", null, sortedArray.length === 0 && /* @__PURE__ */ import_react4.default.createElement("tr", null, /* @__PURE__ */ import_react4.default.createElement(
|
|
441
|
-
"td",
|
|
442
|
-
{
|
|
443
|
-
colSpan: keys.length,
|
|
444
|
-
className: "px-4 h-14 text-neutral-400 text-center"
|
|
445
|
-
},
|
|
446
|
-
"\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
447
|
-
)), sortedArray.map((item, i) => /* @__PURE__ */ import_react4.default.createElement("tr", { key: i, className: "hover:bg-gray-50 transition-colors" }, keys.map((key, i2) => {
|
|
448
|
-
const value = item[key];
|
|
449
|
-
function Content() {
|
|
450
|
-
if (key in columns) {
|
|
451
|
-
const column = columns[key];
|
|
452
|
-
if (column && typeof column === "object" && "mapper" in column) {
|
|
453
|
-
const mapper = column.mapper;
|
|
454
|
-
if (mapper) {
|
|
455
|
-
return /* @__PURE__ */ import_react4.default.createElement(import_react4.default.Fragment, null, mapper(item));
|
|
291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: String(value) });
|
|
456
292
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}))))
|
|
293
|
+
const linkedContent = getLink ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
294
|
+
import_react_router2.Link,
|
|
295
|
+
{
|
|
296
|
+
to: getLink(item),
|
|
297
|
+
className: "block content-center px-4 w-full h-full",
|
|
298
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, {})
|
|
299
|
+
}
|
|
300
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Content, {});
|
|
301
|
+
const cell = Mapper ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
|
|
302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { className: "px-0 h-14 border-b", children: cell }, key);
|
|
303
|
+
}) }, i))
|
|
304
|
+
] })
|
|
305
|
+
]
|
|
306
|
+
}
|
|
472
307
|
);
|
|
473
308
|
}
|
|
474
309
|
|
|
475
310
|
// src/table/page.tsx
|
|
476
|
-
var
|
|
311
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
477
312
|
function createTablePage({
|
|
478
313
|
name,
|
|
479
314
|
columns,
|
|
@@ -493,60 +328,72 @@ function createTablePage({
|
|
|
493
328
|
navigate(`${pathname}?${searchParams2.toString()}`);
|
|
494
329
|
};
|
|
495
330
|
const [searchParams] = (0, import_react_router3.useSearchParams)();
|
|
496
|
-
return /* @__PURE__ */
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
title: name,
|
|
500
|
-
actions: /* @__PURE__ */ import_react5.default.createElement(import_react_router3.Link, { to: `${pathname}/new`, className: "button-primary" }, name, " \uCD94\uAC00")
|
|
501
|
-
}
|
|
502
|
-
), /* @__PURE__ */ import_react5.default.createElement("div", { className: "max-w-7xl mx-auto w-full overflow-auto" }, searchKey && /* @__PURE__ */ import_react5.default.createElement(
|
|
503
|
-
"form",
|
|
504
|
-
{
|
|
505
|
-
className: "h-18 px-4 flex items-center border-t",
|
|
506
|
-
onSubmit: (e) => {
|
|
507
|
-
e.preventDefault();
|
|
508
|
-
const formData = new FormData(e.currentTarget);
|
|
509
|
-
const query = formData.get("query");
|
|
510
|
-
search(query);
|
|
511
|
-
}
|
|
512
|
-
},
|
|
513
|
-
/* @__PURE__ */ import_react5.default.createElement(
|
|
514
|
-
"button",
|
|
515
|
-
{
|
|
516
|
-
type: "submit",
|
|
517
|
-
className: "w-10 h-10 flex justify-center items-center"
|
|
518
|
-
},
|
|
519
|
-
/* @__PURE__ */ import_react5.default.createElement(GoSearch, { className: "text-xl mr-4" })
|
|
520
|
-
),
|
|
521
|
-
/* @__PURE__ */ import_react5.default.createElement(
|
|
522
|
-
"input",
|
|
331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
332
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
333
|
+
Header,
|
|
523
334
|
{
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
335
|
+
title: name,
|
|
336
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react_router3.Link, { to: `${pathname}/new`, className: "button-primary", children: [
|
|
337
|
+
name,
|
|
338
|
+
" \uCD94\uAC00"
|
|
339
|
+
] })
|
|
528
340
|
}
|
|
529
|
-
)
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
341
|
+
),
|
|
342
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "max-w-7xl mx-auto w-full overflow-auto", children: [
|
|
343
|
+
searchKey && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
344
|
+
"form",
|
|
345
|
+
{
|
|
346
|
+
className: "h-18 px-4 flex items-center border-t",
|
|
347
|
+
onSubmit: (e) => {
|
|
348
|
+
e.preventDefault();
|
|
349
|
+
const formData = new FormData(e.currentTarget);
|
|
350
|
+
const query = formData.get("query");
|
|
351
|
+
search(query);
|
|
352
|
+
},
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
355
|
+
"button",
|
|
356
|
+
{
|
|
357
|
+
type: "submit",
|
|
358
|
+
className: "w-10 h-10 flex justify-center items-center",
|
|
359
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_go2.GoSearch, { className: "text-xl mr-4" })
|
|
360
|
+
}
|
|
361
|
+
),
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
363
|
+
"input",
|
|
364
|
+
{
|
|
365
|
+
className: "outline-none h-full flex-1",
|
|
366
|
+
placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
|
|
367
|
+
name: "query",
|
|
368
|
+
defaultValue: searchParams.get("query") ?? ""
|
|
369
|
+
}
|
|
370
|
+
)
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
),
|
|
374
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
375
|
+
Table,
|
|
376
|
+
{
|
|
377
|
+
data: items,
|
|
378
|
+
columns,
|
|
379
|
+
getLink: primaryKey ? (item) => `${pathname}/${item[primaryKey]}` : void 0,
|
|
380
|
+
limit,
|
|
381
|
+
offset,
|
|
382
|
+
orderBy,
|
|
383
|
+
direction
|
|
384
|
+
}
|
|
385
|
+
),
|
|
386
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
387
|
+
TablePageButtons,
|
|
388
|
+
{
|
|
389
|
+
total,
|
|
390
|
+
limit,
|
|
391
|
+
offset,
|
|
392
|
+
MAX_PAGES_TO_SHOW: 10
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
] })
|
|
396
|
+
] });
|
|
550
397
|
};
|
|
551
398
|
}
|
|
552
399
|
// Annotate the CommonJS export names for ESM import in node:
|