@progress/kendo-react-dropdowns 5.12.1 → 5.13.0-dev.202303301815

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.
@@ -51,14 +51,13 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
51
51
  skip: PropTypes.Validator<number>;
52
52
  total: PropTypes.Validator<number>;
53
53
  }>>;
54
- /** @hidden */
55
54
  onFilterChange: PropTypes.Requireable<(...args: any[]) => any>;
56
55
  onPageChange: PropTypes.Requireable<(...args: any[]) => any>;
57
56
  opened: PropTypes.Requireable<boolean>;
58
57
  disabled: PropTypes.Requireable<boolean>;
59
58
  dir: PropTypes.Requireable<string>;
60
59
  tabIndex: PropTypes.Requireable<number>;
61
- accessKey: PropTypes.Requireable<string>; /** @hidden */
60
+ accessKey: PropTypes.Requireable<string>;
62
61
  data: PropTypes.Requireable<any[]>;
63
62
  textField: PropTypes.Requireable<string>;
64
63
  className: PropTypes.Requireable<string>;
@@ -38,13 +38,12 @@ import { validatePackage, canUseDOM } from '@progress/kendo-react-common';
38
38
  import { packageMetadata } from '../package-metadata';
39
39
  import ClearButton from '../common/ClearButton';
40
40
  import { Button } from '@progress/kendo-react-buttons';
41
- import { caretAltDownIcon } from '@progress/kendo-svg-icons';
41
+ import { caretAltDownIcon, xIcon } from '@progress/kendo-svg-icons';
42
42
  import { messages, comboArrowBtnAriaLabelExpand, comboArrowBtnAriaLabelCollapse } from './../messages';
43
43
  import { provideLocalizationService } from '@progress/kendo-react-intl';
44
44
  import { ActionSheet, ActionSheetContent, ActionSheetHeader } from '@progress/kendo-react-layout';
45
+ import { MOBILE_SMALL_DEVISE, MOBILE_MEDIUM_DEVISE } from '../common/constants';
45
46
  var VALIDATION_MESSAGE = 'Please enter a valid value!';
46
- var MOBILE_SMALL_DEVISE = 500;
47
- var MOBILE_MEDIUM_DEVISE = 768;
48
47
  var sizeMap = kendoThemeMaps.sizeMap, roundedMap = kendoThemeMaps.roundedMap;
49
48
  /** @hidden */
50
49
  var ComboBoxWithoutContext = /** @class */ (function (_super) {
@@ -607,8 +606,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
607
606
  React.createElement("div", { className: "k-actionsheet-title" },
608
607
  React.createElement("div", null, adaptiveTitle)),
609
608
  React.createElement("div", { className: "k-actionsheet-actions" },
610
- React.createElement(Button, { tabIndex: 0, "aria-label": "Cancel", "aria-disabled": "false", type: "button", fillMode: "flat", onClick: this.toggleBtnClick },
611
- React.createElement("span", { className: "k-button-icon k-icon k-i-x" })))),
609
+ React.createElement(Button, { tabIndex: 0, "aria-label": "Cancel", "aria-disabled": "false", type: "button", fillMode: "flat", onClick: this.toggleBtnClick, icon: 'x', svgIcon: xIcon }))),
612
610
  React.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderMobileListFilter())),
