superdesk-ui-framework 3.0.6 → 3.0.7

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.
@@ -63497,31 +63497,52 @@ var TreeSelect = /** @class */ (function (_super) {
63497
63497
  function TreeSelect(props) {
63498
63498
  var _this = _super.call(this, props) || this;
63499
63499
  _this.htmlId = (0, react_id_generator_1.default)();
63500
+ _this.inputFocus = function () {
63501
+ var _a;
63502
+ (_a = _this.inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
63503
+ };
63504
+ _this.listNavigation = function () {
63505
+ var element = document.querySelector('.suggestion-item--btn');
63506
+ element.focus();
63507
+ };
63508
+ _this.buttonFocus = function () {
63509
+ var _a;
63510
+ (_a = _this.categoryButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
63511
+ };
63500
63512
  _this.componentDidMount = function () {
63501
63513
  _this.recursion(_this.state.options);
63502
63514
  document.addEventListener("mousedown", function (event) {
63515
+ if (!(event.target instanceof HTMLInputElement)) {
63516
+ return;
63517
+ }
63503
63518
  if ((_this.dropdownRef.current && !_this.dropdownRef.current.contains(event.target))
63504
63519
  && (_this.openDropdownRef.current && !_this.openDropdownRef.current.contains(event.target))) {
63505
63520
  _this.setState({ openDropdown: false });
63506
63521
  }
63507
63522
  });
63523
+ document.addEventListener("keydown", function (e) {
63524
+ if (_this.state.openDropdown && _this.ref.current) {
63525
+ keyboardNavigation(e, _this.ref.current, _this.categoryButtonRef.current ? _this.buttonFocus : _this.inputFocus);
63526
+ if (e.key === 'Backspace') {
63527
+ _this.backButton();
63528
+ var buttonTarget = _this.state.buttonTarget;
63529
+ var className = buttonTarget.pop();
63530
+ if (className != null) {
63531
+ var element = document.getElementsByClassName(className)[0];
63532
+ element.focus();
63533
+ }
63534
+ }
63535
+ }
63536
+ });
63508
63537
  };
63509
- _this.backButton = function () {
63510
- if (_this.state.activeTree.length > 0) {
63538
+ _this.backButtonValue = function () {
63539
+ var item = _this.state.buttonTree.pop();
63540
+ if (item != null) {
63511
63541
  _this.setState({
63512
- options: _this.state.activeTree.pop(),
63542
+ buttonValue: item,
63513
63543
  });
63514
- return;
63515
- }
63516
- else {
63517
- return false;
63518
63544
  }
63519
63545
  };
63520
- _this.backButtonValue = function () {
63521
- _this.setState({
63522
- buttonValue: _this.state.buttonTree.pop(),
63523
- });
63524
- };
63525
63546
  _this.debounceFn = (0, debounce_1.default)(_this.handleDebounce, 500);
63526
63547
  _this.state = {
63527
63548
  value: _this.props.value ? _this.props.value : [],
@@ -63531,11 +63552,11 @@ var TreeSelect = /** @class */ (function (_super) {
63531
63552
  filterArr: [],
63532
63553
  searchFieldValue: '',
63533
63554
  buttonTree: [],
63534
- buttonValue: [],
63555
+ buttonValue: null,
63535
63556
  buttonMouseEvent: false,
63536
63557
  openDropdown: false,
63537
63558
  loading: false,
63538
- // provera: false
63559
+ buttonTarget: [],
63539
63560
  };
63540
63561
  _this.removeClick = _this.removeClick.bind(_this);
63541
63562
  _this.handleMultiLevel = _this.handleMultiLevel.bind(_this);
@@ -63544,14 +63565,19 @@ var TreeSelect = /** @class */ (function (_super) {
63544
63565
  _this.backButtonValue = _this.backButtonValue.bind(_this);
63545
63566
  _this.handleTree = _this.handleTree.bind(_this);
63546
63567
  _this.filteredItem = _this.filteredItem.bind(_this);
63547
- _this.banchButton = _this.banchButton.bind(_this);
63568
+ _this.branchButton = _this.branchButton.bind(_this);
63548
63569
  _this.handleDebounce = _this.handleDebounce.bind(_this);
63549
63570
  _this.toggleMenu = _this.toggleMenu.bind(_this);
63550
63571
  _this.dropdownRef = React.createRef();
63572
+ _this.ref = React.createRef();
63573
+ _this.inputRef = React.createRef();
63574
+ _this.categoryButtonRef = React.createRef();
63551
63575
  _this.openDropdownRef = React.createRef();
63576
+ _this.popperInstance = null;
63552
63577
  return _this;
63553
63578
  }
63554
63579
  TreeSelect.prototype.componentDidUpdate = function (prevProps, prevState) {
63580
+ var _a;
63555
63581
  if (!(0, lodash_1.isEqual)(prevState.value, this.state.value)) {
63556
63582
  this.props.onChange(this.state.value);
63557
63583
  }
@@ -63565,11 +63591,13 @@ var TreeSelect = /** @class */ (function (_super) {
63565
63591
  if ((prevState.activeTree !== this.state.activeTree)
63566
63592
  || (prevState.filterArr !== this.state.filterArr)
63567
63593
  || (prevState.options !== this.state.options)) {
63568
- this.popperInstance.update();
63594
+ (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
63569
63595
  }
63570
63596
  }
63571
63597
  };
63572
63598
  TreeSelect.prototype.toggleMenu = function () {
63599
+ var _this = this;
63600
+ var _a, _b;
63573
63601
  if (this.state.openDropdown) {
63574
63602
  if (this.openDropdownRef.current && this.dropdownRef.current) {
63575
63603
  this.popperInstance = (0, core_1.createPopper)(this.openDropdownRef.current, this.dropdownRef.current, {
@@ -63584,6 +63612,30 @@ var TreeSelect = /** @class */ (function (_super) {
63584
63612
  ],
63585
63613
  });
63586
63614
  }
63615
+ (_a = this.inputRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('keydown', function (e) {
63616
+ if (e.key === 'ArrowDown') {
63617
+ e.preventDefault();
63618
+ e.stopPropagation();
63619
+ if (_this.categoryButtonRef.current) {
63620
+ _this.buttonFocus();
63621
+ }
63622
+ else {
63623
+ setTimeout(function () {
63624
+ _this.listNavigation();
63625
+ });
63626
+ }
63627
+ }
63628
+ });
63629
+ if (this.inputRef.current) {
63630
+ this.inputFocus();
63631
+ }
63632
+ else {
63633
+ var element = document.querySelector('.suggestion-item--btn');
63634
+ element.focus();
63635
+ }
63636
+ }
63637
+ else {
63638
+ (_b = this.openDropdownRef.current) === null || _b === void 0 ? void 0 : _b.focus();
63587
63639
  }
63588
63640
  };
63589
63641
  TreeSelect.prototype.removeClick = function (i) {
@@ -63603,8 +63655,12 @@ var TreeSelect = /** @class */ (function (_super) {
63603
63655
  }
63604
63656
  };
63605
63657
  TreeSelect.prototype.handleButton = function (item) {
63658
+ var buttonTreeNext = this.state.buttonTree;
63659
+ if (this.state.buttonValue != null) {
63660
+ buttonTreeNext = buttonTreeNext.concat(this.state.buttonValue);
63661
+ }
63606
63662
  this.setState({
63607
- buttonTree: __spreadArray(__spreadArray([], this.state.buttonTree, true), [this.state.buttonValue], false),
63663
+ buttonTree: buttonTreeNext,
63608
63664
  buttonValue: item,
63609
63665
  });
63610
63666
  };
@@ -63619,10 +63675,15 @@ var TreeSelect = /** @class */ (function (_super) {
63619
63675
  }
63620
63676
  if (!event.ctrlKey) {
63621
63677
  if (this.props.getOptions) {
63622
- this.setState({ options: this.state.firstBranchOptions, activeTree: [], openDropdown: false });
63678
+ this.setState({
63679
+ options: this.state.firstBranchOptions,
63680
+ activeTree: [],
63681
+ buttonTarget: [],
63682
+ openDropdown: false,
63683
+ });
63623
63684
  }
63624
63685
  else {
63625
- this.setState({ activeTree: [], openDropdown: false });
63686
+ this.setState({ activeTree: [], buttonTarget: [], openDropdown: false });
63626
63687
  }
63627
63688
  }
63628
63689
  this.setState({ buttonMouseEvent: false });
@@ -63635,7 +63696,12 @@ var TreeSelect = /** @class */ (function (_super) {
63635
63696
  this.setState({ value: [item.value] });
63636
63697
  }
63637
63698
  if (!event.ctrlKey) {
63638
- this.setState({ options: this.state.firstBranchOptions, activeTree: [], openDropdown: false });
63699
+ this.setState({
63700
+ options: this.state.firstBranchOptions,
63701
+ activeTree: [],
63702
+ buttonTarget: [],
63703
+ openDropdown: false,
63704
+ });
63639
63705
  }
63640
63706
  this.setState({ buttonMouseEvent: false });
63641
63707
  }
@@ -63651,7 +63717,12 @@ var TreeSelect = /** @class */ (function (_super) {
63651
63717
  this.setState({ value: __spreadArray(__spreadArray([], this.state.value, true), [item.value], false) });
63652
63718
  }
63653
63719
  if (!event.ctrlKey) {
63654
- this.setState({ options: this.state.firstBranchOptions, activeTree: [], openDropdown: false });
63720
+ this.setState({
63721
+ options: this.state.firstBranchOptions,
63722
+ activeTree: [],
63723
+ buttonTarget: [],
63724
+ openDropdown: false,
63725
+ });
63655
63726
  }
63656
63727
  this.setState({ buttonMouseEvent: false });
63657
63728
  }
@@ -63665,7 +63736,12 @@ var TreeSelect = /** @class */ (function (_super) {
63665
63736
  this.setState({ value: [item.value] });
63666
63737
  }
63667
63738
  if (!event.ctrlKey) {
63668
- this.setState({ options: this.state.firstBranchOptions, activeTree: [], openDropdown: false });
63739
+ this.setState({
63740
+ options: this.state.firstBranchOptions,
63741
+ activeTree: [],
63742
+ buttonTarget: [],
63743
+ openDropdown: false,
63744
+ });
63669
63745
  }
63670
63746
  this.setState({ buttonMouseEvent: false });
63671
63747
  }
@@ -63689,6 +63765,7 @@ var TreeSelect = /** @class */ (function (_super) {
63689
63765
  options: this.state.firstBranchOptions,
63690
63766
  openDropdown: false,
63691
63767
  activeTree: [],
63768
+ buttonTarget: [],
63692
63769
  });
63693
63770
  }
63694
63771
  else {
@@ -63705,6 +63782,7 @@ var TreeSelect = /** @class */ (function (_super) {
63705
63782
  options: this.state.firstBranchOptions,
63706
63783
  openDropdown: false,
63707
63784
  activeTree: [],
63785
+ buttonTarget: [],
63708
63786
  });
63709
63787
  }
63710
63788
  }
@@ -63716,6 +63794,16 @@ var TreeSelect = /** @class */ (function (_super) {
63716
63794
  this.setState({ openDropdown: false });
63717
63795
  }
63718
63796
  }
63797
+ var element = document.querySelector('.suggestion-item--btn');
63798
+ element.focus();
63799
+ };
63800
+ TreeSelect.prototype.backButton = function () {
63801
+ var items = this.state.activeTree.pop();
63802
+ if (items != null) {
63803
+ this.setState({
63804
+ options: items,
63805
+ });
63806
+ }
63719
63807
  };
63720
63808
  TreeSelect.prototype.recursion = function (arr) {
63721
63809
  var _this = this;
@@ -63751,7 +63839,7 @@ var TreeSelect = /** @class */ (function (_super) {
63751
63839
  var selectedItem = _this.state.value.some(function (obj) {
63752
63840
  return _this.props.getId(obj) === _this.props.getId(option.value);
63753
63841
  });
63754
- return React.createElement("li", { key: i, className: "suggestion-item suggestion-item--multi-select", onClick: function (event) {
63842
+ return (React.createElement("li", { key: i, className: "suggestion-item suggestion-item--multi-select", onClick: function (event) {
63755
63843
  _this.setState({
63756
63844
  searchFieldValue: '',
63757
63845
  }),
@@ -63759,17 +63847,19 @@ var TreeSelect = /** @class */ (function (_super) {
63759
63847
  event.stopPropagation();
63760
63848
  _this.handleTree(event, option);
63761
63849
  } },
63762
- _this.props.getBorderColor
63763
- && React.createElement("div", { className: "item-border", style: { backgroundColor: _this.props.getBorderColor(option.value) } }),
63764
- React.createElement("span", { style: _this.props.getBackgroundColor
63765
- ? { backgroundColor: _this.props.getBackgroundColor(option.value),
63766
- color: (0, Label_1.getTextColor)(_this.props.getBackgroundColor(option.value)) }
63767
- : undefined, className: 'suggestion-item--bgcolor'
63768
- + (selectedItem ? ' suggestion-item--disabled' : '') }, _this.props.optionTemplate
63769
- ? _this.props.optionTemplate(option.value)
63770
- : _this.props.getLabel(option.value)),
63771
- option.children && React.createElement("span", { className: "suggestion-item__icon" },
63772
- React.createElement(Icon_1.Icon, { name: "chevron-right-thin" })));
63850
+ React.createElement("button", { className: "suggestion-item--btn" },
63851
+ _this.props.getBorderColor
63852
+ && React.createElement("div", { className: "item-border", style: { backgroundColor: _this.props.getBorderColor(option.value) } }),
63853
+ React.createElement("span", { style: _this.props.getBackgroundColor
63854
+ ? { backgroundColor: _this.props.getBackgroundColor(option.value),
63855
+ color: (0, Label_1.getTextColor)(_this.props.getBackgroundColor(option.value)) }
63856
+ : undefined, className: 'suggestion-item--bgcolor'
63857
+ + (selectedItem ? ' suggestion-item--disabled' : '') }, _this.props.optionTemplate
63858
+ ? _this.props.optionTemplate(option.value)
63859
+ : _this.props.getLabel(option.value)),
63860
+ option.children
63861
+ && React.createElement("span", { className: "suggestion-item__icon" },
63862
+ React.createElement(Icon_1.Icon, { name: "chevron-right-thin" })))));
63773
63863
  });
63774
63864
  }
63775
63865
  }
@@ -63780,26 +63870,47 @@ var TreeSelect = /** @class */ (function (_super) {
63780
63870
  });
63781
63871
  return (React.createElement("li", { key: i, className: "suggestion-item suggestion-item--multi-select", onClick: function (event) {
63782
63872
  _this.handleValue(event, item);
63783
- } }, _this.props.optionTemplate
63784
- ? _this.props.optionTemplate(item.value)
63785
- : React.createElement("span", { className: selectedItem
63786
- ? 'suggestion-item--disabled' : undefined }, _this.props.getLabel(item.value))));
63873
+ } },
63874
+ React.createElement("button", { className: "suggestion-item--btn" }, _this.props.optionTemplate
63875
+ ? _this.props.optionTemplate(item.value)
63876
+ : React.createElement("span", { className: selectedItem
63877
+ ? 'suggestion-item--disabled' : undefined }, _this.props.getLabel(item.value)))));
63787
63878
  });
63788
63879
  }
63789
63880
  else {
63790
63881
  return;
63791
63882
  }
63792
63883
  };
63793
- TreeSelect.prototype.banchButton = function () {
63884
+ TreeSelect.prototype.branchButton = function (buttonValue) {
63794
63885
  var _this = this;
63886
+ setTimeout(function () {
63887
+ var _a;
63888
+ (_a = _this.categoryButtonRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('keydown', function (e) {
63889
+ var _a;
63890
+ if (e.key === 'ArrowDown') {
63891
+ e.preventDefault();
63892
+ e.stopPropagation();
63893
+ setTimeout(function () {
63894
+ var element = document.querySelector('.suggestion-item--btn');
63895
+ element.focus();
63896
+ });
63897
+ }
63898
+ if (e.key === 'ArrowUp') {
63899
+ e.preventDefault();
63900
+ e.stopPropagation();
63901
+ (_a = _this.inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
63902
+ }
63903
+ });
63904
+ });
63795
63905
  var selectedButton = this.state.value.some(function (obj) {
63796
- return _this.props.getId(obj) === _this.props.getId(_this.state.buttonValue.value);
63906
+ return _this.props.getId(obj) === _this.props.getId(buttonValue.value);
63797
63907
  });
63798
63908
  if (!selectedButton) {
63799
- return React.createElement("button", { className: 'autocomplete__button' + (this.props.selectBranchWithChildren ? ' autocomplete__button--multi-select' : ''), onMouseOver: function () { return _this.setState({ buttonMouseEvent: true }); }, onMouseOut: function () { return _this.setState({ buttonMouseEvent: false }); }, value: this.state.buttonValue, onClick: function (event) { return _this.handleBranchValue(event, _this.state.buttonValue); } }, "Choose entire category");
63909
+ return React.createElement("button", { ref: this.categoryButtonRef, className: 'autocomplete__button' + (this.props.selectBranchWithChildren ? ' autocomplete__button--multi-select' : ''), onMouseOver: function () { return _this.setState({ buttonMouseEvent: true }); }, onMouseOut: function () { return _this.setState({ buttonMouseEvent: false }); }, onClick: function (event) { return _this.handleBranchValue(event, buttonValue); } }, "Choose entire category");
63800
63910
  }
63801
63911
  else {
63802
- return React.createElement("button", { className: 'autocomplete__button' + (this.props.selectBranchWithChildren ? ' autocomplete__button--multi-select' : '') + ' autocomplete__button--disabled', value: this.state.buttonValue }, "Category selected");
63912
+ return React.createElement("button", { className: 'autocomplete__button'
63913
+ + (this.props.selectBranchWithChildren ? ' autocomplete__button--multi-select' : '') + ' autocomplete__button--disabled' }, "Category selected");
63803
63914
  }
63804
63915
  };
63805
63916
  TreeSelect.prototype.handleDebounce = function () {
@@ -63809,15 +63920,11 @@ var TreeSelect = /** @class */ (function (_super) {
63809
63920
  if (this.state.searchFieldValue) {
63810
63921
  this.setState({
63811
63922
  loading: true,
63812
- // provera: false
63813
63923
  });
63814
63924
  this.ICancelFn = this.props.searchOptions(this.state.searchFieldValue, function (items) {
63815
- // if (items.length === 0) {
63816
- // this.setState({provera: true, loading: false})
63817
- // } else {
63925
+ var _a;
63818
63926
  _this.setState({ options: items, loading: false });
63819
- _this.popperInstance.update();
63820
- // }
63927
+ (_a = _this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
63821
63928
  });
63822
63929
  }
63823
63930
  }
@@ -63855,13 +63962,15 @@ var TreeSelect = /** @class */ (function (_super) {
63855
63962
  this.state.value.length > 0
63856
63963
  ? this.props.readOnly
63857
63964
  || React.createElement("button", { className: "tags-input__remove-value", style: { position: 'relative', bottom: '2px' }, onClick: function () { return _this.setState({ value: [] }); } },
63858
- React.createElement(Icon_1.Icon, { name: 'remove-sign' })) : null)
63965
+ React.createElement(Icon_1.Icon, { name: 'remove-sign' }))
63966
+ : null)
63859
63967
  : React.createElement("div", { className: "tags-input__tags" },
63860
63968
  this.props.readOnly
63861
63969
  || React.createElement("button", { className: "tags-input__overlay-button", ref: this.openDropdownRef, onClick: function () { return _this.setState({ openDropdown: !_this.state.openDropdown }); } }),
63862
- this.state.value.length < 1 && React.createElement("span", { className: 'tags-input__single-item'
63863
- + (this.props.readOnly ? ' tags-input__tag-item--readonly' : '') },
63864
- React.createElement("span", { className: "tags-input__placeholder" }, this.props.placeholder)),
63970
+ this.state.value.length < 1
63971
+ && React.createElement("span", { className: 'tags-input__single-item'
63972
+ + (this.props.readOnly ? ' tags-input__tag-item--readonly' : '') },
63973
+ React.createElement("span", { className: "tags-input__placeholder" }, this.props.placeholder)),
63865
63974
  this.state.value.map(function (item, i) {
63866
63975
  var Wrapper = function (_a) {
63867
63976
  var backgroundColor = _a.backgroundColor, borderColor = _a.borderColor, children = _a.children;
@@ -63891,27 +64000,25 @@ var TreeSelect = /** @class */ (function (_super) {
63891
64000
  } },
63892
64001
  React.createElement(Icon_1.Icon, { name: "search", className: "search" })),
63893
64002
  React.createElement("div", { className: 'autocomplete__filter' },
63894
- React.createElement("input", { placeholder: this.props.searchPlaceholder, type: "text", className: "autocomplete__input", ref: function (input) { return input && input.focus(); }, value: this.state.searchFieldValue, onChange: function (event) {
64003
+ React.createElement("input", { placeholder: this.props.searchPlaceholder, type: "text", className: "autocomplete__input", ref: this.inputRef, value: this.state.searchFieldValue, onChange: function (event) {
64004
+ var _a, _b;
63895
64005
  if (_this.props.kind === 'synchronous') {
63896
64006
  _this.setState({ searchFieldValue: event.target.value });
63897
- _this.popperInstance.update();
64007
+ (_a = _this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
63898
64008
  }
63899
64009
  else if (_this.props.kind === 'asynchronous') {
63900
64010
  if (_this.ICancelFn) {
63901
64011
  _this.ICancelFn();
63902
64012
  }
63903
64013
  _this.setState({ searchFieldValue: event.target.value, options: [] });
63904
- _this.popperInstance.update();
64014
+ (_b = _this.popperInstance) === null || _b === void 0 ? void 0 : _b.update();
63905
64015
  _this.debounceFn();
63906
64016
  }
63907
64017
  else {
63908
64018
  return;
63909
64019
  }
63910
- // if(!this.state.searchFieldValue) {
63911
- // this.setState({provera: false});
63912
- // }
63913
64020
  } }))),
63914
- this.state.activeTree.length > 0
64021
+ (this.state.activeTree.length > 0 && this.state.buttonValue != null)
63915
64022
  && React.createElement("div", { className: 'autocomplete__category-header' },
63916
64023
  React.createElement("div", { className: "autocomplete__icon", onClick: function () {
63917
64024
  _this.backButtonValue();
@@ -63919,16 +64026,17 @@ var TreeSelect = /** @class */ (function (_super) {
63919
64026
  } },
63920
64027
  React.createElement(Icon_1.Icon, { name: "arrow-left", className: "arrow-left" })),
63921
64028
  React.createElement("div", { className: 'autocomplete__filter' },
63922
- React.createElement("button", { className: 'autocomplete__category-title', value: this.state.buttonValue }, this.props.optionTemplate
64029
+ React.createElement("button", { className: 'autocomplete__category-title' }, this.props.optionTemplate
63923
64030
  ? this.props.optionTemplate(this.state.buttonValue.value)
63924
64031
  : this.props.getLabel(this.state.buttonValue.value)),
63925
- this.props.selectBranchWithChildren && this.banchButton())),
64032
+ this.props.selectBranchWithChildren
64033
+ && this.branchButton(this.state.buttonValue))),
63926
64034
  this.state.loading
63927
64035
  ? React.createElement("ul", { className: "suggestion-list--loader" },
63928
64036
  React.createElement(Loader_1.Loader, { overlay: true }))
63929
64037
  : this.state.searchFieldValue === ''
63930
64038
  ? this.props.getOptions
63931
- ? React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select" }, this.state.options
64039
+ ? React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select", ref: this.ref }, this.state.options
63932
64040
  .map(function (option, i) {
63933
64041
  var selectedItem = _this.state.value.some(function (obj) {
63934
64042
  return _this.props.getId(obj) === _this.props.getLabel(option.value);
@@ -63938,23 +64046,90 @@ var TreeSelect = /** @class */ (function (_super) {
63938
64046
  event.stopPropagation();
63939
64047
  _this.handleTree(event, option);
63940
64048
  } },
63941
- (_this.props.getBorderColor && !_this.props.allowMultiple) && React.createElement("div", { className: "item-border", style: { backgroundColor: _this.props.getBorderColor(option.value) } }),
63942
- React.createElement("span", { style: (_this.props.getBackgroundColor && option.value)
63943
- ? { backgroundColor: _this.props.getBackgroundColor(option.value),
63944
- color: (0, Label_1.getTextColor)(_this.props.getBackgroundColor(option.value)) }
63945
- : undefined, className: 'suggestion-item--bgcolor'
63946
- + (selectedItem ? ' suggestion-item--disabled' : '') }, _this.props.optionTemplate
63947
- ? _this.props.optionTemplate(option.value)
63948
- : _this.props.getLabel(option.value)),
63949
- option.children && React.createElement("span", { className: "suggestion-item__icon" },
63950
- React.createElement(Icon_1.Icon, { name: "chevron-right-thin" }))));
63951
- })) : null
63952
- : React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select" }, this.filteredItem(this.props.singleLevelSearch
64049
+ React.createElement("button", { className: "suggestion-item--btn ".concat(_this.props.getId(option.value)), onKeyDown: function (event) {
64050
+ if (event.key === 'Enter' && option.children) {
64051
+ _this.setState({
64052
+ buttonTarget: __spreadArray(__spreadArray([], _this.state.buttonTarget, true), [
64053
+ _this.props.getId(option.value),
64054
+ ], false),
64055
+ });
64056
+ }
64057
+ } },
64058
+ (_this.props.getBorderColor && !_this.props.allowMultiple)
64059
+ && React.createElement("div", { className: "item-border", style: {
64060
+ backgroundColor: _this.props.getBorderColor(option.value),
64061
+ } }),
64062
+ React.createElement("span", { style: (_this.props.getBackgroundColor && option.value)
64063
+ ? {
64064
+ backgroundColor: _this.props.getBackgroundColor(option.value),
64065
+ color: (0, Label_1.getTextColor)(_this.props.getBackgroundColor(option.value)),
64066
+ }
64067
+ : undefined, className: 'suggestion-item--bgcolor'
64068
+ + (selectedItem ? ' suggestion-item--disabled' : '') }, _this.props.optionTemplate
64069
+ ? _this.props.optionTemplate(option.value)
64070
+ : _this.props.getLabel(option.value)),
64071
+ option.children
64072
+ && React.createElement("span", { className: "suggestion-item__icon" },
64073
+ React.createElement(Icon_1.Icon, { name: "chevron-right-thin" })))));
64074
+ }))
64075
+ : null
64076
+ : React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select", ref: this.ref }, this.filteredItem(this.props.singleLevelSearch
63953
64077
  ? this.state.options : this.state.filterArr))))));
63954
64078
  };
63955
64079
  return TreeSelect;
63956
64080
  }(React.Component));
63957
64081
  exports.TreeSelect = TreeSelect;
64082
+ var getButtonList = function (menuRef) {
64083
+ var _a;
64084
+ var list = Array.from((_a = menuRef === null || menuRef === void 0 ? void 0 : menuRef.querySelectorAll(':scope > li')) !== null && _a !== void 0 ? _a : []);
64085
+ var buttons = [];
64086
+ if (list != null) {
64087
+ __spreadArray([], list, true).filter(function (item) {
64088
+ if (item.querySelectorAll('.suggestion-item--btn').length > 0) {
64089
+ buttons.push(item.querySelector('.suggestion-item--btn'));
64090
+ }
64091
+ });
64092
+ }
64093
+ return buttons;
64094
+ };
64095
+ var keyboardNavigation = function (e, menuRef, ref) {
64096
+ var buttons = getButtonList(menuRef);
64097
+ var currentElement = document.activeElement;
64098
+ var currentIndex = Array.prototype.indexOf.call(buttons, currentElement);
64099
+ if (document.activeElement != null && buttons.includes(document.activeElement)) {
64100
+ if ((e === null || e === void 0 ? void 0 : e.key) === 'ArrowDown') {
64101
+ nextElement(buttons, currentIndex, e);
64102
+ }
64103
+ else if ((e === null || e === void 0 ? void 0 : e.key) === 'ArrowUp') {
64104
+ prevElement(buttons, currentIndex, e, ref);
64105
+ }
64106
+ }
64107
+ };
64108
+ var nextElement = function (buttons, currentIndex, e) {
64109
+ e.preventDefault();
64110
+ e.stopPropagation();
64111
+ if (buttons[currentIndex + 1]) {
64112
+ buttons[currentIndex + 1].focus();
64113
+ }
64114
+ else {
64115
+ buttons[0].focus();
64116
+ }
64117
+ };
64118
+ var prevElement = function (buttons, currentIndex, e, ref) {
64119
+ e.preventDefault();
64120
+ e.stopPropagation();
64121
+ if (buttons[currentIndex - 1]) {
64122
+ buttons[currentIndex - 1].focus();
64123
+ }
64124
+ else if (currentIndex === 0) {
64125
+ if (ref) {
64126
+ ref();
64127
+ }
64128
+ }
64129
+ else {
64130
+ buttons[buttons.length - 1].focus();
64131
+ }
64132
+ };
63958
64133
 
63959
64134
 
63960
64135
  /***/ }),
@@ -115115,7 +115290,7 @@ var MultiSelect = /** @class */ (function (_super) {
115115
115290
  React.createElement(multiselect_1.MultiSelect, { panelClassName: classes, value: this.props.value, options: this.props.options, onChange: function (_a) {
115116
115291
  var value = _a.value;
115117
115292
  return _this.props.onChange(value);
115118
- }, display: "chip", zIndex: this.props.zIndex, filter: this.props.filter, filterBy: this.props.optionLabel, appendTo: document.body, placeholder: this.props.placeholder, optionLabel: this.props.optionLabel, emptyFilterMessage: this.props.emptyFilterMessage, filterPlaceholder: this.props.filterPlaceholder, itemTemplate: this.props.itemTemplate, selectedItemTemplate: this.props.selectedItemTemplate, maxSelectedLabels: (_a = this.props.maxSelectedLabels) !== null && _a !== void 0 ? _a : 4, selectedItemsLabel: this.props.selectedItemsLabel, ariaLabelledBy: this.htmlId + 'label', tabIndex: this.props.tabIndex ? this.props.tabIndex : '0', showClear: this.props.showClear, disabled: this.props.disabled, inputId: this.htmlId })));
115293
+ }, display: "chip", zIndex: this.props.zIndex, filter: this.props.filter, appendTo: document.body, placeholder: this.props.placeholder, optionLabel: function (option) { return _this.props.optionLabel(option); }, emptyFilterMessage: this.props.emptyFilterMessage, filterPlaceholder: this.props.filterPlaceholder, itemTemplate: this.props.itemTemplate, selectedItemTemplate: this.props.selectedItemTemplate, maxSelectedLabels: (_a = this.props.maxSelectedLabels) !== null && _a !== void 0 ? _a : 4, selectedItemsLabel: this.props.selectedItemsLabel, ariaLabelledBy: this.htmlId + 'label', tabIndex: this.props.tabIndex ? this.props.tabIndex : '0', showClear: this.props.showClear, disabled: this.props.disabled, inputId: this.htmlId })));
115119
115294
  };
