superdesk-ui-framework 3.0.5 → 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.
@@ -63114,31 +63114,52 @@ var TreeSelect = /** @class */ (function (_super) {
63114
63114
  function TreeSelect(props) {
63115
63115
  var _this = _super.call(this, props) || this;
63116
63116
  _this.htmlId = (0, react_id_generator_1.default)();
63117
+ _this.inputFocus = function () {
63118
+ var _a;
63119
+ (_a = _this.inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
63120
+ };
63121
+ _this.listNavigation = function () {
63122
+ var element = document.querySelector('.suggestion-item--btn');
63123
+ element.focus();
63124
+ };
63125
+ _this.buttonFocus = function () {
63126
+ var _a;
63127
+ (_a = _this.categoryButtonRef.current) === null || _a === void 0 ? void 0 : _a.focus();
63128
+ };
63117
63129
  _this.componentDidMount = function () {
63118
63130
  _this.recursion(_this.state.options);
63119
63131
  document.addEventListener("mousedown", function (event) {
63132
+ if (!(event.target instanceof HTMLInputElement)) {
63133
+ return;
63134
+ }
63120
63135
  if ((_this.dropdownRef.current && !_this.dropdownRef.current.contains(event.target))
63121
63136
  && (_this.openDropdownRef.current && !_this.openDropdownRef.current.contains(event.target))) {
63122
63137
  _this.setState({ openDropdown: false });
63123
63138
  }
63124
63139
  });
63140
+ document.addEventListener("keydown", function (e) {
63141
+ if (_this.state.openDropdown && _this.ref.current) {
63142
+ keyboardNavigation(e, _this.ref.current, _this.categoryButtonRef.current ? _this.buttonFocus : _this.inputFocus);
63143
+ if (e.key === 'Backspace') {
63144
+ _this.backButton();
63145
+ var buttonTarget = _this.state.buttonTarget;
63146
+ var className = buttonTarget.pop();
63147
+ if (className != null) {
63148
+ var element = document.getElementsByClassName(className)[0];
63149
+ element.focus();
63150
+ }
63151
+ }
63152
+ }
63153
+ });
63125
63154
  };
63126
- _this.backButton = function () {
63127
- if (_this.state.activeTree.length > 0) {
63155
+ _this.backButtonValue = function () {
63156
+ var item = _this.state.buttonTree.pop();
63157
+ if (item != null) {
63128
63158
  _this.setState({
63129
- options: _this.state.activeTree.pop(),
63159
+ buttonValue: item,
63130
63160
  });
63131
- return;
63132
- }
63133
- else {
63134
- return false;
63135
63161
  }
63136
63162
  };
63137
- _this.backButtonValue = function () {
63138
- _this.setState({
63139
- buttonValue: _this.state.buttonTree.pop(),
63140
- });
63141
- };
63142
63163
  _this.debounceFn = (0, debounce_1.default)(_this.handleDebounce, 500);
63143
63164
  _this.state = {
63144
63165
  value: _this.props.value ? _this.props.value : [],
@@ -63148,11 +63169,11 @@ var TreeSelect = /** @class */ (function (_super) {
63148
63169
  filterArr: [],
63149
63170
  searchFieldValue: '',
63150
63171
  buttonTree: [],
63151
- buttonValue: [],
63172
+ buttonValue: null,
63152
63173
  buttonMouseEvent: false,
63153
63174
  openDropdown: false,
63154
63175
  loading: false,
63155
- // provera: false
63176
+ buttonTarget: [],
63156
63177
  };
63157
63178
  _this.removeClick = _this.removeClick.bind(_this);
63158
63179
  _this.handleMultiLevel = _this.handleMultiLevel.bind(_this);
@@ -63161,14 +63182,19 @@ var TreeSelect = /** @class */ (function (_super) {
63161
63182
  _this.backButtonValue = _this.backButtonValue.bind(_this);
63162
63183
  _this.handleTree = _this.handleTree.bind(_this);
63163
63184
  _this.filteredItem = _this.filteredItem.bind(_this);
63164
- _this.banchButton = _this.banchButton.bind(_this);
63185
+ _this.branchButton = _this.branchButton.bind(_this);
63165
63186
  _this.handleDebounce = _this.handleDebounce.bind(_this);
63166
63187
  _this.toggleMenu = _this.toggleMenu.bind(_this);
63167
63188
  _this.dropdownRef = React.createRef();
63189
+ _this.ref = React.createRef();
63190
+ _this.inputRef = React.createRef();
63191
+ _this.categoryButtonRef = React.createRef();
63168
63192
  _this.openDropdownRef = React.createRef();
63193
+ _this.popperInstance = null;
63169
63194
  return _this;
63170
63195
  }
63171
63196
  TreeSelect.prototype.componentDidUpdate = function (prevProps, prevState) {
63197
+ var _a;
63172
63198
  if (!(0, lodash_1.isEqual)(prevState.value, this.state.value)) {
63173
63199
  this.props.onChange(this.state.value);
63174
63200
  }
@@ -63182,11 +63208,13 @@ var TreeSelect = /** @class */ (function (_super) {
63182
63208
  if ((prevState.activeTree !== this.state.activeTree)
63183
63209
  || (prevState.filterArr !== this.state.filterArr)
63184
63210
  || (prevState.options !== this.state.options)) {
63185
- this.popperInstance.update();
63211
+ (_a = this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
63186
63212
  }
63187
63213
  }
63188
63214
  };
63189
63215
  TreeSelect.prototype.toggleMenu = function () {
63216
+ var _this = this;
63217
+ var _a, _b;
63190
63218
  if (this.state.openDropdown) {
63191
63219
  if (this.openDropdownRef.current && this.dropdownRef.current) {
63192
63220
  this.popperInstance = (0, core_1.createPopper)(this.openDropdownRef.current, this.dropdownRef.current, {
@@ -63201,6 +63229,30 @@ var TreeSelect = /** @class */ (function (_super) {
63201
63229
  ],
63202
63230
  });
63203
63231
  }
63232
+ (_a = this.inputRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('keydown', function (e) {
63233
+ if (e.key === 'ArrowDown') {
63234
+ e.preventDefault();
63235
+ e.stopPropagation();
63236
+ if (_this.categoryButtonRef.current) {
63237
+ _this.buttonFocus();
63238
+ }
63239
+ else {
63240
+ setTimeout(function () {
63241
+ _this.listNavigation();
63242
+ });
63243
+ }
63244
+ }
63245
+ });
63246
+ if (this.inputRef.current) {
63247
+ this.inputFocus();
63248
+ }
63249
+ else {
63250
+ var element = document.querySelector('.suggestion-item--btn');
63251
+ element.focus();
63252
+ }
63253
+ }
63254
+ else {
63255
+ (_b = this.openDropdownRef.current) === null || _b === void 0 ? void 0 : _b.focus();
63204
63256
  }
63205
63257
  };
63206
63258
  TreeSelect.prototype.removeClick = function (i) {
@@ -63220,8 +63272,12 @@ var TreeSelect = /** @class */ (function (_super) {
63220
63272
  }
63221
63273
  };
63222
63274
  TreeSelect.prototype.handleButton = function (item) {
63275
+ var buttonTreeNext = this.state.buttonTree;
63276
+ if (this.state.buttonValue != null) {
63277
+ buttonTreeNext = buttonTreeNext.concat(this.state.buttonValue);
63278
+ }
63223
63279
  this.setState({
63224
- buttonTree: __spreadArray(__spreadArray([], this.state.buttonTree, true), [this.state.buttonValue], false),
63280
+ buttonTree: buttonTreeNext,
63225
63281
  buttonValue: item,
63226
63282
  });
63227
63283
  };
@@ -63236,10 +63292,15 @@ var TreeSelect = /** @class */ (function (_super) {
63236
63292
  }
63237
63293
  if (!event.ctrlKey) {
63238
63294
  if (this.props.getOptions) {
63239
- this.setState({ options: this.state.firstBranchOptions, activeTree: [], openDropdown: false });
63295
+ this.setState({
63296
+ options: this.state.firstBranchOptions,
63297
+ activeTree: [],
63298
+ buttonTarget: [],
63299
+ openDropdown: false,
63300
+ });
63240
63301
  }
63241
63302
  else {
63242
- this.setState({ activeTree: [], openDropdown: false });
63303
+ this.setState({ activeTree: [], buttonTarget: [], openDropdown: false });
63243
63304
  }
63244
63305
  }
63245
63306
  this.setState({ buttonMouseEvent: false });
@@ -63252,7 +63313,12 @@ var TreeSelect = /** @class */ (function (_super) {
63252
63313
  this.setState({ value: [item.value] });
63253
63314
  }
63254
63315
  if (!event.ctrlKey) {
63255
- this.setState({ options: this.state.firstBranchOptions, activeTree: [], openDropdown: false });
63316
+ this.setState({
63317
+ options: this.state.firstBranchOptions,
63318
+ activeTree: [],
63319
+ buttonTarget: [],
63320
+ openDropdown: false,
63321
+ });
63256
63322
  }
63257
63323
  this.setState({ buttonMouseEvent: false });
63258
63324
  }
@@ -63268,7 +63334,12 @@ var TreeSelect = /** @class */ (function (_super) {
63268
63334
  this.setState({ value: __spreadArray(__spreadArray([], this.state.value, true), [item.value], false) });
63269
63335
  }
63270
63336
  if (!event.ctrlKey) {
63271
- this.setState({ options: this.state.firstBranchOptions, activeTree: [], openDropdown: false });
63337
+ this.setState({
63338
+ options: this.state.firstBranchOptions,
63339
+ activeTree: [],
63340
+ buttonTarget: [],
63341
+ openDropdown: false,
63342
+ });
63272
63343
  }
63273
63344
  this.setState({ buttonMouseEvent: false });
63274
63345
  }
@@ -63282,7 +63353,12 @@ var TreeSelect = /** @class */ (function (_super) {
63282
63353
  this.setState({ value: [item.value] });
63283
63354
  }
63284
63355
  if (!event.ctrlKey) {
63285
- this.setState({ options: this.state.firstBranchOptions, activeTree: [], openDropdown: false });
63356
+ this.setState({
63357
+ options: this.state.firstBranchOptions,
63358
+ activeTree: [],
63359
+ buttonTarget: [],
63360
+ openDropdown: false,
63361
+ });
63286
63362
  }
63287
63363
  this.setState({ buttonMouseEvent: false });
63288
63364
  }
@@ -63306,6 +63382,7 @@ var TreeSelect = /** @class */ (function (_super) {
63306
63382
  options: this.state.firstBranchOptions,
63307
63383
  openDropdown: false,
63308
63384
  activeTree: [],
63385
+ buttonTarget: [],
63309
63386
  });
63310
63387
  }
63311
63388
  else {
@@ -63322,6 +63399,7 @@ var TreeSelect = /** @class */ (function (_super) {
63322
63399
  options: this.state.firstBranchOptions,
63323
63400
  openDropdown: false,
63324
63401
  activeTree: [],
63402
+ buttonTarget: [],
63325
63403
  });
63326
63404
  }
63327
63405
  }
@@ -63333,6 +63411,16 @@ var TreeSelect = /** @class */ (function (_super) {
63333
63411
  this.setState({ openDropdown: false });
63334
63412
  }
63335
63413
  }
63414
+ var element = document.querySelector('.suggestion-item--btn');
63415
+ element.focus();
63416
+ };
63417
+ TreeSelect.prototype.backButton = function () {
63418
+ var items = this.state.activeTree.pop();
63419
+ if (items != null) {
63420
+ this.setState({
63421
+ options: items,
63422
+ });
63423
+ }
63336
63424
  };
63337
63425
  TreeSelect.prototype.recursion = function (arr) {
63338
63426
  var _this = this;
@@ -63368,7 +63456,7 @@ var TreeSelect = /** @class */ (function (_super) {
63368
63456
  var selectedItem = _this.state.value.some(function (obj) {
63369
63457
  return _this.props.getId(obj) === _this.props.getId(option.value);
63370
63458
  });
63371
- return React.createElement("li", { key: i, className: "suggestion-item suggestion-item--multi-select", onClick: function (event) {
63459
+ return (React.createElement("li", { key: i, className: "suggestion-item suggestion-item--multi-select", onClick: function (event) {
63372
63460
  _this.setState({
63373
63461
  searchFieldValue: '',
63374
63462
  }),
@@ -63376,17 +63464,19 @@ var TreeSelect = /** @class */ (function (_super) {
63376
63464
  event.stopPropagation();
63377
63465
  _this.handleTree(event, option);
63378
63466
  } },
63379
- _this.props.getBorderColor
63380
- && React.createElement("div", { className: "item-border", style: { backgroundColor: _this.props.getBorderColor(option.value) } }),
63381
- React.createElement("span", { style: _this.props.getBackgroundColor
63382
- ? { backgroundColor: _this.props.getBackgroundColor(option.value),
63383
- color: (0, Label_1.getTextColor)(_this.props.getBackgroundColor(option.value)) }
63384
- : undefined, className: 'suggestion-item--bgcolor'
63385
- + (selectedItem ? ' suggestion-item--disabled' : '') }, _this.props.optionTemplate
63386
- ? _this.props.optionTemplate(option.value)
63387
- : _this.props.getLabel(option.value)),
63388
- option.children && React.createElement("span", { className: "suggestion-item__icon" },
63389
- React.createElement(Icon_1.Icon, { name: "chevron-right-thin" })));
63467
+ React.createElement("button", { className: "suggestion-item--btn" },
63468
+ _this.props.getBorderColor
63469
+ && React.createElement("div", { className: "item-border", style: { backgroundColor: _this.props.getBorderColor(option.value) } }),
63470
+ React.createElement("span", { style: _this.props.getBackgroundColor
63471
+ ? { backgroundColor: _this.props.getBackgroundColor(option.value),
63472
+ color: (0, Label_1.getTextColor)(_this.props.getBackgroundColor(option.value)) }
63473
+ : undefined, className: 'suggestion-item--bgcolor'
63474
+ + (selectedItem ? ' suggestion-item--disabled' : '') }, _this.props.optionTemplate
63475
+ ? _this.props.optionTemplate(option.value)
63476
+ : _this.props.getLabel(option.value)),
63477
+ option.children
63478
+ && React.createElement("span", { className: "suggestion-item__icon" },
63479
+ React.createElement(Icon_1.Icon, { name: "chevron-right-thin" })))));
63390
63480
  });
63391
63481
  }
63392
63482
  }
@@ -63397,26 +63487,47 @@ var TreeSelect = /** @class */ (function (_super) {
63397
63487
  });
63398
63488
  return (React.createElement("li", { key: i, className: "suggestion-item suggestion-item--multi-select", onClick: function (event) {
63399
63489
  _this.handleValue(event, item);
63400
- } }, _this.props.optionTemplate
63401
- ? _this.props.optionTemplate(item.value)
63402
- : React.createElement("span", { className: selectedItem
63403
- ? 'suggestion-item--disabled' : undefined }, _this.props.getLabel(item.value))));
63490
+ } },
63491
+ React.createElement("button", { className: "suggestion-item--btn" }, _this.props.optionTemplate
63492
+ ? _this.props.optionTemplate(item.value)
63493
+ : React.createElement("span", { className: selectedItem
63494
+ ? 'suggestion-item--disabled' : undefined }, _this.props.getLabel(item.value)))));
63404
63495
  });
63405
63496
  }
63406
63497
  else {
63407
63498
  return;
63408
63499
  }
63409
63500
  };
63410
- TreeSelect.prototype.banchButton = function () {
63501
+ TreeSelect.prototype.branchButton = function (buttonValue) {
63411
63502
  var _this = this;
63503
+ setTimeout(function () {
63504
+ var _a;
63505
+ (_a = _this.categoryButtonRef.current) === null || _a === void 0 ? void 0 : _a.addEventListener('keydown', function (e) {
63506
+ var _a;
63507
+ if (e.key === 'ArrowDown') {
63508
+ e.preventDefault();
63509
+ e.stopPropagation();
63510
+ setTimeout(function () {
63511
+ var element = document.querySelector('.suggestion-item--btn');
63512
+ element.focus();
63513
+ });
63514
+ }
63515
+ if (e.key === 'ArrowUp') {
63516
+ e.preventDefault();
63517
+ e.stopPropagation();
63518
+ (_a = _this.inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
63519
+ }
63520
+ });
63521
+ });
63412
63522
  var selectedButton = this.state.value.some(function (obj) {
63413
- return _this.props.getId(obj) === _this.props.getId(_this.state.buttonValue.value);
63523
+ return _this.props.getId(obj) === _this.props.getId(buttonValue.value);
63414
63524
  });
63415
63525
  if (!selectedButton) {
63416
- 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");
63526
+ 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");
63417
63527
  }
63418
63528
  else {
63419
- return React.createElement("button", { className: 'autocomplete__button' + (this.props.selectBranchWithChildren ? ' autocomplete__button--multi-select' : '') + ' autocomplete__button--disabled', value: this.state.buttonValue }, "Category selected");
63529
+ return React.createElement("button", { className: 'autocomplete__button'
63530
+ + (this.props.selectBranchWithChildren ? ' autocomplete__button--multi-select' : '') + ' autocomplete__button--disabled' }, "Category selected");
63420
63531
  }
63421
63532
  };
63422
63533
  TreeSelect.prototype.handleDebounce = function () {
@@ -63426,15 +63537,11 @@ var TreeSelect = /** @class */ (function (_super) {
63426
63537
  if (this.state.searchFieldValue) {
63427
63538
  this.setState({
63428
63539
  loading: true,
63429
- // provera: false
63430
63540
  });
63431
63541
  this.ICancelFn = this.props.searchOptions(this.state.searchFieldValue, function (items) {
63432
- // if (items.length === 0) {
63433
- // this.setState({provera: true, loading: false})
63434
- // } else {
63542
+ var _a;
63435
63543
  _this.setState({ options: items, loading: false });
63436
- _this.popperInstance.update();
63437
- // }
63544
+ (_a = _this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
63438
63545
  });
63439
63546
  }
63440
63547
  }
@@ -63472,13 +63579,15 @@ var TreeSelect = /** @class */ (function (_super) {
63472
63579
  this.state.value.length > 0
63473
63580
  ? this.props.readOnly
63474
63581
  || React.createElement("button", { className: "tags-input__remove-value", style: { position: 'relative', bottom: '2px' }, onClick: function () { return _this.setState({ value: [] }); } },
63475
- React.createElement(Icon_1.Icon, { name: 'remove-sign' })) : null)
63582
+ React.createElement(Icon_1.Icon, { name: 'remove-sign' }))
63583
+ : null)
63476
63584
  : React.createElement("div", { className: "tags-input__tags" },
63477
63585
  this.props.readOnly
63478
63586
  || React.createElement("button", { className: "tags-input__overlay-button", ref: this.openDropdownRef, onClick: function () { return _this.setState({ openDropdown: !_this.state.openDropdown }); } }),
63479
- this.state.value.length < 1 && React.createElement("span", { className: 'tags-input__single-item'
63480
- + (this.props.readOnly ? ' tags-input__tag-item--readonly' : '') },
63481
- React.createElement("span", { className: "tags-input__placeholder" }, this.props.placeholder)),
63587
+ this.state.value.length < 1
63588
+ && React.createElement("span", { className: 'tags-input__single-item'
63589
+ + (this.props.readOnly ? ' tags-input__tag-item--readonly' : '') },
63590
+ React.createElement("span", { className: "tags-input__placeholder" }, this.props.placeholder)),
63482
63591
  this.state.value.map(function (item, i) {
63483
63592
  var Wrapper = function (_a) {
63484
63593
  var backgroundColor = _a.backgroundColor, borderColor = _a.borderColor, children = _a.children;
@@ -63508,27 +63617,25 @@ var TreeSelect = /** @class */ (function (_super) {
63508
63617
  } },
63509
63618
  React.createElement(Icon_1.Icon, { name: "search", className: "search" })),
63510
63619
  React.createElement("div", { className: 'autocomplete__filter' },
63511
- 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) {
63620
+ React.createElement("input", { placeholder: this.props.searchPlaceholder, type: "text", className: "autocomplete__input", ref: this.inputRef, value: this.state.searchFieldValue, onChange: function (event) {
63621
+ var _a, _b;
63512
63622
  if (_this.props.kind === 'synchronous') {
63513
63623
  _this.setState({ searchFieldValue: event.target.value });
63514
- _this.popperInstance.update();
63624
+ (_a = _this.popperInstance) === null || _a === void 0 ? void 0 : _a.update();
63515
63625
  }
63516
63626
  else if (_this.props.kind === 'asynchronous') {
63517
63627
  if (_this.ICancelFn) {
63518
63628
  _this.ICancelFn();
63519
63629
  }
63520
63630
  _this.setState({ searchFieldValue: event.target.value, options: [] });
63521
- _this.popperInstance.update();
63631
+ (_b = _this.popperInstance) === null || _b === void 0 ? void 0 : _b.update();
63522
63632
  _this.debounceFn();
63523
63633
  }
63524
63634
  else {
63525
63635
  return;
63526
63636
  }
63527
- // if(!this.state.searchFieldValue) {
63528
- // this.setState({provera: false});
63529
- // }
63530
63637
  } }))),
63531
- this.state.activeTree.length > 0
63638
+ (this.state.activeTree.length > 0 && this.state.buttonValue != null)
63532
63639
  && React.createElement("div", { className: 'autocomplete__category-header' },
63533
63640
  React.createElement("div", { className: "autocomplete__icon", onClick: function () {
63534
63641
  _this.backButtonValue();
@@ -63536,16 +63643,17 @@ var TreeSelect = /** @class */ (function (_super) {
63536
63643
  } },
63537
63644
  React.createElement(Icon_1.Icon, { name: "arrow-left", className: "arrow-left" })),
63538
63645
  React.createElement("div", { className: 'autocomplete__filter' },
63539
- React.createElement("button", { className: 'autocomplete__category-title', value: this.state.buttonValue }, this.props.optionTemplate
63646
+ React.createElement("button", { className: 'autocomplete__category-title' }, this.props.optionTemplate
63540
63647
  ? this.props.optionTemplate(this.state.buttonValue.value)
63541
63648
  : this.props.getLabel(this.state.buttonValue.value)),
63542
- this.props.selectBranchWithChildren && this.banchButton())),
63649
+ this.props.selectBranchWithChildren
63650
+ && this.branchButton(this.state.buttonValue))),
63543
63651
  this.state.loading
63544
63652
  ? React.createElement("ul", { className: "suggestion-list--loader" },
63545
63653
  React.createElement(Loader_1.Loader, { overlay: true }))
63546
63654
  : this.state.searchFieldValue === ''
63547
63655
  ? this.props.getOptions
63548
- ? React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select" }, this.state.options
63656
+ ? React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select", ref: this.ref }, this.state.options
63549
63657
  .map(function (option, i) {
63550
63658
  var selectedItem = _this.state.value.some(function (obj) {
63551
63659
  return _this.props.getId(obj) === _this.props.getLabel(option.value);
@@ -63555,23 +63663,90 @@ var TreeSelect = /** @class */ (function (_super) {
63555
63663
  event.stopPropagation();
63556
63664
  _this.handleTree(event, option);
63557
63665
  } },
63558
- (_this.props.getBorderColor && !_this.props.allowMultiple) && React.createElement("div", { className: "item-border", style: { backgroundColor: _this.props.getBorderColor(option.value) } }),
63559
- React.createElement("span", { style: (_this.props.getBackgroundColor && option.value)
63560
- ? { backgroundColor: _this.props.getBackgroundColor(option.value),
63561
- color: (0, Label_1.getTextColor)(_this.props.getBackgroundColor(option.value)) }
63562
- : undefined, className: 'suggestion-item--bgcolor'
63563
- + (selectedItem ? ' suggestion-item--disabled' : '') }, _this.props.optionTemplate
63564
- ? _this.props.optionTemplate(option.value)
63565
- : _this.props.getLabel(option.value)),
63566
- option.children && React.createElement("span", { className: "suggestion-item__icon" },
63567
- React.createElement(Icon_1.Icon, { name: "chevron-right-thin" }))));
63568
- })) : null
63569
- : React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select" }, this.filteredItem(this.props.singleLevelSearch
63666
+ React.createElement("button", { className: "suggestion-item--btn ".concat(_this.props.getId(option.value)), onKeyDown: function (event) {
63667
+ if (event.key === 'Enter' && option.children) {
63668
+ _this.setState({
63669
+ buttonTarget: __spreadArray(__spreadArray([], _this.state.buttonTarget, true), [
63670
+ _this.props.getId(option.value),
63671
+ ], false),
63672
+ });
63673
+ }
63674
+ } },
63675
+ (_this.props.getBorderColor && !_this.props.allowMultiple)
63676
+ && React.createElement("div", { className: "item-border", style: {
63677
+ backgroundColor: _this.props.getBorderColor(option.value),
63678
+ } }),
63679
+ React.createElement("span", { style: (_this.props.getBackgroundColor && option.value)
63680
+ ? {
63681
+ backgroundColor: _this.props.getBackgroundColor(option.value),
63682
+ color: (0, Label_1.getTextColor)(_this.props.getBackgroundColor(option.value)),
63683
+ }
63684
+ : undefined, className: 'suggestion-item--bgcolor'
63685
+ + (selectedItem ? ' suggestion-item--disabled' : '') }, _this.props.optionTemplate
63686
+ ? _this.props.optionTemplate(option.value)
63687
+ : _this.props.getLabel(option.value)),
63688
+ option.children
63689
+ && React.createElement("span", { className: "suggestion-item__icon" },
63690
+ React.createElement(Icon_1.Icon, { name: "chevron-right-thin" })))));
63691
+ }))
63692
+ : null
63693
+ : React.createElement("ul", { className: "suggestion-list suggestion-list--multi-select", ref: this.ref }, this.filteredItem(this.props.singleLevelSearch
63570
63694
  ? this.state.options : this.state.filterArr))))));
63571
63695
  };
63572
63696
  return TreeSelect;
63573
63697
  }(React.Component));
63574
63698
  exports.TreeSelect = TreeSelect;
63699
+ var getButtonList = function (menuRef) {
63700
+ var _a;
63701
+ var list = Array.from((_a = menuRef === null || menuRef === void 0 ? void 0 : menuRef.querySelectorAll(':scope > li')) !== null && _a !== void 0 ? _a : []);
63702
+ var buttons = [];
63703
+ if (list != null) {
63704
+ __spreadArray([], list, true).filter(function (item) {
63705
+ if (item.querySelectorAll('.suggestion-item--btn').length > 0) {
63706
+ buttons.push(item.querySelector('.suggestion-item--btn'));
63707
+ }
63708
+ });
63709
+ }
63710
+ return buttons;
63711
+ };
63712
+ var keyboardNavigation = function (e, menuRef, ref) {
63713
+ var buttons = getButtonList(menuRef);
63714
+ var currentElement = document.activeElement;
63715
+ var currentIndex = Array.prototype.indexOf.call(buttons, currentElement);
63716
+ if (document.activeElement != null && buttons.includes(document.activeElement)) {
63717
+ if ((e === null || e === void 0 ? void 0 : e.key) === 'ArrowDown') {
63718
+ nextElement(buttons, currentIndex, e);
63719
+ }
63720
+ else if ((e === null || e === void 0 ? void 0 : e.key) === 'ArrowUp') {
63721
+ prevElement(buttons, currentIndex, e, ref);
63722
+ }
63723
+ }
63724
+ };
63725
+ var nextElement = function (buttons, currentIndex, e) {
63726
+ e.preventDefault();
63727
+ e.stopPropagation();
63728
+ if (buttons[currentIndex + 1]) {
63729
+ buttons[currentIndex + 1].focus();
63730
+ }
63731
+ else {
63732
+ buttons[0].focus();
63733
+ }
63734
+ };
63735
+ var prevElement = function (buttons, currentIndex, e, ref) {
63736
+ e.preventDefault();
63737
+ e.stopPropagation();
63738
+ if (buttons[currentIndex - 1]) {
63739
+ buttons[currentIndex - 1].focus();
63740
+ }
63741
+ else if (currentIndex === 0) {
63742
+ if (ref) {
63743
+ ref();
63744
+ }
63745
+ }
63746
+ else {
63747
+ buttons[buttons.length - 1].focus();
63748
+ }
63749
+ };
63575
63750
 
63576
63751
 
63577
63752
  /***/ }),