613
611
  React.createElement(ActionSheetContent, { className: '!k-overflow-hidden' },
614
612
  React.createElement("div", { className: 'k-list-container' },
@@ -8,6 +8,7 @@ import { DropDownStateBase, InternalState } from './../common/settings';
8
8
  * @hidden
9
9
  */
10
10
  export interface DropDownListState extends DropDownStateBase {
11
+ windowWidth?: number;
11
12
  }
12
13
  /**
13
14
  * @hidden
@@ -110,6 +111,8 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
110
111
  private _valueDuringOnChange;
111
112
  private _navigated;
112
113
  private _inputId;
114
+ private observerResize?;
115
+ private get document();
113
116
  constructor(props: DropDownListProps);
114
117
  /**
115
118
  * @hidden
@@ -148,6 +151,8 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
148
151
  * @hidden
149
152
  */
150
153
  componentDidMount(): void;
154
+ /** @hidden */
155
+ componentWillUnmount(): void;
151
156
  /**
152
157
  * @hidden
153
158
  */
@@ -162,6 +167,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
162
167
  onNavigate(state: InternalState, keyCode: number): void;
163
168
  private componentRef;
164
169
  private dummySelect;
170
+ private renderAdaptiveListContainer;
165
171
  private renderListContainer;
166
172
  private renderList;
167
173
  private renderListFilter;
@@ -183,6 +189,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
183
189
  private setValidity;
184
190
  private triggerOnChange;
185
191
  private applyState;
192
+ private calculateMedia;
186
193
  }
187
194
  /**
188
195
  * Represents the PropsContext of the `DropDownList` component.
@@ -28,18 +28,20 @@ import * as React from 'react';
28
28
  import * as PropTypes from 'prop-types';
29
29
  import { classNames, Keys, getTabIndex, createPropsContext, withPropsContext, kendoThemeMaps, IconWrap, svgIconPropType, guid } from '@progress/kendo-react-common';
30
30
  import { FloatingLabel } from '@progress/kendo-react-labels';
31
- import { caretAltDownIcon } from '@progress/kendo-svg-icons';
31
+ import { caretAltDownIcon, xIcon } from '@progress/kendo-svg-icons';
32
32
  import ListContainer from '../common/ListContainer';
33
33
  import ListFilter from '../common/ListFilter';
34
34
  import ListDefaultItem from '../common/ListDefaultItem';
35
35
  import List from '../common/List';
36
36
  import DropDownBase from '../common/DropDownBase';
37
37
  import { isPresent, getItemValue, sameCharsOnly, shuffleData, matchText, areSame, getFocusedItem } from '../common/utils';
38
- import { validatePackage } from '@progress/kendo-react-common';
38
+ import { validatePackage, canUseDOM } from '@progress/kendo-react-common';
39
39
  import { packageMetadata } from '../package-metadata';
40
40
  import { Button } from '@progress/kendo-react-buttons';
41
41
  import { provideLocalizationService } from '@progress/kendo-react-intl';
42
42
  import { dropDownListArrowBtnAriaLabel, messages } from '../messages';
43
+ import { MOBILE_SMALL_DEVISE, MOBILE_MEDIUM_DEVISE } from '../common/constants';
44
+ import { ActionSheet, ActionSheetContent, ActionSheetHeader } from '@progress/kendo-react-layout';
43
45
  var VALIDATION_MESSAGE = 'Please select a value from the list!';
44
46
  var sizeMap = kendoThemeMaps.sizeMap, roundedMap = kendoThemeMaps.roundedMap;
45
47
  /**
@@ -312,6 +314,13 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
312
314
  if (_this._filterInput) {
313
315
  _this.focusElement(_this._filterInput);
314
316
  }
317
+ if (_this.props.adaptive) {
318
+ setTimeout(function () {
319
+ if (_this._filterInput) {
320
+ _this.focusElement(_this._filterInput);
321
+ }
322
+ }, 300);
323
+ }
315
324
  };
316
325
  _this.onPopupClosed = function () {
317
326
  if (_this.state.focused) {
@@ -332,6 +341,17 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
332
341
  validatePackage(packageMetadata);
333
342
  return _this;
334
343
  }
344
+ Object.defineProperty(DropDownListWithoutContext.prototype, "document", {
345
+ get: function () {
346
+ if (!canUseDOM) {
347
+ return;
348
+ }
349
+ // useful only for user actions
350
+ return (this.element && this.element.ownerDocument) || document;
351
+ },
352
+ enumerable: false,
353
+ configurable: true
354
+ });
335
355
  Object.defineProperty(DropDownListWithoutContext.prototype, "element", {
336
356
  /**
337
357
  * @hidden
@@ -461,6 +481,7 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
461
481
  this.base.scrollToVirtualItem(virtual, selectedItemIndex);
462
482
  }
463
483
  else if (opening && !virtual) {
484
+ this.onPopupOpened();
464
485
  this.base.scrollToItem(selectedItemIndex);
465
486
  }
466
487
  else if (opened && prevOpened && selectedItem_1 && selectedItemChanged && !this._navigated) {
@@ -482,8 +503,20 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
482
503
  * @hidden
483
504
  */
484
505
  DropDownListWithoutContext.prototype.componentDidMount = function () {
506
+ var _a;
507
+ this.observerResize = canUseDOM && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this));
485
508
  this.base.didMount();
486
509
  this.setValidity();
510
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
511
+ this.observerResize.observe(this.document.body);
512
+ }
513
+ };
514
+ /** @hidden */
515
+ DropDownListWithoutContext.prototype.componentWillUnmount = function () {
516
+ var _a;
517
+ if (((_a = this.document) === null || _a === void 0 ? void 0 : _a.body) && this.observerResize) {
518
+ this.observerResize.disconnect();
519
+ }
487
520
  };