115120
115295
  return MultiSelect;
115121
115296
  }(React.Component));
@@ -115678,21 +115853,25 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115678
115853
  }, {
115679
115854
  key: "filterOptions",
115680
115855
  value: function filterOptions(options) {
115856
+ var _this7 = this;
115857
+
115681
115858
  if (options) {
115682
115859
  var filterValue = this.state.filter.trim().toLocaleLowerCase(this.props.filterLocale);
115683
- var searchFields = this.props.filterBy ? this.props.filterBy.split(',') : [this.props.optionLabel || 'label'];
115684
- return _FilterUtils.default.filter(options, searchFields, filterValue, this.props.filterMatchMode, this.props.filterLocale);
115860
+ var filterOptions = options.filter(function (option) {
115861
+ return _this7.props.optionLabel(option).trim().toLowerCase().includes(filterValue);
115862
+ });
115863
+ return filterOptions;
115685
115864
  }
115686
115865
  }
115687
115866
  }, {
115688
115867
  key: "getOptionLabel",
115689
115868
  value: function getOptionLabel(option) {
115690
- return this.props.optionLabel ? _ObjectUtils.default.resolveFieldData(option, this.props.optionLabel) : option && option['label'] !== undefined ? option['label'] : option;
115869
+ return this.props.optionLabel != null ? this.props.optionLabel(option) : option && option['label'] !== undefined ? option['label'] : option;
115691
115870
  }
115692
115871
  }, {
115693
115872
  key: "getOptionValue",
115694
115873
  value: function getOptionValue(option) {
115695
- return this.props.optionValue ? _ObjectUtils.default.resolveFieldData(option, this.props.optionValue) : option && option['value'] !== undefined ? option['value'] : option;
115874
+ return this.props.optionValue != null ? this.props.optionValue(option) : option && option['value'] !== undefined ? option['value'] : option;
115696
115875
  }
115697
115876
  }, {
115698
115877
  key: "isEmpty",
@@ -115757,13 +115936,13 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115757
115936
  }, {
115758
115937
  key: "getLabelContent",
115759
115938
  value: function getLabelContent() {
115760
- var _this7 = this;
115939
+ var _this8 = this;
115761
115940
 
115762
115941
  if (this.props.selectedItemTemplate) {
115763
115942
  if (!this.isEmpty()) {
115764
115943
  if (this.props.value.length <= this.props.maxSelectedLabels) {
115765
115944
  return this.props.value.map(function (val, index) {
115766
- var item = _ObjectUtils.default.getJSXElement(_this7.props.selectedItemTemplate, val);
115945
+ var item = _ObjectUtils.default.getJSXElement(_this8.props.selectedItemTemplate, val);
115767
115946
 
115768
115947
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
115769
115948
  key: index
@@ -115778,17 +115957,17 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115778
115957
  } else {
115779
115958
  if (this.props.display === 'chip' && !this.isEmpty()) {
115780
115959
  return this.props.value.map(function (val) {
115781
- var label = _this7.getLabelByValue(val);
115960
+ var label = _this8.getLabelByValue(val);
115782
115961
 
115783
115962
  return /*#__PURE__*/_react.default.createElement("div", {
115784
115963
  className: "p-multiselect-token",
115785
115964
  key: label
115786
115965
  }, /*#__PURE__*/_react.default.createElement("span", {
115787
115966
  className: "p-multiselect-token-label"
115788
- }, label), !_this7.props.disabled && /*#__PURE__*/_react.default.createElement("span", {
115967
+ }, label), !_this8.props.disabled && /*#__PURE__*/_react.default.createElement("span", {
115789
115968
  className: "p-multiselect-token-icon pi pi-times-circle",
115790
115969
  onClick: function onClick(e) {
115791
- return _this7.removeChip(e, val);
115970
+ return _this8.removeChip(e, val);
115792
115971
  }
115793
115972
  }));
115794
115973
  });
@@ -115822,7 +116001,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115822
116001
  }, {
115823
116002
  key: "renderClearIcon",
115824
116003
  value: function renderClearIcon() {
115825
- var _this8 = this;
116004
+ var _this9 = this;
115826
116005
 
115827
116006
  var empty = this.isEmpty();
115828
116007
 
@@ -115830,7 +116009,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115830
116009
  return /*#__PURE__*/_react.default.createElement("i", {
115831
116010
  className: "p-multiselect-clear-icon pi pi-times",
115832
116011
  onClick: function onClick(e) {
115833
- return _this8.updateModel(e, null);
116012
+ return _this9.updateModel(e, null);
115834
116013
  }
115835
116014
  });
115836
116015
  }
@@ -115840,7 +116019,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115840
116019
  }, {
115841
116020
  key: "renderLabel",
115842
116021
  value: function renderLabel() {
115843
- var _this9 = this;
116022
+ var _this10 = this;
115844
116023
 
115845
116024
  var empty = this.isEmpty();
115846
116025
  var content = this.getLabelContent();
@@ -115851,7 +116030,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115851
116030
  });
115852
116031
  return /*#__PURE__*/_react.default.createElement("div", {
115853
116032
  ref: function ref(el) {
115854
- return _this9.label = el;
116033
+ return _this10.label = el;
115855
116034
  },
115856
116035
  className: "p-multiselect-label-container"
115857
116036
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -115861,19 +116040,19 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115861
116040
  }, {
115862
116041
  key: "renderHiddenSelect",
115863
116042
  value: function renderHiddenSelect() {
115864
- var _this10 = this;
116043
+ var _this11 = this;
115865
116044
 
115866
116045
  var selectedOptions = this.props.value ? this.props.value.map(function (option, index) {
115867
116046
  return /*#__PURE__*/_react.default.createElement("option", {
115868
- key: _this10.getOptionLabel(option) + '_' + index,
115869
- value: _this10.getOptionValue(option)
116047
+ key: _this11.getOptionLabel(option) + '_' + index,
116048
+ value: _this11.getOptionValue(option)
115870
116049
  });
115871
116050
  }) : null;
115872
116051
  return /*#__PURE__*/_react.default.createElement("div", {
115873
116052
  className: "p-hidden-accessible p-multiselect-hidden-select"
115874
116053
  }, /*#__PURE__*/_react.default.createElement("select", {
115875
116054
  ref: function ref(el) {
115876
- return _this10.nativeSelect = el;
116055
+ return _this11.nativeSelect = el;
115877
116056
  },
115878
116057
  required: this.props.required,
115879
116058
  name: this.props.name,
@@ -115885,7 +116064,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115885
116064
  }, {
115886
116065
  key: "render",
115887
116066
  value: function render() {
115888
- var _this11 = this;
116067
+ var _this12 = this;
115889
116068
 
115890
116069
  var className = (0, _ClassNames.classNames)('p-multiselect p-component p-inputwrapper', {
115891
116070
  'p-multiselect-chip': this.props.display === 'chip',
@@ -115907,17 +116086,17 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115907
116086
 
115908
116087
  if (items && items.length) {
115909
116088
  items = items.map(function (option, index) {
115910
- var optionLabel = _this11.getOptionLabel(option);
116089
+ var optionLabel = _this12.getOptionLabel(option);
115911
116090
 
115912
116091
  return /*#__PURE__*/_react.default.createElement(_MultiSelectItem.MultiSelectItem, {
115913
116092
  key: optionLabel + '_' + index,
115914
116093
  label: optionLabel,
115915
116094
  option: option,
115916
- template: _this11.props.itemTemplate,
115917
- selected: _this11.isSelected(option),
115918
- onClick: _this11.onOptionClick,
115919
- onKeyDown: _this11.onOptionKeyDown,
115920
- tabIndex: _this11.props.tabIndex
116095
+ template: _this12.props.itemTemplate,
116096
+ selected: _this12.isSelected(option),
116097
+ onClick: _this12.onOptionClick,
116098
+ onKeyDown: _this12.onOptionKeyDown,
116099
+ tabIndex: _this12.props.tabIndex
115921
116100
  });
115922
116101
  });
115923
116102
  } else if (hasFilter) {
@@ -115934,14 +116113,14 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115934
116113
  className: className,
115935
116114
  onClick: this.onClick,
115936
116115
  ref: function ref(el) {
115937
- return _this11.container = el;
116116
+ return _this12.container = el;
115938
116117
  },
115939
116118
  style: this.props.style
115940
116119
  }, hiddenSelect, /*#__PURE__*/_react.default.createElement("div", {
115941
116120
  className: "p-hidden-accessible"
115942
116121
  }, /*#__PURE__*/_react.default.createElement("input", {
115943
116122
  ref: function ref(el) {
115944
- return _this11.focusInput = el;
116123
+ return _this12.focusInput = el;
115945
116124
  },
115946
116125
  id: this.props.inputId,
115947
116126
  readOnly: true,
@@ -115973,7 +116152,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115973
116152
  onExited: this.onOverlayExited
115974
116153
  }, /*#__PURE__*/_react.default.createElement(_MultiSelectPanel.MultiSelectPanel, {
115975
116154
  ref: function ref(el) {
115976
- return _this11.panel = el;
116155
+ return _this12.panel = el;
115977
116156
  },
115978
116157
  header: header,
115979
116158
  appendTo: this.props.appendTo,
@@ -116036,8 +116215,8 @@ _defineProperty(MultiSelect, "propTypes", {
116036
116215
  name: _propTypes.default.string,
116037
116216
  value: _propTypes.default.any,
116038
116217
  options: _propTypes.default.array,
116039
- optionLabel: _propTypes.default.string,
116040
- optionValue: _propTypes.default.string,
116218
+ optionLabel: _propTypes.default.func,
116219
+ optionValue: _propTypes.default.func,
116041
116220
  display: _propTypes.default.string,
116042
116221
  style: _propTypes.default.object,
116043
116222
  className: _propTypes.default.string,
@@ -131500,13 +131679,13 @@ var DropdownDoc = /** @class */ (function (_super) {
131500
131679
  DropdownDoc.prototype.render = function () {
131501
131680
  return (React.createElement("section", { className: "docs-page__container" },
131502
131681
  React.createElement("h2", { className: "docs-page__h2" }, "Dropdown"),
131503
- React.createElement(Markup.ReactMarkupCodePreview, null, "\n <Dropdown\n items={[\n { label: 'Action 1', onSelect: () => 1 },\n { label: 'Action 2', onSelect: () => 1 },\n { label: 'Action 3', onSelect: () => 1 },\n ]}>\n Toogle button\n </Dropdown>\n \n "),
131682
+ React.createElement(Markup.ReactMarkupCodePreview, null, "\n <Dropdown\n items={[\n { label: 'Action 1', onSelect: () => 1 },\n { label: 'Action 2', onSelect: () => 1 },\n { label: 'Action 3', onSelect: () => 1 },\n ]}>\n Toogle button\n </Dropdown>\n\n "),
131504
131683
  React.createElement("p", { className: 'docs-page__paragraph' },
131505
131684
  "By default dropdown menu is positioned left comparing to dropdown toggle button element. For right positioned menu (second example) add prop value ",
131506
131685
  React.createElement("code", null, "align = 'right'")),
131507
131686
  React.createElement(Markup.ReactMarkup, null,
131508
131687
  React.createElement(Markup.ReactMarkupPreview, null,
131509
- React.createElement(app_typescript_1.Dropdown, { items: [
131688
+ React.createElement(app_typescript_1.Dropdown, { append: true, items: [
131510
131689
  { label: 'Action 1', onSelect: function () { return 1; } },
131511
131690
  { label: 'Action 2', onSelect: function () { return 1; } },
131512
131691
  { label: 'Action 3', onSelect: function () { return 1; } },
@@ -131541,7 +131720,7 @@ var DropdownDoc = /** @class */ (function (_super) {
131541
131720
  items: [
131542
131721
  {
131543
131722
  type: 'submenu',
131544
- label: 'Show 1',
131723
+ label: 'Show 2',
131545
131724
  icon: 'plus-sign',
131546
131725
  items: []
131547
131726
  }
@@ -131549,7 +131728,7 @@ var DropdownDoc = /** @class */ (function (_super) {
131549
131728
  },
131550
131729
  {
131551
131730
  type: 'submenu',
131552
- label: 'Show 2',
131731
+ label: 'Show 1',
131553
131732
  icon: 'plus-sign',
131554
131733
  items: [],
131555
131734
  },
@@ -131856,7 +132035,7 @@ var DropdownDoc = /** @class */ (function (_super) {
131856
132035
  {
131857
132036
  icon: 'rundown',
131858
132037
  label: 'Create new Show',
131859
- onSelect: function () { return console.log('aaa'); },
132038
+ onSelect: function () { return false; },
131860
132039
  },
131861
132040
  ],
131862
132041
  },
@@ -131897,6 +132076,52 @@ var DropdownDoc = /** @class */ (function (_super) {
131897
132076
  React.createElement(Markup.ReactMarkup, null,
131898
132077
  React.createElement(Markup.ReactMarkupPreview, null,
131899
132078
  React.createElement(app_typescript_1.Dropdown, { items: [
132079
+ {
132080
+ type: 'group',
132081
+ label: 'Create new',
132082
+ items: [
132083
+ {
132084
+ type: 'submenu',
132085
+ label: 'Rundown',
132086
+ icon: 'plus-sign',
132087
+ items: [
132088
+ {
132089
+ type: 'submenu',
132090
+ label: 'Show 1',
132091
+ icon: 'plus-sign',
132092
+ items: [
132093
+ {
132094
+ type: 'submenu',
132095
+ label: 'Show 3',
132096
+ icon: 'plus-sign',
132097
+ items: []
132098
+ }
132099
+ ],
132100
+ },
132101
+ {
132102
+ type: 'submenu',
132103
+ label: 'Show 2',
132104
+ icon: 'plus-sign',
132105
+ items: [
132106
+ {
132107
+ type: 'submenu',
132108
+ label: 'Show 4',
132109
+ icon: 'plus-sign',
132110
+ items: [
132111
+ {
132112
+ type: 'submenu',
132113
+ label: 'Show 5',
132114
+ icon: 'plus-sign',
132115
+ items: []
132116
+ }
132117
+ ],
132118
+ },
132119
+ ],
132120
+ },
132121
+ ],
132122
+ },
132123
+ ],
132124
+ },
131900
132125
  {
131901
132126
  type: 'group', label: 'actions', items: [
131902
132127
  'divider',
@@ -131934,7 +132159,7 @@ var DropdownDoc = /** @class */ (function (_super) {
131934
132159
  ]
131935
132160
  }
131936
132161
  ] }, "Submenu on the left")),
131937
- React.createElement(Markup.ReactMarkupCode, null, "\n <Dropdown\n items={[\n {\n type: 'group', label: 'actions', items: [\n 'divider',\n { label: 'Edit', icon: 'pencil', onSelect: () => 1 },\n { label: 'Copy', icon: 'copy', onSelect: () => 1 },\n { label: 'Delete', icon: 'trash', onSelect: () => 1 },\n 'divider',\n ]\n },\n {\n type: 'submenu', label: 'Second level actions', icon: 'star', items: [\n { label: 'Action 1', onSelect: () => 1 },\n { label: 'Action 2', onSelect: () => 1 },\n { label: 'Action 3', onSelect: () => 1 },\n { label: 'Action 4', onSelect: () => 1 },\n ]\n }]}>\n Multilevel dropdown\n </Dropdown>\n <Dropdown\n items={[\n {\n type: 'group', label: 'actions', items: [\n 'divider',\n { label: 'Edit', icon: 'pencil', onSelect: () => 1 },\n { label: 'Copy', icon: 'copy', onSelect: () => 1 },\n { label: 'Delete', icon: 'trash', onSelect: () => 1 },\n 'divider',\n ]\n },\n {\n type: 'submenu', label: 'Second level actions', icon: 'star', items: [\n { label: 'Action 1', onSelect: () => 1 },\n { label: 'Action 2', onSelect: () => 1 },\n { label: 'Action 3', onSelect: () => 1 },\n { label: 'Action 4', onSelect: () => 1 },\n ]\n }]}>\n Submenu on the left\n </Dropdown> \n ")),
132162
+ React.createElement(Markup.ReactMarkupCode, null, "\n <Dropdown\n items={[\n {\n type: 'group', label: 'actions', items: [\n 'divider',\n { label: 'Edit', icon: 'pencil', onSelect: () => 1 },\n { label: 'Copy', icon: 'copy', onSelect: () => 1 },\n { label: 'Delete', icon: 'trash', onSelect: () => 1 },\n 'divider',\n ]\n },\n {\n type: 'submenu', label: 'Second level actions', icon: 'star', items: [\n { label: 'Action 1', onSelect: () => 1 },\n { label: 'Action 2', onSelect: () => 1 },\n { label: 'Action 3', onSelect: () => 1 },\n { label: 'Action 4', onSelect: () => 1 },\n ]\n }]}>\n Multilevel dropdown\n </Dropdown>\n <Dropdown\n items={[\n {\n type: 'group', label: 'actions', items: [\n 'divider',\n { label: 'Edit', icon: 'pencil', onSelect: () => 1 },\n { label: 'Copy', icon: 'copy', onSelect: () => 1 },\n { label: 'Delete', icon: 'trash', onSelect: () => 1 },\n 'divider',\n ]\n },\n {\n type: 'submenu', label: 'Second level actions', icon: 'star', items: [\n { label: 'Action 1', onSelect: () => 1 },\n { label: 'Action 2', onSelect: () => 1 },\n { label: 'Action 3', onSelect: () => 1 },\n { label: 'Action 4', onSelect: () => 1 },\n ]\n }]}>\n Submenu on the left\n </Dropdown>\n ")),
131938
132163
  React.createElement("h3", { className: "docs-page__h3" }, "Navigation dropdown"),
131939
132164
  React.createElement("p", { className: 'docs-page__paragraph' }, "Example of a dropdown inside a subnavigation element."),
131940
132165
  React.createElement(Markup.ReactMarkup, null,
@@ -131945,7 +132170,7 @@ var DropdownDoc = /** @class */ (function (_super) {
131945
132170
  //align='right'
131946
132171
  , {
131947
132172
  //align='right'
131948
- header: [
132173
+ append: true, header: [
131949
132174
  {
131950
132175
  type: 'group', label: 'actions', items: [
131951
132176
  'divider',
@@ -131964,23 +132189,23 @@ var DropdownDoc = /** @class */ (function (_super) {
131964
132189
  ]
131965
132190
  }
131966
132191
  ], items: [
131967
- // {
131968
- // type: 'group', label: 'actions', items: [
131969
- // 'divider',
131970
- // { label: 'Edit', icon: 'pencil', onSelect: () => 1 },
131971
- // { label: 'Copy', icon: 'copy', onSelect: () => 1 },
131972
- // { label: 'Delete', icon: 'trash', onSelect: () => 1 },
131973
- // 'divider',
131974
- // ]
131975
- // },
131976
- // {
131977
- // type: 'submenu', label: 'Second level actions', icon: 'star', items: [
131978
- // { label: 'Action 1', onSelect: () => 1 },
131979
- // { label: 'Action 2', onSelect: () => 1 },
131980
- // { label: 'Action 3', onSelect: () => 1 },
131981
- // { label: 'Action 4', onSelect: () => 1 },
131982
- // ]
131983
- // }
132192
+ {
132193
+ type: 'group', label: 'actions', items: [
132194
+ 'divider',
132195
+ { label: 'Edit', icon: 'pencil', onSelect: function () { return 1; } },
132196
+ { label: 'Copy', icon: 'copy', onSelect: function () { return 1; } },
132197
+ { label: 'Delete', icon: 'trash', onSelect: function () { return 1; } },
132198
+ 'divider',
132199
+ ]
132200
+ },
132201
+ {
132202
+ type: 'submenu', label: 'Second level actions', icon: 'star', items: [
132203
+ { label: 'Action 1', onSelect: function () { return 1; } },
132204
+ { label: 'Action 2', onSelect: function () { return 1; } },
132205
+ { label: 'Action 3', onSelect: function () { return 1; } },
132206
+ { label: 'Action 4', onSelect: function () { return 1; } },
132207
+ ]
132208
+ }
131984
132209
  ], footer: [
131985
132210
  {
131986
132211
  type: 'submenu', label: 'Second level actions', icon: 'star', items: [
@@ -132017,7 +132242,7 @@ var DropdownDoc = /** @class */ (function (_super) {
132017
132242
  items: [
132018
132243
  {
132019
132244
  type: 'submenu',
132020
- label: 'Show 1',
132245
+ label: 'Show 3',
132021
132246
  items: []
132022
132247
  }
132023
132248
  ],
@@ -138298,14 +138523,14 @@ var MultiselectDocs = /** @class */ (function (_super) {
138298
138523
  React.createElement(Markup.ReactMarkupPreview, null,
138299
138524
  React.createElement("div", { className: 'docs-page__content-row docs-page__content-row--no-margin' },
138300
138525
  React.createElement("div", { className: 'form__row' },
138301
- React.createElement(app_typescript_2.MultiSelect, { value: this.state.value, options: ItemArr, onChange: function (e) { return _this.setState({ value: e }); }, filter: true, showSelectAll: true, zIndex: 2000, placeholder: 'Select a color', optionLabel: 'name', required: true, tabindex: 1, label: 'This is Label', info: 'This is info' })))),
138526
+ React.createElement(app_typescript_2.MultiSelect, { value: this.state.value, options: ItemArr, onChange: function (e) { return _this.setState({ value: e }); }, filter: true, showSelectAll: true, zIndex: 2000, placeholder: 'Select a color', optionLabel: function (option) { return "".concat(option.name, " :: ").concat(option.colorCode); }, required: true, tabindex: 1, label: 'This is Label', info: 'This is info' })))),
138302
138527
  React.createElement(Markup.ReactMarkupCode, null, "\n <MultiSelect\n value={this.state.value}\n options={ItemArr}\n onChange={(e: any) => this.setState({value: e.value})}\n filter\n showSelectAll\n placeholder='Select a color'\n optionLabel='name'\n required\n tabindex={1}\n label={'This is Label'}\n info={'This is info'}\n />\n ")),
138303
138528
  React.createElement("p", { className: 'docs-page__paragraph' }, "MultiSelect with custom template."),
138304
138529
  React.createElement(Markup.ReactMarkup, null,
138305
138530
  React.createElement(Markup.ReactMarkupPreview, null,
138306
138531
  React.createElement("div", { className: 'docs-page__content-row docs-page__content-row--no-margin' },
138307
138532
  React.createElement("div", { className: 'form__row' },
138308
- React.createElement(app_typescript_2.MultiSelect, { value: this.state.value2, options: ItemArr, onChange: function (e) { return _this.setState({ value2: e }); }, filter: true, showSelectAll: true, optionLabel: 'name', itemTemplate: function (option) {
138533
+ React.createElement(app_typescript_2.MultiSelect, { value: this.state.value2, options: ItemArr, optionLabel: function (option) { return "".concat(option.name, " :: ").concat(option.colorCode); }, onChange: function (e) { return _this.setState({ value2: e }); }, filter: true, showSelectAll: true, itemTemplate: function (option) {
138309
138534
  if (option) {
138310
138535
  return (React.createElement("div", { style: { display: 'flex', alignItems: 'center' } },
138311
138536
  React.createElement("div", { style: { width: 10, height: 10, marginInlineEnd: 10, backgroundColor: option.colorCode } }),
@@ -138399,37 +138624,52 @@ var options = [
138399
138624
  {
138400
138625
  value: { name: 'Sub-category1' },
138401
138626
  children: [
138402
- { value: { name: 'Item20' } }
138627
+ { value: { name: 'Item31' } },
138628
+ // {value: {name: 'Item32'}},
138629
+ // {value: {name: 'Item33'}},
138630
+ // {value: {name: 'Item34'}},
138403
138631
  ]
138404
138632
  },
138405
138633
  {
138406
138634
  value: { name: 'Sub-category2' },
138407
138635
  children: [
138408
- { value: { name: 'Item21' } }
138636
+ { value: { name: 'Item41' } },
138637
+ { value: { name: 'Item42' } },
138638
+ { value: { name: 'Item43' } }
138409
138639
  ]
138410
138640
  },
138411
138641
  {
138412
138642
  value: { name: 'Sub-category3' },
138413
138643
  children: [
138414
- { value: { name: 'Item22' } }
138644
+ { value: { name: 'Item50' } },
138645
+ { value: { name: 'Item51' } },
138646
+ { value: { name: 'Item53' } }
138415
138647
  ]
138416
138648
  },
138417
138649
  {
138418
138650
  value: { name: 'Sub-category4' },
138419
138651
  children: [
138420
- { value: { name: 'Item23' } }
138652
+ { value: { name: 'Item23' } },
138653
+ { value: { name: 'Item41' } },
138654
+ { value: { name: 'Item42' } },
138655
+ { value: { name: 'Item43' } }
138421
138656
  ]
138422
138657
  },
138423
138658
  {
138424
138659
  value: { name: 'Sub-category5' },
138425
138660
  children: [
138426
- { value: { name: 'Item24' } }
138661
+ { value: { name: 'Item24' } },
138662
+ { value: { name: 'Item41' } },
138663
+ { value: { name: 'Item42' } },
138664
+ { value: { name: 'Item43' } }
138427
138665
  ]
138428
138666
  },
138429
138667
  {
138430
138668
  value: { name: 'Sub-category6' },
138431
138669
  children: [
138432
- { value: { name: 'Item25' } }
138670
+ { value: { name: 'Item50' } },
138671
+ { value: { name: 'Item51' } },
138672
+ { value: { name: 'Item52' } }
138433
138673
  ]
138434
138674
  }
138435
138675
  ]
@@ -138440,9 +138680,9 @@ var options = [
138440
138680
  {
138441
138681
  value: { name: 'Item8' }
138442
138682
  },
138443
- {
138444
- value: { name: 'Item9' }
138445
- }
138683
+ // {
138684
+ // value: {name: 'Item9'}
138685
+ // }
138446
138686
  ]
138447
138687
  },
138448
138688
  {
@@ -138567,11 +138807,13 @@ var TreeSelectDocs = /** @class */ (function (_super) {
138567
138807
  React.createElement(Markup.ReactMarkupPreview, null,
138568
138808
  React.createElement("div", { className: 'docs-page__content-row docs-page__content-row--no-margin' },
138569
138809
  React.createElement("div", { className: 'form__row' },
138570
- React.createElement(TreeSelect_1.TreeSelect, { value: [{ name: 'Item1' }, { name: 'Item2' }], getOptions: function () { return options; }, kind: 'synchronous', getId: function (item) { return item.name; }, getLabel: function (item) { return item.name; }, getBackgroundColor: function (item) { return item.bgColor; }, selectBranchWithChildren: true, allowMultiple: true, fullWidth: true, singleLevelSearch: true, required: true, info: 'Info Message', error: 'Error Message', label: 'TreeSelect Label', searchPlaceholder: 'Search...', onChange: function (e) { return false; }, valueTemplate: function (item, Wrapper) {
138810
+ React.createElement(TreeSelect_1.TreeSelect, { value: [{ name: 'Item1' }, { name: 'Item2' }], getOptions: function () { return options; }, kind: 'synchronous', getId: function (item) { return item.name; }, getLabel: function (item) { return item.name; }, getBackgroundColor: function (item) { return item.bgColor; }, selectBranchWithChildren: true, allowMultiple: true, fullWidth: true,
138811
+ //singleLevelSearch
138812
+ required: true, info: 'Info Message', error: 'Error Message', label: 'TreeSelect Label', searchPlaceholder: 'Search...', onChange: function (e) { return false; }, valueTemplate: function (item, Wrapper) {
138571
138813
  return (React.createElement(Wrapper, { backgroundColor: item.bgColor },
138572
138814
  React.createElement("span", null, item.name)));
138573
138815
  } })))),
138574
- React.createElement(Markup.ReactMarkupCode, null, "\n <TreeSelect\n value={[{name: 'Item1'}, {name: 'Item2'}]}\n getOptions={() => options}\n kind={'synchronous'}\n getId={(item) => item.name}\n getLabel={(item) => item.name}\n getBackgroundColor={(item: any) => item.bgColor}\n selectBranchWithChildren={true}\n allowMultiple\n fullWidth\n singleLevelSearch\n required\n info={'Info Message'}\n error={'Error Message'}\n label={'TreeSelect Label'}\n searchPlaceholder='Search...'\n onChange={(e) => false}\n valueTemplate={(item, Wrapper) => {\n return (\n <Wrapper backgroundColor={item.bgColor}>\n <span>{item.name}</span>\n </Wrapper>\n );\n }} \n />\n ")),
138816
+ React.createElement(Markup.ReactMarkupCode, null, "\n <TreeSelect\n value={[{name: 'Item1'}, {name: 'Item2'}]}\n getOptions={() => options}\n kind={'synchronous'}\n getId={(item) => item.name}\n getLabel={(item) => item.name}\n getBackgroundColor={(item: any) => item.bgColor}\n selectBranchWithChildren={true}\n allowMultiple\n fullWidth\n singleLevelSearch\n required\n info={'Info Message'}\n error={'Error Message'}\n label={'TreeSelect Label'}\n searchPlaceholder='Search...'\n onChange={(e) => false}\n valueTemplate={(item, Wrapper) => {\n return (\n <Wrapper backgroundColor={item.bgColor}>\n <span>{item.name}</span>\n </Wrapper>\n );\n }}\n />\n ")),
138575
138817
  React.createElement("p", { className: 'docs-page__paragraph' }, "Asynchronous mode in TreeSelect component."),
138576
138818
  React.createElement(Markup.ReactMarkup, null,
138577
138819
  React.createElement(Markup.ReactMarkupPreview, null,
@@ -139034,7 +139276,7 @@ exports.WithSizeObserverDocs = WithSizeObserverDocs;
139034
139276
  /* 652 */
139035
139277
  /***/ (function(module, exports) {
139036
139278
 
139037
- module.exports = {"name":"superdesk-ui-framework","version":"3.0.6","license":"AGPL-3.0","repository":{"type":"git","url":"https://github.com/superdesk/superdesk-ui-framework.git"},"main":"dist/superdesk-ui.bundle.js","types":"react/index.d.ts","contributors":["Nemanja Pavlovic","Vladimir Stefanovic","Darko Tomic","Aleksandar Jelicic","Tomas Kikutis","Dragana Zivkovic"],"scripts":{"start":"webpack-dev-server --config tasks/webpack.dev.js","server":"webpack --watch --config tasks/webpack.prod.js && tsc-watch","build":"webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","lint":"eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}'","lint-fix":"tsc -p tsconfig.json --noEmit && tslint --fix -c tslint.json 'app-typescript/**/*.{ts,tsx}'","prepublishOnly":"npm run build"},"devDependencies":{"@types/chart.js":"^2.9.24","@types/classnames":"^2.2.9","@types/lodash":"^4.14.161","@types/react":"16.8.23","@types/react-beautiful-dnd":"^13.1.2","@types/react-dom":"16.8.0","@types/react-router-dom":"^5.1.2","@types/react-scrollspy":"^3.3.5","@typescript-eslint/parser":"5.14.0","angular":"^1.7.9","angular-animate":"^1.7.9","angular-route":"^1.7.9","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","classnames":"^2.2.5","clean-webpack-plugin":"^1.0.0","code-prettify":"^0.1.0","copy-webpack-plugin":"^4.6.0","css-loader":"^2.1.1","eslint":"^4.6.1","eslint-loader":"^1.9.0","eslint-plugin-angular":"^3.1.1","eslint-plugin-react":"^7.3.0","extract-text-webpack-plugin":"^3.0.2","file-loader":"^0.11.2","html-loader":"^0.5.1","html-webpack-plugin":"^2.30.1","jquery":"^3.1.1","jquery-ui":"^1.12.1","lodash":"4.17.21","node-sass":"6.0","prismjs":"^1.28.0","prop-types":"^15.6.0","react":"16.8.6","react-bootstrap":"^0.31.2","react-dom":"16.8.6","react-redux":"^5.0.6","react-router-dom":"^5.1.2","redux":"^3.7.2","redux-form":"^7.0.4","sass-loader":"^6.0.6","style-loader":"^0.18.2","superdesk-code-style":"^1.1.2","ts-loader":"^6.0.2","tslint":"^5.18.0","typescript":"4.5.2","url-loader":"^1.1.2","webpack":"^3.5.5","webpack-cli":"3.3.10","webpack-dev-server":"2.11.1","webpack-merge":"^4.2.1"},"dependencies":{"@material-ui/lab":"^4.0.0-alpha.56","@popperjs/core":"^2.4.0","@superdesk/primereact":"^5.0.2-8","@types/node":"^14.10.2","chart.js":"^2.9.3","date-fns":"2.7.0","moment":"^2.29.3","popper.js":"1.14.4","primeicons":"2.0.0","react-beautiful-dnd":"^13.0.0","react-id-generator":"^3.0.0","react-popper":"^2.2.3","react-scrollspy":"^3.4.3"}}
139279
+ module.exports = {"name":"superdesk-ui-framework","version":"3.0.7","license":"AGPL-3.0","repository":{"type":"git","url":"https://github.com/superdesk/superdesk-ui-framework.git"},"main":"dist/superdesk-ui.bundle.js","types":"react/index.d.ts","contributors":["Nemanja Pavlovic","Vladimir Stefanovic","Darko Tomic","Aleksandar Jelicic","Tomas Kikutis","Dragana Zivkovic"],"scripts":{"start":"webpack-dev-server --config tasks/webpack.dev.js","server":"webpack --watch --config tasks/webpack.prod.js && tsc-watch","build":"webpack --config tasks/webpack.prod.js && tsc","build-ui":"webpack && tsc && npm run lint","lint":"eslint --parser=@typescript-eslint/parser app && tslint -c tslint.json 'app-typescript/**/*.{ts,tsx}'","lint-fix":"tsc -p tsconfig.json --noEmit && tslint --fix -c tslint.json 'app-typescript/**/*.{ts,tsx}'","prepublishOnly":"npm run build"},"devDependencies":{"@types/chart.js":"^2.9.24","@types/classnames":"^2.2.9","@types/lodash":"^4.14.161","@types/react":"16.8.23","@types/react-beautiful-dnd":"^13.1.2","@types/react-dom":"16.8.0","@types/react-router-dom":"^5.1.2","@types/react-scrollspy":"^3.3.5","@typescript-eslint/parser":"5.14.0","angular":"^1.7.9","angular-animate":"^1.7.9","angular-route":"^1.7.9","babel-core":"^6.26.0","babel-loader":"^7.1.2","babel-plugin-transform-object-rest-spread":"^6.26.0","babel-preset-es2015":"^6.24.1","babel-preset-react":"^6.24.1","classnames":"^2.2.5","clean-webpack-plugin":"^1.0.0","code-prettify":"^0.1.0","copy-webpack-plugin":"^4.6.0","css-loader":"^2.1.1","eslint":"^4.6.1","eslint-loader":"^1.9.0","eslint-plugin-angular":"^3.1.1","eslint-plugin-react":"^7.3.0","extract-text-webpack-plugin":"^3.0.2","file-loader":"^0.11.2","html-loader":"^0.5.1","html-webpack-plugin":"^2.30.1","jquery":"^3.1.1","jquery-ui":"^1.12.1","lodash":"4.17.21","node-sass":"6.0","prismjs":"^1.28.0","prop-types":"^15.6.0","react":"16.8.6","react-bootstrap":"^0.31.2","react-dom":"16.8.6","react-redux":"^5.0.6","react-router-dom":"^5.1.2","redux":"^3.7.2","redux-form":"^7.0.4","sass-loader":"^6.0.6","style-loader":"^0.18.2","superdesk-code-style":"^1.1.2","ts-loader":"^6.0.2","tslint":"^5.18.0","typescript":"4.5.2","url-loader":"^1.1.2","webpack":"^3.5.5","webpack-cli":"3.3.10","webpack-dev-server":"2.11.1","webpack-merge":"^4.2.1"},"dependencies":{"@material-ui/lab":"^4.0.0-alpha.56","@popperjs/core":"^2.4.0","@superdesk/primereact":"^5.0.2-10","@types/node":"^14.10.2","chart.js":"^2.9.3","date-fns":"2.7.0","moment":"^2.29.3","popper.js":"1.14.4","primeicons":"2.0.0","react-beautiful-dnd":"^13.0.0","react-id-generator":"^3.0.0","react-popper":"^2.2.3","react-scrollspy":"^3.4.3"}}
139038
139280
 
139039
139281
  /***/ }),
139040
139282
  /* 653 */