ehscan-react-table 0.0.31 → 0.0.32
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/elements/Table.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ type TableColumn = {
|
|
|
5
5
|
search?: boolean;
|
|
6
6
|
width?: number;
|
|
7
7
|
small?: boolean;
|
|
8
|
+
important?: boolean;
|
|
8
9
|
};
|
|
9
10
|
type SortOrder = {
|
|
10
11
|
tag: string;
|
|
@@ -38,6 +39,7 @@ type Props = {
|
|
|
38
39
|
setNearBottom: (nearBottom: boolean) => void;
|
|
39
40
|
changeColumns: (args: any) => void;
|
|
40
41
|
measureCols: MeasureCol[];
|
|
42
|
+
displayImportant?: boolean;
|
|
41
43
|
};
|
|
42
44
|
export declare const Table: React.FC<Props>;
|
|
43
45
|
export {};
|
package/dist/elements/Table.js
CHANGED
|
@@ -12,7 +12,7 @@ import { useEffect, useState, useRef } from "react";
|
|
|
12
12
|
import TableCellSelectHeadCol from "./TableCellSelectHeadCol";
|
|
13
13
|
import { debounce } from "./Debounce";
|
|
14
14
|
import styles from './table.module.css';
|
|
15
|
-
export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents, setSelectedIds, searchTermArraySetter, setSearchTermArraySetter, fallback, nearBottom, setNearBottom, changeColumns, measureCols }) => {
|
|
15
|
+
export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents, setSelectedIds, searchTermArraySetter, setSearchTermArraySetter, fallback, nearBottom, setNearBottom, changeColumns, measureCols, displayImportant }) => {
|
|
16
16
|
const [wrapperBottom, setWrapperBottom] = useState(undefined);
|
|
17
17
|
const headerRef = useRef(null);
|
|
18
18
|
const scrollRef = useRef(null);
|
|
@@ -143,7 +143,9 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
|
|
|
143
143
|
: _jsx("div", { onClick: () => setOpenCol(tag), children: (_b = (_a = HeadColMainLit[colTitle]) === null || _a === void 0 ? void 0 : _a.call(HeadColMainLit, colTitle)) !== null && _b !== void 0 ? _b : colTitle }) })] }) }));
|
|
144
144
|
};
|
|
145
145
|
const HeadCols = () => {
|
|
146
|
-
return (_jsxs(_Fragment, { children: [columns
|
|
146
|
+
return (_jsxs(_Fragment, { children: [columns
|
|
147
|
+
.filter(col => !displayImportant || col.important)
|
|
148
|
+
.map((col, i) => {
|
|
147
149
|
const { tag, type, width } = col;
|
|
148
150
|
const thWidth = width !== undefined ? `${width}px` : "8px";
|
|
149
151
|
if (type === "checkbox") {
|
|
@@ -162,7 +164,9 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
|
|
|
162
164
|
const EndHeadCol = () => _jsx("th", { style: { "--custom-width": `10px` } }, 'endHeadCol');
|
|
163
165
|
const EndCol = () => _jsx("td", {}, 'endCol');
|
|
164
166
|
const TableBody = () => {
|
|
165
|
-
return (_jsx("tbody", { className: `${styles.tablebody} ${styles._tbl}`, children: rows && rows.map((row, rowIndex) => (_jsxs("tr", { className: styles.deftabletr, children: [columns
|
|
167
|
+
return (_jsx("tbody", { className: `${styles.tablebody} ${styles._tbl}`, children: rows && rows.map((row, rowIndex) => (_jsxs("tr", { className: styles.deftabletr, children: [columns
|
|
168
|
+
.filter(col => !displayImportant || col.important)
|
|
169
|
+
.map((col, ci) => {
|
|
166
170
|
var _a;
|
|
167
171
|
const type = (_a = col.type) !== null && _a !== void 0 ? _a : "def";
|
|
168
172
|
const CellComponent = cellComponents[type];
|