@zohodesk/dot 1.0.0-beta.177 → 1.0.0-beta.180

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 CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  In this Library we Provide Some Basic Components to Build Your Application
4
4
 
5
+ # 1.0.0-beta.180
6
+
7
+ - TagsMultiSelect => scrollTop Issue Solved
8
+ - TagsMultiSelectField => keyPress index fixed
9
+
10
+ # 1.0.0-beta.179
11
+
12
+ - ToggleDropDown => selectedId fix while opening the dropdown.
13
+
14
+ # 1.0.0-beta.178
15
+
16
+ - ReadUnreadIcon component added
17
+
5
18
  # 1.0.0-beta.177
6
19
 
7
20
  - TextEditorField => isReadOnly Ui Given
@@ -46,6 +46,7 @@ export class ToggleDropDown extends Component {
46
46
  this.getOptionsArray = this.getOptionsArray.bind(this);
47
47
  this.emptySearchSVG = this.emptySearchSVG.bind(this);
48
48
  this.getAriaId = getUniqueId(this);
49
+ this.getSelectedIndex = this.getSelectedIndex.bind(this);
49
50
  }
50
51
 
51
52
  emptySearchSVG() {
@@ -189,6 +190,8 @@ export class ToggleDropDown extends Component {
189
190
  } else {
190
191
  onDropDownClose && onDropDownClose();
191
192
  }
193
+
194
+ this.getSelectedIndex(optionsArr);
192
195
  }
193
196
  }
194
197
 
@@ -366,18 +369,31 @@ export class ToggleDropDown extends Component {
366
369
  } else {
367
370
  if (keyCode === 13 || keyCode === 40) {
368
371
  togglePopup(e, boxPosition);
372
+ }
373
+ }
374
+ }
369
375
 
370
- for (let i = 0; i < optionsArr.length; i++) {
371
- const selectedValue = optionsArr[i][keyName];
376
+ getSelectedIndex(optionsArr) {
377
+ const {
378
+ selectedId,
379
+ idName
380
+ } = this.props;
372
381
 
373
- if (value === selectedValue) {
374
- this.setState({
375
- selectedIndex: i
376
- });
377
- break;
378
- }
382
+ if (selectedId) {
383
+ for (let i = 0; i < optionsArr.length; i++) {
384
+ const indexId = optionsArr[i][idName];
385
+
386
+ if (selectedId === indexId) {
387
+ this.setState({
388
+ selectedIndex: i
389
+ });
390
+ break;
379
391
  }
380
392
  }
393
+ } else {
394
+ this.setState({
395
+ selectedIndex: -1
396
+ });
381
397
  }
382
398
  }
383
399
 
@@ -30,11 +30,17 @@ export default class TagsMultiSelect extends React.Component {
30
30
  let {
31
31
  onScroll,
32
32
  name,
33
- noMoreData
33
+ noMoreData,
34
+ searchList
34
35
  } = this.props;
36
+ let {
37
+ containerRef
38
+ } = this;
35
39
 
36
40
  if (findScrollEnd(this.containerRef) && !noMoreData) {
37
41
  onScroll(name);
42
+ let selectItemRef = this[`selectedList_${searchList.length - 1}`];
43
+ scrollTo(containerRef, selectItemRef);
38
44
  }
39
45
  }
40
46
 
@@ -60,11 +66,13 @@ export default class TagsMultiSelect extends React.Component {
60
66
  }, 300);
61
67
  }
62
68
 
63
- let selectItemRef = this[`selectedList_${selectSearchIndex}`];
64
- let {
65
- containerRef
66
- } = this;
67
- scrollTo(containerRef, selectItemRef);
69
+ if (selectSearchIndex != prevProps.selectSearchIndex) {
70
+ let selectItemRef = this[`selectedList_${selectSearchIndex}`];
71
+ let {
72
+ containerRef
73
+ } = this;
74
+ scrollTo(containerRef, selectItemRef);
75
+ }
68
76
  }
69
77
 
