pixelize-design-library 1.0.99 → 1.1.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/dist/Components/DatePicker/DatePicker.js +6 -2
- package/dist/Components/Dropdown/DropDown.js +1 -1
- package/dist/Components/KaTable/CustomHeader.d.ts +3 -0
- package/dist/Components/KaTable/CustomHeader.js +519 -0
- package/dist/Components/KaTable/KaTable.d.ts +11 -7
- package/dist/Components/KaTable/KaTable.js +187 -4
- package/dist/Components/KaTable/KaTableProps.d.ts +7 -1
- package/dist/Layout.js +469 -639
- package/dist/Theme/Default/fonts.d.ts +35 -0
- package/dist/Theme/Default/fonts.js +37 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -2
- package/package.json +2 -2
- package/webpack.config.js +1 -1
|
@@ -17,7 +17,11 @@ var ErrorMessage_1 = __importDefault(require("../Common/ErrorMessage"));
|
|
|
17
17
|
var HelperText_1 = __importDefault(require("../Common/HelperText"));
|
|
18
18
|
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
19
19
|
var DatePickerContainer = styled_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n border-radius: 5px;\n font-family: Arial, sans-serif;\n font-size: 16px;\n color: #333;\n .react-datepicker-wrapper {\n width: 100%;\n }\n .react-datepicker__input-container input {\n width: 100%;\n padding: 8px;\n border: none;\n border-radius: 5px;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);\n }\n .react-datepicker__input-container input:focus {\n outline: none;\n box-shadow: 0 0 5px rgb(49 130 206);\n }\n .react-datepicker__day--selected {\n background-color: ", " !important;\n color: white !important;\n }\n .react-datepicker__day--keyboard-selected {\n background-color: #66bb6a !important;\n color: white !important;\n }\n"], ["\n border-radius: 5px;\n font-family: Arial, sans-serif;\n font-size: 16px;\n color: #333;\n .react-datepicker-wrapper {\n width: 100%;\n }\n .react-datepicker__input-container input {\n width: 100%;\n padding: 8px;\n border: none;\n border-radius: 5px;\n box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);\n }\n .react-datepicker__input-container input:focus {\n outline: none;\n box-shadow: 0 0 5px rgb(49 130 206);\n }\n .react-datepicker__day--selected {\n background-color: ", " !important;\n color: white !important;\n }\n .react-datepicker__day--keyboard-selected {\n background-color: #66bb6a !important;\n color: white !important;\n }\n"])), function (props) { return props.theme.colors.primary[500]; });
|
|
20
|
-
|
|
20
|
+
// const Label = styled.label`
|
|
21
|
+
// display: block;
|
|
22
|
+
// margin-bottom: 5px;
|
|
23
|
+
// font-weight: bold;
|
|
24
|
+
// `;
|
|
21
25
|
function DatePicker(_a) {
|
|
22
26
|
var selectedDate = _a.selectedDate, onChange = _a.onChange, _b = _a.placeholderText, placeholderText = _b === void 0 ? "Select a date" : _b, _c = _a.dateFormat, dateFormat = _c === void 0 ? "MM/dd/yyyy" : _c, _d = _a.showTimeSelect, showTimeSelect = _d === void 0 ? false : _d, _e = _a.timeFormat, timeFormat = _e === void 0 ? "HH:mm aa" : _e, _f = _a.timeIntervals, timeIntervals = _f === void 0 ? 30 : _f, _g = _a.timeCaption, timeCaption = _g === void 0 ? "Time" : _g, dateTimeFormat = _a.dateTimeFormat, id = _a.id, name = _a.name, label = _a.label, _h = _a.isRequired, isRequired = _h === void 0 ? false : _h, _j = _a.isInformation, isInformation = _j === void 0 ? false : _j, _k = _a.informationMessage, informationMessage = _k === void 0 ? "" : _k, _l = _a.error, error = _l === void 0 ? false : _l, _m = _a.errorMessage, errorMessage = _m === void 0 ? "" : _m, _o = _a.helperText, helperText = _o === void 0 ? "" : _o;
|
|
23
27
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
@@ -33,4 +37,4 @@ function DatePicker(_a) {
|
|
|
33
37
|
helperText && !error && react_1.default.createElement(HelperText_1.default, { helperText: helperText })));
|
|
34
38
|
}
|
|
35
39
|
exports.default = DatePicker;
|
|
36
|
-
var templateObject_1
|
|
40
|
+
var templateObject_1;
|
|
@@ -79,7 +79,7 @@ var Dropdown = (0, react_1.forwardRef)(function (_a, ref) {
|
|
|
79
79
|
(option === null || option === void 0 ? void 0 : option.image) && (react_1.default.createElement(react_2.Icon, { as: option.image, boxSize: "1.5rem", mr: 2, style: ImageStyle })),
|
|
80
80
|
react_1.default.createElement(react_2.Box, { as: "span", isTruncated: true, style: LabelStyle }, option.label))); })));
|
|
81
81
|
};
|
|
82
|
-
return (react_1.default.createElement(react_2.Box, { ref: dropdownRef, position: "relative", display: "inline-block"
|
|
82
|
+
return (react_1.default.createElement(react_2.Box, { ref: dropdownRef, position: "relative", display: "inline-block" },
|
|
83
83
|
dropDownToggleOption(),
|
|
84
84
|
isOpen && (react_1.default.createElement(MotionBox, { ref: ref, position: "absolute", zIndex: 5, initial: { opacity: 0, y: -10 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -10 }, style: headStyle }, DropdownContentRender()))));
|
|
85
85
|
});
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
var react_1 = __importStar(require("react"));
|
|
27
|
+
var react_2 = require("@chakra-ui/react");
|
|
28
|
+
var bs_1 = require("react-icons/bs");
|
|
29
|
+
var fa_1 = require("react-icons/fa");
|
|
30
|
+
var fi_1 = require("react-icons/fi");
|
|
31
|
+
var CustomHeader = function (_a) {
|
|
32
|
+
var column = _a.column, onSortChange = _a.onSortChange, onMenuItemClick = _a.onMenuItemClick, menuItems = _a.menuItems;
|
|
33
|
+
var _b = (0, react_1.useState)(false), isSubmenuOpen = _b[0], setSubmenuOpen = _b[1];
|
|
34
|
+
var _c = (0, react_1.useState)(null), submenuPosition = _c[0], setSubmenuPosition = _c[1];
|
|
35
|
+
var _d = (0, react_2.useDisclosure)(), isOpen = _d.isOpen, onOpen = _d.onOpen, onClose = _d.onClose;
|
|
36
|
+
var filterButtonRef = (0, react_1.useRef)(null);
|
|
37
|
+
var handleSubmenuToggle = function (e) {
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
setSubmenuOpen(function (prev) { return !prev; });
|
|
40
|
+
if (filterButtonRef.current) {
|
|
41
|
+
var rect = filterButtonRef.current.getBoundingClientRect();
|
|
42
|
+
setSubmenuPosition({
|
|
43
|
+
top: rect.bottom -
|
|
44
|
+
((rect.bottom - rect.top) * (rect.bottom - 35)) /
|
|
45
|
+
(rect.bottom - rect.top),
|
|
46
|
+
left: rect.x - (rect.x - 220) * (rect.width / rect.width),
|
|
47
|
+
});
|
|
48
|
+
// setSubmenuPosition({
|
|
49
|
+
// top: rect.bottom,
|
|
50
|
+
// left: rect.right,
|
|
51
|
+
// });
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var handleMenuItemClick = function (action) {
|
|
55
|
+
if (onMenuItemClick) {
|
|
56
|
+
onMenuItemClick(action, column.title);
|
|
57
|
+
}
|
|
58
|
+
setSubmenuOpen(false);
|
|
59
|
+
};
|
|
60
|
+
var _e = (0, react_1.useState)("none"), sortState = _e[0], setSortState = _e[1];
|
|
61
|
+
var handleSortClick = function () {
|
|
62
|
+
setSortState(function (prevState) {
|
|
63
|
+
var newState = prevState === "none" ? "asc" : prevState === "asc" ? "desc" : "none";
|
|
64
|
+
if (onSortChange) {
|
|
65
|
+
onSortChange(newState, column.title);
|
|
66
|
+
}
|
|
67
|
+
return newState;
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
return (react_1.default.createElement("div", { onMouseEnter: onOpen, onMouseLeave: onClose },
|
|
71
|
+
react_1.default.createElement(react_2.Box, { style: {
|
|
72
|
+
display: "flex",
|
|
73
|
+
justifyContent: "space-between",
|
|
74
|
+
alignItems: "center",
|
|
75
|
+
} },
|
|
76
|
+
react_1.default.createElement(react_2.Box, { sx: { fontWeight: "bold" } }, column.title),
|
|
77
|
+
react_1.default.createElement(react_2.Box, { style: {
|
|
78
|
+
display: "flex",
|
|
79
|
+
justifyContent: "space-between",
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
} },
|
|
82
|
+
react_1.default.createElement(fi_1.FiInfo, null),
|
|
83
|
+
react_1.default.createElement(react_2.Menu, null,
|
|
84
|
+
isOpen && (react_1.default.createElement(react_2.MenuButton, { ref: filterButtonRef, as: react_2.IconButton, "aria-label": "More options", icon: react_1.default.createElement(bs_1.BsThreeDots, null), size: "sm", variant: "ghost", sx: {
|
|
85
|
+
_hover: {
|
|
86
|
+
background: "none",
|
|
87
|
+
},
|
|
88
|
+
_active: {
|
|
89
|
+
background: "none",
|
|
90
|
+
},
|
|
91
|
+
} })),
|
|
92
|
+
react_1.default.createElement(react_2.Portal, null,
|
|
93
|
+
react_1.default.createElement(react_2.MenuList, { sx: {
|
|
94
|
+
boxShadow: "0px 0px 20px 11px rgba(0, 0, 0, 0.1)",
|
|
95
|
+
borderRadius: "8px",
|
|
96
|
+
padding: "8px",
|
|
97
|
+
backgroundColor: "white",
|
|
98
|
+
}, onMouseLeave: onClose }, menuItems.map(function (item, index) { return (react_1.default.createElement(react_1.default.Fragment, { key: index },
|
|
99
|
+
item.submenu ? (react_1.default.createElement(react_2.MenuItem, { closeOnSelect: false, onClick: handleSubmenuToggle }, item.label)) : (react_1.default.createElement(react_2.MenuItem, { onClick: function () { return handleMenuItemClick(item.action); } }, item.label)),
|
|
100
|
+
isSubmenuOpen && item.submenu && submenuPosition && (react_1.default.createElement(react_2.Box, { position: "absolute", top: submenuPosition.top, left: submenuPosition.left, zIndex: 1, boxShadow: "0px 0px 20px 11px rgba(0, 0, 0, 0.1)", borderRadius: "8px", backgroundColor: "white", padding: "8px", width: "200px" },
|
|
101
|
+
react_1.default.createElement(react_2.MenuGroup, { onMouseLeave: onClose }, item.submenu.map(function (subItem, subIndex) { return (react_1.default.createElement(react_2.MenuItem, { key: subIndex, closeOnSelect: true, onClick: function () {
|
|
102
|
+
return handleMenuItemClick(subItem.action);
|
|
103
|
+
} }, subItem.label)); })))))); })))))),
|
|
104
|
+
react_1.default.createElement(react_2.Box, { sx: { position: "absolute", right: 20, top: 0 } }, isOpen && (react_1.default.createElement(react_2.Flex, { alignItems: "center" },
|
|
105
|
+
react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", backgroundColor: "white", padding: sortState === "asc" ? "1px" : "2px", borderRadius: "10px", flexDirection: "column", width: "20px", height: "20px", onClick: handleSortClick, cursor: "pointer", boxShadow: "0px 0px 20px 11px rgba(0, 0, 0, 0.1)", transition: "transform 0.2s ease-in-out", _hover: { transform: "scale(1.1)" } },
|
|
106
|
+
react_1.default.createElement(react_2.Box, { transition: "opacity 0.2s ease-in-out", opacity: sortState === "none" ? 1 : 0, position: "absolute" },
|
|
107
|
+
react_1.default.createElement(fa_1.FaSort, { color: "black", size: 16 })),
|
|
108
|
+
react_1.default.createElement(react_2.Box, { transition: "opacity 0.2s ease-in-out", opacity: sortState === "asc" ? 1 : 0, position: "absolute" },
|
|
109
|
+
react_1.default.createElement(fa_1.FaCaretUp, { color: "black", size: 16 })),
|
|
110
|
+
react_1.default.createElement(react_2.Box, { transition: "opacity 0.2s ease-in-out", opacity: sortState === "desc" ? 1 : 0, position: "absolute" },
|
|
111
|
+
react_1.default.createElement(fa_1.FaCaretDown, { color: "black", size: 16 }))))))));
|
|
112
|
+
};
|
|
113
|
+
exports.default = CustomHeader;
|
|
114
|
+
// import React, { useState, useRef } from "react";
|
|
115
|
+
// import {
|
|
116
|
+
// Box,
|
|
117
|
+
// IconButton,
|
|
118
|
+
// Menu,
|
|
119
|
+
// MenuButton,
|
|
120
|
+
// MenuList,
|
|
121
|
+
// MenuItem,
|
|
122
|
+
// Portal,
|
|
123
|
+
// MenuDivider,
|
|
124
|
+
// MenuGroup,
|
|
125
|
+
// Flex,
|
|
126
|
+
// useDisclosure,
|
|
127
|
+
// } from "@chakra-ui/react";
|
|
128
|
+
// import { BsThreeDots } from "react-icons/bs";
|
|
129
|
+
// import { FaCaretDown, FaCaretUp, FaSort } from "react-icons/fa";
|
|
130
|
+
// import { FiInfo } from "react-icons/fi";
|
|
131
|
+
// const CustomHeader = ({ column, onSortChange, onMenuItemClick,menuItems }: any) => {
|
|
132
|
+
// const [isSubmenuOpen, setSubmenuOpen] = useState(false);
|
|
133
|
+
// const [submenuPosition, setSubmenuPosition] = useState<{
|
|
134
|
+
// top: number;
|
|
135
|
+
// left: number;
|
|
136
|
+
// } | null>(null);
|
|
137
|
+
// const { isOpen, onOpen, onClose } = useDisclosure();
|
|
138
|
+
// const filterButtonRef = useRef<HTMLButtonElement | null>(null);
|
|
139
|
+
// const handleSubmenuToggle = (e: React.MouseEvent) => {
|
|
140
|
+
// e.stopPropagation();
|
|
141
|
+
// setSubmenuOpen((prev) => !prev);
|
|
142
|
+
// if (filterButtonRef.current) {
|
|
143
|
+
// const rect = filterButtonRef.current.getBoundingClientRect();
|
|
144
|
+
// setSubmenuPosition({
|
|
145
|
+
// top:
|
|
146
|
+
// rect.bottom -
|
|
147
|
+
// ((rect.bottom - rect.top) * (rect.bottom - 35)) /
|
|
148
|
+
// (rect.bottom - rect.top),
|
|
149
|
+
// left: rect.x - (rect.x - 320) * (rect.width / rect.width),
|
|
150
|
+
// });
|
|
151
|
+
// }
|
|
152
|
+
// };
|
|
153
|
+
// const handleMenuItemClick = (action: string) => {
|
|
154
|
+
// if (onMenuItemClick) {
|
|
155
|
+
// onMenuItemClick(action, column.title);
|
|
156
|
+
// }
|
|
157
|
+
// setSubmenuOpen(false);
|
|
158
|
+
// };
|
|
159
|
+
// const [sortState, setSortState] = useState<"none" | "asc" | "desc">("none");
|
|
160
|
+
// const handleSortClick = () => {
|
|
161
|
+
// setSortState((prevState) => {
|
|
162
|
+
// const newState =
|
|
163
|
+
// prevState === "none" ? "asc" : prevState === "asc" ? "desc" : "none";
|
|
164
|
+
// if (onSortChange) {
|
|
165
|
+
// onSortChange(newState, column.title);
|
|
166
|
+
// }
|
|
167
|
+
// return newState;
|
|
168
|
+
// });
|
|
169
|
+
// };
|
|
170
|
+
// return (
|
|
171
|
+
// <div onMouseEnter={onOpen} onMouseLeave={onClose}>
|
|
172
|
+
// <Box
|
|
173
|
+
// style={{
|
|
174
|
+
// display: "flex",
|
|
175
|
+
// justifyContent: "space-between",
|
|
176
|
+
// alignItems: "center",
|
|
177
|
+
// }}
|
|
178
|
+
// >
|
|
179
|
+
// <Box sx={{ fontWeight: "bold" }}>{column.title}</Box>
|
|
180
|
+
// <Box
|
|
181
|
+
// style={{
|
|
182
|
+
// display: "flex",
|
|
183
|
+
// justifyContent: "space-between",
|
|
184
|
+
// alignItems: "center",
|
|
185
|
+
// }}
|
|
186
|
+
// >
|
|
187
|
+
// <FiInfo />
|
|
188
|
+
// <Menu>
|
|
189
|
+
// {isOpen && (
|
|
190
|
+
// <MenuButton
|
|
191
|
+
// ref={filterButtonRef}
|
|
192
|
+
// as={IconButton}
|
|
193
|
+
// aria-label="More options"
|
|
194
|
+
// icon={<BsThreeDots />}
|
|
195
|
+
// size="sm"
|
|
196
|
+
// variant="ghost"
|
|
197
|
+
// sx={{
|
|
198
|
+
// _hover: {
|
|
199
|
+
// background: "none",
|
|
200
|
+
// },
|
|
201
|
+
// _active: {
|
|
202
|
+
// background: "none",
|
|
203
|
+
// },
|
|
204
|
+
// }}
|
|
205
|
+
// />
|
|
206
|
+
// )}
|
|
207
|
+
// <Portal>
|
|
208
|
+
// <MenuList
|
|
209
|
+
// sx={{
|
|
210
|
+
// boxShadow: "0px 0px 20px 11px rgba(0, 0, 0, 0.1)",
|
|
211
|
+
// borderRadius: "8px",
|
|
212
|
+
// padding: "8px",
|
|
213
|
+
// backgroundColor: "white",
|
|
214
|
+
// }}
|
|
215
|
+
// onMouseLeave={onClose}
|
|
216
|
+
// >
|
|
217
|
+
// <MenuItem onClick={() => handleMenuItemClick("Sort")}>
|
|
218
|
+
// Sort
|
|
219
|
+
// </MenuItem>
|
|
220
|
+
// <MenuItem onClick={() => handleMenuItemClick("Hide column")}>
|
|
221
|
+
// Hide column
|
|
222
|
+
// </MenuItem>
|
|
223
|
+
// {/* Main menu item with submenu toggle */}
|
|
224
|
+
// <MenuItem closeOnSelect={false} onClick={handleSubmenuToggle}>
|
|
225
|
+
// Filter
|
|
226
|
+
// </MenuItem>
|
|
227
|
+
// {/* Submenu */}
|
|
228
|
+
// {isSubmenuOpen && submenuPosition && (
|
|
229
|
+
// <Box
|
|
230
|
+
// position="absolute"
|
|
231
|
+
// top={submenuPosition.top}
|
|
232
|
+
// left={submenuPosition.left}
|
|
233
|
+
// transform="translateX(-50%)"
|
|
234
|
+
// zIndex={1}
|
|
235
|
+
// boxShadow="0px 0px 20px 11px rgba(0, 0, 0, 0.1)"
|
|
236
|
+
// borderRadius="8px"
|
|
237
|
+
// backgroundColor="white"
|
|
238
|
+
// padding="8px"
|
|
239
|
+
// width={"200px"} // Set a fixed width or adjust as needed
|
|
240
|
+
// >
|
|
241
|
+
// <MenuGroup onMouseLeave={onClose}>
|
|
242
|
+
// <MenuItem
|
|
243
|
+
// closeOnSelect={true}
|
|
244
|
+
// onClick={() => handleMenuItemClick("Filter by Date")}
|
|
245
|
+
// >
|
|
246
|
+
// Filter by Date
|
|
247
|
+
// </MenuItem>
|
|
248
|
+
// <MenuItem
|
|
249
|
+
// closeOnSelect={true}
|
|
250
|
+
// onClick={() => handleMenuItemClick("Filter by Name")}
|
|
251
|
+
// >
|
|
252
|
+
// Filter by Name
|
|
253
|
+
// </MenuItem>
|
|
254
|
+
// <MenuItem
|
|
255
|
+
// closeOnSelect={true}
|
|
256
|
+
// onClick={() => handleMenuItemClick("Filter by Status")}
|
|
257
|
+
// >
|
|
258
|
+
// Filter by Status
|
|
259
|
+
// </MenuItem>
|
|
260
|
+
// </MenuGroup>
|
|
261
|
+
// </Box>
|
|
262
|
+
// )}
|
|
263
|
+
// <MenuDivider />
|
|
264
|
+
// <MenuItem onClick={() => handleMenuItemClick("Other Options")}>
|
|
265
|
+
// Other Options
|
|
266
|
+
// </MenuItem>
|
|
267
|
+
// </MenuList>
|
|
268
|
+
// </Portal>
|
|
269
|
+
// </Menu>
|
|
270
|
+
// </Box>
|
|
271
|
+
// </Box>
|
|
272
|
+
// <Box sx={{ position: "absolute", right: 20, top: 0 }}>
|
|
273
|
+
// {isOpen && (
|
|
274
|
+
// <Flex alignItems="center">
|
|
275
|
+
// <Box
|
|
276
|
+
// display="flex"
|
|
277
|
+
// alignItems="center"
|
|
278
|
+
// backgroundColor="white"
|
|
279
|
+
// padding={sortState === "asc" ? "1px" : "2px"}
|
|
280
|
+
// borderRadius="10px"
|
|
281
|
+
// flexDirection={"column"}
|
|
282
|
+
// width={"20px"}
|
|
283
|
+
// height={"20px"}
|
|
284
|
+
// onClick={handleSortClick}
|
|
285
|
+
// cursor="pointer"
|
|
286
|
+
// boxShadow="0px 0px 20px 11px rgba(0, 0, 0, 0.1)"
|
|
287
|
+
// transition="transform 0.2s ease-in-out"
|
|
288
|
+
// _hover={{ transform: "scale(1.1)" }}
|
|
289
|
+
// >
|
|
290
|
+
// <Box
|
|
291
|
+
// transition="opacity 0.2s ease-in-out"
|
|
292
|
+
// opacity={sortState === "none" ? 1 : 0}
|
|
293
|
+
// position="absolute"
|
|
294
|
+
// >
|
|
295
|
+
// <FaSort color="black" size={16} />
|
|
296
|
+
// </Box>
|
|
297
|
+
// <Box
|
|
298
|
+
// transition="opacity 0.2s ease-in-out"
|
|
299
|
+
// opacity={sortState === "asc" ? 1 : 0}
|
|
300
|
+
// position="absolute"
|
|
301
|
+
// >
|
|
302
|
+
// <FaCaretUp color="black" size={16} />
|
|
303
|
+
// </Box>
|
|
304
|
+
// <Box
|
|
305
|
+
// transition="opacity 0.2s ease-in-out"
|
|
306
|
+
// opacity={sortState === "desc" ? 1 : 0}
|
|
307
|
+
// position="absolute"
|
|
308
|
+
// >
|
|
309
|
+
// <FaCaretDown color="black" size={16} />
|
|
310
|
+
// </Box>
|
|
311
|
+
// </Box>
|
|
312
|
+
// </Flex>
|
|
313
|
+
// )}
|
|
314
|
+
// </Box>
|
|
315
|
+
// </div>
|
|
316
|
+
// );
|
|
317
|
+
// };
|
|
318
|
+
// export default CustomHeader;
|
|
319
|
+
// import React, { useState, useRef } from "react";
|
|
320
|
+
// import {
|
|
321
|
+
// Box,
|
|
322
|
+
// IconButton,
|
|
323
|
+
// Menu,
|
|
324
|
+
// MenuButton,
|
|
325
|
+
// MenuList,
|
|
326
|
+
// MenuItem,
|
|
327
|
+
// Portal,
|
|
328
|
+
// MenuDivider,
|
|
329
|
+
// MenuGroup,
|
|
330
|
+
// Flex,
|
|
331
|
+
// useDisclosure,
|
|
332
|
+
// } from "@chakra-ui/react";
|
|
333
|
+
// import { BsThreeDots } from "react-icons/bs";
|
|
334
|
+
// import { FaCaretDown, FaCaretUp, FaSort } from "react-icons/fa";
|
|
335
|
+
// import { FiInfo } from "react-icons/fi";
|
|
336
|
+
// const CustomHeader = ({ column }: any) => {
|
|
337
|
+
// const [isSubmenuOpen, setSubmenuOpen] = useState(false);
|
|
338
|
+
// const [submenuPosition, setSubmenuPosition] = useState<{
|
|
339
|
+
// top: number;
|
|
340
|
+
// left: number;
|
|
341
|
+
// } | null>(null);
|
|
342
|
+
// const { isOpen, onOpen, onClose } = useDisclosure();
|
|
343
|
+
// const filterButtonRef = useRef<HTMLButtonElement | null>(null);
|
|
344
|
+
// const handleSubmenuToggle = (e: React.MouseEvent) => {
|
|
345
|
+
// e.stopPropagation();
|
|
346
|
+
// setSubmenuOpen((prev) => !prev);
|
|
347
|
+
// if (filterButtonRef.current) {
|
|
348
|
+
// const rect = filterButtonRef.current.getBoundingClientRect();
|
|
349
|
+
// console.log(rect);
|
|
350
|
+
// setSubmenuPosition({
|
|
351
|
+
// top:
|
|
352
|
+
// rect.bottom -
|
|
353
|
+
// ((rect.bottom - rect.top) * (rect.bottom - 35)) /
|
|
354
|
+
// (rect.bottom - rect.top),
|
|
355
|
+
// left: rect.x - (rect.x - 320) * (rect.width / rect.width),
|
|
356
|
+
// });
|
|
357
|
+
// }
|
|
358
|
+
// };
|
|
359
|
+
// const handleMenuItemClick = (action: string) => {
|
|
360
|
+
// console.log(action, "menuitem");
|
|
361
|
+
// setSubmenuOpen(false);
|
|
362
|
+
// };
|
|
363
|
+
// const [sortState, setSortState] = useState<"none" | "asc" | "desc">("none");
|
|
364
|
+
// const handleSortClick = () => {
|
|
365
|
+
// setSortState((prevState) => {
|
|
366
|
+
// if (prevState === "none") return "asc";
|
|
367
|
+
// if (prevState === "asc") return "desc";
|
|
368
|
+
// return "none";
|
|
369
|
+
// });
|
|
370
|
+
// };
|
|
371
|
+
// return (
|
|
372
|
+
// <div onMouseEnter={onOpen} onMouseLeave={onClose}>
|
|
373
|
+
// <Box
|
|
374
|
+
// style={{
|
|
375
|
+
// display: "flex",
|
|
376
|
+
// justifyContent: "space-between",
|
|
377
|
+
// alignItems: "center",
|
|
378
|
+
// }}
|
|
379
|
+
// >
|
|
380
|
+
// <Box sx={{ fontWeight: "bold" }}>{column.title}</Box>
|
|
381
|
+
// <Box
|
|
382
|
+
// style={{
|
|
383
|
+
// display: "flex",
|
|
384
|
+
// justifyContent: "space-between",
|
|
385
|
+
// alignItems: "center",
|
|
386
|
+
// }}
|
|
387
|
+
// >
|
|
388
|
+
// <FiInfo />
|
|
389
|
+
// <Menu>
|
|
390
|
+
// {isOpen && (
|
|
391
|
+
// <MenuButton
|
|
392
|
+
// ref={filterButtonRef}
|
|
393
|
+
// as={IconButton}
|
|
394
|
+
// aria-label="More options"
|
|
395
|
+
// icon={<BsThreeDots />}
|
|
396
|
+
// size="sm"
|
|
397
|
+
// variant="ghost"
|
|
398
|
+
// sx={{
|
|
399
|
+
// _hover: {
|
|
400
|
+
// background: "none",
|
|
401
|
+
// },
|
|
402
|
+
// _active: {
|
|
403
|
+
// background: "none",
|
|
404
|
+
// },
|
|
405
|
+
// }}
|
|
406
|
+
// />
|
|
407
|
+
// )}
|
|
408
|
+
// <Portal>
|
|
409
|
+
// <MenuList
|
|
410
|
+
// sx={{
|
|
411
|
+
// boxShadow: "0px 0px 20px 11px rgba(0, 0, 0, 0.1)",
|
|
412
|
+
// borderRadius: "8px",
|
|
413
|
+
// padding: "8px",
|
|
414
|
+
// backgroundColor: "white",
|
|
415
|
+
// }}
|
|
416
|
+
// onMouseLeave={onClose}
|
|
417
|
+
// >
|
|
418
|
+
// <MenuItem onClick={() => handleMenuItemClick("Sort")}>
|
|
419
|
+
// Sort
|
|
420
|
+
// </MenuItem>
|
|
421
|
+
// <MenuItem onClick={() => handleMenuItemClick("Hide column")}>
|
|
422
|
+
// Hide column
|
|
423
|
+
// </MenuItem>
|
|
424
|
+
// {/* Main menu item with submenu toggle */}
|
|
425
|
+
// <MenuItem closeOnSelect={false} onClick={handleSubmenuToggle}>
|
|
426
|
+
// Filter
|
|
427
|
+
// </MenuItem>
|
|
428
|
+
// {/* Submenu */}
|
|
429
|
+
// {isSubmenuOpen && submenuPosition && (
|
|
430
|
+
// <Box
|
|
431
|
+
// position="absolute"
|
|
432
|
+
// top={submenuPosition.top}
|
|
433
|
+
// left={submenuPosition.left}
|
|
434
|
+
// transform="translateX(-50%)"
|
|
435
|
+
// zIndex={1}
|
|
436
|
+
// boxShadow="0px 0px 20px 11px rgba(0, 0, 0, 0.1)"
|
|
437
|
+
// borderRadius="8px"
|
|
438
|
+
// backgroundColor="white"
|
|
439
|
+
// padding="8px"
|
|
440
|
+
// width={"200px"} // Set a fixed width or adjust as needed
|
|
441
|
+
// >
|
|
442
|
+
// <MenuGroup onMouseLeave={onClose}>
|
|
443
|
+
// <MenuItem
|
|
444
|
+
// closeOnSelect={true}
|
|
445
|
+
// onClick={() => handleMenuItemClick("Filter by Date")}
|
|
446
|
+
// >
|
|
447
|
+
// Filter by Date
|
|
448
|
+
// </MenuItem>
|
|
449
|
+
// <MenuItem
|
|
450
|
+
// closeOnSelect={true}
|
|
451
|
+
// onClick={() => handleMenuItemClick("Filter by Name")}
|
|
452
|
+
// >
|
|
453
|
+
// Filter by Name
|
|
454
|
+
// </MenuItem>
|
|
455
|
+
// <MenuItem
|
|
456
|
+
// closeOnSelect={true}
|
|
457
|
+
// onClick={() => handleMenuItemClick("Filter by Status")}
|
|
458
|
+
// >
|
|
459
|
+
// Filter by Status
|
|
460
|
+
// </MenuItem>
|
|
461
|
+
// </MenuGroup>
|
|
462
|
+
// </Box>
|
|
463
|
+
// )}
|
|
464
|
+
// <MenuDivider />
|
|
465
|
+
// <MenuItem onClick={() => handleMenuItemClick("Other Options")}>
|
|
466
|
+
// Other Options
|
|
467
|
+
// </MenuItem>
|
|
468
|
+
// </MenuList>
|
|
469
|
+
// </Portal>
|
|
470
|
+
// </Menu>
|
|
471
|
+
// </Box>
|
|
472
|
+
// </Box>
|
|
473
|
+
// <Box sx={{ position: "absolute", right: 20, top: 0 }}>
|
|
474
|
+
// {isOpen && (
|
|
475
|
+
// <Flex alignItems="center">
|
|
476
|
+
// <Box
|
|
477
|
+
// display="flex"
|
|
478
|
+
// alignItems="center"
|
|
479
|
+
// backgroundColor="white"
|
|
480
|
+
// padding={sortState === "asc" ? "1px" : "2px"}
|
|
481
|
+
// borderRadius="10px"
|
|
482
|
+
// flexDirection={"column"}
|
|
483
|
+
// width={"20px"}
|
|
484
|
+
// height={"20px"}
|
|
485
|
+
// onClick={handleSortClick}
|
|
486
|
+
// cursor="pointer"
|
|
487
|
+
// boxShadow="0px 0px 20px 11px rgba(0, 0, 0, 0.1)"
|
|
488
|
+
// transition="transform 0.2s ease-in-out"
|
|
489
|
+
// _hover={{ transform: "scale(1.1)" }}
|
|
490
|
+
// >
|
|
491
|
+
// <Box
|
|
492
|
+
// transition="opacity 0.2s ease-in-out"
|
|
493
|
+
// opacity={sortState === "none" ? 1 : 0}
|
|
494
|
+
// position="absolute"
|
|
495
|
+
// >
|
|
496
|
+
// <FaSort color="black" size={16} />
|
|
497
|
+
// </Box>
|
|
498
|
+
// <Box
|
|
499
|
+
// transition="opacity 0.2s ease-in-out"
|
|
500
|
+
// opacity={sortState === "asc" ? 1 : 0}
|
|
501
|
+
// position="absolute"
|
|
502
|
+
// >
|
|
503
|
+
// <FaCaretUp color="black" size={16} />
|
|
504
|
+
// </Box>
|
|
505
|
+
// <Box
|
|
506
|
+
// transition="opacity 0.2s ease-in-out"
|
|
507
|
+
// opacity={sortState === "desc" ? 1 : 0}
|
|
508
|
+
// position="absolute"
|
|
509
|
+
// >
|
|
510
|
+
// <FaCaretDown color="black" size={16} />
|
|
511
|
+
// </Box>
|
|
512
|
+
// </Box>
|
|
513
|
+
// </Flex>
|
|
514
|
+
// )}
|
|
515
|
+
// </Box>
|
|
516
|
+
// </div>
|
|
517
|
+
// );
|
|
518
|
+
// };
|
|
519
|
+
// export default CustomHeader;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { KaTableProps } from
|
|
3
|
-
import * as TableEnums from
|
|
4
|
-
import * as TableProps from
|
|
5
|
-
import * as TableActionCreator from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { KaTableProps } from "./KaTableProps";
|
|
3
|
+
import * as TableEnums from "ka-table/enums";
|
|
4
|
+
import * as TableProps from "ka-table/props";
|
|
5
|
+
import * as TableActionCreator from "ka-table/actionCreators";
|
|
6
|
+
import * as TableModel from "ka-table/models";
|
|
7
|
+
import * as TableUtils from "ka-table/utils";
|
|
8
|
+
import * as TableFun from "ka-table";
|
|
6
9
|
import "ka-table/style.css";
|
|
7
|
-
|
|
10
|
+
import "./ka-table.css";
|
|
11
|
+
declare const KaTable: ({ columns, data, rowKey, Edit, sorting, format, paging, filter, childComponents, columnReorder, columnResizing, editableCells, validation, loading, checkSelect, onRowClick, onSelectionChange, onSortChange, onMenuItemClick, menuItems, }: KaTableProps) => React.JSX.Element;
|
|
8
12
|
export default KaTable;
|
|
9
|
-
export { TableEnums, TableActionCreator, TableProps };
|
|
13
|
+
export { TableEnums, TableActionCreator, TableProps, TableModel, TableUtils, TableFun, };
|