@@ -102385,13 +102560,12 @@ var SideBarTabs = /** @class */ (function (_super) {
102385
102560
  this.props.onActiveTabChange(activeItem.id);
102386
102561
  }
102387
102562
  };
102388
- SideBarTabs.prototype.handleClick = function (item, event) {
102563
+ SideBarTabs.prototype.handleClick = function (item) {
102389
102564
  if (this.props.activeTab === item.id) {
102390
102565
  this.props.onActiveTabChange(null);
102391
102566
  }
102392
102567
  else {
102393
102568
  this.props.onActiveTabChange(item.id);
102394
- item.onClick(event);
102395
102569
  }
102396
102570
  };
102397
102571
  SideBarTabs.prototype.render = function () {
@@ -102403,7 +102577,7 @@ var SideBarTabs = /** @class */ (function (_super) {
102403
102577
  }
102404
102578
  else {
102405
102579
  return (React.createElement("li", { key: index, "data-sd-tooltip": item.tooltip, "data-flow": 'left' },
102406
- React.createElement("a", { role: 'button', "aria-label": item.tooltip, className: (0, classnames_1.default)('sd-sidetab-menu__btn', { 'sd-sidetab-menu__btn--active': item.id === _this.props.activeTab }), onClick: function (event) { return _this.handleClick(item, event); } },
102580
+ React.createElement("a", { role: 'button', "aria-label": item.tooltip, className: (0, classnames_1.default)('sd-sidetab-menu__btn', { 'sd-sidetab-menu__btn--active': item.id === _this.props.activeTab }), onClick: function () { return _this.handleClick(item); } },
102407
102581
  item.badgeValue != null && (React.createElement(Badge_1.Badge, { text: item['badgeValue'], type: 'primary' })),
102408
102582
  React.createElement("span", { className: 'sd-sidetab-menu__main-icon ' },
102409
102583
  React.createElement(Icon_1.Icon, { size: item['size'], name: item['icon'] })),
@@ -114377,7 +114551,7 @@ var MultiSelect = /** @class */ (function (_super) {
114377
114551
  React.createElement(multiselect_1.MultiSelect, { panelClassName: classes, value: this.props.value, options: this.props.options, onChange: function (_a) {
114378
114552
  var value = _a.value;
114379
114553
  return _this.props.onChange(value);
114380
- }, 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 })));
114554
+ }, 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 })));
114381
114555
  };
114382
114556
  return MultiSelect;
114383
114557
  }(React.Component));
