venice-ui 2.3.0 → 2.3.1
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/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/cjs/components/Table/Cell.js +7 -4
- package/dist/cjs/components/Table/Table.js +5 -3
- package/dist/cjs/components/Table/Table.styles.js +3 -0
- package/dist/esm/components/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/esm/components/Table/Cell.js +7 -4
- package/dist/esm/components/Table/Table.js +5 -3
- package/dist/esm/components/Table/Table.styles.js +3 -0
- package/dist/types/components/Table/Cell.d.ts +1 -0
- package/dist/types/components/Table/Table.styles.d.ts +1 -0
- package/dist/types/types/commonTypes.d.ts +1 -1
- package/package.json +1 -1
|
@@ -125,7 +125,7 @@ const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', header = false,
|
|
|
125
125
|
headerTitle && (react_1.default.createElement(Typography_1.TextAccent, { color: Theme_1.Theme.colors.text }, headerTitle)),
|
|
126
126
|
headerSubtitle && (react_1.default.createElement(Typography_1.TextLabel, { color: Theme_1.Theme.colors.text }, headerSubtitle)))),
|
|
127
127
|
react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuContent, null, options &&
|
|
128
|
-
options.map((option) => (react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuOption, { key: option.label, isDisable: isDisable(option.disableID, option.
|
|
128
|
+
options.map((option) => (react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuOption, { key: option.label, isDisable: isDisable(option.disableID, option.disabled), onClick: () => handleClick(option.action, option.disabled ? option.disabled : false, option.disableID), isActive: option.isActive }, option.label)))),
|
|
129
129
|
footer && (react_1.default.createElement(DropdownMenu_styles_1.DropdownMenuFooter, null, footerText && (react_1.default.createElement(Typography_1.Text, { action: true, onClick: handleFooterAction }, footerText)))))), document.body)));
|
|
130
130
|
};
|
|
131
131
|
exports.DropdownMenu = DropdownMenu;
|
|
@@ -10,16 +10,19 @@ 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, marked = false, }) => {
|
|
13
|
+
const Cell = ({ header, theme = Theme_1.mainTheme, moreActions, item, marked = false, isDisabled = false, }) => {
|
|
14
14
|
if (header.action) {
|
|
15
|
+
const cellAction = item.disabled
|
|
16
|
+
? moreActions.map((a) => ({ ...a, disabled: true }))
|
|
17
|
+
: moreActions.map((a) => ({ ...a }));
|
|
15
18
|
return (react_1.default.createElement(Table_styles_1.OptionTableCell, null,
|
|
16
19
|
react_1.default.createElement(Table_styles_1.OptionTableCellWrapper, { onClick: (e) => e.stopPropagation() },
|
|
17
|
-
react_1.default.createElement(DropdownMenu_1.DropdownMenu, { options:
|
|
20
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, { options: cellAction, targetID: item.id, iconName: "more_vert", iconColor: theme.tableMoreIconColor, iconHoverColor: theme.tableHoverMoreIconColor, iconBgHoverColor: "transparent", position: "right" }))));
|
|
18
21
|
}
|
|
19
22
|
if (header.scope) {
|
|
20
|
-
return (react_1.default.createElement(Table_styles_1.TableCell, { marked: marked }, (0, tableHelper_1.getValueFormScope)(item[header.valueSource], header.scope)));
|
|
23
|
+
return (react_1.default.createElement(Table_styles_1.TableCell, { marked: marked, disabled: isDisabled }, (0, tableHelper_1.getValueFormScope)(item[header.valueSource], header.scope)));
|
|
21
24
|
}
|
|
22
|
-
return (react_1.default.createElement(Table_styles_1.TableCell, { marked: marked }, header.date
|
|
25
|
+
return (react_1.default.createElement(Table_styles_1.TableCell, { marked: marked, disabled: isDisabled }, header.date
|
|
23
26
|
? item[header.valueSource] !== undefined
|
|
24
27
|
? (0, date_fns_1.format)(item[header.valueSource], 'dd-MM-yyyy')
|
|
25
28
|
: ''
|
|
@@ -87,9 +87,11 @@ const Table = ({ theme = Theme_1.mainTheme, headers, elements, hover = true, sel
|
|
|
87
87
|
react_1.default.createElement(Table_styles_1.TableWrapper, { cellPadding: "0", cellSpacing: "0" },
|
|
88
88
|
react_1.default.createElement(Table_styles_1.TableHead, null,
|
|
89
89
|
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 }))))),
|
|
90
|
-
react_1.default.createElement("tbody", null, paginatedElements.map((item) =>
|
|
91
|
-
return (react_1.default.createElement(
|
|
92
|
-
|
|
90
|
+
react_1.default.createElement("tbody", null, paginatedElements.map((item) => {
|
|
91
|
+
return (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) => {
|
|
92
|
+
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, isDisabled: item.disabled }));
|
|
93
|
+
})));
|
|
94
|
+
}))),
|
|
93
95
|
ifPagination && (react_1.default.createElement(Pagination_1.Pagination, { currentPage: currentPage, totalPages: totalPages, pageSize: currentPageSize, onPageChange: setCurrentPage, onPageSizeChange: setCurrentPageSize }))));
|
|
94
96
|
};
|
|
95
97
|
exports.Table = Table;
|
|
@@ -62,6 +62,9 @@ exports.TableCell = styled_components_1.default.td `
|
|
|
62
62
|
border-left:2px solid ${p.theme.action};
|
|
63
63
|
padding-left:6px;
|
|
64
64
|
`}
|
|
65
|
+
${p => p.disabled && `
|
|
66
|
+
color: ${p.theme.inputDisabledTextColor}!important;
|
|
67
|
+
`}
|
|
65
68
|
`;
|
|
66
69
|
exports.OptionTableCell = styled_components_1.default.td `
|
|
67
70
|
text-align: center;
|
|
@@ -99,6 +99,6 @@ export const DropdownMenu = ({ size = 'medium', iconName = 'more_vert', header =
|
|
|
99
99
|
headerTitle && (React.createElement(TextAccent, { color: Theme.colors.text }, headerTitle)),
|
|
100
100
|
headerSubtitle && (React.createElement(TextLabel, { color: Theme.colors.text }, headerSubtitle)))),
|
|
101
101
|
React.createElement(DropdownMenuContent, null, options &&
|
|
102
|
-
options.map((option) => (React.createElement(DropdownMenuOption, { key: option.label, isDisable: isDisable(option.disableID, option.
|
|
102
|
+
options.map((option) => (React.createElement(DropdownMenuOption, { key: option.label, isDisable: isDisable(option.disableID, option.disabled), onClick: () => handleClick(option.action, option.disabled ? option.disabled : false, option.disableID), isActive: option.isActive }, option.label)))),
|
|
103
103
|
footer && (React.createElement(DropdownMenuFooter, null, footerText && (React.createElement(Text, { action: true, onClick: handleFooterAction }, footerText)))))), document.body)));
|
|
104
104
|
};
|
|
@@ -4,16 +4,19 @@ 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, marked = false, }) => {
|
|
7
|
+
export const Cell = ({ header, theme = mainTheme, moreActions, item, marked = false, isDisabled = false, }) => {
|
|
8
8
|
if (header.action) {
|
|
9
|
+
const cellAction = item.disabled
|
|
10
|
+
? moreActions.map((a) => ({ ...a, disabled: true }))
|
|
11
|
+
: moreActions.map((a) => ({ ...a }));
|
|
9
12
|
return (React.createElement(OptionTableCell, null,
|
|
10
13
|
React.createElement(OptionTableCellWrapper, { onClick: (e) => e.stopPropagation() },
|
|
11
|
-
React.createElement(DropdownMenu, { options:
|
|
14
|
+
React.createElement(DropdownMenu, { options: cellAction, targetID: item.id, iconName: "more_vert", iconColor: theme.tableMoreIconColor, iconHoverColor: theme.tableHoverMoreIconColor, iconBgHoverColor: "transparent", position: "right" }))));
|
|
12
15
|
}
|
|
13
16
|
if (header.scope) {
|
|
14
|
-
return (React.createElement(TableCell, { marked: marked }, getValueFormScope(item[header.valueSource], header.scope)));
|
|
17
|
+
return (React.createElement(TableCell, { marked: marked, disabled: isDisabled }, getValueFormScope(item[header.valueSource], header.scope)));
|
|
15
18
|
}
|
|
16
|
-
return (React.createElement(TableCell, { marked: marked }, header.date
|
|
19
|
+
return (React.createElement(TableCell, { marked: marked, disabled: isDisabled }, header.date
|
|
17
20
|
? item[header.valueSource] !== undefined
|
|
18
21
|
? format(item[header.valueSource], 'dd-MM-yyyy')
|
|
19
22
|
: ''
|
|
@@ -61,8 +61,10 @@ export const Table = ({ theme = mainTheme, headers, elements, hover = true, sele
|
|
|
61
61
|
React.createElement(TableWrapper, { cellPadding: "0", cellSpacing: "0" },
|
|
62
62
|
React.createElement(TableHead, null,
|
|
63
63
|
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 }))))),
|
|
64
|
-
React.createElement("tbody", null, paginatedElements.map((item) =>
|
|
65
|
-
return (React.createElement(
|
|
66
|
-
|
|
64
|
+
React.createElement("tbody", null, paginatedElements.map((item) => {
|
|
65
|
+
return (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) => {
|
|
66
|
+
return (React.createElement(Cell, { key: `cell_${header.name}_${item.id}`, header: header, moreActions: moreActions, item: item, theme: theme, marked: item.marked && index === 0, isDisabled: item.disabled }));
|
|
67
|
+
})));
|
|
68
|
+
}))),
|
|
67
69
|
ifPagination && (React.createElement(Pagination, { currentPage: currentPage, totalPages: totalPages, pageSize: currentPageSize, onPageChange: setCurrentPage, onPageSizeChange: setCurrentPageSize }))));
|
|
68
70
|
};
|
|
@@ -56,6 +56,9 @@ export const TableCell = styled.td `
|
|
|
56
56
|
border-left:2px solid ${p.theme.action};
|
|
57
57
|
padding-left:6px;
|
|
58
58
|
`}
|
|
59
|
+
${p => p.disabled && `
|
|
60
|
+
color: ${p.theme.inputDisabledTextColor}!important;
|
|
61
|
+
`}
|
|
59
62
|
`;
|
|
60
63
|
export const OptionTableCell = styled.td `
|
|
61
64
|
text-align: center;
|
|
@@ -18,6 +18,7 @@ export declare const TableRow: import("styled-components").StyledComponent<"tr",
|
|
|
18
18
|
interface ITableCellProps {
|
|
19
19
|
theme: any;
|
|
20
20
|
marked: boolean;
|
|
21
|
+
disabled: boolean;
|
|
21
22
|
}
|
|
22
23
|
export declare const TableCell: import("styled-components").StyledComponent<"td", any, ITableCellProps, never>;
|
|
23
24
|
export declare const OptionTableCell: import("styled-components").StyledComponent<"td", any, {}, never>;
|