@juv/codego-react-ui 3.1.1 → 3.1.2
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 +53 -31
- package/dist/index.global.js +53 -31
- package/dist/index.js +53 -31
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5193,9 +5193,9 @@ function DataGrid({
|
|
|
5193
5193
|
const [viewItem, setViewItem] = React24.useState(null);
|
|
5194
5194
|
const [editItem, setEditItem] = React24.useState(null);
|
|
5195
5195
|
const [deleteItem, setDeleteItem] = React24.useState(null);
|
|
5196
|
-
const [tableData, setTableData] = React24.useState(data);
|
|
5196
|
+
const [tableData, setTableData] = React24.useState(data ?? []);
|
|
5197
5197
|
React24.useEffect(() => {
|
|
5198
|
-
setTableData(data);
|
|
5198
|
+
setTableData(data ?? []);
|
|
5199
5199
|
}, [data]);
|
|
5200
5200
|
const actionIdKey = defaultActions?.idKey ?? (typeof rowKey === "string" ? rowKey : "id");
|
|
5201
5201
|
const autoFields = React24.useMemo(() => {
|
|
@@ -5240,7 +5240,7 @@ function DataGrid({
|
|
|
5240
5240
|
document.addEventListener("mousedown", handler);
|
|
5241
5241
|
return () => document.removeEventListener("mousedown", handler);
|
|
5242
5242
|
}, []);
|
|
5243
|
-
let processed = data.filter(
|
|
5243
|
+
let processed = (data ?? []).filter(
|
|
5244
5244
|
(row) => Object.entries(filters).every(([k, v]) => {
|
|
5245
5245
|
if (!v) return true;
|
|
5246
5246
|
const cell = String(row[k] ?? "").toLowerCase();
|
|
@@ -5438,7 +5438,16 @@ function DataGrid({
|
|
|
5438
5438
|
serverPagination && (() => {
|
|
5439
5439
|
const { pagination, currentPage: cp, goToPage } = serverPagination;
|
|
5440
5440
|
const totalServerPages = pagination.last_page ?? Math.ceil(pagination.total / pagination.per_page);
|
|
5441
|
-
const
|
|
5441
|
+
const pills = [];
|
|
5442
|
+
if (totalServerPages <= 7) {
|
|
5443
|
+
for (let i = 1; i <= totalServerPages; i++) pills.push(i);
|
|
5444
|
+
} else if (cp <= 4) {
|
|
5445
|
+
pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
|
|
5446
|
+
} else if (cp >= totalServerPages - 3) {
|
|
5447
|
+
pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
|
|
5448
|
+
} else {
|
|
5449
|
+
pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
|
|
5450
|
+
}
|
|
5442
5451
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
5443
5452
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
|
|
5444
5453
|
pagination.total,
|
|
@@ -5457,18 +5466,20 @@ function DataGrid({
|
|
|
5457
5466
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react15.ChevronLeft, { className: "h-4 w-4" })
|
|
5458
5467
|
}
|
|
5459
5468
|
),
|
|
5460
|
-
|
|
5461
|
-
"
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5469
|
+
pills.map(
|
|
5470
|
+
(p, i) => p < 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5471
|
+
"button",
|
|
5472
|
+
{
|
|
5473
|
+
onClick: () => goToPage(p),
|
|
5474
|
+
className: cn(
|
|
5475
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
5476
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
5477
|
+
),
|
|
5478
|
+
children: p
|
|
5479
|
+
},
|
|
5480
|
+
p
|
|
5481
|
+
)
|
|
5482
|
+
),
|
|
5472
5483
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
5473
5484
|
"button",
|
|
5474
5485
|
{
|
|
@@ -9926,9 +9937,9 @@ function Table({
|
|
|
9926
9937
|
const [viewItem, setViewItem] = React44.useState(null);
|
|
9927
9938
|
const [editItem, setEditItem] = React44.useState(null);
|
|
9928
9939
|
const [deleteItem, setDeleteItem] = React44.useState(null);
|
|
9929
|
-
const [tableData, setTableData] = React44.useState(data);
|
|
9940
|
+
const [tableData, setTableData] = React44.useState(data ?? []);
|
|
9930
9941
|
React44.useEffect(() => {
|
|
9931
|
-
setTableData(data);
|
|
9942
|
+
setTableData(data ?? []);
|
|
9932
9943
|
}, [data]);
|
|
9933
9944
|
const actionIdKey = defaultActions?.idKey ?? idKey;
|
|
9934
9945
|
const autoFields = React44.useMemo(() => {
|
|
@@ -10251,7 +10262,16 @@ function Table({
|
|
|
10251
10262
|
serverPagination && (() => {
|
|
10252
10263
|
const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
|
|
10253
10264
|
const totalServerPages = pagination2.last_page ?? Math.ceil(pagination2.total / pagination2.per_page);
|
|
10254
|
-
const
|
|
10265
|
+
const pills = [];
|
|
10266
|
+
if (totalServerPages <= 7) {
|
|
10267
|
+
for (let i = 1; i <= totalServerPages; i++) pills.push(i);
|
|
10268
|
+
} else if (cp <= 4) {
|
|
10269
|
+
pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
|
|
10270
|
+
} else if (cp >= totalServerPages - 3) {
|
|
10271
|
+
pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
|
|
10272
|
+
} else {
|
|
10273
|
+
pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
|
|
10274
|
+
}
|
|
10255
10275
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
10256
10276
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
|
|
10257
10277
|
pagination2.total,
|
|
@@ -10270,18 +10290,20 @@ function Table({
|
|
|
10270
10290
|
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_lucide_react28.ChevronLeft, { className: "h-4 w-4" })
|
|
10271
10291
|
}
|
|
10272
10292
|
),
|
|
10273
|
-
|
|
10274
|
-
"
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
|
|
10293
|
+
pills.map(
|
|
10294
|
+
(p, i) => p < 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
10295
|
+
"button",
|
|
10296
|
+
{
|
|
10297
|
+
onClick: () => goToPage(p),
|
|
10298
|
+
className: cn(
|
|
10299
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
10300
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
10301
|
+
),
|
|
10302
|
+
children: p
|
|
10303
|
+
},
|
|
10304
|
+
p
|
|
10305
|
+
)
|
|
10306
|
+
),
|
|
10285
10307
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
10286
10308
|
"button",
|
|
10287
10309
|
{
|
package/dist/index.global.js
CHANGED
|
@@ -68317,9 +68317,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
68317
68317
|
const [viewItem, setViewItem] = React24.useState(null);
|
|
68318
68318
|
const [editItem, setEditItem] = React24.useState(null);
|
|
68319
68319
|
const [deleteItem, setDeleteItem] = React24.useState(null);
|
|
68320
|
-
const [tableData, setTableData] = React24.useState(data);
|
|
68320
|
+
const [tableData, setTableData] = React24.useState(data ?? []);
|
|
68321
68321
|
React24.useEffect(() => {
|
|
68322
|
-
setTableData(data);
|
|
68322
|
+
setTableData(data ?? []);
|
|
68323
68323
|
}, [data]);
|
|
68324
68324
|
const actionIdKey = defaultActions?.idKey ?? (typeof rowKey === "string" ? rowKey : "id");
|
|
68325
68325
|
const autoFields = React24.useMemo(() => {
|
|
@@ -68364,7 +68364,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
68364
68364
|
document.addEventListener("mousedown", handler);
|
|
68365
68365
|
return () => document.removeEventListener("mousedown", handler);
|
|
68366
68366
|
}, []);
|
|
68367
|
-
let processed = data.filter(
|
|
68367
|
+
let processed = (data ?? []).filter(
|
|
68368
68368
|
(row) => Object.entries(filters).every(([k, v]) => {
|
|
68369
68369
|
if (!v) return true;
|
|
68370
68370
|
const cell = String(row[k] ?? "").toLowerCase();
|
|
@@ -68562,7 +68562,16 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
68562
68562
|
serverPagination && (() => {
|
|
68563
68563
|
const { pagination, currentPage: cp, goToPage } = serverPagination;
|
|
68564
68564
|
const totalServerPages = pagination.last_page ?? Math.ceil(pagination.total / pagination.per_page);
|
|
68565
|
-
const
|
|
68565
|
+
const pills = [];
|
|
68566
|
+
if (totalServerPages <= 7) {
|
|
68567
|
+
for (let i = 1; i <= totalServerPages; i++) pills.push(i);
|
|
68568
|
+
} else if (cp <= 4) {
|
|
68569
|
+
pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
|
|
68570
|
+
} else if (cp >= totalServerPages - 3) {
|
|
68571
|
+
pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
|
|
68572
|
+
} else {
|
|
68573
|
+
pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
|
|
68574
|
+
}
|
|
68566
68575
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
68567
68576
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
|
|
68568
68577
|
pagination.total,
|
|
@@ -68581,18 +68590,20 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
68581
68590
|
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ChevronLeft, { className: "h-4 w-4" })
|
|
68582
68591
|
}
|
|
68583
68592
|
),
|
|
68584
|
-
|
|
68585
|
-
"
|
|
68586
|
-
|
|
68587
|
-
|
|
68588
|
-
|
|
68589
|
-
|
|
68590
|
-
|
|
68591
|
-
|
|
68592
|
-
|
|
68593
|
-
|
|
68594
|
-
|
|
68595
|
-
|
|
68593
|
+
pills.map(
|
|
68594
|
+
(p, i) => p < 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
68595
|
+
"button",
|
|
68596
|
+
{
|
|
68597
|
+
onClick: () => goToPage(p),
|
|
68598
|
+
className: cn(
|
|
68599
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
68600
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
68601
|
+
),
|
|
68602
|
+
children: p
|
|
68603
|
+
},
|
|
68604
|
+
p
|
|
68605
|
+
)
|
|
68606
|
+
),
|
|
68596
68607
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
68597
68608
|
"button",
|
|
68598
68609
|
{
|
|
@@ -73461,9 +73472,9 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
73461
73472
|
const [viewItem, setViewItem] = React46.useState(null);
|
|
73462
73473
|
const [editItem, setEditItem] = React46.useState(null);
|
|
73463
73474
|
const [deleteItem, setDeleteItem] = React46.useState(null);
|
|
73464
|
-
const [tableData, setTableData] = React46.useState(data);
|
|
73475
|
+
const [tableData, setTableData] = React46.useState(data ?? []);
|
|
73465
73476
|
React46.useEffect(() => {
|
|
73466
|
-
setTableData(data);
|
|
73477
|
+
setTableData(data ?? []);
|
|
73467
73478
|
}, [data]);
|
|
73468
73479
|
const actionIdKey = defaultActions?.idKey ?? idKey;
|
|
73469
73480
|
const autoFields = React46.useMemo(() => {
|
|
@@ -73786,7 +73797,16 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
73786
73797
|
serverPagination && (() => {
|
|
73787
73798
|
const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
|
|
73788
73799
|
const totalServerPages = pagination2.last_page ?? Math.ceil(pagination2.total / pagination2.per_page);
|
|
73789
|
-
const
|
|
73800
|
+
const pills = [];
|
|
73801
|
+
if (totalServerPages <= 7) {
|
|
73802
|
+
for (let i = 1; i <= totalServerPages; i++) pills.push(i);
|
|
73803
|
+
} else if (cp <= 4) {
|
|
73804
|
+
pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
|
|
73805
|
+
} else if (cp >= totalServerPages - 3) {
|
|
73806
|
+
pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
|
|
73807
|
+
} else {
|
|
73808
|
+
pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
|
|
73809
|
+
}
|
|
73790
73810
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
73791
73811
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
|
|
73792
73812
|
pagination2.total,
|
|
@@ -73805,18 +73825,20 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
|
|
|
73805
73825
|
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ChevronLeft, { className: "h-4 w-4" })
|
|
73806
73826
|
}
|
|
73807
73827
|
),
|
|
73808
|
-
|
|
73809
|
-
"
|
|
73810
|
-
|
|
73811
|
-
|
|
73812
|
-
|
|
73813
|
-
|
|
73814
|
-
|
|
73815
|
-
|
|
73816
|
-
|
|
73817
|
-
|
|
73818
|
-
|
|
73819
|
-
|
|
73828
|
+
pills.map(
|
|
73829
|
+
(p, i) => p < 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
73830
|
+
"button",
|
|
73831
|
+
{
|
|
73832
|
+
onClick: () => goToPage(p),
|
|
73833
|
+
className: cn(
|
|
73834
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
73835
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
73836
|
+
),
|
|
73837
|
+
children: p
|
|
73838
|
+
},
|
|
73839
|
+
p
|
|
73840
|
+
)
|
|
73841
|
+
),
|
|
73820
73842
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
73821
73843
|
"button",
|
|
73822
73844
|
{
|
package/dist/index.js
CHANGED
|
@@ -5078,9 +5078,9 @@ function DataGrid({
|
|
|
5078
5078
|
const [viewItem, setViewItem] = React24.useState(null);
|
|
5079
5079
|
const [editItem, setEditItem] = React24.useState(null);
|
|
5080
5080
|
const [deleteItem, setDeleteItem] = React24.useState(null);
|
|
5081
|
-
const [tableData, setTableData] = React24.useState(data);
|
|
5081
|
+
const [tableData, setTableData] = React24.useState(data ?? []);
|
|
5082
5082
|
React24.useEffect(() => {
|
|
5083
|
-
setTableData(data);
|
|
5083
|
+
setTableData(data ?? []);
|
|
5084
5084
|
}, [data]);
|
|
5085
5085
|
const actionIdKey = defaultActions?.idKey ?? (typeof rowKey === "string" ? rowKey : "id");
|
|
5086
5086
|
const autoFields = React24.useMemo(() => {
|
|
@@ -5125,7 +5125,7 @@ function DataGrid({
|
|
|
5125
5125
|
document.addEventListener("mousedown", handler);
|
|
5126
5126
|
return () => document.removeEventListener("mousedown", handler);
|
|
5127
5127
|
}, []);
|
|
5128
|
-
let processed = data.filter(
|
|
5128
|
+
let processed = (data ?? []).filter(
|
|
5129
5129
|
(row) => Object.entries(filters).every(([k, v]) => {
|
|
5130
5130
|
if (!v) return true;
|
|
5131
5131
|
const cell = String(row[k] ?? "").toLowerCase();
|
|
@@ -5323,7 +5323,16 @@ function DataGrid({
|
|
|
5323
5323
|
serverPagination && (() => {
|
|
5324
5324
|
const { pagination, currentPage: cp, goToPage } = serverPagination;
|
|
5325
5325
|
const totalServerPages = pagination.last_page ?? Math.ceil(pagination.total / pagination.per_page);
|
|
5326
|
-
const
|
|
5326
|
+
const pills = [];
|
|
5327
|
+
if (totalServerPages <= 7) {
|
|
5328
|
+
for (let i = 1; i <= totalServerPages; i++) pills.push(i);
|
|
5329
|
+
} else if (cp <= 4) {
|
|
5330
|
+
pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
|
|
5331
|
+
} else if (cp >= totalServerPages - 3) {
|
|
5332
|
+
pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
|
|
5333
|
+
} else {
|
|
5334
|
+
pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
|
|
5335
|
+
}
|
|
5327
5336
|
return /* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
5328
5337
|
/* @__PURE__ */ jsxs27("span", { className: "text-xs text-muted-foreground", children: [
|
|
5329
5338
|
pagination.total,
|
|
@@ -5342,18 +5351,20 @@ function DataGrid({
|
|
|
5342
5351
|
children: /* @__PURE__ */ jsx28(ChevronLeft5, { className: "h-4 w-4" })
|
|
5343
5352
|
}
|
|
5344
5353
|
),
|
|
5345
|
-
|
|
5346
|
-
"
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5354
|
+
pills.map(
|
|
5355
|
+
(p, i) => p < 0 ? /* @__PURE__ */ jsx28("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ jsx28(
|
|
5356
|
+
"button",
|
|
5357
|
+
{
|
|
5358
|
+
onClick: () => goToPage(p),
|
|
5359
|
+
className: cn(
|
|
5360
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
5361
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
5362
|
+
),
|
|
5363
|
+
children: p
|
|
5364
|
+
},
|
|
5365
|
+
p
|
|
5366
|
+
)
|
|
5367
|
+
),
|
|
5357
5368
|
/* @__PURE__ */ jsx28(
|
|
5358
5369
|
"button",
|
|
5359
5370
|
{
|
|
@@ -9811,9 +9822,9 @@ function Table({
|
|
|
9811
9822
|
const [viewItem, setViewItem] = React44.useState(null);
|
|
9812
9823
|
const [editItem, setEditItem] = React44.useState(null);
|
|
9813
9824
|
const [deleteItem, setDeleteItem] = React44.useState(null);
|
|
9814
|
-
const [tableData, setTableData] = React44.useState(data);
|
|
9825
|
+
const [tableData, setTableData] = React44.useState(data ?? []);
|
|
9815
9826
|
React44.useEffect(() => {
|
|
9816
|
-
setTableData(data);
|
|
9827
|
+
setTableData(data ?? []);
|
|
9817
9828
|
}, [data]);
|
|
9818
9829
|
const actionIdKey = defaultActions?.idKey ?? idKey;
|
|
9819
9830
|
const autoFields = React44.useMemo(() => {
|
|
@@ -10136,7 +10147,16 @@ function Table({
|
|
|
10136
10147
|
serverPagination && (() => {
|
|
10137
10148
|
const { pagination: pagination2, currentPage: cp, goToPage } = serverPagination;
|
|
10138
10149
|
const totalServerPages = pagination2.last_page ?? Math.ceil(pagination2.total / pagination2.per_page);
|
|
10139
|
-
const
|
|
10150
|
+
const pills = [];
|
|
10151
|
+
if (totalServerPages <= 7) {
|
|
10152
|
+
for (let i = 1; i <= totalServerPages; i++) pills.push(i);
|
|
10153
|
+
} else if (cp <= 4) {
|
|
10154
|
+
pills.push(1, 2, 3, 4, 5, -1, totalServerPages);
|
|
10155
|
+
} else if (cp >= totalServerPages - 3) {
|
|
10156
|
+
pills.push(1, -1, totalServerPages - 4, totalServerPages - 3, totalServerPages - 2, totalServerPages - 1, totalServerPages);
|
|
10157
|
+
} else {
|
|
10158
|
+
pills.push(1, -1, cp - 1, cp, cp + 1, -2, totalServerPages);
|
|
10159
|
+
}
|
|
10140
10160
|
return /* @__PURE__ */ jsxs48("div", { className: "flex items-center justify-between gap-2 flex-wrap", children: [
|
|
10141
10161
|
/* @__PURE__ */ jsxs48("span", { className: "text-xs text-muted-foreground", children: [
|
|
10142
10162
|
pagination2.total,
|
|
@@ -10155,18 +10175,20 @@ function Table({
|
|
|
10155
10175
|
children: /* @__PURE__ */ jsx55(ChevronLeft6, { className: "h-4 w-4" })
|
|
10156
10176
|
}
|
|
10157
10177
|
),
|
|
10158
|
-
|
|
10159
|
-
"
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10178
|
+
pills.map(
|
|
10179
|
+
(p, i) => p < 0 ? /* @__PURE__ */ jsx55("span", { className: "px-1 text-muted-foreground text-xs", children: "\u2026" }, p - i) : /* @__PURE__ */ jsx55(
|
|
10180
|
+
"button",
|
|
10181
|
+
{
|
|
10182
|
+
onClick: () => goToPage(p),
|
|
10183
|
+
className: cn(
|
|
10184
|
+
"flex h-8 w-8 items-center justify-center rounded-lg border text-xs font-medium transition-colors",
|
|
10185
|
+
p === cp ? "border-primary bg-primary text-primary-foreground shadow-sm" : "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
10186
|
+
),
|
|
10187
|
+
children: p
|
|
10188
|
+
},
|
|
10189
|
+
p
|
|
10190
|
+
)
|
|
10191
|
+
),
|
|
10170
10192
|
/* @__PURE__ */ jsx55(
|
|
10171
10193
|
"button",
|
|
10172
10194
|
{
|