@@ -114940,21 +115114,25 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
114940
115114
  }, {
114941
115115
  key: "filterOptions",
114942
115116
  value: function filterOptions(options) {
115117
+ var _this7 = this;
115118
+
114943
115119
  if (options) {
114944
115120
  var filterValue = this.state.filter.trim().toLocaleLowerCase(this.props.filterLocale);
114945
- var searchFields = this.props.filterBy ? this.props.filterBy.split(',') : [this.props.optionLabel || 'label'];
114946
- return _FilterUtils.default.filter(options, searchFields, filterValue, this.props.filterMatchMode, this.props.filterLocale);
115121
+ var filterOptions = options.filter(function (option) {
115122
+ return _this7.props.optionLabel(option).trim().toLowerCase().includes(filterValue);
115123
+ });
115124
+ return filterOptions;
114947
115125
  }
114948
115126
  }
114949
115127
  }, {
114950
115128
  key: "getOptionLabel",
114951
115129
  value: function getOptionLabel(option) {
114952
- return this.props.optionLabel ? _ObjectUtils.default.resolveFieldData(option, this.props.optionLabel) : option && option['label'] !== undefined ? option['label'] : option;
115130
+ return this.props.optionLabel != null ? this.props.optionLabel(option) : option && option['label'] !== undefined ? option['label'] : option;
114953
115131
  }
114954
115132
  }, {
114955
115133
  key: "getOptionValue",
114956
115134
  value: function getOptionValue(option) {
114957
- return this.props.optionValue ? _ObjectUtils.default.resolveFieldData(option, this.props.optionValue) : option && option['value'] !== undefined ? option['value'] : option;
115135
+ return this.props.optionValue != null ? this.props.optionValue(option) : option && option['value'] !== undefined ? option['value'] : option;
114958
115136
  }
114959
115137
  }, {
114960
115138
  key: "isEmpty",
@@ -115019,13 +115197,13 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115019
115197
  }, {
115020
115198
  key: "getLabelContent",
115021
115199
  value: function getLabelContent() {
115022
- var _this7 = this;
115200
+ var _this8 = this;
115023
115201
 
115024
115202
  if (this.props.selectedItemTemplate) {
115025
115203
  if (!this.isEmpty()) {
115026
115204
  if (this.props.value.length <= this.props.maxSelectedLabels) {
115027
115205
  return this.props.value.map(function (val, index) {
115028
- var item = _ObjectUtils.default.getJSXElement(_this7.props.selectedItemTemplate, val);
115206
+ var item = _ObjectUtils.default.getJSXElement(_this8.props.selectedItemTemplate, val);
115029
115207
 
115030
115208
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
115031
115209
  key: index
@@ -115040,17 +115218,17 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115040
115218
  } else {
115041
115219
  if (this.props.display === 'chip' && !this.isEmpty()) {
115042
115220
  return this.props.value.map(function (val) {
115043
- var label = _this7.getLabelByValue(val);
115221
+ var label = _this8.getLabelByValue(val);
115044
115222
 
115045
115223
  return /*#__PURE__*/_react.default.createElement("div", {
115046
115224
  className: "p-multiselect-token",
115047
115225
  key: label
115048
115226
  }, /*#__PURE__*/_react.default.createElement("span", {
115049
115227
  className: "p-multiselect-token-label"
115050
- }, label), !_this7.props.disabled && /*#__PURE__*/_react.default.createElement("span", {
115228
+ }, label), !_this8.props.disabled && /*#__PURE__*/_react.default.createElement("span", {
115051
115229
  className: "p-multiselect-token-icon pi pi-times-circle",
115052
115230
  onClick: function onClick(e) {
115053
- return _this7.removeChip(e, val);
115231
+ return _this8.removeChip(e, val);
115054
115232
  }
115055
115233
  }));
115056
115234
  });
@@ -115084,7 +115262,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115084
115262
  }, {
115085
115263
  key: "renderClearIcon",
115086
115264
  value: function renderClearIcon() {
115087
- var _this8 = this;
115265
+ var _this9 = this;
115088
115266
 
115089
115267
  var empty = this.isEmpty();
115090
115268
 
@@ -115092,7 +115270,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115092
115270
  return /*#__PURE__*/_react.default.createElement("i", {
115093
115271
  className: "p-multiselect-clear-icon pi pi-times",
115094
115272
  onClick: function onClick(e) {
115095
- return _this8.updateModel(e, null);
115273
+ return _this9.updateModel(e, null);
115096
115274
  }
115097
115275
  });
115098
115276
  }
@@ -115102,7 +115280,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115102
115280
  }, {
115103
115281
  key: "renderLabel",
115104
115282
  value: function renderLabel() {
115105
- var _this9 = this;
115283
+ var _this10 = this;
115106
115284
 
115107
115285
  var empty = this.isEmpty();
115108
115286
  var content = this.getLabelContent();
@@ -115113,7 +115291,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115113
115291
  });
115114
115292
  return /*#__PURE__*/_react.default.createElement("div", {
115115
115293
  ref: function ref(el) {
115116
- return _this9.label = el;
115294
+ return _this10.label = el;
115117
115295
  },
115118
115296
  className: "p-multiselect-label-container"
115119
115297
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -115123,19 +115301,19 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115123
115301
  }, {
115124
115302
  key: "renderHiddenSelect",
115125
115303
  value: function renderHiddenSelect() {
115126
- var _this10 = this;
115304
+ var _this11 = this;
115127
115305
 
115128
115306
  var selectedOptions = this.props.value ? this.props.value.map(function (option, index) {
115129
115307
  return /*#__PURE__*/_react.default.createElement("option", {
115130
- key: _this10.getOptionLabel(option) + '_' + index,
115131
- value: _this10.getOptionValue(option)
115308
+ key: _this11.getOptionLabel(option) + '_' + index,
115309
+ value: _this11.getOptionValue(option)
115132
115310
  });
115133
115311
  }) : null;
115134
115312
  return /*#__PURE__*/_react.default.createElement("div", {
115135
115313
  className: "p-hidden-accessible p-multiselect-hidden-select"
115136
115314
  }, /*#__PURE__*/_react.default.createElement("select", {
115137
115315
  ref: function ref(el) {
115138
- return _this10.nativeSelect = el;
115316
+ return _this11.nativeSelect = el;
115139
115317
  },
115140
115318
  required: this.props.required,
115141
115319
  name: this.props.name,
@@ -115147,7 +115325,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115147
115325
  }, {
115148
115326
  key: "render",
115149
115327
  value: function render() {
115150
- var _this11 = this;
115328
+ var _this12 = this;
115151
115329
 
115152
115330
  var className = (0, _ClassNames.classNames)('p-multiselect p-component p-inputwrapper', {
115153
115331
  'p-multiselect-chip': this.props.display === 'chip',
@@ -115169,17 +115347,17 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115169
115347
 
115170
115348
  if (items && items.length) {
115171
115349
  items = items.map(function (option, index) {
115172
- var optionLabel = _this11.getOptionLabel(option);
115350
+ var optionLabel = _this12.getOptionLabel(option);
115173
115351
 
115174
115352
  return /*#__PURE__*/_react.default.createElement(_MultiSelectItem.MultiSelectItem, {
115175
115353
  key: optionLabel + '_' + index,
115176
115354
  label: optionLabel,
115177
115355
  option: option,
115178
- template: _this11.props.itemTemplate,
115179
- selected: _this11.isSelected(option),
115180
- onClick: _this11.onOptionClick,
115181
- onKeyDown: _this11.onOptionKeyDown,
115182
- tabIndex: _this11.props.tabIndex
115356
+ template: _this12.props.itemTemplate,
115357
+ selected: _this12.isSelected(option),
115358
+ onClick: _this12.onOptionClick,
115359
+ onKeyDown: _this12.onOptionKeyDown,
115360
+ tabIndex: _this12.props.tabIndex
115183
115361
  });
115184
115362
  });
115185
115363
  } else if (hasFilter) {
@@ -115196,14 +115374,14 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115196
115374
  className: className,
115197
115375
  onClick: this.onClick,
115198
115376
  ref: function ref(el) {
115199
- return _this11.container = el;
115377
+ return _this12.container = el;
115200
115378
  },
115201
115379
  style: this.props.style
115202
115380
  }, hiddenSelect, /*#__PURE__*/_react.default.createElement("div", {
115203
115381
  className: "p-hidden-accessible"
115204
115382
  }, /*#__PURE__*/_react.default.createElement("input", {
115205
115383
  ref: function ref(el) {
115206
- return _this11.focusInput = el;
115384
+ return _this12.focusInput = el;
115207
115385
  },
115208
115386
  id: this.props.inputId,
115209
115387
  readOnly: true,
@@ -115235,7 +115413,7 @@ var MultiSelect = /*#__PURE__*/function (_Component) {
115235
115413
  onExited: this.onOverlayExited
115236
115414
  }, /*#__PURE__*/_react.default.createElement(_MultiSelectPanel.MultiSelectPanel, {
115237
115415
  ref: function ref(el) {
115238
- return _this11.panel = el;
115416
+ return _this12.panel = el;
115239
115417
  },
115240
115418
  header: header,
115241
115419
  appendTo: this.props.appendTo,
@@ -115298,8 +115476,8 @@ _defineProperty(MultiSelect, "propTypes", {
115298
115476
  name: _propTypes.default.string,
115299
115477
  value: _propTypes.default.any,
115300
115478
  options: _propTypes.default.array,
115301
- optionLabel: _propTypes.default.string,
115302
- optionValue: _propTypes.default.string,
115479
+ optionLabel: _propTypes.default.func,
115480
+ optionValue: _propTypes.default.func,
115303
115481
  display: _propTypes.default.string,
115304
115482
  style: _propTypes.default.object,
115305
115483
  className: _propTypes.default.string,