pixelize-design-library 2.1.73 → 2.1.75

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.
Files changed (30) hide show
  1. package/dist/Components/Apexcharts/ApexDonutChart/ApexDonutChart.d.ts +4 -0
  2. package/dist/Components/Apexcharts/ApexDonutChart/ApexDonutChart.js +58 -0
  3. package/dist/Components/Apexcharts/ApexDonutChart/ApexDonutChartProps.d.ts +21 -0
  4. package/dist/Components/Apexcharts/ApexDonutChart/ApexDonutChartProps.js +2 -0
  5. package/dist/Components/Apexcharts/ApexPieChart/ApexPieChart.d.ts +2 -1
  6. package/dist/Components/Apexcharts/ApexPieChart/ApexPieChart.js +113 -16
  7. package/dist/Components/Apexcharts/ApexPieChart/ApexPieChartProps.d.ts +15 -33
  8. package/dist/Components/KaTable/CustomHeader.d.ts +14 -0
  9. package/dist/Components/KaTable/CustomHeader.js +69 -0
  10. package/dist/Components/KaTable/KaTable.d.ts +13 -0
  11. package/dist/Components/KaTable/KaTable.js +111 -0
  12. package/dist/Components/KaTable/KaTableProps.d.ts +23 -0
  13. package/dist/Components/KaTable/KaTableProps.js +2 -0
  14. package/dist/Components/KaTable/SelectionCell.d.ts +8 -0
  15. package/dist/Components/KaTable/SelectionCell.js +38 -0
  16. package/dist/Components/KaTable/SelectionHeader.d.ts +3 -0
  17. package/dist/Components/KaTable/SelectionHeader.js +56 -0
  18. package/dist/Components/KaTable/ka-table.css +27 -0
  19. package/dist/Components/KaTable/useMergedChildComponents.d.ts +14 -0
  20. package/dist/Components/KaTable/useMergedChildComponents.js +224 -0
  21. package/dist/Components/NoteTextArea/NoteTextArea.js +0 -381
  22. package/dist/Components/Table/Table.css +16 -0
  23. package/dist/Pages/KaTableExample.d.ts +3 -0
  24. package/dist/Pages/KaTableExample.js +259 -0
  25. package/dist/Pages/chart.js +11 -7
  26. package/dist/Theme/Default/fonts.d.ts +35 -0
  27. package/dist/Theme/Default/fonts.js +37 -0
  28. package/package.json +1 -1
  29. package/dist/index.d.mts +0 -1468
  30. package/dist/index.mjs +0 -263
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { ApexDonutChartProps } from "./ApexDonutChartProps";
3
+ declare const ApexDonutChart: ({ data, labels, title, titlePosition, height, width, donutColors, chartColor, titleStyle, legendStyle, }: ApexDonutChartProps) => React.JSX.Element;
4
+ export default ApexDonutChart;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ var react_1 = __importDefault(require("react"));
18
+ var react_apexcharts_1 = __importDefault(require("react-apexcharts"));
19
+ var ApexDonutChart = function (_a) {
20
+ var _b;
21
+ var data = _a.data, labels = _a.labels, title = _a.title, _c = _a.titlePosition, titlePosition = _c === void 0 ? "center" : _c, _d = _a.height, height = _d === void 0 ? 400 : _d, _e = _a.width, width = _e === void 0 ? 500 : _e, donutColors = _a.donutColors, chartColor = _a.chartColor, _f = _a.titleStyle, titleStyle = _f === void 0 ? {
22
+ color: "#3182ce",
23
+ fontSize: "16px",
24
+ fontWeight: 600,
25
+ fontFamily: "Arial",
26
+ } : _f, _g = _a.legendStyle, legendStyle = _g === void 0 ? {
27
+ colors: "#000",
28
+ position: "bottom",
29
+ useSeriesColors: false,
30
+ } : _g;
31
+ var options = {
32
+ chart: {
33
+ type: "donut",
34
+ },
35
+ labels: labels,
36
+ colors: (_b = chartColor !== null && chartColor !== void 0 ? chartColor : donutColors) !== null && _b !== void 0 ? _b : ["#3182ce", "#e53e3e", "#38a169", "#dd6b20"],
37
+ legend: {
38
+ position: legendStyle.position,
39
+ labels: {
40
+ colors: legendStyle.colors,
41
+ useSeriesColors: legendStyle.useSeriesColors,
42
+ },
43
+ },
44
+ title: {
45
+ text: title,
46
+ align: titlePosition,
47
+ style: __assign(__assign({}, titleStyle), { fontSize: (titleStyle === null || titleStyle === void 0 ? void 0 : titleStyle.fontSize)
48
+ ? String(titleStyle.fontSize) // ✅ ensures string if number passed
49
+ : undefined }),
50
+ },
51
+ dataLabels: {
52
+ enabled: true,
53
+ },
54
+ };
55
+ return (react_1.default.createElement("div", null,
56
+ react_1.default.createElement(react_apexcharts_1.default, { options: options, series: data, type: "donut", height: height, width: width })));
57
+ };
58
+ exports.default = ApexDonutChart;
@@ -0,0 +1,21 @@
1
+ export type ApexDonutChartProps = {
2
+ data: number[];
3
+ labels: string[];
4
+ title?: string;
5
+ titlePosition?: "left" | "center" | "right";
6
+ height?: number;
7
+ width?: number;
8
+ donutColors?: string[];
9
+ chartColor?: string[];
10
+ titleStyle?: {
11
+ color?: string;
12
+ fontSize?: string | number;
13
+ fontWeight?: number | string;
14
+ fontFamily?: string;
15
+ };
16
+ legendStyle?: {
17
+ colors?: string | string[];
18
+ useSeriesColors?: boolean;
19
+ position?: "top" | "right" | "bottom" | "left";
20
+ };
21
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,4 @@
1
1
  import React from "react";
2
2
  import { ApexPieChartProps } from "./ApexPieChartProps";
3
- export default function ApexPieChart({ data, labels, title, titlePosition, height, width, chartColor, titleStyle, }: ApexPieChartProps): React.JSX.Element;
3
+ declare const ApexPieChart: ({ data, labels, title, height, width, donutColors, chartColor, titlePosition, titleStyle, legendStyle, variant, }: ApexPieChartProps) => React.JSX.Element;
4
+ export default ApexPieChart;
@@ -1,29 +1,126 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
15
  };