488
521
  /**
489
522
  * @hidden
@@ -492,48 +525,52 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
492
525
  var _a;
493
526
  var _this = this;
494
527
  var btnAriaLabel = provideLocalizationService(this).toLanguageString(dropDownListArrowBtnAriaLabel, messages[dropDownListArrowBtnAriaLabel]);
495
- var _b = this.props, style = _b.style, className = _b.className, label = _b.label, dir = _b.dir, virtual = _b.virtual, size = _b.size, rounded = _b.rounded, fillMode = _b.fillMode;
528
+ var _b = this.props, style = _b.style, className = _b.className, label = _b.label, dir = _b.dir, virtual = _b.virtual, size = _b.size, rounded = _b.rounded, fillMode = _b.fillMode, adaptive = _b.adaptive;
529
+ var _c = this.state.windowWidth, windowWidth = _c === void 0 ? 0 : _c;
496
530
  var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
497
531
  var value = this.value;
498
532
  var text = getItemValue(value, this.props.textField);
499
533
  var isValid = !this.validityStyles || this.validity.valid;
500
534
  var base = this.base;
501
535
  var vs = base.vs;
536
+ var renderAdaptive = windowWidth <= MOBILE_MEDIUM_DEVISE && adaptive;
502
537
  vs.enabled = virtual !== undefined;
503
538
  if (virtual !== undefined) {
504
539
  base.vs.skip = virtual.skip;
505
540
  base.vs.total = virtual.total;
506
541
  base.vs.pageSize = virtual.pageSize;
507
542
  }
508
- var _c = this.props, dataItemKey = _c.dataItemKey, _d = _c.data, data = _d === void 0 ? [] : _d, disabled = _c.disabled, tabIndex = _c.tabIndex, loading = _c.loading, iconClassName = _c.iconClassName, valueRender = _c.valueRender;
543
+ var _d = this.props, dataItemKey = _d.dataItemKey, _e = _d.data, data = _e === void 0 ? [] : _e, disabled = _d.disabled, tabIndex = _d.tabIndex, loading = _d.loading, iconClassName = _d.iconClassName, valueRender = _d.valueRender;
509
544
  var focused = this.state.focused;
510
545
  var selectedIndex = data.findIndex(function (i) { return areSame(i, value, dataItemKey); });
511
546
  var valueDefaultRendering = (React.createElement("span", { id: this._inputId, className: "k-input-inner" },
512
547
  React.createElement("span", { className: "k-input-value-text" }, text)));
513
548
  var valueElement = valueRender !== undefined ?
514
549
  valueRender.call(undefined, valueDefaultRendering, value) : valueDefaultRendering;
515
- var dropdownlist = (React.createElement("span", { ref: this.componentRef, className: classNames('k-dropdownlist k-picker', className, (_a = {},
516
- _a["k-picker-".concat(sizeMap[size] || size)] = size,
517
- _a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded,
518
- _a["k-picker-".concat(fillMode)] = fillMode,
519
- _a['k-focus'] = focused,
520
- _a['k-disabled'] = disabled,
521
- _a['k-invalid'] = !isValid,
522
- _a['k-loading'] = loading,
523
- _a['k-required'] = this.required,
524
- _a)), style: !label
525
- ? style
526
- : __assign(__assign({}, style), { width: undefined }), dir: dir, onMouseDown: opened ? function (event) {
527
- if (event.target.nodeName !== 'INPUT') {
528
- _this.focusElement(_this.base.wrapper);
529
- event.preventDefault();
530
- }
531
- } : undefined, onFocus: this.handleFocus, onBlur: this.handleBlur, tabIndex: getTabIndex(tabIndex, disabled), accessKey: this.props.accessKey, onKeyDown: this.handleKeyDown, onKeyPress: this.handleKeyPress, onClick: disabled ? undefined : this.handleWrapperClick, role: 'combobox', "aria-required": this.required, "aria-disabled": disabled || undefined, "aria-haspopup": 'listbox', "aria-expanded": opened || false, "aria-owns": this.base.listBoxId, "aria-activedescendant": opened ? ('option-' + this.base.guid + '-' + (selectedIndex + (virtual ? virtual.skip : 0))) : undefined, "aria-label": this.props.ariaLabel || this.props.label, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy || this._inputId, id: this.props.id, title: this.props.title },
532
- valueElement,
533
- loading && React.createElement(IconWrap, { className: "k-input-loading-icon", name: 'loading' }),
534
- React.createElement(Button, { tabIndex: -1, type: "button", "aria-label": btnAriaLabel, "aria-hidden": true, size: size, fillMode: fillMode, iconClass: iconClassName, className: "k-input-button", rounded: null, themeColor: 'base', icon: !iconClassName ? 'caret-alt-down' : undefined, svgIcon: !iconClassName ? caretAltDownIcon : this.props.svgIcon, onMouseDown: function (e) { return _this.state.focused && e.preventDefault(); } }),
535
- this.dummySelect(value),
536
- this.renderListContainer()));
550
+ var dropdownlist = (React.createElement(React.Fragment, null,
551
+ React.createElement("span", { ref: this.componentRef, className: classNames('k-dropdownlist k-picker', className, (_a = {},
552
+ _a["k-picker-".concat(sizeMap[size] || size)] = size,
553
+ _a["k-rounded-".concat(roundedMap[rounded] || rounded)] = rounded,
554
+ _a["k-picker-".concat(fillMode)] = fillMode,
555
+ _a['k-focus'] = focused,
556
+ _a['k-disabled'] = disabled,
557
+ _a['k-invalid'] = !isValid,
558
+ _a['k-loading'] = loading,
559
+ _a['k-required'] = this.required,
560
+ _a)), style: !label
561
+ ? style
562
+ : __assign(__assign({}, style), { width: undefined }), dir: dir, onMouseDown: opened ? function (event) {
563
+ if (event.target.nodeName !== 'INPUT') {
564
+ _this.focusElement(_this.base.wrapper);
565
+ event.preventDefault();
566
+ }
567
+ } : undefined, onFocus: this.handleFocus, onBlur: this.handleBlur, tabIndex: getTabIndex(tabIndex, disabled), accessKey: this.props.accessKey, onKeyDown: this.handleKeyDown, onKeyPress: this.handleKeyPress, onClick: disabled ? undefined : this.handleWrapperClick, role: 'combobox', "aria-required": this.required, "aria-disabled": disabled || undefined, "aria-haspopup": 'listbox', "aria-expanded": opened || false, "aria-owns": this.base.listBoxId, "aria-activedescendant": opened ? ('option-' + this.base.guid + '-' + (selectedIndex + (virtual ? virtual.skip : 0))) : undefined, "aria-label": this.props.ariaLabel || this.props.label, "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy || this._inputId, id: this.props.id, title: this.props.title },
568
+ valueElement,
569
+ loading && React.createElement(IconWrap, { className: "k-input-loading-icon", name: 'loading' }),
570
+ React.createElement(Button, { tabIndex: -1, type: "button", "aria-label": btnAriaLabel, "aria-hidden": true, size: size, fillMode: fillMode, iconClass: iconClassName, className: "k-input-button", rounded: null, themeColor: 'base', icon: !iconClassName ? 'caret-alt-down' : undefined, svgIcon: !iconClassName ? caretAltDownIcon : this.props.svgIcon, onMouseDown: function (e) { return _this.state.focused && e.preventDefault(); } }),
571
+ this.dummySelect(value),
572
+ !renderAdaptive && this.renderListContainer()),
573
+ renderAdaptive && this.renderAdaptiveListContainer()));
537
574
  return label ? (React.createElement(FloatingLabel, { label: label, editorValue: text, editorValid: isValid, editorDisabled: this.props.disabled, style: { width: style ? style.width : undefined }, children: dropdownlist })) : dropdownlist;
538
575
  };
539
576
  /**
@@ -555,6 +592,39 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
555
592
  }
556
593
  this.applyState(state);
557
594
  };
595
+ DropDownListWithoutContext.prototype.renderAdaptiveListContainer = function () {
596
+ var _a;
597
+ var _this = this;
598
+ var _b = this.state.windowWidth, windowWidth = _b === void 0 ? 0 : _b;
599
+ var _c = this.props, header = _c.header, footer = _c.footer, size = _c.size, adaptiveTitle = _c.adaptiveTitle;
600
+ var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
601
+ var actionSheetProps = {
602
+ navigatable: false,
603
+ navigatableElements: [],
604
+ expand: opened,
605
+ animation: true,
606
+ onClose: function (event) { return _this.handleWrapperClick(event); },
607
+ animationStyles: windowWidth <= MOBILE_SMALL_DEVISE ? { top: 0, width: '100%', height: '100%' } : undefined,
608
+ className: windowWidth <= MOBILE_SMALL_DEVISE
609
+ ? 'k-adaptive-actionsheet k-actionsheet-fullscreen'
610
+ : 'k-adaptive-actionsheet k-actionsheet-bottom'
611
+ };
612
+ return (React.createElement(React.Fragment, null,
613
+ React.createElement(ActionSheet, __assign({}, actionSheetProps),
614
+ React.createElement(ActionSheetHeader, { className: 'k-text-center' },
615
+ React.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" },
616
+ React.createElement("div", { className: "k-actionsheet-title" },
617
+ React.createElement("div", null, adaptiveTitle)),
618
+ React.createElement("div", { className: "k-actionsheet-actions" },
619
+ React.createElement(Button, { tabIndex: 0, "aria-label": "Cancel", "aria-disabled": "false", type: "button", fillMode: "flat", onClick: this.handleWrapperClick, icon: 'x', svgIcon: xIcon }))),
620
+ React.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderListFilter())),
621
+ React.createElement(ActionSheetContent, { className: '!k-overflow-hidden' },
622
+ header && React.createElement("div", { className: "k-list-header" }, header),
623
+ React.createElement("div", { className: classNames('k-list', (_a = {}, _a["k-list-".concat(sizeMap[size] || size)] = size, _a['k-virtual-list'] = this.base.vs.enabled, _a)) },
624
+ this.renderDefaultItem(),
625
+ this.renderList()),
626
+ footer && React.createElement("div", { className: "k-list-footer" }, footer)))));
627
+ };
558
628
  DropDownListWithoutContext.prototype.focusedIndex = function () {
559
629
  var filterText = isPresent(this.props.filter) ? this.props.filter : this.state.text;
560
630
  var _a = this.props, _b = _a.data, data = _b === void 0 ? [] : _b, _c = _a.virtual, virtual = _c === void 0 ? { skip: 0 } : _c, dataItemKey = _a.dataItemKey, textField = _a.textField, focusedItemIndex = _a.focusedItemIndex;
@@ -589,6 +659,14 @@ var DropDownListWithoutContext = /** @class */ (function (_super) {
589
659
  this.base.applyState(state);
590
660
  this._valueDuringOnChange = undefined;
591
661
  };
662
+ DropDownListWithoutContext.prototype.calculateMedia = function (entries) {
663
+ for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
664
+ var entry = entries_1[_i];
665
+ this.setState({ windowWidth: entry.target.clientWidth });
666
+ }
667
+ ;
668
+ };
669
+ ;
592
670
  DropDownListWithoutContext.displayName = 'DropDownList';
