dn-react-router-toolkit 0.5.2 → 0.5.4

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.
@@ -47,33 +47,65 @@ function useFormContext() {
47
47
  // src/crud/crud_form.tsx
48
48
  var import_store2 = require("dn-react-toolkit/store");
49
49
  var import_react3 = __toESM(require("react"));
50
+ var import_utils = require("dn-react-toolkit/utils");
50
51
  function CrudForm({ AdminLayout }) {
51
52
  const form = useFormContext();
52
53
  return /* @__PURE__ */ import_react3.default.createElement(
53
54
  AdminLayout,
54
55
  {
55
56
  title: `${form.name} ${form.item ? "\uC218\uC815" : "\uCD94\uAC00"}`,
56
- actions: /* @__PURE__ */ import_react3.default.createElement(
57
- "button",
58
- {
59
- type: "button",
60
- className: "button-primary",
61
- onClick: form.submit
62
- },
63
- "\uC800\uC7A5\uD558\uAE30"
64
- ),
57
+ actions: /* @__PURE__ */ import_react3.default.createElement("button", { type: "button", className: "button-primary", onClick: form.submit }, "\uC800\uC7A5\uD558\uAE30"),
65
58
  className: "max-w-3xl mx-auto"
66
59
  },
67
- Object.keys(form.columns).length > 0 && /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, Object.entries(form.columns).map(
68
- ([key, value]) => /* @__PURE__ */ import_react3.default.createElement("label", { key }, value.label, value.component ? /* @__PURE__ */ import_react3.default.createElement(value.component, null) : /* @__PURE__ */ import_react3.default.createElement(
69
- import_store2.SyncInput,
70
- {
71
- store: form.store,
72
- property: key,
73
- className: "input-form"
60
+ Object.keys(form.columns).length > 0 && /* @__PURE__ */ import_react3.default.createElement(import_react3.default.Fragment, null, Object.entries(
61
+ form.columns
62
+ ).map(([key, value]) => {
63
+ const createComponent = () => {
64
+ if (value.component) {
65
+ return /* @__PURE__ */ import_react3.default.createElement(value.component, { store: form.store, property: key });
74
66
  }
75
- ))
76
- )),
67
+ if (value.type === "checkbox") {
68
+ return /* @__PURE__ */ import_react3.default.createElement(import_store2.SyncSwitch, { store: form.store, property: key });
69
+ }
70
+ if (value.type === "datetime") {
71
+ return /* @__PURE__ */ import_react3.default.createElement(
72
+ import_store2.SyncInput,
73
+ {
74
+ store: form.store,
75
+ property: key,
76
+ className: "input-form",
77
+ type: "datetime-local",
78
+ serializer: (value2) => {
79
+ if (value2 instanceof Date) {
80
+ return (0, import_utils.moment)(value2).toISOString(true).slice(0, 16);
81
+ }
82
+ return String(value2);
83
+ },
84
+ deserializer: (value2) => {
85
+ if (!value2) {
86
+ return void 0;
87
+ }
88
+ return (0, import_utils.moment)(value2).toDate();
89
+ }
90
+ }
91
+ );
92
+ }
93
+ if (value.options) {
94
+ const Component = value.options;
95
+ return /* @__PURE__ */ import_react3.default.createElement(import_store2.SyncSelect, { store: form.store, property: key }, /* @__PURE__ */ import_react3.default.createElement(Component, null));
96
+ }
97
+ return /* @__PURE__ */ import_react3.default.createElement(
98
+ import_store2.SyncInput,
99
+ {
100
+ store: form.store,
101
+ property: key,
102
+ type: value.type,
103
+ className: "input-form"
104
+ }
105
+ );
106
+ };
107
+ return /* @__PURE__ */ import_react3.default.createElement("label", { key }, value.label, createComponent());
108
+ })),
77
109
  form.item && /* @__PURE__ */ import_react3.default.createElement(
78
110
  "button",
79
111
  {
@@ -9,35 +9,67 @@ function useFormContext() {
9
9
  }
10
10
 
11
11
  // src/crud/crud_form.tsx
12
- import { SyncInput } from "dn-react-toolkit/store";
12
+ import { SyncInput, SyncSelect, SyncSwitch } from "dn-react-toolkit/store";
13
13
  import React2 from "react";
14
+ import { moment } from "dn-react-toolkit/utils";
14
15
  function CrudForm({ AdminLayout }) {
15
16
  const form = useFormContext();
16
17
  return /* @__PURE__ */ React2.createElement(
17
18
  AdminLayout,
18
19
  {
19
20
  title: `${form.name} ${form.item ? "\uC218\uC815" : "\uCD94\uAC00"}`,
20
- actions: /* @__PURE__ */ React2.createElement(
21
- "button",
22
- {
23
- type: "button",
24
- className: "button-primary",
25
- onClick: form.submit
26
- },
27
- "\uC800\uC7A5\uD558\uAE30"
28
- ),
21
+ actions: /* @__PURE__ */ React2.createElement("button", { type: "button", className: "button-primary", onClick: form.submit }, "\uC800\uC7A5\uD558\uAE30"),
29
22
  className: "max-w-3xl mx-auto"
30
23
  },
31
- Object.keys(form.columns).length > 0 && /* @__PURE__ */ React2.createElement(React2.Fragment, null, Object.entries(form.columns).map(
32
- ([key, value]) => /* @__PURE__ */ React2.createElement("label", { key }, value.label, value.component ? /* @__PURE__ */ React2.createElement(value.component, null) : /* @__PURE__ */ React2.createElement(
33
- SyncInput,
34
- {
35
- store: form.store,
36
- property: key,
37
- className: "input-form"
24
+ Object.keys(form.columns).length > 0 && /* @__PURE__ */ React2.createElement(React2.Fragment, null, Object.entries(
25
+ form.columns
26
+ ).map(([key, value]) => {
27
+ const createComponent = () => {
28
+ if (value.component) {
29
+ return /* @__PURE__ */ React2.createElement(value.component, { store: form.store, property: key });
38
30
  }
39
- ))
40
- )),
31
+ if (value.type === "checkbox") {
32
+ return /* @__PURE__ */ React2.createElement(SyncSwitch, { store: form.store, property: key });
33
+ }
34
+ if (value.type === "datetime") {
35
+ return /* @__PURE__ */ React2.createElement(
36
+ SyncInput,
37
+ {
38
+ store: form.store,
39
+ property: key,
40
+ className: "input-form",
41
+ type: "datetime-local",
42
+ serializer: (value2) => {
43
+ if (value2 instanceof Date) {
44
+ return moment(value2).toISOString(true).slice(0, 16);
45
+ }
46
+ return String(value2);
47
+ },
48
+ deserializer: (value2) => {
49
+ if (!value2) {
50
+ return void 0;
51
+ }
52
+ return moment(value2).toDate();
53
+ }
54
+ }
55
+ );
56
+ }
57
+ if (value.options) {
58
+ const Component = value.options;
59
+ return /* @__PURE__ */ React2.createElement(SyncSelect, { store: form.store, property: key }, /* @__PURE__ */ React2.createElement(Component, null));
60
+ }
61
+ return /* @__PURE__ */ React2.createElement(
62
+ SyncInput,
63
+ {
64
+ store: form.store,
65
+ property: key,
66
+ type: value.type,
67
+ className: "input-form"
68
+ }
69
+ );
70
+ };
71
+ return /* @__PURE__ */ React2.createElement("label", { key }, value.label, createComponent());
72
+ })),
41
73
  form.item && /* @__PURE__ */ React2.createElement(
42
74
  "button",
43
75
  {
@@ -1,16 +1,20 @@
1
1
  import { RxStore } from 'dn-react-toolkit/store';
2
- import { PgTableWithColumns } from 'drizzle-orm/pg-core';
3
2
  import React from 'react';
4
3
 
5
4
  type FormState<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof TModel ? "id" : never> = Omit<TModel, TPrimaryKey> & {
6
5
  [K in TPrimaryKey]?: TModel[K];
7
6
  };
8
- type FormColumnValue = {
7
+ type FormColumnValue<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof TModel ? "id" : never> = {
9
8
  label: string;
10
- component?: React.FC;
9
+ type?: React.HTMLInputTypeAttribute;
10
+ component?: React.FC<{
11
+ store: RxStore<FormState<TModel, TPrimaryKey>>;
12
+ property: string;
13
+ }>;
14
+ options?: React.FC;
11
15
  };
12
- type FormColumns<T> = Partial<{
13
- [K in T extends PgTableWithColumns<infer U> ? keyof U["columns"] : never]: FormColumnValue;
16
+ type FormColumns<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof TModel ? "id" : never> = Partial<{
17
+ [K in keyof TModel]: FormColumnValue<TModel, TPrimaryKey>;
14
18
  }>;
15
19
  declare const FormContext: React.Context<{}>;
16
20
  declare function useFormContext<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof TModel ? "id" : never>(): {
@@ -26,7 +30,7 @@ type CrudFormProps<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof
26
30
  name: string;
27
31
  prefix: string;
28
32
  item?: TModel;
29
- columns?: FormColumns<TModel>;
33
+ columns?: FormColumns<TModel, TPrimaryKey>;
30
34
  children?: React.ReactNode;
31
35
  };
32
36
  declare function CrudFormProvider<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof TModel ? "id" : never>({ primaryKey, name, prefix, item, columns, children, }: CrudFormProps<TModel, TPrimaryKey>): React.JSX.Element;
@@ -1,16 +1,20 @@
1
1
  import { RxStore } from 'dn-react-toolkit/store';
2
- import { PgTableWithColumns } from 'drizzle-orm/pg-core';
3
2
  import React from 'react';
4
3
 
5
4
  type FormState<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof TModel ? "id" : never> = Omit<TModel, TPrimaryKey> & {
6
5
  [K in TPrimaryKey]?: TModel[K];
7
6
  };
8
- type FormColumnValue = {
7
+ type FormColumnValue<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof TModel ? "id" : never> = {
9
8
  label: string;
10
- component?: React.FC;
9
+ type?: React.HTMLInputTypeAttribute;
10
+ component?: React.FC<{
11
+ store: RxStore<FormState<TModel, TPrimaryKey>>;
12
+ property: string;
13
+ }>;
14
+ options?: React.FC;
11
15
  };
12
- type FormColumns<T> = Partial<{
13
- [K in T extends PgTableWithColumns<infer U> ? keyof U["columns"] : never]: FormColumnValue;
16
+ type FormColumns<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof TModel ? "id" : never> = Partial<{
17
+ [K in keyof TModel]: FormColumnValue<TModel, TPrimaryKey>;
14
18
  }>;
15
19
  declare const FormContext: React.Context<{}>;
16
20
  declare function useFormContext<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof TModel ? "id" : never>(): {
@@ -26,7 +30,7 @@ type CrudFormProps<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof
26
30
  name: string;
27
31
  prefix: string;
28
32
  item?: TModel;
29
- columns?: FormColumns<TModel>;
33
+ columns?: FormColumns<TModel, TPrimaryKey>;
30
34
  children?: React.ReactNode;
31
35
  };
32
36
  declare function CrudFormProvider<TModel, TPrimaryKey extends keyof TModel = "id" extends keyof TModel ? "id" : never>({ primaryKey, name, prefix, item, columns, children, }: CrudFormProps<TModel, TPrimaryKey>): React.JSX.Element;
@@ -63,58 +63,56 @@ function CrudFormProvider({
63
63
  "Content-Type": "application/json"
64
64
  },
65
65
  body: JSON.stringify(
66
- Object.entries(store.state).reduce(
67
- function reducer(acc, [key, value]) {
68
- const converter = (value2) => {
69
- if (value2 === void 0) {
70
- return void 0;
71
- }
72
- if (value2 === null) {
73
- return {
74
- type: "null",
75
- value: null
76
- };
77
- }
78
- if (typeof value2 === "string") {
79
- return {
80
- type: "string",
81
- value: value2
82
- };
83
- }
84
- if (typeof value2 === "number") {
85
- return {
86
- type: "number",
87
- value: value2
88
- };
89
- }
90
- if (typeof value2 === "boolean") {
91
- return {
92
- type: "boolean",
93
- value: value2
94
- };
95
- }
96
- if (value2 instanceof Date) {
97
- return {
98
- type: "date",
99
- value: value2.toISOString()
100
- };
101
- }
102
- if (Array.isArray(value2)) {
103
- return value2.map((v) => converter(v));
104
- }
105
- if (typeof value2 === "object") {
106
- return Object.entries(
107
- value2
108
- ).reduce(reducer, {});
109
- }
110
- };
111
- return {
112
- ...acc,
113
- [key]: converter(value)
114
- };
115
- },
116
- {}
117
- )
66
+ Object.entries(store.state).reduce(function reducer(acc, [key, value]) {
67
+ const converter = (value2) => {
68
+ if (value2 === void 0) {
69
+ return void 0;
70
+ }
71
+ if (value2 === null) {
72
+ return {
73
+ type: "null",
74
+ value: null
75
+ };
76
+ }
77
+ if (typeof value2 === "string") {
78
+ return {
79
+ type: "string",
80
+ value: value2
81
+ };
82
+ }
83
+ if (typeof value2 === "number") {
84
+ return {
85
+ type: "number",
86
+ value: value2
87
+ };
88
+ }
89
+ if (typeof value2 === "boolean") {
90
+ return {
91
+ type: "boolean",
92
+ value: value2
93
+ };
94
+ }
95
+ if (value2 instanceof Date) {
96
+ return {
97
+ type: "date",
98
+ value: value2.toISOString()
99
+ };
100
+ }
101
+ if (Array.isArray(value2)) {
102
+ return value2.map((v) => converter(v));
103
+ }
104
+ if (typeof value2 === "object") {
105
+ return Object.entries(value2).reduce(
106
+ reducer,
107
+ {}
108
+ );
109
+ }
110
+ };
111
+ return {
112
+ ...acc,
113
+ [key]: converter(value)
114
+ };
115
+ }, {})
118
116
  )
119
117
  });
120
118
  if (!res.ok) {
@@ -27,58 +27,56 @@ function CrudFormProvider({
27
27
  "Content-Type": "application/json"
28
28
  },
29
29
  body: JSON.stringify(
30
- Object.entries(store.state).reduce(
31
- function reducer(acc, [key, value]) {
32
- const converter = (value2) => {
33
- if (value2 === void 0) {
34
- return void 0;
35
- }
36
- if (value2 === null) {
37
- return {
38
- type: "null",
39
- value: null
40
- };
41
- }
42
- if (typeof value2 === "string") {
43
- return {
44
- type: "string",
45
- value: value2
46
- };
47
- }
48
- if (typeof value2 === "number") {
49
- return {
50
- type: "number",
51
- value: value2
52
- };
53
- }
54
- if (typeof value2 === "boolean") {
55
- return {
56
- type: "boolean",
57
- value: value2
58
- };
59
- }
60
- if (value2 instanceof Date) {
61
- return {
62
- type: "date",
63
- value: value2.toISOString()
64
- };
65
- }
66
- if (Array.isArray(value2)) {
67
- return value2.map((v) => converter(v));
68
- }
69
- if (typeof value2 === "object") {
70
- return Object.entries(
71
- value2
72
- ).reduce(reducer, {});
73
- }
74
- };
75
- return {
76
- ...acc,
77
- [key]: converter(value)
78
- };
79
- },
80
- {}
81
- )
30
+ Object.entries(store.state).reduce(function reducer(acc, [key, value]) {
31
+ const converter = (value2) => {
32
+ if (value2 === void 0) {
33
+ return void 0;
34
+ }
35
+ if (value2 === null) {
36
+ return {
37
+ type: "null",
38
+ value: null
39
+ };
40
+ }
41
+ if (typeof value2 === "string") {
42
+ return {
43
+ type: "string",
44
+ value: value2
45
+ };
46
+ }
47
+ if (typeof value2 === "number") {
48
+ return {
49
+ type: "number",
50
+ value: value2
51
+ };
52
+ }
53
+ if (typeof value2 === "boolean") {
54
+ return {
55
+ type: "boolean",
56
+ value: value2
57
+ };
58
+ }
59
+ if (value2 instanceof Date) {
60
+ return {
61
+ type: "date",
62
+ value: value2.toISOString()
63
+ };
64
+ }
65
+ if (Array.isArray(value2)) {
66
+ return value2.map((v) => converter(v));
67
+ }
68
+ if (typeof value2 === "object") {
69
+ return Object.entries(value2).reduce(
70
+ reducer,
71
+ {}
72
+ );
73
+ }
74
+ };
75
+ return {
76
+ ...acc,
77
+ [key]: converter(value)
78
+ };
79
+ }, {})
82
80
  )
83
81
  });
84
82
  if (!res.ok) {
@@ -1,4 +1,4 @@
1
- import { LoaderFunctionArgs } from 'react-router';
1
+ import { LoaderFunction, LoaderFunctionArgs } from 'react-router';
2
2
  import { TableLoaderOptions } from '../table/loader.mjs';
3
3
  import { TableItemLoaderOptions } from '../table/item_loader.mjs';
4
4
  import { Table } from 'drizzle-orm';
@@ -12,10 +12,14 @@ import 'dn-react-toolkit/auth/server';
12
12
  type CrudHandlerOptions<T extends Table, TSelect> = {
13
13
  repository: TableRepository<T, TSelect>;
14
14
  apiHandlerOptions: Omit<APIHandlerOptions<T, TSelect>, "repository">;
15
- loaderOptions: Omit<TableLoaderOptions<T, TSelect>, "repository">;
16
- itemLoaderOptions: Omit<TableItemLoaderOptions<T, TSelect>, "repository">;
15
+ loaderOptions: Omit<TableLoaderOptions<T, TSelect>, "repository"> & {
16
+ loader?: LoaderFunction;
17
+ };
18
+ itemLoaderOptions: Omit<TableItemLoaderOptions<T, TSelect>, "repository"> & {
19
+ loader?: LoaderFunction;
20
+ };
17
21
  };
18
22
  type CrudHandler = (prefix: string) => (args: LoaderFunctionArgs) => Promise<any>;
19
- declare function crudHandler<T extends Table, TSelect>({ repository, apiHandlerOptions, loaderOptions, itemLoaderOptions, }: CrudHandlerOptions<T, TSelect>): (prefix: string) => (args: LoaderFunctionArgs) => Promise<any>;
23
+ declare function crudHandler<T extends Table, TSelect>({ repository, apiHandlerOptions, loaderOptions, itemLoaderOptions, }: CrudHandlerOptions<T, TSelect>): (prefix: string) => (args: LoaderFunctionArgs) => Promise<unknown>;
20
24
 
21
25
  export { type CrudHandler, type CrudHandlerOptions, crudHandler };
@@ -1,4 +1,4 @@
1
- import { LoaderFunctionArgs } from 'react-router';
1
+ import { LoaderFunction, LoaderFunctionArgs } from 'react-router';
2
2
  import { TableLoaderOptions } from '../table/loader.js';
3
3
  import { TableItemLoaderOptions } from '../table/item_loader.js';
4
4
  import { Table } from 'drizzle-orm';
@@ -12,10 +12,14 @@ import 'dn-react-toolkit/auth/server';
12
12
  type CrudHandlerOptions<T extends Table, TSelect> = {
13
13
  repository: TableRepository<T, TSelect>;
14
14
  apiHandlerOptions: Omit<APIHandlerOptions<T, TSelect>, "repository">;
15
- loaderOptions: Omit<TableLoaderOptions<T, TSelect>, "repository">;
16
- itemLoaderOptions: Omit<TableItemLoaderOptions<T, TSelect>, "repository">;
15
+ loaderOptions: Omit<TableLoaderOptions<T, TSelect>, "repository"> & {
16
+ loader?: LoaderFunction;
17
+ };
18
+ itemLoaderOptions: Omit<TableItemLoaderOptions<T, TSelect>, "repository"> & {
19
+ loader?: LoaderFunction;
20
+ };
17
21
  };
18
22
  type CrudHandler = (prefix: string) => (args: LoaderFunctionArgs) => Promise<any>;
19
- declare function crudHandler<T extends Table, TSelect>({ repository, apiHandlerOptions, loaderOptions, itemLoaderOptions, }: CrudHandlerOptions<T, TSelect>): (prefix: string) => (args: LoaderFunctionArgs) => Promise<any>;
23
+ declare function crudHandler<T extends Table, TSelect>({ repository, apiHandlerOptions, loaderOptions, itemLoaderOptions, }: CrudHandlerOptions<T, TSelect>): (prefix: string) => (args: LoaderFunctionArgs) => Promise<unknown>;
20
24
 
21
25
  export { type CrudHandler, type CrudHandlerOptions, crudHandler };
@@ -69,24 +69,16 @@ function tableLoader({
69
69
 
70
70
  // src/table/item_loader.tsx
71
71
  var tableItemloader = ({
72
- loader,
73
72
  repository
74
73
  }) => {
75
- return async ({ params }) => {
76
- const body = loader ? await (async () => {
77
- const result = await loader({ params });
78
- if (result instanceof Response) {
79
- return result.json();
80
- }
81
- return result;
82
- })() : {};
74
+ return async (args) => {
75
+ const { params } = args;
83
76
  if (params["itemId"] === "new") {
84
- return { item: void 0, ...body };
77
+ return { item: void 0 };
85
78
  }
86
79
  const item = params["itemId"] ? await repository.find(params["itemId"]) : void 0;
87
80
  return {
88
- item,
89
- ...body
81
+ item
90
82
  };
91
83
  };
92
84
  };
@@ -272,13 +264,35 @@ function crudHandler({
272
264
  }
273
265
  }
274
266
  if (pattern === prefix) {
275
- return tableLoader({
267
+ const body = await tableLoader({
276
268
  ...loaderOptions,
277
269
  repository
278
270
  })(args);
271
+ if (loaderOptions.loader) {
272
+ const result = await loaderOptions.loader(args);
273
+ if (typeof result === "object") {
274
+ return {
275
+ ...result,
276
+ ...body
277
+ };
278
+ }
279
+ }
280
+ return body;
279
281
  }
280
282
  if (pattern.startsWith(prefix)) {
281
- return tableItemloader({ ...itemLoaderOptions, repository })(args);
283
+ const body = await tableItemloader({ ...itemLoaderOptions, repository })(
284
+ args
285
+ );
286
+ if (itemLoaderOptions.loader) {
287
+ const result = await itemLoaderOptions.loader(args);
288
+ if (typeof result === "object") {
289
+ return {
290
+ ...result,
291
+ ...body
292
+ };
293
+ }
294
+ }
295
+ return body;
282
296
  }
283
297
  };
284
298
  }
@@ -46,24 +46,16 @@ function tableLoader({
46
46
 
47
47
  // src/table/item_loader.tsx
48
48
  var tableItemloader = ({
49
- loader,
50
49
  repository
51
50
  }) => {
52
- return async ({ params }) => {
53
- const body = loader ? await (async () => {
54
- const result = await loader({ params });
55
- if (result instanceof Response) {
56
- return result.json();
57
- }
58
- return result;
59
- })() : {};
51
+ return async (args) => {
52
+ const { params } = args;
60
53
  if (params["itemId"] === "new") {
61
- return { item: void 0, ...body };
54
+ return { item: void 0 };
62
55
  }
63
56
  const item = params["itemId"] ? await repository.find(params["itemId"]) : void 0;
64
57
  return {
65
- item,
66
- ...body
58
+ item
67
59
  };
68
60
  };
69
61
  };
@@ -258,13 +250,35 @@ function crudHandler({
258
250
  }
259
251
  }
260
252
  if (pattern === prefix) {
261
- return tableLoader({
253
+ const body = await tableLoader({
262
254
  ...loaderOptions,
263
255
  repository
264
256
  })(args);
257
+ if (loaderOptions.loader) {
258
+ const result = await loaderOptions.loader(args);
259
+ if (typeof result === "object") {
260
+ return {
261
+ ...result,
262
+ ...body
263
+ };
264
+ }
265
+ }
266
+ return body;
265
267
  }
266
268
  if (pattern.startsWith(prefix)) {
267
- return tableItemloader({ ...itemLoaderOptions, repository })(args);
269
+ const body = await tableItemloader({ ...itemLoaderOptions, repository })(
270
+ args
271
+ );
272
+ if (itemLoaderOptions.loader) {
273
+ const result = await itemLoaderOptions.loader(args);
274
+ if (typeof result === "object") {
275
+ return {
276
+ ...result,
277
+ ...body
278
+ };
279
+ }
280
+ }
281
+ return body;
268
282
  }
269
283
  };
270
284
  }
@@ -2,7 +2,6 @@ import { CrudFormProps } from './crud_form_provider.mjs';
2
2
  import { TablePageOptions } from '../table/page.mjs';
3
3
  import React from 'react';
4
4
  import 'dn-react-toolkit/store';
5
- import 'drizzle-orm/pg-core';
6
5
  import '../table/table.mjs';
7
6
 
8
7
  type CrudPageOptions<TModel, TPrimaryKey extends keyof TModel> = {