baaz-custom-components 5.0.27 → 5.0.29
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.css +114 -9
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +265 -225
- package/dist/index.mjs +261 -225
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1946,7 +1946,7 @@ var CustomBreadcrumb = ({
|
|
|
1946
1946
|
var breadcrumb_default = CustomBreadcrumb;
|
|
1947
1947
|
|
|
1948
1948
|
// src/components/custom/grid/index.tsx
|
|
1949
|
-
var
|
|
1949
|
+
var import_react7 = require("react");
|
|
1950
1950
|
var import_react_grid = require("@svar-ui/react-grid");
|
|
1951
1951
|
|
|
1952
1952
|
// src/utils/exportPdf.ts
|
|
@@ -1979,70 +1979,23 @@ function exportExcel(rows, name) {
|
|
|
1979
1979
|
XLSX.writeFile(workbook, `${name != null ? name : "export"}.xlsx`);
|
|
1980
1980
|
}
|
|
1981
1981
|
|
|
1982
|
-
// src/components/custom/grid/gridHeader.tsx
|
|
1982
|
+
// src/components/custom/grid/gridHeader/index.tsx
|
|
1983
|
+
var import_react6 = require("react");
|
|
1984
|
+
var import_lucide_react13 = require("lucide-react");
|
|
1985
|
+
|
|
1986
|
+
// src/components/custom/grid/gridHeader/components/filters.tsx
|
|
1983
1987
|
var import_react5 = require("react");
|
|
1984
1988
|
var import_lucide_react12 = require("lucide-react");
|
|
1985
1989
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1986
|
-
var
|
|
1987
|
-
onPdf,
|
|
1988
|
-
onExcel,
|
|
1989
|
-
onSearch = () => {
|
|
1990
|
-
},
|
|
1991
|
-
download,
|
|
1992
|
-
search,
|
|
1993
|
-
searchValue,
|
|
1994
|
-
searchkey = "",
|
|
1995
|
-
filterList,
|
|
1990
|
+
var Filters = ({
|
|
1996
1991
|
onFilterChange,
|
|
1997
|
-
initialFilters = []
|
|
1992
|
+
initialFilters = [],
|
|
1993
|
+
filterList
|
|
1998
1994
|
}) => {
|
|
1999
|
-
const [downloadMenu, setDownloadMenu] = (0, import_react5.useState)(false);
|
|
2000
|
-
const [filterMenu, setFilterMenu] = (0, import_react5.useState)(false);
|
|
2001
|
-
const [searchOpen, setSearchOpen] = (0, import_react5.useState)(false);
|
|
2002
1995
|
const [conditions, setConditions] = (0, import_react5.useState)([]);
|
|
2003
|
-
const
|
|
1996
|
+
const [filterMenu, setFilterMenu] = (0, import_react5.useState)(false);
|
|
2004
1997
|
const filterRef = (0, import_react5.useRef)(null);
|
|
2005
1998
|
const filterDropdownRef = (0, import_react5.useRef)(null);
|
|
2006
|
-
(0, import_react5.useEffect)(() => {
|
|
2007
|
-
if (initialFilters && initialFilters.length > 0) {
|
|
2008
|
-
const initialConditions = initialFilters.map(
|
|
2009
|
-
(filter, index) => ({
|
|
2010
|
-
id: crypto.randomUUID(),
|
|
2011
|
-
column: filter.column,
|
|
2012
|
-
operator: filter.operator,
|
|
2013
|
-
value: filter.value,
|
|
2014
|
-
logic: index === 0 ? "WHERE" : filter.logic || "AND"
|
|
2015
|
-
})
|
|
2016
|
-
);
|
|
2017
|
-
setConditions(initialConditions);
|
|
2018
|
-
}
|
|
2019
|
-
}, []);
|
|
2020
|
-
(0, import_react5.useEffect)(() => {
|
|
2021
|
-
if (!filterMenu || !filterDropdownRef.current) return;
|
|
2022
|
-
const dropdown = filterDropdownRef.current;
|
|
2023
|
-
const rect = dropdown.getBoundingClientRect();
|
|
2024
|
-
if (rect.right > window.innerWidth) {
|
|
2025
|
-
dropdown.style.left = "auto";
|
|
2026
|
-
dropdown.style.right = "0";
|
|
2027
|
-
}
|
|
2028
|
-
if (rect.bottom > window.innerHeight) {
|
|
2029
|
-
dropdown.style.top = "auto";
|
|
2030
|
-
dropdown.style.bottom = "100%";
|
|
2031
|
-
dropdown.style.marginBottom = "8px";
|
|
2032
|
-
}
|
|
2033
|
-
}, [filterMenu]);
|
|
2034
|
-
(0, import_react5.useEffect)(() => {
|
|
2035
|
-
const handleClickOutside = (e) => {
|
|
2036
|
-
if (downloadRef.current && !downloadRef.current.contains(e.target)) {
|
|
2037
|
-
setDownloadMenu(false);
|
|
2038
|
-
}
|
|
2039
|
-
if (filterRef.current && !filterRef.current.contains(e.target)) {
|
|
2040
|
-
setFilterMenu(false);
|
|
2041
|
-
}
|
|
2042
|
-
};
|
|
2043
|
-
document.addEventListener("mousedown", handleClickOutside);
|
|
2044
|
-
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2045
|
-
}, []);
|
|
2046
1999
|
const isValidFilter = (condition) => {
|
|
2047
2000
|
if (!condition.column || !condition.operator) return false;
|
|
2048
2001
|
if (condition.operator === "date-range") {
|
|
@@ -2057,10 +2010,11 @@ var GridHeader = ({
|
|
|
2057
2010
|
}, [conditions]);
|
|
2058
2011
|
const activeFilterCount = (initialFilters == null ? void 0 : initialFilters.length) || 0;
|
|
2059
2012
|
const formatFiltersForApi = (conditions2) => {
|
|
2060
|
-
return conditions2.filter(isValidFilter).map(({ column, operator, value, logic }, index) => ({
|
|
2013
|
+
return conditions2.filter(isValidFilter).map(({ column, operator, value, logic, key }, index) => ({
|
|
2061
2014
|
column,
|
|
2062
2015
|
operator,
|
|
2063
2016
|
value,
|
|
2017
|
+
key,
|
|
2064
2018
|
logic: index === 0 ? "WHERE" : logic != null ? logic : "AND"
|
|
2065
2019
|
}));
|
|
2066
2020
|
};
|
|
@@ -2120,60 +2074,93 @@ var GridHeader = ({
|
|
|
2120
2074
|
action: "clear"
|
|
2121
2075
|
});
|
|
2122
2076
|
};
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2077
|
+
(0, import_react5.useEffect)(() => {
|
|
2078
|
+
if (initialFilters && initialFilters.length > 0) {
|
|
2079
|
+
const initialConditions = initialFilters.map(
|
|
2080
|
+
(filter, index) => ({
|
|
2081
|
+
id: crypto.randomUUID(),
|
|
2082
|
+
column: filter.column,
|
|
2083
|
+
operator: filter.operator,
|
|
2084
|
+
value: filter.value,
|
|
2085
|
+
logic: index === 0 ? "WHERE" : filter.logic || "AND"
|
|
2086
|
+
})
|
|
2087
|
+
);
|
|
2088
|
+
setConditions(initialConditions);
|
|
2089
|
+
}
|
|
2090
|
+
}, []);
|
|
2091
|
+
(0, import_react5.useEffect)(() => {
|
|
2092
|
+
const handleClickOutside = (e) => {
|
|
2093
|
+
if (filterRef.current && !filterRef.current.contains(e.target)) {
|
|
2094
|
+
setFilterMenu(false);
|
|
2095
|
+
}
|
|
2096
|
+
};
|
|
2097
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2098
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2099
|
+
}, []);
|
|
2100
|
+
const selectedColumns = (0, import_react5.useMemo)(() => {
|
|
2101
|
+
return conditions.map((c) => c.column).filter(Boolean);
|
|
2102
|
+
}, [conditions]);
|
|
2103
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative", ref: filterRef, children: [
|
|
2104
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2105
|
+
"button",
|
|
2106
|
+
{
|
|
2107
|
+
onClick: () => setFilterMenu((p) => !p),
|
|
2108
|
+
className: "flex items-center gap-2 px-3 py-2 rounded-md hover:bg-input text-sm cursor-pointer",
|
|
2109
|
+
children: [
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.ListFilter, { size: 16 }),
|
|
2111
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "hidden md:block", children: "Filters" }),
|
|
2112
|
+
activeFilterCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "ml-1 px-1.5 py-0.5 text-xs bg-primary text-primary-foreground rounded-full font-medium", children: activeFilterCount })
|
|
2113
|
+
]
|
|
2114
|
+
}
|
|
2115
|
+
),
|
|
2116
|
+
filterMenu && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
2117
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2118
|
+
"div",
|
|
2119
|
+
{
|
|
2120
|
+
className: "fixed inset-0 bg-black/40 z-40 md:hidden",
|
|
2121
|
+
onClick: () => setFilterMenu(false)
|
|
2122
|
+
}
|
|
2123
|
+
),
|
|
2124
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2125
|
+
"div",
|
|
2126
|
+
{
|
|
2127
|
+
ref: filterDropdownRef,
|
|
2128
|
+
className: "fixed inset-x-0 bottom-0 md:absolute md:top-full md:bottom-auto md:left-0 w-full md:w-[700px] md:max-w-[95vw] max-h-[85vh] overflow-y-auto p-4 rounded-t-2xl md:rounded-md border bg-background shadow-xl z-50 space-y-4",
|
|
2129
|
+
children: [
|
|
2130
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-start sm:items-center justify-between gap-2", children: [
|
|
2131
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-sm font-medium", children: "In this view, show records" }),
|
|
2132
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2133
|
+
"button",
|
|
2134
|
+
{
|
|
2135
|
+
onClick: clearFilters,
|
|
2136
|
+
className: "p-2 rounded-md hover:bg-destructive/30 cursor-pointer",
|
|
2137
|
+
title: "Clear all filters",
|
|
2138
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.X, { size: 16 })
|
|
2139
|
+
}
|
|
2140
|
+
)
|
|
2141
|
+
] }),
|
|
2142
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "space-y-3 w-full flex flex-col overflow-auto", children: conditions.map((condition, index) => {
|
|
2143
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
2144
|
+
const selectedColumn = filterList.find(
|
|
2145
|
+
(f) => f.columnName.value === condition.column
|
|
2146
|
+
);
|
|
2147
|
+
const selectedOperator = selectedColumn == null ? void 0 : selectedColumn.operators.find(
|
|
2148
|
+
(op) => op.value === condition.operator
|
|
2149
|
+
);
|
|
2150
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2151
|
+
"div",
|
|
2152
|
+
{
|
|
2153
|
+
className: "flex flex-col md:flex-row gap-3 md:gap-2 w-full",
|
|
2154
|
+
children: [
|
|
2155
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col sm:flex-row gap-2 w-full", children: [
|
|
2156
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-full sm:w-[90px] shrink-0", children: index === 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-sm font-medium", children: "Where" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2170
2157
|
"select",
|
|
2171
2158
|
{
|
|
2172
2159
|
value: (_a = condition.logic) != null ? _a : "AND",
|
|
2173
2160
|
onChange: (e) => updateCondition(condition.id, {
|
|
2174
2161
|
logic: e.target.value
|
|
2175
2162
|
}),
|
|
2176
|
-
className: "w-full px-
|
|
2163
|
+
className: "w-full px-3 py-2 rounded-md bg-input text-sm focus:outline-none",
|
|
2177
2164
|
children: [
|
|
2178
2165
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "AND", children: "AND" }),
|
|
2179
2166
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "OR", children: "OR" })
|
|
@@ -2189,17 +2176,21 @@ var GridHeader = ({
|
|
|
2189
2176
|
operator: void 0,
|
|
2190
2177
|
value: void 0
|
|
2191
2178
|
}),
|
|
2192
|
-
className: "
|
|
2179
|
+
className: "w-full sm:min-w-[8rem] px-3 py-2 rounded-md bg-input text-sm focus:outline-none",
|
|
2193
2180
|
children: [
|
|
2194
2181
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", disabled: true, children: "Column" }),
|
|
2195
|
-
filterList.map((f) =>
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2182
|
+
filterList.map((f) => {
|
|
2183
|
+
const isUsed = selectedColumns.includes(f.columnName.value) && condition.column !== f.columnName.value;
|
|
2184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2185
|
+
"option",
|
|
2186
|
+
{
|
|
2187
|
+
value: f.columnName.value,
|
|
2188
|
+
disabled: isUsed,
|
|
2189
|
+
children: f.columnName.label
|
|
2190
|
+
},
|
|
2191
|
+
f.columnName.value
|
|
2192
|
+
);
|
|
2193
|
+
})
|
|
2203
2194
|
]
|
|
2204
2195
|
}
|
|
2205
2196
|
),
|
|
@@ -2208,11 +2199,18 @@ var GridHeader = ({
|
|
|
2208
2199
|
{
|
|
2209
2200
|
value: (_c = condition.operator) != null ? _c : "",
|
|
2210
2201
|
disabled: !selectedColumn,
|
|
2211
|
-
onChange: (e) =>
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2202
|
+
onChange: (e) => {
|
|
2203
|
+
const operatorValue = e.target.value;
|
|
2204
|
+
const operator = selectedColumn == null ? void 0 : selectedColumn.operators.find(
|
|
2205
|
+
(op) => op.value === operatorValue
|
|
2206
|
+
);
|
|
2207
|
+
updateCondition(condition.id, {
|
|
2208
|
+
operator: e.target.value,
|
|
2209
|
+
key: operator == null ? void 0 : operator.key,
|
|
2210
|
+
value: void 0
|
|
2211
|
+
});
|
|
2212
|
+
},
|
|
2213
|
+
className: "w-full sm:min-w-[8rem] px-3 py-2 rounded-md bg-input text-sm disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none",
|
|
2216
2214
|
children: [
|
|
2217
2215
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", disabled: true, children: "Operator" }),
|
|
2218
2216
|
selectedColumn == null ? void 0 : selectedColumn.operators.map((op) => {
|
|
@@ -2221,8 +2219,10 @@ var GridHeader = ({
|
|
|
2221
2219
|
})
|
|
2222
2220
|
]
|
|
2223
2221
|
}
|
|
2224
|
-
)
|
|
2225
|
-
|
|
2222
|
+
)
|
|
2223
|
+
] }),
|
|
2224
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col sm:flex-row gap-2 w-full items-start sm:items-center", children: [
|
|
2225
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex-1 w-full min-w-0", children: [
|
|
2226
2226
|
(selectedOperator == null ? void 0 : selectedOperator.value) === "input" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2227
2227
|
"input",
|
|
2228
2228
|
{
|
|
@@ -2231,7 +2231,7 @@ var GridHeader = ({
|
|
|
2231
2231
|
value: e.target.value
|
|
2232
2232
|
}),
|
|
2233
2233
|
placeholder: "Enter value",
|
|
2234
|
-
className: "w-full px-3 py-2 rounded-md bg-input text-sm"
|
|
2234
|
+
className: "w-full px-3 py-2 rounded-md bg-input text-sm focus:outline-none"
|
|
2235
2235
|
}
|
|
2236
2236
|
),
|
|
2237
2237
|
(selectedOperator == null ? void 0 : selectedOperator.value) === "select" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
@@ -2241,7 +2241,7 @@ var GridHeader = ({
|
|
|
2241
2241
|
onChange: (e) => updateCondition(condition.id, {
|
|
2242
2242
|
value: e.target.value
|
|
2243
2243
|
}),
|
|
2244
|
-
className: "w-full px-3 py-2 rounded-md bg-input text-sm",
|
|
2244
|
+
className: "w-full px-3 py-2 rounded-md bg-input text-sm focus:outline-none",
|
|
2245
2245
|
children: [
|
|
2246
2246
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: "", disabled: true, children: "Select value" }),
|
|
2247
2247
|
(_f = selectedOperator.options) == null ? void 0 : _f.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
|
|
@@ -2256,10 +2256,10 @@ var GridHeader = ({
|
|
|
2256
2256
|
onChange: (e) => updateCondition(condition.id, {
|
|
2257
2257
|
value: e.target.value
|
|
2258
2258
|
}),
|
|
2259
|
-
className: "w-full px-3 py-2 rounded-md bg-input text-sm"
|
|
2259
|
+
className: "w-full px-3 py-2 rounded-md bg-input text-sm focus:outline-none"
|
|
2260
2260
|
}
|
|
2261
2261
|
),
|
|
2262
|
-
(selectedOperator == null ? void 0 : selectedOperator.value) === "date-range" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-2", children: [
|
|
2262
|
+
(selectedOperator == null ? void 0 : selectedOperator.value) === "date-range" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex flex-col sm:flex-row gap-2 w-full", children: [
|
|
2263
2263
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2264
2264
|
"input",
|
|
2265
2265
|
{
|
|
@@ -2270,8 +2270,7 @@ var GridHeader = ({
|
|
|
2270
2270
|
start: e.target.value
|
|
2271
2271
|
})
|
|
2272
2272
|
}),
|
|
2273
|
-
|
|
2274
|
-
className: "w-full px-3 py-2 rounded-md bg-input text-sm"
|
|
2273
|
+
className: "w-full px-3 py-2 rounded-md bg-input text-sm focus:outline-none"
|
|
2275
2274
|
}
|
|
2276
2275
|
),
|
|
2277
2276
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
@@ -2284,14 +2283,13 @@ var GridHeader = ({
|
|
|
2284
2283
|
end: e.target.value
|
|
2285
2284
|
})
|
|
2286
2285
|
}),
|
|
2287
|
-
|
|
2288
|
-
className: "w-full px-3 py-2 rounded-md bg-input text-sm"
|
|
2286
|
+
className: "w-full px-3 py-2 rounded-md bg-input text-sm focus:outline-none"
|
|
2289
2287
|
}
|
|
2290
2288
|
)
|
|
2291
2289
|
] }),
|
|
2292
2290
|
!selectedOperator && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-full px-3 py-2 rounded-md bg-input/50 text-sm text-muted-foreground", children: "Select operator" })
|
|
2293
2291
|
] }),
|
|
2294
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-[40px] flex justify-
|
|
2292
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-full sm:w-[40px] flex justify-end sm:justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2295
2293
|
"button",
|
|
2296
2294
|
{
|
|
2297
2295
|
onClick: () => deleteCondition(condition.id),
|
|
@@ -2300,58 +2298,100 @@ var GridHeader = ({
|
|
|
2300
2298
|
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.Trash2, { size: 16 })
|
|
2301
2299
|
}
|
|
2302
2300
|
) })
|
|
2303
|
-
]
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
]
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2301
|
+
] })
|
|
2302
|
+
]
|
|
2303
|
+
},
|
|
2304
|
+
condition.id
|
|
2305
|
+
);
|
|
2306
|
+
}) }),
|
|
2307
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between pt-2 border-t", children: [
|
|
2308
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2309
|
+
"button",
|
|
2310
|
+
{
|
|
2311
|
+
onClick: addCondition,
|
|
2312
|
+
className: "flex items-center gap-2 text-sm text-primary hover:text-primary/80 cursor-pointer",
|
|
2313
|
+
children: [
|
|
2314
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.Plus, { size: 14 }),
|
|
2315
|
+
"Add condition"
|
|
2316
|
+
]
|
|
2317
|
+
}
|
|
2318
|
+
),
|
|
2319
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
2320
|
+
"button",
|
|
2321
|
+
{
|
|
2322
|
+
onClick: applyFilters,
|
|
2323
|
+
disabled: !canApply,
|
|
2324
|
+
className: "flex items-center gap-2 px-4 py-2 rounded-md bg-primary text-primary-foreground text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed hover:bg-primary/90 transition-colors cursor-pointer",
|
|
2325
|
+
children: [
|
|
2326
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react12.Check, { size: 16 }),
|
|
2327
|
+
"Apply",
|
|
2328
|
+
hasChangesFromInitial && canApply && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2329
|
+
"span",
|
|
2330
|
+
{
|
|
2331
|
+
className: "ml-1 w-2 h-2 bg-yellow-400 rounded-full",
|
|
2332
|
+
title: "Unapplied changes"
|
|
2333
|
+
}
|
|
2334
|
+
)
|
|
2335
|
+
]
|
|
2336
|
+
}
|
|
2337
|
+
)
|
|
2338
|
+
] })
|
|
2339
|
+
]
|
|
2340
|
+
}
|
|
2341
|
+
)
|
|
2342
|
+
] })
|
|
2343
|
+
] });
|
|
2344
|
+
};
|
|
2345
|
+
var filters_default = Filters;
|
|
2346
|
+
|
|
2347
|
+
// src/components/custom/grid/gridHeader/index.tsx
|
|
2348
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2349
|
+
var GridHeader = ({
|
|
2350
|
+
onPdf,
|
|
2351
|
+
onExcel,
|
|
2352
|
+
onSearch = () => {
|
|
2353
|
+
},
|
|
2354
|
+
download,
|
|
2355
|
+
search,
|
|
2356
|
+
searchValue,
|
|
2357
|
+
searchkey = "",
|
|
2358
|
+
filterList,
|
|
2359
|
+
onFilterChange,
|
|
2360
|
+
initialFilters = []
|
|
2361
|
+
}) => {
|
|
2362
|
+
const [downloadMenu, setDownloadMenu] = (0, import_react6.useState)(false);
|
|
2363
|
+
const [searchOpen, setSearchOpen] = (0, import_react6.useState)(false);
|
|
2364
|
+
const downloadRef = (0, import_react6.useRef)(null);
|
|
2365
|
+
(0, import_react6.useEffect)(() => {
|
|
2366
|
+
const handleClickOutside = (e) => {
|
|
2367
|
+
if (downloadRef.current && !downloadRef.current.contains(e.target)) {
|
|
2368
|
+
setDownloadMenu(false);
|
|
2369
|
+
}
|
|
2370
|
+
};
|
|
2371
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2372
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2373
|
+
}, []);
|
|
2374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col md:flex-row md:items-center justify-between bg-card py-2 px-2 md:px-4 rounded-tl-md rounded-tr-md", children: [
|
|
2375
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex justify-between items-center gap-3", children: [
|
|
2376
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2377
|
+
filters_default,
|
|
2378
|
+
{
|
|
2379
|
+
onFilterChange,
|
|
2380
|
+
initialFilters,
|
|
2381
|
+
filterList
|
|
2382
|
+
}
|
|
2383
|
+
),
|
|
2384
|
+
download && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative", ref: downloadRef, children: [
|
|
2385
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2346
2386
|
"button",
|
|
2347
2387
|
{
|
|
2348
2388
|
onClick: () => setDownloadMenu((p) => !p),
|
|
2349
2389
|
className: "p-2 rounded-md hover:bg-input cursor-pointer",
|
|
2350
|
-
children: /* @__PURE__ */ (0,
|
|
2390
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Ellipsis, { size: 16 })
|
|
2351
2391
|
}
|
|
2352
2392
|
),
|
|
2353
|
-
downloadMenu && /* @__PURE__ */ (0,
|
|
2354
|
-
/* @__PURE__ */ (0,
|
|
2393
|
+
downloadMenu && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "absolute top-full right-0 mt-2 w-32 rounded-md border !bg-background shadow-lg z-50 overflow-hidden", children: [
|
|
2394
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2355
2395
|
"button",
|
|
2356
2396
|
{
|
|
2357
2397
|
onClick: () => {
|
|
@@ -2360,12 +2400,12 @@ var GridHeader = ({
|
|
|
2360
2400
|
},
|
|
2361
2401
|
className: "flex items-center gap-2 w-full px-3 py-2 text-sm hover:bg-muted cursor-pointer",
|
|
2362
2402
|
children: [
|
|
2363
|
-
/* @__PURE__ */ (0,
|
|
2403
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.FileText, { size: 14 }),
|
|
2364
2404
|
"PDF"
|
|
2365
2405
|
]
|
|
2366
2406
|
}
|
|
2367
2407
|
),
|
|
2368
|
-
/* @__PURE__ */ (0,
|
|
2408
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2369
2409
|
"button",
|
|
2370
2410
|
{
|
|
2371
2411
|
onClick: () => {
|
|
@@ -2374,7 +2414,7 @@ var GridHeader = ({
|
|
|
2374
2414
|
},
|
|
2375
2415
|
className: "flex items-center gap-2 w-full px-3 py-2 text-sm hover:bg-muted cursor-pointer",
|
|
2376
2416
|
children: [
|
|
2377
|
-
/* @__PURE__ */ (0,
|
|
2417
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.FileSpreadsheet, { size: 14 }),
|
|
2378
2418
|
"Excel"
|
|
2379
2419
|
]
|
|
2380
2420
|
}
|
|
@@ -2382,20 +2422,20 @@ var GridHeader = ({
|
|
|
2382
2422
|
] })
|
|
2383
2423
|
] })
|
|
2384
2424
|
] }),
|
|
2385
|
-
search && /* @__PURE__ */ (0,
|
|
2425
|
+
search && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "relative h-[40px] flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2386
2426
|
"div",
|
|
2387
2427
|
{
|
|
2388
|
-
className: `absolute right-0 flex items-center transition-all duration-200 ${searchOpen ? "w-[250px]" : "w-[40px]"} h-[40px]`,
|
|
2389
|
-
children: !searchOpen ? /* @__PURE__ */ (0,
|
|
2428
|
+
className: `absolute md:right-0 flex items-center transition-all duration-200 ${searchOpen ? "w-[250px]" : "w-[40px]"} h-[40px]`,
|
|
2429
|
+
children: !searchOpen ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2390
2430
|
"button",
|
|
2391
2431
|
{
|
|
2392
2432
|
onClick: () => setSearchOpen(true),
|
|
2393
2433
|
className: "w-[40px] h-[40px] flex items-center justify-center rounded-md hover:bg-input cursor-pointer",
|
|
2394
|
-
children: /* @__PURE__ */ (0,
|
|
2434
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Search, { size: 18 })
|
|
2395
2435
|
}
|
|
2396
|
-
) : /* @__PURE__ */ (0,
|
|
2397
|
-
/* @__PURE__ */ (0,
|
|
2398
|
-
/* @__PURE__ */ (0,
|
|
2436
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2 w-full h-full px-3 rounded-md border border-input bg-background", children: [
|
|
2437
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.Search, { size: 16 }),
|
|
2438
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2399
2439
|
"input",
|
|
2400
2440
|
{
|
|
2401
2441
|
autoFocus: true,
|
|
@@ -2405,12 +2445,12 @@ var GridHeader = ({
|
|
|
2405
2445
|
value: searchValue
|
|
2406
2446
|
}
|
|
2407
2447
|
),
|
|
2408
|
-
/* @__PURE__ */ (0,
|
|
2448
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2409
2449
|
"button",
|
|
2410
2450
|
{
|
|
2411
2451
|
onClick: () => setSearchOpen(false),
|
|
2412
2452
|
className: "cursor-pointer",
|
|
2413
|
-
children: /* @__PURE__ */ (0,
|
|
2453
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react13.X, { size: 16 })
|
|
2414
2454
|
}
|
|
2415
2455
|
)
|
|
2416
2456
|
] })
|
|
@@ -2421,8 +2461,8 @@ var GridHeader = ({
|
|
|
2421
2461
|
var gridHeader_default = GridHeader;
|
|
2422
2462
|
|
|
2423
2463
|
// src/components/custom/grid/index.tsx
|
|
2424
|
-
var
|
|
2425
|
-
var Grid = (0,
|
|
2464
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2465
|
+
var Grid = (0, import_react7.forwardRef)(
|
|
2426
2466
|
(_a, ref) => {
|
|
2427
2467
|
var _b = _a, {
|
|
2428
2468
|
data,
|
|
@@ -2451,10 +2491,10 @@ var Grid = (0, import_react6.forwardRef)(
|
|
|
2451
2491
|
"onFilterChange",
|
|
2452
2492
|
"initialFilters"
|
|
2453
2493
|
]);
|
|
2454
|
-
const apiRef = (0,
|
|
2455
|
-
const containerRef = (0,
|
|
2456
|
-
(0,
|
|
2457
|
-
const resizeColumns = (0,
|
|
2494
|
+
const apiRef = (0, import_react7.useRef)(null);
|
|
2495
|
+
const containerRef = (0, import_react7.useRef)(null);
|
|
2496
|
+
(0, import_react7.useImperativeHandle)(ref, () => apiRef.current, []);
|
|
2497
|
+
const resizeColumns = (0, import_react7.useCallback)(() => {
|
|
2458
2498
|
var _a2;
|
|
2459
2499
|
const api = apiRef.current;
|
|
2460
2500
|
const container = containerRef.current;
|
|
@@ -2484,7 +2524,7 @@ var Grid = (0, import_react6.forwardRef)(
|
|
|
2484
2524
|
});
|
|
2485
2525
|
}
|
|
2486
2526
|
}, [columns, data]);
|
|
2487
|
-
(0,
|
|
2527
|
+
(0, import_react7.useEffect)(() => {
|
|
2488
2528
|
if (!containerRef.current) return;
|
|
2489
2529
|
const observer = new ResizeObserver(() => {
|
|
2490
2530
|
resizeColumns();
|
|
@@ -2492,7 +2532,7 @@ var Grid = (0, import_react6.forwardRef)(
|
|
|
2492
2532
|
observer.observe(containerRef.current);
|
|
2493
2533
|
return () => observer.disconnect();
|
|
2494
2534
|
}, [resizeColumns]);
|
|
2495
|
-
const init = (0,
|
|
2535
|
+
const init = (0, import_react7.useCallback)(
|
|
2496
2536
|
(api) => {
|
|
2497
2537
|
apiRef.current = api;
|
|
2498
2538
|
resizeColumns();
|
|
@@ -2507,7 +2547,7 @@ var Grid = (0, import_react6.forwardRef)(
|
|
|
2507
2547
|
});
|
|
2508
2548
|
return selectedData;
|
|
2509
2549
|
};
|
|
2510
|
-
const handleExportPdf = (0,
|
|
2550
|
+
const handleExportPdf = (0, import_react7.useCallback)(() => {
|
|
2511
2551
|
const selected = getSelectedData();
|
|
2512
2552
|
if (selected.length) {
|
|
2513
2553
|
exportPdf(selected, fileName);
|
|
@@ -2515,7 +2555,7 @@ var Grid = (0, import_react6.forwardRef)(
|
|
|
2515
2555
|
onExportPdf == null ? void 0 : onExportPdf();
|
|
2516
2556
|
}
|
|
2517
2557
|
}, [getSelectedData, exportPdf, onExportPdf, fileName]);
|
|
2518
|
-
const handleExportExcel = (0,
|
|
2558
|
+
const handleExportExcel = (0, import_react7.useCallback)(() => {
|
|
2519
2559
|
const selected = getSelectedData();
|
|
2520
2560
|
if (selected.length) {
|
|
2521
2561
|
exportExcel(selected, fileName);
|
|
@@ -2523,8 +2563,8 @@ var Grid = (0, import_react6.forwardRef)(
|
|
|
2523
2563
|
onExportExcel == null ? void 0 : onExportExcel();
|
|
2524
2564
|
}
|
|
2525
2565
|
}, [getSelectedData, exportExcel, onExportExcel, fileName]);
|
|
2526
|
-
return /* @__PURE__ */ (0,
|
|
2527
|
-
/* @__PURE__ */ (0,
|
|
2566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "w-full h-full flex flex-col overflow-hidden", children: [
|
|
2567
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2528
2568
|
gridHeader_default,
|
|
2529
2569
|
{
|
|
2530
2570
|
onPdf: handleExportPdf,
|
|
@@ -2539,7 +2579,7 @@ var Grid = (0, import_react6.forwardRef)(
|
|
|
2539
2579
|
initialFilters
|
|
2540
2580
|
}
|
|
2541
2581
|
),
|
|
2542
|
-
/* @__PURE__ */ (0,
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1 w-full overflow-hidden", ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_react_grid.WillowDark, { fonts, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "w-full h-full relative", children: rest.loading ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute inset-0 bg-background/60 backdrop-blur-sm flex items-center justify-center z-10", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "animate-spin rounded-full h-8 w-8 border-2 border-primary border-t-transparent" }) }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2543
2583
|
import_react_grid.Grid,
|
|
2544
2584
|
__spreadProps(__spreadValues({}, rest), {
|
|
2545
2585
|
data,
|
|
@@ -2554,10 +2594,10 @@ var Grid = (0, import_react6.forwardRef)(
|
|
|
2554
2594
|
var grid_default = Grid;
|
|
2555
2595
|
|
|
2556
2596
|
// src/components/custom/grid/sortableHeaderCell.tsx
|
|
2557
|
-
var
|
|
2558
|
-
var
|
|
2597
|
+
var import_lucide_react14 = require("lucide-react");
|
|
2598
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2559
2599
|
function SortableHeaderCell({ cell, sortKey, sortOrder, onSortChange }) {
|
|
2560
|
-
if (!(cell == null ? void 0 : cell.id)) return /* @__PURE__ */ (0,
|
|
2600
|
+
if (!(cell == null ? void 0 : cell.id)) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: cell == null ? void 0 : cell.text });
|
|
2561
2601
|
const active = sortKey === cell.id;
|
|
2562
2602
|
const handleClick = () => {
|
|
2563
2603
|
if (!onSortChange || !cell.id) return;
|
|
@@ -2571,15 +2611,15 @@ function SortableHeaderCell({ cell, sortKey, sortOrder, onSortChange }) {
|
|
|
2571
2611
|
}
|
|
2572
2612
|
onSortChange("", null);
|
|
2573
2613
|
};
|
|
2574
|
-
return /* @__PURE__ */ (0,
|
|
2614
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
2575
2615
|
"div",
|
|
2576
2616
|
{
|
|
2577
2617
|
onClick: handleClick,
|
|
2578
2618
|
className: "cursor-pointer flex items-center gap-2 justify-between select-none",
|
|
2579
2619
|
children: [
|
|
2580
|
-
/* @__PURE__ */ (0,
|
|
2581
|
-
!active && /* @__PURE__ */ (0,
|
|
2582
|
-
active && (sortOrder === "asc" ? /* @__PURE__ */ (0,
|
|
2620
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { children: cell.text }),
|
|
2621
|
+
!active && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react14.ArrowUpDown, { className: "w-4 h-4 opacity-50" }),
|
|
2622
|
+
active && (sortOrder === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react14.MoveDown, { className: "w-4 h-4" }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react14.MoveUp, { className: "w-4 h-4" }))
|
|
2583
2623
|
]
|
|
2584
2624
|
}
|
|
2585
2625
|
);
|
|
@@ -2617,8 +2657,8 @@ function getPaginationRange(currentPage, totalPages, siblingCount = 2) {
|
|
|
2617
2657
|
}
|
|
2618
2658
|
|
|
2619
2659
|
// src/components/custom/pagination/index.tsx
|
|
2620
|
-
var
|
|
2621
|
-
var
|
|
2660
|
+
var import_lucide_react15 = require("lucide-react");
|
|
2661
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2622
2662
|
function Pagination({
|
|
2623
2663
|
totalCount,
|
|
2624
2664
|
count = null,
|
|
@@ -2639,47 +2679,47 @@ function Pagination({
|
|
|
2639
2679
|
const handlePageSizeChange = (size) => {
|
|
2640
2680
|
onPageSizeChange == null ? void 0 : onPageSizeChange(size);
|
|
2641
2681
|
};
|
|
2642
|
-
return /* @__PURE__ */ (0,
|
|
2643
|
-
/* @__PURE__ */ (0,
|
|
2644
|
-
/* @__PURE__ */ (0,
|
|
2682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between bg-card px-3 py-2 rounded-br-md rounded-bl-md", children: [
|
|
2683
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-3 text-xs text-muted-foreground tracking-wider font-medium", children: [
|
|
2684
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("span", { children: [
|
|
2645
2685
|
"Showing ",
|
|
2646
|
-
/* @__PURE__ */ (0,
|
|
2686
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-foreground", children: count }),
|
|
2647
2687
|
" of",
|
|
2648
2688
|
" ",
|
|
2649
|
-
/* @__PURE__ */ (0,
|
|
2689
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-foreground", children: totalCount })
|
|
2650
2690
|
] }),
|
|
2651
|
-
showSizeChanger && /* @__PURE__ */ (0,
|
|
2691
|
+
showSizeChanger && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2652
2692
|
"select",
|
|
2653
2693
|
{
|
|
2654
2694
|
value: pageSize,
|
|
2655
2695
|
onChange: (e) => handlePageSizeChange(Number(e.target.value)),
|
|
2656
2696
|
className: "rounded-md border border-input bg-background px-3 py-2 text-xs text-foreground focus:outline-none",
|
|
2657
|
-
children: sizeChangerOptions.map((size) => /* @__PURE__ */ (0,
|
|
2697
|
+
children: sizeChangerOptions.map((size) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("option", { value: size, children: [
|
|
2658
2698
|
size,
|
|
2659
2699
|
" / page"
|
|
2660
2700
|
] }, size))
|
|
2661
2701
|
}
|
|
2662
2702
|
)
|
|
2663
2703
|
] }),
|
|
2664
|
-
/* @__PURE__ */ (0,
|
|
2665
|
-
/* @__PURE__ */ (0,
|
|
2704
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2705
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2666
2706
|
"button",
|
|
2667
2707
|
{
|
|
2668
2708
|
disabled: currentPage === 1,
|
|
2669
2709
|
onClick: () => handlePageChange(currentPage - 1),
|
|
2670
2710
|
className: "border border-border w-8 h-8 rounded-md flex items-center justify-center disabled:opacity-40 hover:bg-card-foreground transition",
|
|
2671
|
-
children: /* @__PURE__ */ (0,
|
|
2711
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react15.ChevronLeft, { className: "w-5 h-5 select-none" })
|
|
2672
2712
|
}
|
|
2673
2713
|
),
|
|
2674
2714
|
pages.map(
|
|
2675
|
-
(page, idx) => page === "dots" ? /* @__PURE__ */ (0,
|
|
2715
|
+
(page, idx) => page === "dots" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2676
2716
|
"span",
|
|
2677
2717
|
{
|
|
2678
2718
|
className: "px-2 text-muted-foreground text-xs tracking-wider font-medium",
|
|
2679
2719
|
children: "\u2026"
|
|
2680
2720
|
},
|
|
2681
2721
|
`dots-${idx}`
|
|
2682
|
-
) : /* @__PURE__ */ (0,
|
|
2722
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2683
2723
|
"button",
|
|
2684
2724
|
{
|
|
2685
2725
|
onClick: () => handlePageChange(page),
|
|
@@ -2689,13 +2729,13 @@ function Pagination({
|
|
|
2689
2729
|
page
|
|
2690
2730
|
)
|
|
2691
2731
|
),
|
|
2692
|
-
/* @__PURE__ */ (0,
|
|
2732
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2693
2733
|
"button",
|
|
2694
2734
|
{
|
|
2695
2735
|
disabled: currentPage === totalPages,
|
|
2696
2736
|
onClick: () => handlePageChange(currentPage + 1),
|
|
2697
2737
|
className: "border border-border w-8 h-8 rounded-md flex items-center justify-center disabled:opacity-40 hover:bg-card-foreground transition",
|
|
2698
|
-
children: /* @__PURE__ */ (0,
|
|
2738
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react15.ChevronRight, { className: "w-5 h-5 select-none" })
|
|
2699
2739
|
}
|
|
2700
2740
|
)
|
|
2701
2741
|
] })
|