593
671
  /**
594
672
  * @hidden
@@ -289,4 +289,12 @@ export interface DropDownListProps extends FormComponentProps {
289
289
  * @default `solid`
290
290
  */
291
291
  fillMode?: null | 'solid' | 'flat' | 'outline';
292
+ /**
293
+ * Providing different rendering of the popup element based on the screen dimensions.
294
+ */
295
+ adaptive?: boolean;
296
+ /**
297
+ * Specifies the text that is rendered as title in the adaptive popup.
298
+ */
299
+ adaptiveTitle?: string;
292
300
  }
@@ -0,0 +1,4 @@
1
+ /** @hidden */
2
+ export declare const MOBILE_SMALL_DEVISE: number;
3
+ /** @hidden */
4
+ export declare const MOBILE_MEDIUM_DEVISE: number;
@@ -0,0 +1,4 @@
1
+ /** @hidden */
2
+ export var MOBILE_SMALL_DEVISE = 500;
3
+ /** @hidden */
4
+ export var MOBILE_MEDIUM_DEVISE = 768;
package/dist/es/main.d.ts CHANGED
@@ -1,19 +1,25 @@
1
1
  import { FormComponentValidity } from '@progress/kendo-react-common';
2
- import { DropDownList, DropDownListHandle, DropDownListPropsContext } from './DropDownList/DropDownList';
2
+ import { DropDownList, DropDownListHandle, DropDownListPropsContext, DropDownListWithoutContext } from './DropDownList/DropDownList';
3
3
  import { DropDownListProps, DropDownListFilterChangeEvent, DropDownListChangeEvent, DropDownListOpenEvent, DropDownListCloseEvent, DropDownListFocusEvent, DropDownListBlurEvent, DropDownListPageChangeEvent } from './DropDownList/DropDownListProps';
