warqadui 0.0.39 → 0.0.42
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.d.mts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +270 -159
- package/dist/index.mjs +278 -159
- package/dist/styles.js +37 -0
- package/dist/styles.mjs +37 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3219,7 +3219,7 @@ var TableCell = React9.memo(
|
|
|
3219
3219
|
);
|
|
3220
3220
|
},
|
|
3221
3221
|
(prev, next) => {
|
|
3222
|
-
return prev.cell.getValue() === next.cell.getValue() && prev.cell.row.getIsExpanded() === next.cell.row.getIsExpanded() && prev.cell.row.getIsSelected() === next.cell.row.getIsSelected() && prev.rowPadding === next.rowPadding && prev.verticalLines === next.verticalLines;
|
|
3222
|
+
return prev.cell.getValue() === next.cell.getValue() && prev.cell.row.original === next.cell.row.original && prev.cell.row.getIsExpanded() === next.cell.row.getIsExpanded() && prev.cell.row.getIsSelected() === next.cell.row.getIsSelected() && prev.rowPadding === next.rowPadding && prev.verticalLines === next.verticalLines;
|
|
3223
3223
|
}
|
|
3224
3224
|
);
|
|
3225
3225
|
var TableRow = React9.memo(
|
|
@@ -3306,7 +3306,9 @@ function PostTable({
|
|
|
3306
3306
|
}
|
|
3307
3307
|
return initialState;
|
|
3308
3308
|
});
|
|
3309
|
-
const [
|
|
3309
|
+
const [internalData, setInternalData] = useState15(controlledData || []);
|
|
3310
|
+
const isControlled = controlledData !== void 0;
|
|
3311
|
+
const data = isControlled ? controlledData : internalData;
|
|
3310
3312
|
const entryRowRef = useRef5(null);
|
|
3311
3313
|
const focusAndScrollEntryRow = () => {
|
|
3312
3314
|
setTimeout(() => {
|
|
@@ -3327,11 +3329,6 @@ function PostTable({
|
|
|
3327
3329
|
useEffect10(() => {
|
|
3328
3330
|
focusAndScrollEntryRow();
|
|
3329
3331
|
}, []);
|
|
3330
|
-
useEffect10(() => {
|
|
3331
|
-
if (controlledData) {
|
|
3332
|
-
setData(controlledData);
|
|
3333
|
-
}
|
|
3334
|
-
}, [controlledData]);
|
|
3335
3332
|
const [entryData, setEntryData] = useState15({});
|
|
3336
3333
|
const [editingIndex, setEditingIndex] = useState15(null);
|
|
3337
3334
|
const [isSavingAsync, setIsSavingAsync] = useState15(false);
|
|
@@ -3363,23 +3360,21 @@ function PostTable({
|
|
|
3363
3360
|
};
|
|
3364
3361
|
});
|
|
3365
3362
|
const handleSaveField = useCallback2(async () => {
|
|
3366
|
-
const {
|
|
3367
|
-
data: data2,
|
|
3368
|
-
entryData: entryData2,
|
|
3369
|
-
editingIndex: editingIndex2,
|
|
3370
|
-
isSavingAsync: isSavingAsync2,
|
|
3371
|
-
submitLoading: submitLoading2,
|
|
3372
|
-
onChange: onChange2
|
|
3373
|
-
} = latestStateRef.current;
|
|
3363
|
+
const { data: data2, entryData: entryData2, editingIndex: editingIndex2, onChange: onChange2 } = latestStateRef.current;
|
|
3374
3364
|
if (Object.keys(entryData2).length === 0) return;
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3365
|
+
const actionType = editingIndex2 !== null ? "edit" : "add";
|
|
3366
|
+
const entryToSave = { ...entryData2 };
|
|
3367
|
+
const updated = [...data2];
|
|
3368
|
+
let entryToPass;
|
|
3369
|
+
if (actionType === "edit" && editingIndex2 !== null) {
|
|
3370
|
+
updated[editingIndex2] = {
|
|
3371
|
+
...updated[editingIndex2],
|
|
3372
|
+
...entryToSave
|
|
3380
3373
|
};
|
|
3374
|
+
entryToPass = updated[editingIndex2];
|
|
3381
3375
|
} else {
|
|
3382
|
-
|
|
3376
|
+
updated.push(entryToSave);
|
|
3377
|
+
entryToPass = updated[updated.length - 1];
|
|
3383
3378
|
}
|
|
3384
3379
|
if (onChange2) {
|
|
3385
3380
|
setIsSavingAsync(true);
|
|
@@ -3405,12 +3400,11 @@ function PostTable({
|
|
|
3405
3400
|
}));
|
|
3406
3401
|
}
|
|
3407
3402
|
};
|
|
3408
|
-
const type = editingIndex2 !== null ? "edit" : "add";
|
|
3409
3403
|
const result = await onChange2({
|
|
3410
|
-
entryData:
|
|
3404
|
+
entryData: entryToPass,
|
|
3411
3405
|
actions,
|
|
3412
|
-
actionType
|
|
3413
|
-
fullData:
|
|
3406
|
+
actionType,
|
|
3407
|
+
fullData: updated
|
|
3414
3408
|
});
|
|
3415
3409
|
if (result === false) {
|
|
3416
3410
|
setIsSavingAsync(false);
|
|
@@ -3421,14 +3415,14 @@ function PostTable({
|
|
|
3421
3415
|
return;
|
|
3422
3416
|
}
|
|
3423
3417
|
}
|
|
3424
|
-
|
|
3418
|
+
setInternalData(updated);
|
|
3425
3419
|
setEntryData({});
|
|
3426
3420
|
setFieldErrors({});
|
|
3427
3421
|
setIsSavingAsync(false);
|
|
3428
3422
|
if (editingIndex2 !== null) {
|
|
3429
3423
|
setEditingIndex(null);
|
|
3430
3424
|
} else {
|
|
3431
|
-
focusAndScrollEntryRow();
|
|
3425
|
+
setTimeout(() => focusAndScrollEntryRow(), 0);
|
|
3432
3426
|
}
|
|
3433
3427
|
}, []);
|
|
3434
3428
|
const handleCancelEdit = useCallback2(() => {
|
|
@@ -3441,43 +3435,56 @@ function PostTable({
|
|
|
3441
3435
|
const handleEdit = useCallback2((index2, rowOriginal) => {
|
|
3442
3436
|
const { onEdit: onEdit2 } = latestStateRef.current;
|
|
3443
3437
|
setEditingIndex(index2);
|
|
3444
|
-
setEntryData(rowOriginal);
|
|
3438
|
+
setEntryData({ ...rowOriginal });
|
|
3445
3439
|
if (onEdit2) onEdit2(rowOriginal);
|
|
3446
3440
|
}, []);
|
|
3447
3441
|
const handleDelete = useCallback2(
|
|
3448
|
-
(index2) => {
|
|
3442
|
+
async (index2) => {
|
|
3449
3443
|
const { data: data2, editingIndex: editingIndex2, onChange: onChange2, onDelete: onDelete2 } = latestStateRef.current;
|
|
3450
3444
|
const rowToDelete = data2[index2];
|
|
3451
|
-
const
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3445
|
+
const updated = data2.filter((_, i) => i !== index2);
|
|
3446
|
+
if (onChange2) {
|
|
3447
|
+
setIsSavingAsync(true);
|
|
3448
|
+
try {
|
|
3449
|
+
const actions = {
|
|
3450
|
+
focus: (columnId) => {
|
|
3451
|
+
if (entryRowRef.current) {
|
|
3452
|
+
const td = entryRowRef.current.querySelector(
|
|
3453
|
+
`td[data-column-id="${columnId}"]`
|
|
3454
|
+
);
|
|
3455
|
+
if (td) {
|
|
3456
|
+
const input = td.querySelector(
|
|
3457
|
+
`input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex='0'], [id*='${columnId}']`
|
|
3458
|
+
);
|
|
3459
|
+
if (input) input.focus();
|
|
3460
|
+
}
|
|
3461
|
+
}
|
|
3462
|
+
},
|
|
3463
|
+
setError: (columnId, error) => {
|
|
3464
|
+
setFieldErrors((prev) => ({
|
|
3465
|
+
...prev,
|
|
3466
|
+
[columnId]: error
|
|
3467
|
+
}));
|
|
3465
3468
|
}
|
|
3469
|
+
};
|
|
3470
|
+
const result = await onChange2({
|
|
3471
|
+
entryData: rowToDelete,
|
|
3472
|
+
actions,
|
|
3473
|
+
actionType: "delete",
|
|
3474
|
+
fullData: updated
|
|
3475
|
+
});
|
|
3476
|
+
if (result === false) {
|
|
3477
|
+
setIsSavingAsync(false);
|
|
3478
|
+
return;
|
|
3466
3479
|
}
|
|
3467
|
-
}
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
...prev,
|
|
3471
|
-
[columnId]: error
|
|
3472
|
-
}));
|
|
3480
|
+
} catch (error) {
|
|
3481
|
+
setIsSavingAsync(false);
|
|
3482
|
+
return;
|
|
3473
3483
|
}
|
|
3474
|
-
}
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
actionType: "delete",
|
|
3479
|
-
fullData: newData
|
|
3480
|
-
});
|
|
3484
|
+
}
|
|
3485
|
+
setInternalData(updated);
|
|
3486
|
+
if (onDelete2) onDelete2(rowToDelete);
|
|
3487
|
+
setIsSavingAsync(false);
|
|
3481
3488
|
if (editingIndex2 === index2) {
|
|
3482
3489
|
handleCancelEdit();
|
|
3483
3490
|
} else if (editingIndex2 !== null && editingIndex2 > index2) {
|
|
@@ -3875,7 +3882,8 @@ function SimpleTable({
|
|
|
3875
3882
|
isLoading = false,
|
|
3876
3883
|
title,
|
|
3877
3884
|
enableSearch = false,
|
|
3878
|
-
emptyState
|
|
3885
|
+
emptyState,
|
|
3886
|
+
skeletonCount = 5
|
|
3879
3887
|
}) {
|
|
3880
3888
|
const columns = useMemo5(() => {
|
|
3881
3889
|
const cols = userColumns.filter((col) => !col.hide).map((col) => ({
|
|
@@ -3891,9 +3899,9 @@ function SimpleTable({
|
|
|
3891
3899
|
cols.unshift({
|
|
3892
3900
|
header: "#",
|
|
3893
3901
|
id: "index",
|
|
3894
|
-
width:
|
|
3895
|
-
className: "whitespace-nowrap
|
|
3896
|
-
cell: (info) => info.row.index + 1 + startIndex
|
|
3902
|
+
width: 75,
|
|
3903
|
+
className: "whitespace-nowrap px-2 text-center",
|
|
3904
|
+
cell: (info) => /* @__PURE__ */ jsx25("span", { className: "tabular-nums", children: info.row.index + 1 + startIndex })
|
|
3897
3905
|
});
|
|
3898
3906
|
}
|
|
3899
3907
|
return cols;
|
|
@@ -3939,7 +3947,7 @@ function SimpleTable({
|
|
|
3939
3947
|
},
|
|
3940
3948
|
headerGroup.id
|
|
3941
3949
|
)) }),
|
|
3942
|
-
/* @__PURE__ */ jsx25("tbody", { className: "text-black dark:text-white font-semibold font-sans tabular-nums", children: isLoading ? Array.from({ length:
|
|
3950
|
+
/* @__PURE__ */ jsx25("tbody", { className: "text-black dark:text-white font-semibold font-sans tabular-nums", children: isLoading && data.length === 0 ? Array.from({ length: skeletonCount }).map((_, i) => /* @__PURE__ */ jsx25(
|
|
3943
3951
|
"tr",
|
|
3944
3952
|
{
|
|
3945
3953
|
className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-100 dark:border-zinc-800/60 last:border-0"}`,
|
|
@@ -3947,13 +3955,18 @@ function SimpleTable({
|
|
|
3947
3955
|
"td",
|
|
3948
3956
|
{
|
|
3949
3957
|
className: `text-sm ${rowPadding} align-top ${verticalLines ? "border-x border-black dark:border-white" : ""}`,
|
|
3950
|
-
children: /* @__PURE__ */ jsx25(
|
|
3958
|
+
children: /* @__PURE__ */ jsx25(
|
|
3959
|
+
"div",
|
|
3960
|
+
{
|
|
3961
|
+
className: `h-4 bg-gray-200 dark:bg-zinc-800/50 rounded-sm animate-pulse ${colIdx % 2 === 0 ? "w-3/4" : "w-1/2"} ${colIdx === 0 ? "w-4" : ""}`
|
|
3962
|
+
}
|
|
3963
|
+
)
|
|
3951
3964
|
},
|
|
3952
3965
|
`skeleton-col-${colIdx}`
|
|
3953
3966
|
))
|
|
3954
3967
|
},
|
|
3955
3968
|
`skeleton-row-${i}`
|
|
3956
|
-
)) : data.length === 0 ? /* @__PURE__ */ jsx25("tr", { children: /* @__PURE__ */ jsx25(
|
|
3969
|
+
)) : data.length === 0 && !isLoading ? /* @__PURE__ */ jsx25("tr", { children: /* @__PURE__ */ jsx25(
|
|
3957
3970
|
"td",
|
|
3958
3971
|
{
|
|
3959
3972
|
colSpan: columns.length,
|
|
@@ -4060,23 +4073,35 @@ var Branding = ({
|
|
|
4060
4073
|
// src/hooks/Fetches/useA4DataView.tsx
|
|
4061
4074
|
import { useEffect as useEffect11, useRef as useRef6, useState as useState16 } from "react";
|
|
4062
4075
|
import { useReactToPrint } from "react-to-print";
|
|
4063
|
-
import {
|
|
4076
|
+
import {
|
|
4077
|
+
RefreshCw,
|
|
4078
|
+
Printer,
|
|
4079
|
+
AlertCircle,
|
|
4080
|
+
FileX,
|
|
4081
|
+
ChevronLeft,
|
|
4082
|
+
ChevronRight as ChevronRight2
|
|
4083
|
+
} from "lucide-react";
|
|
4064
4084
|
import { jsx as jsx28, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4065
4085
|
var useA4StatementView = ({
|
|
4066
4086
|
url,
|
|
4067
4087
|
v = 1,
|
|
4068
4088
|
delay,
|
|
4069
|
-
params
|
|
4089
|
+
params,
|
|
4090
|
+
startPage = 1
|
|
4070
4091
|
} = {}) => {
|
|
4071
4092
|
const { data: apiData, isLoading, get, error: apiError } = useApis_default();
|
|
4072
4093
|
const contentRef = useRef6(null);
|
|
4073
4094
|
const reactToPrintFn = useReactToPrint({
|
|
4074
4095
|
contentRef
|
|
4075
4096
|
});
|
|
4076
|
-
|
|
4097
|
+
const getData = async () => {
|
|
4077
4098
|
if (url) {
|
|
4078
|
-
|
|
4099
|
+
console.log("url", delay);
|
|
4100
|
+
await get({ url, v, params, delay });
|
|
4079
4101
|
}
|
|
4102
|
+
};
|
|
4103
|
+
useEffect11(() => {
|
|
4104
|
+
getData();
|
|
4080
4105
|
}, [url, v, JSON.stringify(params), delay]);
|
|
4081
4106
|
const A4DataViewComponent = ({
|
|
4082
4107
|
columns = [
|
|
@@ -4100,13 +4125,18 @@ var useA4StatementView = ({
|
|
|
4100
4125
|
rowPadding = "p-3",
|
|
4101
4126
|
verticalLines = true,
|
|
4102
4127
|
headers,
|
|
4103
|
-
tableTitle = "Recent Transactions"
|
|
4128
|
+
tableTitle = "Recent Transactions",
|
|
4129
|
+
startPage: componentStartPage = startPage,
|
|
4130
|
+
isLoading: externalLoading
|
|
4104
4131
|
}) => {
|
|
4105
4132
|
const { store } = useWarqadConfig();
|
|
4133
|
+
const isActuallyLoading = externalLoading ?? isLoading;
|
|
4106
4134
|
const measureContainerRef = useRef6(null);
|
|
4107
4135
|
const [pages, setPages] = useState16([]);
|
|
4108
4136
|
const [isMeasuring, setIsMeasuring] = useState16(true);
|
|
4109
4137
|
const [globalFilter, setGlobalFilter] = useState16("");
|
|
4138
|
+
const [currentPageIndex, setCurrentPageIndex] = useState16(0);
|
|
4139
|
+
const [pageSearch, setPageSearch] = useState16("");
|
|
4110
4140
|
const displayColumnsForSearch = columns.filter((col) => !col.hide);
|
|
4111
4141
|
const filteredDisplayData = data.filter((row) => {
|
|
4112
4142
|
if (!globalFilter) return true;
|
|
@@ -4155,11 +4185,15 @@ var useA4StatementView = ({
|
|
|
4155
4185
|
if (filteredDisplayData && filteredDisplayData.length > 0) {
|
|
4156
4186
|
setIsMeasuring(true);
|
|
4157
4187
|
setPages((prev) => prev.length === 0 ? [[]] : prev);
|
|
4188
|
+
if (componentStartPage !== -1) {
|
|
4189
|
+
setCurrentPageIndex(Math.max(0, componentStartPage - 1));
|
|
4190
|
+
}
|
|
4158
4191
|
} else {
|
|
4159
4192
|
setIsMeasuring(false);
|
|
4160
4193
|
setPages(
|
|
4161
4194
|
(prev) => prev.length === 1 && prev[0].length === 0 ? prev : [[]]
|
|
4162
4195
|
);
|
|
4196
|
+
setCurrentPageIndex(0);
|
|
4163
4197
|
}
|
|
4164
4198
|
}, [depsString]);
|
|
4165
4199
|
useEffect11(() => {
|
|
@@ -4181,7 +4215,6 @@ var useA4StatementView = ({
|
|
|
4181
4215
|
const thHeight = getH(tableHeaderEl);
|
|
4182
4216
|
const tfHeight = getH(tableFooterEl);
|
|
4183
4217
|
const finalTotalHeight = getH(finalTotalEl);
|
|
4184
|
-
const MAX_CONTENT_HEIGHT = 950;
|
|
4185
4218
|
let currentChunks = [];
|
|
4186
4219
|
let currentChunk = [];
|
|
4187
4220
|
let currentHeight = headerHeight + infoGridHeight + tableTitleHeight + thHeight + tfHeight;
|
|
@@ -4189,7 +4222,8 @@ var useA4StatementView = ({
|
|
|
4189
4222
|
const rowHeight = getH(row);
|
|
4190
4223
|
const isLastRow = i === rowEls.length - 1;
|
|
4191
4224
|
const requiredHeight = isLastRow ? rowHeight + finalTotalHeight : rowHeight;
|
|
4192
|
-
|
|
4225
|
+
const currentPageLimit = currentChunks.length === 0 ? 920 : 980;
|
|
4226
|
+
if (currentHeight + requiredHeight > currentPageLimit) {
|
|
4193
4227
|
if (currentChunk.length > 0) {
|
|
4194
4228
|
currentChunks.push([...currentChunk]);
|
|
4195
4229
|
currentChunk = [];
|
|
@@ -4205,7 +4239,15 @@ var useA4StatementView = ({
|
|
|
4205
4239
|
const validPages = currentChunks.filter(
|
|
4206
4240
|
(chunk) => chunk && chunk.length > 0
|
|
4207
4241
|
);
|
|
4208
|
-
|
|
4242
|
+
const finalPages = validPages.length > 0 ? validPages : [[]];
|
|
4243
|
+
setPages(finalPages);
|
|
4244
|
+
if (componentStartPage === -1) {
|
|
4245
|
+
setCurrentPageIndex(finalPages.length - 1);
|
|
4246
|
+
} else if (componentStartPage > 1) {
|
|
4247
|
+
setCurrentPageIndex(
|
|
4248
|
+
Math.min(componentStartPage - 1, finalPages.length - 1)
|
|
4249
|
+
);
|
|
4250
|
+
}
|
|
4209
4251
|
setIsMeasuring(false);
|
|
4210
4252
|
}, 150);
|
|
4211
4253
|
return () => clearTimeout(timer);
|
|
@@ -4231,15 +4273,22 @@ var useA4StatementView = ({
|
|
|
4231
4273
|
]
|
|
4232
4274
|
}
|
|
4233
4275
|
);
|
|
4234
|
-
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ jsx28("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ jsx28(
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4276
|
+
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ jsx28("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ jsx28(
|
|
4277
|
+
InfoGrid,
|
|
4278
|
+
{
|
|
4279
|
+
className: "mb-4",
|
|
4280
|
+
items: info,
|
|
4281
|
+
isLoading: isActuallyLoading
|
|
4282
|
+
}
|
|
4283
|
+
) }) : null;
|
|
4284
|
+
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ jsx28("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ jsxs20("div", { className: "flex flex-col items-center justify-center p-8 bg-gray-50/50 dark:bg-zinc-900/30 rounded-2xl border border-dashed border-gray-300 dark:border-zinc-700 w-full max-w-lg text-center shadow-sm", children: [
|
|
4285
|
+
isActuallyLoading ? /* @__PURE__ */ jsx28("div", { className: "mb-4", children: /* @__PURE__ */ jsx28(ClassicSpin, {}) }) : error ? /* @__PURE__ */ jsx28("div", { className: "w-14 h-14 bg-red-100 dark:bg-red-500/10 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx28(AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ jsx28("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ jsx28(FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
4286
|
+
/* @__PURE__ */ jsx28("h3", { className: "text-lg font-bold text-gray-900 dark:text-white mb-2", children: isActuallyLoading ? "Loading data..." : error ? "Failed to Load Statement" : "No Records Found" }),
|
|
4287
|
+
/* @__PURE__ */ jsx28("p", { className: "text-sm text-gray-500 dark:text-gray-400 max-w-xs mb-6 leading-relaxed", children: isActuallyLoading ? "Please wait while we prepare your statement." : error ? typeof error === "string" ? error : "An unexpected error occurred while fetching the statement data." : "There are no transactions or records available in this requested statement." }),
|
|
4288
|
+
url && !isActuallyLoading && /* @__PURE__ */ jsxs20(
|
|
4240
4289
|
"button",
|
|
4241
4290
|
{
|
|
4242
|
-
onClick: () =>
|
|
4291
|
+
onClick: () => getData(),
|
|
4243
4292
|
className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
|
|
4244
4293
|
children: [
|
|
4245
4294
|
/* @__PURE__ */ jsx28(RefreshCw, { size: 14 }),
|
|
@@ -4247,7 +4296,7 @@ var useA4StatementView = ({
|
|
|
4247
4296
|
]
|
|
4248
4297
|
}
|
|
4249
4298
|
)
|
|
4250
|
-
] }) }) :
|
|
4299
|
+
] }) }) : null;
|
|
4251
4300
|
return /* @__PURE__ */ jsxs20("div", { className: "flex flex-col relative w-full items-center", children: [
|
|
4252
4301
|
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ jsx28("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ jsx28(
|
|
4253
4302
|
"div",
|
|
@@ -4283,82 +4332,157 @@ var useA4StatementView = ({
|
|
|
4283
4332
|
}
|
|
4284
4333
|
) }),
|
|
4285
4334
|
/* @__PURE__ */ jsx28("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ jsx28("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageData, pageIndex) => /* @__PURE__ */ jsx28(
|
|
4286
|
-
|
|
4335
|
+
"div",
|
|
4287
4336
|
{
|
|
4288
|
-
className: "w-full",
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4337
|
+
className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
|
|
4338
|
+
children: /* @__PURE__ */ jsx28(
|
|
4339
|
+
PageA4,
|
|
4340
|
+
{
|
|
4341
|
+
className: "w-full",
|
|
4342
|
+
pageNumber: pageIndex + 1,
|
|
4343
|
+
totalPages: pages.length,
|
|
4344
|
+
isLastPage: pageIndex === pages.length - 1,
|
|
4345
|
+
children: /* @__PURE__ */ jsxs20("div", { className: "flex flex-col h-full grow w-full", children: [
|
|
4346
|
+
/* @__PURE__ */ jsxs20("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
|
|
4347
|
+
headers,
|
|
4348
|
+
printable && pageIndex === currentPageIndex && /* @__PURE__ */ jsx28("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-2", children: [
|
|
4349
|
+
/* @__PURE__ */ jsxs20(
|
|
4350
|
+
"button",
|
|
4351
|
+
{
|
|
4352
|
+
onClick: async () => await getData(),
|
|
4353
|
+
disabled: isLoading,
|
|
4354
|
+
className: "flex items-center gap-2 px-3 py-1.5 text-gray-600 dark:text-gray-300 hover:text-black dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-800 rounded-lg transition-all disabled:opacity-50",
|
|
4355
|
+
children: [
|
|
4356
|
+
/* @__PURE__ */ jsx28(
|
|
4357
|
+
RefreshCw,
|
|
4358
|
+
{
|
|
4359
|
+
size: 16,
|
|
4360
|
+
className: isLoading ? "animate-spin" : ""
|
|
4361
|
+
}
|
|
4362
|
+
),
|
|
4363
|
+
/* @__PURE__ */ jsx28("span", { className: "text-xs font-semibold", children: "Reload" })
|
|
4364
|
+
]
|
|
4365
|
+
}
|
|
4366
|
+
),
|
|
4367
|
+
/* @__PURE__ */ jsxs20(
|
|
4368
|
+
"button",
|
|
4369
|
+
{
|
|
4370
|
+
onClick: () => reactToPrintFn(),
|
|
4371
|
+
className: "flex items-center gap-2 px-4 py-1.5 bg-black dark:bg-zinc-800 text-white rounded-md text-xs font-bold shadow-sm hover:bg-zinc-800 dark:hover:bg-zinc-700 transition-all active:scale-95",
|
|
4372
|
+
children: [
|
|
4373
|
+
/* @__PURE__ */ jsx28(Printer, { size: 16 }),
|
|
4374
|
+
"Print"
|
|
4375
|
+
]
|
|
4376
|
+
}
|
|
4377
|
+
),
|
|
4378
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
|
|
4303
4379
|
/* @__PURE__ */ jsx28(
|
|
4304
|
-
|
|
4380
|
+
"button",
|
|
4305
4381
|
{
|
|
4306
|
-
|
|
4307
|
-
|
|
4382
|
+
onClick: (e) => {
|
|
4383
|
+
e.stopPropagation();
|
|
4384
|
+
setCurrentPageIndex(
|
|
4385
|
+
(p) => Math.max(0, p - 1)
|
|
4386
|
+
);
|
|
4387
|
+
},
|
|
4388
|
+
disabled: currentPageIndex === 0,
|
|
4389
|
+
className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
|
|
4390
|
+
children: /* @__PURE__ */ jsx28(ChevronLeft, { size: 18 })
|
|
4308
4391
|
}
|
|
4309
4392
|
),
|
|
4310
|
-
/* @__PURE__ */
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4393
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
|
|
4394
|
+
/* @__PURE__ */ jsxs20(
|
|
4395
|
+
Select,
|
|
4396
|
+
{
|
|
4397
|
+
value: currentPageIndex + 1,
|
|
4398
|
+
onChange: (val) => {
|
|
4399
|
+
const num = Number(val);
|
|
4400
|
+
if (!isNaN(num)) {
|
|
4401
|
+
setCurrentPageIndex(num - 1);
|
|
4402
|
+
}
|
|
4403
|
+
},
|
|
4404
|
+
variant: "ghost",
|
|
4405
|
+
containerClassName: "inline-block",
|
|
4406
|
+
children: [
|
|
4407
|
+
/* @__PURE__ */ jsx28(SelectTrigger, { className: "h-7 px-2 min-w-[40px] border border-gray-200 dark:border-zinc-700 rounded flex items-center justify-center bg-white dark:bg-zinc-900 hover:bg-gray-100 dark:hover:bg-zinc-800 transition-colors", children: /* @__PURE__ */ jsx28("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
|
|
4408
|
+
/* @__PURE__ */ jsxs20(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
|
|
4409
|
+
/* @__PURE__ */ jsx28("div", { className: "p-2 border-b border-gray-100 dark:border-zinc-800 sticky top-0 bg-white dark:bg-zinc-950 z-10", children: /* @__PURE__ */ jsx28(
|
|
4410
|
+
"input",
|
|
4411
|
+
{
|
|
4412
|
+
type: "text",
|
|
4413
|
+
placeholder: "Page...",
|
|
4414
|
+
className: "w-full px-2 py-1 text-[11px] border rounded bg-gray-50 dark:bg-zinc-900 border-gray-200 dark:border-zinc-800 outline-none focus:ring-1 focus:ring-blue-500 text-gray-900 dark:text-white",
|
|
4415
|
+
value: pageSearch,
|
|
4416
|
+
onChange: (e) => setPageSearch(e.target.value),
|
|
4417
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
4418
|
+
autoFocus: true
|
|
4419
|
+
}
|
|
4420
|
+
) }),
|
|
4421
|
+
/* @__PURE__ */ jsx28("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
|
|
4422
|
+
(p) => String(p).includes(pageSearch)
|
|
4423
|
+
).map((p) => /* @__PURE__ */ jsx28(SelectItem, { value: p, children: p }, p)) })
|
|
4424
|
+
] })
|
|
4425
|
+
]
|
|
4426
|
+
}
|
|
4427
|
+
),
|
|
4428
|
+
/* @__PURE__ */ jsx28("span", { className: "text-gray-400 mx-0.5", children: "/" }),
|
|
4429
|
+
/* @__PURE__ */ jsx28("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
|
|
4430
|
+
] }),
|
|
4431
|
+
/* @__PURE__ */ jsx28(
|
|
4432
|
+
"button",
|
|
4433
|
+
{
|
|
4434
|
+
onClick: (e) => {
|
|
4435
|
+
e.stopPropagation();
|
|
4436
|
+
setCurrentPageIndex(
|
|
4437
|
+
(p) => Math.min(pages.length - 1, p + 1)
|
|
4438
|
+
);
|
|
4439
|
+
},
|
|
4440
|
+
disabled: currentPageIndex === pages.length - 1,
|
|
4441
|
+
className: "p-1 rounded hover:bg-gray-100 dark:hover:bg-zinc-800 disabled:opacity-30 transition-colors text-gray-600 dark:text-gray-400",
|
|
4442
|
+
children: /* @__PURE__ */ jsx28(ChevronRight2, { size: 18 })
|
|
4443
|
+
}
|
|
4444
|
+
)
|
|
4445
|
+
] })
|
|
4446
|
+
] }) })
|
|
4447
|
+
] }),
|
|
4448
|
+
pageIndex === 0 && HeaderEl,
|
|
4449
|
+
pageIndex === 0 && DisplayInfoGridEl,
|
|
4450
|
+
/* @__PURE__ */ jsxs20("div", { className: "grow w-full px-8 pb-8", children: [
|
|
4451
|
+
pageIndex === 0 && /* @__PURE__ */ jsxs20("div", { className: "mb-4 border-b border-gray-200 dark:border-zinc-700 print:border-gray-200 pb-2 flex items-center gap-2 justify-between px-2 mt-2 print:hidden", children: [
|
|
4452
|
+
/* @__PURE__ */ jsx28("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
|
|
4453
|
+
/* @__PURE__ */ jsx28(
|
|
4454
|
+
"input",
|
|
4455
|
+
{
|
|
4456
|
+
type: "text",
|
|
4457
|
+
value: globalFilter,
|
|
4458
|
+
onChange: (e) => setGlobalFilter(e.target.value),
|
|
4459
|
+
placeholder: "Search...",
|
|
4460
|
+
className: "block w-full max-w-xs px-3 py-2 border border-gray-300 rounded-md text-sm shadow-sm focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 dark:bg-zinc-900 dark:border-zinc-700 dark:text-white"
|
|
4461
|
+
}
|
|
4462
|
+
)
|
|
4463
|
+
] }),
|
|
4464
|
+
pageIndex === 0 && /* @__PURE__ */ jsx28("div", { className: "hidden print:flex mb-4 border-b border-gray-200 print:border-gray-200 pb-2 items-center gap-2 justify-between px-2 mt-2", children: /* @__PURE__ */ jsx28("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
4465
|
+
pageIndex > 0 && /* @__PURE__ */ jsx28("div", { className: "h-7 print:h-0" }),
|
|
4466
|
+
statusOverlay ? /* @__PURE__ */ jsx28("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ jsx28(
|
|
4467
|
+
SimpleTable,
|
|
4468
|
+
{
|
|
4469
|
+
columns,
|
|
4470
|
+
data: pageData,
|
|
4471
|
+
className: "bg-transparent!",
|
|
4472
|
+
rowPadding,
|
|
4473
|
+
index,
|
|
4474
|
+
startIndex: pages.slice(0, pageIndex).reduce((acc, curr) => acc + curr.length, 0),
|
|
4475
|
+
verticalLines,
|
|
4476
|
+
emptyState: null,
|
|
4477
|
+
isLoading: isActuallyLoading || isMeasuring && pages.length === 1 && pages[0].length === 0
|
|
4478
|
+
}
|
|
4479
|
+
),
|
|
4480
|
+
pageIndex === pages.length - 1 && !isActuallyLoading && !statusOverlay && DisplayFinalTotalEl
|
|
4481
|
+
] })
|
|
4482
|
+
] })
|
|
4483
|
+
},
|
|
4484
|
+
pageIndex
|
|
4485
|
+
)
|
|
4362
4486
|
},
|
|
4363
4487
|
pageIndex
|
|
4364
4488
|
)) }) })
|
|
@@ -4372,11 +4496,6 @@ var useA4StatementView = ({
|
|
|
4372
4496
|
reactToPrintFn
|
|
4373
4497
|
};
|
|
4374
4498
|
};
|
|
4375
|
-
var A4DataView = (props) => {
|
|
4376
|
-
const { url, v, delay, params, ...rest } = props;
|
|
4377
|
-
const { A4DataView: View } = useA4StatementView({ url, v, delay, params });
|
|
4378
|
-
return /* @__PURE__ */ jsx28(View, { ...rest });
|
|
4379
|
-
};
|
|
4380
4499
|
var useA4DataView_default = useA4StatementView;
|
|
4381
4500
|
|
|
4382
4501
|
// src/hooks/Fetches/useTransaction.tsx
|
|
@@ -4397,12 +4516,13 @@ var useTransaction = ({
|
|
|
4397
4516
|
if (date) dateObj.date = date;
|
|
4398
4517
|
const { data: apiData, isLoading, get, error: apiError } = useApis_default();
|
|
4399
4518
|
const getData = () => {
|
|
4519
|
+
console.log(dateObj);
|
|
4400
4520
|
get({
|
|
4401
4521
|
url,
|
|
4402
4522
|
v,
|
|
4403
4523
|
params: {
|
|
4404
|
-
...
|
|
4405
|
-
...
|
|
4524
|
+
...params,
|
|
4525
|
+
...dateObj
|
|
4406
4526
|
},
|
|
4407
4527
|
delay
|
|
4408
4528
|
});
|
|
@@ -4445,7 +4565,7 @@ var useTransaction = ({
|
|
|
4445
4565
|
url && /* @__PURE__ */ jsxs21(
|
|
4446
4566
|
"button",
|
|
4447
4567
|
{
|
|
4448
|
-
onClick: () =>
|
|
4568
|
+
onClick: () => getData(),
|
|
4449
4569
|
className: "flex items-center gap-2 px-5 py-2 bg-black dark:bg-white text-white dark:text-black font-semibold rounded-lg shadow-md hover:bg-gray-800 dark:hover:bg-gray-100 transition-all active:scale-95 text-sm",
|
|
4450
4570
|
children: [
|
|
4451
4571
|
/* @__PURE__ */ jsx29(RefreshCw2, { size: 14 }),
|
|
@@ -4702,7 +4822,6 @@ var storage = {
|
|
|
4702
4822
|
}
|
|
4703
4823
|
};
|
|
4704
4824
|
export {
|
|
4705
|
-
A4DataView,
|
|
4706
4825
|
Badge,
|
|
4707
4826
|
Branding,
|
|
4708
4827
|
Button,
|