superdesk-ui-framework 3.0.1-beta.6 → 3.0.1-beta.8
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/app/fonts/sd_icons.eot +0 -0
- package/app/fonts/sd_icons.svg +14 -7
- package/app/fonts/sd_icons.ttf +0 -0
- package/app/fonts/sd_icons.woff +0 -0
- package/app/styles/_icon-font.scss +7 -0
- package/app/styles/_sd-tag-input.scss +1 -0
- package/app/styles/components/_sd-grid-item.scss +30 -16
- package/app/styles/components/_sd-searchbar.scss +7 -0
- package/app/styles/design-tokens/_design-tokens-general.scss +1 -1
- package/app/styles/form-elements/_forms-general.scss +64 -5
- package/app/styles/form-elements/_inputs.scss +10 -0
- package/app/styles/grids/_grid-layout.scss +25 -1
- package/app/styles/layout/_basic-layout.scss +2 -2
- package/app/styles/layout/_editor.scss +4 -4
- package/app/styles/primereact/_pr-dropdown.scss +17 -1
- package/app-typescript/components/DurationInput.tsx +37 -4
- package/app-typescript/components/EmptyState.tsx +2 -1
- package/app-typescript/components/Form/FormRowNew.tsx +41 -0
- package/app-typescript/components/Form/index.tsx +1 -0
- package/app-typescript/components/Layouts/AuthoringContainer.tsx +2 -1
- package/app-typescript/components/LeftMenu.tsx +127 -122
- package/app-typescript/components/Lists/TableList.tsx +146 -142
- package/app-typescript/components/SearchBar.tsx +28 -9
- package/app-typescript/components/TimePicker.tsx +2 -0
- package/app-typescript/index.ts +1 -0
- package/dist/examples.bundle.css +273 -0
- package/dist/examples.bundle.js +28927 -28750
- package/dist/playgrounds/react-playgrounds/RundownEditor.tsx +1 -1
- package/dist/playgrounds/react-playgrounds/SamsPlayground.tsx +12 -3
- package/dist/playgrounds/react-playgrounds/TestGround.tsx +120 -14
- package/dist/react/LeftNavigations.tsx +71 -44
- package/dist/react/MultiSelect.tsx +1 -1
- package/dist/react/TableList.tsx +84 -82
- package/dist/react/TimePicker.tsx +6 -4
- package/dist/react/TreeSelect.tsx +1 -1
- package/dist/sd_icons.eot +0 -0
- package/dist/sd_icons.svg +14 -7
- package/dist/sd_icons.ttf +0 -0
- package/dist/sd_icons.woff +0 -0
- package/dist/superdesk-ui.bundle.css +976 -29
- package/dist/superdesk-ui.bundle.js +13975 -2089
- package/dist/vendor.bundle.js +23 -23
- package/examples/pages/playgrounds/react-playgrounds/RundownEditor.tsx +1 -1
- package/examples/pages/playgrounds/react-playgrounds/SamsPlayground.tsx +12 -3
- package/examples/pages/playgrounds/react-playgrounds/TestGround.tsx +120 -14
- package/examples/pages/react/LeftNavigations.tsx +71 -44
- package/examples/pages/react/MultiSelect.tsx +1 -1
- package/examples/pages/react/TableList.tsx +84 -82
- package/examples/pages/react/TimePicker.tsx +6 -4
- package/examples/pages/react/TreeSelect.tsx +1 -1
- package/package.json +2 -1
- package/react/components/DurationInput.d.ts +2 -1
- package/react/components/DurationInput.js +36 -4
- package/react/components/EmptyState.d.ts +1 -0
- package/react/components/EmptyState.js +1 -1
- package/react/components/Form/FormRowNew.d.ts +12 -0
- package/react/components/Form/FormRowNew.js +67 -0
- package/react/components/Form/index.d.ts +1 -0
- package/react/components/Form/index.js +3 -1
- package/react/components/Layouts/AuthoringContainer.d.ts +1 -0
- package/react/components/Layouts/AuthoringContainer.js +1 -1
- package/react/components/LeftMenu.d.ts +3 -1
- package/react/components/LeftMenu.js +8 -1
- package/react/components/Lists/TableList.d.ts +42 -0
- package/react/components/Lists/TableList.js +145 -0
- package/react/components/SearchBar.d.ts +2 -1
- package/react/components/SearchBar.js +18 -2
- package/react/components/TimePicker.d.ts +1 -0
- package/react/components/TimePicker.js +1 -1
- package/react/index.d.ts +1 -0
- package/react/index.js +4 -1
@@ -3,150 +3,155 @@ import classNames from "classnames";
|
|
3
3
|
import Scrollspy from "react-scrollspy";
|
4
4
|
|
5
5
|
interface IMenuItem {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
id: string;
|
7
|
+
label: string;
|
8
|
+
route?: string;
|
9
|
+
ref?: string;
|
10
|
+
onClick?(): void;
|
11
11
|
}
|
12
12
|
|
13
13
|
interface IMenuGroup {
|
14
|
-
|
15
|
-
|
14
|
+
label: string;
|
15
|
+
items: Array<IMenuItem>;
|
16
16
|
}
|
17
17
|
|
18
18
|
interface IMenu {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
19
|
+
className?: string;
|
20
|
+
groups: Array<IMenuGroup>;
|
21
|
+
activeItemId?: string;
|
22
|
+
scrollTo?: string;
|
23
|
+
ariaLabel?: string;
|
24
|
+
scrollSpy?: string;
|
25
|
+
offset?: number;
|
26
|
+
reverseItemBorder?: boolean;
|
27
|
+
style?: "default" | "inverse" | "blanc";
|
28
|
+
size?: "medium" | "large";
|
29
|
+
onSelect(id: string, route: string): void;
|
29
30
|
}
|
30
31
|
|
31
32
|
interface IState {
|
32
|
-
|
33
|
+
active: string;
|
33
34
|
}
|
34
35
|
|
35
36
|
export class LeftMenu extends React.PureComponent<IMenu, IState> {
|
36
|
-
|
37
|
-
|
37
|
+
constructor(props: IMenu) {
|
38
|
+
super(props);
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
this.state = {
|
41
|
+
active: this.props.activeItemId ? this.props.activeItemId : '',
|
42
|
+
};
|
43
|
+
}
|
44
|
+
|
45
|
+
handleClick(item: IMenuItem, event?: React.MouseEvent) {
|
46
|
+
event?.preventDefault();
|
47
|
+
|
48
|
+
this.setState({
|
49
|
+
active: item.id,
|
50
|
+
});
|
43
51
|
|
44
|
-
|
45
|
-
|
52
|
+
if (item.ref) {
|
53
|
+
return document
|
54
|
+
.getElementById(item.ref)
|
55
|
+
?.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
56
|
+
}
|
46
57
|
|
47
|
-
|
48
|
-
|
49
|
-
|
58
|
+
if (item.onClick) {
|
59
|
+
return item.onClick();
|
60
|
+
}
|
50
61
|
|
51
|
-
|
52
|
-
return document
|
53
|
-
.getElementById(item.ref)
|
54
|
-
?.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
62
|
+
this.props.onSelect(item.id, item.route ? item.route : "");
|
55
63
|
}
|
56
64
|
|
57
|
-
|
58
|
-
|
65
|
+
componentDidMount() {
|
66
|
+
if (this.props.scrollTo) {
|
67
|
+
return document
|
68
|
+
.getElementById(this.props.scrollTo)
|
69
|
+
?.scrollIntoView({ block: "nearest", behavior: "smooth" });
|
70
|
+
}
|
59
71
|
}
|
60
72
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
"sd-left-nav--reverse-border": this.props.reverseItemBorder,
|
75
|
-
},
|
76
|
-
this.props.className,
|
77
|
-
);
|
78
|
-
|
79
|
-
const scrollspyList = () => {
|
80
|
-
let scrollSpyList: Array<string> = [];
|
81
|
-
let scrollSpyItems: Array<JSX.Element> = [];
|
82
|
-
this.props.groups.map((element, index) => {
|
83
|
-
scrollSpyList = [...scrollSpyList, element.label];
|
84
|
-
scrollSpyItems.push(
|
85
|
-
<span className="sd-left-nav__group-header" key={"group-" + index}>
|
86
|
-
{element.label}
|
87
|
-
</span>,
|
73
|
+
render() {
|
74
|
+
let classes = classNames(
|
75
|
+
"sd-left-nav",
|
76
|
+
{
|
77
|
+
"sd-left-nav--default": this.props.style === undefined,
|
78
|
+
[`sd-left-nav--${this.props.style}`]:
|
79
|
+
this.props.style || this.props.style !== undefined,
|
80
|
+
"sd-left-nav--medium": this.props.size === undefined,
|
81
|
+
[`sd-left-nav--${this.props.size}`]:
|
82
|
+
this.props.size || this.props.size !== undefined,
|
83
|
+
"sd-left-nav--reverse-border": this.props.reverseItemBorder,
|
84
|
+
},
|
85
|
+
this.props.className,
|
88
86
|
);
|
89
87
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
88
|
+
const scrollspyList = () => {
|
89
|
+
let scrollSpyList: Array<string> = [];
|
90
|
+
let scrollSpyItems: Array<JSX.Element> = [];
|
91
|
+
this.props.groups.map((element, index) => {
|
92
|
+
scrollSpyList = [...scrollSpyList, element.label];
|
93
|
+
scrollSpyItems.push(
|
94
|
+
<span className="sd-left-nav__group-header" key={"group-" + index}>
|
95
|
+
{element.label}
|
96
|
+
</span>,
|
97
|
+
);
|
98
|
+
|
99
|
+
element.items.map((elementOfItem, indexOfItem) => {
|
100
|
+
scrollSpyList = [...scrollSpyList, `${elementOfItem.ref}`];
|
101
|
+
|
102
|
+
scrollSpyItems.push(
|
103
|
+
<a key={"item-" + indexOfItem}
|
104
|
+
onClick={(event) => {
|
105
|
+
this.handleClick(elementOfItem, event);
|
106
|
+
}}
|
107
|
+
className="sd-left-nav__btn" >
|
108
|
+
{elementOfItem.label}
|
109
|
+
</a>,
|
110
|
+
);
|
111
|
+
});
|
112
|
+
});
|
113
|
+
|
114
|
+
return (
|
115
|
+
<Scrollspy
|
116
|
+
offset={this.props.offset ? this.props.offset : -300}
|
117
|
+
items={scrollSpyList}
|
118
|
+
rootEl={this.props.scrollSpy}
|
119
|
+
currentClassName="sd-left-nav__btn--active" >
|
120
|
+
{scrollSpyItems.map((element) => element)}
|
121
|
+
</Scrollspy>
|
122
|
+
);
|
123
|
+
};
|
124
|
+
|
125
|
+
const defaultList = () => {
|
126
|
+
return this.props.groups.map((group, i) => {
|
127
|
+
return (
|
128
|
+
<React.Fragment key={i}>
|
129
|
+
<span className="sd-left-nav__group-header">{group.label}</span>
|
130
|
+
{group.items.map((item, j) => {
|
131
|
+
return (
|
132
|
+
<button
|
133
|
+
key={j}
|
134
|
+
onClick={(event) => {
|
135
|
+
this.handleClick(item, event);
|
136
|
+
}}
|
137
|
+
className={
|
138
|
+
item.id === this.state.active
|
139
|
+
? "sd-left-nav__btn sd-left-nav__btn--active"
|
140
|
+
: "sd-left-nav__btn"
|
141
|
+
}>
|
142
|
+
{item.label}
|
143
|
+
</button>
|
144
|
+
);
|
145
|
+
})}
|
146
|
+
</React.Fragment>
|
147
|
+
);
|
148
|
+
});
|
149
|
+
};
|
150
|
+
|
121
151
|
return (
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
return (
|
126
|
-
<button
|
127
|
-
key={j}
|
128
|
-
onClick={(event) => {
|
129
|
-
this.handleClick(item, event);
|
130
|
-
}}
|
131
|
-
className={
|
132
|
-
item.id === this.state.active
|
133
|
-
? "sd-left-nav__btn sd-left-nav__btn--active"
|
134
|
-
: "sd-left-nav__btn"
|
135
|
-
}
|
136
|
-
>
|
137
|
-
{item.label}
|
138
|
-
</button>
|
139
|
-
);
|
140
|
-
})}
|
141
|
-
</React.Fragment>
|
152
|
+
<nav className={classes} aria-label={this.props.ariaLabel}>
|
153
|
+
{this.props.scrollSpy ? scrollspyList() : defaultList()}
|
154
|
+
</nav>
|
142
155
|
);
|
143
|
-
|
144
|
-
};
|
145
|
-
|
146
|
-
return (
|
147
|
-
<nav className={classes} aria-label={this.props.ariaLabel}>
|
148
|
-
{this.props.scrollSpy ? scrollspyList() : defaultList()}
|
149
|
-
</nav>
|
150
|
-
);
|
151
|
-
}
|
156
|
+
}
|
152
157
|
}
|
@@ -1,125 +1,51 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import classNames from 'classnames';
|
3
|
-
import { DragDropContext, Droppable, Draggable } from "react-beautiful-dnd";
|
3
|
+
import { DragDropContext, Droppable, Draggable, DropResult } from "react-beautiful-dnd";
|
4
4
|
import { Tooltip } from '../Tooltip';
|
5
5
|
import { Button } from '../Button';
|
6
|
-
import { Dropdown } from '../Dropdown';
|
6
|
+
import { Dropdown, IMenuItem, ISubmenu, IMenuGroup } from '../Dropdown';
|
7
7
|
|
8
|
-
interface
|
9
|
-
start?: React.ReactNode;
|
10
|
-
center?: React.ReactNode;
|
11
|
-
end?: React.ReactNode;
|
12
|
-
action?: React.ReactNode;
|
13
|
-
addItem?: boolean;
|
14
|
-
itemsDropdown?: any;
|
15
|
-
dragAndDrop?: boolean;
|
16
|
-
onClick?(): void;
|
17
|
-
}
|
18
|
-
|
19
|
-
class TableListItem extends React.PureComponent<IPropsItem> {
|
20
|
-
render() {
|
21
|
-
return (
|
22
|
-
this.props.addItem ?
|
23
|
-
<li className='table-list__item-container'>
|
24
|
-
<div
|
25
|
-
onClick={this.props.onClick}
|
26
|
-
className={`table-list__item ${this.props.onClick && 'table-list__item--clickable'} ${this.props.dragAndDrop && 'table-list__item--draggable'}`}>
|
27
|
-
<div className='table-list__item-content'>
|
28
|
-
<div className='table-list__item-content-block'>
|
29
|
-
{this.props.start && this.props.start}
|
30
|
-
</div>
|
31
|
-
<div className='table-list__item-content-block table-list__item-content-block--center'>
|
32
|
-
{this.props.center && this.props.center}
|
33
|
-
</div>
|
34
|
-
<div className='table-list__item-content-block'>
|
35
|
-
{this.props.end && this.props.end}
|
36
|
-
</div>
|
37
|
-
</div>
|
38
|
-
{this.props.action && <div className='table-list__slide-in-actions'>
|
39
|
-
{this.props.action}
|
40
|
-
</div>}
|
41
|
-
</div>
|
42
|
-
<div className='table-list__add-bar-container'>
|
43
|
-
<Tooltip text='Add item' flow='top' appendToBody={true}>
|
44
|
-
<div className='table-list__add-bar'>
|
45
|
-
<Dropdown
|
46
|
-
items={this.props.itemsDropdown}>
|
47
|
-
<Button
|
48
|
-
type="primary"
|
49
|
-
icon="plus-large"
|
50
|
-
text="Add item"
|
51
|
-
size="small"
|
52
|
-
shape="round"
|
53
|
-
iconOnly={true}
|
54
|
-
onClick={() => false}
|
55
|
-
/>
|
56
|
-
</Dropdown>
|
57
|
-
</div>
|
58
|
-
</Tooltip>
|
59
|
-
</div>
|
60
|
-
</li>
|
61
|
-
: <li
|
62
|
-
className={`table-list__item ${this.props.onClick && 'table-list__item--clickable'} ${this.props.dragAndDrop && 'table-list__item--draggable'} table-list__item--margin`}
|
63
|
-
onClick={this.props.onClick}>
|
64
|
-
<div className='table-list__item-content'>
|
65
|
-
<div className='table-list__item-content-block'>
|
66
|
-
{this.props.start && this.props.start}
|
67
|
-
</div>
|
68
|
-
<div className='table-list__item-content-block table-list__item-content-block--center'>
|
69
|
-
{this.props.center && this.props.center}
|
70
|
-
</div>
|
71
|
-
<div className='table-list__item-content-block'>
|
72
|
-
{this.props.end && this.props.end}
|
73
|
-
</div>
|
74
|
-
</div>
|
75
|
-
{this.props.action && <div className='table-list__slide-in-actions'>
|
76
|
-
{this.props.action}
|
77
|
-
</div>}
|
78
|
-
</li>
|
79
|
-
);
|
80
|
-
}
|
81
|
-
}
|
82
|
-
|
83
|
-
interface IProps {
|
8
|
+
export interface IProps {
|
84
9
|
children?: React.ReactNode;
|
85
|
-
array
|
10
|
+
array: Array<IPropsArrayItem>;
|
86
11
|
addItem?: boolean;
|
87
12
|
dragAndDrop?: boolean;
|
88
|
-
itemsDropdown?:
|
13
|
+
itemsDropdown?: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
89
14
|
className?: string;
|
90
|
-
|
15
|
+
onDrag?(start: number, end: number): void;
|
91
16
|
}
|
92
17
|
|
93
|
-
interface
|
18
|
+
export interface IPropsArrayItem {
|
94
19
|
start?: React.ReactNode;
|
95
20
|
center?: React.ReactNode;
|
96
21
|
end?: React.ReactNode;
|
97
22
|
action?: React.ReactNode;
|
23
|
+
onClick?(): void;
|
98
24
|
}
|
99
25
|
|
100
|
-
const reorder = (list
|
101
|
-
|
102
|
-
|
103
|
-
|
26
|
+
const reorder = (list: Array<IPropsArrayItem>, startIndex: number, endIndex: number) => {
|
27
|
+
const result = Array.from(list);
|
28
|
+
const [removed] = result.splice(startIndex, 1);
|
29
|
+
result.splice(endIndex, 0, removed);
|
104
30
|
|
105
|
-
|
31
|
+
return result;
|
106
32
|
};
|
107
33
|
|
108
|
-
class TableList extends React.PureComponent<IProps, {items:
|
109
|
-
constructor(props) {
|
34
|
+
class TableList extends React.PureComponent<IProps, { items: Array<IPropsArrayItem>}> {
|
35
|
+
constructor(props: Readonly<IProps>) {
|
110
36
|
super(props);
|
111
37
|
this.state = {
|
112
|
-
|
38
|
+
items: [],
|
113
39
|
};
|
114
40
|
|
115
41
|
this.onDragEnd = this.onDragEnd.bind(this);
|
116
42
|
}
|
117
43
|
|
118
44
|
componentDidMount(): void {
|
119
|
-
this.setState({items: this.props.array});
|
45
|
+
this.setState({ items: this.props.array });
|
120
46
|
}
|
121
47
|
|
122
|
-
componentDidUpdate(prevProps: Readonly<IProps
|
48
|
+
componentDidUpdate(prevProps: Readonly<IProps>): void {
|
123
49
|
if (prevProps.array !== this.props.array) {
|
124
50
|
this.setState({
|
125
51
|
items: this.props.array,
|
@@ -127,7 +53,7 @@ class TableList extends React.PureComponent<IProps, {items: any}> {
|
|
127
53
|
}
|
128
54
|
}
|
129
55
|
|
130
|
-
onDragEnd(result) {
|
56
|
+
onDragEnd(result: DropResult) {
|
131
57
|
if (!result.destination) {
|
132
58
|
return;
|
133
59
|
}
|
@@ -139,66 +65,144 @@ class TableList extends React.PureComponent<IProps, {items: any}> {
|
|
139
65
|
this.setState({
|
140
66
|
items,
|
141
67
|
});
|
68
|
+
|
69
|
+
return this.props.onDrag ?
|
70
|
+
this.props.onDrag(result.source.index, result.destination.index) : null;
|
142
71
|
}
|
143
72
|
|
144
73
|
render() {
|
145
74
|
let classes = classNames({
|
146
|
-
'table-list'
|
75
|
+
'table-list': !this.props.addItem,
|
147
76
|
[`${this.props.className}`]: this.props.className,
|
148
77
|
});
|
149
78
|
|
150
79
|
return (
|
151
80
|
this.props.array ?
|
152
81
|
this.props.dragAndDrop ?
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
82
|
+
<DragDropContext onDragEnd={this.onDragEnd}>
|
83
|
+
<Droppable droppableId="droppable">
|
84
|
+
{(provided, _snapshot) => (
|
85
|
+
<ul
|
86
|
+
className={classes}
|
87
|
+
ref={provided.innerRef}
|
88
|
+
{...provided.droppableProps} >
|
89
|
+
{this.state.items.map((item: IPropsArrayItem, index: number) => (
|
90
|
+
<Draggable key={index} draggableId={`${index}`} index={index}>
|
91
|
+
{(provided2, _snapshot2) => (
|
92
|
+
<div
|
93
|
+
ref={provided2.innerRef}
|
94
|
+
{...provided2.draggableProps}
|
95
|
+
{...provided2.dragHandleProps} >
|
96
|
+
<TableListItem
|
97
|
+
dragAndDrop={this.props.dragAndDrop}
|
98
|
+
start={item.start}
|
99
|
+
center={item.center}
|
100
|
+
end={item.end}
|
101
|
+
action={item.action}
|
102
|
+
onClick={item.onClick ? item.onClick : undefined}
|
103
|
+
addItem={this.props.addItem}
|
104
|
+
itemsDropdown={this.props.itemsDropdown} />
|
105
|
+
</div>
|
106
|
+
)}
|
107
|
+
</Draggable>
|
108
|
+
))}
|
109
|
+
{provided.placeholder}
|
110
|
+
</ul>
|
111
|
+
)}
|
112
|
+
</Droppable>
|
113
|
+
</DragDropContext>
|
114
|
+
: <ul className={classes}>
|
115
|
+
{this.state.items.map((item: IPropsArrayItem, index: number) => (
|
116
|
+
<TableListItem
|
117
|
+
key={index}
|
118
|
+
start={item.start}
|
119
|
+
center={item.center}
|
120
|
+
end={item.end}
|
121
|
+
action={item.action}
|
122
|
+
onClick={item.onClick ? item.onClick : undefined}
|
123
|
+
addItem={this.props.addItem}
|
124
|
+
itemsDropdown={this.props.itemsDropdown} />
|
125
|
+
))}
|
126
|
+
</ul>
|
127
|
+
: this.props.children &&
|
128
|
+
<ul className={classes}>
|
129
|
+
{this.props.children}
|
197
130
|
</ul>
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
131
|
+
);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
export interface IPropsItem {
|
136
|
+
start?: React.ReactNode;
|
137
|
+
center?: React.ReactNode;
|
138
|
+
end?: React.ReactNode;
|
139
|
+
action?: React.ReactNode;
|
140
|
+
addItem?: boolean;
|
141
|
+
itemsDropdown?: any;
|
142
|
+
dragAndDrop?: boolean;
|
143
|
+
onClick?(): void;
|
144
|
+
}
|
145
|
+
|
146
|
+
class TableListItem extends React.PureComponent<IPropsItem> {
|
147
|
+
render() {
|
148
|
+
return (
|
149
|
+
this.props.addItem ?
|
150
|
+
<li className='table-list__item-container'>
|
151
|
+
<div
|
152
|
+
onClick={this.props.onClick}
|
153
|
+
className={`table-list__item ${this.props.onClick && 'table-list__item--clickable'} ${this.props.dragAndDrop && 'table-list__item--draggable'}`}>
|
154
|
+
<div className='table-list__item-content'>
|
155
|
+
<div className='table-list__item-content-block'>
|
156
|
+
{this.props.start && this.props.start}
|
157
|
+
</div>
|
158
|
+
<div className='table-list__item-content-block table-list__item-content-block--center'>
|
159
|
+
{this.props.center && this.props.center}
|
160
|
+
</div>
|
161
|
+
<div className='table-list__item-content-block'>
|
162
|
+
{this.props.end && this.props.end}
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
{this.props.action && <div className='table-list__slide-in-actions'>
|
166
|
+
{this.props.action}
|
167
|
+
</div>}
|
168
|
+
</div>
|
169
|
+
<div className='table-list__add-bar-container'>
|
170
|
+
<Tooltip text='Add item' flow='top' appendToBody={true}>
|
171
|
+
<div className='table-list__add-bar'>
|
172
|
+
<Dropdown
|
173
|
+
items={this.props.itemsDropdown}>
|
174
|
+
<Button
|
175
|
+
type="primary"
|
176
|
+
icon="plus-large"
|
177
|
+
text="Add item"
|
178
|
+
size="small"
|
179
|
+
shape="round"
|
180
|
+
iconOnly={true}
|
181
|
+
onClick={() => false}
|
182
|
+
/>
|
183
|
+
</Dropdown>
|
184
|
+
</div>
|
185
|
+
</Tooltip>
|
186
|
+
</div>
|
187
|
+
</li>
|
188
|
+
: <li
|
189
|
+
className={`table-list__item ${this.props.onClick && 'table-list__item--clickable'} ${this.props.dragAndDrop && 'table-list__item--draggable'} table-list__item--margin`}
|
190
|
+
onClick={this.props.onClick}>
|
191
|
+
<div className='table-list__item-content'>
|
192
|
+
<div className='table-list__item-content-block'>
|
193
|
+
{this.props.start && this.props.start}
|
194
|
+
</div>
|
195
|
+
<div className='table-list__item-content-block table-list__item-content-block--center'>
|
196
|
+
{this.props.center && this.props.center}
|
197
|
+
</div>
|
198
|
+
<div className='table-list__item-content-block'>
|
199
|
+
{this.props.end && this.props.end}
|
200
|
+
</div>
|
201
|
+
</div>
|
202
|
+
{this.props.action && <div className='table-list__slide-in-actions'>
|
203
|
+
{this.props.action}
|
204
|
+
</div>}
|
205
|
+
</li>
|
202
206
|
);
|
203
207
|
}
|
204
208
|
}
|