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.
Files changed (93) hide show
  1. package/dist/api/create_api_handler.d.mts +5 -5
  2. package/dist/api/create_api_handler.d.ts +5 -5
  3. package/dist/client/env_loader.d.mts +2 -2
  4. package/dist/client/env_loader.d.ts +2 -2
  5. package/dist/client/env_loader.js +2 -12
  6. package/dist/client/env_loader.mjs +2 -2
  7. package/dist/client/file_input.d.mts +3 -2
  8. package/dist/client/file_input.d.ts +3 -2
  9. package/dist/client/file_input.js +30 -37
  10. package/dist/client/file_input.mjs +33 -28
  11. package/dist/client/index.d.mts +1 -0
  12. package/dist/client/index.d.ts +1 -0
  13. package/dist/client/index.js +38 -44
  14. package/dist/client/index.mjs +39 -33
  15. package/dist/client/store_text_editor.d.mts +2 -2
  16. package/dist/client/store_text_editor.d.ts +2 -2
  17. package/dist/client/store_text_editor.js +3 -12
  18. package/dist/client/store_text_editor.mjs +3 -2
  19. package/dist/crud/crud_form.d.mts +5 -4
  20. package/dist/crud/crud_form.d.ts +5 -4
  21. package/dist/crud/crud_form.js +83 -72
  22. package/dist/crud/crud_form.mjs +88 -62
  23. package/dist/crud/crud_form_provider.d.mts +10 -8
  24. package/dist/crud/crud_form_provider.d.ts +10 -8
  25. package/dist/crud/crud_form_provider.js +2 -12
  26. package/dist/crud/crud_form_provider.mjs +6 -3
  27. package/dist/crud/crud_loader.d.mts +1 -1
  28. package/dist/crud/crud_loader.d.ts +1 -1
  29. package/dist/crud/crud_page.d.mts +10 -6
  30. package/dist/crud/crud_page.d.ts +10 -6
  31. package/dist/crud/crud_page.js +281 -409
  32. package/dist/crud/crud_page.mjs +286 -399
  33. package/dist/crud/generate_pages.d.mts +10 -2
  34. package/dist/crud/generate_pages.d.ts +10 -2
  35. package/dist/crud/generate_pages.js +17 -14
  36. package/dist/crud/generate_pages.mjs +17 -4
  37. package/dist/crud/index.d.mts +2 -1
  38. package/dist/crud/index.d.ts +2 -1
  39. package/dist/crud/index.js +299 -404
  40. package/dist/crud/index.mjs +304 -404
  41. package/dist/form/create_form_component.d.mts +3 -2
  42. package/dist/form/create_form_component.d.ts +3 -2
  43. package/dist/form/create_form_component.js +3 -12
  44. package/dist/form/create_form_component.mjs +3 -2
  45. package/dist/form/form_components.d.mts +5 -4
  46. package/dist/form/form_components.d.ts +5 -4
  47. package/dist/form/form_components.js +3 -12
  48. package/dist/form/form_components.mjs +3 -2
  49. package/dist/form/index.d.mts +1 -0
  50. package/dist/form/index.d.ts +1 -0
  51. package/dist/form/index.js +3 -12
  52. package/dist/form/index.mjs +3 -2
  53. package/dist/post/editor_toolbar.d.mts +4 -3
  54. package/dist/post/editor_toolbar.d.ts +4 -3
  55. package/dist/post/editor_toolbar.js +116 -273
  56. package/dist/post/editor_toolbar.mjs +123 -263
  57. package/dist/post/index.d.mts +1 -0
  58. package/dist/post/index.d.ts +1 -0
  59. package/dist/post/index.js +329 -411
  60. package/dist/post/index.mjs +337 -409
  61. package/dist/post/post_form_page.d.mts +5 -4
  62. package/dist/post/post_form_page.d.ts +5 -4
  63. package/dist/post/post_form_page.js +331 -413
  64. package/dist/post/post_form_page.mjs +337 -409
  65. package/dist/post/thumbnail_picker.d.mts +3 -2
  66. package/dist/post/thumbnail_picker.d.ts +3 -2
  67. package/dist/post/thumbnail_picker.js +14 -23
  68. package/dist/post/thumbnail_picker.mjs +14 -13
  69. package/dist/seo/index.d.mts +1 -1
  70. package/dist/seo/index.d.ts +1 -1
  71. package/dist/seo/index.js +2 -2
  72. package/dist/seo/index.mjs +2 -2
  73. package/dist/seo/seo.d.mts +2 -2
  74. package/dist/seo/seo.d.ts +2 -2
  75. package/dist/seo/seo.js +2 -2
  76. package/dist/seo/seo.mjs +2 -2
  77. package/dist/table/buttons.d.mts +2 -2
  78. package/dist/table/buttons.d.ts +2 -2
  79. package/dist/table/buttons.js +42 -57
  80. package/dist/table/buttons.mjs +42 -47
  81. package/dist/table/index.d.mts +1 -0
  82. package/dist/table/index.d.ts +1 -0
  83. package/dist/table/index.js +185 -338
  84. package/dist/table/index.mjs +185 -328
  85. package/dist/table/page.d.mts +5 -4
  86. package/dist/table/page.d.ts +5 -4
  87. package/dist/table/page.js +185 -338
  88. package/dist/table/page.mjs +185 -328
  89. package/dist/table/table.d.mts +5 -4
  90. package/dist/table/table.d.ts +5 -4
  91. package/dist/table/table.js +77 -237
  92. package/dist/table/table.mjs +77 -227
  93. package/package.json +7 -5
