venice-ui 3.0.59 → 3.0.61
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.
|
@@ -46,10 +46,11 @@ const HeaderCell_1 = require("./HeaderCell");
|
|
|
46
46
|
const Cell_1 = require("./Cell");
|
|
47
47
|
const SearchInput_1 = require("../SearchInput");
|
|
48
48
|
const PageSize_1 = require("../PageSize");
|
|
49
|
+
const EMPTY_ACTIONS = [];
|
|
49
50
|
const Table = ({ theme, themeVariant = 'default', headers, elements, hover = true, selectable = true, filtrable = false, pagination = false, sortable = true, sort = {
|
|
50
51
|
name: '',
|
|
51
52
|
order: 'none',
|
|
52
|
-
}, pageSize = 20, moreActions =
|
|
53
|
+
}, pageSize = 20, moreActions = EMPTY_ACTIONS, onRowClick, filterLabels, pageSizeAvailableValues, tableHeight, tableWrapperHeight, paginationLabel, calendarLabels, calendarLocaleLabels, paginationZIndex, headerExtraContent, searchable = true, searchInputPlaceholder = config_2.wordbook.searchInput.placeholder, noResultsText = config_2.wordbook.table.filterEmptyState, emptyStateText = config_2.wordbook.table.emptyState, }) => {
|
|
53
54
|
const resolvedThemeData = (0, config_1.resolveThemeWithComponentsConfig)({
|
|
54
55
|
theme,
|
|
55
56
|
themeVariant,
|
|
@@ -186,9 +187,9 @@ const Table = ({ theme, themeVariant = 'default', headers, elements, hover = tru
|
|
|
186
187
|
react_1.default.createElement(Table_styles_1.TableHeaderRow, { theme: resolvedTheme, config: tableConfig }, tableHeaders.map((header) => (react_1.default.createElement(HeaderCell_1.HeaderCell, { key: `header_${header.name}`, header: header, sortable: sortable, handleSort: handleHeaderCellClick, sort: tableSort, size: header.size || 'md' }))))),
|
|
187
188
|
react_1.default.createElement(Table_styles_1.TableBody, null, visibleElements.map((item) => (react_1.default.createElement(Table_styles_1.TableRow, { theme: resolvedTheme, config: tableConfig, key: `table_row_${item.id}`, hover: hover, isDisabled: item.disabled, active: selectedRow === item.id, selectable: selectable, onClick: !item.disabled
|
|
188
189
|
? () => handleRowClick(item.id)
|
|
189
|
-
: undefined }, tableHeaders.map((header, index) => (react_1.default.createElement(Cell_1.Cell, { key: `cell_${header.name}_${item.id}`, header: header, moreActions: moreActions, item: item, theme: theme, selected: item.marked && index === 0, isDisabled: item.disabled }))))))),
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
: undefined }, tableHeaders.map((header, index) => (react_1.default.createElement(Cell_1.Cell, { key: `cell_${header.name}_${item.id}`, header: header, moreActions: moreActions, item: item, theme: theme, selected: item.marked && index === 0, isDisabled: item.disabled })))))))),
|
|
191
|
+
pagination && totalPages > 1 && visibleElements.length > 0 && (react_1.default.createElement(Table_styles_1.TableFooter, null,
|
|
192
|
+
react_1.default.createElement(Pagination_1.Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: setCurrentPage }))),
|
|
192
193
|
noResultsMessage && (react_1.default.createElement(Table_styles_1.TableEmptyState, { theme: resolvedTheme, config: tableConfig }, noResultsMessage)))))));
|
|
193
194
|
};
|
|
194
195
|
exports.Table = Table;
|
|
@@ -220,7 +220,7 @@ exports.TableEmptyState = styled_components_1.default.div `
|
|
|
220
220
|
padding: 0 ${({ theme, config }) => config.size.cell.common.paddingX}px;
|
|
221
221
|
background-color: ${({ theme, config }) => config.color.default.common.background};
|
|
222
222
|
height: ${({ theme, config }) => config.size.header.height}px;
|
|
223
|
-
top:45px;
|
|
223
|
+
top: 45px;
|
|
224
224
|
box-sizing: border-box;
|
|
225
225
|
`;
|
|
226
226
|
exports.TableFooter = styled_components_1.default.div `
|
|
@@ -10,10 +10,11 @@ import { HeaderCell } from './HeaderCell';
|
|
|
10
10
|
import { Cell } from './Cell';
|
|
11
11
|
import { SearchInput } from '../SearchInput';
|
|
12
12
|
import { PageSize } from '../PageSize';
|
|
13
|
+
const EMPTY_ACTIONS = [];
|
|
13
14
|
export const Table = ({ theme, themeVariant = 'default', headers, elements, hover = true, selectable = true, filtrable = false, pagination = false, sortable = true, sort = {
|
|
14
15
|
name: '',
|
|
15
16
|
order: 'none',
|
|
16
|
-
}, pageSize = 20, moreActions =
|
|
17
|
+
}, pageSize = 20, moreActions = EMPTY_ACTIONS, onRowClick, filterLabels, pageSizeAvailableValues, tableHeight, tableWrapperHeight, paginationLabel, calendarLabels, calendarLocaleLabels, paginationZIndex, headerExtraContent, searchable = true, searchInputPlaceholder = wordbook.searchInput.placeholder, noResultsText = wordbook.table.filterEmptyState, emptyStateText = wordbook.table.emptyState, }) => {
|
|
17
18
|
const resolvedThemeData = resolveThemeWithComponentsConfig({
|
|
18
19
|
theme,
|
|
19
20
|
themeVariant,
|
|
@@ -150,8 +151,8 @@ export const Table = ({ theme, themeVariant = 'default', headers, elements, hove
|
|
|
150
151
|
React.createElement(TableHeaderRow, { theme: resolvedTheme, config: tableConfig }, tableHeaders.map((header) => (React.createElement(HeaderCell, { key: `header_${header.name}`, header: header, sortable: sortable, handleSort: handleHeaderCellClick, sort: tableSort, size: header.size || 'md' }))))),
|
|
151
152
|
React.createElement(TableBody, null, visibleElements.map((item) => (React.createElement(TableRow, { theme: resolvedTheme, config: tableConfig, key: `table_row_${item.id}`, hover: hover, isDisabled: item.disabled, active: selectedRow === item.id, selectable: selectable, onClick: !item.disabled
|
|
152
153
|
? () => handleRowClick(item.id)
|
|
153
|
-
: undefined }, tableHeaders.map((header, index) => (React.createElement(Cell, { key: `cell_${header.name}_${item.id}`, header: header, moreActions: moreActions, item: item, theme: theme, selected: item.marked && index === 0, isDisabled: item.disabled }))))))),
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
: undefined }, tableHeaders.map((header, index) => (React.createElement(Cell, { key: `cell_${header.name}_${item.id}`, header: header, moreActions: moreActions, item: item, theme: theme, selected: item.marked && index === 0, isDisabled: item.disabled })))))))),
|
|
155
|
+
pagination && totalPages > 1 && visibleElements.length > 0 && (React.createElement(TableFooter, null,
|
|
156
|
+
React.createElement(Pagination, { currentPage: currentPage, totalPages: totalPages, onPageChange: setCurrentPage }))),
|
|
156
157
|
noResultsMessage && (React.createElement(TableEmptyState, { theme: resolvedTheme, config: tableConfig }, noResultsMessage)))))));
|
|
157
158
|
};
|
|
@@ -214,7 +214,7 @@ export const TableEmptyState = styled.div `
|
|
|
214
214
|
padding: 0 ${({ theme, config }) => config.size.cell.common.paddingX}px;
|
|
215
215
|
background-color: ${({ theme, config }) => config.color.default.common.background};
|
|
216
216
|
height: ${({ theme, config }) => config.size.header.height}px;
|
|
217
|
-
top:45px;
|
|
217
|
+
top: 45px;
|
|
218
218
|
box-sizing: border-box;
|
|
219
219
|
`;
|
|
220
220
|
export const TableFooter = styled.div `
|