4
4
  import { Page, VirtualizationSettings, DropDownsPopupSettings, Suggestion } from './common/settings';
5
- import { ListItemProps } from './common/ListItem';
6
- import { ComboBox, ComboBoxPropsContext, ComboBoxHandle } from './ComboBox/ComboBox';
5
+ import ListItem, { ListItemProps } from './common/ListItem';
6
+ import List from './common/List';
7
+ import SearchBar from './common/SearchBar';
8
+ import ListContainer from './common/ListContainer';
9
+ import ListFilter from './common/ListFilter';
10
+ import { messages as dropdownsMessages, nodata } from './messages/index';
11
+ import { scrollToItem } from './common/utils';
12
+ import { ComboBox, ComboBoxPropsContext, ComboBoxHandle, ComboBoxWithoutContext } from './ComboBox/ComboBox';
7
13
  import { ComboBoxProps, ComboBoxFilterChangeEvent, ComboBoxChangeEvent, ComboBoxOpenEvent, ComboBoxCloseEvent, ComboBoxFocusEvent, ComboBoxBlurEvent, ComboBoxPageChangeEvent } from './ComboBox/ComboBoxProps';
8
- import { AutoComplete, AutoCompleteHandle, AutoCompletePropsContext } from './AutoComplete/AutoComplete';
14
+ import { AutoComplete, AutoCompleteHandle, AutoCompletePropsContext, AutoCompleteWithoutContext } from './AutoComplete/AutoComplete';
9
15
  import { AutoCompleteProps, AutoCompleteChangeEvent, AutoCompleteOpenEvent, AutoCompleteCloseEvent, AutoCompleteFocusEvent, AutoCompleteBlurEvent } from './AutoComplete/AutoCompleteProps';
10
- import { MultiSelect, MultiSelectHandle, MultiSelectPropsContext } from './MultiSelect/MultiSelect';
16
+ import { MultiSelect, MultiSelectHandle, MultiSelectPropsContext, MultiSelectWithoutContext } from './MultiSelect/MultiSelect';
11
17
  import { MultiSelectProps, MultiSelectChangeEvent, MultiSelectPageChangeEvent, MultiSelectFilterChangeEvent, MultiSelectOpenEvent, MultiSelectCloseEvent, MultiSelectFocusEvent, MultiSelectBlurEvent } from './MultiSelect/MultiSelectProps';
12
- import { TagData as MultiSelectTagData, TagData } from './MultiSelect/TagList';
18
+ import TagList, { TagData as MultiSelectTagData, TagData } from './MultiSelect/TagList';
13
19
  import { MultiColumnComboBox, MultiColumnComboBoxPropsContext, MultiColumnComboBoxProps, MultiColumnComboBoxHandle, MultiColumnComboBoxColumn, MultiColumnComboBoxChangeEvent } from './MultiColumnComboBox/MultiColumnComboBox';
14
20
  import { DropDownTree, DropDownTreePropsContext } from './DropDownTree/DropDownTree';
15
21
  export * from './DropDownTree/DropDownTreeProps';
16
22
  import { MultiSelectTree, MultiSelectTreePropsContext } from './MultiSelectTree/MultiSelectTree';
17
23
  export * from './MultiSelectTree/MultiSelectTreeProps';
18
24
  export * from './MultiSelectTree/utils';
