pixelize-design-library 1.1.61 → 1.1.62

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.
@@ -104,35 +104,20 @@ var TableBody = function (_a) {
104
104
  isContent && (react_2.default.createElement(RenderContent, { rowIndex: rowIndex, isExpanded: isExpanded, isContent: !!row.content })),
105
105
  isCheckbox && react_2.default.createElement(RenderCheckbox, { row: row, isChecked: isChecked }),
106
106
  columns.map(function (header, headerIndex) {
107
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
107
+ var _a, _b;
108
108
  if (header.isHidden)
109
109
  return null;
110
110
  var isFrozen = header.isFreeze;
111
- var leftOffset = isFrozen
112
- ? (0, table_1.calculateLeftOffset)(columnWidths, headerIndex) +
113
- (isCheckbox ? 50 : 0)
114
- : 0;
115
- var cellBgColor = undefined;
116
- var cellTextColor = undefined;
117
- if ((_a = row.cellStyle) === null || _a === void 0 ? void 0 : _a[header.id]) {
118
- cellBgColor =
119
- (_d = (_c = (_b = row.cellStyle) === null || _b === void 0 ? void 0 : _b[header.id]) === null || _c === void 0 ? void 0 : _c.bg) !== null && _d !== void 0 ? _d : theme.colors.backgroundColor.light;
120
- cellTextColor =
121
- (_g = (_f = (_e = row.cellStyle) === null || _e === void 0 ? void 0 : _e[header.id]) === null || _f === void 0 ? void 0 : _f.color) !== null && _g !== void 0 ? _g : undefined;
122
- }
123
- else if (isFrozen) {
124
- cellBgColor = freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : undefined;
125
- cellTextColor = freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : undefined;
126
- }
127
- else if (index % 2 === 1) {
128
- cellBgColor = theme.colors.backgroundColor.light;
129
- }
130
- var rowBgColor = undefined;
131
- var rowTextColor = undefined;
132
- if (row.rowStyle) {
133
- rowBgColor = (_h = row.rowStyle) === null || _h === void 0 ? void 0 : _h.bg;
134
- rowTextColor = (_j = row.rowStyle) === null || _j === void 0 ? void 0 : _j.color;
135
- }
111
+ var _c = (0, table_1.TableCellCalculation)({
112
+ isFrozen: isFrozen,
113
+ columnWidths: columnWidths,
114
+ headerIndex: headerIndex,
115
+ isCheckbox: isCheckbox,
116
+ header: header,
117
+ row: row,
118
+ freezedBgColor: freezedBgColor,
119
+ index: index,
120
+ }), leftOffset = _c.leftOffset, cellBgColor = _c.cellBgColor, rowBgColor = _c.rowBgColor, cellTextColor = _c.cellTextColor, rowTextColor = _c.rowTextColor;
136
121
  return (react_2.default.createElement(react_1.Td, { maxWidth: 500, minWidth: 120, key: headerIndex + 1, onClick: function () {
137
122
  return !header.node
138
123
  ? handleRowClick(row, {
@@ -142,12 +127,12 @@ var TableBody = function (_a) {
142
127
  : null;
143
128
  }, fontSize: 14, fontWeight: 400, position: isFrozen ? "sticky" : undefined, left: isFrozen ? leftOffset : undefined, zIndex: isFrozen ? 1 : 0, backgroundColor: cellBgColor !== null && cellBgColor !== void 0 ? cellBgColor : rowBgColor, textOverflow: "ellipsis", border: noBorders
144
129
  ? "none"
145
- : "1px solid ".concat((_k = theme.colors) === null || _k === void 0 ? void 0 : _k.gray[isFrozen || isChecked ? 300 : 200]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), boxSizing: "border-box", color: cellTextColor !== null && cellTextColor !== void 0 ? cellTextColor : rowTextColor, _hover: ((_l = row.cellStyle) === null || _l === void 0 ? void 0 : _l[header.id]) || row.rowStyle
130
+ : "1px solid ".concat((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.gray[isFrozen || isChecked ? 300 : 200]), className: "columns ".concat(isFrozen ? "sticky-columns" : "scrollable-columns"), boxSizing: "border-box", color: cellTextColor !== null && cellTextColor !== void 0 ? cellTextColor : rowTextColor, _hover: ((_b = row.cellStyle) === null || _b === void 0 ? void 0 : _b[header.id]) || row.rowStyle
146
131
  ? {}
147
132
  : {
148
133
  backgroundColor: theme.colors.gray[100],
149
134
  } },
150
- react_2.default.createElement(react_1.Box, { textOverflow: "ellipsis", whiteSpace: "nowrap", display: "block", overflow: "hidden" }, header.node ? header.node(row) : row[header.id])));
135
+ react_2.default.createElement(react_1.Box, { display: "block", overflow: "hidden", whiteSpace: "normal", overflowWrap: "break-word" }, header.node ? header.node(row) : row[header.id])));
151
136
  }),
152
137
  isLink && react_2.default.createElement(RenderView, { row: row, bgcolor: freezeViewColor })),
153
138
  row.content && isExpanded && (react_2.default.createElement(react_1.Tr, null,
@@ -51,7 +51,7 @@ var TableHeader = function (_a) {
51
51
  var theme = (0, useCustomTheme_1.useCustomTheme)();
52
52
  var RenderCheckbox = (0, react_2.useCallback)(function () {
53
53
  var _a;
54
- return (react_2.default.createElement(react_1.Th, { w: 6, fontSize: 14, fontWeight: 600, color: freezedTextColor, textTransform: "capitalize", backgroundColor: freezedBgColor, border: noBorders ? "none" : "1px solid ".concat((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.gray[300]), position: "sticky", className: "columns sticky-columns", left: "0px", zIndex: 9, boxShadow: "2px 0 5px rgba(0, 0, 0, 0.1)", top: 0 },
54
+ return (react_2.default.createElement(react_1.Th, { w: 6, fontSize: 14, fontWeight: 600, color: freezedTextColor, textTransform: "capitalize", backgroundColor: freezedBgColor, border: noBorders ? "none" : "1px solid ".concat((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.gray[300]), position: "sticky", className: "columns sticky-columns", left: "0px", zIndex: 9, boxShadow: "2px 0 5px rgba(0, 0, 0, 0.1)" },
55
55
  react_2.default.createElement(react_1.Checkbox, { "aria-label": "Select all rows", colorScheme: "gray", backgroundColor: theme.colors.gray[50], borderColor: theme.colors.gray[500], variant: "outline", onChange: function () { return handleCheckbox(0); }, isChecked: isLoading ? false : checked === true, isIndeterminate: checked === "indeterminate", _hover: { transform: "scale(1.1)" } })));
56
56
  }, [
57
57
  checked,
@@ -92,7 +92,7 @@ function Table(_a) {
92
92
  isTableSettings && (react_1.default.createElement(TableSettings_1.default, { columns: columnsList, onSave: function (cols) { return handleColumnPreferences(cols); } })),
93
93
  react_1.default.createElement(react_2.TableContainer, { sx: tableContainerStyles },
94
94
  react_1.default.createElement(react_3.Table, { variant: "simple", size: "sm", overflowX: "scroll", minW: "100%", className: "table_wrapper" },
95
- react_1.default.createElement(react_3.Thead, { position: "sticky", top: 0, zIndex: 2 },
95
+ react_1.default.createElement(react_3.Thead, { position: "sticky", top: -0.5, zIndex: 2 },
96
96
  react_1.default.createElement(TableHeader_1.default, { columns: columnsList, isCheckbox: isCheckbox, headerBgColor: headerBgColor !== null && headerBgColor !== void 0 ? headerBgColor : theme.colors.backgroundColor.muted, headerTextColor: headerTextColor !== null && headerTextColor !== void 0 ? headerTextColor : (_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray[600], freezedBgColor: freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : theme.colors.backgroundColor.secondary, freezedTextColor: freezedTextColor !== null && freezedTextColor !== void 0 ? freezedTextColor : (_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray[600], handleSort: handleSort, headerRefs: headerRefs, columnWidths: columnWidths, columnsSort: columnsSort, noBorders: noBorders, handleCheckbox: handleCheckbox, isLoading: isTableLoading, checked: tableData.length !== 0 && selection.length === tableData.length
97
97
  ? true
98
98
  : selection.length === 0
@@ -1,5 +1,5 @@
1
1
  import { KaTableProps } from "../Components/KaTable/KaTableProps";
2
- import { DataObject } from "../Components/Table/TableProps";
2
+ import { DataObject, TableHeaderProps } from "../Components/Table/TableProps";
3
3
  export declare function SortMultiColumnData(data: Record<string, string | number>[], sortConfig: {
4
4
  column: string | number;
5
5
  direction: string;
@@ -10,3 +10,21 @@ export declare const calculateLeftOffset: (columns: number[], index: number) =>
10
10
  export declare const searchAndSortData: (data: DataObject[], searchValues: Record<string, string>) => DataObject[];
11
11
  export declare function debounce<T extends (...args: any[]) => void>(func: T, delay: number): (...args: Parameters<T>) => void;
12
12
  export declare const pageSizeCalculation: (records: number) => number[];
13
+ type TableCellCalculationProps = {
14
+ isFrozen?: boolean;
15
+ columnWidths: number[];
16
+ headerIndex: number;
17
+ isCheckbox?: boolean;
18
+ header: TableHeaderProps;
19
+ row: DataObject;
20
+ freezedBgColor?: string;
21
+ index: number;
22
+ };
23
+ export declare const TableCellCalculation: ({ isFrozen, columnWidths, headerIndex, isCheckbox, header, row, freezedBgColor, index, }: TableCellCalculationProps) => {
24
+ leftOffset: number;
25
+ cellBgColor: any;
26
+ rowBgColor: any;
27
+ cellTextColor: any;
28
+ rowTextColor: any;
29
+ };
30
+ export {};
@@ -9,7 +9,8 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9
9
  return to.concat(ar || Array.prototype.slice.call(from));
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.pageSizeCalculation = exports.debounce = exports.searchAndSortData = exports.calculateLeftOffset = exports.getFieldType = exports.getPreviousColumnWidth = exports.SortMultiColumnData = void 0;
12
+ exports.TableCellCalculation = exports.pageSizeCalculation = exports.debounce = exports.searchAndSortData = exports.calculateLeftOffset = exports.getFieldType = exports.getPreviousColumnWidth = exports.SortMultiColumnData = void 0;
13
+ var useCustomTheme_1 = require("../Theme/useCustomTheme");
13
14
  function SortMultiColumnData(data, sortConfig) {
14
15
  if (!sortConfig.length)
15
16
  return data;
@@ -107,3 +108,33 @@ var pageSizeCalculation = function (records) {
107
108
  return pageSize;
108
109
  };
109
110
  exports.pageSizeCalculation = pageSizeCalculation;
111
+ var TableCellCalculation = function (_a) {
112
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k;
113
+ var isFrozen = _a.isFrozen, columnWidths = _a.columnWidths, headerIndex = _a.headerIndex, isCheckbox = _a.isCheckbox, header = _a.header, row = _a.row, freezedBgColor = _a.freezedBgColor, index = _a.index;
114
+ var theme = (0, useCustomTheme_1.useCustomTheme)();
115
+ var leftOffset = isFrozen
116
+ ? (0, exports.calculateLeftOffset)(columnWidths, headerIndex) + (isCheckbox ? 50 : 0)
117
+ : 0;
118
+ var cellBgColor = undefined;
119
+ var cellTextColor = undefined;
120
+ if ((_b = row.cellStyle) === null || _b === void 0 ? void 0 : _b[header.id]) {
121
+ cellBgColor =
122
+ (_e = (_d = (_c = row.cellStyle) === null || _c === void 0 ? void 0 : _c[header.id]) === null || _d === void 0 ? void 0 : _d.bg) !== null && _e !== void 0 ? _e : theme.colors.backgroundColor.light;
123
+ cellTextColor = (_h = (_g = (_f = row.cellStyle) === null || _f === void 0 ? void 0 : _f[header.id]) === null || _g === void 0 ? void 0 : _g.color) !== null && _h !== void 0 ? _h : undefined;
124
+ }
125
+ else if (isFrozen) {
126
+ cellBgColor = freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : undefined;
127
+ cellTextColor = freezedBgColor !== null && freezedBgColor !== void 0 ? freezedBgColor : undefined;
128
+ }
129
+ else if (index % 2 === 1) {
130
+ cellBgColor = theme.colors.backgroundColor.light;
131
+ }
132
+ var rowBgColor = undefined;
133
+ var rowTextColor = undefined;
134
+ if (row.rowStyle) {
135
+ rowBgColor = (_j = row.rowStyle) === null || _j === void 0 ? void 0 : _j.bg;
136
+ rowTextColor = (_k = row.rowStyle) === null || _k === void 0 ? void 0 : _k.color;
137
+ }
138
+ return { leftOffset: leftOffset, cellBgColor: cellBgColor, rowBgColor: rowBgColor, cellTextColor: cellTextColor, rowTextColor: rowTextColor };
139
+ };
140
+ exports.TableCellCalculation = TableCellCalculation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixelize-design-library",
3
- "version": "1.1.61",
3
+ "version": "1.1.62",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",