dn-react-router-toolkit 0.7.7 → 0.7.9
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/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 +83 -72
- package/dist/crud/crud_form.mjs +88 -62
- package/dist/crud/crud_form_provider.d.mts +10 -8
- package/dist/crud/crud_form_provider.d.ts +10 -8
- package/dist/crud/crud_form_provider.js +2 -12
- package/dist/crud/crud_form_provider.mjs +6 -3
- package/dist/crud/crud_loader.d.mts +1 -1
- package/dist/crud/crud_loader.d.ts +1 -1
- package/dist/crud/crud_page.d.mts +10 -6
- package/dist/crud/crud_page.d.ts +10 -6
- package/dist/crud/crud_page.js +281 -409
- package/dist/crud/crud_page.mjs +286 -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 +299 -404
- package/dist/crud/index.mjs +304 -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/crud/crud_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/crud/crud_page.tsx
|
|
@@ -39,7 +29,6 @@ var import_react_router7 = require("react-router");
|
|
|
39
29
|
var import_react_router = require("react-router");
|
|
40
30
|
var import_react_store_input = require("react-store-input");
|
|
41
31
|
var import_react = require("react");
|
|
42
|
-
var import_react2 = __toESM(require("react"));
|
|
43
32
|
|
|
44
33
|
// src/crud/serialize.ts
|
|
45
34
|
function serialize(value) {
|
|
@@ -100,6 +89,7 @@ function serialize(value) {
|
|
|
100
89
|
}
|
|
101
90
|
|
|
102
91
|
// src/crud/crud_form_provider.tsx
|
|
92
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
103
93
|
var FormContext = (0, import_react.createContext)({});
|
|
104
94
|
function useFormContext() {
|
|
105
95
|
return (0, import_react.useContext)(FormContext);
|
|
@@ -180,165 +170,17 @@ function CrudFormProvider({
|
|
|
180
170
|
delete: deleteItem,
|
|
181
171
|
columns
|
|
182
172
|
};
|
|
183
|
-
return /* @__PURE__ */
|
|
173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormContext.Provider, { value, children });
|
|
184
174
|
}
|
|
185
175
|
|
|
186
176
|
// src/table/page.tsx
|
|
187
177
|
var import_react_router4 = require("react-router");
|
|
188
|
-
|
|
189
|
-
// node_modules/react-icons/lib/iconBase.mjs
|
|
190
|
-
var import_react4 = __toESM(require("react"), 1);
|
|
191
|
-
|
|
192
|
-
// node_modules/react-icons/lib/iconContext.mjs
|
|
193
|
-
var import_react3 = __toESM(require("react"), 1);
|
|
194
|
-
var DefaultContext = {
|
|
195
|
-
color: void 0,
|
|
196
|
-
size: void 0,
|
|
197
|
-
className: void 0,
|
|
198
|
-
style: void 0,
|
|
199
|
-
attr: void 0
|
|
200
|
-
};
|
|
201
|
-
var IconContext = import_react3.default.createContext && /* @__PURE__ */ import_react3.default.createContext(DefaultContext);
|
|
202
|
-
|
|
203
|
-
// node_modules/react-icons/lib/iconBase.mjs
|
|
204
|
-
var _excluded = ["attr", "size", "title"];
|
|
205
|
-
function _objectWithoutProperties(source, excluded) {
|
|
206
|
-
if (source == null) return {};
|
|
207
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
208
|
-
var key, i;
|
|
209
|
-
if (Object.getOwnPropertySymbols) {
|
|
210
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
211
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
212
|
-
key = sourceSymbolKeys[i];
|
|
213
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
214
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
215
|
-
target[key] = source[key];
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return target;
|
|
219
|
-
}
|
|
220
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
221
|
-
if (source == null) return {};
|
|
222
|
-
var target = {};
|
|
223
|
-
for (var key in source) {
|
|
224
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
225
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
226
|
-
target[key] = source[key];
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return target;
|
|
230
|
-
}
|
|
231
|
-
function _extends() {
|
|
232
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
233
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
234
|
-
var source = arguments[i];
|
|
235
|
-
for (var key in source) {
|
|
236
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
237
|
-
target[key] = source[key];
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return target;
|
|
242
|
-
};
|
|
243
|
-
return _extends.apply(this, arguments);
|
|
244
|
-
}
|
|
245
|
-
function ownKeys(e, r) {
|
|
246
|
-
var t = Object.keys(e);
|
|
247
|
-
if (Object.getOwnPropertySymbols) {
|
|
248
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
249
|
-
r && (o = o.filter(function(r2) {
|
|
250
|
-
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
251
|
-
})), t.push.apply(t, o);
|
|
252
|
-
}
|
|
253
|
-
return t;
|
|
254
|
-
}
|
|
255
|
-
function _objectSpread(e) {
|
|
256
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
257
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
258
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
|
|
259
|
-
_defineProperty(e, r2, t[r2]);
|
|
260
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
261
|
-
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
return e;
|
|
265
|
-
}
|
|
266
|
-
function _defineProperty(obj, key, value) {
|
|
267
|
-
key = _toPropertyKey(key);
|
|
268
|
-
if (key in obj) {
|
|
269
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
270
|
-
} else {
|
|
271
|
-
obj[key] = value;
|
|
272
|
-
}
|
|
273
|
-
return obj;
|
|
274
|
-
}
|
|
275
|
-
function _toPropertyKey(t) {
|
|
276
|
-
var i = _toPrimitive(t, "string");
|
|
277
|
-
return "symbol" == typeof i ? i : i + "";
|
|
278
|
-
}
|
|
279
|
-
function _toPrimitive(t, r) {
|
|
280
|
-
if ("object" != typeof t || !t) return t;
|
|
281
|
-
var e = t[Symbol.toPrimitive];
|
|
282
|
-
if (void 0 !== e) {
|
|
283
|
-
var i = e.call(t, r || "default");
|
|
284
|
-
if ("object" != typeof i) return i;
|
|
285
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
286
|
-
}
|
|
287
|
-
return ("string" === r ? String : Number)(t);
|
|
288
|
-
}
|
|
289
|
-
function Tree2Element(tree) {
|
|
290
|
-
return tree && tree.map((node, i) => /* @__PURE__ */ import_react4.default.createElement(node.tag, _objectSpread({
|
|
291
|
-
key: i
|
|
292
|
-
}, node.attr), Tree2Element(node.child)));
|
|
293
|
-
}
|
|
294
|
-
function GenIcon(data) {
|
|
295
|
-
return (props) => /* @__PURE__ */ import_react4.default.createElement(IconBase, _extends({
|
|
296
|
-
attr: _objectSpread({}, data.attr)
|
|
297
|
-
}, props), Tree2Element(data.child));
|
|
298
|
-
}
|
|
299
|
-
function IconBase(props) {
|
|
300
|
-
var elem = (conf) => {
|
|
301
|
-
var {
|
|
302
|
-
attr,
|
|
303
|
-
size,
|
|
304
|
-
title
|
|
305
|
-
} = props, svgProps = _objectWithoutProperties(props, _excluded);
|
|
306
|
-
var computedSize = size || conf.size || "1em";
|
|
307
|
-
var className;
|
|
308
|
-
if (conf.className) className = conf.className;
|
|
309
|
-
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
310
|
-
return /* @__PURE__ */ import_react4.default.createElement("svg", _extends({
|
|
311
|
-
stroke: "currentColor",
|
|
312
|
-
fill: "currentColor",
|
|
313
|
-
strokeWidth: "0"
|
|
314
|
-
}, conf.attr, attr, svgProps, {
|
|
315
|
-
className,
|
|
316
|
-
style: _objectSpread(_objectSpread({
|
|
317
|
-
color: props.color || conf.color
|
|
318
|
-
}, conf.style), props.style),
|
|
319
|
-
height: computedSize,
|
|
320
|
-
width: computedSize,
|
|
321
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
322
|
-
}), title && /* @__PURE__ */ import_react4.default.createElement("title", null, title), props.children);
|
|
323
|
-
};
|
|
324
|
-
return IconContext !== void 0 ? /* @__PURE__ */ import_react4.default.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
// node_modules/react-icons/go/index.mjs
|
|
328
|
-
function GoArrowDown(props) {
|
|
329
|
-
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);
|
|
330
|
-
}
|
|
331
|
-
function GoArrowUp(props) {
|
|
332
|
-
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);
|
|
333
|
-
}
|
|
334
|
-
function GoSearch(props) {
|
|
335
|
-
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);
|
|
336
|
-
}
|
|
178
|
+
var import_go2 = require("react-icons/go");
|
|
337
179
|
|
|
338
180
|
// src/table/buttons.tsx
|
|
339
181
|
var import_utils = require("dn-react-toolkit/utils");
|
|
340
182
|
var import_react_router2 = require("react-router");
|
|
341
|
-
var
|
|
183
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
342
184
|
function TablePageButtons({
|
|
343
185
|
MAX_PAGES_TO_SHOW,
|
|
344
186
|
total,
|
|
@@ -351,63 +193,59 @@ function TablePageButtons({
|
|
|
351
193
|
const currentPage = Math.floor(offset / limit) + 1;
|
|
352
194
|
const startButton = (Math.ceil(currentPage / MAX_PAGES_TO_SHOW) - 1) * MAX_PAGES_TO_SHOW;
|
|
353
195
|
const endButton = Math.min(startButton + MAX_PAGES_TO_SHOW - 1, pages);
|
|
354
|
-
return /* @__PURE__ */
|
|
355
|
-
|
|
356
|
-
{
|
|
357
|
-
to: (() => {
|
|
358
|
-
searchParams.set(
|
|
359
|
-
"offset",
|
|
360
|
-
String((startButton - 1) * limit)
|
|
361
|
-
);
|
|
362
|
-
return `${pathname}?${searchParams.toString()}`;
|
|
363
|
-
})(),
|
|
364
|
-
className: "w-10 block text-center transition-colors hover:text-primary"
|
|
365
|
-
},
|
|
366
|
-
"\uC774\uC804"
|
|
367
|
-
), Array.from({
|
|
368
|
-
length: Math.min(
|
|
369
|
-
MAX_PAGES_TO_SHOW,
|
|
370
|
-
pages - startButton
|
|
371
|
-
)
|
|
372
|
-
}).map((_, index) => {
|
|
373
|
-
return /* @__PURE__ */ import_react5.default.createElement(
|
|
196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: pages > 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "flex justify-center items-center my-8 gap-4 text-neutral-400", children: [
|
|
197
|
+
startButton > 1 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
374
198
|
import_react_router2.Link,
|
|
375
199
|
{
|
|
376
|
-
key: index,
|
|
377
200
|
to: (() => {
|
|
378
|
-
searchParams.set(
|
|
379
|
-
"offset",
|
|
380
|
-
String((startButton + index) * limit)
|
|
381
|
-
);
|
|
201
|
+
searchParams.set("offset", String((startButton - 1) * limit));
|
|
382
202
|
return `${pathname}?${searchParams.toString()}`;
|
|
383
203
|
})(),
|
|
384
|
-
className:
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
)
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
204
|
+
className: "w-10 block text-center transition-colors hover:text-primary",
|
|
205
|
+
children: "\uC774\uC804"
|
|
206
|
+
}
|
|
207
|
+
),
|
|
208
|
+
Array.from({
|
|
209
|
+
length: Math.min(MAX_PAGES_TO_SHOW, pages - startButton)
|
|
210
|
+
}).map((_, index) => {
|
|
211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
212
|
+
import_react_router2.Link,
|
|
213
|
+
{
|
|
214
|
+
to: (() => {
|
|
215
|
+
searchParams.set(
|
|
216
|
+
"offset",
|
|
217
|
+
String((startButton + index) * limit)
|
|
218
|
+
);
|
|
219
|
+
return `${pathname}?${searchParams.toString()}`;
|
|
220
|
+
})(),
|
|
221
|
+
className: (0, import_utils.cn)(
|
|
222
|
+
"w-6 block text-center transition-colors",
|
|
223
|
+
currentPage === startButton + index + 1 ? "font-bold text-primary" : "hover:text-primary"
|
|
224
|
+
),
|
|
225
|
+
children: startButton + index + 1
|
|
226
|
+
},
|
|
227
|
+
index
|
|
228
|
+
);
|
|
229
|
+
}),
|
|
230
|
+
endButton < pages && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
231
|
+
import_react_router2.Link,
|
|
232
|
+
{
|
|
233
|
+
to: (() => {
|
|
234
|
+
searchParams.set("offset", String((endButton + 1) * limit));
|
|
235
|
+
return `${pathname}?${searchParams.toString()}`;
|
|
236
|
+
})(),
|
|
237
|
+
className: "w-10 block text-center transition-colors hover:text-primary",
|
|
238
|
+
children: "\uB2E4\uC74C"
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
] }) });
|
|
405
242
|
}
|
|
406
243
|
|
|
407
244
|
// src/table/table.tsx
|
|
408
245
|
var import_utils2 = require("dn-react-toolkit/utils");
|
|
246
|
+
var import_go = require("react-icons/go");
|
|
409
247
|
var import_react_router3 = require("react-router");
|
|
410
|
-
var
|
|
248
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
411
249
|
function Table({
|
|
412
250
|
className = "min-w-full whitespace-nowrap",
|
|
413
251
|
data,
|
|
@@ -422,95 +260,92 @@ function Table({
|
|
|
422
260
|
const keys = Object.entries(columns).filter((entry) => entry[1]).map(([key]) => key);
|
|
423
261
|
const sortedArray = [...data];
|
|
424
262
|
const [_, setSearchParams] = (0, import_react_router3.useSearchParams)();
|
|
425
|
-
return /* @__PURE__ */
|
|
263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
426
264
|
"table",
|
|
427
265
|
{
|
|
428
|
-
className: (0, import_utils2.cn)(
|
|
429
|
-
|
|
430
|
-
"
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
266
|
+
className: (0, import_utils2.cn)(className, "text-[15px] border-separate border-spacing-0"),
|
|
267
|
+
children: [
|
|
268
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tr", { children: keys.map((key) => {
|
|
269
|
+
const value = columns[key];
|
|
270
|
+
function getReactNode() {
|
|
271
|
+
if (value && typeof value === "object" && "label" in value) {
|
|
272
|
+
return value.label;
|
|
273
|
+
}
|
|
274
|
+
return value;
|
|
275
|
+
}
|
|
276
|
+
function Head() {
|
|
277
|
+
const reactNode = getReactNode();
|
|
278
|
+
if (typeof reactNode === "string") {
|
|
279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
280
|
+
"button",
|
|
281
|
+
{
|
|
282
|
+
className: (0, import_utils2.cn)(
|
|
283
|
+
orderBy === key ? "text-neutral-900 font-medium" : "text-neutral-500",
|
|
284
|
+
"px-4 h-14 flex items-center w-full"
|
|
285
|
+
),
|
|
286
|
+
onClick: () => {
|
|
287
|
+
let newDirection = "asc";
|
|
288
|
+
if (orderBy === key) {
|
|
289
|
+
newDirection = direction === "asc" ? "desc" : "asc";
|
|
290
|
+
}
|
|
291
|
+
setSearchParams({
|
|
292
|
+
orderBy: key,
|
|
293
|
+
direction: newDirection
|
|
294
|
+
});
|
|
295
|
+
},
|
|
296
|
+
children: [
|
|
297
|
+
reactNode,
|
|
298
|
+
orderBy === key && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "ml-0.5", children: direction === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_go.GoArrowUp, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_go.GoArrowDown, {}) })
|
|
299
|
+
]
|
|
300
|
+
}
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: reactNode });
|
|
304
|
+
}
|
|
305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { className: (0, import_utils2.cn)("border-y font-normal"), children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Head, {}) }, key);
|
|
306
|
+
}) }) }),
|
|
307
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tbody", { children: [
|
|
308
|
+
sortedArray.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
309
|
+
"td",
|
|
446
310
|
{
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
311
|
+
colSpan: keys.length,
|
|
312
|
+
className: "px-4 h-14 text-neutral-400 text-center",
|
|
313
|
+
children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
314
|
+
}
|
|
315
|
+
) }),
|
|
316
|
+
sortedArray.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tr", { className: "hover:bg-gray-50 transition-colors", children: keys.map((key, i2) => {
|
|
317
|
+
const value = item[key];
|
|
318
|
+
function Content() {
|
|
319
|
+
if (key in columns) {
|
|
320
|
+
const column = columns[key];
|
|
321
|
+
if (column && typeof column === "object" && "mapper" in column) {
|
|
322
|
+
const mapper = column.mapper;
|
|
323
|
+
if (mapper) {
|
|
324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: mapper(item) });
|
|
325
|
+
}
|
|
455
326
|
}
|
|
456
|
-
setSearchParams({
|
|
457
|
-
orderBy: key,
|
|
458
|
-
direction: newDirection
|
|
459
|
-
});
|
|
460
327
|
}
|
|
461
|
-
|
|
462
|
-
reactNode,
|
|
463
|
-
orderBy === key && /* @__PURE__ */ import_react6.default.createElement("div", { className: "ml-0.5" }, direction === "asc" ? /* @__PURE__ */ import_react6.default.createElement(GoArrowUp, null) : /* @__PURE__ */ import_react6.default.createElement(GoArrowDown, null))
|
|
464
|
-
);
|
|
465
|
-
}
|
|
466
|
-
return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, reactNode);
|
|
467
|
-
}
|
|
468
|
-
return /* @__PURE__ */ import_react6.default.createElement(
|
|
469
|
-
"th",
|
|
470
|
-
{
|
|
471
|
-
key,
|
|
472
|
-
className: (0, import_utils2.cn)("border-y font-normal")
|
|
473
|
-
},
|
|
474
|
-
/* @__PURE__ */ import_react6.default.createElement(Head, null)
|
|
475
|
-
);
|
|
476
|
-
}))),
|
|
477
|
-
/* @__PURE__ */ import_react6.default.createElement("tbody", null, sortedArray.length === 0 && /* @__PURE__ */ import_react6.default.createElement("tr", null, /* @__PURE__ */ import_react6.default.createElement(
|
|
478
|
-
"td",
|
|
479
|
-
{
|
|
480
|
-
colSpan: keys.length,
|
|
481
|
-
className: "px-4 h-14 text-neutral-400 text-center"
|
|
482
|
-
},
|
|
483
|
-
"\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
|
|
484
|
-
)), sortedArray.map((item, i) => /* @__PURE__ */ import_react6.default.createElement("tr", { key: i, className: "hover:bg-gray-50 transition-colors" }, keys.map((key, i2) => {
|
|
485
|
-
const value = item[key];
|
|
486
|
-
function Content() {
|
|
487
|
-
if (key in columns) {
|
|
488
|
-
const column = columns[key];
|
|
489
|
-
if (column && typeof column === "object" && "mapper" in column) {
|
|
490
|
-
const mapper = column.mapper;
|
|
491
|
-
if (mapper) {
|
|
492
|
-
return /* @__PURE__ */ import_react6.default.createElement(import_react6.default.Fragment, null, mapper(item));
|
|
328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: String(value) });
|
|
493
329
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
}))))
|
|
330
|
+
const linkedContent = getLink ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
331
|
+
import_react_router3.Link,
|
|
332
|
+
{
|
|
333
|
+
to: getLink(item),
|
|
334
|
+
className: "block content-center px-4 w-full h-full",
|
|
335
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Content, {})
|
|
336
|
+
}
|
|
337
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Content, {});
|
|
338
|
+
const cell = Mapper ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
|
|
339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("td", { className: "px-0 h-14 border-b", children: cell }, key);
|
|
340
|
+
}) }, i))
|
|
341
|
+
] })
|
|
342
|
+
]
|
|
343
|
+
}
|
|
509
344
|
);
|
|
510
345
|
}
|
|
511
346
|
|
|
512
347
|
// src/table/page.tsx
|
|
513
|
-
var
|
|
348
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
514
349
|
function createTablePage({
|
|
515
350
|
name,
|
|
516
351
|
columns,
|
|
@@ -530,73 +365,83 @@ function createTablePage({
|
|
|
530
365
|
navigate(`${pathname}?${searchParams2.toString()}`);
|
|
531
366
|
};
|
|
532
367
|
const [searchParams] = (0, import_react_router4.useSearchParams)();
|
|
533
|
-
return /* @__PURE__ */
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
title: name,
|
|
537
|
-
actions: /* @__PURE__ */ import_react7.default.createElement(import_react_router4.Link, { to: `${pathname}/new`, className: "button-primary" }, name, " \uCD94\uAC00")
|
|
538
|
-
}
|
|
539
|
-
), /* @__PURE__ */ import_react7.default.createElement("div", { className: "max-w-7xl mx-auto w-full overflow-auto" }, searchKey && /* @__PURE__ */ import_react7.default.createElement(
|
|
540
|
-
"form",
|
|
541
|
-
{
|
|
542
|
-
className: "h-18 px-4 flex items-center border-t",
|
|
543
|
-
onSubmit: (e) => {
|
|
544
|
-
e.preventDefault();
|
|
545
|
-
const formData = new FormData(e.currentTarget);
|
|
546
|
-
const query = formData.get("query");
|
|
547
|
-
search(query);
|
|
548
|
-
}
|
|
549
|
-
},
|
|
550
|
-
/* @__PURE__ */ import_react7.default.createElement(
|
|
551
|
-
"button",
|
|
368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
369
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
370
|
+
Header,
|
|
552
371
|
{
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
/* @__PURE__ */ import_react7.default.createElement(
|
|
559
|
-
"input",
|
|
560
|
-
{
|
|
561
|
-
className: "outline-none h-full flex-1",
|
|
562
|
-
placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
|
|
563
|
-
name: "query",
|
|
564
|
-
defaultValue: searchParams.get("query") ?? ""
|
|
372
|
+
title: name,
|
|
373
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_router4.Link, { to: `${pathname}/new`, className: "button-primary", children: [
|
|
374
|
+
name,
|
|
375
|
+
" \uCD94\uAC00"
|
|
376
|
+
] })
|
|
565
377
|
}
|
|
566
|
-
)
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
378
|
+
),
|
|
379
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "max-w-7xl mx-auto w-full overflow-auto", children: [
|
|
380
|
+
searchKey && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
381
|
+
"form",
|
|
382
|
+
{
|
|
383
|
+
className: "h-18 px-4 flex items-center border-t",
|
|
384
|
+
onSubmit: (e) => {
|
|
385
|
+
e.preventDefault();
|
|
386
|
+
const formData = new FormData(e.currentTarget);
|
|
387
|
+
const query = formData.get("query");
|
|
388
|
+
search(query);
|
|
389
|
+
},
|
|
390
|
+
children: [
|
|
391
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
392
|
+
"button",
|
|
393
|
+
{
|
|
394
|
+
type: "submit",
|
|
395
|
+
className: "w-10 h-10 flex justify-center items-center",
|
|
396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_go2.GoSearch, { className: "text-xl mr-4" })
|
|
397
|
+
}
|
|
398
|
+
),
|
|
399
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
400
|
+
"input",
|
|
401
|
+
{
|
|
402
|
+
className: "outline-none h-full flex-1",
|
|
403
|
+
placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
|
|
404
|
+
name: "query",
|
|
405
|
+
defaultValue: searchParams.get("query") ?? ""
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
]
|
|
409
|
+
}
|
|
410
|
+
),
|
|
411
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
412
|
+
Table,
|
|
413
|
+
{
|
|
414
|
+
data: items,
|
|
415
|
+
columns,
|
|
416
|
+
getLink: primaryKey ? (item) => `${pathname}/${item[primaryKey]}` : void 0,
|
|
417
|
+
limit,
|
|
418
|
+
offset,
|
|
419
|
+
orderBy,
|
|
420
|
+
direction
|
|
421
|
+
}
|
|
422
|
+
),
|
|
423
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
424
|
+
TablePageButtons,
|
|
425
|
+
{
|
|
426
|
+
total,
|
|
427
|
+
limit,
|
|
428
|
+
offset,
|
|
429
|
+
MAX_PAGES_TO_SHOW: 10
|
|
430
|
+
}
|
|
431
|
+
)
|
|
432
|
+
] })
|
|
433
|
+
] });
|
|
587
434
|
};
|
|
588
435
|
}
|
|
589
436
|
|
|
590
|
-
// src/crud/crud_form.tsx
|
|
591
|
-
var import_react13 = __toESM(require("react"));
|
|
592
|
-
|
|
593
437
|
// src/form/create_form_component.tsx
|
|
594
438
|
var import_utils3 = require("dn-react-toolkit/utils");
|
|
595
|
-
var
|
|
439
|
+
var import_react2 = require("react");
|
|
440
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
596
441
|
function createComponent(tag, options) {
|
|
597
442
|
return function FormComponent({ className, ...props }) {
|
|
598
443
|
const Tag = tag;
|
|
599
|
-
return /* @__PURE__ */
|
|
444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Tag, { ...props, className: (0, import_utils3.cn)(options.className, className) });
|
|
600
445
|
};
|
|
601
446
|
}
|
|
602
447
|
|
|
@@ -615,12 +460,12 @@ var FormLabel = createComponent("label", {
|
|
|
615
460
|
var import_react_store_input3 = require("react-store-input");
|
|
616
461
|
|
|
617
462
|
// src/client/env_loader.tsx
|
|
618
|
-
var import_react9 = __toESM(require("react"));
|
|
619
463
|
var import_react_router5 = require("react-router");
|
|
464
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
620
465
|
|
|
621
466
|
// src/client/file_input.tsx
|
|
622
|
-
var
|
|
623
|
-
var
|
|
467
|
+
var import_react3 = require("react");
|
|
468
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
624
469
|
|
|
625
470
|
// src/client/use_user_agent.tsx
|
|
626
471
|
var import_react_router6 = require("react-router");
|
|
@@ -628,7 +473,8 @@ var import_react_router6 = require("react-router");
|
|
|
628
473
|
// src/client/store_text_editor.tsx
|
|
629
474
|
var import_dn_react_text_editor = require("dn-react-text-editor");
|
|
630
475
|
var import_react_store_input2 = require("react-store-input");
|
|
631
|
-
var
|
|
476
|
+
var import_react4 = require("react");
|
|
477
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
632
478
|
function StoreTextEditor({
|
|
633
479
|
store,
|
|
634
480
|
name,
|
|
@@ -638,8 +484,8 @@ function StoreTextEditor({
|
|
|
638
484
|
ref,
|
|
639
485
|
...props
|
|
640
486
|
}) {
|
|
641
|
-
const controllerRef = (0,
|
|
642
|
-
(0,
|
|
487
|
+
const controllerRef = (0, import_react4.useRef)(null);
|
|
488
|
+
(0, import_react4.useImperativeHandle)(
|
|
643
489
|
ref,
|
|
644
490
|
() => controllerRef.current,
|
|
645
491
|
[]
|
|
@@ -687,7 +533,7 @@ function StoreTextEditor({
|
|
|
687
533
|
}
|
|
688
534
|
return void 0;
|
|
689
535
|
};
|
|
690
|
-
return /* @__PURE__ */
|
|
536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
691
537
|
import_dn_react_text_editor.TextEditor,
|
|
692
538
|
{
|
|
693
539
|
...props,
|
|
@@ -705,71 +551,93 @@ function StoreTextEditor({
|
|
|
705
551
|
var import_client = require("dn-react-toolkit/file/client");
|
|
706
552
|
|
|
707
553
|
// src/crud/crud_form.tsx
|
|
554
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
708
555
|
function CrudForm({
|
|
709
556
|
AdminHeader
|
|
710
557
|
}) {
|
|
711
558
|
const form = useFormContext();
|
|
712
559
|
const component = (0, import_react_store_input3.useStoreComponent)(form.store);
|
|
713
|
-
return /* @__PURE__ */
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
560
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
561
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
562
|
+
AdminHeader,
|
|
563
|
+
{
|
|
564
|
+
title: `${form.name} ${form.item ? "\uC218\uC815" : "\uCD94\uAC00"}`,
|
|
565
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
566
|
+
form.item && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
567
|
+
"button",
|
|
568
|
+
{
|
|
569
|
+
type: "button",
|
|
570
|
+
className: "button-outline",
|
|
571
|
+
onClick: () => {
|
|
572
|
+
form.delete();
|
|
573
|
+
},
|
|
574
|
+
children: "\uC0AD\uC81C\uD558\uAE30"
|
|
575
|
+
}
|
|
576
|
+
),
|
|
577
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
578
|
+
"button",
|
|
579
|
+
{
|
|
580
|
+
type: "button",
|
|
581
|
+
className: "button-primary",
|
|
582
|
+
onClick: form.submit,
|
|
583
|
+
children: "\uC800\uC7A5\uD558\uAE30"
|
|
584
|
+
}
|
|
585
|
+
)
|
|
586
|
+
] })
|
|
587
|
+
}
|
|
588
|
+
),
|
|
589
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "max-w-2xl mx-auto", children: Object.keys(form.columns).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_jsx_runtime9.Fragment, { children: Object.entries(form.columns).map(
|
|
590
|
+
([name, value]) => {
|
|
591
|
+
function InputComponent() {
|
|
592
|
+
if (value.component) {
|
|
593
|
+
const Component = value.component;
|
|
594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Component, { store: form.store, name });
|
|
724
595
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
596
|
+
if (value.type === "textarea") {
|
|
597
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
598
|
+
StoreTextEditor,
|
|
599
|
+
{
|
|
600
|
+
store: form.store,
|
|
601
|
+
name,
|
|
602
|
+
editor: {
|
|
603
|
+
attributes: {
|
|
604
|
+
class: "text-editor-form"
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
if (value.options) {
|
|
611
|
+
const Component = value.options;
|
|
612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(component.select, { name, className: "select-form", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Component, {}) });
|
|
613
|
+
}
|
|
614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
615
|
+
component.input,
|
|
743
616
|
{
|
|
744
|
-
|
|
745
|
-
|
|
617
|
+
name,
|
|
618
|
+
type: value.type,
|
|
619
|
+
className: "input-form"
|
|
746
620
|
}
|
|
747
621
|
);
|
|
748
622
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
return /* @__PURE__ */
|
|
623
|
+
const v = form.store.state[name];
|
|
624
|
+
if (typeof v === "boolean") {
|
|
625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "flex", children: [
|
|
626
|
+
value.label,
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "ml-auto", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InputComponent, {}) })
|
|
628
|
+
] });
|
|
752
629
|
}
|
|
753
|
-
return /* @__PURE__ */
|
|
754
|
-
|
|
755
|
-
{
|
|
756
|
-
|
|
757
|
-
type: value.type,
|
|
758
|
-
className: "input-form"
|
|
759
|
-
}
|
|
760
|
-
);
|
|
761
|
-
}
|
|
762
|
-
const v = form.store.state[name];
|
|
763
|
-
if (typeof v === "boolean") {
|
|
764
|
-
return /* @__PURE__ */ import_react13.default.createElement("div", { className: "flex" }, value.label, /* @__PURE__ */ import_react13.default.createElement("div", { className: "ml-auto" }, /* @__PURE__ */ import_react13.default.createElement(InputComponent, null)));
|
|
630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FormRow, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(FormEntry, { children: [
|
|
631
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FormLabel, { children: value.label }, name),
|
|
632
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(InputComponent, {})
|
|
633
|
+
] }) });
|
|
765
634
|
}
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
))));
|
|
635
|
+
) }) })
|
|
636
|
+
] });
|
|
769
637
|
}
|
|
770
638
|
|
|
771
639
|
// src/crud/crud_page.tsx
|
|
772
|
-
var
|
|
640
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
773
641
|
function crudPage({
|
|
774
642
|
name,
|
|
775
643
|
primaryKey,
|
|
@@ -777,7 +645,7 @@ function crudPage({
|
|
|
777
645
|
formOptions,
|
|
778
646
|
header
|
|
779
647
|
}) {
|
|
780
|
-
|
|
648
|
+
const create = (prefix) => {
|
|
781
649
|
return function Page() {
|
|
782
650
|
const data = (0, import_react_router7.useLoaderData)();
|
|
783
651
|
const { pathname } = (0, import_react_router7.useLocation)();
|
|
@@ -786,29 +654,33 @@ function crudPage({
|
|
|
786
654
|
...tablePageOptions,
|
|
787
655
|
name
|
|
788
656
|
});
|
|
789
|
-
return /* @__PURE__ */
|
|
657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Component, { header });
|
|
790
658
|
}
|
|
791
659
|
if (pathname.startsWith(prefix)) {
|
|
792
|
-
return /* @__PURE__ */
|
|
660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
793
661
|
CrudFormProvider,
|
|
794
662
|
{
|
|
795
663
|
item: data?.item,
|
|
796
664
|
prefix,
|
|
797
665
|
name,
|
|
798
666
|
columns: formOptions.columns,
|
|
799
|
-
primaryKey
|
|
800
|
-
|
|
801
|
-
|
|
667
|
+
primaryKey,
|
|
668
|
+
children: formOptions.form ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FormDelegate, { component: formOptions.form }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CrudForm, { AdminHeader: header })
|
|
669
|
+
}
|
|
802
670
|
);
|
|
803
671
|
}
|
|
804
672
|
};
|
|
805
673
|
};
|
|
674
|
+
return {
|
|
675
|
+
name,
|
|
676
|
+
create
|
|
677
|
+
};
|
|
806
678
|
}
|
|
807
679
|
function FormDelegate({
|
|
808
680
|
component: Component
|
|
809
681
|
}) {
|
|
810
682
|
const form = useFormContext();
|
|
811
|
-
return /* @__PURE__ */
|
|
683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Component, { form });
|
|
812
684
|
}
|
|
813
685
|
// Annotate the CommonJS export names for ESM import in node:
|
|
814
686
|
0 && (module.exports = {
|