19
- export { AutoComplete, AutoCompleteHandle, AutoCompleteProps, AutoCompletePropsContext, AutoCompleteChangeEvent, AutoCompleteOpenEvent, AutoCompleteCloseEvent, AutoCompleteFocusEvent, AutoCompleteBlurEvent, DropDownList, DropDownListHandle, DropDownListProps, DropDownListPropsContext, DropDownListFilterChangeEvent, DropDownListChangeEvent, DropDownListOpenEvent, DropDownListCloseEvent, DropDownListFocusEvent, DropDownListBlurEvent, DropDownListPageChangeEvent, Page, VirtualizationSettings, DropDownsPopupSettings, ListItemProps, Suggestion, ComboBox, ComboBoxHandle, ComboBoxProps, ComboBoxPropsContext, ComboBoxFilterChangeEvent, ComboBoxChangeEvent, ComboBoxOpenEvent, ComboBoxCloseEvent, ComboBoxFocusEvent, ComboBoxBlurEvent, ComboBoxPageChangeEvent, MultiSelect, MultiSelectHandle, MultiSelectProps, MultiSelectPropsContext, MultiSelectChangeEvent, MultiSelectPageChangeEvent, MultiSelectFilterChangeEvent, MultiSelectOpenEvent, MultiSelectCloseEvent, MultiSelectFocusEvent, MultiSelectBlurEvent, MultiSelectTagData, FormComponentValidity, MultiColumnComboBox, MultiColumnComboBoxColumn, MultiColumnComboBoxProps, MultiColumnComboBoxPropsContext, MultiColumnComboBoxHandle, MultiColumnComboBoxChangeEvent, DropDownTree, DropDownTreePropsContext, MultiSelectTree, MultiSelectTreePropsContext, TagData };
25
+ export { AutoComplete, AutoCompleteHandle, AutoCompleteProps, AutoCompletePropsContext, AutoCompleteWithoutContext, AutoCompleteChangeEvent, AutoCompleteOpenEvent, AutoCompleteCloseEvent, AutoCompleteFocusEvent, AutoCompleteBlurEvent, DropDownList, DropDownListHandle, DropDownListProps, DropDownListPropsContext, DropDownListWithoutContext, DropDownListFilterChangeEvent, DropDownListChangeEvent, DropDownListOpenEvent, DropDownListCloseEvent, DropDownListFocusEvent, DropDownListBlurEvent, DropDownListPageChangeEvent, Page, VirtualizationSettings, DropDownsPopupSettings, ListItemProps, Suggestion, ComboBox, ComboBoxHandle, ComboBoxProps, ComboBoxPropsContext, ComboBoxWithoutContext, ComboBoxFilterChangeEvent, ComboBoxChangeEvent, ComboBoxOpenEvent, ComboBoxCloseEvent, ComboBoxFocusEvent, ComboBoxBlurEvent, ComboBoxPageChangeEvent, MultiSelect, MultiSelectHandle, MultiSelectProps, MultiSelectPropsContext, MultiSelectWithoutContext, MultiSelectChangeEvent, MultiSelectPageChangeEvent, MultiSelectFilterChangeEvent, MultiSelectOpenEvent, MultiSelectCloseEvent, MultiSelectFocusEvent, MultiSelectBlurEvent, MultiSelectTagData, FormComponentValidity, MultiColumnComboBox, MultiColumnComboBoxColumn, MultiColumnComboBoxProps, MultiColumnComboBoxPropsContext, MultiColumnComboBoxHandle, MultiColumnComboBoxChangeEvent, DropDownTree, DropDownTreePropsContext, MultiSelectTree, MultiSelectTreePropsContext, TagData, TagList, SearchBar, List, ListItem, ListContainer, ListFilter, dropdownsMessages, nodata, scrollToItem };
package/dist/es/main.js CHANGED
@@ -1,11 +1,19 @@
1
- import { DropDownList, DropDownListPropsContext } from './DropDownList/DropDownList';
2
- import { ComboBox, ComboBoxPropsContext } from './ComboBox/ComboBox';
3
- import { AutoComplete, AutoCompletePropsContext } from './AutoComplete/AutoComplete';
4
- import { MultiSelect, MultiSelectPropsContext } from './MultiSelect/MultiSelect';
1
+ import { DropDownList, DropDownListPropsContext, DropDownListWithoutContext } from './DropDownList/DropDownList';
2
+ import ListItem from './common/ListItem';
3
+ import List from './common/List';
4
+ import SearchBar from './common/SearchBar';
5
+ import ListContainer from './common/ListContainer';
6
+ import ListFilter from './common/ListFilter';
7
+ import { messages as dropdownsMessages, nodata } from './messages/index';
8
+ import { scrollToItem } from './common/utils';
9
+ import { ComboBox, ComboBoxPropsContext, ComboBoxWithoutContext } from './ComboBox/ComboBox';
10
+ import { AutoComplete, AutoCompletePropsContext, AutoCompleteWithoutContext } from './AutoComplete/AutoComplete';
11
+ import { MultiSelect, MultiSelectPropsContext, MultiSelectWithoutContext } from './MultiSelect/MultiSelect';
12
+ import TagList from './MultiSelect/TagList';
5
13
  import { MultiColumnComboBox, MultiColumnComboBoxPropsContext } from './MultiColumnComboBox/MultiColumnComboBox';
6
14
  import { DropDownTree, DropDownTreePropsContext } from './DropDownTree/DropDownTree';
7
15
  export * from './DropDownTree/DropDownTreeProps';
