superdesk-ui-framework 3.0.1-beta.25 → 3.0.1-beta.26
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/styles/_sd-tag-input.scss +36 -1
- package/app/styles/_table-list.scss +1 -0
- package/app/styles/primereact/_pr-dialog.scss +4 -0
- package/app-typescript/components/Label.tsx +10 -6
- package/app-typescript/components/Layouts/AuthoringFrame.tsx +2 -1
- package/app-typescript/components/Layouts/AuthoringFrameRightBar.tsx +21 -2
- package/app-typescript/components/Lists/TableList.tsx +62 -2
- package/app-typescript/components/Menu.tsx +2 -2
- package/app-typescript/components/Spacer.tsx +1 -1
- package/app-typescript/components/TreeSelect.tsx +85 -33
- package/dist/examples.bundle.js +1549 -1184
- package/dist/playgrounds/react-playgrounds/Index.tsx +1 -0
- package/dist/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
- package/dist/react/TableList.tsx +2 -0
- package/dist/react/TreeSelect.tsx +100 -78
- package/dist/superdesk-ui.bundle.css +34 -2
- package/dist/superdesk-ui.bundle.js +1132 -1059
- package/dist/vendor.bundle.js +4 -4
- package/examples/index.js +4 -0
- package/examples/pages/playgrounds/react-playgrounds/Index.tsx +1 -0
- package/examples/pages/playgrounds/react-playgrounds/Multiedit.tsx +321 -0
- package/examples/pages/react/TableList.tsx +2 -0
- package/examples/pages/react/TreeSelect.tsx +100 -78
- package/package.json +1 -1
- package/react/components/Label.d.ts +1 -1
- package/react/components/Label.js +10 -5
- 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/Lists/TableList.d.ts +1 -0
- package/react/components/Lists/TableList.js +34 -6
- package/react/components/Menu.js +1 -1
- package/react/components/TreeSelect.d.ts +3 -1
- package/react/components/TreeSelect.js +50 -23
@@ -4,6 +4,7 @@ export { TestGround } from './TestGround';
|
|
4
4
|
export { UiPlayground } from './UiPlayground';
|
5
5
|
export { PageLayoutTest } from './PageLayoutTest';
|
6
6
|
export { EditorTest } from './EditorTest';
|
7
|
+
export { Multiedit } from './Multiedit';
|
7
8
|
export { RundownEditor } from './RundownEditor';
|
8
9
|
export { PersonalProfile } from './PersonalProfile';
|
9
10
|
export { Rundowns } from './Rundowns';
|
@@ -0,0 +1,321 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import * as Components from './components/Index';
|
3
|
+
import { ButtonGroup, Button, NavButton, SubNav, Dropdown, Input, IconButton, Divider, Tooltip, Select, Option, Switch, Icon, AvatarWrapper, AvatarContentImage, AvatarContentText, Text, EmptyState, Alert, SlidingToolbar, TabLabel, Tabs, Heading, Modal } from '../../../../app-typescript/index';
|
4
|
+
import * as Layout from '../../../../app-typescript/components/Layouts';
|
5
|
+
import * as Form from '../../../../app-typescript/components/Form';
|
6
|
+
import * as Nav from '../../../../app-typescript/components/Navigation';
|
7
|
+
import { BoxedList, BoxedListItem, BoxedListContentRow } from '../../../../app-typescript/components/Lists';
|
8
|
+
import { Spacer } from '../../../../app-typescript/components/Spacer';
|
9
|
+
|
10
|
+
interface IProps {
|
11
|
+
children?: React.ReactNode;
|
12
|
+
}
|
13
|
+
|
14
|
+
interface IState {
|
15
|
+
theme: 'dark' | 'light' | string;
|
16
|
+
itemType: string;
|
17
|
+
dropDownState: string;
|
18
|
+
itemSelected1: boolean;
|
19
|
+
itemSelected2: boolean;
|
20
|
+
itemSelected3: boolean;
|
21
|
+
value1: boolean;
|
22
|
+
value2: boolean;
|
23
|
+
value3: boolean;
|
24
|
+
leftPanelOpen: boolean;
|
25
|
+
rightPanelOpen: boolean;
|
26
|
+
rightPanelPinned: boolean;
|
27
|
+
sideOverlayOpen: boolean;
|
28
|
+
sideBarOpen: boolean;
|
29
|
+
arr: any;
|
30
|
+
}
|
31
|
+
|
32
|
+
export class Multiedit extends React.Component<IProps, IState> {
|
33
|
+
constructor(props: IProps) {
|
34
|
+
super(props);
|
35
|
+
this.state = {
|
36
|
+
theme: 'light',
|
37
|
+
itemType: 'itemtype01',
|
38
|
+
dropDownState: '',
|
39
|
+
itemSelected1: false,
|
40
|
+
itemSelected2: false,
|
41
|
+
itemSelected3: false,
|
42
|
+
value1: false,
|
43
|
+
value2: false,
|
44
|
+
value3: false,
|
45
|
+
leftPanelOpen: false,
|
46
|
+
rightPanelOpen: false,
|
47
|
+
rightPanelPinned: false,
|
48
|
+
sideOverlayOpen: false,
|
49
|
+
sideBarOpen: false,
|
50
|
+
arr: [<Editor />, <Editor />]
|
51
|
+
|
52
|
+
}
|
53
|
+
this.handleTheme = this.handleTheme.bind(this);
|
54
|
+
}
|
55
|
+
|
56
|
+
handleTheme(newTheme: string) {
|
57
|
+
this.setState({
|
58
|
+
theme: newTheme
|
59
|
+
})
|
60
|
+
}
|
61
|
+
|
62
|
+
changeStatus(item: any, status: string) {
|
63
|
+
if (item.status.includes(status)) {
|
64
|
+
item.status.splice(item.status.indexOf(status), 1);
|
65
|
+
} else {
|
66
|
+
item.status.push(status);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
render() {
|
71
|
+
return (
|
72
|
+
<Modal
|
73
|
+
className='p-dialog-flex'
|
74
|
+
onHide={() => false}
|
75
|
+
maximized={true} contentPadding={"none"}
|
76
|
+
headerTemplate="Multiedit"
|
77
|
+
visible={true} >
|
78
|
+
<Spacer children={this.state.arr} gap={'0'}></Spacer>
|
79
|
+
<div style={{
|
80
|
+
padding: '0 20px',
|
81
|
+
display: 'flex',
|
82
|
+
alignItems: 'center'
|
83
|
+
}}>
|
84
|
+
<Dropdown
|
85
|
+
append
|
86
|
+
items={[
|
87
|
+
{ label: 'Action 1', onSelect: () => this.setState({arr: [...this.state.arr, <Editor />]}) },
|
88
|
+
]}>
|
89
|
+
<Button type="primary" icon="plus-large" text="Add article" style="filled" size="large" shape="round" iconOnly={true} onClick={()=> false} />
|
90
|
+
</Dropdown>
|
91
|
+
</div>
|
92
|
+
</Modal>
|
93
|
+
);
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
interface IEditor {
|
98
|
+
sideBarOpen?: boolean;
|
99
|
+
}
|
100
|
+
|
101
|
+
export class Editor extends React.Component<IEditor, IEditor> {
|
102
|
+
constructor(props: IEditor) {
|
103
|
+
super(props);
|
104
|
+
this.state = {
|
105
|
+
sideBarOpen: false,
|
106
|
+
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
render() {
|
111
|
+
return <div style={{borderRight: '4px solid grey'}}>
|
112
|
+
<Layout.AuthoringFrame
|
113
|
+
header={(
|
114
|
+
<SubNav zIndex={2}>
|
115
|
+
<ButtonGroup align='end'>
|
116
|
+
<ButtonGroup subgroup={true} spaces="no-space">
|
117
|
+
<Tooltip text='More actions' flow='left'>
|
118
|
+
<NavButton type='default' icon='dots-vertical' text='More actions' onClick={()=> false} />
|
119
|
+
</Tooltip>
|
120
|
+
<Tooltip text='Send to / Publish' flow='left'>
|
121
|
+
<NavButton type='highlight' icon='send-to' iconSize='big' text='Send to / Publish' onClick={()=> false} />
|
122
|
+
</Tooltip>
|
123
|
+
<Tooltip text='Send to / Publish' flow='left'>
|
124
|
+
<NavButton type='darker' icon={this.state.sideBarOpen ? 'forward-thin' : 'backward-thin'} text='More actions' onClick={()=> this.setState({sideBarOpen: !this.state.sideBarOpen})} />
|
125
|
+
</Tooltip>
|
126
|
+
</ButtonGroup>
|
127
|
+
</ButtonGroup>
|
128
|
+
</SubNav>
|
129
|
+
)}
|
130
|
+
main={(
|
131
|
+
<Layout.AuthoringMain
|
132
|
+
headerPadding='medium'
|
133
|
+
toolBar={(
|
134
|
+
<React.Fragment>
|
135
|
+
<div className="sd-editor-toolbar__content">
|
136
|
+
<dl>
|
137
|
+
<dt>Created</dt>
|
138
|
+
<dd><time title="July 29, 2021 3:58 PM">07/29</time></dd>
|
139
|
+
<dt>by</dt>
|
140
|
+
<dt>Nareg Asmarian</dt>
|
141
|
+
</dl>
|
142
|
+
<dl>
|
143
|
+
<dt>Modified</dt>
|
144
|
+
<dd><time title="July 29, 2021 3:58 PM">07/29</time></dd>
|
145
|
+
</dl>
|
146
|
+
</div>
|
147
|
+
<ButtonGroup align='end'>
|
148
|
+
<IconButton icon="preview-mode" toolTipAppend={true} ariaValue="Print preview" onClick={()=> false} />
|
149
|
+
<IconButton icon="adjust" ariaValue="Toogle theme" onClick={()=> false} />
|
150
|
+
<IconButton icon="switches" ariaValue="Theme settings" onClick={()=> false} />
|
151
|
+
</ButtonGroup>
|
152
|
+
</React.Fragment>
|
153
|
+
)}
|
154
|
+
authoringHeader ={(
|
155
|
+
<React.Fragment>
|
156
|
+
<Form.FormGroup inlineLabel={true}>
|
157
|
+
<Form.FormItem>
|
158
|
+
<Input
|
159
|
+
type='text'
|
160
|
+
label='Slugline'
|
161
|
+
value='This is some value'
|
162
|
+
maxLength={30}
|
163
|
+
error='This is error message'
|
164
|
+
info='This is some hint message'
|
165
|
+
required={false}
|
166
|
+
disabled={false}
|
167
|
+
invalid={false}
|
168
|
+
onChange={(value) => {}} />
|
169
|
+
</Form.FormItem>
|
170
|
+
<Form.FormItem>
|
171
|
+
<Input
|
172
|
+
type='text'
|
173
|
+
label='Slugline'
|
174
|
+
value='This is some value'
|
175
|
+
maxLength={30}
|
176
|
+
error='This is error message'
|
177
|
+
info='This is some hint message'
|
178
|
+
required={false}
|
179
|
+
disabled={false}
|
180
|
+
invalid={false}
|
181
|
+
onChange={(value) => {}} />
|
182
|
+
</Form.FormItem>
|
183
|
+
</Form.FormGroup>
|
184
|
+
<Form.FormGroup inlineLabel={true}>
|
185
|
+
<Form.FormItem>
|
186
|
+
<Input
|
187
|
+
type='text'
|
188
|
+
label='Genre'
|
189
|
+
value='This is some value'
|
190
|
+
maxLength={30}
|
191
|
+
error='This is error message'
|
192
|
+
info='This is some hint message'
|
193
|
+
required={false}
|
194
|
+
disabled={false}
|
195
|
+
invalid={false}
|
196
|
+
onChange={(value) => {}} />
|
197
|
+
</Form.FormItem>
|
198
|
+
</Form.FormGroup>
|
199
|
+
<Form.FormGroup marginBottom='0' inlineLabel={true}>
|
200
|
+
<Form.FormItem>
|
201
|
+
<Input
|
202
|
+
type='text'
|
203
|
+
label='Subject'
|
204
|
+
value='This is some value'
|
205
|
+
maxLength={30}
|
206
|
+
error='This is error message'
|
207
|
+
info='This is some hint message'
|
208
|
+
required={true}
|
209
|
+
disabled={false}
|
210
|
+
invalid={false}
|
211
|
+
onChange={(value) => {}} />
|
212
|
+
</Form.FormItem>
|
213
|
+
<Form.FormItem autoWidth={true}>
|
214
|
+
<Form.FormText>Just testing:</Form.FormText>
|
215
|
+
</Form.FormItem>
|
216
|
+
<Form.FormItem>
|
217
|
+
<Select
|
218
|
+
label='Categories'
|
219
|
+
labelHidden={true}
|
220
|
+
value='This is some value'
|
221
|
+
error='This is error message'
|
222
|
+
info='This is some hint message'
|
223
|
+
required={true}
|
224
|
+
disabled={false}
|
225
|
+
invalid={false}
|
226
|
+
onChange={(value) => {}}>
|
227
|
+
<Option>Option 1</Option>
|
228
|
+
<Option>Option 2</Option>
|
229
|
+
</Select>
|
230
|
+
</Form.FormItem>
|
231
|
+
<Form.FormItem autoWidth={true}>
|
232
|
+
<ButtonGroup>
|
233
|
+
<IconButton ariaValue="Submit" icon="picture" onClick={()=> false} />
|
234
|
+
<Button text="Cancel" onClick={()=> false} type="default" style="hollow" />
|
235
|
+
<Button text="Submit" onClick={()=> false} type="primary" />
|
236
|
+
</ButtonGroup>
|
237
|
+
</Form.FormItem>
|
238
|
+
</Form.FormGroup>
|
239
|
+
</React.Fragment>
|
240
|
+
)}>
|
241
|
+
</Layout.AuthoringMain>
|
242
|
+
)}
|
243
|
+
sidePanel={(
|
244
|
+
<Layout.Panel side='right' background='grey' open={false} size='x-small'>
|
245
|
+
<Layout.PanelHeader title='Pinned content' onClose={() => false}>
|
246
|
+
</Layout.PanelHeader>
|
247
|
+
<Layout.PanelContent>
|
248
|
+
<Layout.PanelContentBlock>
|
249
|
+
<BoxedList density='comfortable'>
|
250
|
+
<BoxedListItem
|
251
|
+
type="success"
|
252
|
+
clickable={true}
|
253
|
+
media={(
|
254
|
+
<Icon name='slideshow' />
|
255
|
+
)}
|
256
|
+
actions={(
|
257
|
+
<IconButton icon="dots-vertical" ariaValue="More actions" onClick={()=> false} />
|
258
|
+
)}
|
259
|
+
>
|
260
|
+
<BoxedListContentRow>
|
261
|
+
Maecenas sed diam eget risus varius blandit sit amet non magna. Vestibulum id ligula porta felis euismod semper.
|
262
|
+
</BoxedListContentRow>
|
263
|
+
<BoxedListContentRow>
|
264
|
+
Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
|
265
|
+
</BoxedListContentRow>
|
266
|
+
</BoxedListItem>
|
267
|
+
<BoxedListItem
|
268
|
+
type="warning"
|
269
|
+
media={(
|
270
|
+
<AvatarWrapper
|
271
|
+
size="medium"
|
272
|
+
>
|
273
|
+
<AvatarContentText text="JL" tooltipText="Jeffrey Lebowski" />
|
274
|
+
</AvatarWrapper>
|
275
|
+
)}
|
276
|
+
footer={(
|
277
|
+
<ButtonGroup align="end">
|
278
|
+
<Button text="cancel" size="small" style="hollow" onClick={()=> false} />
|
279
|
+
<Button text="yes" size="small" style="hollow" type="primary" onClick={()=> false} />
|
280
|
+
</ButtonGroup>
|
281
|
+
)}
|
282
|
+
actions={(
|
283
|
+
<IconButton icon="dots-vertical" ariaValue="More actions" onClick={()=> false} />
|
284
|
+
)}
|
285
|
+
>
|
286
|
+
<BoxedListContentRow>
|
287
|
+
Maecenas sed diam eget risus varius blandit sit amet magna.
|
288
|
+
</BoxedListContentRow>
|
289
|
+
</BoxedListItem>
|
290
|
+
<BoxedListItem
|
291
|
+
selected={true}
|
292
|
+
actions={(
|
293
|
+
<IconButton icon="dots-vertical" ariaValue="More actions" onClick={()=> false} />
|
294
|
+
)}
|
295
|
+
>
|
296
|
+
<BoxedListContentRow>
|
297
|
+
Maecenas sed diam eget risus varius blandit sit amet magna. Vestibulum id ligula porta felis euismod semper.
|
298
|
+
</BoxedListContentRow>
|
299
|
+
</BoxedListItem>
|
300
|
+
</BoxedList>
|
301
|
+
</Layout.PanelContentBlock>
|
302
|
+
</Layout.PanelContent>
|
303
|
+
</Layout.Panel>
|
304
|
+
)}
|
305
|
+
|
306
|
+
sideBarClosed={this.state.sideBarOpen}
|
307
|
+
sideBar={(
|
308
|
+
<Nav.SideBarTabs
|
309
|
+
items={[
|
310
|
+
{ icon: 'info', size: 'big', tooltip: 'Info', onClick: () => false },
|
311
|
+
{ icon: 'chat', size: 'big', tooltip: 'Comments', onClick: () => false },
|
312
|
+
{ icon: 'history', size: 'big', tooltip: 'History', onClick: () => false },
|
313
|
+
{ icon: 'package', size: 'big', tooltip: 'Packages', onClick: () => false },
|
314
|
+
{ icon: 'attachment', size: 'big', tooltip: 'Attachments', onClick: () => false },
|
315
|
+
{ icon: 'comments', size: 'big', tooltip: 'Inline Comments', onClick: () => false },
|
316
|
+
{ icon: 'suggestion', size: 'big', tooltip: 'Suggestions', onClick: () => false }]} />
|
317
|
+
)}
|
318
|
+
/>
|
319
|
+
</div>
|
320
|
+
}
|
321
|
+
}
|
package/dist/react/TableList.tsx
CHANGED
@@ -98,6 +98,7 @@ export default class TableListDoc extends React.Component<IProps, IState> {
|
|
98
98
|
<Markup.ReactMarkupPreview>
|
99
99
|
<TableList
|
100
100
|
dragAndDrop
|
101
|
+
append
|
101
102
|
addItem
|
102
103
|
array={this.state.array}
|
103
104
|
itemsDropdown={(index) => [
|
@@ -135,6 +136,7 @@ export default class TableListDoc extends React.Component<IProps, IState> {
|
|
135
136
|
<Prop name='className' isRequired={false} type='string' default='false' description='Add class on TableList container.' />
|
136
137
|
<Prop name='showDragHandle' isRequired={false} type='string' default='always' description='"always" | "onHover" | "none".' />
|
137
138
|
<Prop name='readOnly' isRequired={false} type='boolean' default='false' description='When specified, component changes are not enabled.' />
|
139
|
+
<Prop name='append' isRequired={false} type='boolean' default='false' description='Set append to body on individual item while draging.' />
|
138
140
|
<Prop name='onDrag' isRequired={false} type='function' default='false' description='Returns start and end position of draggable item' />
|
139
141
|
<Prop name='onAddItem' isRequired={false} type='function' default='false' description='Returns index of draggable item.' />
|
140
142
|
<Prop name='itemsDropdown' isRequired={false} type='function' default='false' description='Dropdown for adding items in the list. Returns index of draggable item.' />
|
@@ -13,51 +13,79 @@ interface IState {
|
|
13
13
|
arr: any;
|
14
14
|
}
|
15
15
|
|
16
|
-
let
|
16
|
+
let options = [
|
17
17
|
{
|
18
|
-
value: 'Category1',
|
18
|
+
value: {name: 'Category1'},
|
19
19
|
children: [
|
20
20
|
{
|
21
|
-
value: 'Sub-
|
21
|
+
value: {name: 'Sub-category1'},
|
22
22
|
children: [
|
23
|
-
{value: '
|
23
|
+
{value: {name: 'Item20'}}
|
24
24
|
]
|
25
25
|
},
|
26
26
|
{
|
27
|
-
value: 'Sub-
|
27
|
+
value: {name: 'Sub-category2'},
|
28
|
+
children: [
|
29
|
+
{value: {name: 'Item21'}}
|
30
|
+
]
|
31
|
+
}
|
32
|
+
,
|
33
|
+
{
|
34
|
+
value: {name: 'Sub-category3'},
|
35
|
+
children: [
|
36
|
+
{value: {name: 'Item22'}}
|
37
|
+
]
|
38
|
+
}
|
39
|
+
,
|
40
|
+
{
|
41
|
+
value: {name: 'Sub-category4'},
|
42
|
+
children: [
|
43
|
+
{value: {name: 'Item23'}}
|
44
|
+
]
|
45
|
+
}
|
46
|
+
,
|
47
|
+
{
|
48
|
+
value: {name: 'Sub-category5'},
|
28
49
|
children: [
|
29
|
-
{value: '
|
50
|
+
{value: {name: 'Item24'}}
|
51
|
+
]
|
52
|
+
}
|
53
|
+
,
|
54
|
+
{
|
55
|
+
value: {name: 'Sub-category6'},
|
56
|
+
children: [
|
57
|
+
{value: {name: 'Item25'}}
|
30
58
|
]
|
31
59
|
}
|
32
60
|
]
|
33
61
|
},
|
34
62
|
{
|
35
|
-
value: 'Category2',
|
63
|
+
value: {name: 'Category2'},
|
36
64
|
children: [
|
37
65
|
{
|
38
|
-
value: '
|
66
|
+
value: {name: 'Item8'}
|
39
67
|
},
|
40
68
|
{
|
41
|
-
value: '
|
69
|
+
value: {name: 'Item9'}
|
42
70
|
}
|
43
71
|
]
|
44
72
|
},
|
45
73
|
{
|
46
|
-
value: 'Category3',
|
74
|
+
value: {name: 'Category3', bgColor: 'red'},
|
47
75
|
children: [
|
48
76
|
{
|
49
|
-
value: '
|
77
|
+
value: {name: 'Item10'}
|
50
78
|
},
|
51
79
|
{
|
52
|
-
value: '
|
80
|
+
value: {name: 'Item11'}
|
53
81
|
}
|
54
82
|
]
|
55
83
|
},
|
56
84
|
]
|
57
85
|
|
58
|
-
let
|
86
|
+
let options2 = [
|
59
87
|
{
|
60
|
-
value: {name: 'Category1'},
|
88
|
+
value: {name: 'Category1', border: 'red'},
|
61
89
|
children: [
|
62
90
|
{
|
63
91
|
value: {name: 'Sub-category1'},
|
@@ -102,7 +130,7 @@ let itemArr2 = [
|
|
102
130
|
]
|
103
131
|
},
|
104
132
|
{
|
105
|
-
value: {name: 'Category2'},
|
133
|
+
value: {name: 'Category2', border: 'green'},
|
106
134
|
children: [
|
107
135
|
{
|
108
136
|
value: {name: 'Item8'}
|
@@ -113,7 +141,7 @@ let itemArr2 = [
|
|
113
141
|
]
|
114
142
|
},
|
115
143
|
{
|
116
|
-
value: {name: 'Category3'},
|
144
|
+
value: {name: 'Category3', border: 'yellow'},
|
117
145
|
children: [
|
118
146
|
{
|
119
147
|
value: {name: 'Item10'}
|
@@ -125,37 +153,6 @@ let itemArr2 = [
|
|
125
153
|
},
|
126
154
|
]
|
127
155
|
|
128
|
-
const source = [
|
129
|
-
{
|
130
|
-
'name': 'Article (news)',
|
131
|
-
'qcode': 'Article (news)',
|
132
|
-
},
|
133
|
-
{
|
134
|
-
'name': 'Article',
|
135
|
-
'qcode': 'Article',
|
136
|
-
},
|
137
|
-
{
|
138
|
-
'name': 'Sidebar',
|
139
|
-
'qcode': 'Sidebar',
|
140
|
-
},
|
141
|
-
{
|
142
|
-
'name': 'Factbox',
|
143
|
-
'qcode': 'Factbox',
|
144
|
-
},
|
145
|
-
{
|
146
|
-
'name': 'Item',
|
147
|
-
'qcode': 'Item',
|
148
|
-
},
|
149
|
-
{
|
150
|
-
'name': 'Array',
|
151
|
-
'qcode': 'Array',
|
152
|
-
},
|
153
|
-
{
|
154
|
-
'name': 'Object',
|
155
|
-
'qcode': 'Object',
|
156
|
-
},
|
157
|
-
];
|
158
|
-
|
159
156
|
let fetchedArr = [];
|
160
157
|
fetch('https://nominatim.openstreetmap.org/search/berlin?format=json&addressdetails=1&limit=20').then(response => response.json()).then(data => fetchedArr = data
|
161
158
|
);
|
@@ -186,8 +183,8 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
|
|
186
183
|
this.state = {
|
187
184
|
value: [],
|
188
185
|
value2: [],
|
189
|
-
options:
|
190
|
-
options2:
|
186
|
+
options: options,
|
187
|
+
options2: options,
|
191
188
|
inputValue: '',
|
192
189
|
arr: []
|
193
190
|
}
|
@@ -228,21 +225,29 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
|
|
228
225
|
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
229
226
|
<div className='form__row'>
|
230
227
|
<TreeSelect
|
228
|
+
value={[{name: 'Item1'}, {name: 'Item2'}]}
|
229
|
+
getOptions={() => options}
|
230
|
+
kind={'synchronous'}
|
231
231
|
getId={(item) => item.name}
|
232
232
|
getLabel={(item) => item.name}
|
233
|
-
|
234
|
-
value={[{name: 'Item1'}, {name: 'Item2'}]}
|
233
|
+
getBackgroundColor={(item: any) => item.bgColor}
|
235
234
|
selectBranchWithChildren={true}
|
236
|
-
onChange={(e) => console.log(e)}
|
237
235
|
allowMultiple
|
238
|
-
kind={'synchronous'}
|
239
236
|
fullWidth
|
237
|
+
singleLevelSearch
|
238
|
+
required
|
240
239
|
info={'Info Message'}
|
241
240
|
error={'Error Message'}
|
242
|
-
required
|
243
241
|
label={'TreeSelect Label'}
|
244
|
-
singleLevelSearch
|
245
242
|
searchPlaceholder='Search...'
|
243
|
+
onChange={(e) => false}
|
244
|
+
valueTemplate={(item, Wrapper) => {
|
245
|
+
return (
|
246
|
+
<Wrapper backgroundColor={item.bgColor}>
|
247
|
+
<span>{item.name}</span>
|
248
|
+
</Wrapper>
|
249
|
+
);
|
250
|
+
}}
|
246
251
|
/>
|
247
252
|
</div>
|
248
253
|
</div>
|
@@ -250,21 +255,29 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
|
|
250
255
|
|
251
256
|
<Markup.ReactMarkupCode>{`
|
252
257
|
<TreeSelect
|
258
|
+
value={[{name: 'Item1'}, {name: 'Item2'}]}
|
259
|
+
getOptions={() => options}
|
260
|
+
kind={'synchronous'}
|
253
261
|
getId={(item) => item.name}
|
254
262
|
getLabel={(item) => item.name}
|
255
|
-
|
256
|
-
return itemArr2
|
257
|
-
}}
|
258
|
-
value={[{name: 'Item1'}, {name: 'Item2'}]}
|
263
|
+
getBackgroundColor={(item: any) => item.bgColor}
|
259
264
|
selectBranchWithChildren={true}
|
260
|
-
onChange={(e) => console.log(e)}
|
261
265
|
allowMultiple
|
262
|
-
kind={'synchronous'}
|
263
266
|
fullWidth
|
267
|
+
singleLevelSearch
|
268
|
+
required
|
264
269
|
info={'Info Message'}
|
265
270
|
error={'Error Message'}
|
266
|
-
required
|
267
271
|
label={'TreeSelect Label'}
|
272
|
+
searchPlaceholder='Search...'
|
273
|
+
onChange={(e) => false}
|
274
|
+
valueTemplate={(item, Wrapper) => {
|
275
|
+
return (
|
276
|
+
<Wrapper backgroundColor={item.bgColor}>
|
277
|
+
<span>{item.name}</span>
|
278
|
+
</Wrapper>
|
279
|
+
);
|
280
|
+
}}
|
268
281
|
/>
|
269
282
|
`}</Markup.ReactMarkupCode>
|
270
283
|
|
@@ -286,7 +299,6 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
|
|
286
299
|
}
|
287
300
|
getId={({qcode}) => qcode.display_name}
|
288
301
|
selectBranchWithChildren={false}
|
289
|
-
//optionTemplate={(item) => <span style={{color: 'blue'}}>{item.display_name}</span>}
|
290
302
|
allowMultiple={true}
|
291
303
|
/>
|
292
304
|
</div>
|
@@ -317,20 +329,23 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
|
|
317
329
|
<div className='docs-page__content-row docs-page__content-row--no-margin'>
|
318
330
|
<div className='form__row'>
|
319
331
|
<TreeSelect
|
332
|
+
getOptions={() => options2}
|
333
|
+
kind={'synchronous'}
|
320
334
|
getId={(item) => item.name}
|
321
335
|
getLabel={(item) => item.name}
|
336
|
+
getBackgroundColor={(item) => item.bgColor}
|
337
|
+
getBorderColor={(item) => item.border}
|
322
338
|
placeholder='Select one'
|
323
|
-
|
324
|
-
|
325
|
-
onChange={(e) => console.log(e)}
|
339
|
+
selectBranchWithChildren={true}
|
340
|
+
onChange={(e) => false}
|
326
341
|
optionTemplate={(item: any) => {
|
327
342
|
return <div>Label: {item.name}</div>
|
328
343
|
}}
|
329
|
-
valueTemplate={(item: any) => {
|
330
|
-
return <
|
344
|
+
valueTemplate={(item: any, Wrapper) => {
|
345
|
+
return <Wrapper borderColor={item.border}>
|
346
|
+
<span>{item.name}</span>
|
347
|
+
</Wrapper>
|
331
348
|
}}
|
332
|
-
//allowMultiple
|
333
|
-
//readOnly
|
334
349
|
/>
|
335
350
|
</div>
|
336
351
|
</div>
|
@@ -338,17 +353,22 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
|
|
338
353
|
|
339
354
|
<Markup.ReactMarkupCode>{`
|
340
355
|
<TreeSelect
|
356
|
+
getOptions={() => options2}
|
357
|
+
kind={'synchronous'}
|
341
358
|
getId={(item) => item.name}
|
342
359
|
getLabel={(item) => item.name}
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
360
|
+
getBackgroundColor={(item) => item.bgColor}
|
361
|
+
getBorderColor={(item) => item.border}
|
362
|
+
placeholder='Select one'
|
363
|
+
selectBranchWithChildren={true}
|
364
|
+
onChange={(e) => false}
|
347
365
|
optionTemplate={(item: any) => {
|
348
366
|
return <div>Label: {item.name}</div>
|
349
367
|
}}
|
350
|
-
valueTemplate={(item: any) => {
|
351
|
-
return <
|
368
|
+
valueTemplate={(item: any, Wrapper) => {
|
369
|
+
return <Wrapper borderColor={item.border}>
|
370
|
+
<span>{item.name}</span>
|
371
|
+
</Wrapper>
|
352
372
|
}}
|
353
373
|
/>
|
354
374
|
`}</Markup.ReactMarkupCode>
|
@@ -370,8 +390,10 @@ export class TreeSelectDocs extends React.Component<{}, IState> {
|
|
370
390
|
<Prop name='searchPlaceholder' isRequired={false} type='string' default='/' description='Filter input placeholder.'/>
|
371
391
|
<Prop name='getLabel' isRequired={true} type='Function' default='/' description='Callback to invoke when value changes.'/>
|
372
392
|
<Prop name='getId' isRequired={true} type='Function' default='/' description='Callback to invoke when value changes.'/>
|
373
|
-
<Prop name='
|
374
|
-
<Prop name='
|
393
|
+
<Prop name='getBackgroundColor' isRequired={true} type='Function' default='/' description='Function to return background color of individual item in options.'/>
|
394
|
+
<Prop name='getBorderColor' isRequired={true} type='Function' default='/' description='Function to return border color of individual item in options in single-select mode.'/>
|
395
|
+
<Prop name='valueTemplate' isRequired={false} type='Function(item, Wrapper)' default='/' description='Function that gets an item in the value and returns the content for it.'/>
|
396
|
+
<Prop name='optionTemplate' isRequired={false} type='Function(item)' default='/' description='Function that gets the option and returns the content for it.'/>
|
375
397
|
<Prop name='searchOptions' isRequired={false} type='Function' default='/' description='The function will be called when a search is initiated from UI in asynchronous mode.'/>
|
376
398
|
<Prop name='onChange' isRequired={true} type='Function' default='/' description='Callback to invoke when value changes.'/>
|
377
399
|
<Prop name='label' isRequired={false} type='string' default='/' description='Input label'/>
|