dn-react-router-toolkit 0.4.4 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/api/create_api_handler.d.mts +28 -0
  2. package/dist/api/create_api_handler.d.ts +28 -0
  3. package/dist/api/create_api_handler.js +148 -0
  4. package/dist/api/create_api_handler.mjs +132 -0
  5. package/dist/api/create_handler.js +27 -25
  6. package/dist/api/create_handler.mjs +27 -25
  7. package/dist/api/index.js +27 -25
  8. package/dist/api/index.mjs +27 -25
  9. package/dist/api/item_api_handler.d.mts +18 -0
  10. package/dist/api/item_api_handler.d.ts +18 -0
  11. package/dist/api/item_api_handler.js +55 -0
  12. package/dist/api/item_api_handler.mjs +30 -0
  13. package/dist/auth/index.d.mts +1 -2
  14. package/dist/auth/index.d.ts +1 -2
  15. package/dist/auth/index.js +13 -21
  16. package/dist/auth/index.mjs +12 -20
  17. package/dist/auth/with_auth.d.mts +3 -3
  18. package/dist/auth/with_auth.d.ts +3 -3
  19. package/dist/auth/with_auth.js +13 -21
  20. package/dist/auth/with_auth.mjs +12 -20
  21. package/dist/crud/crud_form.d.mts +13 -0
  22. package/dist/crud/crud_form.d.ts +13 -0
  23. package/dist/crud/crud_form.js +88 -0
  24. package/dist/crud/crud_form.mjs +55 -0
  25. package/dist/crud/crud_form_provider.d.mts +34 -0
  26. package/dist/crud/crud_form_provider.d.ts +34 -0
  27. package/dist/crud/crud_form_provider.js +160 -0
  28. package/dist/crud/crud_form_provider.mjs +124 -0
  29. package/dist/crud/crud_loader.d.mts +21 -0
  30. package/dist/crud/crud_loader.d.ts +21 -0
  31. package/dist/crud/crud_loader.js +288 -0
  32. package/dist/crud/crud_loader.mjs +273 -0
  33. package/dist/crud/crud_page.d.mts +25 -0
  34. package/dist/crud/crud_page.d.ts +25 -0
  35. package/dist/crud/crud_page.js +645 -0
  36. package/dist/crud/crud_page.mjs +616 -0
  37. package/dist/crud/generate_handlers.d.mts +15 -0
  38. package/dist/crud/generate_handlers.d.ts +15 -0
  39. package/dist/crud/generate_handlers.js +39 -0
  40. package/dist/crud/generate_handlers.mjs +14 -0
  41. package/dist/crud/generate_pages.d.mts +11 -0
  42. package/dist/crud/generate_pages.d.ts +11 -0
  43. package/dist/crud/generate_pages.js +52 -0
  44. package/dist/crud/generate_pages.mjs +17 -0
  45. package/dist/crud/generate_routes.d.mts +5 -0
  46. package/dist/crud/generate_routes.d.ts +5 -0
  47. package/dist/crud/generate_routes.js +62 -0
  48. package/dist/crud/generate_routes.mjs +27 -0
  49. package/dist/crud/index.d.mts +21 -0
  50. package/dist/crud/index.d.ts +21 -0
  51. package/dist/crud/index.js +970 -0
  52. package/dist/crud/index.mjs +945 -0
  53. package/dist/db/index.d.mts +4 -0
  54. package/dist/db/index.d.ts +4 -0
  55. package/dist/db/index.js +46 -0
  56. package/dist/db/index.mjs +8 -0
  57. package/dist/index.d.mts +3 -2
  58. package/dist/index.d.ts +3 -2
  59. package/dist/seo/index.js +26 -25
  60. package/dist/seo/index.mjs +27 -26
  61. package/dist/seo/seo.js +26 -25
  62. package/dist/seo/seo.mjs +27 -26
  63. package/dist/table/buttons.d.mts +10 -0
  64. package/dist/table/buttons.d.ts +10 -0
  65. package/dist/table/buttons.js +102 -0
  66. package/dist/table/buttons.mjs +71 -0
  67. package/dist/table/index.d.mts +9 -0
  68. package/dist/table/index.d.ts +9 -0
  69. package/dist/table/index.js +570 -0
  70. package/dist/table/index.mjs +543 -0
  71. package/dist/table/item_loader.d.mts +12 -0
  72. package/dist/table/item_loader.d.ts +12 -0
  73. package/dist/table/item_loader.js +51 -0
  74. package/dist/table/item_loader.mjs +26 -0
  75. package/dist/table/loader.d.mts +28 -0
  76. package/dist/table/loader.d.ts +28 -0
  77. package/dist/table/loader.js +70 -0
  78. package/dist/table/loader.mjs +48 -0
  79. package/dist/table/page.d.mts +27 -0
  80. package/dist/table/page.d.ts +27 -0
  81. package/dist/table/page.js +444 -0
  82. package/dist/table/page.mjs +415 -0
  83. package/dist/table/repository.d.mts +38 -0
  84. package/dist/table/repository.d.ts +38 -0
  85. package/dist/table/repository.js +76 -0
  86. package/dist/table/repository.mjs +56 -0
  87. package/dist/table/table.d.mts +27 -0
  88. package/dist/table/table.d.ts +27 -0
  89. package/dist/table/table.js +290 -0
  90. package/dist/table/table.mjs +255 -0
  91. package/package.json +21 -3
  92. package/dist/auth/temp_user.d.mts +0 -5
  93. package/dist/auth/temp_user.d.ts +0 -5
  94. package/dist/auth/temp_user.js +0 -18
  95. package/dist/auth/temp_user.mjs +0 -0
