pixelize-design-library 1.1.93 → 1.1.94
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/Button/Button.d.ts +1 -1
- package/dist/Components/Button/Button.js +4 -4
- package/dist/Components/Button/ButtonProps.d.ts +1 -0
- package/dist/Components/Common/ErrorMessage.js +5 -1
- package/dist/Components/Common/FormLabel.js +2 -6
- package/dist/Components/Input/TextInput.d.ts +1 -1
- package/dist/Components/Input/TextInput.js +11 -12
- package/dist/Components/Input/TextInputProps.d.ts +3 -4
- package/dist/Components/KaTable/CustomHeader.d.ts +14 -0
- package/dist/Components/KaTable/CustomHeader.js +69 -0
- package/dist/Components/KaTable/KaTable.d.ts +13 -0
- package/dist/Components/KaTable/KaTable.js +111 -0
- package/dist/Components/KaTable/KaTableProps.d.ts +23 -0
- package/dist/Components/KaTable/KaTableProps.js +2 -0
- package/dist/Components/KaTable/SelectionCell.d.ts +8 -0
- package/dist/Components/KaTable/SelectionCell.js +38 -0
- package/dist/Components/KaTable/SelectionHeader.d.ts +3 -0
- package/dist/Components/KaTable/SelectionHeader.js +56 -0
- package/dist/Components/KaTable/ka-table.css +27 -0
- package/dist/Components/KaTable/useMergedChildComponents.d.ts +14 -0
- package/dist/Components/KaTable/useMergedChildComponents.js +224 -0
- package/dist/Pages/KaTableExample.d.ts +3 -0
- package/dist/Pages/KaTableExample.js +259 -0
- package/dist/Pages/button.js +7 -3
- package/dist/Pages/input.js +10 -5
- package/dist/Theme/Default/fonts.d.ts +35 -0
- package/dist/Theme/Default/fonts.js +37 -0
- package/dist/Theme/Default/palette.d.ts +145 -6
- package/dist/Theme/Default/palette.js +244 -105
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ButtonProps } from "./ButtonProps";
|
|
3
|
-
declare function Button({ label, onClick, color, variant, leftIcon, rightIcon, size, isDisabled, isLoading, loadingText, type, sx, }: ButtonProps): React.JSX.Element;
|
|
3
|
+
declare function Button({ label, onClick, color, variant, leftIcon, rightIcon, size, isDisabled, isLoading, loadingText, type, width, padding, sx, }: ButtonProps): React.JSX.Element;
|
|
4
4
|
declare const _default: React.MemoExoticComponent<typeof Button>;
|
|
5
5
|
export default _default;
|
|
@@ -38,7 +38,7 @@ var react_1 = __importStar(require("react"));
|
|
|
38
38
|
var react_2 = require("@chakra-ui/react");
|
|
39
39
|
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
40
40
|
function Button(_a) {
|
|
41
|
-
var label = _a.label, onClick = _a.onClick, color = _a.color, _b = _a.variant, variant = _b === void 0 ? "solid" : _b, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, size = _a.size, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d, _e = _a.loadingText, loadingText = _e === void 0 ? "Loading" : _e, type = _a.type, sx = _a.sx;
|
|
41
|
+
var label = _a.label, onClick = _a.onClick, color = _a.color, _b = _a.variant, variant = _b === void 0 ? "solid" : _b, leftIcon = _a.leftIcon, rightIcon = _a.rightIcon, size = _a.size, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d, _e = _a.loadingText, loadingText = _e === void 0 ? "Loading" : _e, type = _a.type, width = _a.width, padding = _a.padding, sx = _a.sx;
|
|
42
42
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
43
43
|
var buttonColor = !color ? theme.colors.primary[500] : color;
|
|
44
44
|
var variantStyles = {
|
|
@@ -78,12 +78,12 @@ function Button(_a) {
|
|
|
78
78
|
},
|
|
79
79
|
};
|
|
80
80
|
var appliedVariantStyle = !color ? variantStyles[variant] : {};
|
|
81
|
-
return (react_1.default.createElement(react_2.Button, __assign({ type: type, onClick: onClick, width: "fit-content",
|
|
82
|
-
react_1.default.createElement(react_2.
|
|
81
|
+
return (react_1.default.createElement(react_2.Button, __assign({ type: type, onClick: onClick, width: width || "fit-content", padding: padding, borderRadius: "4px", bg: "#9A4FE5", color: "white", _hover: { bg: "#8847C5" }, variant: variant, size: size, isLoading: isLoading, isDisabled: isDisabled, loadingText: loadingText, leftIcon: leftIcon, rightIcon: rightIcon, sx: sx }, appliedVariantStyle),
|
|
82
|
+
react_1.default.createElement(react_2.Text, { sx: {
|
|
83
83
|
overflow: "hidden",
|
|
84
84
|
textOverflow: "ellipsis",
|
|
85
85
|
whiteSpace: "nowrap",
|
|
86
86
|
maxWidth: "100%",
|
|
87
|
-
} }, label)));
|
|
87
|
+
}, fontSize: "1rem", fontWeight: 500 }, label)));
|
|
88
88
|
}
|
|
89
89
|
exports.default = (0, react_1.memo)(Button);
|
|
@@ -5,8 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var react_1 = __importDefault(require("react"));
|
|
7
7
|
var react_2 = require("@chakra-ui/react");
|
|
8
|
+
var lucide_react_1 = require("lucide-react");
|
|
8
9
|
var ErrorMessage = function (_a) {
|
|
9
10
|
var errorMessage = _a.errorMessage;
|
|
10
|
-
return (react_1.default.createElement(
|
|
11
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
12
|
+
react_1.default.createElement(react_2.FormErrorMessage, { fontSize: "14px" },
|
|
13
|
+
react_1.default.createElement(lucide_react_1.Info, { width: "14px" }),
|
|
14
|
+
react_1.default.createElement(react_2.Text, { ml: "3px" }, errorMessage !== null && errorMessage !== void 0 ? errorMessage : "Error"))));
|
|
11
15
|
};
|
|
12
16
|
exports.default = ErrorMessage;
|
|
@@ -7,16 +7,12 @@ exports.TextLabel = void 0;
|
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var react_2 = require("@chakra-ui/react");
|
|
9
9
|
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
10
|
-
var lucide_react_1 = require("lucide-react");
|
|
11
10
|
var TextLabel = function (_a) {
|
|
12
11
|
var label = _a.label, id = _a.id, _b = _a.isRequired, isRequired = _b === void 0 ? false : _b, _c = _a.isInformation, isInformation = _c === void 0 ? false : _c, _d = _a.informationMessage, informationMessage = _d === void 0 ? "" : _d;
|
|
13
12
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
14
13
|
return (react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", gap: "3px" },
|
|
15
|
-
react_1.default.createElement(react_2.FormLabel, { htmlFor: id !== null && id !== void 0 ? id : label, color: theme.colors.gray[600], mb: "0.
|
|
14
|
+
react_1.default.createElement(react_2.FormLabel, { htmlFor: id !== null && id !== void 0 ? id : label, color: theme.colors.gray[600], mb: "0.375rem", fontWeight: 400, fontSize: "0.875rem" },
|
|
16
15
|
label,
|
|
17
|
-
isRequired && react_1.default.createElement("span", { style: { color: "red" } }, "*"))
|
|
18
|
-
isInformation && informationMessage && (react_1.default.createElement(react_2.Tooltip, { label: informationMessage, hasArrow: true, placement: "top", bg: "gray.600", color: "white", fontSize: "10px" },
|
|
19
|
-
react_1.default.createElement(react_2.Box, { cursor: "pointer" },
|
|
20
|
-
react_1.default.createElement(react_2.Icon, { as: lucide_react_1.InfoIcon, color: "gray.500", boxSize: 4 }))))));
|
|
16
|
+
isRequired && react_1.default.createElement("span", { style: { color: "red", paddingLeft: "0.4rem" } }, "*"))));
|
|
21
17
|
};
|
|
22
18
|
exports.TextLabel = TextLabel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TextInputProps } from "./TextInputProps";
|
|
3
|
-
declare function TextInput({ label, type, id, name, onChange, onBlur, onFocus, isDisabled, isReadOnly, isRequired, value, placeholder, width, error, errorMessage, helperText, onRightIconclick, inputRightIcon, inputLeftIcon, onLeftIconClick, inputGroupStyle, inputStyle, size, isInformation, informationMessage, leftElementStyle, rightElementStyle, }: TextInputProps): React.JSX.Element;
|
|
3
|
+
declare function TextInput({ label, type, id, name, onChange, onBlur, onFocus, isDisabled, isReadOnly, isRequired, value, placeholder, width, height, error, errorMessage, helperText, onRightIconclick, inputRightIcon, inputLeftIcon, onLeftIconClick, inputGroupStyle, inputStyle, size, isInformation, informationMessage, leftElementStyle, rightElementStyle, }: TextInputProps): React.JSX.Element;
|
|
4
4
|
declare const _default: React.MemoExoticComponent<typeof TextInput>;
|
|
5
5
|
export default _default;
|
|
@@ -21,30 +21,29 @@ var FormLabel_1 = require("../Common/FormLabel");
|
|
|
21
21
|
var HelperText_1 = __importDefault(require("../Common/HelperText"));
|
|
22
22
|
var ErrorMessage_1 = __importDefault(require("../Common/ErrorMessage"));
|
|
23
23
|
function TextInput(_a) {
|
|
24
|
-
var label = _a.label, _b = _a.type, type = _b === void 0 ? "text" : _b, id = _a.id, name = _a.name, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, _d = _a.isReadOnly, isReadOnly = _d === void 0 ? false : _d, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, value = _a.value, _f = _a.placeholder, placeholder = _f === void 0 ? "Placeholder" : _f, _g = _a.width, width = _g === void 0 ? "
|
|
24
|
+
var label = _a.label, _b = _a.type, type = _b === void 0 ? "text" : _b, id = _a.id, name = _a.name, onChange = _a.onChange, onBlur = _a.onBlur, onFocus = _a.onFocus, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, _d = _a.isReadOnly, isReadOnly = _d === void 0 ? false : _d, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, value = _a.value, _f = _a.placeholder, placeholder = _f === void 0 ? "Placeholder" : _f, _g = _a.width, width = _g === void 0 ? "360px" : _g, _h = _a.height, height = _h === void 0 ? "44px" : _h, error = _a.error, errorMessage = _a.errorMessage, helperText = _a.helperText, onRightIconclick = _a.onRightIconclick, inputRightIcon = _a.inputRightIcon, inputLeftIcon = _a.inputLeftIcon, onLeftIconClick = _a.onLeftIconClick, inputGroupStyle = _a.inputGroupStyle, inputStyle = _a.inputStyle, _j = _a.size, size = _j === void 0 ? "md" : _j, _k = _a.isInformation, isInformation = _k === void 0 ? false : _k, informationMessage = _a.informationMessage, leftElementStyle = _a.leftElementStyle, rightElementStyle = _a.rightElementStyle;
|
|
25
25
|
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
26
26
|
var getPadding = function () {
|
|
27
27
|
if (inputLeftIcon && inputRightIcon) {
|
|
28
|
-
return "
|
|
28
|
+
return { pl: "1.9rem", pr: "1.9rem" };
|
|
29
29
|
}
|
|
30
30
|
else if (inputLeftIcon) {
|
|
31
|
-
return
|
|
31
|
+
return { pl: "1.9rem", pr: "1rem" };
|
|
32
32
|
}
|
|
33
33
|
else if (inputRightIcon) {
|
|
34
|
-
return "
|
|
34
|
+
return { pl: "1rem", pr: "1.9rem" };
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
return "
|
|
37
|
+
return { pl: "1rem", pr: "1rem" };
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
|
|
40
|
+
var padding = getPadding();
|
|
41
|
+
return (react_1.default.createElement(react_2.FormControl, { isInvalid: error, w: width },
|
|
41
42
|
label && (react_1.default.createElement(FormLabel_1.TextLabel, { label: label, id: id, isInformation: isInformation, informationMessage: informationMessage, isRequired: isRequired })),
|
|
42
|
-
react_1.default.createElement(react_2.InputGroup, { width:
|
|
43
|
-
inputLeftIcon && (react_1.default.createElement(react_2.InputLeftElement, { onClick: onLeftIconClick,
|
|
44
|
-
react_1.default.createElement(react_2.Input, { type: type,
|
|
45
|
-
|
|
46
|
-
placeholder: placeholder, onChange: onChange, onBlur: onBlur, onFocus: onFocus, value: value, errorBorderColor: error ? "crimson" : "", isDisabled: isDisabled, isReadOnly: isReadOnly, id: id, name: name, size: size, style: __assign(__assign({}, inputStyle), { backgroundColor: theme.colors.backgroundColor.light, fontWeight: 600, color: theme.colors.gray[600], padding: getPadding(), fontSize: 15, letterSpacing: 0.7 }) }),
|
|
47
|
-
inputRightIcon && (react_1.default.createElement(react_2.InputRightElement, { onClick: onRightIconclick, style: __assign(__assign({}, rightElementStyle), { height: "1.8rem", width: "1.8rem" }) }, inputRightIcon))),
|
|
43
|
+
react_1.default.createElement(react_2.InputGroup, { width: "100%", style: inputGroupStyle, height: height },
|
|
44
|
+
inputLeftIcon && (react_1.default.createElement(react_2.InputLeftElement, __assign({ onClick: onLeftIconClick, pointerEvents: onLeftIconClick ? "auto" : "none", display: "flex", alignItems: "center", justifyContent: "center", height: height, width: "2rem", cursor: onLeftIconClick ? "pointer" : "default" }, leftElementStyle), inputLeftIcon)),
|
|
45
|
+
react_1.default.createElement(react_2.Input, __assign({ type: type, placeholder: placeholder, onChange: onChange, onBlur: onBlur, onFocus: onFocus, value: value, errorBorderColor: error ? "crimson" : "", isDisabled: isDisabled, isReadOnly: isReadOnly, id: id, name: name, size: size, height: height, fontWeight: 500, color: "#161B25", bg: "gray.50", fontSize: "0.875rem", letterSpacing: "0.7px", borderRadius: "0.25rem", border: "1px", borderColor: error ? "#F2463A" : "#D6D8DB", _placeholder: { color: "gray.400", fontStyle: "italic" }, pt: "13px", pb: "13px" }, padding, inputStyle)),
|
|
46
|
+
inputRightIcon && (react_1.default.createElement(react_2.InputRightElement, __assign({ onClick: onRightIconclick, pointerEvents: onRightIconclick ? "auto" : "none", display: "flex", alignItems: "center", justifyContent: "center", height: height, width: "2rem" }, rightElementStyle), inputRightIcon))),
|
|
48
47
|
error && react_1.default.createElement(ErrorMessage_1.default, { errorMessage: errorMessage }),
|
|
49
48
|
helperText && !error && react_1.default.createElement(HelperText_1.default, { helperText: helperText })));
|
|
50
49
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { InputProps } from "@chakra-ui/react";
|
|
3
|
-
export type TextInputProps = Pick<InputProps, "value" | "type" | "onChange" | "placeholder" | "onBlur" | "onFocus" | "isDisabled" | "isRequired" | "isReadOnly" | "width" | "errorBorderColor" | "size"> & {
|
|
2
|
+
export type TextInputProps = Pick<InputProps, "value" | "type" | "onChange" | "placeholder" | "onBlur" | "onFocus" | "isDisabled" | "isRequired" | "isReadOnly" | "width" | "height" | "errorBorderColor" | "size"> & {
|
|
4
3
|
label?: string;
|
|
5
4
|
id?: string;
|
|
6
5
|
name?: string;
|
|
@@ -8,9 +7,9 @@ export type TextInputProps = Pick<InputProps, "value" | "type" | "onChange" | "p
|
|
|
8
7
|
errorMessage?: string;
|
|
9
8
|
helperText?: string;
|
|
10
9
|
onRightIconclick?: () => void;
|
|
11
|
-
inputRightIcon?:
|
|
10
|
+
inputRightIcon?: any;
|
|
12
11
|
onLeftIconClick?: () => void;
|
|
13
|
-
inputLeftIcon?:
|
|
12
|
+
inputLeftIcon?: any;
|
|
14
13
|
inputStyle?: {};
|
|
15
14
|
inputGroupStyle?: {};
|
|
16
15
|
isInformation?: boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type CustomHeaderProps = {
|
|
3
|
+
column: any;
|
|
4
|
+
onSortChange?: (sortState: string, columnName: string) => void;
|
|
5
|
+
menuItems?: Array<{
|
|
6
|
+
label: string;
|
|
7
|
+
onClick: () => void;
|
|
8
|
+
submenu?: any[];
|
|
9
|
+
}>;
|
|
10
|
+
isSort?: boolean;
|
|
11
|
+
sortDirection: string;
|
|
12
|
+
};
|
|
13
|
+
declare const CustomHeader: React.MemoExoticComponent<({ column, onSortChange, menuItems, isSort, sortDirection, }: CustomHeaderProps) => React.JSX.Element>;
|
|
14
|
+
export default CustomHeader;
|
|
@@ -0,0 +1,69 @@
|
|
|
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 useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
31
|
+
var CustomHeader = (0, react_1.memo)(function (_a) {
|
|
32
|
+
var column = _a.column, onSortChange = _a.onSortChange, menuItems = _a.menuItems, isSort = _a.isSort, sortDirection = _a.sortDirection;
|
|
33
|
+
var handleSortClick = (0, react_1.useCallback)(function () {
|
|
34
|
+
var sortOrder = "none";
|
|
35
|
+
if (sortDirection === "none")
|
|
36
|
+
sortOrder = "asc";
|
|
37
|
+
else if (sortDirection === "asc")
|
|
38
|
+
sortOrder = "desc";
|
|
39
|
+
onSortChange === null || onSortChange === void 0 ? void 0 : onSortChange(sortOrder, column.key);
|
|
40
|
+
}, [sortDirection, column.key, onSortChange]);
|
|
41
|
+
return (react_1.default.createElement(react_2.Box, { display: "flex", justifyContent: "space-between", alignItems: "center" },
|
|
42
|
+
react_1.default.createElement(react_2.Box, { fontWeight: "bold" }, column.title),
|
|
43
|
+
react_1.default.createElement(react_2.Flex, { alignItems: "center" },
|
|
44
|
+
isSort && (react_1.default.createElement(SortingIcon, { sortState: sortDirection, handleSortClick: handleSortClick })),
|
|
45
|
+
menuItems && (menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) ? (react_1.default.createElement(react_2.Menu, null,
|
|
46
|
+
react_1.default.createElement(react_2.MenuButton, { as: react_2.IconButton, "aria-label": "Options", icon: react_1.default.createElement(bs_1.BsThreeDots, null), size: "sm", variant: "ghost", _hover: { bg: "none" }, _active: { bg: "none" } }),
|
|
47
|
+
react_1.default.createElement(react_2.Portal, null,
|
|
48
|
+
react_1.default.createElement(react_2.MenuList, null, menuItems.map(function (item, index) { return (react_1.default.createElement(react_1.default.Fragment, { key: index },
|
|
49
|
+
react_1.default.createElement(react_2.MenuItem, { onClick: function () { return item === null || item === void 0 ? void 0 : item.onClick(); } }, item.label),
|
|
50
|
+
item.submenu && react_1.default.createElement(Submenu, { items: item.submenu }))); }))))) : null)));
|
|
51
|
+
});
|
|
52
|
+
var SortingIcon = (0, react_1.memo)(function (_a) {
|
|
53
|
+
var sortState = _a.sortState, handleSortClick = _a.handleSortClick;
|
|
54
|
+
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
55
|
+
return (react_1.default.createElement(react_2.Box, { display: "flex", alignItems: "center", justifyContent: "center", bg: theme.colors.white, borderRadius: "full", cursor: "pointer", w: "24px", h: "24px", onClick: handleSortClick, transition: "transform 0.2s ease-in-out", _hover: { transform: "scale(1.1)" } },
|
|
56
|
+
sortState === "none" && react_1.default.createElement(fa_1.FaSort, { size: 14 }),
|
|
57
|
+
sortState === "asc" && react_1.default.createElement(fa_1.FaCaretUp, { size: 14 }),
|
|
58
|
+
sortState === "desc" && react_1.default.createElement(fa_1.FaCaretDown, { size: 14 })));
|
|
59
|
+
});
|
|
60
|
+
var Submenu = (0, react_1.memo)(function (_a) {
|
|
61
|
+
var items = _a.items;
|
|
62
|
+
return (react_1.default.createElement(react_2.MenuGroup, null, items.map(function (subItem, index) { return (react_1.default.createElement(react_2.MenuItem, { key: index, onClick: function () { return (subItem === null || subItem === void 0 ? void 0 : subItem.onClick) && (subItem === null || subItem === void 0 ? void 0 : subItem.onClick()); }, sx: {
|
|
63
|
+
pl: 6,
|
|
64
|
+
fontSize: "sm",
|
|
65
|
+
color: "gray.600",
|
|
66
|
+
_hover: { bg: "gray.100", color: "gray.800" }, // Hover styles
|
|
67
|
+
} }, subItem.label)); })));
|
|
68
|
+
});
|
|
69
|
+
exports.default = CustomHeader;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as TableEnums from "ka-table/enums";
|
|
3
|
+
import * as TableProps from "ka-table/props";
|
|
4
|
+
import * as TableActionCreator from "ka-table/actionCreators";
|
|
5
|
+
import * as TableModel from "ka-table/models";
|
|
6
|
+
import * as TableUtils from "ka-table/utils";
|
|
7
|
+
import * as TableFun from "ka-table";
|
|
8
|
+
import "ka-table/style.css";
|
|
9
|
+
import "./ka-table.css";
|
|
10
|
+
import { KaTableProps } from "./KaTableProps";
|
|
11
|
+
declare const _default: React.MemoExoticComponent<({ columns, data, rowKey, Edit, format, filter, childComponents, columnReorder, columnResizing, editableCells, validation, loading, checkSelect, onRowClick, onSelectionChange, selected, columnVisibility, headerBgColor, freezedBgColor, headerTextColor, freezedTextColor, }: KaTableProps) => React.JSX.Element>;
|
|
12
|
+
export default _default;
|
|
13
|
+
export { TableEnums, TableActionCreator, TableProps, TableModel, TableUtils, TableFun, };
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
26
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
27
|
+
if (ar || !(i in from)) {
|
|
28
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
29
|
+
ar[i] = from[i];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.TableFun = exports.TableUtils = exports.TableModel = exports.TableProps = exports.TableActionCreator = exports.TableEnums = void 0;
|
|
39
|
+
var react_1 = __importStar(require("react"));
|
|
40
|
+
var ka_table_1 = require("ka-table");
|
|
41
|
+
var TableEnums = __importStar(require("ka-table/enums"));
|
|
42
|
+
exports.TableEnums = TableEnums;
|
|
43
|
+
var TableProps = __importStar(require("ka-table/props"));
|
|
44
|
+
exports.TableProps = TableProps;
|
|
45
|
+
var TableActionCreator = __importStar(require("ka-table/actionCreators"));
|
|
46
|
+
exports.TableActionCreator = TableActionCreator;
|
|
47
|
+
var TableModel = __importStar(require("ka-table/models"));
|
|
48
|
+
exports.TableModel = TableModel;
|
|
49
|
+
var TableUtils = __importStar(require("ka-table/utils"));
|
|
50
|
+
exports.TableUtils = TableUtils;
|
|
51
|
+
var TableFun = __importStar(require("ka-table"));
|
|
52
|
+
exports.TableFun = TableFun;
|
|
53
|
+
require("ka-table/style.css");
|
|
54
|
+
require("./ka-table.css");
|
|
55
|
+
var useMergedChildComponents_1 = __importDefault(require("./useMergedChildComponents"));
|
|
56
|
+
var useCustomTheme_1 = require("../../Theme/useCustomTheme");
|
|
57
|
+
var table_1 = require("../../Utils/table");
|
|
58
|
+
var selectionCellColumn = {
|
|
59
|
+
key: "select-cell",
|
|
60
|
+
width: 50,
|
|
61
|
+
columnFreeze: true,
|
|
62
|
+
customHeader: false,
|
|
63
|
+
className: "select-cell",
|
|
64
|
+
};
|
|
65
|
+
var KaTable = function (_a) {
|
|
66
|
+
var _b, _c;
|
|
67
|
+
var columns = _a.columns, data = _a.data, _d = _a.rowKey, rowKey = _d === void 0 ? "id" : _d, Edit = _a.Edit,
|
|
68
|
+
// sorting,
|
|
69
|
+
format = _a.format,
|
|
70
|
+
// paging,
|
|
71
|
+
filter = _a.filter, childComponents = _a.childComponents, columnReorder = _a.columnReorder, columnResizing = _a.columnResizing, editableCells = _a.editableCells, validation = _a.validation, loading = _a.loading, checkSelect = _a.checkSelect, onRowClick = _a.onRowClick, onSelectionChange = _a.onSelectionChange, selected = _a.selected, columnVisibility = _a.columnVisibility, headerBgColor = _a.headerBgColor, freezedBgColor = _a.freezedBgColor, headerTextColor = _a.headerTextColor, freezedTextColor = _a.freezedTextColor;
|
|
72
|
+
var theme = (0, useCustomTheme_1.useCustomTheme)();
|
|
73
|
+
var _e = (0, react_1.useState)([]), sortState = _e[0], setSortState = _e[1];
|
|
74
|
+
if (checkSelect &&
|
|
75
|
+
!columns.some(function (column) { return column.key === "select-cell"; })) {
|
|
76
|
+
columns.unshift(selectionCellColumn);
|
|
77
|
+
}
|
|
78
|
+
var dataLength = (_b = data === null || data === void 0 ? void 0 : data.length) !== null && _b !== void 0 ? _b : 0;
|
|
79
|
+
// const columnVisibilitys = columnVisibility ?? false;
|
|
80
|
+
var handleSort = function (sort) {
|
|
81
|
+
setSortState(sort);
|
|
82
|
+
};
|
|
83
|
+
var sortedData = (0, react_1.useMemo)(function () { return (0, table_1.SortMultiColumnData)(__spreadArray([], data, true), sortState); }, [sortState, data]);
|
|
84
|
+
var mergedChildComponents = (0, useMergedChildComponents_1.default)({
|
|
85
|
+
childComponents: childComponents,
|
|
86
|
+
onSortChange: handleSort,
|
|
87
|
+
handleSelection: onSelectionChange,
|
|
88
|
+
rowKey: rowKey,
|
|
89
|
+
onRowClick: onRowClick,
|
|
90
|
+
selected: selected,
|
|
91
|
+
dataLength: dataLength,
|
|
92
|
+
columns: columns,
|
|
93
|
+
headerBgColor: headerBgColor,
|
|
94
|
+
freezedBgColor: freezedBgColor,
|
|
95
|
+
headerTextColor: headerTextColor,
|
|
96
|
+
freezedTextColor: freezedTextColor,
|
|
97
|
+
sortState: sortState,
|
|
98
|
+
});
|
|
99
|
+
return (react_1.default.createElement("div", { style: {
|
|
100
|
+
borderRadius: "10px 0 0 10px",
|
|
101
|
+
borderWidth: "0px 0px 0px 5px",
|
|
102
|
+
borderColor: (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[500],
|
|
103
|
+
boxShadow: theme.shadows.lg,
|
|
104
|
+
} },
|
|
105
|
+
react_1.default.createElement(ka_table_1.Table, { columns: columns, data: sortedData, rowKeyField: rowKey, editingMode: Edit, key: columns, sortingMode: TableEnums.SortingMode.MultipleRemote, format: format,
|
|
106
|
+
// paging={paging}
|
|
107
|
+
filteringMode: undefined, childComponents: mergedChildComponents, columnReordering: columnReorder, columnResizing: columnResizing, editableCells: editableCells, validation: validation, loading: loading, virtualScrolling: {
|
|
108
|
+
enabled: true,
|
|
109
|
+
} })));
|
|
110
|
+
};
|
|
111
|
+
exports.default = react_1.default.memo(KaTable);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type KaTableProps = {
|
|
2
|
+
columns: any;
|
|
3
|
+
data: any;
|
|
4
|
+
rowKey?: any;
|
|
5
|
+
Edit?: any;
|
|
6
|
+
format?: (props: any) => void;
|
|
7
|
+
validation?: (props: any) => void;
|
|
8
|
+
filter?: any;
|
|
9
|
+
childComponents?: any;
|
|
10
|
+
columnReorder?: any;
|
|
11
|
+
columnResizing?: any;
|
|
12
|
+
editableCells?: any;
|
|
13
|
+
loading?: any;
|
|
14
|
+
checkSelect?: any;
|
|
15
|
+
onRowClick?: (rowData: any, column: any) => void;
|
|
16
|
+
onSelectionChange?: (selectedIds: any[]) => void;
|
|
17
|
+
selected?: any;
|
|
18
|
+
columnVisibility?: boolean;
|
|
19
|
+
headerBgColor?: string;
|
|
20
|
+
headerTextColor?: string;
|
|
21
|
+
freezedBgColor?: string;
|
|
22
|
+
freezedTextColor?: string;
|
|
23
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TableProps } from "./KaTable";
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ rowKeyValue, selectedRows, onSelectionChange, selected, }: TableProps.ICellTextProps<any> & {
|
|
4
|
+
onSelectionChange: (ids: any[], type: string) => void;
|
|
5
|
+
rowKey: any;
|
|
6
|
+
selected: any;
|
|
7
|
+
}) => React.JSX.Element>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
var react_1 = __importDefault(require("react"));
|
|
16
|
+
var KaTable_1 = require("./KaTable");
|
|
17
|
+
var SelectionCell = function (_a) {
|
|
18
|
+
var rowKeyValue = _a.rowKeyValue, selectedRows = _a.selectedRows, onSelectionChange = _a.onSelectionChange, selected = _a.selected;
|
|
19
|
+
var table = KaTable_1.TableFun.useTableInstance();
|
|
20
|
+
var onChangeHandle = function (event) {
|
|
21
|
+
if (event.nativeEvent.shiftKey) {
|
|
22
|
+
table.selectRowsRange(rowKeyValue, __spreadArray([], selectedRows, true).pop());
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
var isChecked = event.currentTarget.checked;
|
|
26
|
+
var action = isChecked ? "add" : "remove";
|
|
27
|
+
onSelectionChange(rowKeyValue, action);
|
|
28
|
+
if (isChecked) {
|
|
29
|
+
table.selectRow(rowKeyValue);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
table.deselectRow(rowKeyValue);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return react_1.default.createElement("input", { type: "checkbox", checked: selected, onChange: onChangeHandle, style: { marginLeft: "37%" } });
|
|
37
|
+
};
|
|
38
|
+
exports.default = react_1.default.memo(SelectionCell);
|
|
@@ -0,0 +1,56 @@
|
|
|
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 KaTable_1 = require("./KaTable");
|
|
28
|
+
var SelectionHeader = function (_a) {
|
|
29
|
+
var onSelectionChange = _a.onSelectionChange, rowKey = _a.rowKey, selected = _a.selected;
|
|
30
|
+
var table = KaTable_1.TableFun.useTableInstance();
|
|
31
|
+
var selectAllRef = (0, react_1.useRef)(null);
|
|
32
|
+
(0, react_1.useEffect)(function () {
|
|
33
|
+
if (selectAllRef.current) {
|
|
34
|
+
selectAllRef.current.indeterminate = selected === null || selected === void 0 ? void 0 : selected.intederminate;
|
|
35
|
+
}
|
|
36
|
+
}, [selected.intederminate]);
|
|
37
|
+
var handleSelectionChange = (0, react_1.useCallback)(function (checked) {
|
|
38
|
+
onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(checked);
|
|
39
|
+
}, [onSelectionChange]);
|
|
40
|
+
return (react_1.default.createElement("input", { ref: selectAllRef, type: "checkbox", checked: selected === null || selected === void 0 ? void 0 : selected.checked, onChange: function (event) {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
var isChecked = event.currentTarget.checked;
|
|
43
|
+
// const action = isChecked ? "add" : "remove";
|
|
44
|
+
var totalIds = isChecked
|
|
45
|
+
? (_b = (_a = table === null || table === void 0 ? void 0 : table.props) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.map(function (row) { return row[rowKey]; })
|
|
46
|
+
: [];
|
|
47
|
+
handleSelectionChange(totalIds);
|
|
48
|
+
if (isChecked) {
|
|
49
|
+
table.selectAllFilteredRows();
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
table.deselectAllFilteredRows();
|
|
53
|
+
}
|
|
54
|
+
}, style: { marginLeft: "40%" } }));
|
|
55
|
+
};
|
|
56
|
+
exports.default = react_1.default.memo(SelectionHeader);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.ka-thead-cell {
|
|
2
|
+
padding: 7px 7px;
|
|
3
|
+
}
|
|
4
|
+
.ka-cell {
|
|
5
|
+
padding: 7px 0px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.ka-thead-background {
|
|
9
|
+
background-color: #bfbcbc;
|
|
10
|
+
z-index: 1;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ka-cell-text {
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
text-overflow: ellipsis;
|
|
16
|
+
white-space: nowrap;
|
|
17
|
+
padding-left: 5%;
|
|
18
|
+
}
|
|
19
|
+
.ka-row {
|
|
20
|
+
box-sizing: unset;
|
|
21
|
+
border-bottom: none;
|
|
22
|
+
border-top: none;
|
|
23
|
+
}
|
|
24
|
+
.ka-table-wrapper {
|
|
25
|
+
border-bottom: 2px solid #d8d9db;
|
|
26
|
+
border-right: 2px solid #d8d9db;
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { KaTableProps } from "./KaTableProps";
|
|
2
|
+
type MergedChildComponentsProps = Pick<KaTableProps, "headerBgColor" | "headerTextColor" | "freezedBgColor" | "freezedTextColor"> & {
|
|
3
|
+
childComponents: any;
|
|
4
|
+
onSortChange: any;
|
|
5
|
+
handleSelection: any;
|
|
6
|
+
rowKey: any;
|
|
7
|
+
onRowClick: any;
|
|
8
|
+
selected: any;
|
|
9
|
+
dataLength: number;
|
|
10
|
+
columns: any;
|
|
11
|
+
sortState: any;
|
|
12
|
+
};
|
|
13
|
+
declare const useMergedChildComponents: ({ childComponents, onSortChange, handleSelection, rowKey, onRowClick, selected, dataLength, columns, headerBgColor, freezedBgColor, headerTextColor, freezedTextColor, sortState, }: MergedChildComponentsProps) => any;
|
|
14
|
+
export default useMergedChildComponents;
|