warqadui 0.0.41 → 0.0.43
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 +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/index.js +211 -106
- package/dist/index.mjs +219 -106
- package/dist/styles.js +37 -0
- package/dist/styles.mjs +37 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -499,8 +499,9 @@ interface SimpleTableProps<TData> {
|
|
|
499
499
|
title?: string;
|
|
500
500
|
enableSearch?: boolean;
|
|
501
501
|
emptyState?: React__default.ReactNode;
|
|
502
|
+
skeletonCount?: number;
|
|
502
503
|
}
|
|
503
|
-
declare function SimpleTable<TData>({ columns: userColumns, data, className, renderFooter: componentFooter, rowPadding, verticalLines, index, startIndex, isLoading, title, enableSearch, emptyState, }: SimpleTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
504
|
+
declare function SimpleTable<TData>({ columns: userColumns, data, className, renderFooter: componentFooter, rowPadding, verticalLines, index, startIndex, isLoading, title, enableSearch, emptyState, skeletonCount, }: SimpleTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
504
505
|
|
|
505
506
|
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
506
507
|
variant?: "primary" | "danger" | "warning" | "success";
|
|
@@ -571,13 +572,14 @@ declare const useApi: () => {
|
|
|
571
572
|
}>;
|
|
572
573
|
};
|
|
573
574
|
|
|
574
|
-
declare const useA4StatementView: ({ url, v, delay, params, }?: {
|
|
575
|
+
declare const useA4StatementView: ({ url, v, delay, params, startPage, }?: {
|
|
575
576
|
url?: string;
|
|
576
577
|
v?: 0 | 1 | 2;
|
|
577
578
|
delay?: number;
|
|
578
579
|
params?: Record<string, any>;
|
|
580
|
+
startPage?: number;
|
|
579
581
|
}) => {
|
|
580
|
-
A4DataView: ({ columns, data, error, info, index, title, subtitle, printable, rowPadding, verticalLines, headers, tableTitle, }: {
|
|
582
|
+
A4DataView: ({ columns, data, error, info, index, title, subtitle, printable, rowPadding, verticalLines, headers, tableTitle, startPage: componentStartPage, isLoading: externalLoading, }: {
|
|
581
583
|
tableTitle?: string;
|
|
582
584
|
columns?: SimpleTableColumn<any>[];
|
|
583
585
|
data?: any[];
|
|
@@ -590,20 +592,21 @@ declare const useA4StatementView: ({ url, v, delay, params, }?: {
|
|
|
590
592
|
rowPadding?: string;
|
|
591
593
|
verticalLines?: boolean;
|
|
592
594
|
headers?: React.ReactNode;
|
|
595
|
+
startPage?: number;
|
|
596
|
+
isLoading?: boolean;
|
|
593
597
|
}) => react_jsx_runtime.JSX.Element;
|
|
594
598
|
data: any;
|
|
595
599
|
isLoading: boolean;
|
|
596
600
|
get: FetchFunction;
|
|
597
601
|
reactToPrintFn: react_to_print.UseReactToPrintFn;
|
|
598
602
|
};
|
|
599
|
-
type A4DataViewProps = Parameters<ReturnType<typeof useA4StatementView>["A4DataView"]>[0] & Parameters<typeof useA4StatementView>[0];
|
|
600
|
-
declare const A4DataView: (props: A4DataViewProps) => react_jsx_runtime.JSX.Element;
|
|
601
603
|
|
|
602
|
-
declare const useTransaction: ({ url, v, delay, params, }: {
|
|
604
|
+
declare const useTransaction: ({ url, v, delay, params, dateFilter, }: {
|
|
603
605
|
url: string;
|
|
604
606
|
v?: 0 | 1 | 2;
|
|
605
607
|
delay?: number;
|
|
606
608
|
params?: Record<string, any>;
|
|
609
|
+
dateFilter?: boolean;
|
|
607
610
|
}) => {
|
|
608
611
|
TransactionViewComponent: ({ columns, data, error, pageRows, searchPlaceholder, selectable, filterables, verticalLines, index, rowPadding, className, title, description, onCreate, createTitle, ...rest }: {
|
|
609
612
|
columns: DataTableColumn[];
|
|
@@ -709,4 +712,4 @@ interface StorageManager {
|
|
|
709
712
|
*/
|
|
710
713
|
declare const storage: StorageManager;
|
|
711
714
|
|
|
712
|
-
export {
|
|
715
|
+
export { Badge, type BadgeProps, Branding, type BrandingProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ClassicSpin, CodeBlock, DashboardLayout, DataTable, type DataTableColumn, DateInput, type DateInputProps, type DeleteFunction, type FetchFunction, type FetchProps, Fields, InfoGrid, Input, type InputProps, LoadingBox, LoadingSpin, Modal, type ModalProps, type NavItem, type NavItems, type Option, OverlaySpin, PageA4, PageHeader, type PdfOptions, PhoneInput, type PhoneInputProps, type PostFunction, PostTable, type PostTableActions, type PostTableChangeParams, type PutFunction, SearchApi, SearchApiContent, SearchApiInput, SearchApiItem, type SearchApiProps, SearchApiTrigger, Select, SelectContent, SelectItem, type SelectProps, SelectTrigger, SimpleTable, type SimpleTableColumn, type StorageManager, type StoreConfig, Textarea, type TextareaProps, type ThemeConfig, ThemeProvider, ThemeToggle, type UseModalReturn, type WarqadConfig, type WarqadConfigContextType, WarqadProvider, generatePdf, storage, useA4StatementView, useApi, useModal, useSearchApiContext, useSelectContext, useTheme, useTransaction, useWarqadConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -499,8 +499,9 @@ interface SimpleTableProps<TData> {
|
|
|
499
499
|
title?: string;
|
|
500
500
|
enableSearch?: boolean;
|
|
501
501
|
emptyState?: React__default.ReactNode;
|
|
502
|
+
skeletonCount?: number;
|
|
502
503
|
}
|
|
503
|
-
declare function SimpleTable<TData>({ columns: userColumns, data, className, renderFooter: componentFooter, rowPadding, verticalLines, index, startIndex, isLoading, title, enableSearch, emptyState, }: SimpleTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
504
|
+
declare function SimpleTable<TData>({ columns: userColumns, data, className, renderFooter: componentFooter, rowPadding, verticalLines, index, startIndex, isLoading, title, enableSearch, emptyState, skeletonCount, }: SimpleTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
504
505
|
|
|
505
506
|
interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
506
507
|
variant?: "primary" | "danger" | "warning" | "success";
|
|
@@ -571,13 +572,14 @@ declare const useApi: () => {
|
|
|
571
572
|
}>;
|
|
572
573
|
};
|
|
573
574
|
|
|
574
|
-
declare const useA4StatementView: ({ url, v, delay, params, }?: {
|
|
575
|
+
declare const useA4StatementView: ({ url, v, delay, params, startPage, }?: {
|
|
575
576
|
url?: string;
|
|
576
577
|
v?: 0 | 1 | 2;
|
|
577
578
|
delay?: number;
|
|
578
579
|
params?: Record<string, any>;
|
|
580
|
+
startPage?: number;
|
|
579
581
|
}) => {
|
|
580
|
-
A4DataView: ({ columns, data, error, info, index, title, subtitle, printable, rowPadding, verticalLines, headers, tableTitle, }: {
|
|
582
|
+
A4DataView: ({ columns, data, error, info, index, title, subtitle, printable, rowPadding, verticalLines, headers, tableTitle, startPage: componentStartPage, isLoading: externalLoading, }: {
|
|
581
583
|
tableTitle?: string;
|
|
582
584
|
columns?: SimpleTableColumn<any>[];
|
|
583
585
|
data?: any[];
|
|
@@ -590,20 +592,21 @@ declare const useA4StatementView: ({ url, v, delay, params, }?: {
|
|
|
590
592
|
rowPadding?: string;
|
|
591
593
|
verticalLines?: boolean;
|
|
592
594
|
headers?: React.ReactNode;
|
|
595
|
+
startPage?: number;
|
|
596
|
+
isLoading?: boolean;
|
|
593
597
|
}) => react_jsx_runtime.JSX.Element;
|
|
594
598
|
data: any;
|
|
595
599
|
isLoading: boolean;
|
|
596
600
|
get: FetchFunction;
|
|
597
601
|
reactToPrintFn: react_to_print.UseReactToPrintFn;
|
|
598
602
|
};
|
|
599
|
-
type A4DataViewProps = Parameters<ReturnType<typeof useA4StatementView>["A4DataView"]>[0] & Parameters<typeof useA4StatementView>[0];
|
|
600
|
-
declare const A4DataView: (props: A4DataViewProps) => react_jsx_runtime.JSX.Element;
|
|
601
603
|
|
|
602
|
-
declare const useTransaction: ({ url, v, delay, params, }: {
|
|
604
|
+
declare const useTransaction: ({ url, v, delay, params, dateFilter, }: {
|
|
603
605
|
url: string;
|
|
604
606
|
v?: 0 | 1 | 2;
|
|
605
607
|
delay?: number;
|
|
606
608
|
params?: Record<string, any>;
|
|
609
|
+
dateFilter?: boolean;
|
|
607
610
|
}) => {
|
|
608
611
|
TransactionViewComponent: ({ columns, data, error, pageRows, searchPlaceholder, selectable, filterables, verticalLines, index, rowPadding, className, title, description, onCreate, createTitle, ...rest }: {
|
|
609
612
|
columns: DataTableColumn[];
|
|
@@ -709,4 +712,4 @@ interface StorageManager {
|
|
|
709
712
|
*/
|
|
710
713
|
declare const storage: StorageManager;
|
|
711
714
|
|
|
712
|
-
export {
|
|
715
|
+
export { Badge, type BadgeProps, Branding, type BrandingProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, ClassicSpin, CodeBlock, DashboardLayout, DataTable, type DataTableColumn, DateInput, type DateInputProps, type DeleteFunction, type FetchFunction, type FetchProps, Fields, InfoGrid, Input, type InputProps, LoadingBox, LoadingSpin, Modal, type ModalProps, type NavItem, type NavItems, type Option, OverlaySpin, PageA4, PageHeader, type PdfOptions, PhoneInput, type PhoneInputProps, type PostFunction, PostTable, type PostTableActions, type PostTableChangeParams, type PutFunction, SearchApi, SearchApiContent, SearchApiInput, SearchApiItem, type SearchApiProps, SearchApiTrigger, Select, SelectContent, SelectItem, type SelectProps, SelectTrigger, SimpleTable, type SimpleTableColumn, type StorageManager, type StoreConfig, Textarea, type TextareaProps, type ThemeConfig, ThemeProvider, ThemeToggle, type UseModalReturn, type WarqadConfig, type WarqadConfigContextType, WarqadProvider, generatePdf, storage, useA4StatementView, useApi, useModal, useSearchApiContext, useSelectContext, useTheme, useTransaction, useWarqadConfig };
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
A4DataView: () => A4DataView,
|
|
34
33
|
Badge: () => Badge,
|
|
35
34
|
Branding: () => Branding,
|
|
36
35
|
Button: () => Button,
|
|
@@ -3907,7 +3906,8 @@ function SimpleTable({
|
|
|
3907
3906
|
isLoading = false,
|
|
3908
3907
|
title,
|
|
3909
3908
|
enableSearch = false,
|
|
3910
|
-
emptyState
|
|
3909
|
+
emptyState,
|
|
3910
|
+
skeletonCount = 5
|
|
3911
3911
|
}) {
|
|
3912
3912
|
const columns = (0, import_react17.useMemo)(() => {
|
|
3913
3913
|
const cols = userColumns.filter((col) => !col.hide).map((col) => ({
|
|
@@ -3923,9 +3923,9 @@ function SimpleTable({
|
|
|
3923
3923
|
cols.unshift({
|
|
3924
3924
|
header: "#",
|
|
3925
3925
|
id: "index",
|
|
3926
|
-
width:
|
|
3927
|
-
className: "whitespace-nowrap
|
|
3928
|
-
cell: (info) => info.row.index + 1 + startIndex
|
|
3926
|
+
width: 75,
|
|
3927
|
+
className: "whitespace-nowrap px-2 text-center",
|
|
3928
|
+
cell: (info) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "tabular-nums", children: info.row.index + 1 + startIndex })
|
|
3929
3929
|
});
|
|
3930
3930
|
}
|
|
3931
3931
|
return cols;
|
|
@@ -3971,7 +3971,7 @@ function SimpleTable({
|
|
|
3971
3971
|
},
|
|
3972
3972
|
headerGroup.id
|
|
3973
3973
|
)) }),
|
|
3974
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tbody", { className: "text-black dark:text-white font-semibold font-sans tabular-nums", children: isLoading ? Array.from({ length:
|
|
3974
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("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__ */ (0, import_jsx_runtime25.jsx)(
|
|
3975
3975
|
"tr",
|
|
3976
3976
|
{
|
|
3977
3977
|
className: `border-b ${verticalLines ? "border-black dark:border-white" : "border-gray-100 dark:border-zinc-800/60 last:border-0"}`,
|
|
@@ -3979,13 +3979,18 @@ function SimpleTable({
|
|
|
3979
3979
|
"td",
|
|
3980
3980
|
{
|
|
3981
3981
|
className: `text-sm ${rowPadding} align-top ${verticalLines ? "border-x border-black dark:border-white" : ""}`,
|
|
3982
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3982
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3983
|
+
"div",
|
|
3984
|
+
{
|
|
3985
|
+
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" : ""}`
|
|
3986
|
+
}
|
|
3987
|
+
)
|
|
3983
3988
|
},
|
|
3984
3989
|
`skeleton-col-${colIdx}`
|
|
3985
3990
|
))
|
|
3986
3991
|
},
|
|
3987
3992
|
`skeleton-row-${i}`
|
|
3988
|
-
)) : data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3993
|
+
)) : data.length === 0 && !isLoading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3989
3994
|
"td",
|
|
3990
3995
|
{
|
|
3991
3996
|
colSpan: columns.length,
|
|
@@ -4098,17 +4103,22 @@ var useA4StatementView = ({
|
|
|
4098
4103
|
url,
|
|
4099
4104
|
v = 1,
|
|
4100
4105
|
delay,
|
|
4101
|
-
params
|
|
4106
|
+
params,
|
|
4107
|
+
startPage = 1
|
|
4102
4108
|
} = {}) => {
|
|
4103
4109
|
const { data: apiData, isLoading, get, error: apiError } = useApis_default();
|
|
4104
4110
|
const contentRef = (0, import_react19.useRef)(null);
|
|
4105
4111
|
const reactToPrintFn = (0, import_react_to_print.useReactToPrint)({
|
|
4106
4112
|
contentRef
|
|
4107
4113
|
});
|
|
4108
|
-
|
|
4114
|
+
const getData = async () => {
|
|
4109
4115
|
if (url) {
|
|
4110
|
-
|
|
4116
|
+
console.log("url", delay);
|
|
4117
|
+
await get({ url, v, params, delay });
|
|
4111
4118
|
}
|
|
4119
|
+
};
|
|
4120
|
+
(0, import_react19.useEffect)(() => {
|
|
4121
|
+
getData();
|
|
4112
4122
|
}, [url, v, JSON.stringify(params), delay]);
|
|
4113
4123
|
const A4DataViewComponent = ({
|
|
4114
4124
|
columns = [
|
|
@@ -4132,13 +4142,18 @@ var useA4StatementView = ({
|
|
|
4132
4142
|
rowPadding = "p-3",
|
|
4133
4143
|
verticalLines = true,
|
|
4134
4144
|
headers,
|
|
4135
|
-
tableTitle = "Recent Transactions"
|
|
4145
|
+
tableTitle = "Recent Transactions",
|
|
4146
|
+
startPage: componentStartPage = startPage,
|
|
4147
|
+
isLoading: externalLoading
|
|
4136
4148
|
}) => {
|
|
4137
4149
|
const { store } = useWarqadConfig();
|
|
4150
|
+
const isActuallyLoading = externalLoading ?? isLoading;
|
|
4138
4151
|
const measureContainerRef = (0, import_react19.useRef)(null);
|
|
4139
4152
|
const [pages, setPages] = (0, import_react19.useState)([]);
|
|
4140
4153
|
const [isMeasuring, setIsMeasuring] = (0, import_react19.useState)(true);
|
|
4141
4154
|
const [globalFilter, setGlobalFilter] = (0, import_react19.useState)("");
|
|
4155
|
+
const [currentPageIndex, setCurrentPageIndex] = (0, import_react19.useState)(0);
|
|
4156
|
+
const [pageSearch, setPageSearch] = (0, import_react19.useState)("");
|
|
4142
4157
|
const displayColumnsForSearch = columns.filter((col) => !col.hide);
|
|
4143
4158
|
const filteredDisplayData = data.filter((row) => {
|
|
4144
4159
|
if (!globalFilter) return true;
|
|
@@ -4187,11 +4202,15 @@ var useA4StatementView = ({
|
|
|
4187
4202
|
if (filteredDisplayData && filteredDisplayData.length > 0) {
|
|
4188
4203
|
setIsMeasuring(true);
|
|
4189
4204
|
setPages((prev) => prev.length === 0 ? [[]] : prev);
|
|
4205
|
+
if (componentStartPage !== -1) {
|
|
4206
|
+
setCurrentPageIndex(Math.max(0, componentStartPage - 1));
|
|
4207
|
+
}
|
|
4190
4208
|
} else {
|
|
4191
4209
|
setIsMeasuring(false);
|
|
4192
4210
|
setPages(
|
|
4193
4211
|
(prev) => prev.length === 1 && prev[0].length === 0 ? prev : [[]]
|
|
4194
4212
|
);
|
|
4213
|
+
setCurrentPageIndex(0);
|
|
4195
4214
|
}
|
|
4196
4215
|
}, [depsString]);
|
|
4197
4216
|
(0, import_react19.useEffect)(() => {
|
|
@@ -4213,7 +4232,6 @@ var useA4StatementView = ({
|
|
|
4213
4232
|
const thHeight = getH(tableHeaderEl);
|
|
4214
4233
|
const tfHeight = getH(tableFooterEl);
|
|
4215
4234
|
const finalTotalHeight = getH(finalTotalEl);
|
|
4216
|
-
const MAX_CONTENT_HEIGHT = 950;
|
|
4217
4235
|
let currentChunks = [];
|
|
4218
4236
|
let currentChunk = [];
|
|
4219
4237
|
let currentHeight = headerHeight + infoGridHeight + tableTitleHeight + thHeight + tfHeight;
|
|
@@ -4221,7 +4239,8 @@ var useA4StatementView = ({
|
|
|
4221
4239
|
const rowHeight = getH(row);
|
|
4222
4240
|
const isLastRow = i === rowEls.length - 1;
|
|
4223
4241
|
const requiredHeight = isLastRow ? rowHeight + finalTotalHeight : rowHeight;
|
|
4224
|
-
|
|
4242
|
+
const currentPageLimit = currentChunks.length === 0 ? 920 : 980;
|
|
4243
|
+
if (currentHeight + requiredHeight > currentPageLimit) {
|
|
4225
4244
|
if (currentChunk.length > 0) {
|
|
4226
4245
|
currentChunks.push([...currentChunk]);
|
|
4227
4246
|
currentChunk = [];
|
|
@@ -4237,7 +4256,15 @@ var useA4StatementView = ({
|
|
|
4237
4256
|
const validPages = currentChunks.filter(
|
|
4238
4257
|
(chunk) => chunk && chunk.length > 0
|
|
4239
4258
|
);
|
|
4240
|
-
|
|
4259
|
+
const finalPages = validPages.length > 0 ? validPages : [[]];
|
|
4260
|
+
setPages(finalPages);
|
|
4261
|
+
if (componentStartPage === -1) {
|
|
4262
|
+
setCurrentPageIndex(finalPages.length - 1);
|
|
4263
|
+
} else if (componentStartPage > 1) {
|
|
4264
|
+
setCurrentPageIndex(
|
|
4265
|
+
Math.min(componentStartPage - 1, finalPages.length - 1)
|
|
4266
|
+
);
|
|
4267
|
+
}
|
|
4241
4268
|
setIsMeasuring(false);
|
|
4242
4269
|
}, 150);
|
|
4243
4270
|
return () => clearTimeout(timer);
|
|
@@ -4263,15 +4290,22 @@ var useA4StatementView = ({
|
|
|
4263
4290
|
]
|
|
4264
4291
|
}
|
|
4265
4292
|
);
|
|
4266
|
-
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4293
|
+
const DisplayInfoGridEl = Array.isArray(info) && info.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { id: "a4-info-grid", className: "px-8", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4294
|
+
InfoGrid,
|
|
4295
|
+
{
|
|
4296
|
+
className: "mb-4",
|
|
4297
|
+
items: info,
|
|
4298
|
+
isLoading: isActuallyLoading
|
|
4299
|
+
}
|
|
4300
|
+
) }) : null;
|
|
4301
|
+
const statusOverlay = isActuallyLoading || error || !data || data.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col relative w-full items-center justify-center py-12 min-h-[400px]", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("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: [
|
|
4302
|
+
isActuallyLoading ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ClassicSpin, {}) }) : error ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.AlertCircle, { className: "w-7 h-7 text-red-600 dark:text-red-500" }) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-14 h-14 bg-gray-200 dark:bg-zinc-800 rounded-full flex items-center justify-center mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.FileX, { className: "w-7 h-7 text-gray-500 dark:text-gray-400" }) }),
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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" }),
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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." }),
|
|
4305
|
+
url && !isActuallyLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4272
4306
|
"button",
|
|
4273
4307
|
{
|
|
4274
|
-
onClick: () =>
|
|
4308
|
+
onClick: () => getData(),
|
|
4275
4309
|
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",
|
|
4276
4310
|
children: [
|
|
4277
4311
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.RefreshCw, { size: 14 }),
|
|
@@ -4279,7 +4313,7 @@ var useA4StatementView = ({
|
|
|
4279
4313
|
]
|
|
4280
4314
|
}
|
|
4281
4315
|
)
|
|
4282
|
-
] }) }) :
|
|
4316
|
+
] }) }) : null;
|
|
4283
4317
|
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col relative w-full items-center", children: [
|
|
4284
4318
|
isMeasuring && filteredDisplayData.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute top-0 opacity-0 pointer-events-none -left-full", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4285
4319
|
"div",
|
|
@@ -4315,82 +4349,157 @@ var useA4StatementView = ({
|
|
|
4315
4349
|
}
|
|
4316
4350
|
) }),
|
|
4317
4351
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "py-2 px-0 md:px-4 w-full", ref: contentRef, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-col gap-8 print:block print:gap-0 w-full items-center", children: pages.map((pageData, pageIndex) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4318
|
-
|
|
4352
|
+
"div",
|
|
4319
4353
|
{
|
|
4320
|
-
className: "w-full",
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4354
|
+
className: pageIndex === currentPageIndex ? "w-full" : "hidden print:block w-full",
|
|
4355
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4356
|
+
PageA4,
|
|
4357
|
+
{
|
|
4358
|
+
className: "w-full",
|
|
4359
|
+
pageNumber: pageIndex + 1,
|
|
4360
|
+
totalPages: pages.length,
|
|
4361
|
+
isLastPage: pageIndex === pages.length - 1,
|
|
4362
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col h-full grow w-full", children: [
|
|
4363
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("header", { className: "flex justify-between gap-2 items-center px-8 pt-4 print:hidden", children: [
|
|
4364
|
+
headers,
|
|
4365
|
+
printable && pageIndex === currentPageIndex && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex items-center justify-end ", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4366
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4367
|
+
"button",
|
|
4368
|
+
{
|
|
4369
|
+
onClick: async () => await getData(),
|
|
4370
|
+
disabled: isLoading,
|
|
4371
|
+
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",
|
|
4372
|
+
children: [
|
|
4373
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4374
|
+
import_lucide_react12.RefreshCw,
|
|
4375
|
+
{
|
|
4376
|
+
size: 16,
|
|
4377
|
+
className: isLoading ? "animate-spin" : ""
|
|
4378
|
+
}
|
|
4379
|
+
),
|
|
4380
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-xs font-semibold", children: "Reload" })
|
|
4381
|
+
]
|
|
4382
|
+
}
|
|
4383
|
+
),
|
|
4384
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4385
|
+
"button",
|
|
4386
|
+
{
|
|
4387
|
+
onClick: () => reactToPrintFn(),
|
|
4388
|
+
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",
|
|
4389
|
+
children: [
|
|
4390
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.Printer, { size: 16 }),
|
|
4391
|
+
"Print"
|
|
4392
|
+
]
|
|
4393
|
+
}
|
|
4394
|
+
),
|
|
4395
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1.5 ml-2 pl-2 border-l border-gray-200 dark:border-zinc-700", children: [
|
|
4335
4396
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4336
|
-
|
|
4397
|
+
"button",
|
|
4337
4398
|
{
|
|
4338
|
-
|
|
4339
|
-
|
|
4399
|
+
onClick: (e) => {
|
|
4400
|
+
e.stopPropagation();
|
|
4401
|
+
setCurrentPageIndex(
|
|
4402
|
+
(p) => Math.max(0, p - 1)
|
|
4403
|
+
);
|
|
4404
|
+
},
|
|
4405
|
+
disabled: currentPageIndex === 0,
|
|
4406
|
+
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",
|
|
4407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ChevronLeft, { size: 18 })
|
|
4340
4408
|
}
|
|
4341
4409
|
),
|
|
4342
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4410
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1 text-[11px] font-bold tabular-nums", children: [
|
|
4411
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
4412
|
+
Select,
|
|
4413
|
+
{
|
|
4414
|
+
value: currentPageIndex + 1,
|
|
4415
|
+
onChange: (val) => {
|
|
4416
|
+
const num = Number(val);
|
|
4417
|
+
if (!isNaN(num)) {
|
|
4418
|
+
setCurrentPageIndex(num - 1);
|
|
4419
|
+
}
|
|
4420
|
+
},
|
|
4421
|
+
variant: "ghost",
|
|
4422
|
+
containerClassName: "inline-block",
|
|
4423
|
+
children: [
|
|
4424
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(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__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-900 dark:text-white", children: currentPageIndex + 1 }) }),
|
|
4425
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(SelectContent, { className: "min-w-[100px] max-h-64 overflow-y-auto p-0", children: [
|
|
4426
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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__ */ (0, import_jsx_runtime28.jsx)(
|
|
4427
|
+
"input",
|
|
4428
|
+
{
|
|
4429
|
+
type: "text",
|
|
4430
|
+
placeholder: "Page...",
|
|
4431
|
+
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",
|
|
4432
|
+
value: pageSearch,
|
|
4433
|
+
onChange: (e) => setPageSearch(e.target.value),
|
|
4434
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
4435
|
+
autoFocus: true
|
|
4436
|
+
}
|
|
4437
|
+
) }),
|
|
4438
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-1", children: pages.map((_, i) => i + 1).filter(
|
|
4439
|
+
(p) => String(p).includes(pageSearch)
|
|
4440
|
+
).map((p) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(SelectItem, { value: p, children: p }, p)) })
|
|
4441
|
+
] })
|
|
4442
|
+
]
|
|
4443
|
+
}
|
|
4444
|
+
),
|
|
4445
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-400 mx-0.5", children: "/" }),
|
|
4446
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-gray-600 dark:text-gray-400", children: pages.length })
|
|
4447
|
+
] }),
|
|
4448
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4449
|
+
"button",
|
|
4450
|
+
{
|
|
4451
|
+
onClick: (e) => {
|
|
4452
|
+
e.stopPropagation();
|
|
4453
|
+
setCurrentPageIndex(
|
|
4454
|
+
(p) => Math.min(pages.length - 1, p + 1)
|
|
4455
|
+
);
|
|
4456
|
+
},
|
|
4457
|
+
disabled: currentPageIndex === pages.length - 1,
|
|
4458
|
+
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",
|
|
4459
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react12.ChevronRight, { size: 18 })
|
|
4460
|
+
}
|
|
4461
|
+
)
|
|
4462
|
+
] })
|
|
4463
|
+
] }) })
|
|
4464
|
+
] }),
|
|
4465
|
+
pageIndex === 0 && HeaderEl,
|
|
4466
|
+
pageIndex === 0 && DisplayInfoGridEl,
|
|
4467
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "grow w-full px-8 pb-8", children: [
|
|
4468
|
+
pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("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: [
|
|
4469
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 dark:text-gray-100 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }),
|
|
4470
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4471
|
+
"input",
|
|
4472
|
+
{
|
|
4473
|
+
type: "text",
|
|
4474
|
+
value: globalFilter,
|
|
4475
|
+
onChange: (e) => setGlobalFilter(e.target.value),
|
|
4476
|
+
placeholder: "Search...",
|
|
4477
|
+
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"
|
|
4478
|
+
}
|
|
4479
|
+
)
|
|
4480
|
+
] }),
|
|
4481
|
+
pageIndex === 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("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__ */ (0, import_jsx_runtime28.jsx)("h3", { className: "text-sm font-bold text-gray-800 print:text-gray-800 uppercase tracking-wide shrink-0", children: tableTitle }) }),
|
|
4482
|
+
pageIndex > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "h-7 print:h-0" }),
|
|
4483
|
+
statusOverlay ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "px-8 pb-8", children: statusOverlay }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
4484
|
+
SimpleTable,
|
|
4485
|
+
{
|
|
4486
|
+
columns,
|
|
4487
|
+
data: pageData,
|
|
4488
|
+
className: "bg-transparent!",
|
|
4489
|
+
rowPadding,
|
|
4490
|
+
index,
|
|
4491
|
+
startIndex: pages.slice(0, pageIndex).reduce((acc, curr) => acc + curr.length, 0),
|
|
4492
|
+
verticalLines,
|
|
4493
|
+
emptyState: null,
|
|
4494
|
+
isLoading: isActuallyLoading || isMeasuring && pages.length === 1 && pages[0].length === 0
|
|
4495
|
+
}
|
|
4496
|
+
),
|
|
4497
|
+
pageIndex === pages.length - 1 && !isActuallyLoading && !statusOverlay && DisplayFinalTotalEl
|
|
4498
|
+
] })
|
|
4499
|
+
] })
|
|
4500
|
+
},
|
|
4501
|
+
pageIndex
|
|
4502
|
+
)
|
|
4394
4503
|
},
|
|
4395
4504
|
pageIndex
|
|
4396
4505
|
)) }) })
|
|
@@ -4404,11 +4513,6 @@ var useA4StatementView = ({
|
|
|
4404
4513
|
reactToPrintFn
|
|
4405
4514
|
};
|
|
4406
4515
|
};
|
|
4407
|
-
var A4DataView = (props) => {
|
|
4408
|
-
const { url, v, delay, params, ...rest } = props;
|
|
4409
|
-
const { A4DataView: View } = useA4StatementView({ url, v, delay, params });
|
|
4410
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(View, { ...rest });
|
|
4411
|
-
};
|
|
4412
4516
|
var useA4DataView_default = useA4StatementView;
|
|
4413
4517
|
|
|
4414
4518
|
// src/hooks/Fetches/useTransaction.tsx
|
|
@@ -4420,21 +4524,23 @@ var useTransaction = ({
|
|
|
4420
4524
|
url,
|
|
4421
4525
|
v = 1,
|
|
4422
4526
|
delay,
|
|
4423
|
-
params = {}
|
|
4527
|
+
params = {},
|
|
4528
|
+
dateFilter = true
|
|
4424
4529
|
}) => {
|
|
4425
4530
|
const [date, setDate] = (0, import_react20.useState)(
|
|
4426
4531
|
(0, import_moment.default)().format("DD/MM/YYYY")
|
|
4427
4532
|
);
|
|
4428
4533
|
const dateObj = {};
|
|
4429
|
-
if (date) dateObj.date = date;
|
|
4534
|
+
if (date && dateFilter) dateObj.date = date;
|
|
4430
4535
|
const { data: apiData, isLoading, get, error: apiError } = useApis_default();
|
|
4431
4536
|
const getData = () => {
|
|
4537
|
+
console.log(dateObj);
|
|
4432
4538
|
get({
|
|
4433
4539
|
url,
|
|
4434
4540
|
v,
|
|
4435
4541
|
params: {
|
|
4436
|
-
...
|
|
4437
|
-
...
|
|
4542
|
+
...params,
|
|
4543
|
+
...dateObj
|
|
4438
4544
|
},
|
|
4439
4545
|
delay
|
|
4440
4546
|
});
|
|
@@ -4477,7 +4583,7 @@ var useTransaction = ({
|
|
|
4477
4583
|
url && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
4478
4584
|
"button",
|
|
4479
4585
|
{
|
|
4480
|
-
onClick: () =>
|
|
4586
|
+
onClick: () => getData(),
|
|
4481
4587
|
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",
|
|
4482
4588
|
children: [
|
|
4483
4589
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_lucide_react13.RefreshCw, { size: 14 }),
|
|
@@ -4495,7 +4601,7 @@ var useTransaction = ({
|
|
|
4495
4601
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Card.Description, { children: description })
|
|
4496
4602
|
] }),
|
|
4497
4603
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("section", { className: "flex gap-2 items-center", children: [
|
|
4498
|
-
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4604
|
+
dateFilter && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
4499
4605
|
Fields_default.DateInput,
|
|
4500
4606
|
{
|
|
4501
4607
|
value: date,
|
|
@@ -4735,7 +4841,6 @@ var storage = {
|
|
|
4735
4841
|
};
|
|
4736
4842
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4737
4843
|
0 && (module.exports = {
|
|
4738
|
-
A4DataView,
|
|
4739
4844
|
Badge,
|
|
4740
4845
|
Branding,
|
|
4741
4846
|
Button,
|