@@ -0,0 +1,4 @@
1
+ export { drizzle } from 'drizzle-orm/node-postgres';
2
+ export * from 'drizzle-orm';
3
+ import * as pgCore from 'drizzle-orm/pg-core';
4
+ export { pgCore as core };
@@ -0,0 +1,4 @@
1
+ export { drizzle } from 'drizzle-orm/node-postgres';
2
+ export * from 'drizzle-orm';
3
+ import * as pgCore from 'drizzle-orm/pg-core';
4
+ export { pgCore as core };
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+
31
+ // src/db/index.ts
32
+ var db_exports = {};
33
+ __export(db_exports, {
34
+ core: () => core,
35
+ drizzle: () => import_node_postgres.drizzle
36
+ });
37
+ module.exports = __toCommonJS(db_exports);
38
+ var import_node_postgres = require("drizzle-orm/node-postgres");
39
+ __reExport(db_exports, require("drizzle-orm"), module.exports);
40
+ var core = __toESM(require("drizzle-orm/pg-core"));
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ core,
44
+ drizzle,
45
+ ...require("drizzle-orm")
46
+ });
@@ -0,0 +1,8 @@
1
+ // src/db/index.ts
2
+ import { drizzle } from "drizzle-orm/node-postgres";
3
+ export * from "drizzle-orm";
4
+ import * as core from "drizzle-orm/pg-core";
5
+ export {
6
+ core,
7
+ drizzle
8
+ };
package/dist/index.d.mts CHANGED
@@ -1,2 +1,3 @@
1
-
2
- export { }
1
+ import 'drizzle-orm/node-postgres';
2
+ import 'drizzle-orm';
3
+ import 'drizzle-orm/pg-core';
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
-
2
- export { }
1
+ import 'drizzle-orm/node-postgres';
2
+ import 'drizzle-orm';
3
+ import 'drizzle-orm/pg-core';
package/dist/seo/index.js CHANGED
@@ -98,7 +98,10 @@ function configSEO(config) {
98
98
  content: socialImage.length > 0 ? "summary_large_image" : "summary"
99
99
  },
100
100
  pageTitle && { property: "twitter:title", content: pageTitle },
