dn-react-router-toolkit 0.7.14 → 0.8.0
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 -4
- package/dist/api/create_api_handler.d.ts +5 -4
- package/dist/api/create_api_handler.js +0 -1
- package/dist/api/create_api_handler.mjs +0 -1
- package/dist/api/index.d.mts +1 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +0 -2
- package/dist/api/index.mjs +0 -2
- package/dist/api/item_api_handler.d.mts +5 -4
- package/dist/api/item_api_handler.d.ts +5 -4
- package/dist/api/item_api_handler.js +0 -1
- package/dist/api/item_api_handler.mjs +0 -1
- package/dist/auth/cookie_manager.d.mts +2 -1
- package/dist/auth/cookie_manager.d.ts +2 -1
- package/dist/auth/cookie_manager.js +9 -3
- package/dist/auth/cookie_manager.mjs +9 -3
- package/dist/auth/index.js +9 -3
- package/dist/auth/index.mjs +9 -3
- package/dist/crud/crud_form.js +1 -1
- package/dist/crud/crud_form.mjs +1 -1
- package/dist/crud/crud_loader.d.mts +6 -5
- package/dist/crud/crud_loader.d.ts +6 -5
- package/dist/crud/crud_loader.js +46 -34
- package/dist/crud/crud_loader.mjs +46 -34
- package/dist/crud/crud_page.d.mts +3 -2
- package/dist/crud/crud_page.d.ts +3 -2
- package/dist/crud/crud_page.js +226 -198
- package/dist/crud/crud_page.mjs +224 -202
- package/dist/crud/generate_handlers.d.mts +3 -2
- package/dist/crud/generate_handlers.d.ts +3 -2
- package/dist/crud/generate_pages.d.mts +2 -1
- package/dist/crud/generate_pages.d.ts +2 -1
- package/dist/crud/index.d.mts +5 -3
- package/dist/crud/index.d.ts +5 -3
- package/dist/crud/index.js +246 -206
- package/dist/crud/index.mjs +252 -218
- package/dist/post/index.js +65 -58
- package/dist/post/index.mjs +68 -67
- package/dist/post/post_form_page.js +65 -58
- package/dist/post/post_form_page.mjs +68 -67
- package/dist/table/index.d.mts +7 -3
- package/dist/table/index.d.ts +7 -3
- package/dist/table/index.js +153 -105
- package/dist/table/index.mjs +149 -110
- package/dist/table/item_loader.d.mts +5 -4
- package/dist/table/item_loader.d.ts +5 -4
- package/dist/table/load_table.d.mts +30 -0
- package/dist/table/load_table.d.ts +30 -0
- package/dist/table/load_table.js +67 -0
- package/dist/table/load_table.mjs +45 -0
- package/dist/table/loader.d.mts +7 -15
- package/dist/table/loader.d.ts +7 -15
- package/dist/table/loader.js +47 -31
- package/dist/table/loader.mjs +46 -32
- package/dist/table/page.d.mts +6 -16
- package/dist/table/page.d.ts +6 -16
- package/dist/table/page.js +193 -165
- package/dist/table/page.mjs +194 -172
- package/dist/table/repository.d.mts +13 -11
- package/dist/table/repository.d.ts +13 -11
- package/dist/table/repository.js +1 -1
- package/dist/table/repository.mjs +1 -1
- package/dist/table/table_form.d.mts +13 -0
- package/dist/table/table_form.d.ts +13 -0
- package/dist/table/table_form.js +295 -0
- package/dist/table/table_form.mjs +270 -0
- package/dist/table/use_table.d.mts +4 -0
- package/dist/table/use_table.d.ts +4 -0
- package/dist/table/use_table.js +43 -0
- package/dist/table/use_table.mjs +18 -0
- package/package.json +3 -3
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SQLWrapper, InferSelectModel } from 'drizzle-orm';
|
|
2
|
+
import { TableRepository, ColumnOf } from './repository.mjs';
|
|
3
|
+
import { PgTableWithColumns } from 'drizzle-orm/pg-core';
|
|
4
|
+
import 'drizzle-orm/node-postgres';
|
|
5
|
+
|
|
6
|
+
type TableOptions<T extends PgTableWithColumns<any>> = {
|
|
7
|
+
where?: SQLWrapper[];
|
|
8
|
+
searchKey?: ColumnOf<T>;
|
|
9
|
+
defaultOrderBy: keyof InferSelectModel<T>;
|
|
10
|
+
defaultDirection: "asc" | "desc";
|
|
11
|
+
};
|
|
12
|
+
type TableLoaderOptions<T extends PgTableWithColumns<any>, TSelect> = {
|
|
13
|
+
repository: TableRepository<T, TSelect>;
|
|
14
|
+
options: TableOptions<T>;
|
|
15
|
+
};
|
|
16
|
+
declare function loadTable<T extends PgTableWithColumns<any>, TSelect>({ request, repository, options, }: {
|
|
17
|
+
request: Request;
|
|
18
|
+
repository: TableRepository<T, TSelect>;
|
|
19
|
+
options: TableOptions<T>;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
items: TSelect[];
|
|
22
|
+
total: number;
|
|
23
|
+
limit: number;
|
|
24
|
+
offset: number;
|
|
25
|
+
orderBy: keyof T["_"]["columns"] & string;
|
|
26
|
+
direction: "asc" | "desc";
|
|
27
|
+
searchKey: ColumnOf<T> | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
export { type TableLoaderOptions, loadTable };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SQLWrapper, InferSelectModel } from 'drizzle-orm';
|
|
2
|
+
import { TableRepository, ColumnOf } from './repository.js';
|
|
3
|
+
import { PgTableWithColumns } from 'drizzle-orm/pg-core';
|
|
4
|
+
import 'drizzle-orm/node-postgres';
|
|
5
|
+
|
|
6
|
+
type TableOptions<T extends PgTableWithColumns<any>> = {
|
|
7
|
+
where?: SQLWrapper[];
|
|
8
|
+
searchKey?: ColumnOf<T>;
|
|
9
|
+
defaultOrderBy: keyof InferSelectModel<T>;
|
|
10
|
+
defaultDirection: "asc" | "desc";
|
|
11
|
+
};
|
|
12
|
+
type TableLoaderOptions<T extends PgTableWithColumns<any>, TSelect> = {
|
|
13
|
+
repository: TableRepository<T, TSelect>;
|
|
14
|
+
options: TableOptions<T>;
|
|
15
|
+
};
|
|
16
|
+
declare function loadTable<T extends PgTableWithColumns<any>, TSelect>({ request, repository, options, }: {
|
|
17
|
+
request: Request;
|
|
18
|
+
repository: TableRepository<T, TSelect>;
|
|
19
|
+
options: TableOptions<T>;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
items: TSelect[];
|
|
22
|
+
total: number;
|
|
23
|
+
limit: number;
|
|
24
|
+
offset: number;
|
|
25
|
+
orderBy: keyof T["_"]["columns"] & string;
|
|
26
|
+
direction: "asc" | "desc";
|
|
27
|
+
searchKey: ColumnOf<T> | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
export { type TableLoaderOptions, loadTable };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/table/load_table.tsx
|
|
21
|
+
var load_table_exports = {};
|
|
22
|
+
__export(load_table_exports, {
|
|
23
|
+
loadTable: () => loadTable
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(load_table_exports);
|
|
26
|
+
var import_drizzle_orm = require("drizzle-orm");
|
|
27
|
+
async function loadTable({
|
|
28
|
+
request,
|
|
29
|
+
repository,
|
|
30
|
+
options
|
|
31
|
+
}) {
|
|
32
|
+
const searchParams = new URL(request.url).searchParams;
|
|
33
|
+
const { where, searchKey, defaultOrderBy, defaultDirection } = options;
|
|
34
|
+
const query = searchParams.get("query") ?? void 0;
|
|
35
|
+
const limit = Number(searchParams.get("limit") ?? "20");
|
|
36
|
+
const offset = Number(searchParams.get("offset") ?? "0");
|
|
37
|
+
const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
|
|
38
|
+
const direction = searchParams.get("direction") ?? defaultDirection;
|
|
39
|
+
const whereClauses = (0, import_drizzle_orm.and)(
|
|
40
|
+
searchKey && query ? (0, import_drizzle_orm.ilike)(
|
|
41
|
+
repository.schema[searchKey],
|
|
42
|
+
`%${query}%`
|
|
43
|
+
) : void 0,
|
|
44
|
+
...where ?? []
|
|
45
|
+
);
|
|
46
|
+
const total = await repository.countTotal({ where: whereClauses });
|
|
47
|
+
const items = await repository.findAll({
|
|
48
|
+
orderBy,
|
|
49
|
+
direction,
|
|
50
|
+
limit,
|
|
51
|
+
offset,
|
|
52
|
+
where: whereClauses
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
items,
|
|
56
|
+
total,
|
|
57
|
+
limit,
|
|
58
|
+
offset,
|
|
59
|
+
orderBy,
|
|
60
|
+
direction,
|
|
61
|
+
searchKey
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
loadTable
|
|
67
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/table/load_table.tsx
|
|
2
|
+
import {
|
|
3
|
+
and,
|
|
4
|
+
ilike
|
|
5
|
+
} from "drizzle-orm";
|
|
6
|
+
async function loadTable({
|
|
7
|
+
request,
|
|
8
|
+
repository,
|
|
9
|
+
options
|
|
10
|
+
}) {
|
|
11
|
+
const searchParams = new URL(request.url).searchParams;
|
|
12
|
+
const { where, searchKey, defaultOrderBy, defaultDirection } = options;
|
|
13
|
+
const query = searchParams.get("query") ?? void 0;
|
|
14
|
+
const limit = Number(searchParams.get("limit") ?? "20");
|
|
15
|
+
const offset = Number(searchParams.get("offset") ?? "0");
|
|
16
|
+
const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
|
|
17
|
+
const direction = searchParams.get("direction") ?? defaultDirection;
|
|
18
|
+
const whereClauses = and(
|
|
19
|
+
searchKey && query ? ilike(
|
|
20
|
+
repository.schema[searchKey],
|
|
21
|
+
`%${query}%`
|
|
22
|
+
) : void 0,
|
|
23
|
+
...where ?? []
|
|
24
|
+
);
|
|
25
|
+
const total = await repository.countTotal({ where: whereClauses });
|
|
26
|
+
const items = await repository.findAll({
|
|
27
|
+
orderBy,
|
|
28
|
+
direction,
|
|
29
|
+
limit,
|
|
30
|
+
offset,
|
|
31
|
+
where: whereClauses
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
items,
|
|
35
|
+
total,
|
|
36
|
+
limit,
|
|
37
|
+
offset,
|
|
38
|
+
orderBy,
|
|
39
|
+
direction,
|
|
40
|
+
searchKey
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
loadTable
|
|
45
|
+
};
|
package/dist/table/loader.d.mts
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
+
import { ColumnOf } from './repository.mjs';
|
|
1
2
|
import { LoaderFunctionArgs } from 'react-router';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import 'drizzle-orm
|
|
3
|
+
import { TableLoaderOptions } from './load_table.mjs';
|
|
4
|
+
import { PgTableWithColumns } from 'drizzle-orm/pg-core';
|
|
5
|
+
import 'drizzle-orm';
|
|
6
|
+
import 'drizzle-orm/node-postgres';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
where?: SQLWrapper[];
|
|
8
|
-
searchKey?: ColumnOf<T>;
|
|
9
|
-
defaultOrderBy: keyof InferSelectModel<T>;
|
|
10
|
-
defaultDirection: "asc" | "desc";
|
|
11
|
-
};
|
|
12
|
-
type TableLoaderOptions<T extends Table, TSelect> = {
|
|
13
|
-
repository: TableRepository<T, TSelect>;
|
|
14
|
-
tableOptions: TableOptions<T>;
|
|
15
|
-
};
|
|
16
|
-
declare function tableLoader<T extends Table, TSelect>({ repository, tableOptions, }: TableLoaderOptions<T, TSelect>): ({ request }: LoaderFunctionArgs) => Promise<{
|
|
8
|
+
declare function tableLoader<T extends PgTableWithColumns<any>, TSelect>({ repository, options, }: TableLoaderOptions<T, TSelect>): ({ request }: LoaderFunctionArgs) => Promise<{
|
|
17
9
|
table: {
|
|
18
10
|
items: TSelect[];
|
|
19
11
|
total: number;
|
|
@@ -25,4 +17,4 @@ declare function tableLoader<T extends Table, TSelect>({ repository, tableOption
|
|
|
25
17
|
};
|
|
26
18
|
}>;
|
|
27
19
|
|
|
28
|
-
export {
|
|
20
|
+
export { tableLoader };
|
package/dist/table/loader.d.ts
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
+
import { ColumnOf } from './repository.js';
|
|
1
2
|
import { LoaderFunctionArgs } from 'react-router';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import 'drizzle-orm
|
|
3
|
+
import { TableLoaderOptions } from './load_table.js';
|
|
4
|
+
import { PgTableWithColumns } from 'drizzle-orm/pg-core';
|
|
5
|
+
import 'drizzle-orm';
|
|
6
|
+
import 'drizzle-orm/node-postgres';
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
where?: SQLWrapper[];
|
|
8
|
-
searchKey?: ColumnOf<T>;
|
|
9
|
-
defaultOrderBy: keyof InferSelectModel<T>;
|
|
10
|
-
defaultDirection: "asc" | "desc";
|
|
11
|
-
};
|
|
12
|
-
type TableLoaderOptions<T extends Table, TSelect> = {
|
|
13
|
-
repository: TableRepository<T, TSelect>;
|
|
14
|
-
tableOptions: TableOptions<T>;
|
|
15
|
-
};
|
|
16
|
-
declare function tableLoader<T extends Table, TSelect>({ repository, tableOptions, }: TableLoaderOptions<T, TSelect>): ({ request }: LoaderFunctionArgs) => Promise<{
|
|
8
|
+
declare function tableLoader<T extends PgTableWithColumns<any>, TSelect>({ repository, options, }: TableLoaderOptions<T, TSelect>): ({ request }: LoaderFunctionArgs) => Promise<{
|
|
17
9
|
table: {
|
|
18
10
|
items: TSelect[];
|
|
19
11
|
total: number;
|
|
@@ -25,4 +17,4 @@ declare function tableLoader<T extends Table, TSelect>({ repository, tableOption
|
|
|
25
17
|
};
|
|
26
18
|
}>;
|
|
27
19
|
|
|
28
|
-
export {
|
|
20
|
+
export { tableLoader };
|
package/dist/table/loader.js
CHANGED
|
@@ -23,44 +23,60 @@ __export(loader_exports, {
|
|
|
23
23
|
tableLoader: () => tableLoader
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(loader_exports);
|
|
26
|
+
|
|
27
|
+
// src/table/load_table.tsx
|
|
26
28
|
var import_drizzle_orm = require("drizzle-orm");
|
|
29
|
+
async function loadTable({
|
|
30
|
+
request,
|
|
31
|
+
repository,
|
|
32
|
+
options
|
|
33
|
+
}) {
|
|
34
|
+
const searchParams = new URL(request.url).searchParams;
|
|
35
|
+
const { where, searchKey, defaultOrderBy, defaultDirection } = options;
|
|
36
|
+
const query = searchParams.get("query") ?? void 0;
|
|
37
|
+
const limit = Number(searchParams.get("limit") ?? "20");
|
|
38
|
+
const offset = Number(searchParams.get("offset") ?? "0");
|
|
39
|
+
const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
|
|
40
|
+
const direction = searchParams.get("direction") ?? defaultDirection;
|
|
41
|
+
const whereClauses = (0, import_drizzle_orm.and)(
|
|
42
|
+
searchKey && query ? (0, import_drizzle_orm.ilike)(
|
|
43
|
+
repository.schema[searchKey],
|
|
44
|
+
`%${query}%`
|
|
45
|
+
) : void 0,
|
|
46
|
+
...where ?? []
|
|
47
|
+
);
|
|
48
|
+
const total = await repository.countTotal({ where: whereClauses });
|
|
49
|
+
const items = await repository.findAll({
|
|
50
|
+
orderBy,
|
|
51
|
+
direction,
|
|
52
|
+
limit,
|
|
53
|
+
offset,
|
|
54
|
+
where: whereClauses
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
items,
|
|
58
|
+
total,
|
|
59
|
+
limit,
|
|
60
|
+
offset,
|
|
61
|
+
orderBy,
|
|
62
|
+
direction,
|
|
63
|
+
searchKey
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/table/loader.tsx
|
|
27
68
|
function tableLoader({
|
|
28
69
|
repository,
|
|
29
|
-
|
|
70
|
+
options
|
|
30
71
|
}) {
|
|
31
72
|
return async ({ request }) => {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const offset = Number(searchParams.get("offset") ?? "0");
|
|
37
|
-
const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
|
|
38
|
-
const direction = searchParams.get("direction") ?? defaultDirection;
|
|
39
|
-
const whereClauses = (0, import_drizzle_orm.and)(
|
|
40
|
-
searchKey && query ? (0, import_drizzle_orm.ilike)(
|
|
41
|
-
repository.schema[searchKey],
|
|
42
|
-
`%${query}%`
|
|
43
|
-
) : void 0,
|
|
44
|
-
...where ?? []
|
|
45
|
-
);
|
|
46
|
-
const total = await repository.countTotal({ where: whereClauses });
|
|
47
|
-
const items = await repository.findAll({
|
|
48
|
-
orderBy,
|
|
49
|
-
direction,
|
|
50
|
-
limit,
|
|
51
|
-
offset,
|
|
52
|
-
where: whereClauses
|
|
73
|
+
const table = await loadTable({
|
|
74
|
+
request,
|
|
75
|
+
repository,
|
|
76
|
+
options
|
|
53
77
|
});
|
|
54
78
|
return {
|
|
55
|
-
table
|
|
56
|
-
items,
|
|
57
|
-
total,
|
|
58
|
-
limit,
|
|
59
|
-
offset,
|
|
60
|
-
orderBy,
|
|
61
|
-
direction,
|
|
62
|
-
searchKey
|
|
63
|
-
}
|
|
79
|
+
table
|
|
64
80
|
};
|
|
65
81
|
};
|
|
66
82
|
}
|
package/dist/table/loader.mjs
CHANGED
|
@@ -1,45 +1,59 @@
|
|
|
1
|
-
// src/table/
|
|
1
|
+
// src/table/load_table.tsx
|
|
2
2
|
import {
|
|
3
3
|
and,
|
|
4
4
|
ilike
|
|
5
5
|
} from "drizzle-orm";
|
|
6
|
+
async function loadTable({
|
|
7
|
+
request,
|
|
8
|
+
repository,
|
|
9
|
+
options
|
|
10
|
+
}) {
|
|
11
|
+
const searchParams = new URL(request.url).searchParams;
|
|
12
|
+
const { where, searchKey, defaultOrderBy, defaultDirection } = options;
|
|
13
|
+
const query = searchParams.get("query") ?? void 0;
|
|
14
|
+
const limit = Number(searchParams.get("limit") ?? "20");
|
|
15
|
+
const offset = Number(searchParams.get("offset") ?? "0");
|
|
16
|
+
const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
|
|
17
|
+
const direction = searchParams.get("direction") ?? defaultDirection;
|
|
18
|
+
const whereClauses = and(
|
|
19
|
+
searchKey && query ? ilike(
|
|
20
|
+
repository.schema[searchKey],
|
|
21
|
+
`%${query}%`
|
|
22
|
+
) : void 0,
|
|
23
|
+
...where ?? []
|
|
24
|
+
);
|
|
25
|
+
const total = await repository.countTotal({ where: whereClauses });
|
|
26
|
+
const items = await repository.findAll({
|
|
27
|
+
orderBy,
|
|
28
|
+
direction,
|
|
29
|
+
limit,
|
|
30
|
+
offset,
|
|
31
|
+
where: whereClauses
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
items,
|
|
35
|
+
total,
|
|
36
|
+
limit,
|
|
37
|
+
offset,
|
|
38
|
+
orderBy,
|
|
39
|
+
direction,
|
|
40
|
+
searchKey
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/table/loader.tsx
|
|
6
45
|
function tableLoader({
|
|
7
46
|
repository,
|
|
8
|
-
|
|
47
|
+
options
|
|
9
48
|
}) {
|
|
10
49
|
return async ({ request }) => {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const offset = Number(searchParams.get("offset") ?? "0");
|
|
16
|
-
const orderBy = searchParams.get("orderBy") ?? defaultOrderBy;
|
|
17
|
-
const direction = searchParams.get("direction") ?? defaultDirection;
|
|
18
|
-
const whereClauses = and(
|
|
19
|
-
searchKey && query ? ilike(
|
|
20
|
-
repository.schema[searchKey],
|
|
21
|
-
`%${query}%`
|
|
22
|
-
) : void 0,
|
|
23
|
-
...where ?? []
|
|
24
|
-
);
|
|
25
|
-
const total = await repository.countTotal({ where: whereClauses });
|
|
26
|
-
const items = await repository.findAll({
|
|
27
|
-
orderBy,
|
|
28
|
-
direction,
|
|
29
|
-
limit,
|
|
30
|
-
offset,
|
|
31
|
-
where: whereClauses
|
|
50
|
+
const table = await loadTable({
|
|
51
|
+
request,
|
|
52
|
+
repository,
|
|
53
|
+
options
|
|
32
54
|
});
|
|
33
55
|
return {
|
|
34
|
-
table
|
|
35
|
-
items,
|
|
36
|
-
total,
|
|
37
|
-
limit,
|
|
38
|
-
offset,
|
|
39
|
-
orderBy,
|
|
40
|
-
direction,
|
|
41
|
-
searchKey
|
|
42
|
-
}
|
|
56
|
+
table
|
|
43
57
|
};
|
|
44
58
|
};
|
|
45
59
|
}
|
package/dist/table/page.d.mts
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { TableColumnOptions } from './table.mjs';
|
|
3
2
|
import { FC, ReactNode } from 'react';
|
|
3
|
+
import { TablePageOptions } from './table_form.mjs';
|
|
4
|
+
import './table.mjs';
|
|
5
|
+
import './use_table.mjs';
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
items: TModel[];
|
|
7
|
-
total: number;
|
|
8
|
-
limit: number;
|
|
9
|
-
offset: number;
|
|
10
|
-
orderBy: string;
|
|
11
|
-
direction: string;
|
|
12
|
-
searchKey?: string;
|
|
13
|
-
};
|
|
14
|
-
type TablePageOptions<TModel> = {
|
|
7
|
+
declare function createTablePage<TModel>({ name, columns, primaryKey, }: TablePageOptions<TModel> & {
|
|
15
8
|
name: string;
|
|
16
|
-
|
|
17
|
-
primaryKey?: keyof TModel;
|
|
18
|
-
};
|
|
19
|
-
declare function createTablePage<TModel>({ name, columns, primaryKey, }: TablePageOptions<TModel>): ({ header: Header, }: {
|
|
9
|
+
}): ({ header: Header, }: {
|
|
20
10
|
header: FC<{
|
|
21
11
|
title: string;
|
|
22
12
|
actions?: ReactNode;
|
|
23
13
|
}>;
|
|
24
14
|
}) => react_jsx_runtime.JSX.Element;
|
|
25
15
|
|
|
26
|
-
export {
|
|
16
|
+
export { createTablePage };
|
package/dist/table/page.d.ts
CHANGED
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { TableColumnOptions } from './table.js';
|
|
3
2
|
import { FC, ReactNode } from 'react';
|
|
3
|
+
import { TablePageOptions } from './table_form.js';
|
|
4
|
+
import './table.js';
|
|
5
|
+
import './use_table.js';
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
items: TModel[];
|
|
7
|
-
total: number;
|
|
8
|
-
limit: number;
|
|
9
|
-
offset: number;
|
|
10
|
-
orderBy: string;
|
|
11
|
-
direction: string;
|
|
12
|
-
searchKey?: string;
|
|
13
|
-
};
|
|
14
|
-
type TablePageOptions<TModel> = {
|
|
7
|
+
declare function createTablePage<TModel>({ name, columns, primaryKey, }: TablePageOptions<TModel> & {
|
|
15
8
|
name: string;
|
|
16
|
-
|
|
17
|
-
primaryKey?: keyof TModel;
|
|
18
|
-
};
|
|
19
|
-
declare function createTablePage<TModel>({ name, columns, primaryKey, }: TablePageOptions<TModel>): ({ header: Header, }: {
|
|
9
|
+
}): ({ header: Header, }: {
|
|
20
10
|
header: FC<{
|
|
21
11
|
title: string;
|
|
22
12
|
actions?: ReactNode;
|
|
23
13
|
}>;
|
|
24
14
|
}) => react_jsx_runtime.JSX.Element;
|
|
25
15
|
|
|
26
|
-
export {
|
|
16
|
+
export { createTablePage };
|