70
78
  emptySearchSVG() {
@@ -129,12 +129,12 @@ const TagsMultiSelectField = props => {
129
129
  }
130
130
  } else if (keyCode === 40) {
131
131
  updateSelectedSuggestionIndex(prevSelectedSuggestionIndex => {
132
- let newIndex = prevSelectedSuggestionIndex === options.length - 1 ? 0 : prevSelectedSuggestionIndex + 1;
132
+ let newIndex = prevSelectedSuggestionIndex >= options.length - 1 ? 0 : prevSelectedSuggestionIndex + 1;
133
133
  return newIndex;
134
134
  });
135
135
  } else if (keyCode === 38) {
136
136
  updateSelectedSuggestionIndex(prevSelectedSuggestionIndex => {
137
- let newIndex = prevSelectedSuggestionIndex <= 0 ? options.length - 1 : prevSelectedSuggestionIndex - 1;
137
+ let newIndex = prevSelectedSuggestionIndex <= 0 || prevSelectedSuggestionIndex >= options.length - 1 ? options.length - 1 : prevSelectedSuggestionIndex - 1;
138
138
  return newIndex;
139
139
  });
140
140
  } else if (keyCode === 8 && searchValue === '' & !isValueChanged) {
@@ -12,4 +12,4 @@
12
12
  }
13
13
  .redHover:hover {
14
14
  color: var(--zdt_icons_hover_red);
15
- }
15
+ }
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Icon from '@zohodesk/icons/lib/Icon';
4
+ import style from './Icons.module.css';
5
+ export default class ReadUnreadIcon extends React.Component {
6
+ render() {
7
+ let {
8
+ onClick,
9
+ dataId,
10
+ dataTitle,
11
+ iconClass,
12
+ className,
13
+ isRead,
14
+ iconSize
15
+ } = this.props;
16
+ return /*#__PURE__*/React.createElement("span", {
17
+ onClick: onClick,
18
+ className: `${style.iconStyle} ${style.blueHover} ${className ? className : ''}`,
19
+ "data-id": dataId,
20
+ "data-title": dataTitle
21
+ }, /*#__PURE__*/React.createElement(Icon, {
22
+ name: isRead ? 'ZD-TK-read' : 'ZD-TK-unread',
23
+ size: iconSize,
24
+ iconClass: iconClass
25
+ }));
26
+ }
27
+
28
+ }
29
+ ReadUnreadIcon.defaultProps = {
30
+ isRead: false
31
+ };
32
+ ReadUnreadIcon.propTypes = {
33
+ className: PropTypes.string,
34
+ dataId: PropTypes.string,
35
+ dataTitle: PropTypes.string,
36
+ iconClass: PropTypes.string,
37
+ onClick: PropTypes.func,
38
+ isRead: PropTypes.bool,
39
+ iconSize: PropTypes.string
40
+ };
@@ -3,9 +3,15 @@ import FloatingIcons from '../FloatingIcons';
3
3
  import EditIcon from '../EditIcon';
4
4
  import DeleteIcon from '../DeleteIcon';
5
5
  import SmartIcon from '../SmartIcon';
6
+ import ReadUnreadIcon from '../ReadUnreadIcon';
6
7
  export default class FloatingIcons__default extends Component {
7
8
  render() {
8
- return /*#__PURE__*/React.createElement(FloatingIcons, null, /*#__PURE__*/React.createElement(EditIcon, null), /*#__PURE__*/React.createElement(DeleteIcon, null), /*#__PURE__*/React.createElement(SmartIcon, null));
9
+ return /*#__PURE__*/React.createElement(FloatingIcons, null, /*#__PURE__*/React.createElement(ReadUnreadIcon, {
10
+ isRead: true,
11
+ iconSize: "15"
12
+ }), /*#__PURE__*/React.createElement(ReadUnreadIcon, {
13
+ iconSize: "15"
14
+ }), /*#__PURE__*/React.createElement(EditIcon, null), /*#__PURE__*/React.createElement(DeleteIcon, null), /*#__PURE__*/React.createElement(SmartIcon, null));
9
15
  }
10
16
 
11
17
  }
@@ -111,6 +111,7 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
111
111
  _this.getOptionsArray = _this.getOptionsArray.bind(_assertThisInitialized(_this));
112
112
  _this.emptySearchSVG = _this.emptySearchSVG.bind(_assertThisInitialized(_this));
113
113
  _this.getAriaId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this));
114
+ _this.getSelectedIndex = _this.getSelectedIndex.bind(_assertThisInitialized(_this));
114
115
  return _this;
115
116
  }
116
117
 
@@ -263,6 +264,8 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
263
264
  } else {
264
265
  onDropDownClose && onDropDownClose();
265
266
  }