5
16
  Object.defineProperty(exports, "__esModule", { value: true });
6
17
  var react_1 = __importDefault(require("react"));
7
18
  var react_apexcharts_1 = __importDefault(require("react-apexcharts"));
8
- function ApexPieChart(_a) {
9
- var data = _a.data, labels = _a.labels, title = _a.title, titlePosition = _a.titlePosition, _b = _a.height, height = _b === void 0 ? 400 : _b, _c = _a.width, width = _c === void 0 ? 500 : _c, chartColor = _a.chartColor, _d = _a.titleStyle, titleStyle = _d === void 0 ? {
19
+ var ApexPieChart = function (_a) {
20
+ var _b, _c;
21
+ var data = _a.data, labels = _a.labels, title = _a.title, _d = _a.height, height = _d === void 0 ? 400 : _d, _e = _a.width, width = _e === void 0 ? 500 : _e, donutColors = _a.donutColors, chartColor = _a.chartColor, _f = _a.titlePosition, titlePosition = _f === void 0 ? "center" : _f, _g = _a.titleStyle, titleStyle = _g === void 0 ? {
10
22
  color: "#3182ce",
11
- } : _d;
12
- var options = {
13
- chart: {
14
- type: "pie",
15
- height: 350,
16
- },
17
- labels: labels,
18
- title: {
23
+ fontSize: "16px",
24
+ fontWeight: 600,
25
+ fontFamily: "Arial",
26
+ } : _g, _h = _a.legendStyle, legendStyle = _h === void 0 ? {
27
+ colors: "#000",
28
+ position: "bottom",
29
+ useSeriesColors: false,
30
+ } : _h, _j = _a.variant, variant = _j === void 0 ? "pie" : _j;
31
+ var extraOptions = {};
32
+ switch (variant) {
33
+ case "semi-donut":
34
+ extraOptions = {
35
+ plotOptions: {
36
+ pie: {
37
+ startAngle: -90,
38
+ endAngle: 90,
39
+ offsetY: 10,
40
+ },
41
+ },
42
+ };
43
+ break;
44
+ case "monochrome-pie":
45
+ extraOptions = {
46
+ theme: {
47
+ monochrome: {
48
+ enabled: true,
49
+ shadeTo: "light",
50
+ shadeIntensity: 0.65,
51
+ },
52
+ },
53
+ };
54
+ break;
55
+ case "gradient-donut":
56
+ extraOptions = {
57
+ fill: {
58
+ type: "gradient",
59
+ },
60
+ };
61
+ break;
62
+ case "donut-with-pattern":
63
+ extraOptions = {
64
+ fill: {
65
+ type: "pattern",
66
+ pattern: {
67
+ style: ["verticalLines", "squares", "horizontalLines", "circles"],
68
+ },
69
+ },
70
+ };
71
+ break;
72
+ case "pie-with-image":
73
+ extraOptions = {
74
+ fill: {
75
+ type: "image",
76
+ image: {
77
+ src: [
78
+ "https://i.imgur.com/UM3mrju.jpg",
79
+ "https://i.imgur.com/NpPOqQq.jpg",
80
+ ],
81
+ },
82
+ },
83
+ };
84
+ break;
85
+ case "update-donut":
86
+ extraOptions = {
87
+ plotOptions: {
88
+ pie: {
89
+ donut: {
90
+ labels: {
91
+ show: true,
92
+ total: {
93
+ show: true,
94
+ label: "Total",
95
+ },
96
+ },
97
+ },
98
+ },
99
+ },
100
+ };
101
+ break;
102
+ case "pie":
103
+ extraOptions = {
104
+ chart: { type: "pie" },
105
+ };
106
+ break;
107
+ default:
108
+ break;
109
+ }
110
+ var options = __assign({ chart: {
111
+ type: variant.includes("pie") ? "pie" : "donut",
112
+ }, labels: labels, colors: (_b = chartColor !== null && chartColor !== void 0 ? chartColor : donutColors) !== null && _b !== void 0 ? _b : ["#3182ce", "#e53e3e", "#38a169", "#dd6b20"], legend: {
113
+ position: legendStyle.position,
114
+ labels: {
115
+ colors: legendStyle.colors,
116
+ useSeriesColors: legendStyle.useSeriesColors,
117
+ },
118
+ }, title: {
19
119
  text: title,
20
120
  align: titlePosition,
21
121
  style: titleStyle,
22
- },
23
- colors: chartColor,
24
- };
25
- var series = data;
122
+ }, dataLabels: { enabled: true } }, extraOptions);
26
123
  return (react_1.default.createElement("div", null,
27
- react_1.default.createElement(react_apexcharts_1.default, { options: options, series: series, type: "pie", height: height, width: width })));
28
- }
124
+ react_1.default.createElement(react_apexcharts_1.default, { options: options, series: data, type: (_c = options.chart) === null || _c === void 0 ? void 0 : _c.type, height: height, width: width })));
125
+ };
29
126
  exports.default = ApexPieChart;
