venice-ui 2.2.9 → 2.2.10
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.
|
@@ -13,7 +13,7 @@ const Icons_1 = require("../Icons");
|
|
|
13
13
|
const Theme_1 = require("../../Theme");
|
|
14
14
|
const Table_styles_1 = require("../Table/Table.styles");
|
|
15
15
|
const DropdownMenu_1 = require("../DropdownMenu");
|
|
16
|
-
const List = ({ isCheckbox = false, isCollapsable = false, isSelectable = false, haveMoreOptions = false, items, handleChange, handleSelect, selected, theme = Theme_1.mainTheme,
|
|
16
|
+
const List = ({ isCheckbox = false, isCollapsable = false, isSelectable = false, haveMoreOptions = false, items, handleChange, handleSelect, selected, theme = Theme_1.mainTheme, levelActions = [], }) => {
|
|
17
17
|
const updateItem = (items, rowID, updater) => {
|
|
18
18
|
items.forEach((_item) => {
|
|
19
19
|
if (_item.id === rowID) {
|
|
@@ -106,9 +106,9 @@ const List = ({ isCheckbox = false, isCollapsable = false, isSelectable = false,
|
|
|
106
106
|
isCheckbox && (react_1.default.createElement("div", { onClick: (e) => e.stopPropagation() },
|
|
107
107
|
react_1.default.createElement(Checkbox_1.Checkbox, { handleClick: () => handleClick(row), value: getValue(row), isIntermedian: getIntermedian(row), size: "small" }))),
|
|
108
108
|
react_1.default.createElement(list_styles_1.ListText, { selected: isSelectable && selected ? selected === row.id : false }, row.value),
|
|
109
|
-
haveMoreOptions && (react_1.default.createElement(list_styles_1.MoreWrapper, null,
|
|
109
|
+
haveMoreOptions && levelActions[level]?.moreActions && (react_1.default.createElement(list_styles_1.MoreWrapper, null,
|
|
110
110
|
react_1.default.createElement(Table_styles_1.OptionTableCellWrapper, { onClick: (e) => e.stopPropagation() },
|
|
111
|
-
react_1.default.createElement(DropdownMenu_1.DropdownMenu, { options: moreActions, targetID: row.id, iconName: "more_vert", iconColor: theme.tableMoreIconColor, iconHoverColor: theme.tableHoverMoreIconColor, iconBgHoverColor: "transparent", position: "right" }))))),
|
|
111
|
+
react_1.default.createElement(DropdownMenu_1.DropdownMenu, { options: levelActions[level]?.moreActions || [], targetID: row.id, iconName: "more_vert", iconColor: theme.tableMoreIconColor, iconHoverColor: theme.tableHoverMoreIconColor, iconBgHoverColor: "transparent", position: "right" }))))),
|
|
112
112
|
row.extend && row.children.length > 0 && (react_1.default.createElement(list_styles_1.ListRowExtend, null, row.children.map((_chiledRow) => {
|
|
113
113
|
return gerenrateRow(_chiledRow, level + 1);
|
|
114
114
|
})))));
|
|
@@ -7,7 +7,7 @@ import { Icon } from '../Icons';
|
|
|
7
7
|
import { mainTheme } from '../../Theme';
|
|
8
8
|
import { OptionTableCellWrapper } from '../Table/Table.styles';
|
|
9
9
|
import { DropdownMenu } from '../DropdownMenu';
|
|
10
|
-
export const List = ({ isCheckbox = false, isCollapsable = false, isSelectable = false, haveMoreOptions = false, items, handleChange, handleSelect, selected, theme = mainTheme,
|
|
10
|
+
export const List = ({ isCheckbox = false, isCollapsable = false, isSelectable = false, haveMoreOptions = false, items, handleChange, handleSelect, selected, theme = mainTheme, levelActions = [], }) => {
|
|
11
11
|
const updateItem = (items, rowID, updater) => {
|
|
12
12
|
items.forEach((_item) => {
|
|
13
13
|
if (_item.id === rowID) {
|
|
@@ -100,9 +100,9 @@ export const List = ({ isCheckbox = false, isCollapsable = false, isSelectable =
|
|
|
100
100
|
isCheckbox && (React.createElement("div", { onClick: (e) => e.stopPropagation() },
|
|
101
101
|
React.createElement(Checkbox, { handleClick: () => handleClick(row), value: getValue(row), isIntermedian: getIntermedian(row), size: "small" }))),
|
|
102
102
|
React.createElement(ListText, { selected: isSelectable && selected ? selected === row.id : false }, row.value),
|
|
103
|
-
haveMoreOptions && (React.createElement(MoreWrapper, null,
|
|
103
|
+
haveMoreOptions && levelActions[level]?.moreActions && (React.createElement(MoreWrapper, null,
|
|
104
104
|
React.createElement(OptionTableCellWrapper, { onClick: (e) => e.stopPropagation() },
|
|
105
|
-
React.createElement(DropdownMenu, { options: moreActions, targetID: row.id, iconName: "more_vert", iconColor: theme.tableMoreIconColor, iconHoverColor: theme.tableHoverMoreIconColor, iconBgHoverColor: "transparent", position: "right" }))))),
|
|
105
|
+
React.createElement(DropdownMenu, { options: levelActions[level]?.moreActions || [], targetID: row.id, iconName: "more_vert", iconColor: theme.tableMoreIconColor, iconHoverColor: theme.tableHoverMoreIconColor, iconBgHoverColor: "transparent", position: "right" }))))),
|
|
106
106
|
row.extend && row.children.length > 0 && (React.createElement(ListRowExtend, null, row.children.map((_chiledRow) => {
|
|
107
107
|
return gerenrateRow(_chiledRow, level + 1);
|
|
108
108
|
})))));
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { IAction } from 'types/';
|
|
3
|
+
export interface ILevelAction {
|
|
4
|
+
level: number;
|
|
5
|
+
moreActions: IAction[];
|
|
6
|
+
}
|
|
3
7
|
export interface IListProps {
|
|
4
8
|
items: IListItem[];
|
|
5
9
|
handleChange: (items: IListItem[]) => void;
|
|
@@ -10,7 +14,7 @@ export interface IListProps {
|
|
|
10
14
|
isSelectable?: boolean;
|
|
11
15
|
haveMoreOptions?: boolean;
|
|
12
16
|
theme?: any;
|
|
13
|
-
|
|
17
|
+
levelActions: ILevelAction[];
|
|
14
18
|
}
|
|
15
19
|
export interface IListItem {
|
|
16
20
|
id: string;
|