267
+
268
+ this.getSelectedIndex(optionsArr);
266
269
  }
267
270
  }
268
271
  }, {
@@ -433,27 +436,40 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
433
436
  } else {
434
437
  if (keyCode === 13 || keyCode === 40) {
435
438
  togglePopup(e, boxPosition);
439
+ }
440
+ }
441
+ }
442
+ }, {
443
+ key: "getSelectedIndex",
444
+ value: function getSelectedIndex(optionsArr) {
445
+ var _this$props9 = this.props,
446
+ selectedId = _this$props9.selectedId,
447
+ idName = _this$props9.idName;
436
448
 
437
- for (var i = 0; i < optionsArr.length; i++) {
438
- var selectedValue = optionsArr[i][keyName];
449
+ if (selectedId) {
450
+ for (var i = 0; i < optionsArr.length; i++) {
451
+ var indexId = optionsArr[i][idName];
439
452
 
440
- if (value === selectedValue) {
441
- this.setState({
442
- selectedIndex: i
443
- });
444
- break;
445
- }
453
+ if (selectedId === indexId) {
454
+ this.setState({
455
+ selectedIndex: i
456
+ });
457
+ break;
446
458
  }
447
459
  }
460
+ } else {
461
+ this.setState({
462
+ selectedIndex: -1
463
+ });
448
464
  }
449
465
  }
450
466
  }, {
451
467
  key: "onSearchAPI",
452
468
  value: function onSearchAPI() {
453
469
  var searchValue = this.state.searchValue;
454
- var _this$props9 = this.props,
455
- needSearchFetching = _this$props9.needSearchFetching,
456
- onSearch = _this$props9.onSearch;
470
+ var _this$props10 = this.props,
471
+ needSearchFetching = _this$props10.needSearchFetching,
472
+ onSearch = _this$props10.onSearch;
457
473
 
458
474
  if (needSearchFetching && onSearch) {
459
475
  onSearch(searchValue);
@@ -496,9 +512,9 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
496
512
  }, {
497
513
  key: "handleScroll",
498
514
  value: function handleScroll(e) {
499
- var _this$props10 = this.props,
500
- isNextOptions = _this$props10.isNextOptions,
501
- getNextOptions = _this$props10.getNextOptions;
515
+ var _this$props11 = this.props,
516
+ isNextOptions = _this$props11.isNextOptions,
517
+ getNextOptions = _this$props11.getNextOptions;
502
518
  var searchValue = this.state.searchValue;
503
519
 
504
520
  if (e.target.scrollTop + e.target.offsetHeight > e.target.scrollHeight - 1) {
@@ -515,58 +531,58 @@ var ToggleDropDown = /*#__PURE__*/function (_Component) {
515
531
  var _this$state3 = this.state,
516
532
  options = _this$state3.options,
517
533
  selectedIndex = _this$state3.selectedIndex;
518
- var _this$props11 = this.props,
519
- value = _this$props11.value,
520
- removeClose = _this$props11.removeClose,
521
- boxSize = _this$props11.boxSize,
522
- keyName = _this$props11.keyName,
523
- idName = _this$props11.idName,
524
- title = _this$props11.title,
525
- isSearch = _this$props11.isSearch,
526
- isArrow = _this$props11.isArrow,
527
- placeHolderText = _this$props11.placeHolderText,
528
- className = _this$props11.className,
529
- right = _this$props11.right,
530
- left = _this$props11.left,
531
- top = _this$props11.top,
532
- bottom = _this$props11.bottom,
533
- isOpen = _this$props11.isPopupOpen,
534
- isPopupActive = _this$props11.isPopupActive,
535
- needExternalPopupState = _this$props11.needExternalPopupState,
536
- isPopupReady = _this$props11.isPopupReady,
537
- position = _this$props11.position,
538
- getTargetRef = _this$props11.getTargetRef,
539
- getContainerRef = _this$props11.getContainerRef,
540
- dataId = _this$props11.dataId,
541
- searchBoxSize = _this$props11.searchBoxSize,
542
- searchEmptyHint = _this$props11.searchEmptyHint,
543
- searchErrorText = _this$props11.searchErrorText,
544
- activeStyle = _this$props11.activeStyle,
545
- showOnHover = _this$props11.showOnHover,
546
- isDisabled = _this$props11.isDisabled,
547
- showIconOnHover = _this$props11.showIconOnHover,
548
- isReadOnly = _this$props11.isReadOnly,
549
- hoverStyle = _this$props11.hoverStyle,
550
- isEditable = _this$props11.isEditable,
551
- iconName = _this$props11.iconName,
552
- iconSize = _this$props11.iconSize,
553
- needTick = _this$props11.needTick,
554
- dataTitle = _this$props11.dataTitle,
555
- isDataLoaded = _this$props11.isDataLoaded,
556
- children = _this$props11.children,
557
- needResponsive = _this$props11.needResponsive,
558
- arrowIconPosition = _this$props11.arrowIconPosition,
559
- isGroupDropDown = _this$props11.isGroupDropDown,
560
- groupOptionsKey = _this$props11.groupOptionsKey,
561
- groupNameKey = _this$props11.groupNameKey,
562
- isToggleStateNeeded = _this$props11.isToggleStateNeeded,
563
- selectedId = _this$props11.selectedId,
564
- isPadding = _this$props11.isPadding,
565
- isNeedEffect = _this$props11.isNeedEffect,
566
- hoverType = _this$props11.hoverType,
567
- palette = _this$props11.palette,
568
- getFooter = _this$props11.getFooter,
569
- customProps = _this$props11.customProps;
534
+ var _this$props12 = this.props,
535
+ value = _this$props12.value,
536
+ removeClose = _this$props12.removeClose,
537
+ boxSize = _this$props12.boxSize,
538
+ keyName = _this$props12.keyName,
539
+ idName = _this$props12.idName,
540
+ title = _this$props12.title,
541
+ isSearch = _this$props12.isSearch,
542
+ isArrow = _this$props12.isArrow,
543
+ placeHolderText = _this$props12.placeHolderText,
544
+ className = _this$props12.className,
545
+ right = _this$props12.right,
546
+ left = _this$props12.left,
547
+ top = _this$props12.top,
548
+ bottom = _this$props12.bottom,
549
+ isOpen = _this$props12.isPopupOpen,
550
+ isPopupActive = _this$props12.isPopupActive,
551
+ needExternalPopupState = _this$props12.needExternalPopupState,
552
+ isPopupReady = _this$props12.isPopupReady,
553
+ position = _this$props12.position,
554
+ getTargetRef = _this$props12.getTargetRef,
555
+ getContainerRef = _this$props12.getContainerRef,
556
+ dataId = _this$props12.dataId,
557
+ searchBoxSize = _this$props12.searchBoxSize,
558
+ searchEmptyHint = _this$props12.searchEmptyHint,
559
+ searchErrorText = _this$props12.searchErrorText,
560
+ activeStyle = _this$props12.activeStyle,
561
+ showOnHover = _this$props12.showOnHover,
562
+ isDisabled = _this$props12.isDisabled,
563
+ showIconOnHover = _this$props12.showIconOnHover,
564
+ isReadOnly = _this$props12.isReadOnly,
565
+ hoverStyle = _this$props12.hoverStyle,
566
+ isEditable = _this$props12.isEditable,
567
+ iconName = _this$props12.iconName,
568
+ iconSize = _this$props12.iconSize,
569
+ needTick = _this$props12.needTick,
570
+ dataTitle = _this$props12.dataTitle,
571
+ isDataLoaded = _this$props12.isDataLoaded,
572
+ children = _this$props12.children,
573
+ needResponsive = _this$props12.needResponsive,
574
+ arrowIconPosition = _this$props12.arrowIconPosition,
575
+ isGroupDropDown = _this$props12.isGroupDropDown,
576
+ groupOptionsKey = _this$props12.groupOptionsKey,
577
+ groupNameKey = _this$props12.groupNameKey,
578
+ isToggleStateNeeded = _this$props12.isToggleStateNeeded,
579
+ selectedId = _this$props12.selectedId,
580
+ isPadding = _this$props12.isPadding,
581
+ isNeedEffect = _this$props12.isNeedEffect,
582
+ hoverType = _this$props12.hoverType,
583
+ palette = _this$props12.palette,
584
+ getFooter = _this$props12.getFooter,
585
+ customProps = _this$props12.customProps;
570
586
  var _customProps$ToggleDr = customProps.ToggleDropDownProps,
571
587
  ToggleDropDownProps = _customProps$ToggleDr === void 0 ? {} : _customProps$ToggleDr,
572
588
  _customProps$DropBoxP = customProps.DropBoxProps,
@@ -86,10 +86,14 @@ var TagsMultiSelect = /*#__PURE__*/function (_React$Component) {
86
86
  var _this$props = this.props,
87
87
  onScroll = _this$props.onScroll,
88
88
  name = _this$props.name,
89
- noMoreData = _this$props.noMoreData;
89
+ noMoreData = _this$props.noMoreData,
90
+ searchList = _this$props.searchList;
91
+ var containerRef = this.containerRef;
90
92
 
91
93
  if ((0, _Common.findScrollEnd)(this.containerRef) && !noMoreData) {
92
94
  onScroll(name);
95
+ var selectItemRef = this["selectedList_".concat(searchList.length - 1)];
96
+ (0, _Common2.scrollTo)(containerRef, selectItemRef);
93
97
  }
94
98
  }
95
99
  }, {
@@ -118,9 +122,11 @@ var TagsMultiSelect = /*#__PURE__*/function (_React$Component) {
118
122
  }, 300);
119
123
  }
120
124
 
121
- var selectItemRef = this["selectedList_".concat(selectSearchIndex)];
122
- var containerRef = this.containerRef;
123
- (0, _Common2.scrollTo)(containerRef, selectItemRef);
125
+ if (selectSearchIndex != prevProps.selectSearchIndex) {
126
+ var selectItemRef = this["selectedList_".concat(selectSearchIndex)];
127
+ var containerRef = this.containerRef;
128
+ (0, _Common2.scrollTo)(containerRef, selectItemRef);
129
+ }
124
130
  }
125
131
  }, {
126
132
  key: "emptySearchSVG",
@@ -167,12 +167,12 @@ var TagsMultiSelectField = function TagsMultiSelectField(props) {
167
167
  }
168
168
  } else if (keyCode === 40) {
169
169
  updateSelectedSuggestionIndex(function (prevSelectedSuggestionIndex) {
170
- var newIndex = prevSelectedSuggestionIndex === options.length - 1 ? 0 : prevSelectedSuggestionIndex + 1;
170
+ var newIndex = prevSelectedSuggestionIndex >= options.length - 1 ? 0 : prevSelectedSuggestionIndex + 1;
171
171
  return newIndex;
172
172
  });
173
173
  } else if (keyCode === 38) {
174
174
  updateSelectedSuggestionIndex(function (prevSelectedSuggestionIndex) {
175
- var newIndex = prevSelectedSuggestionIndex <= 0 ? options.length - 1 : prevSelectedSuggestionIndex - 1;
175
+ var newIndex = prevSelectedSuggestionIndex <= 0 || prevSelectedSuggestionIndex >= options.length - 1 ? options.length - 1 : prevSelectedSuggestionIndex - 1;
176
176
  return newIndex;
177
177
  });
178
178
  } else if (keyCode === 8 && searchValue === '' & !isValueChanged) {
@@ -12,4 +12,4 @@
12
12
  }
13
13
  .redHover:hover {
14
14
  color: var(--zdt_icons_hover_red);
15
- }
15
+ }
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
14
+ var _Icon = _interopRequireDefault(require("@zohodesk/icons/lib/Icon"));
15
+
16
+ var _IconsModule = _interopRequireDefault(require("./Icons.module.css"));
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
+
20
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
+
22
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
+
24
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
25
+
26
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
+
28
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
+
30
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
+
32
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
33
+
34
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
+
36
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
+
38
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
39
+
40
+ var ReadUnreadIcon = /*#__PURE__*/function (_React$Component) {
41
+ _inherits(ReadUnreadIcon, _React$Component);
42
+
43
+ var _super = _createSuper(ReadUnreadIcon);
44
+
45
+ function ReadUnreadIcon() {
46
+ _classCallCheck(this, ReadUnreadIcon);
47
+
48
+ return _super.apply(this, arguments);
49
+ }
50
+
51
+ _createClass(ReadUnreadIcon, [{
52
+ key: "render",
53
+ value: function render() {
54
+ var _this$props = this.props,
55
+ onClick = _this$props.onClick,
56
+ dataId = _this$props.dataId,
57
+ dataTitle = _this$props.dataTitle,
58
+ iconClass = _this$props.iconClass,
59
+ className = _this$props.className,
60
+ isRead = _this$props.isRead,
61
+ iconSize = _this$props.iconSize;
62
+ return /*#__PURE__*/_react["default"].createElement("span", {
63
+ onClick: onClick,
64
+ className: "".concat(_IconsModule["default"].iconStyle, " ").concat(_IconsModule["default"].blueHover, " ").concat(className ? className : ''),
65
+ "data-id": dataId,
66
+ "data-title": dataTitle
67
+ }, /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
68
+ name: isRead ? 'ZD-TK-read' : 'ZD-TK-unread',
69
+ size: iconSize,
70
+ iconClass: iconClass
71
+ }));
72
+ }
73
+ }]);
74
+
75
+ return ReadUnreadIcon;
76
+ }(_react["default"].Component);
77
+
78
+ exports["default"] = ReadUnreadIcon;
79
+ ReadUnreadIcon.defaultProps = {
80
+ isRead: false
81
+ };
82
+ ReadUnreadIcon.propTypes = {
83
+ className: _propTypes["default"].string,
84
+ dataId: _propTypes["default"].string,
85
+ dataTitle: _propTypes["default"].string,
86
+ iconClass: _propTypes["default"].string,
87
+ onClick: _propTypes["default"].func,
88
+ isRead: _propTypes["default"].bool,
89
+ iconSize: _propTypes["default"].string
90
+ };
@@ -17,6 +17,8 @@ var _DeleteIcon = _interopRequireDefault(require("../DeleteIcon"));
17
17
 