101
- description && { property: "twitter:description", content: description },
101
+ description && {
102
+ property: "twitter:description",
103
+ content: description
104
+ },
102
105
  ...socialImage?.map((file) => ({
103
106
  property: "twitter:image",
104
107
  content: file.url
@@ -106,16 +109,10 @@ function configSEO(config) {
106
109
  ];
107
110
  };
108
111
  function StructedData() {
109
- const matches = (0, import_react_router.useMatches)();
110
- const data = matches.reduce((acc, match) => {
111
- return {
112
- ...acc,
113
- ...match.loaderData?.seo || {}
114
- };
115
- }, {});
116
- const { pageTitle, description, keywords, url, thumbnail } = data;
112
+ const { seo } = (0, import_react_router.useLoaderData)();
113
+ const props = seo || {};
114
+ const { pageTitle, description, keywords, url, thumbnail } = props;
117
115
  const thumbnailUrl = thumbnail?.url;
118
- const props = data?.seo || {};
119
116
  const websiteSchemaId = `${config.origin}/#website`;
120
117
  const websiteSchema = {
121
118
  "@type": "WebSite",
@@ -136,7 +133,9 @@ function configSEO(config) {
136
133
  }
137
134
  ] : [],
138
135
  ...props.images || [],
139
- ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
136
+ ...props.collection?.map(
137
+ (portfolio) => portfolio.thumbnail
138
+ ) || []
140
139
  ].filter(Boolean);
141
140
  const image = images.filter((file) => file.id).map((file) => ({
142
141
  "@type": "ImageObject",
@@ -152,21 +151,23 @@ function configSEO(config) {
152
151
  const collectionMainEntity = props.collection ? {
153
152
  "@type": "ItemList",
154
153
  numberOfItems: props.collection.length,
155
- itemListElement: props.collection.map((item, index) => ({
156
- "@type": "ListItem",
157
- position: index + 1,
158
- url: item.url,
159
- item: {
160
- "@type": "WebPage",
161
- "@id": `${item.url}#webpage`,
154
+ itemListElement: props.collection.map(
155
+ (item, index) => ({
156
+ "@type": "ListItem",
157
+ position: index + 1,
162
158
  url: item.url,
163
- name: item.title,
164
- thumbnailUrl: item.thumbnail?.url,
165
- dateModified: item.updatedAt?.toISOString(),
166
- dateCreated: item.createdAt?.toISOString(),
167
- datePublished: item.createdAt?.toISOString()
168
- }
169
- }))
159
+ item: {
160
+ "@type": "WebPage",
161
+ "@id": `${item.url}#webpage`,
162
+ url: item.url,
163
+ name: item.title,
164
+ thumbnailUrl: item.thumbnail?.url,
165
+ dateModified: item.updatedAt?.toISOString(),
166
+ dateCreated: item.createdAt?.toISOString(),
167
+ datePublished: item.createdAt?.toISOString()
168
+ }
169
+ })
170
+ )
170
171
  } : void 0;
171
172
  const structuredData = {
172
173
  "@context": "https://schema.org",
@@ -35,7 +35,7 @@ var require_schema = __commonJS({
35
35
  // src/seo/seo.tsx
36
36
  var Schema = __toESM(require_schema());
37
37
  import React from "react";
38
- import { useMatches } from "react-router";
38
+ import { useLoaderData } from "react-router";
39
39
  function configSEO(config) {
40
40
  function init(props) {
41
41
  const canonicalPath = props.canonicalPath;
@@ -85,7 +85,10 @@ function configSEO(config) {
85
85
  content: socialImage.length > 0 ? "summary_large_image" : "summary"
86
86
  },
87
87
  pageTitle && { property: "twitter:title", content: pageTitle },
88
- description && { property: "twitter:description", content: description },
88
+ description && {
89
+ property: "twitter:description",
90
+ content: description
91
+ },
89
92
  ...socialImage?.map((file) => ({
90
93
  property: "twitter:image",
91
94
  content: file.url
@@ -93,16 +96,10 @@ function configSEO(config) {
93
96
  ];
94
97
  };
95
98
  function StructedData() {
96
- const matches = useMatches();
97
- const data = matches.reduce((acc, match) => {
98
- return {
99
- ...acc,
100
- ...match.loaderData?.seo || {}
101
- };
102
- }, {});
103
- const { pageTitle, description, keywords, url, thumbnail } = data;
99
+ const { seo } = useLoaderData();
100
+ const props = seo || {};
101
+ const { pageTitle, description, keywords, url, thumbnail } = props;
104
102
  const thumbnailUrl = thumbnail?.url;
105
- const props = data?.seo || {};
106
103
  const websiteSchemaId = `${config.origin}/#website`;
107
104
  const websiteSchema = {
108
105
  "@type": "WebSite",
@@ -123,7 +120,9 @@ function configSEO(config) {
123
120
  }
124
121
  ] : [],
125
122
  ...props.images || [],
126
- ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
123
+ ...props.collection?.map(
124
+ (portfolio) => portfolio.thumbnail
125
+ ) || []
127
126
  ].filter(Boolean);
128
127
  const image = images.filter((file) => file.id).map((file) => ({
129
128
  "@type": "ImageObject",
@@ -139,21 +138,23 @@ function configSEO(config) {
139
138
  const collectionMainEntity = props.collection ? {
140
139
  "@type": "ItemList",
141
140
  numberOfItems: props.collection.length,
142
- itemListElement: props.collection.map((item, index) => ({
143
- "@type": "ListItem",
144
- position: index + 1,
145
- url: item.url,
146
- item: {
147
- "@type": "WebPage",
148
- "@id": `${item.url}#webpage`,
141
+ itemListElement: props.collection.map(
142
+ (item, index) => ({
143
+ "@type": "ListItem",
144
+ position: index + 1,
149
145
  url: item.url,
150
- name: item.title,
151
- thumbnailUrl: item.thumbnail?.url,
152
- dateModified: item.updatedAt?.toISOString(),
153
- dateCreated: item.createdAt?.toISOString(),
154
- datePublished: item.createdAt?.toISOString()
155
- }
156
- }))
146
+ item: {
147
+ "@type": "WebPage",
148
+ "@id": `${item.url}#webpage`,
149
+ url: item.url,
150
+ name: item.title,
151
+ thumbnailUrl: item.thumbnail?.url,
152
+ dateModified: item.updatedAt?.toISOString(),
153
+ dateCreated: item.createdAt?.toISOString(),
154
+ datePublished: item.createdAt?.toISOString()
155
+ }
156
+ })
157
+ )
157
158
  } : void 0;
158
159
  const structuredData = {
159
160
  "@context": "https://schema.org",
package/dist/seo/seo.js CHANGED
@@ -96,7 +96,10 @@ function configSEO(config) {
96
96
  content: socialImage.length > 0 ? "summary_large_image" : "summary"
97
97
  },
98
98
  pageTitle && { property: "twitter:title", content: pageTitle },
99
- description && { property: "twitter:description", content: description },
99
+ description && {
100
+ property: "twitter:description",
101
+ content: description
102
+ },
100
103
  ...socialImage?.map((file) => ({
101
104
  property: "twitter:image",
102
105
  content: file.url
@@ -104,16 +107,10 @@ function configSEO(config) {
104
107
  ];
105
108
  };
106
109
  function StructedData() {
107
- const matches = (0, import_react_router.useMatches)();
108
- const data = matches.reduce((acc, match) => {
109
- return {
110
- ...acc,
111
- ...match.loaderData?.seo || {}
112
- };
113
- }, {});
114
- const { pageTitle, description, keywords, url, thumbnail } = data;
110
+ const { seo } = (0, import_react_router.useLoaderData)();
111
+ const props = seo || {};
112
+ const { pageTitle, description, keywords, url, thumbnail } = props;
115
113
  const thumbnailUrl = thumbnail?.url;
116
- const props = data?.seo || {};
117
114
  const websiteSchemaId = `${config.origin}/#website`;
118
115
  const websiteSchema = {
119
116
  "@type": "WebSite",
@@ -134,7 +131,9 @@ function configSEO(config) {
134
131
  }
135
132
  ] : [],
136
133
  ...props.images || [],
137
- ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
134
+ ...props.collection?.map(
135
+ (portfolio) => portfolio.thumbnail
136
+ ) || []
138
137
  ].filter(Boolean);
139
138
  const image = images.filter((file) => file.id).map((file) => ({
140
139
  "@type": "ImageObject",
@@ -150,21 +149,23 @@ function configSEO(config) {
150
149
  const collectionMainEntity = props.collection ? {
151
150
  "@type": "ItemList",
152
151
  numberOfItems: props.collection.length,
153
- itemListElement: props.collection.map((item, index) => ({
154
- "@type": "ListItem",
155
- position: index + 1,
156
- url: item.url,
157
- item: {
158
- "@type": "WebPage",
159
- "@id": `${item.url}#webpage`,
152
+ itemListElement: props.collection.map(
153
+ (item, index) => ({
154
+ "@type": "ListItem",
155
+ position: index + 1,
160
156
  url: item.url,
161
- name: item.title,
162
- thumbnailUrl: item.thumbnail?.url,
163
- dateModified: item.updatedAt?.toISOString(),
164
- dateCreated: item.createdAt?.toISOString(),
165
- datePublished: item.createdAt?.toISOString()
166
- }
167
- }))
157
+ item: {
158
+ "@type": "WebPage",
159
+ "@id": `${item.url}#webpage`,
160
+ url: item.url,
161
+ name: item.title,
162
+ thumbnailUrl: item.thumbnail?.url,
163
+ dateModified: item.updatedAt?.toISOString(),
164
+ dateCreated: item.createdAt?.toISOString(),
165
+ datePublished: item.createdAt?.toISOString()
166
+ }
167
+ })
168
+ )
168
169
  } : void 0;
169
170
  const structuredData = {
170
171
  "@context": "https://schema.org",
package/dist/seo/seo.mjs CHANGED
@@ -35,7 +35,7 @@ var require_schema = __commonJS({
35
35
  // src/seo/seo.tsx
36
36
  var Schema = __toESM(require_schema());
37
37
  import React from "react";
38
- import { useMatches } from "react-router";
38
+ import { useLoaderData } from "react-router";
39
39
  function configSEO(config) {
40
40
  function init(props) {
41
41
  const canonicalPath = props.canonicalPath;
@@ -85,7 +85,10 @@ function configSEO(config) {
85
85
  content: socialImage.length > 0 ? "summary_large_image" : "summary"
86
86
  },
87
87
  pageTitle && { property: "twitter:title", content: pageTitle },
88
- description && { property: "twitter:description", content: description },
88
+ description && {
89
+ property: "twitter:description",
90
+ content: description
91
+ },
89
92
  ...socialImage?.map((file) => ({
90
93
  property: "twitter:image",
91
94
  content: file.url
@@ -93,16 +96,10 @@ function configSEO(config) {
93
96
  ];
94
97
  };
95
98
  function StructedData() {
96
- const matches = useMatches();
97
- const data = matches.reduce((acc, match) => {
98
- return {
99
- ...acc,
100
- ...match.loaderData?.seo || {}
101
- };
102
- }, {});
103
- const { pageTitle, description, keywords, url, thumbnail } = data;
99
+ const { seo } = useLoaderData();
100
+ const props = seo || {};
101
+ const { pageTitle, description, keywords, url, thumbnail } = props;
104
102
  const thumbnailUrl = thumbnail?.url;
105
- const props = data?.seo || {};
106
103
  const websiteSchemaId = `${config.origin}/#website`;
107
104
  const websiteSchema = {
108
105
  "@type": "WebSite",
@@ -123,7 +120,9 @@ function configSEO(config) {
123
120
  }
124
121
  ] : [],
125
122
  ...props.images || [],
126
- ...props.collection?.map((portfolio) => portfolio.thumbnail) || []
123
+ ...props.collection?.map(
124
+ (portfolio) => portfolio.thumbnail
125
+ ) || []
127
126
  ].filter(Boolean);
128
127
  const image = images.filter((file) => file.id).map((file) => ({
129
128
  "@type": "ImageObject",
@@ -139,21 +138,23 @@ function configSEO(config) {
139
138
  const collectionMainEntity = props.collection ? {
140
139
  "@type": "ItemList",
141
140
  numberOfItems: props.collection.length,
142
- itemListElement: props.collection.map((item, index) => ({
143
- "@type": "ListItem",
144
- position: index + 1,
145
- url: item.url,
146
- item: {
147
- "@type": "WebPage",
148
- "@id": `${item.url}#webpage`,
141
+ itemListElement: props.collection.map(
142
+ (item, index) => ({
143
+ "@type": "ListItem",
144
+ position: index + 1,
149
145
  url: item.url,
150
- name: item.title,
151
- thumbnailUrl: item.thumbnail?.url,
152
- dateModified: item.updatedAt?.toISOString(),
153
- dateCreated: item.createdAt?.toISOString(),
154
- datePublished: item.createdAt?.toISOString()
155
- }
156
- }))
146
+ item: {
147
+ "@type": "WebPage",
148
+ "@id": `${item.url}#webpage`,
149
+ url: item.url,
150
+ name: item.title,
151
+ thumbnailUrl: item.thumbnail?.url,
152
+ dateModified: item.updatedAt?.toISOString(),
153
+ dateCreated: item.createdAt?.toISOString(),
154
+ datePublished: item.createdAt?.toISOString()
155
+ }
156
+ })
157
+ )
157
158
  } : void 0;
158
159
  const structuredData = {
159
160
  "@context": "https://schema.org",
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+
3
+ declare function TablePageButtons({ MAX_PAGES_TO_SHOW, total, limit, offset, }: {
4
+ MAX_PAGES_TO_SHOW: number;
5
+ total: number;
6
+ limit: number;
7
+ offset: number;
8
+ }): React.JSX.Element;
9
+
10
+ export { TablePageButtons as default };
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+
3
+ declare function TablePageButtons({ MAX_PAGES_TO_SHOW, total, limit, offset, }: {
4
+ MAX_PAGES_TO_SHOW: number;
5
+ total: number;
6
+ limit: number;
7
+ offset: number;
8
+ }): React.JSX.Element;
9
+
10
+ export { TablePageButtons as default };
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
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
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/table/buttons.tsx
31
+ var buttons_exports = {};
32
+ __export(buttons_exports, {
33
+ default: () => TablePageButtons
34
+ });
35
+ module.exports = __toCommonJS(buttons_exports);
36
+ var import_utils = require("dn-react-toolkit/utils");
37
+ var import_react_router = require("react-router");
38
+ var import_react = __toESM(require("react"));
39
+ function TablePageButtons({
40
+ MAX_PAGES_TO_SHOW,
41
+ total,
42
+ limit,
43
+ offset
44
+ }) {
45
+ const pages = Math.ceil(total / limit);
46
+ const { pathname } = (0, import_react_router.useLocation)();
47
+ const [searchParams] = (0, import_react_router.useSearchParams)();
48
+ const currentPage = Math.floor(offset / limit) + 1;
49
+ const startButton = (Math.ceil(currentPage / MAX_PAGES_TO_SHOW) - 1) * MAX_PAGES_TO_SHOW;
50
+ const endButton = Math.min(startButton + MAX_PAGES_TO_SHOW - 1, pages);
51
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, pages > 1 && /* @__PURE__ */ import_react.default.createElement("div", { className: "flex justify-center items-center my-8 gap-4 text-neutral-400" }, startButton > 1 && /* @__PURE__ */ import_react.default.createElement(
52
+ import_react_router.Link,
53
+ {
54
+ to: (() => {
55
+ searchParams.set(
56
+ "offset",
57
+ String((startButton - 1) * limit)
58
+ );
59
+ return `${pathname}?${searchParams.toString()}`;
60
+ })(),
61
+ className: "w-10 block text-center transition-colors hover:text-primary"
62
+ },
63
+ "\uC774\uC804"
64
+ ), Array.from({
65
+ length: Math.min(
66
+ MAX_PAGES_TO_SHOW,
67
+ pages - startButton
68
+ )
69
+ }).map((_, index) => {
70
+ return /* @__PURE__ */ import_react.default.createElement(
71
+ import_react_router.Link,
72
+ {
73
+ key: index,
74
+ to: (() => {
75
+ searchParams.set(
76
+ "offset",
77
+ String((startButton + index) * limit)
78
+ );
79
+ return `${pathname}?${searchParams.toString()}`;
80
+ })(),
81
+ className: (0, import_utils.cn)(
82
+ "w-6 block text-center transition-colors",
83
+ currentPage === startButton + index + 1 ? "font-bold text-primary" : "hover:text-primary"
84
+ )
85
+ },
86
+ startButton + index + 1
87
+ );
88
+ }), endButton < pages && /* @__PURE__ */ import_react.default.createElement(
89
+ import_react_router.Link,
90
+ {
91
+ to: (() => {
92
+ searchParams.set(
93
+ "offset",
94
+ String((endButton + 1) * limit)
95
+ );
96
+ return `${pathname}?${searchParams.toString()}`;
97
+ })(),
98
+ className: "w-10 block text-center transition-colors hover:text-primary"
99
+ },
100
+ "\uB2E4\uC74C"
101
+ )));
102
+ }
@@ -0,0 +1,71 @@
1
+ // src/table/buttons.tsx
2
+ import { cn } from "dn-react-toolkit/utils";
3
+ import { Link, useLocation, useSearchParams } from "react-router";
4
+ import React from "react";
5
+ function TablePageButtons({
6
+ MAX_PAGES_TO_SHOW,
7
+ total,
8
+ limit,
9
+ offset
10
+ }) {
11
+ const pages = Math.ceil(total / limit);
12
+ const { pathname } = useLocation();
13
+ const [searchParams] = useSearchParams();
14
+ const currentPage = Math.floor(offset / limit) + 1;
15
+ const startButton = (Math.ceil(currentPage / MAX_PAGES_TO_SHOW) - 1) * MAX_PAGES_TO_SHOW;
16
+ const endButton = Math.min(startButton + MAX_PAGES_TO_SHOW - 1, pages);
17
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, pages > 1 && /* @__PURE__ */ React.createElement("div", { className: "flex justify-center items-center my-8 gap-4 text-neutral-400" }, startButton > 1 && /* @__PURE__ */ React.createElement(
18
+ Link,
19
+ {
20
+ to: (() => {
21
+ searchParams.set(
22
+ "offset",
23
+ String((startButton - 1) * limit)
24
+ );
25
+ return `${pathname}?${searchParams.toString()}`;
26
+ })(),
27
+ className: "w-10 block text-center transition-colors hover:text-primary"
28
+ },
29
+ "\uC774\uC804"
30
+ ), Array.from({
31
+ length: Math.min(
32
+ MAX_PAGES_TO_SHOW,
33
+ pages - startButton
34
+ )
35
+ }).map((_, index) => {
36
+ return /* @__PURE__ */ React.createElement(
37
+ Link,
38
+ {
39
+ key: index,
40
+ to: (() => {
41
+ searchParams.set(
42
+ "offset",
43
+ String((startButton + index) * limit)
44
+ );
45
+ return `${pathname}?${searchParams.toString()}`;
46
+ })(),
47
+ className: cn(
48
+ "w-6 block text-center transition-colors",
49
+ currentPage === startButton + index + 1 ? "font-bold text-primary" : "hover:text-primary"
50
+ )
51
+ },
52
+ startButton + index + 1
53
+ );
54
+ }), endButton < pages && /* @__PURE__ */ React.createElement(
55
+ Link,
56
+ {
57
+ to: (() => {
58
+ searchParams.set(
59
+ "offset",
60
+ String((endButton + 1) * limit)
61
+ );
62
+ return `${pathname}?${searchParams.toString()}`;
63
+ })(),
64
+ className: "w-10 block text-center transition-colors hover:text-primary"
65
+ },
66
+ "\uB2E4\uC74C"
67
+ )));
68
+ }
69
+ export {
70
+ TablePageButtons as default
71
+ };
@@ -0,0 +1,9 @@
1
+ export { BaseTableRepository, ColumnOf, FindAllOptions, InsertModelOf, SelectModelOf, TableRepository } from './repository.mjs';
2
+ export { TableItemLoaderOptions, tableItemloader } from './item_loader.mjs';
3
+ export { TableLoaderOptions, tableLoader } from './loader.mjs';
4
+ export { TablePageOptions, TableProps, createTablePage } from './page.mjs';
5
+ export { OrderedTableProps, Table, TableColumnOptions, TableColumnProps } from './table.mjs';
6
+ import 'drizzle-orm';
7
+ import 'drizzle-orm/pg-core';
8
+ import 'react-router';
9
+ import 'react';
@@ -0,0 +1,9 @@
1
+ export { BaseTableRepository, ColumnOf, FindAllOptions, InsertModelOf, SelectModelOf, TableRepository } from './repository.js';
2
+ export { TableItemLoaderOptions, tableItemloader } from './item_loader.js';
3
+ export { TableLoaderOptions, tableLoader } from './loader.js';
4
+ export { TablePageOptions, TableProps, createTablePage } from './page.js';
5
+ export { OrderedTableProps, Table, TableColumnOptions, TableColumnProps } from './table.js';
6
+ import 'drizzle-orm';
7
+ import 'drizzle-orm/pg-core';
8
+ import 'react-router';
9
+ import 'react';