8
16
  import { MultiSelectTree, MultiSelectTreePropsContext } from './MultiSelectTree/MultiSelectTree';
9
17
  export * from './MultiSelectTree/MultiSelectTreeProps';
10
18
  export * from './MultiSelectTree/utils';
11
- export { AutoComplete, AutoCompletePropsContext, DropDownList, DropDownListPropsContext, ComboBox, ComboBoxPropsContext, MultiSelect, MultiSelectPropsContext, MultiColumnComboBox, MultiColumnComboBoxPropsContext, DropDownTree, DropDownTreePropsContext, MultiSelectTree, MultiSelectTreePropsContext };
19
+ export { AutoComplete, AutoCompletePropsContext, AutoCompleteWithoutContext, DropDownList, DropDownListPropsContext, DropDownListWithoutContext, ComboBox, ComboBoxPropsContext, ComboBoxWithoutContext, MultiSelect, MultiSelectPropsContext, MultiSelectWithoutContext, MultiColumnComboBox, MultiColumnComboBoxPropsContext, DropDownTree, DropDownTreePropsContext, MultiSelectTree, MultiSelectTreePropsContext, TagList, SearchBar, List, ListItem, ListContainer, ListFilter, dropdownsMessages, nodata, scrollToItem };
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-dropdowns',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1680171876,
8
+ publishDate: 1680198554,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
11
  };
@@ -51,14 +51,13 @@ export declare class ComboBoxWithoutContext extends React.Component<ComboBoxProp
51
51
  skip: PropTypes.Validator<number>;
52
52
  total: PropTypes.Validator<number>;
53
53
  }>>;
54
- /** @hidden */
55
54
  onFilterChange: PropTypes.Requireable<(...args: any[]) => any>;
56
55
  onPageChange: PropTypes.Requireable<(...args: any[]) => any>;
57
56
  opened: PropTypes.Requireable<boolean>;
58
57
  disabled: PropTypes.Requireable<boolean>;
59
58
  dir: PropTypes.Requireable<string>;
60
59
  tabIndex: PropTypes.Requireable<number>;
61
- accessKey: PropTypes.Requireable<string>; /** @hidden */
60
+ accessKey: PropTypes.Requireable<string>;
62
61
  data: PropTypes.Requireable<any[]>;
63
62
  textField: PropTypes.Requireable<string>;
64
63
  className: PropTypes.Requireable<string>;
@@ -45,9 +45,8 @@ var kendo_svg_icons_1 = require("@progress/kendo-svg-icons");
45
45
  var messages_1 = require("./../messages");
46
46
  var kendo_react_intl_1 = require("@progress/kendo-react-intl");
47
47
  var kendo_react_layout_1 = require("@progress/kendo-react-layout");
48
+ var constants_1 = require("../common/constants");
48
49
  var VALIDATION_MESSAGE = 'Please enter a valid value!';
49
- var MOBILE_SMALL_DEVISE = 500;
50
- var MOBILE_MEDIUM_DEVISE = 768;
51
50
  var sizeMap = kendo_react_common_1.kendoThemeMaps.sizeMap, roundedMap = kendo_react_common_1.kendoThemeMaps.roundedMap;
52
51
  /** @hidden */
53
52
  var ComboBoxWithoutContext = /** @class */ (function (_super) {
@@ -290,7 +289,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
290
289
  * The mobile mode of the ComboBox.
291
290
  */
292
291
  get: function () {
293
- var isAdaptive = this.state.windowWidth && this.state.windowWidth <= MOBILE_MEDIUM_DEVISE && this.props.adaptive;
292
+ var isAdaptive = this.state.windowWidth && this.state.windowWidth <= constants_1.MOBILE_MEDIUM_DEVISE && this.props.adaptive;
294
293
  return !!isAdaptive;
295
294
  },
296
295
  enumerable: false,
@@ -445,7 +444,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
445
444
  var base = this.base;
446
445
  var vs = base.vs;
447
446
  var id = this.props.id || this._inputId;
448
- var renderAdaptive = windowWidth <= MOBILE_MEDIUM_DEVISE && adaptive;
447
+ var renderAdaptive = windowWidth <= constants_1.MOBILE_MEDIUM_DEVISE && adaptive;
449
448
  vs.enabled = virtual !== undefined;
450
449
  if (virtual !== undefined) {
451
450
  vs.skip = virtual.skip;
@@ -535,7 +534,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
535
534
  var _b = this.props, _c = _b.data, data = _c === void 0 ? [] : _c, textField = _b.textField, allowCustom = _b.allowCustom;
536
535
  var opened = this.props.opened !== undefined ? this.props.opened : this.state.opened;
537
536
  var valueItemText = (0, utils_1.getItemValue)(this.value, textField);
538
- var isMobileDevice = this.state.windowWidth && this.state.windowWidth <= MOBILE_MEDIUM_DEVISE;
537
+ var isMobileDevice = this.state.windowWidth && this.state.windowWidth <= constants_1.MOBILE_MEDIUM_DEVISE;
539
538
  this._suggested = '';
540
539
  if (text === valueItemText || (text === '' && !(0, utils_1.isPresent)(valueItemText))) {
541
540
  if (opened && !isMobileDevice) {
@@ -598,8 +597,8 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
598
597
  expand: opened,
599
598
  animation: true,
600
599
  onClose: function (event) { return _this.toggleBtnClick(event); },
601
- animationStyles: windowWidth <= MOBILE_SMALL_DEVISE ? { top: 0, width: '100%', height: '100%' } : undefined,
602
- className: windowWidth <= MOBILE_SMALL_DEVISE
600
+ animationStyles: windowWidth <= constants_1.MOBILE_SMALL_DEVISE ? { top: 0, width: '100%', height: '100%' } : undefined,
601
+ className: windowWidth <= constants_1.MOBILE_SMALL_DEVISE
603
602
  ? 'k-adaptive-actionsheet k-actionsheet-fullscreen'
604
603
  : 'k-adaptive-actionsheet k-actionsheet-bottom'
605
604
  };
@@ -610,8 +609,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
610
609
  React.createElement("div", { className: "k-actionsheet-title" },
611
610
  React.createElement("div", null, adaptiveTitle)),
612
611
  React.createElement("div", { className: "k-actionsheet-actions" },
613
- React.createElement(kendo_react_buttons_1.Button, { tabIndex: 0, "aria-label": "Cancel", "aria-disabled": "false", type: "button", fillMode: "flat", onClick: this.toggleBtnClick },
614
- React.createElement("span", { className: "k-button-icon k-icon k-i-x" })))),
612
+ React.createElement(kendo_react_buttons_1.Button, { tabIndex: 0, "aria-label": "Cancel", "aria-disabled": "false", type: "button", fillMode: "flat", onClick: this.toggleBtnClick, icon: 'x', svgIcon: kendo_svg_icons_1.xIcon }))),
615
613
  React.createElement("div", { className: "k-actionsheet-titlebar-group k-actionsheet-filter" }, this.renderMobileListFilter())),
