@zohodesk/dot 1.0.0-beta.227 → 1.0.0-beta.229
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/README.md +8 -0
- package/es/ActionButton/ActionButton.js +7 -3
- package/es/Provider.js +6 -104
- package/es/deprecated/SelectDropdown/SelectDropdown.js +59 -35
- package/es/deprecated/SelectDropdown/SelectDropdown.module.css +1 -0
- package/es/dropdown/ToggleDropDown/ToggleDropDown.js +183 -160
- package/es/dropdown/ToggleDropDown/ToggleDropDown.module.css +3 -0
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +93 -65
- package/es/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +7 -3
- package/es/list/GridStencils/GridStencils.module.css +7 -18
- package/es/list/status/StatusDropdown/StatusDropdown.js +103 -80
- package/es/list/status/StatusDropdown/StatusDropdown.module.css +3 -0
- package/es/lookup/header/ViewDropDown/ViewDropDown.js +79 -54
- package/lib/ActionButton/ActionButton.js +7 -3
- package/lib/Provider.js +7 -122
- package/lib/deprecated/SelectDropdown/SelectDropdown.js +60 -38
- package/lib/deprecated/SelectDropdown/SelectDropdown.module.css +1 -0
- package/lib/dropdown/ToggleDropDown/ToggleDropDown.js +182 -161
- package/lib/dropdown/ToggleDropDown/ToggleDropDown.module.css +3 -0
- package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +91 -65
- package/lib/form/fields/TagsMultiSelectField/TagsMultiSelectField.js +7 -3
- package/lib/list/GridStencils/GridStencils.module.css +7 -18
- package/lib/list/status/StatusDropdown/StatusDropdown.js +102 -81
- package/lib/list/status/StatusDropdown/StatusDropdown.module.css +3 -0
- package/lib/lookup/header/ViewDropDown/ViewDropDown.js +75 -52
- package/package.json +5 -5
|
@@ -5,7 +5,6 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
|
|
|
5
5
|
import React, { Component, Fragment } from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import Icon from '@zohodesk/icons/lib/Icon';
|
|
8
|
-
import DropBox from '@zohodesk/components/lib/DropBox/DropBox';
|
|
9
8
|
import Popup from '@zohodesk/components/lib/Popup/Popup';
|
|
10
9
|
import { Box, Container } from '@zohodesk/components/lib/Layout';
|
|
11
10
|
import ListItem from '@zohodesk/components/lib/ListItem/ListItem';
|
|
@@ -20,6 +19,8 @@ import { scrollTo } from '@zohodesk/components/lib/utils/Common';
|
|
|
20
19
|
import { getUniqueId } from '@zohodesk/components/lib/Provider/IdProvider';
|
|
21
20
|
import btnStyle from '@zohodesk/components/lib/semantic/Button/semanticButton.module.css';
|
|
22
21
|
import RippleEffect from '@zohodesk/components/lib/RippleEffect/RippleEffect';
|
|
22
|
+
import ResponsiveDropBox from '@zohodesk/components/lib/ResponsiveDropBox/ResponsiveDropBox';
|
|
23
|
+
import { ResponsiveReceiver } from '@zohodesk/components/lib/Responsive/CustomResponsive';
|
|
23
24
|
import { shallowDiff } from '../../utils/General';
|
|
24
25
|
import style from './ToggleDropDown.module.css';
|
|
25
26
|
export class ToggleDropDown extends Component {
|
|
@@ -472,6 +473,17 @@ export class ToggleDropDown extends Component {
|
|
|
472
473
|
}
|
|
473
474
|
}
|
|
474
475
|
|
|
476
|
+
responsiveFunc(_ref3) {
|
|
477
|
+
let {
|
|
478
|
+
mediaQueryOR
|
|
479
|
+
} = _ref3;
|
|
480
|
+
return {
|
|
481
|
+
tabletMode: mediaQueryOR([{
|
|
482
|
+
maxWidth: 700
|
|
483
|
+
}])
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
|
|
475
487
|
render() {
|
|
476
488
|
const {
|
|
477
489
|
options,
|
|
@@ -599,105 +611,180 @@ export class ToggleDropDown extends Component {
|
|
|
599
611
|
name: "ZD-down",
|
|
600
612
|
iconClass: `${'toggleDropIcon'} ${style.arrow} ${style[`${arrowIconPosition}_arrow`]}`,
|
|
601
613
|
dataId: "statusdownarrow"
|
|
602
|
-
}) : null)))), isPopupOpen ? /*#__PURE__*/React.createElement(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
},
|
|
652
|
-
|
|
653
|
-
})), /*#__PURE__*/React.createElement(Box, {
|
|
654
|
-
id: ariaTitleId,
|
|
655
|
-
scroll: "vertical",
|
|
656
|
-
dataId: `${dataId}_list`,
|
|
657
|
-
className: style.maxHgt,
|
|
658
|
-
eleRef: this.scrollContentRef,
|
|
659
|
-
onScroll: this.handleScroll,
|
|
660
|
-
role: isSearch ? 'listbox' : undefined,
|
|
661
|
-
"aria-labelledby": isSearch ? ariaTitleId : undefined
|
|
662
|
-
}, isDataLoaded ? options && options.length != 0 ? isGroupDropDown ? /*#__PURE__*/React.createElement(Fragment, null, options.map(group => {
|
|
663
|
-
const groupName = group[groupNameKey];
|
|
664
|
-
const groupOptions = group[groupOptionsKey];
|
|
665
|
-
const {
|
|
666
|
-
needDivider
|
|
667
|
-
} = group;
|
|
668
|
-
return /*#__PURE__*/React.createElement(Fragment, {
|
|
669
|
-
key: `index${groupName}`
|
|
670
|
-
}, needDivider && /*#__PURE__*/React.createElement("div", {
|
|
671
|
-
className: style.seperatedLine
|
|
672
|
-
}), groupName && /*#__PURE__*/React.createElement("div", {
|
|
673
|
-
className: style.groupName
|
|
614
|
+
}) : null)))), isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
|
|
615
|
+
query: this.responsiveFunc,
|
|
616
|
+
responsiveId: "Helmet"
|
|
617
|
+
}, _ref4 => {
|
|
618
|
+
let {
|
|
619
|
+
tabletMode
|
|
620
|
+
} = _ref4;
|
|
621
|
+
return /*#__PURE__*/React.createElement(ResponsiveDropBox, _extends({
|
|
622
|
+
boxPosition: position,
|
|
623
|
+
isActive: isPopupReady,
|
|
624
|
+
onClick: removeClose,
|
|
625
|
+
size: boxSize,
|
|
626
|
+
right: right,
|
|
627
|
+
left: left,
|
|
628
|
+
top: top,
|
|
629
|
+
bottom: bottom,
|
|
630
|
+
isArrow: isArrow,
|
|
631
|
+
isAnimate: true,
|
|
632
|
+
getRef: getContainerRef,
|
|
633
|
+
customClass: {
|
|
634
|
+
customDropBoxWrap: style.dropBoxContainer
|
|
635
|
+
},
|
|
636
|
+
needResponsive: needResponsive,
|
|
637
|
+
isPadding: isPadding,
|
|
638
|
+
tabindex: "0",
|
|
639
|
+
a11y: {
|
|
640
|
+
role: !isSearch ? 'menu' : undefined,
|
|
641
|
+
ariaLabelledby: !isSearch ? ariaTitleId : undefined
|
|
642
|
+
},
|
|
643
|
+
palette: palette,
|
|
644
|
+
isResponsivePadding: true
|
|
645
|
+
}, DropBoxProps), /*#__PURE__*/React.createElement(Fragment, null, isSearch ? /*#__PURE__*/React.createElement(Box, {
|
|
646
|
+
className: style.search
|
|
647
|
+
}, /*#__PURE__*/React.createElement(TextBoxIcon, _extends({
|
|
648
|
+
placeHolder: placeHolderText,
|
|
649
|
+
onChange: this.handleChange,
|
|
650
|
+
value: searchValue,
|
|
651
|
+
onClear: this.onSearchClear,
|
|
652
|
+
size: searchBoxSize,
|
|
653
|
+
inputRef: this.searchInputRef,
|
|
654
|
+
onKeyDown: this.handleKeyDown,
|
|
655
|
+
a11y: {
|
|
656
|
+
role: 'combobox',
|
|
657
|
+
ariaOwns: ariaTitleId,
|
|
658
|
+
ariaActivedescendant: allyOptionsArr[selectedIndex] && allyOptionsArr[selectedIndex][keyName],
|
|
659
|
+
ariaAutocomplete: 'list',
|
|
660
|
+
ariaHaspopup: true,
|
|
661
|
+
ariaExpanded: true
|
|
662
|
+
}
|
|
663
|
+
}, TextBoxIconProps))) : null, title && options.length != 0 && /*#__PURE__*/React.createElement(Box, {
|
|
664
|
+
className: style.title
|
|
674
665
|
}, /*#__PURE__*/React.createElement(DropDownHeading, {
|
|
675
|
-
text:
|
|
666
|
+
text: title,
|
|
667
|
+
htmlId: ariaTitleId,
|
|
676
668
|
palette: palette,
|
|
677
669
|
a11y: {
|
|
678
670
|
role: 'heading'
|
|
679
|
-
}
|
|
680
|
-
|
|
671
|
+
},
|
|
672
|
+
customClass: style.dropdown
|
|
673
|
+
})), /*#__PURE__*/React.createElement(Box, {
|
|
674
|
+
id: ariaTitleId,
|
|
675
|
+
flexible: true,
|
|
676
|
+
shrink: true,
|
|
677
|
+
scroll: "vertical",
|
|
678
|
+
dataId: `${dataId}_list`,
|
|
679
|
+
className: `${tabletMode ? style.responsivemaxHgt : style.maxHgt}`,
|
|
680
|
+
eleRef: this.scrollContentRef,
|
|
681
|
+
onScroll: this.handleScroll,
|
|
682
|
+
role: isSearch ? 'listbox' : undefined,
|
|
683
|
+
"aria-labelledby": isSearch ? ariaTitleId : undefined
|
|
684
|
+
}, isDataLoaded ? options && options.length != 0 ? isGroupDropDown ? /*#__PURE__*/React.createElement(Fragment, null, options.map(group => {
|
|
685
|
+
const groupName = group[groupNameKey];
|
|
686
|
+
const groupOptions = group[groupOptionsKey];
|
|
687
|
+
const {
|
|
688
|
+
needDivider
|
|
689
|
+
} = group;
|
|
690
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
691
|
+
key: `index${groupName}`
|
|
692
|
+
}, needDivider && /*#__PURE__*/React.createElement("div", {
|
|
693
|
+
className: style.seperatedLine
|
|
694
|
+
}), groupName && /*#__PURE__*/React.createElement("div", {
|
|
695
|
+
className: style.groupName
|
|
696
|
+
}, /*#__PURE__*/React.createElement(DropDownHeading, {
|
|
697
|
+
text: groupName,
|
|
698
|
+
palette: palette,
|
|
699
|
+
a11y: {
|
|
700
|
+
role: 'heading'
|
|
701
|
+
}
|
|
702
|
+
})), groupOptions && groupOptions.map(item => {
|
|
703
|
+
const {
|
|
704
|
+
iconName,
|
|
705
|
+
iconSize,
|
|
706
|
+
iconClass,
|
|
707
|
+
title,
|
|
708
|
+
disableTitle = '',
|
|
709
|
+
isDisabled = false
|
|
710
|
+
} = item;
|
|
711
|
+
listIndex += 1;
|
|
712
|
+
return iconName ? /*#__PURE__*/React.createElement(ListItemWithIcon, _extends({
|
|
713
|
+
key: listIndex,
|
|
714
|
+
dataId: item[keyName],
|
|
715
|
+
value: item[keyName],
|
|
716
|
+
id: item[idName],
|
|
717
|
+
active: selectedId === item[idName],
|
|
718
|
+
onClick: this.onSelect.bind(this, item),
|
|
719
|
+
index: listIndex,
|
|
720
|
+
highlight: selectedIndex === listIndex,
|
|
721
|
+
disableTitle: disableTitle,
|
|
722
|
+
isDisabled: isDisabled,
|
|
723
|
+
iconName: iconName,
|
|
724
|
+
iconClass: iconClass,
|
|
725
|
+
iconSize: iconSize,
|
|
726
|
+
needTick: needTick,
|
|
727
|
+
needBorder: false,
|
|
728
|
+
onMouseEnter: this.handleMouseEnter,
|
|
729
|
+
getRef: this.itemRef,
|
|
730
|
+
title: title ? title : item[keyName],
|
|
731
|
+
palette: palette,
|
|
732
|
+
a11y: {
|
|
733
|
+
role: isSearch ? 'option' : 'menuitem',
|
|
734
|
+
ariaSelected: selectedId === item[idName]
|
|
735
|
+
}
|
|
736
|
+
}, ListItemWithIconProps)) : /*#__PURE__*/React.createElement(ListItem, _extends({
|
|
737
|
+
key: listIndex,
|
|
738
|
+
dataId: item[keyName],
|
|
739
|
+
value: item[keyName],
|
|
740
|
+
id: item[idName],
|
|
741
|
+
active: selectedId === item[idName],
|
|
742
|
+
onClick: this.onSelect.bind(this, item),
|
|
743
|
+
isDisabled: isDisabled,
|
|
744
|
+
disableTitle: disableTitle,
|
|
745
|
+
index: listIndex,
|
|
746
|
+
highlight: selectedIndex === listIndex,
|
|
747
|
+
needTick: needTick,
|
|
748
|
+
needBorder: false,
|
|
749
|
+
onMouseEnter: this.handleMouseEnter,
|
|
750
|
+
getRef: this.itemRef,
|
|
751
|
+
title: title ? title : item[keyName],
|
|
752
|
+
palette: palette,
|
|
753
|
+
a11y: {
|
|
754
|
+
role: isSearch ? 'option' : 'menuitem',
|
|
755
|
+
ariaSelected: selectedId === item[idName]
|
|
756
|
+
}
|
|
757
|
+
}, ListItemProps));
|
|
758
|
+
}));
|
|
759
|
+
})) : /*#__PURE__*/React.createElement(Fragment, null, options.map((item, i) => {
|
|
681
760
|
const {
|
|
682
761
|
iconName,
|
|
683
762
|
iconSize,
|
|
684
763
|
iconClass,
|
|
685
764
|
title,
|
|
686
|
-
|
|
687
|
-
isDisabled = false
|
|
765
|
+
needDivider,
|
|
766
|
+
isDisabled = false,
|
|
767
|
+
disableTitle = ''
|
|
688
768
|
} = item;
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
769
|
+
|
|
770
|
+
if (!needDivider) {
|
|
771
|
+
listIndex += 1;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
return /*#__PURE__*/React.createElement(Fragment, {
|
|
775
|
+
key: i
|
|
776
|
+
}, needDivider ? /*#__PURE__*/React.createElement("div", {
|
|
777
|
+
className: style.seperatedLine
|
|
778
|
+
}) : iconName ? /*#__PURE__*/React.createElement(ListItemWithIcon, _extends({
|
|
692
779
|
dataId: item[keyName],
|
|
693
780
|
value: item[keyName],
|
|
694
781
|
id: item[idName],
|
|
695
782
|
active: selectedId === item[idName],
|
|
696
783
|
onClick: this.onSelect.bind(this, item),
|
|
697
784
|
index: listIndex,
|
|
698
|
-
highlight: selectedIndex === listIndex,
|
|
699
785
|
disableTitle: disableTitle,
|
|
700
786
|
isDisabled: isDisabled,
|
|
787
|
+
highlight: selectedIndex === listIndex,
|
|
701
788
|
iconName: iconName,
|
|
702
789
|
iconClass: iconClass,
|
|
703
790
|
iconSize: iconSize,
|
|
@@ -706,6 +793,7 @@ export class ToggleDropDown extends Component {
|
|
|
706
793
|
onMouseEnter: this.handleMouseEnter,
|
|
707
794
|
getRef: this.itemRef,
|
|
708
795
|
title: title ? title : item[keyName],
|
|
796
|
+
key: listIndex,
|
|
709
797
|
palette: palette,
|
|
710
798
|
a11y: {
|
|
711
799
|
role: isSearch ? 'option' : 'menuitem',
|
|
@@ -716,10 +804,10 @@ export class ToggleDropDown extends Component {
|
|
|
716
804
|
dataId: item[keyName],
|
|
717
805
|
value: item[keyName],
|
|
718
806
|
id: item[idName],
|
|
807
|
+
disableTitle: disableTitle,
|
|
808
|
+
isDisabled: isDisabled,
|
|
719
809
|
active: selectedId === item[idName],
|
|
720
810
|
onClick: this.onSelect.bind(this, item),
|
|
721
|
-
isDisabled: isDisabled,
|
|
722
|
-
disableTitle: disableTitle,
|
|
723
811
|
index: listIndex,
|
|
724
812
|
highlight: selectedIndex === listIndex,
|
|
725
813
|
needTick: needTick,
|
|
@@ -732,82 +820,17 @@ export class ToggleDropDown extends Component {
|
|
|
732
820
|
role: isSearch ? 'option' : 'menuitem',
|
|
733
821
|
ariaSelected: selectedId === item[idName]
|
|
734
822
|
}
|
|
735
|
-
}, ListItemProps));
|
|
736
|
-
}))
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
} = item;
|
|
747
|
-
|
|
748
|
-
if (!needDivider) {
|
|
749
|
-
listIndex += 1;
|
|
750
|
-
}
|
|
751
|
-
|
|
752
|
-
return /*#__PURE__*/React.createElement(Fragment, {
|
|
753
|
-
key: i
|
|
754
|
-
}, needDivider ? /*#__PURE__*/React.createElement("div", {
|
|
755
|
-
className: style.seperatedLine
|
|
756
|
-
}) : iconName ? /*#__PURE__*/React.createElement(ListItemWithIcon, _extends({
|
|
757
|
-
dataId: item[keyName],
|
|
758
|
-
value: item[keyName],
|
|
759
|
-
id: item[idName],
|
|
760
|
-
active: selectedId === item[idName],
|
|
761
|
-
onClick: this.onSelect.bind(this, item),
|
|
762
|
-
index: listIndex,
|
|
763
|
-
disableTitle: disableTitle,
|
|
764
|
-
isDisabled: isDisabled,
|
|
765
|
-
highlight: selectedIndex === listIndex,
|
|
766
|
-
iconName: iconName,
|
|
767
|
-
iconClass: iconClass,
|
|
768
|
-
iconSize: iconSize,
|
|
769
|
-
needTick: needTick,
|
|
770
|
-
needBorder: false,
|
|
771
|
-
onMouseEnter: this.handleMouseEnter,
|
|
772
|
-
getRef: this.itemRef,
|
|
773
|
-
title: title ? title : item[keyName],
|
|
774
|
-
key: listIndex,
|
|
775
|
-
palette: palette,
|
|
776
|
-
a11y: {
|
|
777
|
-
role: isSearch ? 'option' : 'menuitem',
|
|
778
|
-
ariaSelected: selectedId === item[idName]
|
|
779
|
-
}
|
|
780
|
-
}, ListItemWithIconProps)) : /*#__PURE__*/React.createElement(ListItem, _extends({
|
|
781
|
-
key: listIndex,
|
|
782
|
-
dataId: item[keyName],
|
|
783
|
-
value: item[keyName],
|
|
784
|
-
id: item[idName],
|
|
785
|
-
disableTitle: disableTitle,
|
|
786
|
-
isDisabled: isDisabled,
|
|
787
|
-
active: selectedId === item[idName],
|
|
788
|
-
onClick: this.onSelect.bind(this, item),
|
|
789
|
-
index: listIndex,
|
|
790
|
-
highlight: selectedIndex === listIndex,
|
|
791
|
-
needTick: needTick,
|
|
792
|
-
needBorder: false,
|
|
793
|
-
onMouseEnter: this.handleMouseEnter,
|
|
794
|
-
getRef: this.itemRef,
|
|
795
|
-
title: title ? title : item[keyName],
|
|
796
|
-
palette: palette,
|
|
797
|
-
a11y: {
|
|
798
|
-
role: isSearch ? 'option' : 'menuitem',
|
|
799
|
-
ariaSelected: selectedId === item[idName]
|
|
800
|
-
}
|
|
801
|
-
}, ListItemProps)));
|
|
802
|
-
})) : /*#__PURE__*/React.createElement(CommonEmptyState, {
|
|
803
|
-
className: style.svgWrapper,
|
|
804
|
-
description: searchEmptyHint,
|
|
805
|
-
title: searchErrorText || 'No results',
|
|
806
|
-
size: "small",
|
|
807
|
-
getEmptyState: this.emptySearchSVG
|
|
808
|
-
}) : /*#__PURE__*/React.createElement("div", {
|
|
809
|
-
className: style.loader
|
|
810
|
-
}, /*#__PURE__*/React.createElement(Loader, null))), getFooter ? /*#__PURE__*/React.createElement("div", null, getFooter()) : null)) : null);
|
|
823
|
+
}, ListItemProps)));
|
|
824
|
+
})) : /*#__PURE__*/React.createElement(CommonEmptyState, {
|
|
825
|
+
className: style.svgWrapper,
|
|
826
|
+
description: searchEmptyHint,
|
|
827
|
+
title: searchErrorText || 'No results',
|
|
828
|
+
size: "small",
|
|
829
|
+
getEmptyState: this.emptySearchSVG
|
|
830
|
+
}) : /*#__PURE__*/React.createElement("div", {
|
|
831
|
+
className: style.loader
|
|
832
|
+
}, /*#__PURE__*/React.createElement(Loader, null))), getFooter ? /*#__PURE__*/React.createElement(Box, null, getFooter()) : null));
|
|
833
|
+
}) : null);
|
|
811
834
|
}
|
|
812
835
|
|
|
813
836
|
}
|
|
@@ -3,12 +3,13 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { Container, Box } from '@zohodesk/components/lib/Layout';
|
|
4
4
|
import Tag from '@zohodesk/components/lib/Tag/Tag';
|
|
5
5
|
import TextBoxIcon from '@zohodesk/components/lib/TextBoxIcon/TextBoxIcon';
|
|
6
|
-
import DropBox from '@zohodesk/components/lib/DropBox/DropBox';
|
|
7
6
|
import EmptySearch from '@zohodesk/svg/lib/svg/EmptySearch';
|
|
8
7
|
import ListItem from '@zohodesk/components/lib/ListItem/ListItem';
|
|
9
8
|
import Loader from '@zohodesk/svg/lib/svg/Loader';
|
|
10
9
|
import DropDownSeparator from '@zohodesk/components/lib/DropDown/DropDownSeparator';
|
|
11
10
|
import CommonEmptyState from '../../../emptystate/CommonEmptyState/CommonEmptyState';
|
|
11
|
+
import ResponsiveDropBox from '@zohodesk/components/lib/ResponsiveDropBox/ResponsiveDropBox';
|
|
12
|
+
import { ResponsiveReceiver } from '@zohodesk/components/lib/Responsive/CustomResponsive';
|
|
12
13
|
import { findScrollEnd, stopBubbling } from '../../../utils/Common';
|
|
13
14
|
import { scrollTo } from '@zohodesk/components/lib/utils/Common.js';
|
|
14
15
|
import style from './TagsMultiSelect.module.css';
|
|
@@ -97,6 +98,17 @@ export default class TagsMultiSelect extends React.Component {
|
|
|
97
98
|
this.containerRef = ele;
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
responsiveFunc(_ref) {
|
|
102
|
+
let {
|
|
103
|
+
mediaQueryOR
|
|
104
|
+
} = _ref;
|
|
105
|
+
return {
|
|
106
|
+
tabletMode: mediaQueryOR([{
|
|
107
|
+
maxWidth: 700
|
|
108
|
+
}])
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
100
112
|
render() {
|
|
101
113
|
let {
|
|
102
114
|
searchList,
|
|
@@ -125,7 +137,8 @@ export default class TagsMultiSelect extends React.Component {
|
|
|
125
137
|
getTextBoxChildren,
|
|
126
138
|
htmlId,
|
|
127
139
|
boxSize,
|
|
128
|
-
onSelectTag
|
|
140
|
+
onSelectTag,
|
|
141
|
+
clickableTag
|
|
129
142
|
} = this.props;
|
|
130
143
|
let {
|
|
131
144
|
showAll
|
|
@@ -158,7 +171,7 @@ export default class TagsMultiSelect extends React.Component {
|
|
|
158
171
|
text: name,
|
|
159
172
|
onRemove: isReadOnly ? null : deleteTag.bind(this, name),
|
|
160
173
|
closeTitle: i18nKeys.deleteText,
|
|
161
|
-
palette: tagType === 'SYSTEM' ? 'primary' : 'default',
|
|
174
|
+
palette: clickableTag ? 'defaultLink' : tagType === 'SYSTEM' ? 'primary' : 'default',
|
|
162
175
|
isReadOnly: isReadOnly,
|
|
163
176
|
onSelectTag: onSelectTag ? onSelectTag : undefined
|
|
164
177
|
})) : null;
|
|
@@ -169,7 +182,7 @@ export default class TagsMultiSelect extends React.Component {
|
|
|
169
182
|
}, showAll ? `${i18nKeys.lessText}` : `+${tagsList.length - chipNeedToShow} ${i18nKeys.moreText}`) : null) : null, /*#__PURE__*/React.createElement(Box, {
|
|
170
183
|
flexible: true,
|
|
171
184
|
adjust: true,
|
|
172
|
-
|
|
185
|
+
shrink: true,
|
|
173
186
|
className: style.inputWrapper
|
|
174
187
|
}, /*#__PURE__*/React.createElement("span", {
|
|
175
188
|
className: style.custmSpan
|
|
@@ -190,67 +203,80 @@ export default class TagsMultiSelect extends React.Component {
|
|
|
190
203
|
},
|
|
191
204
|
size: "xsmall",
|
|
192
205
|
inputRef: this.textInputRef
|
|
193
|
-
}, getTextBoxChildren ? getTextBoxChildren() : null))), isPopupOpen ? /*#__PURE__*/React.createElement(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
getRef: getContainerRef,
|
|
198
|
-
isBoxPaddingNeed: true,
|
|
199
|
-
size: boxSize,
|
|
200
|
-
boxPosition: boxPosition,
|
|
201
|
-
isPadding: false,
|
|
202
|
-
customClass: {
|
|
203
|
-
customDropBoxWrap: style.dropdown
|
|
204
|
-
},
|
|
205
|
-
dataId: `${dataId}_dropbox`
|
|
206
|
-
}, isTagListLoading ? /*#__PURE__*/React.createElement(Container, {
|
|
207
|
-
align: "both",
|
|
208
|
-
className: style.viewpopNew
|
|
209
|
-
}, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Container, {
|
|
210
|
-
scroll: "vertical",
|
|
211
|
-
className: style.viewpopNew,
|
|
212
|
-
onScroll: this.onScroll,
|
|
213
|
-
eleRef: this.getContainerRef
|
|
214
|
-
}, searchList.length ? /*#__PURE__*/React.createElement(Box, {
|
|
215
|
-
flexible: true
|
|
216
|
-
}, searchList.map((item, index) => {
|
|
206
|
+
}, getTextBoxChildren ? getTextBoxChildren() : null))), isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
|
|
207
|
+
query: this.responsiveFunc,
|
|
208
|
+
responsiveId: "Helmet"
|
|
209
|
+
}, _ref2 => {
|
|
217
210
|
let {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
211
|
+
tabletMode
|
|
212
|
+
} = _ref2;
|
|
213
|
+
return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
|
|
214
|
+
isAnimate: true,
|
|
215
|
+
isActive: isPopupReady,
|
|
216
|
+
isArrow: false,
|
|
217
|
+
getRef: getContainerRef,
|
|
218
|
+
isBoxPaddingNeed: true,
|
|
219
|
+
size: boxSize,
|
|
220
|
+
boxPosition: boxPosition,
|
|
221
|
+
isPadding: false,
|
|
222
|
+
customClass: {
|
|
223
|
+
customDropBoxWrap: style.dropdown
|
|
224
|
+
},
|
|
225
|
+
dataId: `${dataId}_dropbox`,
|
|
226
|
+
isResponsivePadding: true,
|
|
227
|
+
alignBox: "row"
|
|
235
228
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
236
|
-
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
229
|
+
flexible: true
|
|
230
|
+
}, isTagListLoading ? /*#__PURE__*/React.createElement(Container, {
|
|
231
|
+
align: "both",
|
|
232
|
+
className: `${tabletMode ? '' : style.viewpopNew}`
|
|
233
|
+
}, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Container, {
|
|
234
|
+
scroll: "vertical",
|
|
235
|
+
className: `${tabletMode ? '' : style.viewpopNew}`,
|
|
236
|
+
onScroll: this.onScroll,
|
|
237
|
+
eleRef: this.getContainerRef
|
|
238
|
+
}, searchList.length ? /*#__PURE__*/React.createElement(Box, {
|
|
239
|
+
flexible: true,
|
|
240
|
+
shrink: true
|
|
241
|
+
}, searchList.map((item, index) => {
|
|
242
|
+
let {
|
|
243
|
+
name,
|
|
244
|
+
isNew
|
|
245
|
+
} = item;
|
|
246
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, searchList.length > 1 && isNew ? /*#__PURE__*/React.createElement(DropDownSeparator, null) : null, /*#__PURE__*/React.createElement(ListItem, {
|
|
247
|
+
key: index,
|
|
248
|
+
index: index,
|
|
249
|
+
autoHover: true,
|
|
250
|
+
value: isNew ? '' : name,
|
|
251
|
+
title: isNew ? '' : name,
|
|
252
|
+
onClick: addTag.bind(this, item),
|
|
253
|
+
needTick: true,
|
|
254
|
+
highlight: selectSearchIndex === index,
|
|
255
|
+
getRef: this.getSelectedItemRef,
|
|
256
|
+
isDisabled: listDisabled
|
|
257
|
+
}, isNew ? /*#__PURE__*/React.createElement(Container, {
|
|
258
|
+
alignBox: "row",
|
|
259
|
+
align: "vertical"
|
|
260
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
261
|
+
className: style.newTagLabel
|
|
262
|
+
}, i18nKeys.newTagText, ":"), /*#__PURE__*/React.createElement(Box, {
|
|
263
|
+
shrink: true,
|
|
264
|
+
"data-title": name,
|
|
265
|
+
className: `${style.dotted} ${style.newTagText} `,
|
|
266
|
+
dataId: `${dataId}_new_tag_text`
|
|
267
|
+
}, name)) : null));
|
|
268
|
+
})) : /*#__PURE__*/React.createElement(Box, {
|
|
269
|
+
flexible: true,
|
|
270
|
+
dataId: `${dataId}_empty`
|
|
271
|
+
}, /*#__PURE__*/React.createElement(Container, {
|
|
272
|
+
className: style.searchEmpty
|
|
273
|
+
}, /*#__PURE__*/React.createElement(CommonEmptyState, {
|
|
274
|
+
title: i18nKeys.emptyTitleText,
|
|
275
|
+
description: i18nKeys.emptyDescription,
|
|
276
|
+
size: "small",
|
|
277
|
+
getEmptyState: this.emptySearchSVG
|
|
278
|
+
})))))));
|
|
279
|
+
}) : null);
|
|
254
280
|
}
|
|
255
281
|
|
|
256
282
|
}
|
|
@@ -293,7 +319,8 @@ TagsMultiSelect.propTypes = {
|
|
|
293
319
|
getTextBoxChildren: PropTypes.func,
|
|
294
320
|
htmlId: PropTypes.string,
|
|
295
321
|
boxSize: PropTypes.string,
|
|
296
|
-
onSelectTag: PropTypes.func
|
|
322
|
+
onSelectTag: PropTypes.func,
|
|
323
|
+
clickableTag: PropTypes.bool
|
|
297
324
|
};
|
|
298
325
|
TagsMultiSelect.defaultProps = {
|
|
299
326
|
className: '',
|
|
@@ -302,7 +329,8 @@ TagsMultiSelect.defaultProps = {
|
|
|
302
329
|
borderColor: 'default',
|
|
303
330
|
needBorder: true,
|
|
304
331
|
dataId: '',
|
|
305
|
-
boxSize: 'default'
|
|
332
|
+
boxSize: 'default',
|
|
333
|
+
clickableTag: false
|
|
306
334
|
};
|
|
307
335
|
|
|
308
336
|
if (false) {
|
|
@@ -36,7 +36,8 @@ const TagsMultiSelectField = props => {
|
|
|
36
36
|
getTextBoxChildren,
|
|
37
37
|
children,
|
|
38
38
|
ePhiData,
|
|
39
|
-
customProps
|
|
39
|
+
customProps,
|
|
40
|
+
clickableTag
|
|
40
41
|
} = props;
|
|
41
42
|
const {
|
|
42
43
|
LabelProps = {},
|
|
@@ -232,7 +233,9 @@ const TagsMultiSelectField = props => {
|
|
|
232
233
|
htmlId: htmlId,
|
|
233
234
|
getTextBoxChildren: getTextBoxChildren,
|
|
234
235
|
className: containerClass
|
|
235
|
-
}, TagsMultiSelectProps
|
|
236
|
+
}, TagsMultiSelectProps, {
|
|
237
|
+
clickableTag: clickableTag
|
|
238
|
+
})), validationMessage && /*#__PURE__*/React.createElement(ValidationMessage, _extends({
|
|
236
239
|
text: validationMessage,
|
|
237
240
|
palette: validationPalette,
|
|
238
241
|
type: errorType,
|
|
@@ -252,7 +255,8 @@ TagsMultiSelectField.propTypes = {
|
|
|
252
255
|
value: PropTypes.string,
|
|
253
256
|
selectedValueCount: PropTypes.string,
|
|
254
257
|
validationMessage: PropTypes.string,
|
|
255
|
-
options: PropTypes.array
|
|
258
|
+
options: PropTypes.array,
|
|
259
|
+
clickableTag: PropTypes.bool
|
|
256
260
|
}),
|
|
257
261
|
styleProperties: PropTypes.shape({
|
|
258
262
|
labelSize: PropTypes.string,
|