hi-tm 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -0
- package/dist/components/Cards/AutoComplete&DropDown/ItemCard.js +2 -2
- package/dist/components/DropDowns/CreatableDropDown.d.ts +3 -0
- package/dist/components/DropDowns/CreatableDropDown.js +255 -0
- package/dist/components/Inputs/InputMultiselect.js +17 -7
- package/dist/components/Layout/Headers/HeaderLayout.js +9 -3
- package/dist/components/Layout/Sidebar.js +1 -1
- package/dist/components/Table/ModernTable/ModernTable.d.ts +4 -0
- package/dist/components/Table/ModernTable/ModernTable.js +421 -0
- package/dist/components/Table/ModernTable/ModernTableHeader.d.ts +102 -0
- package/dist/components/Table/ModernTable/ModernTableHeader.js +322 -0
- package/dist/components/Table/RtlTable/RtlTable.d.ts +5 -0
- package/dist/components/Table/RtlTable/RtlTable.js +126 -0
- package/dist/components/Table/TableHeaderDiv.js +1 -1
- package/dist/components/Table/TableRowDiv.d.ts +1 -0
- package/dist/components/Table/TableRowDiv.js +0 -1
- package/dist/components/Wrapper/Bounded.d.ts +5 -3
- package/dist/components/Wrapper/Bounded.js +6 -6
- package/dist/components/Wrapper/ModernTable/ModernTableBounded.d.ts +26 -0
- package/dist/components/Wrapper/ModernTable/ModernTableBounded.js +23 -0
- package/dist/components/Wrapper/TableBodyBoundedDiv.js +1 -1
- package/dist/components/Wrapper/TableBoundedDiv.d.ts +2 -2
- package/dist/components/Wrapper/TableBoundedDiv.js +2 -2
- package/dist/components/sections/components/Tabs/TabsComponent.js +6 -1
- package/dist/elements/Loader.d.ts +3 -0
- package/dist/elements/Loader.js +21 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +14 -1
- package/dist/styles/globals.css +100 -96
- package/dist/types/DropDown/CreatableDropDown.d.ts +57 -0
- package/dist/types/DropDown/CreatableDropDown.js +2 -0
- package/dist/types/ModernTable/index.d.ts +87 -0
- package/dist/types/ModernTable/index.js +2 -0
- package/dist/types/RtlTable/index.d.ts +73 -0
- package/dist/types/RtlTable/index.js +2 -0
- package/package.json +3 -1
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const react_1 = __importStar(require("react"));
|
|
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, }) => {
|
|
43
|
+
const [activeFilterColumn, setActiveFilterColumn] = (0, react_1.useState)(null);
|
|
44
|
+
const [clickedColumn, setClickedColumn] = (0, react_1.useState)(null);
|
|
45
|
+
const [arrowDir, setArrowDir] = (0, react_1.useState)(false);
|
|
46
|
+
const [isFilterClicked, setIsFilterClicked] = (0, react_1.useState)(false);
|
|
47
|
+
const [isChecked, setIsChecked] = (0, react_1.useState)(false);
|
|
48
|
+
const [checkedFilters, setCheckedFilters] = (0, react_1.useState)({});
|
|
49
|
+
const [checkedSorting, setCheckedSorting] = (0, react_1.useState)({});
|
|
50
|
+
const [checkedPins, setCheckedPins] = (0, react_1.useState)({});
|
|
51
|
+
const modalFilterRef = (0, react_1.useRef)(null);
|
|
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
|
+
};
|
|
59
|
+
const totalColumns = columns?.length || 0;
|
|
60
|
+
const columnsWithWidth = columns?.filter((col) => col.inlineCss && 'width' in (col.inlineCss || {})) || [];
|
|
61
|
+
const totalDefinedWidth = columnsWithWidth.reduce((acc, col) => {
|
|
62
|
+
if (!col.inlineCss?.width)
|
|
63
|
+
return acc;
|
|
64
|
+
const width = col.inlineCss.width;
|
|
65
|
+
return acc + (typeof width === 'string' ? Number.parseInt(width) : width);
|
|
66
|
+
}, 0);
|
|
67
|
+
const remainingColumns = totalColumns - columnsWithWidth.length;
|
|
68
|
+
const remainingWidth = remainingColumns > 0 ? `${(100 - totalDefinedWidth) / remainingColumns}%` : 'auto';
|
|
69
|
+
const handleColumnClick = (name, id) => {
|
|
70
|
+
if (onClickHandlerColumn) {
|
|
71
|
+
onClickHandlerColumn({ name, id });
|
|
72
|
+
}
|
|
73
|
+
setClickedColumn(name);
|
|
74
|
+
setArrowDir((prevDir) => !prevDir);
|
|
75
|
+
};
|
|
76
|
+
const handleFilterIconClick = (event, itemId) => {
|
|
77
|
+
event.stopPropagation();
|
|
78
|
+
setIsFilterClicked(true);
|
|
79
|
+
setActiveFilterColumn(activeFilterColumn === itemId ? null : itemId);
|
|
80
|
+
};
|
|
81
|
+
const handleFilterItemClick = (filterItemId) => {
|
|
82
|
+
setCheckedFilters((prevCheckedFilters) => ({
|
|
83
|
+
...prevCheckedFilters,
|
|
84
|
+
[filterItemId]: !prevCheckedFilters[filterItemId],
|
|
85
|
+
}));
|
|
86
|
+
};
|
|
87
|
+
const handleSortingItemClick = (sortingItemId, name, content) => {
|
|
88
|
+
// Clear previous sorting selections
|
|
89
|
+
setCheckedSorting({});
|
|
90
|
+
// Set the new sorting selection
|
|
91
|
+
setCheckedSorting({ [sortingItemId]: true });
|
|
92
|
+
if (onSortingClick) {
|
|
93
|
+
onSortingClick({
|
|
94
|
+
id: sortingItemId,
|
|
95
|
+
name,
|
|
96
|
+
content,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const handlePinItemClick = (pinItemId, name, content) => {
|
|
101
|
+
// Clear previous pin selections
|
|
102
|
+
setCheckedPins({});
|
|
103
|
+
// Set the new pin selection
|
|
104
|
+
setCheckedPins({ [pinItemId]: true });
|
|
105
|
+
if (onPinClick) {
|
|
106
|
+
onPinClick({
|
|
107
|
+
id: pinItemId,
|
|
108
|
+
name,
|
|
109
|
+
content,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
const handleFilterButtonClick = (columnId) => {
|
|
114
|
+
if (onFilterButtonClick) {
|
|
115
|
+
return onFilterButtonClick(columnId);
|
|
116
|
+
}
|
|
117
|
+
return false;
|
|
118
|
+
};
|
|
119
|
+
// Replace the organizeFilterData function with this updated version that sorts by type
|
|
120
|
+
const organizeFilterData = (item) => {
|
|
121
|
+
if (!item.modalFilterData)
|
|
122
|
+
return null;
|
|
123
|
+
// Add default type based on name if type is not provided
|
|
124
|
+
const typedFilterData = item.modalFilterData.map((filterItem) => {
|
|
125
|
+
if (filterItem.type) {
|
|
126
|
+
return filterItem;
|
|
127
|
+
}
|
|
128
|
+
// For backward compatibility, infer type from name if not explicitly provided
|
|
129
|
+
let inferredType;
|
|
130
|
+
if (filterItem.name?.includes('sort_')) {
|
|
131
|
+
inferredType = 'sort';
|
|
132
|
+
}
|
|
133
|
+
else if (filterItem.name?.includes('pin_')) {
|
|
134
|
+
inferredType = 'pin';
|
|
135
|
+
}
|
|
136
|
+
else if (filterItem.name?.includes('filter')) {
|
|
137
|
+
inferredType = 'filter';
|
|
138
|
+
}
|
|
139
|
+
return { ...filterItem, type: inferredType };
|
|
140
|
+
});
|
|
141
|
+
// Sort by type: pin first, then sort, then filter
|
|
142
|
+
const sortOrder = { pin: 1, sort: 2, filter: 3 };
|
|
143
|
+
typedFilterData.sort((a, b) => {
|
|
144
|
+
return ((sortOrder[a.type] || 4) -
|
|
145
|
+
(sortOrder[b.type] || 4));
|
|
146
|
+
});
|
|
147
|
+
// Group by type
|
|
148
|
+
const sortingItems = typedFilterData.filter((filterItem) => filterItem.type === 'sort');
|
|
149
|
+
const pinItems = typedFilterData.filter((filterItem) => filterItem.type === 'pin');
|
|
150
|
+
const filterItems = typedFilterData.filter((filterItem) => filterItem.type === 'filter');
|
|
151
|
+
return {
|
|
152
|
+
sortingSection: sortingItems.length > 0 ? sortingItems : undefined,
|
|
153
|
+
pinSection: pinItems.length > 0 ? pinItems : undefined,
|
|
154
|
+
filterSection: filterItems.length > 0 ? filterItems[0] : undefined,
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
(0, react_1.useEffect)(() => {
|
|
158
|
+
const handleClickOutside = (event) => {
|
|
159
|
+
if (!isFilterClicked) {
|
|
160
|
+
if (filterIconRef.current?.contains(event.target) ||
|
|
161
|
+
modalFilterRef.current?.contains(event.target)) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
setActiveFilterColumn(null);
|
|
165
|
+
}
|
|
166
|
+
setIsFilterClicked(false);
|
|
167
|
+
};
|
|
168
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
169
|
+
return () => {
|
|
170
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
171
|
+
};
|
|
172
|
+
}, [isFilterClicked]);
|
|
173
|
+
return (react_1.default.createElement("div", { className: "group max-lg:hidden grid w-full border-b border-t border-black/15", style: { gridTemplateColumns: gridClassName || 'repeat(auto-fit, minmax(100px, 1fr))' } },
|
|
174
|
+
react_1.default.createElement("div", { className: "relative flex items-center justify-center gap-2 w-14 mr-[-10px]" },
|
|
175
|
+
react_1.default.createElement("p", { className: "w-6 text-center flex items-center justify-center opacity-50 mr-3" }, "#"),
|
|
176
|
+
hasCheckbox && (react_1.default.createElement("div", { className: "relative mt-[7px]" },
|
|
177
|
+
react_1.default.createElement("input", { type: "checkbox", checked: isChecked, onChange: handleCheckboxChange, className: "peer h-5 w-5 cursor-pointer appearance-none rounded-md border-2 border-gray-300 transition-all checked:border-blue-500 checked:bg-blue-500 hover:border-blue-500" }),
|
|
178
|
+
react_1.default.createElement("svg", { className: "pointer-events-none absolute left-[5px] top-[5px] h-2.5 w-2.5 fill-white opacity-0 transition-opacity peer-checked:opacity-100", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" },
|
|
179
|
+
react_1.default.createElement("path", { d: "M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z" }))))),
|
|
180
|
+
hasSelect && (react_1.default.createElement("div", { className: `ml-2 mr-5 flex h-14 w-14 cursor-pointer items-center justify-center rounded-sm` })),
|
|
181
|
+
columns.map((item) => {
|
|
182
|
+
const columnStyle = {
|
|
183
|
+
flex: '1 1 0',
|
|
184
|
+
textAlign: item.inlineCss?.textAlign || 'left',
|
|
185
|
+
};
|
|
186
|
+
// Organize modalFilterData into sections if filterSections is not provided
|
|
187
|
+
const organizedSections = !item.filterSections && item.modalFilterData ? organizeFilterData(item) : null;
|
|
188
|
+
return (react_1.default.createElement(react_1.default.Fragment, { key: item.id },
|
|
189
|
+
react_1.default.createElement("div", { className: `flex items-center h-14 select-none text-sm font-medium text-gray-700 justify-center`, style: {
|
|
190
|
+
...item.inlineCss,
|
|
191
|
+
} },
|
|
192
|
+
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 ? 'cursor-pointer opacity-100 hover:scale-105' : '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" },
|
|
193
|
+
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" },
|
|
194
|
+
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3.75 6.75h16.5M6.75 12h10.5M8.75 17.25h6.5" }))))),
|
|
195
|
+
react_1.default.createElement("div", { onClick: () => item.hasSort && item.name && handleColumnClick(item.name, item.id), className: `transition-all relative text-nowrap ${item.hasSort ? 'cursor-pointer hover:text-black ' : 'cursor-default'}` },
|
|
196
|
+
item.content,
|
|
197
|
+
item.modalFilterData &&
|
|
198
|
+
item.modalFilterData.length > 0 &&
|
|
199
|
+
activeFilterColumn === item.id && (react_1.default.createElement("div", { ref: modalFilterRef, className: "absolute mt-1 w-48 cursor-default rounded-md bg-white py-1 shadow-lg z-10 border border-gray-200" },
|
|
200
|
+
organizedSections?.sortingSection &&
|
|
201
|
+
organizedSections.sortingSection.length > 0 && (react_1.default.createElement("div", { className: "sorting-section" }, organizedSections.sortingSection.map((sortingItem) => (react_1.default.createElement("div", { key: sortingItem.id, onClick: (event) => {
|
|
202
|
+
event.stopPropagation();
|
|
203
|
+
handleSortingItemClick(sortingItem.id, sortingItem.name, sortingItem.content);
|
|
204
|
+
if (filterHandler) {
|
|
205
|
+
filterHandler({
|
|
206
|
+
id: sortingItem.id,
|
|
207
|
+
content: sortingItem.content,
|
|
208
|
+
name: sortingItem.name,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
if (onFilterClick) {
|
|
212
|
+
onFilterClick({
|
|
213
|
+
id: sortingItem.id,
|
|
214
|
+
name: sortingItem.name,
|
|
215
|
+
content: sortingItem.content,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}, className: `cursor-pointer py-[10px] px-[10px] text-sm text-gray-700 flex items-center justify-between hover:bg-gray-100 ${checkedSorting[sortingItem.id] ? 'bg-gray-200' : ''}` },
|
|
219
|
+
react_1.default.createElement("div", { className: "flex items-center gap-2" },
|
|
220
|
+
sortingItem.FilterIcon ? (typeof sortingItem.FilterIcon === 'string' ? (react_1.default.createElement(image_1.default, { src: sortingItem.FilterIcon || '/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 === 'function' ? (react_1.default.createElement("span", { className: `mr-2 ${sortingItem.iconTailwindStyle}` }, react_1.default.createElement(sortingItem.FilterIcon))) : null) : null,
|
|
221
|
+
react_1.default.createElement("span", null, sortingItem.content)),
|
|
222
|
+
checkedSorting[sortingItem.id] &&
|
|
223
|
+
sortingItem.CheckedIcon &&
|
|
224
|
+
(typeof sortingItem.CheckedIcon === 'string' ? (react_1.default.createElement(image_1.default, { src: sortingItem.CheckedIcon || '/placeholder.svg', alt: "checked", width: 16, height: 16 })) : react_1.default.isValidElement(sortingItem.CheckedIcon) ? (sortingItem.CheckedIcon) : typeof sortingItem.CheckedIcon === '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" },
|
|
225
|
+
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }))))))))),
|
|
226
|
+
organizedSections?.sortingSection &&
|
|
227
|
+
organizedSections.sortingSection.length > 0 &&
|
|
228
|
+
organizedSections?.pinSection &&
|
|
229
|
+
organizedSections.pinSection.length > 0 && (react_1.default.createElement("div", { className: "border-t border-gray-200 my-1" })),
|
|
230
|
+
organizedSections?.pinSection && 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) => {
|
|
231
|
+
event.stopPropagation();
|
|
232
|
+
handlePinItemClick(pinItem.id, pinItem.name, pinItem.content);
|
|
233
|
+
if (filterHandler) {
|
|
234
|
+
filterHandler({
|
|
235
|
+
id: pinItem.id,
|
|
236
|
+
content: pinItem.content,
|
|
237
|
+
name: pinItem.name,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
if (onFilterClick) {
|
|
241
|
+
onFilterClick({
|
|
242
|
+
id: pinItem.id,
|
|
243
|
+
name: pinItem.name,
|
|
244
|
+
content: pinItem.content,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}, 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' : ''}` },
|
|
248
|
+
react_1.default.createElement("div", { className: "flex items-center gap-2" },
|
|
249
|
+
pinItem.FilterIcon ? (typeof pinItem.FilterIcon === 'string' ? (react_1.default.createElement(image_1.default, { src: pinItem.FilterIcon || '/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 === 'function' ? (react_1.default.createElement("span", { className: `mr-2 ${pinItem.iconTailwindStyle}` }, react_1.default.createElement(pinItem.FilterIcon))) : null) : null,
|
|
250
|
+
react_1.default.createElement("span", null, pinItem.content)),
|
|
251
|
+
checkedPins[pinItem.id] &&
|
|
252
|
+
pinItem.CheckedIcon &&
|
|
253
|
+
(typeof pinItem.CheckedIcon === 'string' ? (react_1.default.createElement(image_1.default, { src: pinItem.CheckedIcon || '/placeholder.svg', alt: "checked", width: 16, height: 16 })) : react_1.default.isValidElement(pinItem.CheckedIcon) ? (pinItem.CheckedIcon) : typeof pinItem.CheckedIcon === '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" },
|
|
254
|
+
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" }))))))))),
|
|
255
|
+
((organizedSections?.sortingSection &&
|
|
256
|
+
organizedSections.sortingSection.length > 0) ||
|
|
257
|
+
(organizedSections?.pinSection &&
|
|
258
|
+
organizedSections.pinSection.length > 0)) &&
|
|
259
|
+
organizedSections?.filterSection && (react_1.default.createElement("div", { className: "border-t border-gray-200 my-1" })),
|
|
260
|
+
organizedSections?.filterSection && (react_1.default.createElement("div", { className: "filter-section" },
|
|
261
|
+
react_1.default.createElement("div", { onClick: (event) => {
|
|
262
|
+
event.stopPropagation();
|
|
263
|
+
handleFilterButtonClick(item.id);
|
|
264
|
+
if (filterHandler) {
|
|
265
|
+
filterHandler({
|
|
266
|
+
id: organizedSections.filterSection?.id ?? 0,
|
|
267
|
+
content: organizedSections.filterSection?.content ?? '',
|
|
268
|
+
name: organizedSections.filterSection?.name ?? '',
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
if (onFilterClick) {
|
|
272
|
+
onFilterClick({
|
|
273
|
+
id: organizedSections.filterSection?.id ?? 0,
|
|
274
|
+
name: organizedSections.filterSection?.name ?? '',
|
|
275
|
+
content: organizedSections.filterSection?.content ?? '',
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}, className: "cursor-pointer py-[10px] px-[10px] text-sm text-gray-700 flex items-center justify-between hover:bg-gray-100" },
|
|
279
|
+
react_1.default.createElement("div", { className: "flex items-center gap-2" },
|
|
280
|
+
organizedSections.filterSection.FilterIcon ? (typeof organizedSections.filterSection.FilterIcon === 'string' ? (react_1.default.createElement(image_1.default, { src: organizedSections.filterSection.FilterIcon ||
|
|
281
|
+
'/placeholder.svg' ||
|
|
282
|
+
'/placeholder.svg' ||
|
|
283
|
+
'/placeholder.svg' ||
|
|
284
|
+
'/placeholder.svg' ||
|
|
285
|
+
'/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.FilterIcon ===
|
|
286
|
+
'function' ? (react_1.default.createElement("span", { className: `mr-2 ${organizedSections.filterSection.iconTailwindStyle}` }, react_1.default.createElement(organizedSections.filterSection
|
|
287
|
+
.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" },
|
|
288
|
+
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" },
|
|
289
|
+
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" }))),
|
|
290
|
+
react_1.default.createElement("span", null, organizedSections.filterSection.content))))),
|
|
291
|
+
!organizedSections &&
|
|
292
|
+
item.modalFilterData.map((filterItem) => (react_1.default.createElement("div", { key: filterItem.id, onClick: (event) => {
|
|
293
|
+
event.stopPropagation();
|
|
294
|
+
handleFilterItemClick(filterItem.id);
|
|
295
|
+
if (filterHandler) {
|
|
296
|
+
filterHandler({
|
|
297
|
+
id: filterItem.id,
|
|
298
|
+
content: filterItem.content,
|
|
299
|
+
name: filterItem.name,
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
if (onFilterClick) {
|
|
303
|
+
onFilterClick({
|
|
304
|
+
id: filterItem.id,
|
|
305
|
+
name: filterItem.name,
|
|
306
|
+
content: filterItem.content,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}, 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' : ''}` },
|
|
310
|
+
react_1.default.createElement("div", { className: "flex items-center gap-2" },
|
|
311
|
+
filterItem.FilterIcon ? (typeof filterItem.FilterIcon === 'string' ? (react_1.default.createElement(image_1.default, { src: filterItem.FilterIcon || '/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 === 'function' ? (react_1.default.createElement("span", { className: `mr-2 ${filterItem.iconTailwindStyle}` }, react_1.default.createElement(filterItem.FilterIcon))) : null) : null,
|
|
312
|
+
react_1.default.createElement("span", null, filterItem.content)),
|
|
313
|
+
item.hasFilter &&
|
|
314
|
+
checkedFilters[filterItem.id] &&
|
|
315
|
+
filterItem.CheckedIcon &&
|
|
316
|
+
(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 === '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" },
|
|
317
|
+
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 12.75l6 6 9-13.5" })))))))))),
|
|
318
|
+
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'}` },
|
|
319
|
+
react_1.default.createElement(image_1.default, { src: sortIcon || '/placeholder.svg', alt: "sortIcon", width: 12, height: 12 }))))));
|
|
320
|
+
})));
|
|
321
|
+
};
|
|
322
|
+
exports.default = ModernTableHeader;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RtlTableProps } from '@/types/RtlTable';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export default function RtlTable({ headers, data, onDeleteRow, onDeleteSubItem, showDeleteButton, iconSrc, className, isDndActive, }: RtlTableProps & {
|
|
4
|
+
isDndActive?: boolean;
|
|
5
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.default = RtlTable;
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const dnd_1 = require("@hello-pangea/dnd");
|
|
40
|
+
function RtlTable({ headers, data, onDeleteRow, onDeleteSubItem, showDeleteButton = true, iconSrc = {}, className = '', isDndActive = false, // Add this prop to control drag-and-drop activation
|
|
41
|
+
}) {
|
|
42
|
+
// Set the first row as active by default if it has a subitem
|
|
43
|
+
const defaultActiveRow = data.length > 0 && data[0].subItem ? data[0].id : null;
|
|
44
|
+
const [activeRowId, setActiveRowId] = (0, react_1.useState)(defaultActiveRow);
|
|
45
|
+
const [tableData, setTableData] = (0, react_1.useState)(data);
|
|
46
|
+
const [draggedItemId, setDraggedItemId] = (0, react_1.useState)(null);
|
|
47
|
+
// Default icons
|
|
48
|
+
const icons = {
|
|
49
|
+
...iconSrc,
|
|
50
|
+
};
|
|
51
|
+
const handleRowClick = (rowId) => {
|
|
52
|
+
setActiveRowId((prevId) => (prevId === rowId ? null : rowId));
|
|
53
|
+
};
|
|
54
|
+
const handleDeleteRow = (rowId, e) => {
|
|
55
|
+
e.stopPropagation();
|
|
56
|
+
if (onDeleteRow) {
|
|
57
|
+
onDeleteRow(rowId);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const handleDeleteSubItem = (rowId, subItemId, e) => {
|
|
61
|
+
e.stopPropagation();
|
|
62
|
+
if (onDeleteSubItem) {
|
|
63
|
+
onDeleteSubItem(rowId, subItemId);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const onDragStart = (start) => {
|
|
67
|
+
setDraggedItemId(start.draggableId);
|
|
68
|
+
};
|
|
69
|
+
const onDragEnd = (result) => {
|
|
70
|
+
setDraggedItemId(null);
|
|
71
|
+
if (!result.destination)
|
|
72
|
+
return;
|
|
73
|
+
const items = Array.from(tableData);
|
|
74
|
+
const [reorderedItem] = items.splice(result.source.index, 1);
|
|
75
|
+
items.splice(result.destination.index, 0, reorderedItem);
|
|
76
|
+
setTableData(items);
|
|
77
|
+
};
|
|
78
|
+
// Helper function to render cell content
|
|
79
|
+
const renderCellContent = (content, headerId) => {
|
|
80
|
+
// If it's the unit column and the content is a string or number, render with dropdown
|
|
81
|
+
if (headerId === 'unit' && (typeof content === 'string' || typeof content === 'number')) {
|
|
82
|
+
return (react_1.default.createElement("div", { className: "flex items-center justify-end" },
|
|
83
|
+
react_1.default.createElement("span", { className: "mr-2" }, content),
|
|
84
|
+
react_1.default.createElement("div", { className: "relative inline-block text-left" },
|
|
85
|
+
react_1.default.createElement("button", { type: "button", className: "inline-flex justify-center w-full rounded-md border border-gray-300 shadow-sm px-2 py-1 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500", onClick: (e) => e.stopPropagation() }, react_1.default.isValidElement(icons.dropdownIcon) ? icons.dropdownIcon : null))));
|
|
86
|
+
}
|
|
87
|
+
// If it's a React component, render it directly
|
|
88
|
+
if (react_1.default.isValidElement(content)) {
|
|
89
|
+
return react_1.default.createElement("div", { onClick: (e) => e.stopPropagation() }, content);
|
|
90
|
+
}
|
|
91
|
+
// Otherwise, render as text
|
|
92
|
+
return content;
|
|
93
|
+
};
|
|
94
|
+
return (react_1.default.createElement(dnd_1.DragDropContext, { onDragStart: onDragStart, onDragEnd: onDragEnd },
|
|
95
|
+
react_1.default.createElement(dnd_1.Droppable, { droppableId: "table" }, (provided) => (react_1.default.createElement("div", { ...provided.droppableProps, ref: provided.innerRef, className: `w-full overflow-x-auto rounded-lg shadow-sm ${className}` },
|
|
96
|
+
react_1.default.createElement("div", { className: "w-full border border-gray-200 rounded-lg bg-white", dir: "rtl" },
|
|
97
|
+
react_1.default.createElement("div", { className: "flex bg-gray-50 border-b border-gray-200 rounded-t-lg" },
|
|
98
|
+
react_1.default.createElement("div", { className: "w-12 p-4 text-center font-medium text-gray-700 border-l border-gray-200 flex items-center justify-center" }, "#"),
|
|
99
|
+
headers.map((header, index) => (react_1.default.createElement("div", { key: header.id, className: `p-4 text-right font-medium text-gray-700 ${index < headers.length - 1 ? 'border-l border-gray-200' : ''}`, style: { width: header.width || 'auto' } }, header.label))),
|
|
100
|
+
showDeleteButton && (react_1.default.createElement("div", { className: "w-12 p-4 text-center font-medium text-gray-700" }))),
|
|
101
|
+
react_1.default.createElement("div", { className: "bg-white divide-y divide-gray-100" },
|
|
102
|
+
tableData.map((row, index) => (react_1.default.createElement(dnd_1.Draggable, { key: row.id, draggableId: row.id, index: index, isDragDisabled: !isDndActive }, (provided) => (react_1.default.createElement("div", { ref: provided.innerRef, ...provided.draggableProps, ...provided.dragHandleProps, style: {
|
|
103
|
+
...provided.draggableProps.style,
|
|
104
|
+
cursor: isDndActive ? 'grab' : 'default',
|
|
105
|
+
backgroundColor: draggedItemId === row.id ? 'rgba(0, 0, 0, 0.1)' : 'transparent',
|
|
106
|
+
filter: draggedItemId && draggedItemId !== row.id ? 'blur(2px)' : 'none',
|
|
107
|
+
} },
|
|
108
|
+
react_1.default.createElement("div", { key: row.id, className: "flex flex-col" },
|
|
109
|
+
react_1.default.createElement("div", { className: `flex items-center transition-colors duration-150 cursor-pointer ${activeRowId === row.id ? 'bg-gray-100' : 'hover:bg-gray-50'}`, onClick: () => handleRowClick(row.id) },
|
|
110
|
+
react_1.default.createElement("div", { className: `w-12 px-4 text-center text-gray-700 border-l border-gray-200 font-medium ${isDndActive ? 'cursor-grab' : ''}` },
|
|
111
|
+
react_1.default.createElement("span", null, index + 1)),
|
|
112
|
+
headers.map((header, headerIndex) => (react_1.default.createElement("div", { key: `${row.id}-${header.id}`, className: `px-4 text-right text-gray-700 ${headerIndex < headers.length - 1 ? 'border-l border-gray-200' : ''}`, style: { width: header.width || 'auto' } }, renderCellContent(row.cells[header.id], header.id)))),
|
|
113
|
+
showDeleteButton && (react_1.default.createElement("div", { className: "w-12 p-4 flex justify-center" },
|
|
114
|
+
react_1.default.createElement("button", { onClick: (e) => handleDeleteRow(row.id, e), className: "text-red-500 hover:text-red-600 transition-colors duration-150 transform hover:scale-110 focus:outline-none", "aria-label": "Delete row" }, react_1.default.isValidElement(icons.deleteIcon) ? icons.deleteIcon : null)))),
|
|
115
|
+
activeRowId === row.id && row.subItem && (react_1.default.createElement("div", { className: "animate-fadeIn" },
|
|
116
|
+
react_1.default.createElement("div", { key: row.subItem.id, className: "flex items-center transition-colors duration-150 bg-gray-50" },
|
|
117
|
+
react_1.default.createElement("div", { className: "w-12 px-4 text-center text-gray-600 border-l border-gray-200 font-medium flex items-center justify-center" }, react_1.default.isValidElement(icons.childIcon) ? icons.childIcon : null),
|
|
118
|
+
headers.map((header, headerIndex) => (react_1.default.createElement("div", { key: `${row?.subItem?.id}-${header.id}`, className: `px-4 text-right text-gray-600 ${headerIndex < headers.length - 1
|
|
119
|
+
? 'border-l border-gray-200'
|
|
120
|
+
: ''}`, style: { width: header.width || 'auto' } }, renderCellContent(row.subItem?.cells[header.id], header.id)))),
|
|
121
|
+
showDeleteButton && (react_1.default.createElement("div", { className: "w-12 p-4 flex justify-center" },
|
|
122
|
+
react_1.default.createElement("button", { onClick: (e) => handleDeleteSubItem(row.id, row.subItem?.id ?? '', e), className: "text-red-500 hover:text-red-600 transition-colors duration-150 transform hover:scale-110 focus:outline-none", "aria-label": "Delete sub-item" }, react_1.default.isValidElement(icons.deleteIcon)
|
|
123
|
+
? icons.deleteIcon
|
|
124
|
+
: null)))))))))))),
|
|
125
|
+
provided.placeholder)))))));
|
|
126
|
+
}
|
|
@@ -94,7 +94,7 @@ const TableHeader = ({ columns, sortIcon, hasChildren, hasSelect = false, onClic
|
|
|
94
94
|
flex: hasDefinedWidth ? '0 0 auto' : '1 1 0',
|
|
95
95
|
};
|
|
96
96
|
return (react_1.default.createElement("div", { key: item.id, className: "h-8 select-none px-4 text-xs font-medium text-text-color-primary text-opacity-80", style: columnStyle },
|
|
97
|
-
react_1.default.createElement("div", { className: "flex h-full w-full", style: item.inlineCss },
|
|
97
|
+
react_1.default.createElement("div", { className: "flex h-full w-full ", style: item.inlineCss },
|
|
98
98
|
item.hasFilter && (react_1.default.createElement("div", { ref: filterIconRef, onClick: (event) => item.hasFilter && handleFilterIconClick(event, item.id), className: `group ml-1 transition-all duration-300 ease-in-out ${item.hasFilter ? 'cursor-pointer opacity-100 hover:scale-105' : 'opacity-0'}` },
|
|
99
99
|
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" },
|
|
100
100
|
react_1.default.createElement("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3.75 6.75h16.5M6.75 12h10.5M8.75 17.25h6.5" })))),
|
|
@@ -16,6 +16,7 @@ interface TableRowDivProps {
|
|
|
16
16
|
content: string;
|
|
17
17
|
type: 'text' | 'date' | 'status' | 'price' | 'image' | 'operation';
|
|
18
18
|
statusClass?: 'danger' | 'success' | 'warning' | 'info' | 'primary' | 'secondary';
|
|
19
|
+
statusCode?: number;
|
|
19
20
|
inlineCss?: {
|
|
20
21
|
width?: string | number;
|
|
21
22
|
[key: string]: any;
|
|
@@ -14,11 +14,12 @@ interface BoundedProps {
|
|
|
14
14
|
padding?: string;
|
|
15
15
|
height?: string;
|
|
16
16
|
};
|
|
17
|
+
className?: string;
|
|
17
18
|
}
|
|
18
19
|
declare const Bounded: {
|
|
19
|
-
({ children, tagName: Tag, tailwindStyle }: BoundedProps): React.JSX.Element;
|
|
20
|
-
Body({ children, bodyStyle }: SectionProps): React.JSX.Element;
|
|
21
|
-
Aside({ children }: SectionProps): React.JSX.Element;
|
|
20
|
+
({ children, tagName: Tag, tailwindStyle, className, }: BoundedProps): React.JSX.Element;
|
|
21
|
+
Body({ children, bodyStyle, className }: SectionProps): React.JSX.Element;
|
|
22
|
+
Aside({ children, className }: SectionProps): React.JSX.Element;
|
|
22
23
|
};
|
|
23
24
|
interface SectionProps {
|
|
24
25
|
children: React.ReactNode;
|
|
@@ -26,5 +27,6 @@ interface SectionProps {
|
|
|
26
27
|
padding?: string;
|
|
27
28
|
height?: string;
|
|
28
29
|
};
|
|
30
|
+
className?: string;
|
|
29
31
|
}
|
|
30
32
|
export default Bounded;
|
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const Bounded = ({ children, tagName: Tag, tailwindStyle }) => {
|
|
9
|
-
return (react_1.default.createElement(Tag, { className: `absolute left-3 top-0 overflow-x-auto w-[
|
|
8
|
+
const Bounded = ({ children, tagName: Tag, tailwindStyle, className = '', }) => {
|
|
9
|
+
return (react_1.default.createElement(Tag, { className: `absolute left-3 top-0 overflow-x-auto w-[96%] xl:w-full flex flex-col xl:flex-row gap-5 pb-7 lg:gap-3 ${tailwindStyle?.height !== undefined ? tailwindStyle.height : 'h-auto'} ${className}` }, children));
|
|
10
10
|
};
|
|
11
|
-
Bounded.Body = ({ children, bodyStyle }) => {
|
|
12
|
-
return (react_1.default.createElement("div", { className: `flex-1
|
|
11
|
+
Bounded.Body = ({ children, bodyStyle, className = '' }) => {
|
|
12
|
+
return (react_1.default.createElement("div", { className: `flex-1 ${bodyStyle?.height !== undefined ? bodyStyle.height : 'h-auto'} bg-white-color rounded-xl BoundedShadow overflow-y-hidden ${bodyStyle?.padding || ''} ${className}` }, children));
|
|
13
13
|
};
|
|
14
|
-
Bounded.Aside = ({ children }) => {
|
|
15
|
-
return react_1.default.createElement("div", { className:
|
|
14
|
+
Bounded.Aside = ({ children, className = '' }) => {
|
|
15
|
+
return react_1.default.createElement("div", { className: `bg-inherit ${className}` }, children);
|
|
16
16
|
};
|
|
17
17
|
exports.default = Bounded;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* ModernTableBounded component that renders its children inside a dynamic tag element with specified styling.
|
|
4
|
+
* It allows customization of the wrapper element via the `tagName` prop.
|
|
5
|
+
*
|
|
6
|
+
* @param {React.ReactNode} children - The content to be rendered inside the bounded container.
|
|
7
|
+
* @param {React.ElementType} tagName - The tag name (element type) to render, e.g., 'div', 'section', etc.
|
|
8
|
+
* @param {boolean} isOpenSideBar - A boolean flag indicating whether the sidebar is open or not.
|
|
9
|
+
*/
|
|
10
|
+
interface ModernTableBoundedProps {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
tagName: React.ElementType;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const ModernTableBounded: {
|
|
16
|
+
({ children, tagName: Tag, className, }: ModernTableBoundedProps): React.JSX.Element;
|
|
17
|
+
Filter({ children, className }: SectionProps): React.JSX.Element;
|
|
18
|
+
Body({ children, className }: SectionProps): React.JSX.Element;
|
|
19
|
+
Content({ children, className }: SectionProps): React.JSX.Element;
|
|
20
|
+
Footer({ children, className }: SectionProps): React.JSX.Element;
|
|
21
|
+
};
|
|
22
|
+
interface SectionProps {
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
className?: string;
|
|
25
|
+
}
|
|
26
|
+
export default ModernTableBounded;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const ModernTableBounded = ({ children, tagName: Tag, className = '', }) => {
|
|
9
|
+
return (react_1.default.createElement(Tag, { className: `relative w-[97%] max-xl:mr-[28px] mr-0 overflow-x-auto flex flex-col gap-5 p-[16px] lg:p-0 rounded-lg shadow-md ${className} ` }, children));
|
|
10
|
+
};
|
|
11
|
+
ModernTableBounded.Filter = ({ children, className }) => {
|
|
12
|
+
return react_1.default.createElement("div", { className: `flex gap-4 px-3 py-2 ${className}` }, children);
|
|
13
|
+
};
|
|
14
|
+
ModernTableBounded.Body = ({ children, className }) => {
|
|
15
|
+
return react_1.default.createElement("div", { className: `flex-1 bg-white overflow-y-hidden ${className}` }, children);
|
|
16
|
+
};
|
|
17
|
+
ModernTableBounded.Content = ({ children, className }) => {
|
|
18
|
+
return react_1.default.createElement("div", { className: `${className}` }, children);
|
|
19
|
+
};
|
|
20
|
+
ModernTableBounded.Footer = ({ children, className }) => {
|
|
21
|
+
return react_1.default.createElement("div", { className: `${className}` }, children);
|
|
22
|
+
};
|
|
23
|
+
exports.default = ModernTableBounded;
|
|
@@ -6,6 +6,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const TableBodyBoundedDiv = ({ children, inlineCSS, }) => {
|
|
9
|
-
return (react_1.default.createElement("div", { style: inlineCSS || {}, className: " w-full flex-col gap-
|
|
9
|
+
return (react_1.default.createElement("div", { style: inlineCSS || {}, className: " w-full flex-col gap-3 grid grid-cols-1 sm:grid-cols-2 lg:flex" }, children));
|
|
10
10
|
};
|
|
11
11
|
exports.default = TableBodyBoundedDiv;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const TableBoundedDiv: ({ children, inlineCSS }: {
|
|
2
|
+
declare const TableBoundedDiv: ({ children, inlineCSS, }: {
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
-
inlineCSS?:
|
|
4
|
+
inlineCSS?: object;
|
|
5
5
|
}) => React.JSX.Element;
|
|
6
6
|
export default TableBoundedDiv;
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
};
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const TableBoundedDiv = ({ children, inlineCSS }) => {
|
|
9
|
-
return (react_1.default.createElement("div", { style: inlineCSS || {}, className:
|
|
8
|
+
const TableBoundedDiv = ({ children, inlineCSS, }) => {
|
|
9
|
+
return (react_1.default.createElement("div", { style: inlineCSS || {}, className: "w-full overflow-y-hidden rounded-lg " }, children));
|
|
10
10
|
};
|
|
11
11
|
exports.default = TableBoundedDiv;
|