616
614
  React.createElement(kendo_react_layout_1.ActionSheetContent, { className: '!k-overflow-hidden' },
617
615
  React.createElement("div", { className: 'k-list-container' },
@@ -673,7 +671,7 @@ var ComboBoxWithoutContext = /** @class */ (function (_super) {
673
671
  var selectedItemText = (0, utils_1.getItemValue)(this.value, textField);
674
672
  var value = (0, utils_1.isPresent)(text) && text !== selectedItemText ? null : this.value;
675
673
  var ListComponent = this.props.list || List_1.default;
676
- return (React.createElement(ListComponent, { id: base.listBoxId, virtual: Boolean(virtual), show: opened, data: data, focusedIndex: focusedIndex, value: value, textField: textField, valueField: dataItemKey, groupField: this.props.groupField, optionsGuid: base.guid, listRef: function (list) { vs.list = _this.base.list = list; _this.itemHeight = 0; }, wrapperStyle: (this.state.windowWidth && this.state.windowWidth > MOBILE_MEDIUM_DEVISE)
674
+ return (React.createElement(ListComponent, { id: base.listBoxId, virtual: Boolean(virtual), show: opened, data: data, focusedIndex: focusedIndex, value: value, textField: textField, valueField: dataItemKey, groupField: this.props.groupField, optionsGuid: base.guid, listRef: function (list) { vs.list = _this.base.list = list; _this.itemHeight = 0; }, wrapperStyle: (this.state.windowWidth && this.state.windowWidth > constants_1.MOBILE_MEDIUM_DEVISE)
677
675
  ? { maxHeight: popupSettings.height }
678
676
  : {}, wrapperCssClass: (0, kendo_react_common_1.classNames)('k-list-content', (_a = {},
679
677
  _a['k-list-scroller'] = !virtual,
@@ -8,6 +8,7 @@ import { DropDownStateBase, InternalState } from './../common/settings';
8
8
  * @hidden
9
9
  */
10
10
  export interface DropDownListState extends DropDownStateBase {
11
+ windowWidth?: number;
11
12
  }
12
13
  /**
13
14
  * @hidden
@@ -110,6 +111,8 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
110
111
  private _valueDuringOnChange;
111
112
  private _navigated;
112
113
  private _inputId;
114
+ private observerResize?;
115
+ private get document();
113
116
  constructor(props: DropDownListProps);
114
117
  /**
115
118
  * @hidden
@@ -148,6 +151,8 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
148
151
  * @hidden
149
152
  */
150
153
  componentDidMount(): void;
154
+ /** @hidden */
155
+ componentWillUnmount(): void;
151
156
  /**
152
157
  * @hidden
153
158
  */
@@ -162,6 +167,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
162
167
  onNavigate(state: InternalState, keyCode: number): void;
163
168
  private componentRef;
164
169
  private dummySelect;
170
+ private renderAdaptiveListContainer;
165
171
  private renderListContainer;
166
172
  private renderList;
167
173
  private renderListFilter;
@@ -183,6 +189,7 @@ export declare class DropDownListWithoutContext extends React.Component<DropDown
183
189
  private setValidity;
184
190
  private triggerOnChange;
185
191
  private applyState;
192
+ private calculateMedia;
186
193
  }
187
194
  /**
188
195
  * Represents the PropsContext of the `DropDownList` component.