@@ -7587,8 +7587,10 @@ var require_routes = __commonJS({
7587
7587
  // src/crud/crud_form_provider.tsx
7588
7588
  import { useNavigate } from "react-router";
7589
7589
  import { useStore } from "react-store-input";
7590
- import { createContext, useContext } from "react";
7591
- import React from "react";
7590
+ import {
7591
+ createContext,
7592
+ useContext
7593
+ } from "react";
7592
7594
 
7593
7595
  // src/crud/serialize.ts
7594
7596
  function serialize(value) {
@@ -7684,6 +7686,7 @@ function deserialize(data) {
7684
7686
  }
7685
7687
 
7686
7688
  // src/crud/crud_form_provider.tsx
7689
+ import { jsx } from "react/jsx-runtime";
7687
7690
  var FormContext = createContext({});
7688
7691
  function useFormContext() {
7689
7692
  return useContext(FormContext);
@@ -7764,19 +7767,17 @@ function CrudFormProvider({
7764
7767
  delete: deleteItem,
7765
7768
  columns
7766
7769
  };
7767
- return /* @__PURE__ */ React.createElement(FormContext.Provider, { value }, children);
7770
+ return /* @__PURE__ */ jsx(FormContext.Provider, { value, children });
7768
7771
  }
7769
7772
 
7770
- // src/crud/crud_form.tsx
7771
- import React6 from "react";
7772
-
7773
7773
  // src/form/create_form_component.tsx
7774
7774
  import { cn } from "dn-react-toolkit/utils";
7775
- import React2 from "react";
7775
+ import "react";
7776
+ import { jsx as jsx2 } from "react/jsx-runtime";
7776
7777
  function createComponent(tag, options) {
7777
7778
  return function FormComponent({ className, ...props }) {
7778
7779
  const Tag = tag;
7779
- return /* @__PURE__ */ React2.createElement(Tag, { ...props, className: cn(options.className, className) });
7780
+ return /* @__PURE__ */ jsx2(Tag, { ...props, className: cn(options.className, className) });
7780
7781
  };
7781
7782
  }
7782
7783
 
@@ -7795,12 +7796,14 @@ var FormLabel = createComponent("label", {
7795
7796
  import { useStoreComponent } from "react-store-input";
7796
7797
 
7797
7798
  // src/client/env_loader.tsx
7798
- import React3 from "react";
7799
7799
  import { useRouteLoaderData } from "react-router";
7800
+ import { jsx as jsx3 } from "react/jsx-runtime";
7800
7801
 
7801
7802
  // src/client/file_input.tsx
7802
- import "react";
7803
- import React4 from "react";
7803
+ import {
7804
+ useRef
7805
+ } from "react";
7806
+ import { Fragment, jsx as jsx4, jsxs } from "react/jsx-runtime";
7804
7807
 
7805
7808
  // src/client/use_user_agent.tsx
7806
7809
  import { useRouteLoaderData as useRouteLoaderData2 } from "react-router";
@@ -7810,7 +7813,8 @@ import {
7810
7813
  TextEditor
7811
7814
  } from "dn-react-text-editor";
7812
7815
  import { useStoreController } from "react-store-input";
7813
- import React5, { useImperativeHandle, useRef } from "react";
7816
+ import { useImperativeHandle, useRef as useRef2 } from "react";
7817
+ import { jsx as jsx5 } from "react/jsx-runtime";
7814
7818
  function StoreTextEditor({
7815
7819
  store,
7816
7820
  name,
@@ -7820,7 +7824,7 @@ function StoreTextEditor({
7820
7824
  ref,
7821
7825
  ...props
7822
7826
  }) {
7823
- const controllerRef = useRef(null);
7827
+ const controllerRef = useRef2(null);
7824
7828
  useImperativeHandle(
7825
7829
  ref,
7826
7830
  () => controllerRef.current,
@@ -7869,7 +7873,7 @@ function StoreTextEditor({
7869
7873
  }
7870
7874
  return void 0;
7871
7875
  };
7872
- return /* @__PURE__ */ React5.createElement(
7876
+ return /* @__PURE__ */ jsx5(
7873
7877
  TextEditor,
7874
7878
  {
7875
7879
  ...props,
@@ -7887,67 +7891,89 @@ function StoreTextEditor({
7887
7891
  import { generateMetadata } from "dn-react-toolkit/file/client";
7888
7892
 
7889
7893
  // src/crud/crud_form.tsx
7894
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
7890
7895
  function CrudForm({
7891
7896
  AdminHeader
7892
7897
  }) {
7893
7898
  const form = useFormContext();
7894
7899
  const component = useStoreComponent(form.store);
7895
- return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(
7896
- AdminHeader,
7897
- {
7898
- title: `${form.name} ${form.item ? "\uC218\uC815" : "\uCD94\uAC00"}`,
7899
- actions: /* @__PURE__ */ React6.createElement(React6.Fragment, null, form.item && /* @__PURE__ */ React6.createElement(
7900
- "button",
7901
- {
7902
- type: "button",
7903
- className: "button-outline",
7904
- onClick: () => {
7905
- form.delete();
7900
+ return /* @__PURE__ */ jsxs2(Fragment2, { children: [
7901
+ /* @__PURE__ */ jsx6(
7902
+ AdminHeader,
7903
+ {
7904
+ title: `${form.name} ${form.item ? "\uC218\uC815" : "\uCD94\uAC00"}`,
7905
+ actions: /* @__PURE__ */ jsxs2(Fragment2, { children: [
7906
+ form.item && /* @__PURE__ */ jsx6(
7907
+ "button",
7908
+ {
7909
+ type: "button",
7910
+ className: "button-outline",
7911
+ onClick: () => {
7912
+ form.delete();
7913
+ },
7914
+ children: "\uC0AD\uC81C\uD558\uAE30"
7915
+ }
7916
+ ),
7917
+ /* @__PURE__ */ jsx6(
7918
+ "button",
7919
+ {
7920
+ type: "button",
7921
+ className: "button-primary",
7922
+ onClick: form.submit,
7923
+ children: "\uC800\uC7A5\uD558\uAE30"
7924
+ }
7925
+ )
7926
+ ] })
7927
+ }
7928
+ ),
7929
+ /* @__PURE__ */ jsx6("div", { className: "max-w-2xl mx-auto", children: Object.keys(form.columns).length > 0 && /* @__PURE__ */ jsx6(Fragment2, { children: Object.entries(form.columns).map(
7930
+ ([name, value]) => {
7931
+ function InputComponent() {
7932
+ if (value.component) {
7933
+ const Component = value.component;
7934
+ return /* @__PURE__ */ jsx6(Component, { store: form.store, name });
7906
7935
  }
7907
- },
7908
- "\uC0AD\uC81C\uD558\uAE30"
7909
- ), /* @__PURE__ */ React6.createElement(
7910
- "button",
7911
- {
7912
- type: "button",
7913
- className: "button-primary",
7914
- onClick: form.submit
7915
- },
7916
- "\uC800\uC7A5\uD558\uAE30"
7917
- ))
7918
- }
7919
- ), /* @__PURE__ */ React6.createElement("div", { className: "max-w-2xl mx-auto" }, Object.keys(form.columns).length > 0 && /* @__PURE__ */ React6.createElement(React6.Fragment, null, Object.entries(form.columns).map(
7920
- ([name, value]) => {
7921
- function InputComponent() {
7922
- if (value.type === "textarea") {
7923
- return /* @__PURE__ */ React6.createElement(
7924
- StoreTextEditor,
7936
+ if (value.type === "textarea") {
7937
+ return /* @__PURE__ */ jsx6(
7938
+ StoreTextEditor,
7939
+ {
7940
+ store: form.store,
7941
+ name,
7942
+ editor: {
7943
+ attributes: {
7944
+ class: "text-editor-form"
7945
+ }
7946
+ }
7947
+ }
7948
+ );
7949
+ }
7950
+ if (value.options) {
7951
+ const Component = value.options;
7952
+ return /* @__PURE__ */ jsx6(component.select, { name, className: "select-form", children: /* @__PURE__ */ jsx6(Component, {}) });
7953
+ }
7954
+ return /* @__PURE__ */ jsx6(
7955
+ component.input,
7925
7956
  {
7926
- store: form.store,
7927
- name
7957
+ name,
7958
+ type: value.type,
7959
+ className: "input-form"
7928
7960
  }
7929
7961
  );
7930
7962
  }
7931
- if (value.options) {
7932
- const Component = value.options;
7933
- return /* @__PURE__ */ React6.createElement(component.select, { name, className: "select-form" }, /* @__PURE__ */ React6.createElement(Component, null));
7934
- }
7935
- return /* @__PURE__ */ React6.createElement(
7936
- component.input,
7937
- {
7938
- name,
7939
- type: value.type,
7940
- className: "input-form"
7941
- }
7942
- );
7963
+ const v = form.store.state[name];
7964
+ if (typeof v === "boolean") {
7965
+ return /* @__PURE__ */ jsxs2("div", { className: "flex", children: [
7966
+ value.label,
7967
+ /* @__PURE__ */ jsx6("div", { className: "ml-auto", children: /* @__PURE__ */ jsx6(InputComponent, {}) })
7968
+ ] });
7969
+ }
7970
+ return /* @__PURE__ */ jsx6(FormRow, { children: /* @__PURE__ */ jsxs2(FormEntry, { children: [
7971
+ /* @__PURE__ */ jsx6(FormLabel, { children: value.label }, name),
7972
+ /* @__PURE__ */ jsx6(InputComponent, {})
7973
+ ] }) });
7943
7974
  }
7944
- const v = form.store.state[name];
7945
- if (typeof v === "boolean") {
7946
- return /* @__PURE__ */ React6.createElement("div", { className: "flex" }, value.label, /* @__PURE__ */ React6.createElement("div", { className: "ml-auto" }, /* @__PURE__ */ React6.createElement(InputComponent, null)));
7947
- }
7948
- return /* @__PURE__ */ React6.createElement(FormRow, null, /* @__PURE__ */ React6.createElement(FormEntry, null, /* @__PURE__ */ React6.createElement(FormLabel, { key: name }, value.label), /* @__PURE__ */ React6.createElement(InputComponent, null)));
7949
- }
7950
- ))));
7975
+ ) }) })
7976
+ ] });
7951
7977
  }
7952
7978
 
7953
7979
  // src/table/loader.tsx
@@ -8215,160 +8241,12 @@ import {
8215
8241
  useNavigate as useNavigate2,
8216
8242
  useSearchParams as useSearchParams3
8217
8243
  } from "react-router";
8218
-
8219
- // node_modules/react-icons/lib/iconBase.mjs
8220
- import React8 from "react";
8221
-
8222
- // node_modules/react-icons/lib/iconContext.mjs
8223
- import React7 from "react";
8224
- var DefaultContext = {
8225
- color: void 0,
8226
- size: void 0,
8227
- className: void 0,
8228
- style: void 0,
8229
- attr: void 0
8230
- };
8231
- var IconContext = React7.createContext && /* @__PURE__ */ React7.createContext(DefaultContext);
8232
-
8233
- // node_modules/react-icons/lib/iconBase.mjs
8234
- var _excluded = ["attr", "size", "title"];
8235
- function _objectWithoutProperties(source, excluded) {
8236
- if (source == null) return {};
8237
- var target = _objectWithoutPropertiesLoose(source, excluded);
8238
- var key, i;
8239
- if (Object.getOwnPropertySymbols) {
8240
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
8241
- for (i = 0; i < sourceSymbolKeys.length; i++) {
8242
- key = sourceSymbolKeys[i];
8243
- if (excluded.indexOf(key) >= 0) continue;
8244
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
8245
- target[key] = source[key];
8246
- }
8247
- }
8248
- return target;
8249
- }
8250
- function _objectWithoutPropertiesLoose(source, excluded) {
8251
- if (source == null) return {};
8252
- var target = {};
8253
- for (var key in source) {
8254
- if (Object.prototype.hasOwnProperty.call(source, key)) {
8255
- if (excluded.indexOf(key) >= 0) continue;
8256
- target[key] = source[key];
8257
- }
8258
- }
8259
- return target;
8260
- }
8261
- function _extends() {
8262
- _extends = Object.assign ? Object.assign.bind() : function(target) {
8263
- for (var i = 1; i < arguments.length; i++) {
8264
- var source = arguments[i];
8265
- for (var key in source) {
8266
- if (Object.prototype.hasOwnProperty.call(source, key)) {
8267
- target[key] = source[key];
8268
- }
8269
- }
8270
- }
8271
- return target;
8272
- };
8273
- return _extends.apply(this, arguments);
8274
- }
8275
- function ownKeys(e, r) {
8276
- var t = Object.keys(e);
8277
- if (Object.getOwnPropertySymbols) {
8278
- var o = Object.getOwnPropertySymbols(e);
8279
- r && (o = o.filter(function(r2) {
8280
- return Object.getOwnPropertyDescriptor(e, r2).enumerable;
8281
- })), t.push.apply(t, o);
8282
- }
8283
- return t;
8284
- }
8285
- function _objectSpread(e) {
8286
- for (var r = 1; r < arguments.length; r++) {
8287
- var t = null != arguments[r] ? arguments[r] : {};
8288
- r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
8289
- _defineProperty(e, r2, t[r2]);
8290
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
8291
- Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
8292
- });
8293
- }
8294
- return e;
8295
- }
8296
- function _defineProperty(obj, key, value) {
8297
- key = _toPropertyKey(key);
8298
- if (key in obj) {
8299
- Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
8300
- } else {
8301
- obj[key] = value;
8302
- }
8303
- return obj;
8304
- }
8305
- function _toPropertyKey(t) {
8306
- var i = _toPrimitive(t, "string");
8307
- return "symbol" == typeof i ? i : i + "";
8308
- }
8309
- function _toPrimitive(t, r) {
8310
- if ("object" != typeof t || !t) return t;
8311
- var e = t[Symbol.toPrimitive];
8312
- if (void 0 !== e) {
8313
- var i = e.call(t, r || "default");
8314
- if ("object" != typeof i) return i;
8315
- throw new TypeError("@@toPrimitive must return a primitive value.");
8316
- }
8317
- return ("string" === r ? String : Number)(t);
8318
- }
8319
- function Tree2Element(tree) {
8320
- return tree && tree.map((node, i) => /* @__PURE__ */ React8.createElement(node.tag, _objectSpread({
8321
- key: i
8322
- }, node.attr), Tree2Element(node.child)));
8323
- }
8324
- function GenIcon(data) {
8325
- return (props) => /* @__PURE__ */ React8.createElement(IconBase, _extends({
8326
- attr: _objectSpread({}, data.attr)
8327
- }, props), Tree2Element(data.child));
8328
- }
8329
- function IconBase(props) {
8330
- var elem = (conf) => {
8331
- var {
8332
- attr,
8333
- size,
8334
- title
8335
- } = props, svgProps = _objectWithoutProperties(props, _excluded);
8336
- var computedSize = size || conf.size || "1em";
8337
- var className;
8338
- if (conf.className) className = conf.className;
8339
- if (props.className) className = (className ? className + " " : "") + props.className;
8340
- return /* @__PURE__ */ React8.createElement("svg", _extends({
8341
- stroke: "currentColor",
8342
- fill: "currentColor",
8343
- strokeWidth: "0"
8344
- }, conf.attr, attr, svgProps, {
8345
- className,
8346
- style: _objectSpread(_objectSpread({
8347
- color: props.color || conf.color
8348
- }, conf.style), props.style),
8349
- height: computedSize,
8350
- width: computedSize,
8351
- xmlns: "http://www.w3.org/2000/svg"
8352
- }), title && /* @__PURE__ */ React8.createElement("title", null, title), props.children);
8353
- };
8354
- return IconContext !== void 0 ? /* @__PURE__ */ React8.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
8355
- }
8356
-
8357
- // node_modules/react-icons/go/index.mjs
8358
- function GoArrowDown(props) {
8359
- 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);
8360
- }
8361
- function GoArrowUp(props) {
8362
- 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);
8363
- }
8364
- function GoSearch(props) {
8365
- 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);
8366
- }
8244
+ import { GoSearch } from "react-icons/go";
8367
8245
 
8368
8246
  // src/table/buttons.tsx
8369
8247
  import { cn as cn2 } from "dn-react-toolkit/utils";
8370
8248
  import { Link, useLocation, useSearchParams } from "react-router";
8371
- import React9 from "react";
8249
+ import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
8372
8250
  function TablePageButtons({
8373
8251
  MAX_PAGES_TO_SHOW,
8374
8252
  total,
@@ -8381,63 +8259,59 @@ function TablePageButtons({
8381
8259
  const currentPage = Math.floor(offset / limit) + 1;
8382
8260
  const startButton = (Math.ceil(currentPage / MAX_PAGES_TO_SHOW) - 1) * MAX_PAGES_TO_SHOW;
8383
8261
  const endButton = Math.min(startButton + MAX_PAGES_TO_SHOW - 1, pages);
8384
- return /* @__PURE__ */ React9.createElement(React9.Fragment, null, pages > 1 && /* @__PURE__ */ React9.createElement("div", { className: "flex justify-center items-center my-8 gap-4 text-neutral-400" }, startButton > 1 && /* @__PURE__ */ React9.createElement(
8385
- Link,
8386
- {
8387
- to: (() => {
8388
- searchParams.set(
8389
- "offset",
8390
- String((startButton - 1) * limit)
8391
- );
8392
- return `${pathname}?${searchParams.toString()}`;
8393
- })(),
8394
- className: "w-10 block text-center transition-colors hover:text-primary"
8395
- },
8396
- "\uC774\uC804"
8397
- ), Array.from({
8398
- length: Math.min(
8399
- MAX_PAGES_TO_SHOW,
8400
- pages - startButton
8401
- )
8402
- }).map((_, index2) => {
8403
- return /* @__PURE__ */ React9.createElement(
8262
+ return /* @__PURE__ */ jsx7(Fragment3, { children: pages > 1 && /* @__PURE__ */ jsxs3("div", { className: "flex justify-center items-center my-8 gap-4 text-neutral-400", children: [
8263
+ startButton > 1 && /* @__PURE__ */ jsx7(
8404
8264
  Link,
8405
8265
  {
8406
- key: index2,
8407
8266
  to: (() => {
8408
- searchParams.set(
8409
- "offset",
8410
- String((startButton + index2) * limit)
8411
- );
8267
+ searchParams.set("offset", String((startButton - 1) * limit));
8412
8268
  return `${pathname}?${searchParams.toString()}`;
8413
8269
  })(),
8414
- className: cn2(
8415
- "w-6 block text-center transition-colors",
8416
- currentPage === startButton + index2 + 1 ? "font-bold text-primary" : "hover:text-primary"
8417
- )
8418
- },
8419
- startButton + index2 + 1
8420
- );
8421
- }), endButton < pages && /* @__PURE__ */ React9.createElement(
8422
- Link,
8423
- {
8424
- to: (() => {
8425
- searchParams.set(
8426
- "offset",
8427
- String((endButton + 1) * limit)
8428
- );
8429
- return `${pathname}?${searchParams.toString()}`;
8430
- })(),
8431
- className: "w-10 block text-center transition-colors hover:text-primary"
8432
- },
8433
- "\uB2E4\uC74C"
8434
- )));
8270
+ className: "w-10 block text-center transition-colors hover:text-primary",
8271
+ children: "\uC774\uC804"
8272
+ }
8273
+ ),
8274
+ Array.from({
8275
+ length: Math.min(MAX_PAGES_TO_SHOW, pages - startButton)
8276
+ }).map((_, index2) => {
8277
+ return /* @__PURE__ */ jsx7(
8278
+ Link,
8279
+ {
8280
+ to: (() => {
8281
+ searchParams.set(
8282
+ "offset",
8283
+ String((startButton + index2) * limit)
8284
+ );
8285
+ return `${pathname}?${searchParams.toString()}`;
8286
+ })(),
8287
+ className: cn2(
8288
+ "w-6 block text-center transition-colors",
8289
+ currentPage === startButton + index2 + 1 ? "font-bold text-primary" : "hover:text-primary"
8290
+ ),
8291
+ children: startButton + index2 + 1
8292
+ },
8293
+ index2
8294
+ );
8295
+ }),
8296
+ endButton < pages && /* @__PURE__ */ jsx7(
8297
+ Link,
8298
+ {
8299
+ to: (() => {
8300
+ searchParams.set("offset", String((endButton + 1) * limit));
8301
+ return `${pathname}?${searchParams.toString()}`;
8302
+ })(),
8303
+ className: "w-10 block text-center transition-colors hover:text-primary",
8304
+ children: "\uB2E4\uC74C"
8305
+ }
8306
+ )
8307
+ ] }) });
8435
8308
  }
8436
8309
 
8437
8310
  // src/table/table.tsx
8438
8311
  import { cn as cn3 } from "dn-react-toolkit/utils";
8312
+ import { GoArrowDown, GoArrowUp } from "react-icons/go";
8439
8313
  import { Link as Link2, useSearchParams as useSearchParams2 } from "react-router";
8440
- import React10 from "react";
8314
+ import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
8441
8315
  function Table({
8442
8316
  className = "min-w-full whitespace-nowrap",
8443
8317
  data,
@@ -8452,95 +8326,92 @@ function Table({
8452
8326
  const keys = Object.entries(columns).filter((entry) => entry[1]).map(([key]) => key);
8453
8327
  const sortedArray = [...data];
8454
8328
  const [_, setSearchParams] = useSearchParams2();
8455
- return /* @__PURE__ */ React10.createElement(
8329
+ return /* @__PURE__ */ jsxs4(
8456
8330
  "table",
8457
8331
  {
8458
- className: cn3(
8459
- className,
8460
- "text-[15px] border-separate border-spacing-0"
8461
- )
8462
- },
8463
- /* @__PURE__ */ React10.createElement("thead", null, /* @__PURE__ */ React10.createElement("tr", null, keys.map((key) => {
8464
- const value = columns[key];
8465
- function getReactNode() {
8466
- if (value && typeof value === "object" && "label" in value) {
8467
- return value.label;
8468
- }
8469
- return value;
8470
- }
8471
- function Head() {
8472
- const reactNode = getReactNode();
8473
- if (typeof reactNode === "string") {
8474
- return /* @__PURE__ */ React10.createElement(
8475
- "button",
8332
+ className: cn3(className, "text-[15px] border-separate border-spacing-0"),
8333
+ children: [
8334
+ /* @__PURE__ */ jsx8("thead", { children: /* @__PURE__ */ jsx8("tr", { children: keys.map((key) => {
8335
+ const value = columns[key];
8336
+ function getReactNode() {
8337
+ if (value && typeof value === "object" && "label" in value) {
8338
+ return value.label;
8339
+ }
8340
+ return value;
8341
+ }
8342
+ function Head() {
8343
+ const reactNode = getReactNode();
8344
+ if (typeof reactNode === "string") {
8345
+ return /* @__PURE__ */ jsxs4(
8346
+ "button",
8347
+ {
8348
+ className: cn3(
8349
+ orderBy === key ? "text-neutral-900 font-medium" : "text-neutral-500",
8350
+ "px-4 h-14 flex items-center w-full"
8351
+ ),
8352
+ onClick: () => {
8353
+ let newDirection = "asc";
8354
+ if (orderBy === key) {
8355
+ newDirection = direction === "asc" ? "desc" : "asc";
8356
+ }
8357
+ setSearchParams({
8358
+ orderBy: key,
8359
+ direction: newDirection
8360
+ });
8361
+ },
8362
+ children: [
8363
+ reactNode,
8364
+ orderBy === key && /* @__PURE__ */ jsx8("div", { className: "ml-0.5", children: direction === "asc" ? /* @__PURE__ */ jsx8(GoArrowUp, {}) : /* @__PURE__ */ jsx8(GoArrowDown, {}) })
8365
+ ]
8366
+ }
8367
+ );
8368
+ }
8369
+ return /* @__PURE__ */ jsx8(Fragment4, { children: reactNode });
8370
+ }
8371
+ return /* @__PURE__ */ jsx8("th", { className: cn3("border-y font-normal"), children: /* @__PURE__ */ jsx8(Head, {}) }, key);
8372
+ }) }) }),
8373
+ /* @__PURE__ */ jsxs4("tbody", { children: [
8374
+ sortedArray.length === 0 && /* @__PURE__ */ jsx8("tr", { children: /* @__PURE__ */ jsx8(
8375
+ "td",
8476
8376
  {
8477
- className: cn3(
8478
- orderBy === key ? "text-neutral-900 font-medium" : "text-neutral-500",
8479
- "px-4 h-14 flex items-center w-full"
8480
- ),
8481
- onClick: () => {
8482
- let newDirection = "asc";
8483
- if (orderBy === key) {
8484
- newDirection = direction === "asc" ? "desc" : "asc";
8377
+ colSpan: keys.length,
8378
+ className: "px-4 h-14 text-neutral-400 text-center",
8379
+ children: "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
8380
+ }
8381
+ ) }),
8382
+ sortedArray.map((item, i) => /* @__PURE__ */ jsx8("tr", { className: "hover:bg-gray-50 transition-colors", children: keys.map((key, i2) => {
8383
+ const value = item[key];
8384
+ function Content() {
8385
+ if (key in columns) {
8386
+ const column = columns[key];
8387
+ if (column && typeof column === "object" && "mapper" in column) {
8388
+ const mapper = column.mapper;
8389
+ if (mapper) {
8390
+ return /* @__PURE__ */ jsx8(Fragment4, { children: mapper(item) });
8391
+ }
8485
8392
  }
8486
- setSearchParams({
8487
- orderBy: key,
8488
- direction: newDirection
8489
- });
8490
8393
  }
8491
- },
8492
- reactNode,
8493
- orderBy === key && /* @__PURE__ */ React10.createElement("div", { className: "ml-0.5" }, direction === "asc" ? /* @__PURE__ */ React10.createElement(GoArrowUp, null) : /* @__PURE__ */ React10.createElement(GoArrowDown, null))
8494
- );
8495
- }
8496
- return /* @__PURE__ */ React10.createElement(React10.Fragment, null, reactNode);
8497
- }
8498
- return /* @__PURE__ */ React10.createElement(
8499
- "th",
8500
- {
8501
- key,
8502
- className: cn3("border-y font-normal")
8503
- },
8504
- /* @__PURE__ */ React10.createElement(Head, null)
8505
- );
8506
- }))),
8507
- /* @__PURE__ */ React10.createElement("tbody", null, sortedArray.length === 0 && /* @__PURE__ */ React10.createElement("tr", null, /* @__PURE__ */ React10.createElement(
8508
- "td",
8509
- {
8510
- colSpan: keys.length,
8511
- className: "px-4 h-14 text-neutral-400 text-center"
8512
- },
8513
- "\uB370\uC774\uD130\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4."
8514
- )), sortedArray.map((item, i) => /* @__PURE__ */ React10.createElement("tr", { key: i, className: "hover:bg-gray-50 transition-colors" }, keys.map((key, i2) => {
8515
- const value = item[key];
8516
- function Content() {
8517
- if (key in columns) {
8518
- const column = columns[key];
8519
- if (column && typeof column === "object" && "mapper" in column) {
8520
- const mapper = column.mapper;
8521
- if (mapper) {
8522
- return /* @__PURE__ */ React10.createElement(React10.Fragment, null, mapper(item));
8394
+ return /* @__PURE__ */ jsx8(Fragment4, { children: String(value) });
8523
8395
  }
8524
- }
8525
- }
8526
- return /* @__PURE__ */ React10.createElement(React10.Fragment, null, String(value));
8527
- }
8528
- const linkedContent = getLink ? /* @__PURE__ */ React10.createElement(
8529
- Link2,
8530
- {
8531
- to: getLink(item),
8532
- className: "block content-center px-4 w-full h-full"
8533
- },
8534
- /* @__PURE__ */ React10.createElement(Content, null)
8535
- ) : /* @__PURE__ */ React10.createElement(Content, null);
8536
- const cell = Mapper ? /* @__PURE__ */ React10.createElement(Mapper, { item, index: i2 }, linkedContent) : linkedContent;
8537
- return /* @__PURE__ */ React10.createElement("td", { key, className: "px-0 h-14 border-b" }, cell);
8538
- }))))
8396
+ const linkedContent = getLink ? /* @__PURE__ */ jsx8(
8397
+ Link2,
8398
+ {
8399
+ to: getLink(item),
8400
+ className: "block content-center px-4 w-full h-full",
8401
+ children: /* @__PURE__ */ jsx8(Content, {})
8402
+ }
8403
+ ) : /* @__PURE__ */ jsx8(Content, {});
8404
+ const cell = Mapper ? /* @__PURE__ */ jsx8(Mapper, { item, index: i2, children: linkedContent }) : linkedContent;
8405
+ return /* @__PURE__ */ jsx8("td", { className: "px-0 h-14 border-b", children: cell }, key);
8406
+ }) }, i))
8407
+ ] })
8408
+ ]
8409
+ }
8539
8410
  );
8540
8411
  }
8541
8412
 
8542
8413
  // src/table/page.tsx
8543
- import React11 from "react";
8414
+ import { Fragment as Fragment5, jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
8544
8415
  function createTablePage({
8545
8416
  name,
8546
8417
  columns,
@@ -8560,65 +8431,77 @@ function createTablePage({
8560
8431
  navigate(`${pathname}?${searchParams2.toString()}`);
8561
8432
  };
8562
8433
  const [searchParams] = useSearchParams3();
8563
- return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(
8564
- Header,
8565
- {
8566
- title: name,
8567
- actions: /* @__PURE__ */ React11.createElement(Link3, { to: `${pathname}/new`, className: "button-primary" }, name, " \uCD94\uAC00")
8568
- }
8569
- ), /* @__PURE__ */ React11.createElement("div", { className: "max-w-7xl mx-auto w-full overflow-auto" }, searchKey && /* @__PURE__ */ React11.createElement(
8570
- "form",
8571
- {
8572
- className: "h-18 px-4 flex items-center border-t",
8573
- onSubmit: (e) => {
8574
- e.preventDefault();
8575
- const formData = new FormData(e.currentTarget);
8576
- const query = formData.get("query");
8577
- search(query);
8578
- }
8579
- },
8580
- /* @__PURE__ */ React11.createElement(
8581
- "button",
8582
- {
8583
- type: "submit",
8584
- className: "w-10 h-10 flex justify-center items-center"
8585
- },
8586
- /* @__PURE__ */ React11.createElement(GoSearch, { className: "text-xl mr-4" })
8587
- ),
8588
- /* @__PURE__ */ React11.createElement(
8589
- "input",
8434
+ return /* @__PURE__ */ jsxs5(Fragment5, { children: [
8435
+ /* @__PURE__ */ jsx9(
8436
+ Header,
8590
8437
  {
8591
- className: "outline-none h-full flex-1",
8592
- placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
8593
- name: "query",
8594
- defaultValue: searchParams.get("query") ?? ""
8438
+ title: name,
8439
+ actions: /* @__PURE__ */ jsxs5(Link3, { to: `${pathname}/new`, className: "button-primary", children: [
8440
+ name,
8441
+ " \uCD94\uAC00"
8442
+ ] })
8595
8443
  }
8596
- )
8597
- ), /* @__PURE__ */ React11.createElement(
8598
- Table,
8599
- {
8600
- data: items,
8601
- columns,
8602
- getLink: primaryKey ? (item) => `${pathname}/${item[primaryKey]}` : void 0,
8603
- limit,
8604
- offset,
8605
- orderBy,
8606
- direction
8607
- }
8608
- ), /* @__PURE__ */ React11.createElement(
8609
- TablePageButtons,
8610
- {
8611
- total,
8612
- limit,
8613
- offset,
8614
- MAX_PAGES_TO_SHOW: 10
8615
- }
8616
- )));
8444
+ ),
8445
+ /* @__PURE__ */ jsxs5("div", { className: "max-w-7xl mx-auto w-full overflow-auto", children: [
8446
+ searchKey && /* @__PURE__ */ jsxs5(
8447
+ "form",
8448
+ {
8449
+ className: "h-18 px-4 flex items-center border-t",
8450
+ onSubmit: (e) => {
8451
+ e.preventDefault();
8452
+ const formData = new FormData(e.currentTarget);
8453
+ const query = formData.get("query");
8454
+ search(query);
8455
+ },
8456
+ children: [
8457
+ /* @__PURE__ */ jsx9(
8458
+ "button",
8459
+ {
8460
+ type: "submit",
8461
+ className: "w-10 h-10 flex justify-center items-center",
8462
+ children: /* @__PURE__ */ jsx9(GoSearch, { className: "text-xl mr-4" })
8463
+ }
8464
+ ),
8465
+ /* @__PURE__ */ jsx9(
8466
+ "input",
8467
+ {
8468
+ className: "outline-none h-full flex-1",
8469
+ placeholder: "\uC5EC\uAE30\uC5D0 \uAC80\uC0C9\uD558\uC138\uC694...",
8470
+ name: "query",
8471
+ defaultValue: searchParams.get("query") ?? ""
8472
+ }
8473
+ )
8474
+ ]
8475
+ }
8476
+ ),
8477
+ /* @__PURE__ */ jsx9(
8478
+ Table,
8479
+ {
8480
+ data: items,
8481
+ columns,
8482
+ getLink: primaryKey ? (item) => `${pathname}/${item[primaryKey]}` : void 0,
8483
+ limit,
8484
+ offset,
8485
+ orderBy,
8486
+ direction
8487
+ }
8488
+ ),
8489
+ /* @__PURE__ */ jsx9(
8490
+ TablePageButtons,
8491
+ {
8492
+ total,
8493
+ limit,
8494
+ offset,
8495
+ MAX_PAGES_TO_SHOW: 10
8496
+ }
8497
+ )
8498
+ ] })
8499
+ ] });
8617
8500
  };
8618
8501
  }
8619
8502
 
8620
8503
  // src/crud/crud_page.tsx
8621
- import React12 from "react";
8504
+ import { jsx as jsx10 } from "react/jsx-runtime";
8622
8505
  function crudPage({
8623
8506
  name,
8624
8507
  primaryKey,
@@ -8626,7 +8509,7 @@ function crudPage({
8626
8509
  formOptions,
8627
8510
  header
8628
8511
  }) {
8629
- return (prefix2) => {
8512
+ const create = (prefix2) => {
8630
8513
  return function Page() {
8631
8514
  const data = useLoaderData2();
8632
8515
  const { pathname } = useLocation3();
@@ -8635,29 +8518,33 @@ function crudPage({
8635
8518
  ...tablePageOptions,
8636
8519
  name
8637
8520
  });
8638
- return /* @__PURE__ */ React12.createElement(Component, { header });
8521
+ return /* @__PURE__ */ jsx10(Component, { header });
8639
8522
  }
8640
8523
  if (pathname.startsWith(prefix2)) {
8641
- return /* @__PURE__ */ React12.createElement(
8524
+ return /* @__PURE__ */ jsx10(
8642
8525
  CrudFormProvider,
8643
8526
  {
8644
8527
  item: data?.item,
8645
8528
  prefix: prefix2,
8646
8529
  name,
8647
8530
  columns: formOptions.columns,
8648
- primaryKey
8649
- },
8650
- formOptions.form ? /* @__PURE__ */ React12.createElement(FormDelegate, { component: formOptions.form }) : /* @__PURE__ */ React12.createElement(CrudForm, { AdminHeader: header })
8531
+ primaryKey,
8532
+ children: formOptions.form ? /* @__PURE__ */ jsx10(FormDelegate, { component: formOptions.form }) : /* @__PURE__ */ jsx10(CrudForm, { AdminHeader: header })
8533
+ }
8651
8534
  );
8652
8535
  }
8653
8536
  };
8654
8537
  };
8538
+ return {
8539
+ name,
8540
+ create
8541
+ };
8655
8542
  }
8656
8543
  function FormDelegate({
8657
8544
  component: Component
8658
8545
  }) {
8659
8546
  const form = useFormContext();
8660
- return /* @__PURE__ */ React12.createElement(Component, { form });
8547
+ return /* @__PURE__ */ jsx10(Component, { form });
8661
8548
  }
8662
8549
 
8663
8550
  // src/crud/generate_handlers.ts
@@ -8674,16 +8561,29 @@ var generateHandlers = (handlers) => {
8674
8561
 
8675
8562
  // src/crud/generate_pages.tsx
8676
8563
  import { useLocation as useLocation4 } from "react-router";
8677
- import React13 from "react";
8564
+ import { jsx as jsx11 } from "react/jsx-runtime";
8678
8565
  var generatePages = (pages) => {
8679
- return function Page() {
8566
+ function Page() {
8680
8567
  const { pathname } = useLocation4();
8681
8568
  for (const route2 of Object.keys(pages)) {
8682
8569
  if (pathname.startsWith(route2)) {
8683
- const Page2 = pages[route2](route2);
8684
- return /* @__PURE__ */ React13.createElement(Page2, null);
8570
+ const Page2 = pages[route2].create(route2);
8571
+ return /* @__PURE__ */ jsx11(Page2, {});
8685
8572
  }
8686
8573
  }
8574
+ }
8575
+ const routes = Object.keys(pages);
8576
+ const menus = Object.keys(pages).map((path) => {
8577
+ const page = pages[path];
8578
+ return {
8579
+ title: page.name,
8580
+ to: path
8581
+ };
8582
+ });
8583
+ return {
8584
+ Page,
8585
+ routes,
8586
+ menus
8687
8587
  };
8688
8588
  };
8689
8589