@@ -1,41 +1,23 @@
1
1
  export type ApexPieChartProps = {
2
+ variant?: DonutPieVariant;
2
3
  data: number[];
3
4
  labels: string[];
4
5
  title?: string;
5
- titlePosition?: "left" | "center" | "right";
6
6
  height?: number;
7
7
  width?: number;
8
+ donutColors?: string[];
8
9
  chartColor?: string[];
9
- titleStyle?: StyleProps;
10
- };
11
- type StyleProps = {
12
- fontSize?: string;
13
- fontFamily?: string;
14
- fontWeight?: string | number;
15
- color?: string;
10
+ titlePosition?: "left" | "center" | "right";
11
+ titleStyle?: {
12
+ color?: string;
13
+ fontSize?: string;
14
+ fontWeight?: number | string;
15
+ fontFamily?: string;
16
+ };
17
+ legendStyle?: {
18
+ colors?: string | string[];
19
+ useSeriesColors?: boolean;
20
+ position?: "top" | "right" | "bottom" | "left";
21
+ };
16
22
  };
17
- export interface ApexOptions {
18
- annotations?: ApexAnnotations;
19
- chart?: ApexChart;
20
- colors?: any[];
21
- dataLabels?: ApexDataLabels;
22
- fill?: ApexFill;
23
- forecastDataPoints?: ApexForecastDataPoints;
24
- grid?: ApexGrid;
25
- labels?: string[];
26
- legend?: ApexLegend;
27
- markers?: ApexMarkers;
28
- noData?: ApexNoData;
29
- plotOptions?: ApexPlotOptions;
30
- responsive?: ApexResponsive[];
31
- series?: ApexAxisChartSeries | ApexNonAxisChartSeries;
32
- states?: ApexStates;
33
- stroke?: ApexStroke;
34
- subtitle?: ApexTitleSubtitle;
35
- theme?: ApexTheme;
36
- title?: ApexTitleSubtitle;
37
- tooltip?: ApexTooltip;
38
- xaxis?: ApexXAxis;
39
- yaxis?: ApexYAxis | ApexYAxis[];
40
- }
41
- export {};
23
+ export type DonutPieVariant = "pie" | "donut" | "update-donut" | "monochrome-pie" | "gradient-donut" | "semi-donut" | "donut-with-pattern" | "pie-with-image";
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ import React from "react";
2
+ declare const _default: React.MemoExoticComponent<({ onSelectionChange, rowKey, selected }: any) => React.JSX.Element>;
3
+ export default _default;
@@ -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);