18
18
  var _SmartIcon = _interopRequireDefault(require("../SmartIcon"));
19
19
 
20
+ var _ReadUnreadIcon = _interopRequireDefault(require("../ReadUnreadIcon"));
21
+
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
23
 
22
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -57,7 +59,12 @@ var FloatingIcons__default = /*#__PURE__*/function (_Component) {
57
59
  _createClass(FloatingIcons__default, [{
58
60
  key: "render",
59
61
  value: function render() {
60
- return /*#__PURE__*/_react["default"].createElement(_FloatingIcons["default"], null, /*#__PURE__*/_react["default"].createElement(_EditIcon["default"], null), /*#__PURE__*/_react["default"].createElement(_DeleteIcon["default"], null), /*#__PURE__*/_react["default"].createElement(_SmartIcon["default"], null));
62
+ return /*#__PURE__*/_react["default"].createElement(_FloatingIcons["default"], null, /*#__PURE__*/_react["default"].createElement(_ReadUnreadIcon["default"], {
63
+ isRead: true,
64
+ iconSize: "15"
65
+ }), /*#__PURE__*/_react["default"].createElement(_ReadUnreadIcon["default"], {
66
+ iconSize: "15"
67
+ }), /*#__PURE__*/_react["default"].createElement(_EditIcon["default"], null), /*#__PURE__*/_react["default"].createElement(_DeleteIcon["default"], null), /*#__PURE__*/_react["default"].createElement(_SmartIcon["default"], null));
61
68
  }
62
69
  }]);
63
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/dot",
3
- "version": "1.0.0-beta.177",
3
+ "version": "1.0.0-beta.180",
4
4
  "main": "lib/index",
5
5
  "module": "es/index.js",
6
6
  "jsnext:main": "es/index.js",
@@ -30,9 +30,9 @@
30
30
  "dependencies": {},
31
31
  "devDependencies": {
32
32
  "velocity-react": "^1.4.3",
33
- "@zohodesk/variables": "1.0.0-beta.21",
33
+ "@zohodesk/variables": "1.0.0-beta.23",
34
34
  "@zohodesk/i18n": "^1.0.0-beta.7",
35
- "@zohodesk/components": "1.0.0-alpha-195",
35
+ "@zohodesk/components": "1.0.0-alpha-202",
36
36
  "@zohodesk/icons": "1.0.0-beta.79",
37
37
  "@zohodesk/svg": "1.0.0-beta.34",
38
38
  "@zohodesk/virtualizer": "1.0.3",
@@ -40,9 +40,9 @@
40
40
  },
41
41
  "peerDependencies": {
42
42
  "velocity-react": "^1.4.3",
43
- "@zohodesk/variables": "^1.0.0-beta.21",
43
+ "@zohodesk/variables": "^1.0.0-beta.23",
44
44
  "@zohodesk/i18n": "^1.0.0-beta.7",
45
- "@zohodesk/components": "1.0.0-alpha-195",
45
+ "@zohodesk/components": "1.0.0-alpha-202",
46
46
  "@zohodesk/icons": "^1.0.0-beta.79",
47
47
  "@zohodesk/svg": "^1.0.0-beta.34"
48
48
  },
@@ -45,6 +45,7 @@ export class ToggleDropDown extends Component {
45
45
  this.getOptionsArray = this.getOptionsArray.bind(this);
46
46
  this.emptySearchSVG = this.emptySearchSVG.bind(this);
47
47
  this.getAriaId = getUniqueId(this);
48
+ this.getSelectedIndex = this.getSelectedIndex.bind(this);
48
49
  }
49
50
 
50
51
  emptySearchSVG() {
@@ -156,6 +157,7 @@ export class ToggleDropDown extends Component {
156
157
  } else {
157
158
  onDropDownClose && onDropDownClose();
158
159
  }
160
+ this.getSelectedIndex(optionsArr);
159
161
  }
160
162
  }
