venice-ui 2.0.19 → 2.0.21
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/cjs/components/Table/Cell.js +3 -3
- package/dist/cjs/components/Table/Table.js +2 -2
- package/dist/cjs/components/Table/Table.styles.js +10 -8
- package/dist/esm/components/Table/Cell.js +3 -3
- package/dist/esm/components/Table/Table.js +2 -2
- package/dist/esm/components/Table/Table.styles.js +10 -8
- package/dist/types/components/Table/Cell.d.ts +1 -0
- package/dist/types/components/Table/Table.styles.d.ts +1 -0
- package/package.json +1 -1
|
@@ -10,16 +10,16 @@ const DropdownMenu_1 = require("../DropdownMenu");
|
|
|
10
10
|
const Theme_1 = require("../../Theme");
|
|
11
11
|
const date_fns_1 = require("date-fns");
|
|
12
12
|
const tableHelper_1 = require("./tableHelper");
|
|
13
|
-
const Cell = ({ header, theme = Theme_1.mainTheme, moreActions, item, }) => {
|
|
13
|
+
const Cell = ({ header, theme = Theme_1.mainTheme, moreActions, item, marked = false, }) => {
|
|
14
14
|
if (header.action) {
|
|
15
15
|
return (react_1.default.createElement(Table_styles_1.OptionTableCell, null,
|
|
16
16
|
react_1.default.createElement(Table_styles_1.OptionTableCellWrapper, { onClick: (e) => e.stopPropagation() },
|
|
17
17
|
react_1.default.createElement(DropdownMenu_1.DropdownMenu, { options: moreActions, targetID: item.id, iconName: "more_vert", iconColor: theme.tableMoreIconColor, iconHoverColor: theme.tableHoverMoreIconColor, iconBgHoverColor: "transparent", position: "right" }))));
|
|
18
18
|
}
|
|
19
19
|
if (header.scope) {
|
|
20
|
-
return (react_1.default.createElement(Table_styles_1.TableCell,
|
|
20
|
+
return (react_1.default.createElement(Table_styles_1.TableCell, { marked: marked }, (0, tableHelper_1.getValueFormScope)(item[header.valueSource], header.scope)));
|
|
21
21
|
}
|
|
22
|
-
return (react_1.default.createElement(Table_styles_1.TableCell,
|
|
22
|
+
return (react_1.default.createElement(Table_styles_1.TableCell, { marked: marked }, header.date
|
|
23
23
|
? (0, date_fns_1.format)(item[header.valueSource], 'dd-MM-yyyy')
|
|
24
24
|
: header.isCount
|
|
25
25
|
? item[header.valueSource].length
|
|
@@ -78,8 +78,8 @@ const Table = ({ theme = Theme_1.mainTheme, headers, elements, hover = true, sel
|
|
|
78
78
|
react_1.default.createElement(Table_styles_1.TableWrapper, { cellPadding: "0", cellSpacing: "0" },
|
|
79
79
|
react_1.default.createElement(Table_styles_1.TableHead, null,
|
|
80
80
|
react_1.default.createElement(Table_styles_1.TableRow, { hover: false, selectable: false, active: false }, tableProps.headers.map((header) => (react_1.default.createElement(HeaderCell_1.HeaderCell, { key: `header_${header.name}`, header: header, sortable: sortable, handleSort: handleHeaderCellClick, sort: tableProps.sort }))))),
|
|
81
|
-
react_1.default.createElement("tbody", null, tableProps.elements.map((item) => (react_1.default.createElement(Table_styles_1.TableRow, { key: `table_row_${item.id}`, hover: hover, active: selectedRow === item.id, selectable: selectable, onClick: () => handleRowClick(item.id) }, tableProps.headers.map((header) => {
|
|
82
|
-
return (react_1.default.createElement(Cell_1.Cell, { key: `cell_${header.name}_${item.id}`, header: header, moreActions: moreActions, item: item, theme: theme }));
|
|
81
|
+
react_1.default.createElement("tbody", null, tableProps.elements.map((item) => (react_1.default.createElement(Table_styles_1.TableRow, { key: `table_row_${item.id}`, hover: hover, active: selectedRow === item.id, selectable: selectable, onClick: () => handleRowClick(item.id) }, tableProps.headers.map((header, index) => {
|
|
82
|
+
return (react_1.default.createElement(Cell_1.Cell, { key: `cell_${header.name}_${item.id}`, header: header, moreActions: moreActions, item: item, theme: theme, marked: item.marked && index === 0 }));
|
|
83
83
|
}))))))));
|
|
84
84
|
};
|
|
85
85
|
exports.Table = Table;
|
|
@@ -12,7 +12,7 @@ exports.TableHead = styled_components_1.default.thead `
|
|
|
12
12
|
tr:first-child {
|
|
13
13
|
position: sticky;
|
|
14
14
|
top: 0;
|
|
15
|
-
z-index:10;
|
|
15
|
+
z-index: 10;
|
|
16
16
|
}
|
|
17
17
|
`;
|
|
18
18
|
exports.TableHeaderCell = styled_components_1.default.th `
|
|
@@ -21,11 +21,9 @@ exports.TableHeaderCell = styled_components_1.default.th `
|
|
|
21
21
|
padding: 8px;
|
|
22
22
|
transition: 300ms;
|
|
23
23
|
font-size: 14px;
|
|
24
|
-
color
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.14);
|
|
28
|
-
position:relative;
|
|
24
|
+
color: ${(p) => (p.isSorted ? p.theme.tableHeaderActive : p.theme.text)};
|
|
25
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.14);
|
|
26
|
+
position: relative;
|
|
29
27
|
`;
|
|
30
28
|
exports.OptionTableHeaderCell = styled_components_1.default.th `
|
|
31
29
|
font-weight: bold;
|
|
@@ -34,7 +32,7 @@ exports.OptionTableHeaderCell = styled_components_1.default.th `
|
|
|
34
32
|
transition: 300ms;
|
|
35
33
|
font-size: 14px;
|
|
36
34
|
background-color: ${(p) => p.theme.tableHeaderBackground};
|
|
37
|
-
border-bottom:
|
|
35
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.14);
|
|
38
36
|
`;
|
|
39
37
|
exports.TableRow = styled_components_1.default.tr `
|
|
40
38
|
background-color: ${(p) => p.active
|
|
@@ -59,7 +57,11 @@ exports.TableRow = styled_components_1.default.tr `
|
|
|
59
57
|
`;
|
|
60
58
|
exports.TableCell = styled_components_1.default.td `
|
|
61
59
|
padding: 8px;
|
|
62
|
-
|
|
60
|
+
${(p) => p.marked &&
|
|
61
|
+
`
|
|
62
|
+
border-left:2px solid ${p.theme.action};
|
|
63
|
+
padding-left:6px;
|
|
64
|
+
`}
|
|
63
65
|
`;
|
|
64
66
|
exports.OptionTableCell = styled_components_1.default.td `
|
|
65
67
|
text-align: center;
|
|
@@ -4,16 +4,16 @@ import { DropdownMenu } from '../DropdownMenu';
|
|
|
4
4
|
import { mainTheme } from '../../Theme';
|
|
5
5
|
import { format } from 'date-fns';
|
|
6
6
|
import { getValueFormScope } from './tableHelper';
|
|
7
|
-
export const Cell = ({ header, theme = mainTheme, moreActions, item, }) => {
|
|
7
|
+
export const Cell = ({ header, theme = mainTheme, moreActions, item, marked = false, }) => {
|
|
8
8
|
if (header.action) {
|
|
9
9
|
return (React.createElement(OptionTableCell, null,
|
|
10
10
|
React.createElement(OptionTableCellWrapper, { onClick: (e) => e.stopPropagation() },
|
|
11
11
|
React.createElement(DropdownMenu, { options: moreActions, targetID: item.id, iconName: "more_vert", iconColor: theme.tableMoreIconColor, iconHoverColor: theme.tableHoverMoreIconColor, iconBgHoverColor: "transparent", position: "right" }))));
|
|
12
12
|
}
|
|
13
13
|
if (header.scope) {
|
|
14
|
-
return (React.createElement(TableCell,
|
|
14
|
+
return (React.createElement(TableCell, { marked: marked }, getValueFormScope(item[header.valueSource], header.scope)));
|
|
15
15
|
}
|
|
16
|
-
return (React.createElement(TableCell,
|
|
16
|
+
return (React.createElement(TableCell, { marked: marked }, header.date
|
|
17
17
|
? format(item[header.valueSource], 'dd-MM-yyyy')
|
|
18
18
|
: header.isCount
|
|
19
19
|
? item[header.valueSource].length
|
|
@@ -52,7 +52,7 @@ export const Table = ({ theme = mainTheme, headers, elements, hover = true, sele
|
|
|
52
52
|
React.createElement(TableWrapper, { cellPadding: "0", cellSpacing: "0" },
|
|
53
53
|
React.createElement(TableHead, null,
|
|
54
54
|
React.createElement(TableRow, { hover: false, selectable: false, active: false }, tableProps.headers.map((header) => (React.createElement(HeaderCell, { key: `header_${header.name}`, header: header, sortable: sortable, handleSort: handleHeaderCellClick, sort: tableProps.sort }))))),
|
|
55
|
-
React.createElement("tbody", null, tableProps.elements.map((item) => (React.createElement(TableRow, { key: `table_row_${item.id}`, hover: hover, active: selectedRow === item.id, selectable: selectable, onClick: () => handleRowClick(item.id) }, tableProps.headers.map((header) => {
|
|
56
|
-
return (React.createElement(Cell, { key: `cell_${header.name}_${item.id}`, header: header, moreActions: moreActions, item: item, theme: theme }));
|
|
55
|
+
React.createElement("tbody", null, tableProps.elements.map((item) => (React.createElement(TableRow, { key: `table_row_${item.id}`, hover: hover, active: selectedRow === item.id, selectable: selectable, onClick: () => handleRowClick(item.id) }, tableProps.headers.map((header, index) => {
|
|
56
|
+
return (React.createElement(Cell, { key: `cell_${header.name}_${item.id}`, header: header, moreActions: moreActions, item: item, theme: theme, marked: item.marked && index === 0 }));
|
|
57
57
|
}))))))));
|
|
58
58
|
};
|
|
@@ -6,7 +6,7 @@ export const TableHead = styled.thead `
|
|
|
6
6
|
tr:first-child {
|
|
7
7
|
position: sticky;
|
|
8
8
|
top: 0;
|
|
9
|
-
z-index:10;
|
|
9
|
+
z-index: 10;
|
|
10
10
|
}
|
|
11
11
|
`;
|
|
12
12
|
export const TableHeaderCell = styled.th `
|
|
@@ -15,11 +15,9 @@ export const TableHeaderCell = styled.th `
|
|
|
15
15
|
padding: 8px;
|
|
16
16
|
transition: 300ms;
|
|
17
17
|
font-size: 14px;
|
|
18
|
-
color
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.14);
|
|
22
|
-
position:relative;
|
|
18
|
+
color: ${(p) => (p.isSorted ? p.theme.tableHeaderActive : p.theme.text)};
|
|
19
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.14);
|
|
20
|
+
position: relative;
|
|
23
21
|
`;
|
|
24
22
|
export const OptionTableHeaderCell = styled.th `
|
|
25
23
|
font-weight: bold;
|
|
@@ -28,7 +26,7 @@ export const OptionTableHeaderCell = styled.th `
|
|
|
28
26
|
transition: 300ms;
|
|
29
27
|
font-size: 14px;
|
|
30
28
|
background-color: ${(p) => p.theme.tableHeaderBackground};
|
|
31
|
-
border-bottom:
|
|
29
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.14);
|
|
32
30
|
`;
|
|
33
31
|
export const TableRow = styled.tr `
|
|
34
32
|
background-color: ${(p) => p.active
|
|
@@ -53,7 +51,11 @@ export const TableRow = styled.tr `
|
|
|
53
51
|
`;
|
|
54
52
|
export const TableCell = styled.td `
|
|
55
53
|
padding: 8px;
|
|
56
|
-
|
|
54
|
+
${(p) => p.marked &&
|
|
55
|
+
`
|
|
56
|
+
border-left:2px solid ${p.theme.action};
|
|
57
|
+
padding-left:6px;
|
|
58
|
+
`}
|
|
57
59
|
`;
|
|
58
60
|
export const OptionTableCell = styled.td `
|
|
59
61
|
text-align: center;
|
|
@@ -17,6 +17,7 @@ interface ITableRowProps {
|
|
|
17
17
|
export declare const TableRow: import("styled-components").StyledComponent<"tr", any, ITableRowProps, never>;
|
|
18
18
|
interface ITableCellProps {
|
|
19
19
|
theme: any;
|
|
20
|
+
marked: boolean;
|
|
20
21
|
}
|
|
21
22
|
export declare const TableCell: import("styled-components").StyledComponent<"td", any, ITableCellProps, never>;
|
|
22
23
|
export declare const OptionTableCell: import("styled-components").StyledComponent<"td", any, {}, never>;
|