hi-tm 0.10.3 → 0.10.4
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.
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import React from
|
|
1
|
+
import React from "react";
|
|
2
2
|
export interface CustomColumnStyle extends React.CSSProperties {
|
|
3
3
|
width?: string | number;
|
|
4
|
-
textAlign?:
|
|
4
|
+
textAlign?: "left" | "center" | "right";
|
|
5
5
|
flex?: string;
|
|
6
6
|
padding?: string;
|
|
7
7
|
margin?: string;
|
|
8
8
|
backgroundColor?: string;
|
|
9
|
-
justifyContent?:
|
|
10
|
-
alignItems?:
|
|
11
|
-
position?:
|
|
9
|
+
justifyContent?: "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "end" | "start";
|
|
10
|
+
alignItems?: "flex-start" | "flex-end" | "center" | "stretch" | "baseline";
|
|
11
|
+
position?: "static" | "relative" | "absolute" | "fixed" | "sticky";
|
|
12
12
|
}
|
|
13
13
|
interface BaseModalFilterData {
|
|
14
14
|
id: number;
|
|
15
15
|
name: string;
|
|
16
16
|
content: string;
|
|
17
|
-
type?:
|
|
17
|
+
type?: "pin" | "sort" | "filter";
|
|
18
18
|
FilterIcon?: React.ComponentType<any> | string | React.ReactNode;
|
|
19
19
|
iconTailwindStyle?: string;
|
|
20
20
|
}
|
|
@@ -73,6 +73,7 @@ interface ModernTableHeaderProps {
|
|
|
73
73
|
}) => void;
|
|
74
74
|
hasSelect?: boolean;
|
|
75
75
|
hasCheckbox?: boolean;
|
|
76
|
+
hasSelectAll?: boolean;
|
|
76
77
|
onCheckboxClick?: (checked: boolean) => void;
|
|
77
78
|
onClickHandlerColumn?: (params: {
|
|
78
79
|
name: string;
|
|
@@ -101,5 +102,5 @@ interface ModernTableHeaderProps {
|
|
|
101
102
|
isMobileView?: boolean;
|
|
102
103
|
mobileViewGridClassName?: string;
|
|
103
104
|
}
|
|
104
|
-
declare const ModernTableHeader: ({ columns, sortIcon, hasSelect, hasCheckbox, onCheckboxClick, onClickHandlerColumn, filterHandler, onSelectAllClick, FilterIcon, onFilterClick, onSortingClick, onPinClick, onFilterButtonClick, gridClassName, containerClassName, isMobileView, mobileViewGridClassName, }: ModernTableHeaderProps) => React.JSX.Element;
|
|
105
|
+
declare const ModernTableHeader: ({ columns, sortIcon, hasSelect, hasCheckbox, hasSelectAll, onCheckboxClick, onClickHandlerColumn, filterHandler, onSelectAllClick, FilterIcon, onFilterClick, onSortingClick, onPinClick, onFilterButtonClick, gridClassName, containerClassName, isMobileView, mobileViewGridClassName, }: ModernTableHeaderProps) => React.JSX.Element;
|
|
105
106
|
export default ModernTableHeader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
"use client";
|
|
3
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
4
|
if (k2 === undefined) k2 = k;
|
|
5
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -39,7 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
const react_1 = __importStar(require("react"));
|
|
41
41
|
const image_1 = __importDefault(require("next/image"));
|
|
42
|
-
const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheckbox = false, onCheckboxClick, onClickHandlerColumn, filterHandler, onSelectAllClick, FilterIcon, onFilterClick, onSortingClick, onPinClick, onFilterButtonClick, gridClassName, containerClassName, isMobileView, mobileViewGridClassName, }) => {
|
|
42
|
+
const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheckbox = false, hasSelectAll, onCheckboxClick, onClickHandlerColumn, filterHandler, onSelectAllClick, FilterIcon, onFilterClick, onSortingClick, onPinClick, onFilterButtonClick, gridClassName, containerClassName, isMobileView, mobileViewGridClassName, }) => {
|
|
43
43
|
const [activeFilterColumn, setActiveFilterColumn] = (0, react_1.useState)(null);
|
|
44
44
|
const [clickedColumn, setClickedColumn] = (0, react_1.useState)(null);
|
|
45
45
|
const [arrowDir, setArrowDir] = (0, react_1.useState)(false);
|
|
@@ -50,6 +50,12 @@ const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheck
|
|
|
50
50
|
const [checkedPins, setCheckedPins] = (0, react_1.useState)({});
|
|
51
51
|
const modalFilterRef = (0, react_1.useRef)(null);
|
|
52
52
|
const filterIconRef = (0, react_1.useRef)(null);
|
|
53
|
+
// const handleCheckboxChange = () => {
|
|
54
|
+
// const newCheckedState = !isChecked;
|
|
55
|
+
// setIsChecked(newCheckedState);
|
|
56
|
+
// onCheckboxClick?.(newCheckedState);
|
|
57
|
+
// onSelectAllClick?.(newCheckedState);
|
|
58
|
+
// };
|
|
53
59
|
const handleCheckboxChange = () => {
|
|
54
60
|
const newCheckedState = !isChecked;
|
|
55
61
|
setIsChecked(newCheckedState);
|
|
@@ -57,15 +63,17 @@ const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheck
|
|
|
57
63
|
onSelectAllClick?.(newCheckedState);
|
|
58
64
|
};
|
|
59
65
|
const totalColumns = columns?.length || 0;
|
|
60
|
-
const columnsWithWidth = columns?.filter((col) => col.inlineCss &&
|
|
66
|
+
const columnsWithWidth = columns?.filter((col) => col.inlineCss && "width" in (col.inlineCss || {})) || [];
|
|
61
67
|
const totalDefinedWidth = columnsWithWidth.reduce((acc, col) => {
|
|
62
68
|
if (!col.inlineCss?.width)
|
|
63
69
|
return acc;
|
|
64
70
|
const width = col.inlineCss.width;
|
|
65
|
-
return acc + (typeof width ===
|
|
71
|
+
return acc + (typeof width === "string" ? Number.parseInt(width) : width);
|
|
66
72
|
}, 0);
|
|
67
73
|
const remainingColumns = totalColumns - columnsWithWidth.length;
|
|
68
|
-
const remainingWidth = remainingColumns > 0
|
|
74
|
+
const remainingWidth = remainingColumns > 0
|
|
75
|
+
? `${(100 - totalDefinedWidth) / remainingColumns}%`
|
|
76
|
+
: "auto";
|
|
69
77
|
const handleColumnClick = (name, id) => {
|
|
70
78
|
if (onClickHandlerColumn) {
|
|
71
79
|
onClickHandlerColumn({ name, id });
|
|
@@ -127,14 +135,14 @@ const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheck
|
|
|
127
135
|
}
|
|
128
136
|
// For backward compatibility, infer type from name if not explicitly provided
|
|
129
137
|
let inferredType;
|
|
130
|
-
if (filterItem.name?.includes(
|
|
131
|
-
inferredType =
|
|
138
|
+
if (filterItem.name?.includes("sort_")) {
|
|
139
|
+
inferredType = "sort";
|
|
132
140
|
}
|
|
133
|
-
else if (filterItem.name?.includes(
|
|
134
|
-
inferredType =
|
|
141
|
+
else if (filterItem.name?.includes("pin_")) {
|
|
142
|
+
inferredType = "pin";
|
|
135
143
|
}
|
|
136
|
-
else if (filterItem.name?.includes(
|
|
137
|
-
inferredType =
|
|
144
|
+
else if (filterItem.name?.includes("filter")) {
|
|
145
|
+
inferredType = "filter";
|
|
138
146
|
}
|
|
139
147
|
return { ...filterItem, type: inferredType };
|
|
140
148
|
});
|
|
@@ -145,9 +153,9 @@ const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheck
|
|
|
145
153
|
(sortOrder[b.type] || 4));
|
|
146
154
|
});
|
|
147
155
|
// Group by type
|
|
148
|
-
const sortingItems = typedFilterData.filter((filterItem) => filterItem.type ===
|
|
149
|
-
const pinItems = typedFilterData.filter((filterItem) => filterItem.type ===
|
|
150
|
-
const filterItems = typedFilterData.filter((filterItem) => filterItem.type ===
|
|
156
|
+
const sortingItems = typedFilterData.filter((filterItem) => filterItem.type === "sort");
|
|
157
|
+
const pinItems = typedFilterData.filter((filterItem) => filterItem.type === "pin");
|
|
158
|
+
const filterItems = typedFilterData.filter((filterItem) => filterItem.type === "filter");
|
|
151
159
|
return {
|
|
152
160
|
sortingSection: sortingItems.length > 0 ? sortingItems : undefined,
|
|
153
161
|
pinSection: pinItems.length > 0 ? pinItems : undefined,
|
|
@@ -165,15 +173,20 @@ const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheck
|
|
|
165
173
|
}
|
|
166
174
|
setIsFilterClicked(false);
|
|
167
175
|
};
|
|
168
|
-
document.addEventListener(
|
|
176
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
169
177
|
return () => {
|
|
170
|
-
document.removeEventListener(
|
|
178
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
171
179
|
};
|
|
172
180
|
}, [isFilterClicked]);
|
|
173
|
-
|
|
181
|
+
(0, react_1.useEffect)(() => {
|
|
182
|
+
if (hasSelectAll !== undefined) {
|
|
183
|
+
setIsChecked(hasSelectAll);
|
|
184
|
+
}
|
|
185
|
+
}, [hasSelectAll]);
|
|
186
|
+
return (react_1.default.createElement("div", { className: `group ${containerClassName ? containerClassName : ""} max-lg:hidden grid w-full border-b border-t border-black/15 `, style: {
|
|
174
187
|
gridTemplateColumns: isMobileView && mobileViewGridClassName
|
|
175
188
|
? mobileViewGridClassName
|
|
176
|
-
: gridClassName ||
|
|
189
|
+
: gridClassName || "repeat(auto-fit, minmax(100px, 1fr))",
|
|
177
190
|
} },
|
|
178
191
|
react_1.default.createElement("div", { className: "relative flex items-center justify-center gap-2 w-14 mr-[-10px]" },
|
|
179
192
|
react_1.default.createElement("p", { className: "w-6 text-center flex items-center justify-center opacity-50 mr-3" }, "#"),
|
|
@@ -184,19 +197,27 @@ const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheck
|
|
|
184
197
|
hasSelect && (react_1.default.createElement("div", { className: `ml-2 mr-5 flex h-14 w-14 cursor-pointer items-center justify-center rounded-sm` })),
|
|
185
198
|
columns.map((item) => {
|
|
186
199
|
const columnStyle = {
|
|
187
|
-
flex:
|
|
188
|
-
textAlign: item.inlineCss?.textAlign ||
|
|
200
|
+
flex: "1 1 0",
|
|
201
|
+
textAlign: item.inlineCss?.textAlign || "left",
|
|
189
202
|
};
|
|
190
203
|
// Organize modalFilterData into sections if filterSections is not provided
|
|
191
|
-
const organizedSections = !item.filterSections && item.modalFilterData
|
|
204
|
+
const organizedSections = !item.filterSections && item.modalFilterData
|
|
205
|
+
? organizeFilterData(item)
|
|
206
|
+
: null;
|
|
192
207
|
return (react_1.default.createElement(react_1.default.Fragment, { key: item.id },
|
|
193
208
|
react_1.default.createElement("div", { className: `flex items-center h-14 select-none text-sm font-medium text-gray-700 justify-center`, style: {
|
|
194
209
|
...item.inlineCss,
|
|
195
210
|
} },
|
|
196
|
-
item.hasFilter && (react_1.default.createElement("div", { ref: filterIconRef, onClick: (event) => item.hasFilter && handleFilterIconClick(event, item.id), className: `group mr-2 transition-all duration-300 ease-in-out ${item.hasFilter
|
|
211
|
+
item.hasFilter && (react_1.default.createElement("div", { ref: filterIconRef, onClick: (event) => item.hasFilter && handleFilterIconClick(event, item.id), className: `group mr-2 transition-all duration-300 ease-in-out ${item.hasFilter
|
|
212
|
+
? "cursor-pointer opacity-100 hover:scale-105"
|
|
213
|
+
: "opacity-0"}` }, FilterIcon ? (typeof FilterIcon === "string" ? (react_1.default.createElement(image_1.default, { src: FilterIcon || "/placeholder.svg", alt: "filter", width: 16, height: 16 })) : react_1.default.isValidElement(FilterIcon) ? (FilterIcon) : typeof FilterIcon === "function" ? (react_1.default.createElement(FilterIcon)) : (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "size-4 hover:fill-current hover:opacity-50" },
|
|
197
214
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3.75 6.75h16.5M6.75 12h10.5M8.75 17.25h6.5" })))) : (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "size-4 hover:fill-current hover:opacity-50" },
|
|
198
215
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3.75 6.75h16.5M6.75 12h10.5M8.75 17.25h6.5" }))))),
|
|
199
|
-
react_1.default.createElement("div", { onClick: () => item.hasSort &&
|
|
216
|
+
react_1.default.createElement("div", { onClick: () => item.hasSort &&
|
|
217
|
+
item.name &&
|
|
218
|
+
handleColumnClick(item.name, item.id), className: `transition-all relative text-nowrap ${item.hasSort
|
|
219
|
+
? "cursor-pointer hover:text-black "
|
|
220
|
+
: "cursor-default"}` },
|
|
200
221
|
item.content,
|
|
201
222
|
item.modalFilterData &&
|
|
202
223
|
item.modalFilterData.length > 0 &&
|
|
@@ -219,19 +240,28 @@ const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheck
|
|
|
219
240
|
content: sortingItem.content,
|
|
220
241
|
});
|
|
221
242
|
}
|
|
222
|
-
}, className: `cursor-pointer py-[10px] px-[10px] text-sm text-gray-700 flex items-center justify-between hover:bg-gray-100 ${checkedSorting[sortingItem.id]
|
|
243
|
+
}, className: `cursor-pointer py-[10px] px-[10px] text-sm text-gray-700 flex items-center justify-between hover:bg-gray-100 ${checkedSorting[sortingItem.id]
|
|
244
|
+
? "bg-gray-200"
|
|
245
|
+
: ""}` },
|
|
223
246
|
react_1.default.createElement("div", { className: "flex items-center gap-2" },
|
|
224
|
-
sortingItem.FilterIcon ? (typeof sortingItem.FilterIcon ===
|
|
247
|
+
sortingItem.FilterIcon ? (typeof sortingItem.FilterIcon ===
|
|
248
|
+
"string" ? (react_1.default.createElement(image_1.default, { src: sortingItem.FilterIcon ||
|
|
249
|
+
"/placeholder.svg", alt: "sort icon", width: 16, height: 16, className: `mr-2 ${sortingItem.iconTailwindStyle}` })) : react_1.default.isValidElement(sortingItem.FilterIcon) ? (react_1.default.createElement("span", { className: `mr-2 ${sortingItem.iconTailwindStyle}` }, sortingItem.FilterIcon)) : typeof sortingItem.FilterIcon ===
|
|
250
|
+
"function" ? (react_1.default.createElement("span", { className: `mr-2 ${sortingItem.iconTailwindStyle}` }, react_1.default.createElement(sortingItem.FilterIcon))) : null) : null,
|
|
225
251
|
react_1.default.createElement("span", null, sortingItem.content)),
|
|
226
252
|
checkedSorting[sortingItem.id] &&
|
|
227
253
|
sortingItem.CheckedIcon &&
|
|
228
|
-
(typeof sortingItem.CheckedIcon ===
|
|
254
|
+
(typeof sortingItem.CheckedIcon ===
|
|
255
|
+
"string" ? (react_1.default.createElement(image_1.default, { src: sortingItem.CheckedIcon ||
|
|
256
|
+
"/placeholder.svg", alt: "checked", width: 16, height: 16 })) : react_1.default.isValidElement(sortingItem.CheckedIcon) ? (sortingItem.CheckedIcon) : typeof sortingItem.CheckedIcon ===
|
|
257
|
+
"function" ? (react_1.default.createElement(sortingItem.CheckedIcon)) : (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "size-4 hover:fill-current hover:opacity-50" },
|
|
229
258
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }))))))))),
|
|
230
259
|
organizedSections?.sortingSection &&
|
|
231
260
|
organizedSections.sortingSection.length > 0 &&
|
|
232
261
|
organizedSections?.pinSection &&
|
|
233
262
|
organizedSections.pinSection.length > 0 && (react_1.default.createElement("div", { className: "border-t border-gray-200 my-1" })),
|
|
234
|
-
organizedSections?.pinSection &&
|
|
263
|
+
organizedSections?.pinSection &&
|
|
264
|
+
organizedSections.pinSection.length > 0 && (react_1.default.createElement("div", { className: "pin-section" }, organizedSections.pinSection.map((pinItem) => (react_1.default.createElement("div", { key: pinItem.id, onClick: (event) => {
|
|
235
265
|
event.stopPropagation();
|
|
236
266
|
handlePinItemClick(pinItem.id, pinItem.name, pinItem.content);
|
|
237
267
|
if (filterHandler) {
|
|
@@ -248,13 +278,17 @@ const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheck
|
|
|
248
278
|
content: pinItem.content,
|
|
249
279
|
});
|
|
250
280
|
}
|
|
251
|
-
}, className: `cursor-pointer py-[10px] px-[10px] text-sm text-gray-700 flex items-center justify-between hover:bg-gray-100 ${checkedPins[pinItem.id] ?
|
|
281
|
+
}, className: `cursor-pointer py-[10px] px-[10px] text-sm text-gray-700 flex items-center justify-between hover:bg-gray-100 ${checkedPins[pinItem.id] ? "bg-gray-200" : ""}` },
|
|
252
282
|
react_1.default.createElement("div", { className: "flex items-center gap-2" },
|
|
253
|
-
pinItem.FilterIcon ? (typeof pinItem.FilterIcon ===
|
|
283
|
+
pinItem.FilterIcon ? (typeof pinItem.FilterIcon === "string" ? (react_1.default.createElement(image_1.default, { src: pinItem.FilterIcon ||
|
|
284
|
+
"/placeholder.svg", alt: "pin icon", width: 16, height: 16, className: `mr-2 ${pinItem.iconTailwindStyle}` })) : react_1.default.isValidElement(pinItem.FilterIcon) ? (react_1.default.createElement("span", { className: `mr-2 ${pinItem.iconTailwindStyle}` }, pinItem.FilterIcon)) : typeof pinItem.FilterIcon ===
|
|
285
|
+
"function" ? (react_1.default.createElement("span", { className: `mr-2 ${pinItem.iconTailwindStyle}` }, react_1.default.createElement(pinItem.FilterIcon))) : null) : null,
|
|
254
286
|
react_1.default.createElement("span", null, pinItem.content)),
|
|
255
287
|
checkedPins[pinItem.id] &&
|
|
256
288
|
pinItem.CheckedIcon &&
|
|
257
|
-
(typeof pinItem.CheckedIcon ===
|
|
289
|
+
(typeof pinItem.CheckedIcon === "string" ? (react_1.default.createElement(image_1.default, { src: pinItem.CheckedIcon ||
|
|
290
|
+
"/placeholder.svg", alt: "checked", width: 16, height: 16 })) : react_1.default.isValidElement(pinItem.CheckedIcon) ? (pinItem.CheckedIcon) : typeof pinItem.CheckedIcon ===
|
|
291
|
+
"function" ? (react_1.default.createElement(pinItem.CheckedIcon)) : (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "size-4 hover:fill-current hover:opacity-50" },
|
|
258
292
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }))))))))),
|
|
259
293
|
((organizedSections?.sortingSection &&
|
|
260
294
|
organizedSections.sortingSection.length > 0) ||
|
|
@@ -268,26 +302,30 @@ const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheck
|
|
|
268
302
|
if (filterHandler) {
|
|
269
303
|
filterHandler({
|
|
270
304
|
id: organizedSections.filterSection?.id ?? 0,
|
|
271
|
-
content: organizedSections.filterSection?.content ??
|
|
272
|
-
|
|
305
|
+
content: organizedSections.filterSection?.content ??
|
|
306
|
+
"",
|
|
307
|
+
name: organizedSections.filterSection?.name ?? "",
|
|
273
308
|
});
|
|
274
309
|
}
|
|
275
310
|
if (onFilterClick) {
|
|
276
311
|
onFilterClick({
|
|
277
312
|
id: organizedSections.filterSection?.id ?? 0,
|
|
278
|
-
name: organizedSections.filterSection?.name ??
|
|
279
|
-
content: organizedSections.filterSection?.content ??
|
|
313
|
+
name: organizedSections.filterSection?.name ?? "",
|
|
314
|
+
content: organizedSections.filterSection?.content ??
|
|
315
|
+
"",
|
|
280
316
|
});
|
|
281
317
|
}
|
|
282
318
|
}, className: "cursor-pointer py-[10px] px-[10px] text-sm text-gray-700 flex items-center justify-between hover:bg-gray-100" },
|
|
283
319
|
react_1.default.createElement("div", { className: "flex items-center gap-2" },
|
|
284
|
-
organizedSections.filterSection.FilterIcon ? (typeof organizedSections.filterSection
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
320
|
+
organizedSections.filterSection.FilterIcon ? (typeof organizedSections.filterSection
|
|
321
|
+
.FilterIcon === "string" ? (react_1.default.createElement(image_1.default, { src: organizedSections.filterSection
|
|
322
|
+
.FilterIcon ||
|
|
323
|
+
"/placeholder.svg" ||
|
|
324
|
+
"/placeholder.svg" ||
|
|
325
|
+
"/placeholder.svg" ||
|
|
326
|
+
"/placeholder.svg" ||
|
|
327
|
+
"/placeholder.svg", alt: "filter icon", width: 16, height: 16, className: `mr-2 ${organizedSections.filterSection.iconTailwindStyle}` })) : react_1.default.isValidElement(organizedSections.filterSection.FilterIcon) ? (react_1.default.createElement("span", { className: `mr-2 ${organizedSections.filterSection.iconTailwindStyle}` }, organizedSections.filterSection.FilterIcon)) : typeof organizedSections.filterSection
|
|
328
|
+
.FilterIcon === "function" ? (react_1.default.createElement("span", { className: `mr-2 ${organizedSections.filterSection.iconTailwindStyle}` }, react_1.default.createElement(organizedSections.filterSection
|
|
291
329
|
.FilterIcon))) : (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "size-4 mr-2" },
|
|
292
330
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z" })))) : (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "size-4 mr-2" },
|
|
293
331
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 01-.659 1.591l-5.432 5.432a2.25 2.25 0 00-.659 1.591v2.927a2.25 2.25 0 01-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 00-.659-1.591L3.659 7.409A2.25 2.25 0 013 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0112 3z" }))),
|
|
@@ -310,17 +348,20 @@ const ModernTableHeader = ({ columns = [], sortIcon, hasSelect = false, hasCheck
|
|
|
310
348
|
content: filterItem.content,
|
|
311
349
|
});
|
|
312
350
|
}
|
|
313
|
-
}, className: `cursor-pointer py-[10px] px-[10px] text-sm text-gray-700 flex items-center justify-between hover:bg-gray-100 ${checkedFilters[filterItem.id] ?
|
|
351
|
+
}, className: `cursor-pointer py-[10px] px-[10px] text-sm text-gray-700 flex items-center justify-between hover:bg-gray-100 ${checkedFilters[filterItem.id] ? "bg-gray-200" : ""}` },
|
|
314
352
|
react_1.default.createElement("div", { className: "flex items-center gap-2" },
|
|
315
|
-
filterItem.FilterIcon ? (typeof filterItem.FilterIcon ===
|
|
353
|
+
filterItem.FilterIcon ? (typeof filterItem.FilterIcon === "string" ? (react_1.default.createElement(image_1.default, { src: filterItem.FilterIcon ||
|
|
354
|
+
"/placeholder.svg", alt: "filter icon", width: 16, height: 16, className: `mr-2 ${filterItem.iconTailwindStyle}` })) : react_1.default.isValidElement(filterItem.FilterIcon) ? (react_1.default.createElement("span", { className: `mr-2 ${filterItem.iconTailwindStyle}` }, filterItem.FilterIcon)) : typeof filterItem.FilterIcon ===
|
|
355
|
+
"function" ? (react_1.default.createElement("span", { className: `mr-2 ${filterItem.iconTailwindStyle}` }, react_1.default.createElement(filterItem.FilterIcon))) : null) : null,
|
|
316
356
|
react_1.default.createElement("span", null, filterItem.content)),
|
|
317
357
|
item.hasFilter &&
|
|
318
358
|
checkedFilters[filterItem.id] &&
|
|
319
359
|
filterItem.CheckedIcon &&
|
|
320
|
-
(typeof filterItem.CheckedIcon ===
|
|
360
|
+
(typeof filterItem.CheckedIcon === "string" ? (react_1.default.createElement(image_1.default, { src: filterItem.CheckedIcon || "/placeholder.svg", alt: "checked", width: 16, height: 16 })) : react_1.default.isValidElement(filterItem.CheckedIcon) ? (filterItem.CheckedIcon) : typeof filterItem.CheckedIcon ===
|
|
361
|
+
"function" ? (react_1.default.createElement(filterItem.CheckedIcon)) : (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: "1.5", stroke: "currentColor", className: "size-4 hover:fill-current hover:opacity-50" },
|
|
321
362
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" })))))))))),
|
|
322
|
-
item.hasSort && (react_1.default.createElement("div", { className: `ml-1 transition-all duration-300 ease-in-out ${arrowDir && clickedColumn === item.name ?
|
|
323
|
-
react_1.default.createElement(image_1.default, { src: sortIcon ||
|
|
363
|
+
item.hasSort && (react_1.default.createElement("div", { className: `ml-1 transition-all duration-300 ease-in-out ${arrowDir && clickedColumn === item.name ? "rotate-180" : ""} ${clickedColumn === item.name ? "opacity-100" : "opacity-0"}` },
|
|
364
|
+
react_1.default.createElement(image_1.default, { src: sortIcon || "/placeholder.svg", alt: "sortIcon", width: 12, height: 12 }))))));
|
|
324
365
|
})));
|
|
325
366
|
};
|
|
326
367
|
exports.default = ModernTableHeader;
|