superdesk-ui-framework 3.0.36 → 3.0.38
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 +3 -5
- package/app/styles/_tag-labels.scss +0 -2
- package/app/styles/app.scss +1 -0
- package/app/styles/form-elements/_checkbox.scss +3 -0
- package/app/styles/form-elements/_input-preview.scss +70 -0
- package/app/styles/form-elements/_inputs.scss +10 -14
- package/app/styles/primereact/_pr-tag-input.scss +1 -1
- package/app-typescript/components/DatePicker.tsx +101 -101
- package/app-typescript/components/DurationInput.tsx +76 -76
- package/app-typescript/components/Form/InputNew.tsx +1 -1
- package/app-typescript/components/Form/InputWrapper.tsx +34 -18
- package/app-typescript/components/Input.tsx +38 -62
- package/app-typescript/components/MultiSelect.tsx +49 -47
- package/app-typescript/components/Select.tsx +13 -22
- package/app-typescript/components/SelectPreview.tsx +100 -0
- package/app-typescript/components/SelectWithTemplate.tsx +2 -12
- package/app-typescript/components/TagInput.tsx +25 -24
- package/app-typescript/components/TimePicker.tsx +13 -16
- package/app-typescript/components/TreeSelect.tsx +180 -131
- package/dist/examples.bundle.js +2323 -2189
- package/dist/react/Autocomplete.tsx +32 -31
- package/dist/react/DatePicker.tsx +56 -73
- package/dist/react/DurationInput.tsx +36 -47
- package/dist/react/Inputs.tsx +86 -248
- package/dist/react/MultiSelect.tsx +30 -23
- package/dist/react/Selects.tsx +12 -44
- package/dist/react/TagInputDocs.tsx +15 -21
- package/dist/react/TimePicker.tsx +25 -32
- package/dist/react/TreeSelect.tsx +97 -90
- package/dist/superdesk-ui.bundle.css +85 -18
- package/dist/superdesk-ui.bundle.js +1858 -1709
- package/dist/vendor.bundle.js +14 -14
- package/examples/pages/react/Autocomplete.tsx +32 -31
- package/examples/pages/react/DatePicker.tsx +56 -73
- package/examples/pages/react/DurationInput.tsx +36 -47
- package/examples/pages/react/Inputs.tsx +86 -248
- package/examples/pages/react/MultiSelect.tsx +30 -23
- package/examples/pages/react/Selects.tsx +12 -44
- package/examples/pages/react/TagInputDocs.tsx +15 -21
- package/examples/pages/react/TimePicker.tsx +25 -32
- package/examples/pages/react/TreeSelect.tsx +97 -90
- package/package.json +1 -1
- package/react/components/DatePicker.d.ts +2 -12
- package/react/components/DatePicker.js +14 -8
- package/react/components/DurationInput.d.ts +2 -11
- package/react/components/DurationInput.js +14 -4
- package/react/components/Form/InputNew.d.ts +1 -1
- package/react/components/Form/InputWrapper.d.ts +11 -5
- package/react/components/Form/InputWrapper.js +6 -9
- package/react/components/Input.d.ts +3 -19
- package/react/components/Input.js +8 -21
- package/react/components/MultiSelect.d.ts +4 -13
- package/react/components/MultiSelect.js +6 -2
- package/react/components/Select.d.ts +3 -15
- package/react/components/Select.js +7 -8
- package/react/components/SelectPreview.d.ts +17 -0
- package/react/components/SelectPreview.js +109 -0
- package/react/components/SelectWithTemplate.d.ts +2 -11
- package/react/components/SelectWithTemplate.js +0 -1
- package/react/components/TagInput.d.ts +3 -12
- package/react/components/TagInput.js +6 -2
- package/react/components/TimePicker.d.ts +2 -11
- package/react/components/TimePicker.js +6 -2
- package/react/components/TreeSelect.d.ts +2 -11
- package/react/components/TreeSelect.js +49 -26
@@ -1,48 +1,45 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import nextId from "react-id-generator";
|
3
3
|
import { InputWrapper } from './Form';
|
4
|
+
import {IInputWrapper} from './Form/InputWrapper';
|
4
5
|
|
5
|
-
interface IProps {
|
6
|
+
interface IProps extends IInputWrapper {
|
6
7
|
value: string; // will output time as ISO8601 time string(e.g. 16:55) or an empty string if there's no value
|
7
8
|
onChange(valueNext: string): void;
|
8
9
|
allowSeconds?: boolean;
|
9
|
-
disabled?: boolean;
|
10
|
-
inlineLabel?: boolean;
|
11
|
-
required?: boolean;
|
12
|
-
fullWidth?: boolean;
|
13
|
-
invalid?: boolean;
|
14
|
-
labelHidden?: boolean;
|
15
|
-
tabindex?: number;
|
16
|
-
label?: string;
|
17
|
-
info?: string;
|
18
|
-
error?: string;
|
19
10
|
}
|
20
11
|
|
21
12
|
export class TimePicker extends React.PureComponent<IProps> {
|
22
13
|
private htmlId = nextId();
|
23
14
|
|
24
15
|
render() {
|
16
|
+
if (this.props.preview) {
|
17
|
+
return (
|
18
|
+
<div>
|
19
|
+
<span>{this.props.value}</span>
|
20
|
+
</div>
|
21
|
+
);
|
22
|
+
}
|
23
|
+
|
25
24
|
return (
|
26
25
|
<InputWrapper
|
27
26
|
label={this.props.label}
|
28
27
|
error={this.props.error}
|
29
28
|
required={this.props.required}
|
30
29
|
disabled={this.props.disabled}
|
31
|
-
invalid={this.props.invalid}
|
32
30
|
info={this.props.info}
|
33
31
|
inlineLabel={this.props.inlineLabel}
|
34
32
|
labelHidden={this.props.labelHidden}
|
35
|
-
fullWidth={this.props.fullWidth}
|
36
33
|
htmlId={this.htmlId}
|
37
34
|
tabindex={this.props.tabindex}
|
38
35
|
>
|
39
36
|
<input
|
37
|
+
value={this.props.value}
|
38
|
+
type="time"
|
39
|
+
className="sd-input__input"
|
40
40
|
id={this.htmlId}
|
41
41
|
aria-labelledby={this.htmlId + 'label'}
|
42
|
-
type="time"
|
43
42
|
step={this.props.allowSeconds ? 1 : undefined}
|
44
|
-
className="sd-input__input"
|
45
|
-
value={this.props.value}
|
46
43
|
required={this.props.required}
|
47
44
|
disabled={this.props.disabled}
|
48
45
|
onChange={(event) => {
|
@@ -7,6 +7,8 @@ import { InputWrapper } from "./Form";
|
|
7
7
|
import { createPopper, Instance } from '@popperjs/core';
|
8
8
|
import {isEqual} from 'lodash';
|
9
9
|
import {getTextColor} from './Label';
|
10
|
+
import {IInputWrapper} from './Form/InputWrapper';
|
11
|
+
import {SelectPreview} from './SelectPreview';
|
10
12
|
|
11
13
|
interface IState<T> {
|
12
14
|
value: Array<T>;
|
@@ -23,7 +25,7 @@ interface IState<T> {
|
|
23
25
|
buttonTarget: Array<string>; // array of class names
|
24
26
|
}
|
25
27
|
|
26
|
-
interface IPropsBase<T> {
|
28
|
+
interface IPropsBase<T> extends IInputWrapper {
|
27
29
|
value?: Array<T>;
|
28
30
|
selectBranchWithChildren?: boolean;
|
29
31
|
readOnly?: boolean;
|
@@ -33,16 +35,6 @@ interface IPropsBase<T> {
|
|
33
35
|
singleLevelSearch?: boolean;
|
34
36
|
placeholder?: string;
|
35
37
|
searchPlaceholder?: string;
|
36
|
-
invalid?: boolean;
|
37
|
-
inlineLabel?: boolean;
|
38
|
-
labelHidden?: boolean;
|
39
|
-
tabindex?: number;
|
40
|
-
fullWidth?: boolean;
|
41
|
-
info?: string;
|
42
|
-
error?: string;
|
43
|
-
required?: boolean;
|
44
|
-
label?: string;
|
45
|
-
disabled?: boolean;
|
46
38
|
zIndex?: number;
|
47
39
|
getLabel(item: T): string;
|
48
40
|
getId(item: T): string;
|
@@ -116,7 +108,6 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
116
108
|
this.inputRef = React.createRef();
|
117
109
|
this.categoryButtonRef = React.createRef();
|
118
110
|
this.openDropdownRef = React.createRef();
|
119
|
-
|
120
111
|
this.popperInstance = null;
|
121
112
|
}
|
122
113
|
|
@@ -152,7 +143,7 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
152
143
|
this.backButtonValue();
|
153
144
|
|
154
145
|
const {buttonTarget} = this.state;
|
155
|
-
const className = buttonTarget.pop()
|
146
|
+
const className = `${buttonTarget.pop()}-focus`;
|
156
147
|
|
157
148
|
if (className != null) {
|
158
149
|
const element: HTMLElement = document.getElementsByClassName(className)[0] as HTMLElement;
|
@@ -460,21 +451,30 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
460
451
|
>
|
461
452
|
<button className="suggestion-item--btn">
|
462
453
|
{this.props.getBorderColor
|
463
|
-
&& <div
|
464
|
-
|
454
|
+
&& <div
|
455
|
+
className="item-border"
|
456
|
+
style={{
|
457
|
+
backgroundColor: this.props.getBorderColor(option.value),
|
458
|
+
}}
|
459
|
+
>
|
465
460
|
</div>
|
466
461
|
}
|
467
462
|
<span
|
468
|
-
style={this.props.getBackgroundColor
|
469
|
-
? {backgroundColor: this.props.getBackgroundColor(option.value),
|
470
|
-
color: getTextColor(this.props.getBackgroundColor(option.value))}
|
471
|
-
: undefined}
|
472
463
|
className={'suggestion-item--bgcolor'
|
473
|
-
+ (selectedItem ? ' suggestion-item--disabled' : '')
|
464
|
+
+ (selectedItem ? ' suggestion-item--disabled' : '')
|
465
|
+
}
|
466
|
+
style={this.props.getBackgroundColor
|
467
|
+
? {
|
468
|
+
backgroundColor: this.props.getBackgroundColor(option.value),
|
469
|
+
color: getTextColor(this.props.getBackgroundColor(option.value)),
|
470
|
+
}
|
471
|
+
: undefined
|
472
|
+
}
|
474
473
|
>
|
475
474
|
{this.props.optionTemplate
|
476
475
|
? this.props.optionTemplate(option.value)
|
477
|
-
: this.props.getLabel(option.value)
|
476
|
+
: this.props.getLabel(option.value)
|
477
|
+
}
|
478
478
|
</span>
|
479
479
|
{option.children
|
480
480
|
&& <span className="suggestion-item__icon">
|
@@ -492,7 +492,8 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
492
492
|
this.props.getId(obj) === this.props.getId(item.value),
|
493
493
|
);
|
494
494
|
return (
|
495
|
-
<li
|
495
|
+
<li
|
496
|
+
key={i}
|
496
497
|
className={`suggestion-item suggestion-item--multi-select`}
|
497
498
|
onClick={(event) => {
|
498
499
|
this.handleValue(event, item);
|
@@ -506,7 +507,8 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
506
507
|
? 'suggestion-item--disabled' : undefined}
|
507
508
|
>
|
508
509
|
{this.props.getLabel(item.value)}
|
509
|
-
</span>
|
510
|
+
</span>
|
511
|
+
}
|
510
512
|
</button>
|
511
513
|
</li>
|
512
514
|
);
|
@@ -542,8 +544,8 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
542
544
|
|
543
545
|
if (!selectedButton) {
|
544
546
|
return <button
|
545
|
-
ref={this.categoryButtonRef}
|
546
547
|
className={'autocomplete__button' + (this.props.selectBranchWithChildren ? ' autocomplete__button--multi-select' : '')}
|
548
|
+
ref={this.categoryButtonRef}
|
547
549
|
onMouseOver={() => this.setState({buttonMouseEvent: true})}
|
548
550
|
onMouseOut={() => this.setState({buttonMouseEvent: false})}
|
549
551
|
onClick={(event) => this.handleBranchValue(event, buttonValue)}
|
@@ -553,7 +555,7 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
553
555
|
} else {
|
554
556
|
return <button
|
555
557
|
className={'autocomplete__button'
|
556
|
-
|
558
|
+
+ (this.props.selectBranchWithChildren ? ' autocomplete__button--multi-select' : '') + ' autocomplete__button--disabled'}
|
557
559
|
>
|
558
560
|
Category selected
|
559
561
|
</button>;
|
@@ -579,29 +581,53 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
579
581
|
}
|
580
582
|
|
581
583
|
render() {
|
584
|
+
if (this.props.preview) {
|
585
|
+
return (
|
586
|
+
<SelectPreview
|
587
|
+
kind={this.props.allowMultiple
|
588
|
+
? {
|
589
|
+
mode: 'multi-select',
|
590
|
+
getBackgroundColor: this.props.getBackgroundColor,
|
591
|
+
}
|
592
|
+
: {
|
593
|
+
mode: 'single-select',
|
594
|
+
getBorderColor: this.props.getBorderColor,
|
595
|
+
}
|
596
|
+
}
|
597
|
+
items={this.state.value}
|
598
|
+
valueTemplate={this.props.valueTemplate}
|
599
|
+
getLabel={this.props.getLabel}
|
600
|
+
/>
|
601
|
+
);
|
602
|
+
}
|
603
|
+
|
582
604
|
return (
|
583
605
|
<InputWrapper
|
584
606
|
label={this.props.label}
|
585
607
|
error={this.props.error}
|
586
608
|
required={this.props.required}
|
587
609
|
disabled={this.props.disabled}
|
588
|
-
invalid={this.props.invalid}
|
589
610
|
info={this.props.info}
|
590
611
|
inlineLabel={this.props.inlineLabel}
|
591
612
|
labelHidden={this.props.labelHidden}
|
592
|
-
fullWidth={this.props.fullWidth}
|
593
613
|
htmlId={this.htmlId}
|
594
|
-
tabindex={this.props.tabindex}
|
595
|
-
|
614
|
+
tabindex={this.props.tabindex}
|
615
|
+
>
|
616
|
+
<div className={`tags-input sd-input__input tags-input--${this.props.allowMultiple ? 'multi-select' : 'single-select'}`}>
|
596
617
|
{this.props.allowMultiple
|
597
618
|
? <div className="tags-input__tags">
|
598
619
|
{this.props.readOnly
|
599
620
|
|| <button ref={this.openDropdownRef}
|
600
|
-
className=
|
601
|
-
onClick={() =>
|
621
|
+
className={`tags-input__add-button ${this.props.disabled ? 'tags-input__add-button--disabled' : ''}`}
|
622
|
+
onClick={() => {
|
623
|
+
if (!this.props.disabled) {
|
624
|
+
this.setState({openDropdown: !this.state.openDropdown});
|
625
|
+
}
|
626
|
+
}}
|
602
627
|
>
|
603
628
|
<i className="icon-plus-large"></i>
|
604
|
-
</button>
|
629
|
+
</button>
|
630
|
+
}
|
605
631
|
<ul className="tags-input__tag-list">
|
606
632
|
{this.state.value.map((item, i: number) => {
|
607
633
|
const Wrapper: React.ComponentType<{backgroundColor?: string}>
|
@@ -609,22 +635,30 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
609
635
|
<li
|
610
636
|
className={"tags-input__tag-item tags-input__tag-item--multi-select"
|
611
637
|
+ (this.props.readOnly ? ' tags-input__tag-item--readonly' : '')}
|
612
|
-
onClick={() => !this.props.readOnly && this.
|
638
|
+
onClick={() => (!this.props.readOnly && !this.props.disabled)
|
639
|
+
&& this.removeClick(i)
|
640
|
+
}
|
613
641
|
style={this.props.valueTemplate
|
614
642
|
? {backgroundColor}
|
615
643
|
: this.props.getBackgroundColor
|
616
644
|
&& {backgroundColor: this.props.getBackgroundColor(item)}}
|
617
645
|
>
|
618
646
|
<span
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
647
|
+
className="tags-input__helper-box"
|
648
|
+
style={
|
649
|
+
{color: backgroundColor
|
650
|
+
? getTextColor(backgroundColor)
|
651
|
+
: this.props.getBackgroundColor
|
652
|
+
&& getTextColor(this.props.getBackgroundColor(item)),
|
653
|
+
}
|
654
|
+
}
|
655
|
+
>
|
624
656
|
{children}
|
625
|
-
{!this.props.readOnly
|
626
|
-
<
|
627
|
-
|
657
|
+
{!this.props.readOnly
|
658
|
+
&& <span className="tags-input__remove-button">
|
659
|
+
<Icon name="close-small"></Icon>
|
660
|
+
</span>
|
661
|
+
}
|
628
662
|
</span>
|
629
663
|
</li>
|
630
664
|
);
|
@@ -642,10 +676,12 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
642
676
|
})}
|
643
677
|
</ul>
|
644
678
|
{this.state.value.length > 0
|
645
|
-
? this.props.readOnly
|
646
|
-
|| <button
|
647
|
-
|
648
|
-
|
679
|
+
? (this.props.readOnly || this.props.disabled)
|
680
|
+
|| <button
|
681
|
+
className="tags-input__remove-value"
|
682
|
+
style={{position: 'relative', bottom: '2px'}}
|
683
|
+
onClick={() => this.setState({value: []})}
|
684
|
+
>
|
649
685
|
<Icon name='remove-sign'></Icon>
|
650
686
|
</button>
|
651
687
|
: null
|
@@ -661,8 +697,11 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
661
697
|
</button>
|
662
698
|
}
|
663
699
|
{this.state.value.length < 1
|
664
|
-
&& <span
|
665
|
-
|
700
|
+
&& <span
|
701
|
+
className={ 'tags-input__single-item'
|
702
|
+
+ (this.props.readOnly ? ' tags-input__tag-item--readonly' : '')
|
703
|
+
}
|
704
|
+
>
|
666
705
|
<span className="tags-input__placeholder">
|
667
706
|
{this.props.placeholder}
|
668
707
|
</span>
|
@@ -673,23 +712,29 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
673
712
|
= ({backgroundColor, borderColor, children}) => (
|
674
713
|
<span
|
675
714
|
className={ 'tags-input__single-item'
|
676
|
-
|
677
|
-
|
715
|
+
+ (this.props.readOnly ? ' tags-input__tag-item--readonly' : '')
|
716
|
+
}
|
717
|
+
onClick={() => !this.props.readOnly && this.removeClick(i)
|
718
|
+
}
|
678
719
|
>
|
679
720
|
{this.props.getBorderColor
|
680
|
-
&& <div
|
721
|
+
&& <div
|
722
|
+
className="item-border item-border-selected"
|
681
723
|
style={borderColor
|
682
|
-
|
683
|
-
|
724
|
+
? {backgroundColor: borderColor}
|
725
|
+
: {backgroundColor: this.props.getBorderColor(item)}
|
726
|
+
}
|
684
727
|
>
|
685
728
|
</div>
|
686
729
|
}
|
687
730
|
<span
|
688
731
|
style={{color: backgroundColor && getTextColor(backgroundColor)}}
|
689
|
-
className="tags-input__helper-box"
|
732
|
+
className="tags-input__helper-box"
|
733
|
+
>
|
690
734
|
<span
|
691
735
|
className={backgroundColor && `tags-input__tag-item`}
|
692
|
-
style={{backgroundColor, margin: 0}}
|
736
|
+
style={{backgroundColor, margin: 0}}
|
737
|
+
>
|
693
738
|
{children}
|
694
739
|
</span>
|
695
740
|
{this.props.readOnly
|
@@ -710,14 +755,16 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
710
755
|
}
|
711
756
|
</React.Fragment>;
|
712
757
|
})}
|
713
|
-
|
758
|
+
</div>
|
714
759
|
}
|
715
760
|
|
716
761
|
{this.state.openDropdown
|
717
762
|
&& <div
|
718
|
-
className={"autocomplete autocomplete--multi-select"
|
719
|
-
|
763
|
+
className={"autocomplete autocomplete--multi-select"
|
764
|
+
+ (this.props.width === 'medium' ? ' autocomplete--fixed-width' : '')
|
765
|
+
}
|
720
766
|
style={{zIndex: this.props.zIndex}}
|
767
|
+
ref={this.dropdownRef}
|
721
768
|
>
|
722
769
|
<div className='autocomplete__header'>
|
723
770
|
<div
|
@@ -731,9 +778,9 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
731
778
|
</div>
|
732
779
|
<div className='autocomplete__filter'>
|
733
780
|
<input
|
734
|
-
placeholder={this.props.searchPlaceholder}
|
735
|
-
type="text"
|
736
781
|
className="autocomplete__input"
|
782
|
+
type="text"
|
783
|
+
placeholder={this.props.searchPlaceholder}
|
737
784
|
ref={this.inputRef}
|
738
785
|
value={this.state.searchFieldValue}
|
739
786
|
onChange={(event) => {
|
@@ -767,10 +814,9 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
767
814
|
</div>
|
768
815
|
<div className='autocomplete__filter'>
|
769
816
|
<button className={'autocomplete__category-title'}>
|
770
|
-
{
|
771
|
-
this.props.optionTemplate
|
772
|
-
|
773
|
-
: this.props.getLabel(this.state.buttonValue.value)
|
817
|
+
{this.props.optionTemplate
|
818
|
+
? this.props.optionTemplate(this.state.buttonValue.value)
|
819
|
+
: this.props.getLabel(this.state.buttonValue.value)
|
774
820
|
}
|
775
821
|
</button>
|
776
822
|
|
@@ -788,83 +834,86 @@ export class TreeSelect<T> extends React.Component<IProps<T>, IState<T>> {
|
|
788
834
|
className="suggestion-list suggestion-list--multi-select"
|
789
835
|
ref={this.ref}
|
790
836
|
>
|
791
|
-
{this.state.options
|
792
|
-
.
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
837
|
+
{this.state.options.map((option, i: React.Key | undefined) => {
|
838
|
+
let selectedItem = this.state.value.some((obj) =>
|
839
|
+
this.props.getId(obj) === this.props.getId(option.value),
|
840
|
+
);
|
841
|
+
return (
|
842
|
+
<li
|
843
|
+
key={i}
|
844
|
+
className={`suggestion-item suggestion-item--multi-select`}
|
845
|
+
onClick={(event) => {
|
846
|
+
event.preventDefault();
|
847
|
+
event.stopPropagation();
|
848
|
+
this.handleTree(event, option);
|
849
|
+
}}
|
850
|
+
>
|
851
|
+
<button
|
852
|
+
className={`suggestion-item--btn ${this.props.getId(option.value)}-focus`}
|
853
|
+
onKeyDown={(event) => {
|
854
|
+
if (event.key === 'Enter' && option.children) {
|
855
|
+
this.setState({
|
856
|
+
buttonTarget: [
|
857
|
+
...this.state.buttonTarget,
|
858
|
+
this.props.getId(option.value),
|
859
|
+
],
|
860
|
+
});
|
861
|
+
}
|
804
862
|
}}
|
805
863
|
>
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
this.
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
864
|
+
{(this.props.getBorderColor && !this.props.allowMultiple)
|
865
|
+
&& <div
|
866
|
+
className="item-border"
|
867
|
+
style={{
|
868
|
+
backgroundColor: this.props.getBorderColor(
|
869
|
+
option.value,
|
870
|
+
),
|
871
|
+
}}
|
872
|
+
>
|
873
|
+
</div>
|
874
|
+
}
|
875
|
+
<span
|
876
|
+
className={
|
877
|
+
'suggestion-item--bgcolor'
|
878
|
+
+ (selectedItem ? ' suggestion-item--disabled' : '')
|
879
|
+
}
|
880
|
+
style={
|
881
|
+
(this.props.getBackgroundColor && option.value)
|
882
|
+
? {
|
883
|
+
backgroundColor:
|
884
|
+
this.props.getBackgroundColor(option.value),
|
885
|
+
color:
|
886
|
+
getTextColor(this.props.getBackgroundColor(
|
824
887
|
option.value,
|
888
|
+
),
|
825
889
|
),
|
826
|
-
}
|
827
|
-
|
828
|
-
</div>
|
890
|
+
}
|
891
|
+
: undefined
|
829
892
|
}
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
backgroundColor:
|
835
|
-
this.props.getBackgroundColor(option.value),
|
836
|
-
color:
|
837
|
-
getTextColor(this.props.getBackgroundColor(
|
838
|
-
option.value,
|
839
|
-
),
|
840
|
-
),
|
841
|
-
}
|
842
|
-
: undefined
|
843
|
-
}
|
844
|
-
className={
|
845
|
-
'suggestion-item--bgcolor'
|
846
|
-
+ (selectedItem ? ' suggestion-item--disabled' : '')
|
847
|
-
}
|
848
|
-
>
|
849
|
-
{this.props.optionTemplate
|
850
|
-
? this.props.optionTemplate(option.value)
|
851
|
-
: this.props.getLabel(option.value)}
|
852
|
-
</span>
|
853
|
-
{option.children
|
854
|
-
&& <span className="suggestion-item__icon">
|
855
|
-
<Icon name="chevron-right-thin"></Icon>
|
856
|
-
</span>
|
893
|
+
>
|
894
|
+
{this.props.optionTemplate
|
895
|
+
? this.props.optionTemplate(option.value)
|
896
|
+
: this.props.getLabel(option.value)
|
857
897
|
}
|
858
|
-
</
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
898
|
+
</span>
|
899
|
+
{option.children
|
900
|
+
&& <span className="suggestion-item__icon">
|
901
|
+
<Icon name="chevron-right-thin"></Icon>
|
902
|
+
</span>
|
903
|
+
}
|
904
|
+
</button>
|
905
|
+
</li>
|
906
|
+
);
|
907
|
+
})}
|
863
908
|
</ul>
|
864
909
|
: null
|
865
|
-
: <ul
|
910
|
+
: <ul
|
911
|
+
className="suggestion-list suggestion-list--multi-select"
|
912
|
+
ref={this.ref}
|
913
|
+
>
|
866
914
|
{this.filteredItem(this.props.singleLevelSearch
|
867
|
-
? this.state.options : this.state.filterArr)
|
915
|
+
? this.state.options : this.state.filterArr)
|
916
|
+
}
|
868
917
|
</ul>
|
869
918
|
}
|
870
919
|
</div>
|