161
163
 
@@ -306,17 +308,28 @@ export class ToggleDropDown extends Component {
306
308
  } else {
307
309
  if (keyCode === 13 || keyCode === 40) {
308
310
  togglePopup(e, boxPosition);
309
- for (let i = 0; i < optionsArr.length; i++) {
310
- const selectedValue = optionsArr[i][keyName];
311
- if (value === selectedValue) {
312
- this.setState({
313
- selectedIndex: i
314
- });
315
- break;
316
- }
311
+ }
312
+ }
313
+ }
314
+
315
+ getSelectedIndex(optionsArr) {
316
+ const { selectedId, idName } = this.props;
317
+ if(selectedId) {
318
+ for (let i = 0; i < optionsArr.length; i++) {
319
+ const indexId = optionsArr[i][idName];
320
+ if (selectedId === indexId) {
321
+ this.setState({
322
+ selectedIndex: i
323
+ });
324
+ break;
317
325
  }
318
326
  }
319
327
  }
328
+ else {
329
+ this.setState({
330
+ selectedIndex: -1
331
+ })
332
+ }
320
333
  }
321
334
 
322
335
  onSearchAPI() {
@@ -25,9 +25,14 @@ export default class TagsMultiSelect extends React.Component {
25
25
  }
26
26
 
27
27
  onScroll() {
28
- let { onScroll, name, noMoreData } = this.props;
28
+ let { onScroll, name, noMoreData, searchList } = this.props;
29
+ let {
30
+ containerRef
31
+ } = this;
29
32
  if (findScrollEnd(this.containerRef) && !noMoreData) {
30
33
  onScroll(name);
34
+ let selectItemRef = this[`selectedList_${searchList.length-1}`];
35
+ scrollTo(containerRef, selectItemRef);
31
36
  }
32
37
  }
33
38
 
@@ -52,9 +57,11 @@ export default class TagsMultiSelect extends React.Component {
52
57
  }
53
58
  }, 300);
