superdesk-ui-framework 3.0.1-beta.9 → 3.0.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/app/fonts/sd_icons.eot +0 -0
- package/app/fonts/sd_icons.svg +1 -0
- package/app/fonts/sd_icons.ttf +0 -0
- package/app/fonts/sd_icons.woff +0 -0
- package/app/scripts/toggleBoxNext.js +1 -1
- package/app/styles/_big-icon-font.scss +1 -1
- package/app/styles/_buttons.scss +11 -6
- package/app/styles/_content-divider.scss +63 -8
- package/app/styles/_helpers.scss +24 -1
- package/app/styles/_icon-font.scss +11 -10
- package/app/styles/_labels.scss +0 -1
- package/app/styles/_master-desk.scss +5 -4
- package/app/styles/_modals.scss +7 -3
- package/app/styles/_normalize.scss +4 -0
- package/app/styles/_sd-tag-input.scss +56 -2
- package/app/styles/_simple-list.scss +0 -2
- package/app/styles/_table-list.scss +116 -12
- package/app/styles/app.scss +3 -0
- package/app/styles/components/_list-item.scss +23 -16
- package/app/styles/components/_sd-collapse-box.scss +6 -6
- package/app/styles/components/_sd-comment-box.scss +8 -4
- package/app/styles/components/_sd-editor-popup.scss +4 -4
- package/app/styles/components/_sd-media-carousel.scss +37 -2
- package/app/styles/components/_sd-pagination.scss +41 -0
- package/app/styles/components/_sd-photo-preview.scss +2 -2
- package/app/styles/components/_subnav.scss +470 -470
- package/app/styles/design-tokens/_new-colors.scss +29 -12
- package/app/styles/dropdowns/_basic-dropdown.scss +6 -0
- package/app/styles/form-elements/_input-wrap.scss +138 -0
- package/app/styles/form-elements/_inputs.scss +230 -61
- package/app/styles/grids/_grid-layout.scss +13 -14
- package/app/styles/interface-elements/_side-panel.scss +1 -1
- package/app/styles/layout/_editor.scss +6 -0
- package/app/styles/menus/_sd-sidebar-menu.scss +1 -1
- package/app/styles/primereact/_pr-datepicker.scss +16 -2
- package/app/styles/primereact/_pr-dialog.scss +9 -0
- package/app/styles/primereact/_pr-menu.scss +6 -5
- package/app/styles/variables/_colors.scss +47 -47
- package/app/template/search-handler.html +2 -2
- package/app-typescript/components/ContentDivider.tsx +3 -0
- package/app-typescript/components/DatePicker.tsx +8 -9
- package/app-typescript/components/Dropdown.tsx +127 -82
- package/app-typescript/components/DurationInput.tsx +39 -14
- package/app-typescript/components/Form/FormLabel.tsx +8 -1
- package/app-typescript/components/Form/InputBase.tsx +12 -2
- package/app-typescript/components/Input.tsx +4 -4
- package/app-typescript/components/Label.tsx +17 -1
- package/app-typescript/components/Layouts/AuthoringFrame.tsx +2 -1
- package/app-typescript/components/Layouts/AuthoringFrameRightBar.tsx +21 -2
- package/app-typescript/components/Layouts/AuthoringInnerHeader.tsx +1 -1
- package/app-typescript/components/Layouts/AuthoringMain.tsx +4 -2
- package/app-typescript/components/Layouts/CoreLayout.tsx +3 -1
- package/app-typescript/components/Layouts/CoreLayoutMain.tsx +10 -1
- package/app-typescript/components/Lists/ContentList.tsx +64 -30
- package/app-typescript/components/Lists/TableList.tsx +255 -53
- package/app-typescript/components/Menu.tsx +2 -2
- package/app-typescript/components/Modal.tsx +6 -2
- package/app-typescript/components/MultiSelect.tsx +1 -1
- package/app-typescript/components/NavButton.tsx +2 -1
- package/app-typescript/components/Navigation/SideBarMenu.tsx +30 -4
- package/app-typescript/components/SearchBar.tsx +11 -3
- package/app-typescript/components/Spacer.tsx +87 -0
- package/app-typescript/components/TimePicker.tsx +2 -13
- package/app-typescript/components/TreeSelect.tsx +286 -180
- package/app-typescript/index.ts +1 -0
- package/dist/examples.bundle.css +110 -71
- package/dist/examples.bundle.js +23848 -21661
- package/dist/playgrounds/react-playgrounds/CoreLayout.tsx +505 -2
- package/dist/playgrounds/react-playgrounds/Index.tsx +1 -0
- package/dist/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
- package/dist/playgrounds/react-playgrounds/RundownEditor.tsx +17 -19
- package/dist/playgrounds/react-playgrounds/Rundowns.tsx +22 -23
- package/dist/playgrounds/react-playgrounds/TestGround.tsx +226 -25
- package/dist/react/ContentDivider.tsx +22 -18
- package/dist/react/ContentList.tsx +188 -12
- package/dist/react/DatePicker.tsx +50 -2
- package/dist/react/Dropdowns.tsx +580 -48
- package/dist/react/DurationInput.tsx +7 -3
- package/dist/react/Inputs.tsx +1 -7
- package/dist/react/Modal.tsx +154 -22
- package/dist/react/MultiSelect.tsx +5 -5
- package/dist/react/NavButtons.tsx +31 -1
- package/dist/react/TableList.tsx +52 -139
- package/dist/react/Togglebox.tsx +1 -1
- package/dist/react/TreeSelect.tsx +167 -176
- package/dist/sd_icons.eot +0 -0
- package/dist/sd_icons.svg +1 -0
- package/dist/sd_icons.ttf +0 -0
- package/dist/sd_icons.woff +0 -0
- package/dist/superdesk-ui.bundle.css +1100 -407
- package/dist/superdesk-ui.bundle.js +6591 -4035
- package/dist/vendor.bundle.js +27 -27
- package/examples/css/docs-page.css +4 -4
- package/examples/index.js +4 -0
- package/examples/pages/playgrounds/react-playgrounds/CoreLayout.tsx +505 -2
- package/examples/pages/playgrounds/react-playgrounds/Index.tsx +1 -0
- package/examples/pages/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
- package/examples/pages/playgrounds/react-playgrounds/RundownEditor.tsx +17 -19
- package/examples/pages/playgrounds/react-playgrounds/Rundowns.tsx +22 -23
- package/examples/pages/playgrounds/react-playgrounds/TestGround.tsx +226 -25
- package/examples/pages/react/ContentDivider.tsx +22 -18
- package/examples/pages/react/ContentList.tsx +188 -12
- package/examples/pages/react/DatePicker.tsx +50 -2
- package/examples/pages/react/Dropdowns.tsx +580 -48
- package/examples/pages/react/DurationInput.tsx +7 -3
- package/examples/pages/react/Inputs.tsx +1 -7
- package/examples/pages/react/Modal.tsx +154 -22
- package/examples/pages/react/MultiSelect.tsx +5 -5
- package/examples/pages/react/NavButtons.tsx +31 -1
- package/examples/pages/react/TableList.tsx +52 -139
- package/examples/pages/react/Togglebox.tsx +1 -1
- package/examples/pages/react/TreeSelect.tsx +167 -176
- package/package.json +3 -5
- package/react/components/ContentDivider.d.ts +1 -0
- package/react/components/ContentDivider.js +2 -0
- package/react/components/DatePicker.d.ts +2 -2
- package/react/components/DatePicker.js +3 -3
- package/react/components/Dropdown.d.ts +6 -5
- package/react/components/Dropdown.js +57 -30
- package/react/components/DurationInput.d.ts +1 -1
- package/react/components/DurationInput.js +46 -17
- package/react/components/Form/FormLabel.d.ts +4 -1
- package/react/components/Form/FormLabel.js +9 -3
- package/react/components/Form/InputBase.d.ts +0 -1
- package/react/components/Form/InputBase.js +15 -1
- package/react/components/Input.d.ts +3 -3
- package/react/components/Input.js +2 -1
- package/react/components/Label.d.ts +1 -0
- package/react/components/Label.js +17 -2
- package/react/components/Layouts/AuthoringFrame.d.ts +1 -0
- package/react/components/Layouts/AuthoringFrame.js +1 -1
- package/react/components/Layouts/AuthoringFrameRightBar.d.ts +9 -2
- package/react/components/Layouts/AuthoringFrameRightBar.js +14 -3
- package/react/components/Layouts/AuthoringInnerHeader.js +1 -1
- package/react/components/Layouts/AuthoringMain.js +1 -1
- package/react/components/Layouts/CoreLayout.d.ts +2 -0
- package/react/components/Layouts/CoreLayout.js +1 -1
- package/react/components/Layouts/CoreLayoutMain.d.ts +2 -0
- package/react/components/Layouts/CoreLayoutMain.js +8 -1
- package/react/components/Lists/ContentList.d.ts +6 -0
- package/react/components/Lists/ContentList.js +42 -16
- package/react/components/Lists/TableList.d.ts +30 -8
- package/react/components/Lists/TableList.js +127 -24
- package/react/components/Menu.js +1 -1
- package/react/components/Modal.d.ts +2 -0
- package/react/components/Modal.js +3 -3
- package/react/components/MultiSelect.d.ts +40 -0
- package/react/components/MultiSelect.js +70 -0
- package/react/components/NavButton.d.ts +1 -1
- package/react/components/Navigation/SideBarMenu.d.ts +6 -0
- package/react/components/Navigation/SideBarMenu.js +19 -2
- package/react/components/SearchBar.d.ts +1 -1
- package/react/components/SearchBar.js +15 -7
- package/react/components/TimePicker.d.ts +1 -5
- package/react/components/TimePicker.js +3 -7
- package/react/components/TreeSelect.d.ts +12 -5
- package/react/components/TreeSelect.js +189 -116
- package/react/index.d.ts +1 -0
- package/react/index.js +3 -0
- package/patches/@superdesk+primereact+5.0.2-4.patch +0 -66
@@ -4,15 +4,19 @@ import { DragDropContext, Droppable, Draggable, DropResult } from "react-beautif
|
|
4
4
|
import { Tooltip } from '../Tooltip';
|
5
5
|
import { Button } from '../Button';
|
6
6
|
import { Dropdown, IMenuItem, ISubmenu, IMenuGroup } from '../Dropdown';
|
7
|
+
import ReactDOM from 'react-dom';
|
7
8
|
|
8
9
|
export interface IProps {
|
9
|
-
children?: React.ReactNode;
|
10
10
|
array: Array<IPropsArrayItem>;
|
11
11
|
addItem?: boolean;
|
12
12
|
dragAndDrop?: boolean;
|
13
|
-
itemsDropdown?: Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
14
13
|
className?: string;
|
14
|
+
readOnly?: boolean;
|
15
|
+
showDragHandle?: 'always' | 'onHover' | 'none'; // always default
|
16
|
+
append?: boolean;
|
15
17
|
onDrag?(start: number, end: number): void;
|
18
|
+
onAddItem?(index: number, item?: IPropsArrayItem): void;
|
19
|
+
itemsDropdown?(index?: number): Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
16
20
|
}
|
17
21
|
|
18
22
|
export interface IPropsArrayItem {
|
@@ -20,7 +24,15 @@ export interface IPropsArrayItem {
|
|
20
24
|
center?: React.ReactNode;
|
21
25
|
end?: React.ReactNode;
|
22
26
|
action?: React.ReactNode;
|
27
|
+
hexColor?: string;
|
23
28
|
onClick?(): void;
|
29
|
+
onDoubleClick?(): void;
|
30
|
+
locked?: boolean;
|
31
|
+
positionLocked?: boolean;
|
32
|
+
}
|
33
|
+
|
34
|
+
interface IState {
|
35
|
+
items: Array<IPropsArrayItem>;
|
24
36
|
}
|
25
37
|
|
26
38
|
const reorder = (list: Array<IPropsArrayItem>, startIndex: number, endIndex: number) => {
|
@@ -31,25 +43,30 @@ const reorder = (list: Array<IPropsArrayItem>, startIndex: number, endIndex: num
|
|
31
43
|
return result;
|
32
44
|
};
|
33
45
|
|
34
|
-
class TableList extends React.PureComponent<IProps,
|
35
|
-
constructor(props:
|
46
|
+
class TableList extends React.PureComponent<IProps, IState> {
|
47
|
+
constructor(props: IProps) {
|
36
48
|
super(props);
|
37
49
|
this.state = {
|
38
50
|
items: [],
|
39
51
|
};
|
40
52
|
|
41
53
|
this.onDragEnd = this.onDragEnd.bind(this);
|
54
|
+
this.dropDown = this.dropDown.bind(this);
|
42
55
|
}
|
43
56
|
|
44
57
|
componentDidMount(): void {
|
45
|
-
|
58
|
+
if (this.props.array) {
|
59
|
+
this.setState({ items: this.props.array });
|
60
|
+
}
|
46
61
|
}
|
47
62
|
|
48
|
-
componentDidUpdate(prevProps:
|
49
|
-
if (
|
50
|
-
this.
|
51
|
-
|
52
|
-
|
63
|
+
componentDidUpdate(prevProps: IProps): void {
|
64
|
+
if (this.props.array) {
|
65
|
+
if (prevProps.array !== this.props.array) {
|
66
|
+
this.setState({
|
67
|
+
items: this.props.array,
|
68
|
+
});
|
69
|
+
}
|
53
70
|
}
|
54
71
|
}
|
55
72
|
|
@@ -63,55 +80,110 @@ class TableList extends React.PureComponent<IProps, { items: Array<IPropsArrayIt
|
|
63
80
|
result.destination.index,
|
64
81
|
);
|
65
82
|
this.setState({
|
66
|
-
items,
|
83
|
+
items: items,
|
67
84
|
});
|
68
85
|
|
69
86
|
return this.props.onDrag ?
|
70
87
|
this.props.onDrag(result.source.index, result.destination.index) : null;
|
71
88
|
}
|
72
89
|
|
90
|
+
dropDown() {
|
91
|
+
return (
|
92
|
+
<Dropdown
|
93
|
+
items={this.props.itemsDropdown ? this.props.itemsDropdown() : []}>
|
94
|
+
<Button
|
95
|
+
type="primary"
|
96
|
+
icon="plus-large"
|
97
|
+
text="Add item"
|
98
|
+
size="small"
|
99
|
+
shape="round"
|
100
|
+
iconOnly={true}
|
101
|
+
onClick={() => false}
|
102
|
+
/>
|
103
|
+
</Dropdown>
|
104
|
+
);
|
105
|
+
}
|
106
|
+
|
73
107
|
render() {
|
74
|
-
let classes = classNames({
|
108
|
+
let classes = classNames('', {
|
75
109
|
'table-list': !this.props.addItem,
|
110
|
+
'table-list--read-only': this.props.readOnly,
|
76
111
|
[`${this.props.className}`]: this.props.className,
|
77
112
|
});
|
78
113
|
|
79
114
|
return (
|
80
|
-
this.
|
81
|
-
this.props.dragAndDrop
|
82
|
-
<DragDropContext onDragEnd={this.onDragEnd}>
|
115
|
+
this.state.items.length > 0
|
116
|
+
? this.props.dragAndDrop
|
117
|
+
? <DragDropContext onDragEnd={this.onDragEnd}>
|
83
118
|
<Droppable droppableId="droppable">
|
84
119
|
{(provided, _snapshot) => (
|
85
|
-
<
|
120
|
+
<div
|
121
|
+
role='list'
|
86
122
|
className={classes}
|
87
123
|
ref={provided.innerRef}
|
88
124
|
{...provided.droppableProps} >
|
89
125
|
{this.state.items.map((item: IPropsArrayItem, index: number) => (
|
90
126
|
<Draggable key={index} draggableId={`${index}`} index={index}>
|
91
|
-
{(provided2,
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
127
|
+
{(provided2, snapshot) => (
|
128
|
+
this.props.append
|
129
|
+
? <PortalItem
|
130
|
+
provided={provided2}
|
131
|
+
snapshot={snapshot}
|
132
|
+
item={item}
|
133
|
+
index={index}
|
97
134
|
dragAndDrop={this.props.dragAndDrop}
|
98
|
-
|
99
|
-
center={item.center}
|
100
|
-
end={item.end}
|
101
|
-
action={item.action}
|
102
|
-
onClick={item.onClick ? item.onClick : undefined}
|
135
|
+
showDragHandle={this.props.showDragHandle}
|
103
136
|
addItem={this.props.addItem}
|
104
|
-
|
105
|
-
|
137
|
+
onAddItem={() => this.props.onAddItem
|
138
|
+
&& this.props.onAddItem(index, item)}
|
139
|
+
itemsDropdown={() => this.props.itemsDropdown
|
140
|
+
? this.props.itemsDropdown(index)
|
141
|
+
: []}
|
142
|
+
/>
|
143
|
+
: <div
|
144
|
+
ref={provided2.innerRef}
|
145
|
+
{...provided2.draggableProps}
|
146
|
+
{...provided2.dragHandleProps} >
|
147
|
+
<TableListItem
|
148
|
+
dragAndDrop={this.props.dragAndDrop}
|
149
|
+
start={item.start}
|
150
|
+
center={item.center}
|
151
|
+
end={item.end}
|
152
|
+
action={item.action}
|
153
|
+
onClick={item.onClick ? item.onClick : undefined}
|
154
|
+
onDoubleClick={item.onDoubleClick
|
155
|
+
? item.onDoubleClick
|
156
|
+
: undefined}
|
157
|
+
addItem={this.props.addItem}
|
158
|
+
itemsDropdown={() => this.props.itemsDropdown
|
159
|
+
? this.props.itemsDropdown(index)
|
160
|
+
: []}
|
161
|
+
hexColor={item.hexColor}
|
162
|
+
locked={item.locked}
|
163
|
+
positionLocked={item.positionLocked}
|
164
|
+
onAddItem={() => this.props.onAddItem
|
165
|
+
&& this.props.onAddItem(index, item)}
|
166
|
+
showDragHandle={this.props.showDragHandle}
|
167
|
+
/>
|
168
|
+
</div>
|
106
169
|
)}
|
107
170
|
</Draggable>
|
108
171
|
))}
|
109
172
|
{provided.placeholder}
|
110
|
-
|
173
|
+
{(this.props.addItem && !this.props.readOnly) &&
|
174
|
+
<div className={`table-list__add-item table-list__item--margin`}>
|
175
|
+
<Tooltip text='Add item' flow='top' appendToBody={true}>
|
176
|
+
<div className='table-list__add-item--container sd-margin-x--auto'>
|
177
|
+
{this.dropDown()}
|
178
|
+
</div>
|
179
|
+
</Tooltip>
|
180
|
+
</div>
|
181
|
+
}
|
182
|
+
</div>
|
111
183
|
)}
|
112
184
|
</Droppable>
|
113
185
|
</DragDropContext>
|
114
|
-
: <
|
186
|
+
: <div role='list' className={classes}>
|
115
187
|
{this.state.items.map((item: IPropsArrayItem, index: number) => (
|
116
188
|
<TableListItem
|
117
189
|
key={index}
|
@@ -120,14 +192,38 @@ class TableList extends React.PureComponent<IProps, { items: Array<IPropsArrayIt
|
|
120
192
|
end={item.end}
|
121
193
|
action={item.action}
|
122
194
|
onClick={item.onClick ? item.onClick : undefined}
|
195
|
+
onDoubleClick={item.onDoubleClick
|
196
|
+
? item.onDoubleClick
|
197
|
+
: undefined}
|
123
198
|
addItem={this.props.addItem}
|
124
|
-
itemsDropdown={this.props.itemsDropdown}
|
199
|
+
itemsDropdown={() => this.props.itemsDropdown ? this.props.itemsDropdown(index) : []}
|
200
|
+
hexColor={item.hexColor}
|
201
|
+
locked={item.locked}
|
202
|
+
positionLocked={item.positionLocked}
|
203
|
+
onAddItem={() => this.props.onAddItem
|
204
|
+
&& this.props.onAddItem(index, item)}
|
205
|
+
/>
|
125
206
|
))}
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
207
|
+
{(this.props.addItem && !this.props.readOnly) &&
|
208
|
+
<div className={`table-list__add-item table-list__item--margin`}>
|
209
|
+
<Tooltip text='Add item' flow='top' appendToBody={true}>
|
210
|
+
<div className='table-list__add-item--container sd-margin-x--auto'>
|
211
|
+
{this.dropDown()}
|
212
|
+
</div>
|
213
|
+
</Tooltip>
|
214
|
+
</div>
|
215
|
+
}
|
216
|
+
</div>
|
217
|
+
: (this.props.addItem && !this.props.readOnly) ? <div role='list' className={classes}>
|
218
|
+
<div className={`table-list__add-item table-list__item--margin`}>
|
219
|
+
<Tooltip text='Add item' flow='top' appendToBody={true}>
|
220
|
+
<div className='table-list__add-item--container sd-margin-x--auto'>
|
221
|
+
{this.dropDown()}
|
222
|
+
</div>
|
223
|
+
</Tooltip>
|
224
|
+
</div>
|
225
|
+
</div>
|
226
|
+
: null
|
131
227
|
);
|
132
228
|
}
|
133
229
|
}
|
@@ -138,19 +234,74 @@ export interface IPropsItem {
|
|
138
234
|
end?: React.ReactNode;
|
139
235
|
action?: React.ReactNode;
|
140
236
|
addItem?: boolean;
|
141
|
-
itemsDropdown?: any;
|
142
237
|
dragAndDrop?: boolean;
|
238
|
+
hexColor?: string;
|
239
|
+
showDragHandle?: 'always' | 'onHover' | 'none';
|
240
|
+
locked?: boolean;
|
241
|
+
positionLocked?: boolean;
|
143
242
|
onClick?(): void;
|
243
|
+
onDoubleClick?(): void;
|
244
|
+
onSelect?(): void;
|
245
|
+
onAddItem?(e: number): void;
|
246
|
+
itemsDropdown?(index?: number): Array<IMenuItem | ISubmenu | IMenuGroup | 'divider'>;
|
144
247
|
}
|
145
248
|
|
146
249
|
class TableListItem extends React.PureComponent<IPropsItem> {
|
250
|
+
private timer: any;
|
251
|
+
private delay = 200;
|
252
|
+
private prevent = false;
|
253
|
+
|
254
|
+
onSingleClick = () => {
|
255
|
+
let selection = window.getSelection();
|
256
|
+
this.timer = setTimeout(() => {
|
257
|
+
if (!this.prevent && this.props.onClick && selection) {
|
258
|
+
if (this.props.dragAndDrop) {
|
259
|
+
this.props.onClick();
|
260
|
+
} else {
|
261
|
+
if (selection.toString().length < 1) {
|
262
|
+
this.props.onClick();
|
263
|
+
}
|
264
|
+
}
|
265
|
+
}
|
266
|
+
}, this.delay);
|
267
|
+
}
|
268
|
+
|
269
|
+
onDoubleClick = () => {
|
270
|
+
clearTimeout(this.timer);
|
271
|
+
this.prevent = true;
|
272
|
+
if (this.props.onDoubleClick) {
|
273
|
+
this.props.onDoubleClick();
|
274
|
+
}
|
275
|
+
setTimeout(() => {
|
276
|
+
this.prevent = false;
|
277
|
+
}, this.delay);
|
278
|
+
}
|
279
|
+
|
280
|
+
onActionMenuClick = (event: React.MouseEvent<HTMLElement>) => {
|
281
|
+
event.preventDefault();
|
282
|
+
event.stopPropagation();
|
283
|
+
}
|
284
|
+
|
147
285
|
render() {
|
286
|
+
|
287
|
+
let classes = classNames('table-list__item', {
|
288
|
+
'table-list__item--clickable': this.props.onClick,
|
289
|
+
'table-list__item--draggable': this.props.dragAndDrop,
|
290
|
+
'table-list__item--locked': this.props.locked,
|
291
|
+
'table-list__item--position-locked': this.props.positionLocked,
|
292
|
+
'table-list__item--drag-handles-always': !this.props.showDragHandle,
|
293
|
+
'table-list__item--drag-handles-none': this.props.showDragHandle === 'none',
|
294
|
+
});
|
295
|
+
|
148
296
|
return (
|
149
297
|
this.props.addItem ?
|
150
|
-
<
|
298
|
+
<div className='table-list__item-container'>
|
151
299
|
<div
|
152
|
-
|
153
|
-
|
300
|
+
role='listitem'
|
301
|
+
onClick={() => this.onSingleClick()}
|
302
|
+
onDoubleClick={() => this.onDoubleClick()}
|
303
|
+
className={classes}>
|
304
|
+
<div className='table-list__item-border' style={{ backgroundColor: this.props.hexColor }}></div>
|
154
305
|
<div className='table-list__item-content'>
|
155
306
|
<div className='table-list__item-content-block'>
|
156
307
|
{this.props.start && this.props.start}
|
@@ -162,15 +313,18 @@ class TableListItem extends React.PureComponent<IPropsItem> {
|
|
162
313
|
{this.props.end && this.props.end}
|
163
314
|
</div>
|
164
315
|
</div>
|
165
|
-
{this.props.action &&
|
166
|
-
|
167
|
-
|
316
|
+
{this.props.action &&
|
317
|
+
<div className='table-list__slide-in-actions'
|
318
|
+
onClick={this.onActionMenuClick}>
|
319
|
+
{this.props.action}
|
320
|
+
</div>}
|
168
321
|
</div>
|
169
322
|
<div className='table-list__add-bar-container'>
|
170
323
|
<Tooltip text='Add item' flow='top' appendToBody={true}>
|
171
324
|
<div className='table-list__add-bar'>
|
172
325
|
<Dropdown
|
173
|
-
|
326
|
+
onChange={this.props.onAddItem}
|
327
|
+
items={this.props.itemsDropdown ? this.props.itemsDropdown() : []}>
|
174
328
|
<Button
|
175
329
|
type="primary"
|
176
330
|
icon="plus-large"
|
@@ -184,10 +338,13 @@ class TableListItem extends React.PureComponent<IPropsItem> {
|
|
184
338
|
</div>
|
185
339
|
</Tooltip>
|
186
340
|
</div>
|
187
|
-
</
|
188
|
-
: <
|
189
|
-
|
190
|
-
|
341
|
+
</div>
|
342
|
+
: <div
|
343
|
+
role='listitem'
|
344
|
+
className={`${classes} table-list__item--margin`}
|
345
|
+
onClick={() => this.onSingleClick()}
|
346
|
+
onDoubleClick={() => this.onDoubleClick()}>
|
347
|
+
<div className='table-list__item-border' style={{ backgroundColor: this.props.hexColor }}></div>
|
191
348
|
<div className='table-list__item-content'>
|
192
349
|
<div className='table-list__item-content-block'>
|
193
350
|
{this.props.start && this.props.start}
|
@@ -199,14 +356,59 @@ class TableListItem extends React.PureComponent<IPropsItem> {
|
|
199
356
|
{this.props.end && this.props.end}
|
200
357
|
</div>
|
201
358
|
</div>
|
202
|
-
{this.props.action &&
|
203
|
-
|
204
|
-
|
205
|
-
|
359
|
+
{this.props.action &&
|
360
|
+
<div className='table-list__slide-in-actions'
|
361
|
+
onClick={this.onActionMenuClick}>
|
362
|
+
{this.props.action}
|
363
|
+
</div>}
|
364
|
+
</div>
|
206
365
|
);
|
207
366
|
}
|
208
367
|
}
|
209
368
|
|
369
|
+
class PortalItem extends React.PureComponent {
|
370
|
+
props: any;
|
371
|
+
render() {
|
372
|
+
const provided = this.props.provided;
|
373
|
+
const snapshot = this.props.snapshot;
|
374
|
+
|
375
|
+
const usePortal: boolean = snapshot.isDragging;
|
376
|
+
|
377
|
+
const child = (
|
378
|
+
<div
|
379
|
+
ref={provided.innerRef}
|
380
|
+
{...provided.draggableProps}
|
381
|
+
{...provided.dragHandleProps}>
|
382
|
+
<TableListItem
|
383
|
+
dragAndDrop={this.props.dragAndDrop}
|
384
|
+
start={this.props.item.start}
|
385
|
+
center={this.props.item.center}
|
386
|
+
end={this.props.item.end}
|
387
|
+
action={this.props.item.action}
|
388
|
+
onClick={this.props.item.onClick ? this.props.item.onClick : undefined}
|
389
|
+
onDoubleClick={this.props.item.onDoubleClick
|
390
|
+
? this.props.item.onDoubleClick
|
391
|
+
: undefined}
|
392
|
+
addItem={this.props.addItem}
|
393
|
+
itemsDropdown={this.props.itemsDropdown}
|
394
|
+
hexColor={this.props.item.hexColor}
|
395
|
+
locked={this.props.item.locked}
|
396
|
+
positionLocked={this.props.item.positionLocked}
|
397
|
+
onAddItem={() => this.props.onAddItem}
|
398
|
+
showDragHandle={this.props.showDragHandle}
|
399
|
+
/>
|
400
|
+
</div>
|
401
|
+
);
|
402
|
+
|
403
|
+
if (!usePortal) {
|
404
|
+
return child;
|
405
|
+
}
|
406
|
+
|
407
|
+
// if dragging - put the item in a portal
|
408
|
+
return ReactDOM.createPortal(child, document.body);
|
409
|
+
}
|
410
|
+
}
|
411
|
+
|
210
412
|
export {
|
211
413
|
TableList, TableListItem
|
212
414
|
};
|
@@ -131,7 +131,7 @@ export class Menu extends React.Component<IProps, {}> {
|
|
131
131
|
|
132
132
|
render() {
|
133
133
|
return (
|
134
|
-
<
|
134
|
+
<React.Fragment>
|
135
135
|
{
|
136
136
|
this.props.children(this.toggle)
|
137
137
|
}
|
@@ -167,7 +167,7 @@ export class Menu extends React.Component<IProps, {}> {
|
|
167
167
|
baseZIndex={this.props.zIndex ?? superdeskTopBarZIndex}
|
168
168
|
/>
|
169
169
|
</div>
|
170
|
-
</
|
170
|
+
</React.Fragment>
|
171
171
|
);
|
172
172
|
}
|
173
173
|
}
|
@@ -10,7 +10,9 @@ interface IProps {
|
|
10
10
|
contentBg?: 'default' | 'medium' | 'dark';
|
11
11
|
contentPadding?: 'none' | 'small' | 'medium' | 'large';
|
12
12
|
size?: 'small' | 'medium' | 'large' | 'x-large';
|
13
|
+
position?: "center" | "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right";
|
13
14
|
maximized?: boolean;
|
15
|
+
maximizable?: boolean;
|
14
16
|
headerTemplate?: JSX.Element | string;
|
15
17
|
footerTemplate?: JSX.Element | string;
|
16
18
|
closeOnEscape?: boolean;
|
@@ -23,8 +25,8 @@ export class Modal extends React.Component<IProps, {}> {
|
|
23
25
|
render() {
|
24
26
|
let classes = classNames({
|
25
27
|
[`p-dialog-content--${this.props.size}`]: this.props.size,
|
26
|
-
'p-dialog-content--default': this.props.contentBg === undefined,
|
27
|
-
[`p-dialog-content--${this.props.contentBg}`]: this.props.contentBg,
|
28
|
+
'p-dialog-content-bg--default': this.props.contentBg === undefined,
|
29
|
+
[`p-dialog-content-bg--${this.props.contentBg}`]: this.props.contentBg,
|
28
30
|
'p-dialog-content--s-padding': this.props.contentPadding === undefined,
|
29
31
|
[`p-dialog-content--${this.props.contentPadding}`]: this.props.contentPadding,
|
30
32
|
}, this.props.className);
|
@@ -38,10 +40,12 @@ export class Modal extends React.Component<IProps, {}> {
|
|
38
40
|
footer={this.props.footerTemplate}
|
39
41
|
closeOnEscape={this.props.closeOnEscape}
|
40
42
|
maximized={this.props.maximized}
|
43
|
+
maximizable={this.props.maximizable}
|
41
44
|
contentClassName={classes}
|
42
45
|
onShow={this.props.onShow}
|
43
46
|
onHide={this.props.onHide}
|
44
47
|
zIndex={this.props.zIndex}
|
48
|
+
position={this.props.position && this.props.position}
|
45
49
|
>
|
46
50
|
{this.props.children}
|
47
51
|
</PrimeDialog>
|
@@ -20,7 +20,7 @@ interface IProps<T> {
|
|
20
20
|
showSelectAll?: boolean;
|
21
21
|
itemTemplate?(item: any): JSX.Element | undefined;
|
22
22
|
selectedItemTemplate?(value: any): JSX.Element | undefined;
|
23
|
-
onChange(newValue:
|
23
|
+
onChange(newValue: T): void;
|
24
24
|
invalid?: boolean;
|
25
25
|
inlineLabel?: boolean;
|
26
26
|
labelHidden?: boolean;
|
@@ -8,12 +8,13 @@ interface IProps {
|
|
8
8
|
text?: string;
|
9
9
|
iconSize?: 'small' | 'big'; // defaults to 'small'
|
10
10
|
theme?: 'light' | 'dark'; // defaults to 'light'
|
11
|
-
type?: 'default' | 'primary' | 'highlight' | 'darker';
|
11
|
+
type?: 'default' | 'primary' | 'highlight' | 'darker' | 'dark';
|
12
12
|
state?: 'normal' | 'active'; // defaults to 'normal'
|
13
13
|
value?: 'button' | 'submit' | 'reset'; // defaults to 'button'
|
14
14
|
onClick(): void;
|
15
15
|
badgeValue?: string;
|
16
16
|
}
|
17
|
+
|
17
18
|
export class NavButton extends React.PureComponent<IProps> {
|
18
19
|
render() {
|
19
20
|
let classes = classNames('sd-navbtn', {
|
@@ -4,6 +4,8 @@ import { Icon } from '../Icon';
|
|
4
4
|
interface IProps {
|
5
5
|
items: Array<IItem | 'divider'>;
|
6
6
|
side?: 'none' | 'left' | 'right';
|
7
|
+
hover?: boolean;
|
8
|
+
onCLick?(): void;
|
7
9
|
}
|
8
10
|
|
9
11
|
interface IItem {
|
@@ -11,11 +13,14 @@ interface IItem {
|
|
11
13
|
size: 'small' | 'big'; // defaults to 'small'
|
12
14
|
tooltip?: string;
|
13
15
|
active?: boolean;
|
16
|
+
hover?: boolean;
|
17
|
+
onCLick?(): void;
|
14
18
|
}
|
15
19
|
|
16
20
|
interface IState {
|
17
21
|
index: number;
|
18
22
|
closeIndex: number;
|
23
|
+
hover: boolean;
|
19
24
|
}
|
20
25
|
|
21
26
|
export class SideBarMenu extends React.PureComponent<IProps, IState> {
|
@@ -24,8 +29,10 @@ export class SideBarMenu extends React.PureComponent<IProps, IState> {
|
|
24
29
|
this.state = {
|
25
30
|
index: -1,
|
26
31
|
closeIndex: -1,
|
32
|
+
hover: this.props.hover ? this.props.hover : false,
|
27
33
|
};
|
28
34
|
this.handleClick = this.handleClick.bind(this);
|
35
|
+
this.handleArrows = this.handleArrows.bind(this);
|
29
36
|
}
|
30
37
|
|
31
38
|
handleClick(indexNumber: number) {
|
@@ -39,10 +46,16 @@ export class SideBarMenu extends React.PureComponent<IProps, IState> {
|
|
39
46
|
}
|
40
47
|
}
|
41
48
|
|
49
|
+
handleArrows() {
|
50
|
+
this.setState({
|
51
|
+
hover: !this.state.hover,
|
52
|
+
});
|
53
|
+
}
|
54
|
+
|
42
55
|
render() {
|
43
56
|
return (
|
44
57
|
<div className='sd-sidebar-menu sd-content-wrapper__left-tabs'>
|
45
|
-
<ul className='authoring-active'>
|
58
|
+
<ul className={'authoring-active'}>
|
46
59
|
{this.props.items.map((item, index) => {
|
47
60
|
if (item === 'divider') {
|
48
61
|
return (
|
@@ -50,9 +63,22 @@ export class SideBarMenu extends React.PureComponent<IProps, IState> {
|
|
50
63
|
);
|
51
64
|
} else {
|
52
65
|
return (
|
53
|
-
<li key={index}
|
54
|
-
|
55
|
-
|
66
|
+
<li key={index}
|
67
|
+
data-sd-tooltip={item['tooltip']}
|
68
|
+
data-flow='right'
|
69
|
+
className={item.hover ? 'authoring-active__item' : ''}>
|
70
|
+
<a className={'sd-sidebar-menu__btn'
|
71
|
+
+ (this.state.hover ? ' sd-sidebar-menu__btn--closed ' : '')
|
72
|
+
+ (item['active'] ? ' sd-sidebar-menu__btn--active' : (index === this.state.index ? ' sd-sidebar-menu__btn--active' : ''))}
|
73
|
+
onClick={() => {
|
74
|
+
this.handleClick(index);
|
75
|
+
if (item.hover) {
|
76
|
+
this.handleArrows();
|
77
|
+
if (item.onCLick) {
|
78
|
+
item.onCLick();
|
79
|
+
}
|
80
|
+
}
|
81
|
+
}}>
|
56
82
|
<span className='sd-sidebar-menu__main-icon '>
|
57
83
|
<Icon size={item['size']} name={item['icon']} />
|
58
84
|
</span>
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
3
3
|
import {Icon} from './Icon';
|
4
4
|
|
5
5
|
interface IProps {
|
6
|
-
value?: string
|
6
|
+
value?: string;
|
7
7
|
type?: 'expanded' | 'collapsed' | 'boxed';
|
8
8
|
placeholder: string;
|
9
9
|
focused?: boolean;
|
@@ -79,9 +79,17 @@ export class SearchBar extends React.PureComponent<IProps, IState> {
|
|
79
79
|
onChange={(event) => this.setState({inputValue: event.target.value})}
|
80
80
|
onFocus={() => this.setState({focused: true})} />
|
81
81
|
{this.state.inputValue &&
|
82
|
-
<button className="sd-searchbar__cancel" onClick={() =>
|
82
|
+
<button className="sd-searchbar__cancel" onClick={() => {
|
83
|
+
this.setState({inputValue: ''});
|
84
|
+
setTimeout(() => {
|
85
|
+
if (this.props.onSubmit) {
|
86
|
+
this.props.onSubmit(this.state.inputValue);
|
87
|
+
}
|
88
|
+
});
|
89
|
+
}}>
|
83
90
|
<Icon name='remove-sign' />
|
84
91
|
</button>}
|
92
|
+
{this.state.inputValue &&
|
85
93
|
<button
|
86
94
|
id="sd-searchbar__search-btn"
|
87
95
|
className={`sd-searchbar__search-btn ${this.state.keyDown ? 'sd-searchbar__search-btn--active' : ''}`}
|
@@ -91,7 +99,7 @@ export class SearchBar extends React.PureComponent<IProps, IState> {
|
|
91
99
|
}
|
92
100
|
}}>
|
93
101
|
<Icon name='chevron-right-thin' />
|
94
|
-
</button>
|
102
|
+
</button>}
|
95
103
|
</div>
|
96
104
|
);
|
97
105
|
}
|