@juv/codego-react-ui 3.0.6 → 3.0.8
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/index.cjs +118 -80
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.global.js +118 -80
- package/dist/index.js +118 -80
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4858,7 +4858,19 @@ function useServerDataGrid({ url, params }) {
|
|
|
4858
4858
|
import_axios.default.get(url, { params: { ...params, page: currentPage } }).then(({ data: res }) => {
|
|
4859
4859
|
if (cancelled) return;
|
|
4860
4860
|
setData(res.data);
|
|
4861
|
-
|
|
4861
|
+
const rawTotal = res.total;
|
|
4862
|
+
const rawPerPage = res.per_page;
|
|
4863
|
+
const lastPage = Math.ceil(rawTotal / rawPerPage);
|
|
4864
|
+
const pg = res.pagination ?? {
|
|
4865
|
+
first_page_url: res.first_page_url ?? `${url}?page=1`,
|
|
4866
|
+
last_page_url: res.last_page_url ?? `${url}?page=${lastPage}`,
|
|
4867
|
+
next_page_url: res.next_page_url !== void 0 ? res.next_page_url : currentPage < lastPage ? `${url}?page=${currentPage + 1}` : null,
|
|
4868
|
+
prev_page_url: res.prev_page_url !== void 0 ? res.prev_page_url : currentPage > 1 ? `${url}?page=${currentPage - 1}` : null,
|
|
4869
|
+
per_page: rawPerPage,
|
|
4870
|
+
total: rawTotal,
|
|
4871
|
+
links: res.links ?? []
|
|
4872
|
+
};
|
|
4873
|
+
setPagination(pg);
|
|
4862
4874
|
if (res.data.length > 0) {
|
|
4863
4875
|
setColumns(
|
|
4864
4876
|
Object.keys(res.data[0]).map((key) => ({
|
|
@@ -5358,45 +5370,52 @@ function DataGrid({
|
|
|
5358
5370
|
onPageChange: setPage
|
|
5359
5371
|
}
|
|
5360
5372
|
),
|
|
5361
|
-
serverPagination &&
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5373
|
+
serverPagination && (() => {
|
|
5374
|
+
const { pagination, currentPage: cp, goToPage } = serverPagination;
|
|
5375
|
+
const totalServerPages = Math.ceil(pagination.total / pagination.per_page);
|
|
5376
|
+
const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
|
|
5377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
5378
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
|
|
5379
|
+
pagination.total,
|
|
5380
|
+
" total rows \xB7 page ",
|
|
5381
|
+
cp,
|
|
5382
|
+
" of ",
|
|
5383
|
+
totalServerPages
|
|
5384
|
+
] }),
|
|
5385
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5386
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5387
|
+
"button",
|
|
5388
|
+
{
|
|
5389
|
+
onClick: () => goToPage(cp - 1),
|
|
5390
|
+
disabled: !pagination.prev_page_url,
|
|
5391
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
5392
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ChevronLeft, { className: "h-4 w-4" })
|
|
5393
|
+
}
|
|
5394
|
+
),
|
|
5395
|
+
pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5396
|
+
"button",
|
|
5397
|
+
{
|
|
5398
|
+
onClick: () => goToPage(p),
|
|
5399
|
+
className: cn(
|
|
5400
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
5401
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
5402
|
+
),
|
|
5403
|
+
children: p
|
|
5404
|
+
},
|
|
5405
|
+
p
|
|
5406
|
+
)),
|
|
5407
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5408
|
+
"button",
|
|
5409
|
+
{
|
|
5410
|
+
onClick: () => goToPage(cp + 1),
|
|
5411
|
+
disabled: !pagination.next_page_url,
|
|
5412
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
5413
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ChevronRight, { className: "h-4 w-4" })
|
|
5414
|
+
}
|
|
5415
|
+
)
|
|
5416
|
+
] })
|
|
5417
|
+
] });
|
|
5418
|
+
})(),
|
|
5400
5419
|
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
|
|
5401
5420
|
defaultActions && editItem && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5402
5421
|
DGEditModal,
|
|
@@ -9484,7 +9503,19 @@ function useServerTable({ url, params }) {
|
|
|
9484
9503
|
}).then(({ data: res }) => {
|
|
9485
9504
|
if (cancelled) return;
|
|
9486
9505
|
setData(res.data);
|
|
9487
|
-
|
|
9506
|
+
const rawTotal = res.total;
|
|
9507
|
+
const rawPerPage = res.per_page;
|
|
9508
|
+
const lastPage = Math.ceil(rawTotal / rawPerPage);
|
|
9509
|
+
const pg = res.pagination ?? {
|
|
9510
|
+
first_page_url: res.first_page_url ?? `${url}?page=1`,
|
|
9511
|
+
last_page_url: res.last_page_url ?? `${url}?page=${lastPage}`,
|
|
9512
|
+
next_page_url: res.next_page_url !== void 0 ? res.next_page_url : currentPage < lastPage ? `${url}?page=${currentPage + 1}` : null,
|
|
9513
|
+
prev_page_url: res.prev_page_url !== void 0 ? res.prev_page_url : currentPage > 1 ? `${url}?page=${currentPage - 1}` : null,
|
|
9514
|
+
per_page: rawPerPage,
|
|
9515
|
+
total: rawTotal,
|
|
9516
|
+
links: res.links ?? []
|
|
9517
|
+
};
|
|
9518
|
+
setPagination(pg);
|
|
9488
9519
|
if (res.data.length > 0) {
|
|
9489
9520
|
setColumns(
|
|
9490
9521
|
Object.keys(res.data[0]).map((key) => ({
|
|
@@ -10145,45 +10176,52 @@ function Table({
|
|
|
10145
10176
|
)
|
|
10146
10177
|
] })
|
|
10147
10178
|
] }),
|
|
10148
|
-
serverPagination &&
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
|
|
10174
|
-
|
|
10175
|
-
|
|
10176
|
-
|
|
10177
|
-
|
|
10178
|
-
|
|
10179
|
-
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
|
|
10184
|
-
|
|
10185
|
-
|
|
10186
|
-
|
|
10179
|
+
serverPagination && (() => {
|
|
10180
|
+
const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
|
|
10181
|
+
const totalServerPages = Math.ceil(pagination2.total / pagination2.per_page);
|
|
10182
|
+
const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
|
|
10183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
10184
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
|
|
10185
|
+
pagination2.total,
|
|
10186
|
+
" total rows \xB7 page ",
|
|
10187
|
+
cp,
|
|
10188
|
+
" of ",
|
|
10189
|
+
totalServerPages
|
|
10190
|
+
] }),
|
|
10191
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
10192
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
10193
|
+
"button",
|
|
10194
|
+
{
|
|
10195
|
+
onClick: () => goToPage(cp - 1),
|
|
10196
|
+
disabled: !pagination2.prev_page_url,
|
|
10197
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
10198
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react28.ChevronLeft, { className: "h-4 w-4" })
|
|
10199
|
+
}
|
|
10200
|
+
),
|
|
10201
|
+
pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
10202
|
+
"button",
|
|
10203
|
+
{
|
|
10204
|
+
onClick: () => goToPage(p),
|
|
10205
|
+
className: cn(
|
|
10206
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
10207
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
10208
|
+
),
|
|
10209
|
+
children: p
|
|
10210
|
+
},
|
|
10211
|
+
p
|
|
10212
|
+
)),
|
|
10213
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
10214
|
+
"button",
|
|
10215
|
+
{
|
|
10216
|
+
onClick: () => goToPage(cp + 1),
|
|
10217
|
+
disabled: !pagination2.next_page_url,
|
|
10218
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
10219
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react28.ChevronRight, { className: "h-4 w-4" })
|
|
10220
|
+
}
|
|
10221
|
+
)
|
|
10222
|
+
] })
|
|
10223
|
+
] });
|
|
10224
|
+
})()
|
|
10187
10225
|
] }),
|
|
10188
10226
|
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
10189
10227
|
ViewModal,
|
package/dist/index.d.cts
CHANGED
|
@@ -350,10 +350,10 @@ interface ServerPagination {
|
|
|
350
350
|
total: number;
|
|
351
351
|
links: ServerPaginationLink[];
|
|
352
352
|
}
|
|
353
|
-
interface ServerTableResponse<T> {
|
|
353
|
+
interface ServerTableResponse<T> extends ServerPagination {
|
|
354
354
|
current_page: number;
|
|
355
355
|
data: T[];
|
|
356
|
-
pagination
|
|
356
|
+
pagination?: ServerPagination;
|
|
357
357
|
}
|
|
358
358
|
interface UseServerTableOptions {
|
|
359
359
|
/** Base URL — page param appended automatically: `url?page=N` */
|
|
@@ -449,7 +449,7 @@ interface TableProps<T> {
|
|
|
449
449
|
/** When provided, appends an Actions column with View / Edit / Delete buttons */
|
|
450
450
|
defaultActions?: DefaultActionsConfig<T>;
|
|
451
451
|
/** Pass the serverPagination object from useServerTable to enable server-side pagination */
|
|
452
|
-
serverPagination?: ServerPaginationProp;
|
|
452
|
+
serverPagination?: ServerPaginationProp | null;
|
|
453
453
|
className?: string;
|
|
454
454
|
}
|
|
455
455
|
declare function Table<T extends Record<string, any>>({ data, columns, searchable, searchPlaceholder, pagination, itemsPerPage, selectable, onBulkDelete, idKey, defaultActions, serverPagination, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -350,10 +350,10 @@ interface ServerPagination {
|
|
|
350
350
|
total: number;
|
|
351
351
|
links: ServerPaginationLink[];
|
|
352
352
|
}
|
|
353
|
-
interface ServerTableResponse<T> {
|
|
353
|
+
interface ServerTableResponse<T> extends ServerPagination {
|
|
354
354
|
current_page: number;
|
|
355
355
|
data: T[];
|
|
356
|
-
pagination
|
|
356
|
+
pagination?: ServerPagination;
|
|
357
357
|
}
|
|
358
358
|
interface UseServerTableOptions {
|
|
359
359
|
/** Base URL — page param appended automatically: `url?page=N` */
|
|
@@ -449,7 +449,7 @@ interface TableProps<T> {
|
|
|
449
449
|
/** When provided, appends an Actions column with View / Edit / Delete buttons */
|
|
450
450
|
defaultActions?: DefaultActionsConfig<T>;
|
|
451
451
|
/** Pass the serverPagination object from useServerTable to enable server-side pagination */
|
|
452
|
-
serverPagination?: ServerPaginationProp;
|
|
452
|
+
serverPagination?: ServerPaginationProp | null;
|
|
453
453
|
className?: string;
|
|
454
454
|
}
|
|
455
455
|
declare function Table<T extends Record<string, any>>({ data, columns, searchable, searchPlaceholder, pagination, itemsPerPage, selectable, onBulkDelete, idKey, defaultActions, serverPagination, className, }: TableProps<T>): react_jsx_runtime.JSX.Element;
|
package/dist/index.global.js
CHANGED
|
@@ -61433,7 +61433,19 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
61433
61433
|
axios_default.get(url2, { params: { ...params, page: currentPage } }).then(({ data: res }) => {
|
|
61434
61434
|
if (cancelled) return;
|
|
61435
61435
|
setData(res.data);
|
|
61436
|
-
|
|
61436
|
+
const rawTotal = res.total;
|
|
61437
|
+
const rawPerPage = res.per_page;
|
|
61438
|
+
const lastPage = Math.ceil(rawTotal / rawPerPage);
|
|
61439
|
+
const pg = res.pagination ?? {
|
|
61440
|
+
first_page_url: res.first_page_url ?? `${url2}?page=1`,
|
|
61441
|
+
last_page_url: res.last_page_url ?? `${url2}?page=${lastPage}`,
|
|
61442
|
+
next_page_url: res.next_page_url !== void 0 ? res.next_page_url : currentPage < lastPage ? `${url2}?page=${currentPage + 1}` : null,
|
|
61443
|
+
prev_page_url: res.prev_page_url !== void 0 ? res.prev_page_url : currentPage > 1 ? `${url2}?page=${currentPage - 1}` : null,
|
|
61444
|
+
per_page: rawPerPage,
|
|
61445
|
+
total: rawTotal,
|
|
61446
|
+
links: res.links ?? []
|
|
61447
|
+
};
|
|
61448
|
+
setPagination(pg);
|
|
61437
61449
|
if (res.data.length > 0) {
|
|
61438
61450
|
setColumns(
|
|
61439
61451
|
Object.keys(res.data[0]).map((key) => ({
|
|
@@ -61933,45 +61945,52 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
61933
61945
|
onPageChange: setPage
|
|
61934
61946
|
}
|
|
61935
61947
|
),
|
|
61936
|
-
serverPagination &&
|
|
61937
|
-
|
|
61938
|
-
|
|
61939
|
-
|
|
61940
|
-
|
|
61941
|
-
|
|
61942
|
-
|
|
61943
|
-
|
|
61944
|
-
|
|
61945
|
-
|
|
61946
|
-
|
|
61947
|
-
|
|
61948
|
-
|
|
61949
|
-
|
|
61950
|
-
|
|
61951
|
-
|
|
61952
|
-
|
|
61953
|
-
|
|
61954
|
-
|
|
61955
|
-
|
|
61956
|
-
|
|
61957
|
-
|
|
61958
|
-
|
|
61959
|
-
|
|
61960
|
-
|
|
61961
|
-
|
|
61962
|
-
|
|
61963
|
-
|
|
61964
|
-
|
|
61965
|
-
|
|
61966
|
-
|
|
61967
|
-
|
|
61968
|
-
|
|
61969
|
-
|
|
61970
|
-
|
|
61971
|
-
|
|
61972
|
-
|
|
61973
|
-
|
|
61974
|
-
|
|
61948
|
+
serverPagination && (() => {
|
|
61949
|
+
const { pagination, currentPage: cp, goToPage } = serverPagination;
|
|
61950
|
+
const totalServerPages = Math.ceil(pagination.total / pagination.per_page);
|
|
61951
|
+
const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
|
|
61952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
61953
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
|
|
61954
|
+
pagination.total,
|
|
61955
|
+
" total rows \xB7 page ",
|
|
61956
|
+
cp,
|
|
61957
|
+
" of ",
|
|
61958
|
+
totalServerPages
|
|
61959
|
+
] }),
|
|
61960
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
61961
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
61962
|
+
"button",
|
|
61963
|
+
{
|
|
61964
|
+
onClick: () => goToPage(cp - 1),
|
|
61965
|
+
disabled: !pagination.prev_page_url,
|
|
61966
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
61967
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronLeft, { className: "h-4 w-4" })
|
|
61968
|
+
}
|
|
61969
|
+
),
|
|
61970
|
+
pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
61971
|
+
"button",
|
|
61972
|
+
{
|
|
61973
|
+
onClick: () => goToPage(p),
|
|
61974
|
+
className: cn(
|
|
61975
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
61976
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
61977
|
+
),
|
|
61978
|
+
children: p
|
|
61979
|
+
},
|
|
61980
|
+
p
|
|
61981
|
+
)),
|
|
61982
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
61983
|
+
"button",
|
|
61984
|
+
{
|
|
61985
|
+
onClick: () => goToPage(cp + 1),
|
|
61986
|
+
disabled: !pagination.next_page_url,
|
|
61987
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
61988
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronRight, { className: "h-4 w-4" })
|
|
61989
|
+
}
|
|
61990
|
+
)
|
|
61991
|
+
] })
|
|
61992
|
+
] });
|
|
61993
|
+
})(),
|
|
61975
61994
|
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
|
|
61976
61995
|
defaultActions && editItem && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
61977
61996
|
DGEditModal,
|
|
@@ -66470,7 +66489,19 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
66470
66489
|
}).then(({ data: res }) => {
|
|
66471
66490
|
if (cancelled) return;
|
|
66472
66491
|
setData(res.data);
|
|
66473
|
-
|
|
66492
|
+
const rawTotal = res.total;
|
|
66493
|
+
const rawPerPage = res.per_page;
|
|
66494
|
+
const lastPage = Math.ceil(rawTotal / rawPerPage);
|
|
66495
|
+
const pg = res.pagination ?? {
|
|
66496
|
+
first_page_url: res.first_page_url ?? `${url2}?page=1`,
|
|
66497
|
+
last_page_url: res.last_page_url ?? `${url2}?page=${lastPage}`,
|
|
66498
|
+
next_page_url: res.next_page_url !== void 0 ? res.next_page_url : currentPage < lastPage ? `${url2}?page=${currentPage + 1}` : null,
|
|
66499
|
+
prev_page_url: res.prev_page_url !== void 0 ? res.prev_page_url : currentPage > 1 ? `${url2}?page=${currentPage - 1}` : null,
|
|
66500
|
+
per_page: rawPerPage,
|
|
66501
|
+
total: rawTotal,
|
|
66502
|
+
links: res.links ?? []
|
|
66503
|
+
};
|
|
66504
|
+
setPagination(pg);
|
|
66474
66505
|
if (res.data.length > 0) {
|
|
66475
66506
|
setColumns(
|
|
66476
66507
|
Object.keys(res.data[0]).map((key) => ({
|
|
@@ -67131,45 +67162,52 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
67131
67162
|
)
|
|
67132
67163
|
] })
|
|
67133
67164
|
] }),
|
|
67134
|
-
serverPagination &&
|
|
67135
|
-
|
|
67136
|
-
|
|
67137
|
-
|
|
67138
|
-
|
|
67139
|
-
|
|
67140
|
-
|
|
67141
|
-
|
|
67142
|
-
|
|
67143
|
-
|
|
67144
|
-
|
|
67145
|
-
|
|
67146
|
-
|
|
67147
|
-
|
|
67148
|
-
|
|
67149
|
-
|
|
67150
|
-
|
|
67151
|
-
|
|
67152
|
-
|
|
67153
|
-
|
|
67154
|
-
|
|
67155
|
-
|
|
67156
|
-
|
|
67157
|
-
|
|
67158
|
-
|
|
67159
|
-
|
|
67160
|
-
|
|
67161
|
-
|
|
67162
|
-
|
|
67163
|
-
|
|
67164
|
-
|
|
67165
|
-
|
|
67166
|
-
|
|
67167
|
-
|
|
67168
|
-
|
|
67169
|
-
|
|
67170
|
-
|
|
67171
|
-
|
|
67172
|
-
|
|
67165
|
+
serverPagination && (() => {
|
|
67166
|
+
const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
|
|
67167
|
+
const totalServerPages = Math.ceil(pagination2.total / pagination2.per_page);
|
|
67168
|
+
const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
|
|
67169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
67170
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
|
|
67171
|
+
pagination2.total,
|
|
67172
|
+
" total rows \xB7 page ",
|
|
67173
|
+
cp,
|
|
67174
|
+
" of ",
|
|
67175
|
+
totalServerPages
|
|
67176
|
+
] }),
|
|
67177
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
67178
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
67179
|
+
"button",
|
|
67180
|
+
{
|
|
67181
|
+
onClick: () => goToPage(cp - 1),
|
|
67182
|
+
disabled: !pagination2.prev_page_url,
|
|
67183
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
67184
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ChevronLeft, { className: "h-4 w-4" })
|
|
67185
|
+
}
|
|
67186
|
+
),
|
|
67187
|
+
pageLinks.map((p) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
67188
|
+
"button",
|
|
67189
|
+
{
|
|
67190
|
+
onClick: () => goToPage(p),
|
|
67191
|
+
className: cn(
|
|
67192
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
67193
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
67194
|
+
),
|
|
67195
|
+
children: p
|
|
67196
|
+
},
|
|
67197
|
+
p
|
|
67198
|
+
)),
|
|
67199
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
67200
|
+
"button",
|
|
67201
|
+
{
|
|
67202
|
+
onClick: () => goToPage(cp + 1),
|
|
67203
|
+
disabled: !pagination2.next_page_url,
|
|
67204
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
67205
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ChevronRight, { className: "h-4 w-4" })
|
|
67206
|
+
}
|
|
67207
|
+
)
|
|
67208
|
+
] })
|
|
67209
|
+
] });
|
|
67210
|
+
})()
|
|
67173
67211
|
] }),
|
|
67174
67212
|
defaultActions && viewItem && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
67175
67213
|
ViewModal,
|
package/dist/index.js
CHANGED
|
@@ -4744,7 +4744,19 @@ function useServerDataGrid({ url, params }) {
|
|
|
4744
4744
|
axios.get(url, { params: { ...params, page: currentPage } }).then(({ data: res }) => {
|
|
4745
4745
|
if (cancelled) return;
|
|
4746
4746
|
setData(res.data);
|
|
4747
|
-
|
|
4747
|
+
const rawTotal = res.total;
|
|
4748
|
+
const rawPerPage = res.per_page;
|
|
4749
|
+
const lastPage = Math.ceil(rawTotal / rawPerPage);
|
|
4750
|
+
const pg = res.pagination ?? {
|
|
4751
|
+
first_page_url: res.first_page_url ?? `${url}?page=1`,
|
|
4752
|
+
last_page_url: res.last_page_url ?? `${url}?page=${lastPage}`,
|
|
4753
|
+
next_page_url: res.next_page_url !== void 0 ? res.next_page_url : currentPage < lastPage ? `${url}?page=${currentPage + 1}` : null,
|
|
4754
|
+
prev_page_url: res.prev_page_url !== void 0 ? res.prev_page_url : currentPage > 1 ? `${url}?page=${currentPage - 1}` : null,
|
|
4755
|
+
per_page: rawPerPage,
|
|
4756
|
+
total: rawTotal,
|
|
4757
|
+
links: res.links ?? []
|
|
4758
|
+
};
|
|
4759
|
+
setPagination(pg);
|
|
4748
4760
|
if (res.data.length > 0) {
|
|
4749
4761
|
setColumns(
|
|
4750
4762
|
Object.keys(res.data[0]).map((key) => ({
|
|
@@ -5244,45 +5256,52 @@ function DataGrid({
|
|
|
5244
5256
|
onPageChange: setPage
|
|
5245
5257
|
}
|
|
5246
5258
|
),
|
|
5247
|
-
serverPagination &&
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5260
|
-
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5267
|
-
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5259
|
+
serverPagination && (() => {
|
|
5260
|
+
const { pagination, currentPage: cp, goToPage } = serverPagination;
|
|
5261
|
+
const totalServerPages = Math.ceil(pagination.total / pagination.per_page);
|
|
5262
|
+
const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
|
|
5263
|
+
return /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
5264
|
+
/* @__PURE__ */ jsxs27("span", { className: "text-xs text-muted-foreground", children: [
|
|
5265
|
+
pagination.total,
|
|
5266
|
+
" total rows \xB7 page ",
|
|
5267
|
+
cp,
|
|
5268
|
+
" of ",
|
|
5269
|
+
totalServerPages
|
|
5270
|
+
] }),
|
|
5271
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-1", children: [
|
|
5272
|
+
/* @__PURE__ */ jsx28(
|
|
5273
|
+
"button",
|
|
5274
|
+
{
|
|
5275
|
+
onClick: () => goToPage(cp - 1),
|
|
5276
|
+
disabled: !pagination.prev_page_url,
|
|
5277
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
5278
|
+
children: /* @__PURE__ */ jsx28(ChevronLeft5, { className: "h-4 w-4" })
|
|
5279
|
+
}
|
|
5280
|
+
),
|
|
5281
|
+
pageLinks.map((p) => /* @__PURE__ */ jsx28(
|
|
5282
|
+
"button",
|
|
5283
|
+
{
|
|
5284
|
+
onClick: () => goToPage(p),
|
|
5285
|
+
className: cn(
|
|
5286
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
5287
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
5288
|
+
),
|
|
5289
|
+
children: p
|
|
5290
|
+
},
|
|
5291
|
+
p
|
|
5292
|
+
)),
|
|
5293
|
+
/* @__PURE__ */ jsx28(
|
|
5294
|
+
"button",
|
|
5295
|
+
{
|
|
5296
|
+
onClick: () => goToPage(cp + 1),
|
|
5297
|
+
disabled: !pagination.next_page_url,
|
|
5298
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
5299
|
+
children: /* @__PURE__ */ jsx28(ChevronRight7, { className: "h-4 w-4" })
|
|
5300
|
+
}
|
|
5301
|
+
)
|
|
5302
|
+
] })
|
|
5303
|
+
] });
|
|
5304
|
+
})(),
|
|
5286
5305
|
defaultActions && viewItem && /* @__PURE__ */ jsx28(DGViewModal, { item: viewItem, fields: viewFields, onClose: () => setViewItem(null) }),
|
|
5287
5306
|
defaultActions && editItem && /* @__PURE__ */ jsx28(
|
|
5288
5307
|
DGEditModal,
|
|
@@ -9370,7 +9389,19 @@ function useServerTable({ url, params }) {
|
|
|
9370
9389
|
}).then(({ data: res }) => {
|
|
9371
9390
|
if (cancelled) return;
|
|
9372
9391
|
setData(res.data);
|
|
9373
|
-
|
|
9392
|
+
const rawTotal = res.total;
|
|
9393
|
+
const rawPerPage = res.per_page;
|
|
9394
|
+
const lastPage = Math.ceil(rawTotal / rawPerPage);
|
|
9395
|
+
const pg = res.pagination ?? {
|
|
9396
|
+
first_page_url: res.first_page_url ?? `${url}?page=1`,
|
|
9397
|
+
last_page_url: res.last_page_url ?? `${url}?page=${lastPage}`,
|
|
9398
|
+
next_page_url: res.next_page_url !== void 0 ? res.next_page_url : currentPage < lastPage ? `${url}?page=${currentPage + 1}` : null,
|
|
9399
|
+
prev_page_url: res.prev_page_url !== void 0 ? res.prev_page_url : currentPage > 1 ? `${url}?page=${currentPage - 1}` : null,
|
|
9400
|
+
per_page: rawPerPage,
|
|
9401
|
+
total: rawTotal,
|
|
9402
|
+
links: res.links ?? []
|
|
9403
|
+
};
|
|
9404
|
+
setPagination(pg);
|
|
9374
9405
|
if (res.data.length > 0) {
|
|
9375
9406
|
setColumns(
|
|
9376
9407
|
Object.keys(res.data[0]).map((key) => ({
|
|
@@ -10031,45 +10062,52 @@ function Table({
|
|
|
10031
10062
|
)
|
|
10032
10063
|
] })
|
|
10033
10064
|
] }),
|
|
10034
|
-
serverPagination &&
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
|
|
10040
|
-
|
|
10041
|
-
|
|
10042
|
-
|
|
10043
|
-
|
|
10044
|
-
|
|
10045
|
-
|
|
10046
|
-
|
|
10047
|
-
|
|
10048
|
-
|
|
10049
|
-
|
|
10050
|
-
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
|
|
10062
|
-
|
|
10063
|
-
|
|
10064
|
-
|
|
10065
|
-
|
|
10066
|
-
|
|
10067
|
-
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10065
|
+
serverPagination && (() => {
|
|
10066
|
+
const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
|
|
10067
|
+
const totalServerPages = Math.ceil(pagination2.total / pagination2.per_page);
|
|
10068
|
+
const pageLinks = Array.from({ length: totalServerPages }, (_, i) => i + 1);
|
|
10069
|
+
return /* @__PURE__ */ jsxs48("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
10070
|
+
/* @__PURE__ */ jsxs48("span", { className: "text-xs text-muted-foreground", children: [
|
|
10071
|
+
pagination2.total,
|
|
10072
|
+
" total rows \xB7 page ",
|
|
10073
|
+
cp,
|
|
10074
|
+
" of ",
|
|
10075
|
+
totalServerPages
|
|
10076
|
+
] }),
|
|
10077
|
+
/* @__PURE__ */ jsxs48("div", { className: "flex items-center gap-1", children: [
|
|
10078
|
+
/* @__PURE__ */ jsx55(
|
|
10079
|
+
"button",
|
|
10080
|
+
{
|
|
10081
|
+
onClick: () => goToPage(cp - 1),
|
|
10082
|
+
disabled: !pagination2.prev_page_url,
|
|
10083
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
10084
|
+
children: /* @__PURE__ */ jsx55(ChevronLeft6, { className: "h-4 w-4" })
|
|
10085
|
+
}
|
|
10086
|
+
),
|
|
10087
|
+
pageLinks.map((p) => /* @__PURE__ */ jsx55(
|
|
10088
|
+
"button",
|
|
10089
|
+
{
|
|
10090
|
+
onClick: () => goToPage(p),
|
|
10091
|
+
className: cn(
|
|
10092
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
10093
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
10094
|
+
),
|
|
10095
|
+
children: p
|
|
10096
|
+
},
|
|
10097
|
+
p
|
|
10098
|
+
)),
|
|
10099
|
+
/* @__PURE__ */ jsx55(
|
|
10100
|
+
"button",
|
|
10101
|
+
{
|
|
10102
|
+
onClick: () => goToPage(cp + 1),
|
|
10103
|
+
disabled: !pagination2.next_page_url,
|
|
10104
|
+
className: "flex h-8 w-8 items-center justify-center rounded-lg border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:pointer-events-none",
|
|
10105
|
+
children: /* @__PURE__ */ jsx55(ChevronRight9, { className: "h-4 w-4" })
|
|
10106
|
+
}
|
|
10107
|
+
)
|
|
10108
|
+
] })
|
|
10109
|
+
] });
|
|
10110
|
+
})()
|
|
10073
10111
|
] }),
|
|
10074
10112
|
defaultActions && viewItem && /* @__PURE__ */ jsx55(
|
|
10075
10113
|
ViewModal,
|