54
59
  }
55
- let selectItemRef = this[`selectedList_${selectSearchIndex}`];
56
- let { containerRef } = this;
57
- scrollTo(containerRef, selectItemRef);
60
+ if(selectSearchIndex != prevProps.selectSearchIndex){
61
+ let selectItemRef = this[`selectedList_${selectSearchIndex}`];
62
+ let { containerRef } = this;
63
+ scrollTo(containerRef, selectItemRef);
64
+ }
58
65
  }
59
66
 
60
67
  emptySearchSVG() {
@@ -110,7 +110,7 @@ const TagsMultiSelectField = props => {
110
110
  } else if (keyCode === 40) {
111
111
  updateSelectedSuggestionIndex(prevSelectedSuggestionIndex => {
112
112
  let newIndex =
113
- prevSelectedSuggestionIndex === options.length - 1
113
+ prevSelectedSuggestionIndex >= options.length - 1
114
114
  ? 0
115
115
  : prevSelectedSuggestionIndex + 1;
116
116
  return newIndex;
@@ -118,7 +118,7 @@ const TagsMultiSelectField = props => {
118
118
  } else if (keyCode === 38) {
119
119
  updateSelectedSuggestionIndex(prevSelectedSuggestionIndex => {
120
120
  let newIndex =
121
- prevSelectedSuggestionIndex <= 0
121
+ (prevSelectedSuggestionIndex <= 0 || prevSelectedSuggestionIndex >= options.length - 1)
122
122
  ? options.length - 1
123
123
  : prevSelectedSuggestionIndex - 1;
124
124
  return newIndex;
@@ -4,14 +4,8 @@ import Icon from '@zohodesk/icons/lib/Icon';
4
4
  import style from './Icons.module.css';
5
5
  export default class CompleteIcon extends React.Component {
6
6
  render() {
7
- let {
8
- onClick,
9
- dataId,
10
- dataTitle,
11
- iconClass,
12
- className,
13
- iconSize
14
- } = this.props;
7
+ let { onClick, dataId, dataTitle, iconClass, className, iconSize } =
8
+ this.props;
15
9
  return (
16
10
  <span
17
11
  onClick={onClick}
@@ -5,14 +5,8 @@ import Icon from '@zohodesk/icons/lib/Icon';
5
5
 
6
6
  export default class DeleteComponent extends React.Component {
7
7
  render() {
8
- let {
9
- onClick,
10
- dataId,
11
- dataTitle,
12
- iconClass,
13
- iconSize,
14
- className
15
- } = this.props;
8
+ let { onClick, dataId, dataTitle, iconClass, iconSize, className } =
9
+ this.props;
16
10
  return (
17
11
  <span
18
12
  onClick={onClick}
@@ -5,14 +5,8 @@ import Icon from '@zohodesk/icons/lib/Icon';
5
5
 
6
6
  export default class EditIcon extends React.Component {
7
7
  render() {
8
- let {
9
- onClick,
10
- dataId,
11
- dataTitle,
12
- iconClass,
13
- iconSize,
14
- className
15
- } = this.props;
8
+ let { onClick, dataId, dataTitle, iconClass, iconSize, className } =
9
+ this.props;
16
10
  return (
17
11
  <span
18
12
  onClick={onClick}
@@ -29,4 +29,4 @@ if (__DOCS__) {
29
29
  folderName: 'List',
30
30
  componentGroup: 'FloatingIcons'
31
31
  };
32
- }
32
+ }
@@ -12,4 +12,4 @@
12
12
  }
13
13
  .redHover:hover {
14
14
  color: var(--zdt_icons_hover_red);
15
- }
15
+ }
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import Icon from '@zohodesk/icons/lib/Icon';
4
+ import style from './Icons.module.css';
5
+
6
+ export default class ReadUnreadIcon extends React.Component {
7
+ render() {
8
+ let { onClick, dataId, dataTitle, iconClass, className, isRead, iconSize } =
9
+ this.props;
10
+ return (
11
+ <span
12
+ onClick={onClick}
13
+ className={`${style.iconStyle} ${style.blueHover} ${
14
+ className ? className : ''
15
+ }`}
16
+ data-id={dataId}
17
+ data-title={dataTitle}
18
+ >
19
+ <Icon
20
+ name={isRead ? 'ZD-TK-read' : 'ZD-TK-unread'}
21
+ size={iconSize}
22
+ iconClass={iconClass}
23
+ />
24
+ </span>
25
+ );
26
+ }
27
+ }
28
+
29
+ ReadUnreadIcon.defaultProps = {
30
+ isRead: false
31
+ };
32
+
33
+ ReadUnreadIcon.propTypes = {
34
+ className: PropTypes.string,
35
+ dataId: PropTypes.string,
36
+ dataTitle: PropTypes.string,
37
+ iconClass: PropTypes.string,
38
+ onClick: PropTypes.func,
39
+ isRead: PropTypes.bool,
40
+ iconSize: PropTypes.string
41
+ };
@@ -3,11 +3,14 @@ import FloatingIcons from '../FloatingIcons';
3
3
  import EditIcon from '../EditIcon';
4
4
  import DeleteIcon from '../DeleteIcon';
5
5
  import SmartIcon from '../SmartIcon';
6
+ import ReadUnreadIcon from '../ReadUnreadIcon';
6
7
 
7
8
  export default class FloatingIcons__default extends Component {
8
9
  render() {
9
10
  return (
10
11
  <FloatingIcons>
12
+ <ReadUnreadIcon isRead iconSize="15" />
13
+ <ReadUnreadIcon iconSize="15" />
11
14
  <EditIcon />
12
15
  <DeleteIcon />
13
16
  <SmartIcon />