@progress/kendo-react-dropdowns 14.5.0-develop.13 → 14.5.0-develop.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AutoComplete/AutoComplete.mjs +7 -7
- package/AutoComplete/AutoCompleteProps.d.ts +6 -1
- package/AutoCompleteMcpWrapper.d.ts +17 -0
- package/AutoCompleteMcpWrapper.js +8 -0
- package/AutoCompleteMcpWrapper.mjs +18 -0
- package/ComboBox/ComboBox.mjs +10 -10
- package/ComboBox/ComboBoxProps.d.ts +6 -1
- package/ComboBoxMcpWrapper.d.ts +17 -0
- package/ComboBoxMcpWrapper.js +8 -0
- package/ComboBoxMcpWrapper.mjs +18 -0
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +123 -123
- package/DropDownList/DropDownListProps.d.ts +6 -1
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +64 -64
- package/DropDownTree/DropDownTreeProps.d.ts +6 -1
- package/MultiSelect/MultiSelect.mjs +9 -9
- package/MultiSelect/MultiSelectProps.d.ts +6 -1
- package/MultiSelectMcpWrapper.d.ts +17 -0
- package/MultiSelectMcpWrapper.js +8 -0
- package/MultiSelectMcpWrapper.mjs +18 -0
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +9 -3
- package/index.d.ts +9 -3
- package/index.js +1 -1
- package/index.mjs +51 -47
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
|
@@ -13,14 +13,14 @@ import K from "../common/List.mjs";
|
|
|
13
13
|
import x from "../common/DropDownBase.mjs";
|
|
14
14
|
import L from "../common/GroupStickyHeader.mjs";
|
|
15
15
|
import { getFilteredData as b, getItemValue as I, areSame as S, isPresent as z, getFocusedItem as F, itemIndexStartsWith as H } from "../common/utils.mjs";
|
|
16
|
-
import {
|
|
16
|
+
import { createPropsContext as A, classNames as w, kendoThemeMaps as q, Keys as f, canUseDOM as E, subscribeToKendoPaste as W, IconWrap as G, withIdHOC as U, withPropsContext as $, withAdaptiveModeContext as j } from "@progress/kendo-react-common";
|
|
17
17
|
import { FloatingLabel as J } from "@progress/kendo-react-labels";
|
|
18
18
|
import Q from "../common/ClearButton.mjs";
|
|
19
19
|
import { AdaptiveMode as X } from "../common/AdaptiveMode.mjs";
|
|
20
20
|
import M from "../common/withCustomComponent.mjs";
|
|
21
21
|
import { ActionSheetContent as Y } from "@progress/kendo-react-layout";
|
|
22
22
|
import Z from "../common/ListFilter.mjs";
|
|
23
|
-
const ee = "Please enter a valid value!", { sizeMap: D, roundedMap: te } =
|
|
23
|
+
const ee = "Please enter a valid value!", { sizeMap: D, roundedMap: te } = q, y = class y extends c.Component {
|
|
24
24
|
constructor() {
|
|
25
25
|
super(...arguments), this.state = {}, this.base = new x(this), this._element = null, this._suggested = "", this._input = null, this._adaptiveInput = null, this._skipFocusEvent = !1, this._isScrolling = !1, this.itemHeight = 0, this.focus = () => {
|
|
26
26
|
this._input && this._input.focus();
|
|
@@ -278,7 +278,7 @@ const ee = "Please enter a valid value!", { sizeMap: D, roundedMap: te } = U, y
|
|
|
278
278
|
var s;
|
|
279
279
|
this.observerResize = E && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (s = this.document) != null && s.body && this.observerResize && this.observerResize.observe(this.document.body);
|
|
280
280
|
const e = this.props.name || this.props.id;
|
|
281
|
-
this.KendoPasteSubscription =
|
|
281
|
+
this.KendoPasteSubscription = W(this._element, {
|
|
282
282
|
fieldName: e,
|
|
283
283
|
onValueChange: (t) => {
|
|
284
284
|
this.handleKendoPasteValue(t);
|
|
@@ -322,7 +322,7 @@ const ee = "Please enter a valid value!", { sizeMap: D, roundedMap: te } = U, y
|
|
|
322
322
|
},
|
|
323
323
|
this.props.prefix && /* @__PURE__ */ c.createElement(O, { ...B }),
|
|
324
324
|
this.renderSearchBar(h || "", m),
|
|
325
|
-
a && /* @__PURE__ */ c.createElement(
|
|
325
|
+
a && /* @__PURE__ */ c.createElement(G, { className: "k-input-loading-icon", name: "loading" }),
|
|
326
326
|
g && !a && /* @__PURE__ */ c.createElement(Q, { onClick: this.clearButtonClick, key: "clearbutton" }),
|
|
327
327
|
this.props.suffix && /* @__PURE__ */ c.createElement(T, { ...V }),
|
|
328
328
|
!this.mobileMode && this.renderListContainer()
|
|
@@ -513,10 +513,10 @@ y.displayName = "AutoComplete", y.propTypes = {
|
|
|
513
513
|
suffix: void 0
|
|
514
514
|
};
|
|
515
515
|
let k = y;
|
|
516
|
-
const se =
|
|
517
|
-
|
|
516
|
+
const se = A(), ie = U(
|
|
517
|
+
$(
|
|
518
518
|
se,
|
|
519
|
-
|
|
519
|
+
j(k)
|
|
520
520
|
)
|
|
521
521
|
);
|
|
522
522
|
ie.displayName = "KendoReactAutoComplete";
|
|
@@ -11,7 +11,7 @@ import { DropDownsPopupSettings, Suggestion } from '../common/settings.js';
|
|
|
11
11
|
import { ListGroupItemProps } from '../common/ListGroupItem.js';
|
|
12
12
|
import { GroupStickyHeaderProps } from '../common/GroupStickyHeader.js';
|
|
13
13
|
import { ListItemProps } from '../common/ListItem.js';
|
|
14
|
-
import { AdaptiveModeContextType, CustomComponent, FormComponentProps } from '@progress/kendo-react-common';
|
|
14
|
+
import { AdaptiveModeContextType, CustomComponent, FormComponentProps, WebMcpProps } from '@progress/kendo-react-common';
|
|
15
15
|
/**
|
|
16
16
|
* Represents the object of the `change` AutoComplete event.
|
|
17
17
|
*/
|
|
@@ -519,6 +519,11 @@ export interface AutoCompleteProps extends FormComponentProps {
|
|
|
519
519
|
* This property is related to accessibility.
|
|
520
520
|
*/
|
|
521
521
|
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
522
|
+
/**
|
|
523
|
+
* Enables Web MCP tool registration for this component.
|
|
524
|
+
* Requires a parent `WebMcpProvider` from `@progress/kendo-react-webmcp`.
|
|
525
|
+
*/
|
|
526
|
+
webMcp?: boolean | WebMcpProps;
|
|
522
527
|
/**
|
|
523
528
|
* @hidden
|
|
524
529
|
* This prop is provided by the withAdaptiveModeContext HOC to subscribe to AdaptiveModeContext.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { AutoCompleteHandle } from './AutoComplete/AutoComplete.js';
|
|
9
|
+
import { AutoCompleteProps } from './AutoComplete/AutoCompleteProps';
|
|
10
|
+
/**
|
|
11
|
+
* AutoComplete wrapper that integrates the Web MCP hook.
|
|
12
|
+
*
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
/** @hidden */
|
|
17
|
+
export declare const AutoCompleteWrapper: React.ForwardRefExoticComponent<AutoCompleteProps & React.RefAttributes<AutoCompleteHandle>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react"),l=require("./AutoComplete/AutoComplete.js"),n=require("@progress/kendo-react-common");function i(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const c=i(a),u=c.forwardRef((e,o)=>{const[t,r]=n.useMergedRef(o);return n.useWebMcpRegister("autocomplete",t,e,e.webMcp),c.createElement(l.AutoComplete,{...e,ref:r})});u.displayName="KendoReactAutoComplete";exports.AutoCompleteWrapper=u;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as t from "react";
|
|
9
|
+
import { AutoComplete as a } from "./AutoComplete/AutoComplete.mjs";
|
|
10
|
+
import { useMergedRef as f, useWebMcpRegister as p } from "@progress/kendo-react-common";
|
|
11
|
+
const c = t.forwardRef((e, o) => {
|
|
12
|
+
const [r, m] = f(o);
|
|
13
|
+
return p("autocomplete", r, e, e.webMcp), /* @__PURE__ */ t.createElement(a, { ...e, ref: m });
|
|
14
|
+
});
|
|
15
|
+
c.displayName = "KendoReactAutoComplete";
|
|
16
|
+
export {
|
|
17
|
+
c as AutoCompleteWrapper
|
|
18
|
+
};
|
package/ComboBox/ComboBox.mjs
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import * as u from "react";
|
|
9
9
|
import m from "prop-types";
|
|
10
10
|
import _ from "../common/DropDownBase.mjs";
|
|
11
|
-
import {
|
|
11
|
+
import { createPropsContext as et, classNames as S, uComboBox as F, Keys as I, validatePackage as st, getLicenseMessage as it, svgIconPropType as ot, canUseDOM as A, subscribeToKendoPaste as at, IconWrap as nt, WatermarkOverlay as lt, withIdHOC as rt, withPropsContext as pt, withUnstyledHOC as dt, withAdaptiveModeContext as ht } from "@progress/kendo-react-common";
|
|
12
12
|
import { FloatingLabel as ct } from "@progress/kendo-react-labels";
|
|
13
13
|
import { getPlainDataDuplicates as ut, getItemIndexByText as P, getFilteredData as y, areSame as D, getItemValue as w, isPresent as k, itemIndexStartsWith as L, suggestValue as gt } from "../common/utils.mjs";
|
|
14
14
|
import mt from "../common/SearchBar.mjs";
|
|
@@ -235,7 +235,7 @@ const Ft = "Please enter a valid value!", E = class E extends u.Component {
|
|
|
235
235
|
e.syntheticEvent = t, this.mobileMode && !this._skipFocus && (this._skipFocus = !0, this.base.togglePopup(e), this.applyState(e), setTimeout(() => {
|
|
236
236
|
this._skipFocus = !1;
|
|
237
237
|
}, 300)), this.base.handleFocus(t);
|
|
238
|
-
}, this.showLicenseWatermark = !
|
|
238
|
+
}, this.showLicenseWatermark = !st(H, { component: "ComboBox" }), this.licenseMessage = it(H);
|
|
239
239
|
}
|
|
240
240
|
get _inputId() {
|
|
241
241
|
return this.props.id;
|
|
@@ -328,7 +328,7 @@ const Ft = "Please enter a valid value!", E = class E extends u.Component {
|
|
|
328
328
|
var t;
|
|
329
329
|
this.observerResize = A && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (t = this.document) != null && t.body && this.observerResize && this.observerResize.observe(this.document.body), this.checkForDuplicatePlainTextRecords();
|
|
330
330
|
const s = this.props.name || this.props.id;
|
|
331
|
-
this.KendoPasteSubscription =
|
|
331
|
+
this.KendoPasteSubscription = at(this._element, {
|
|
332
332
|
fieldName: s,
|
|
333
333
|
onValueChange: (e) => {
|
|
334
334
|
this.handleKendoPasteValue(e);
|
|
@@ -393,7 +393,7 @@ const Ft = "Please enter a valid value!", E = class E extends u.Component {
|
|
|
393
393
|
this.renderSearchBar(V || "", R, g),
|
|
394
394
|
Y && !i && /* @__PURE__ */ u.createElement(xt, { onClick: this.clearButtonClick, key: "clearbutton" }),
|
|
395
395
|
i && /* @__PURE__ */ u.createElement(
|
|
396
|
-
|
|
396
|
+
nt,
|
|
397
397
|
{
|
|
398
398
|
className: S(F.loadingIcon({ c: B })),
|
|
399
399
|
name: "loading",
|
|
@@ -544,7 +544,7 @@ const Ft = "Please enter a valid value!", E = class E extends u.Component {
|
|
|
544
544
|
a
|
|
545
545
|
)
|
|
546
546
|
),
|
|
547
|
-
this.showLicenseWatermark && /* @__PURE__ */ u.createElement(
|
|
547
|
+
this.showLicenseWatermark && /* @__PURE__ */ u.createElement(lt, { message: this.licenseMessage })
|
|
548
548
|
);
|
|
549
549
|
}
|
|
550
550
|
renderList() {
|
|
@@ -695,7 +695,7 @@ E.displayName = "ComboBox", E.propTypes = {
|
|
|
695
695
|
ignoreCase: m.bool,
|
|
696
696
|
clearButton: m.bool,
|
|
697
697
|
iconClassName: m.string,
|
|
698
|
-
svgIcon:
|
|
698
|
+
svgIcon: ot,
|
|
699
699
|
validationMessage: m.string,
|
|
700
700
|
required: m.bool,
|
|
701
701
|
id: m.string,
|
|
@@ -721,11 +721,11 @@ E.displayName = "ComboBox", E.propTypes = {
|
|
|
721
721
|
suffix: void 0
|
|
722
722
|
};
|
|
723
723
|
let N = E;
|
|
724
|
-
const kt =
|
|
725
|
-
|
|
724
|
+
const kt = et(), Dt = rt(
|
|
725
|
+
pt(
|
|
726
726
|
kt,
|
|
727
|
-
|
|
728
|
-
|
|
727
|
+
dt(
|
|
728
|
+
ht(N)
|
|
729
729
|
)
|
|
730
730
|
)
|
|
731
731
|
);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { ComboBox } from './ComboBox.js';
|
|
9
9
|
import { FilterChangeEvent, ChangeEvent, OpenEvent, CloseEvent, FocusEvent, BlurEvent, PageChangeEvent } from './../common/events';
|
|
10
|
-
import { AdaptiveModeContextType, CustomComponent, DropDownsClassStructure, FormComponentProps, SVGIcon } from '@progress/kendo-react-common';
|
|
10
|
+
import { AdaptiveModeContextType, CustomComponent, DropDownsClassStructure, FormComponentProps, SVGIcon, WebMcpProps } from '@progress/kendo-react-common';
|
|
11
11
|
import { VirtualizationSettings, DropDownsPopupSettings } from '../common/settings.js';
|
|
12
12
|
import { ListItemProps } from '../common/ListItem.js';
|
|
13
13
|
import { ListGroupItemProps } from '../common/ListGroupItem.js';
|
|
@@ -646,6 +646,11 @@ export interface ComboBoxProps extends FormComponentProps {
|
|
|
646
646
|
* ```
|
|
647
647
|
*/
|
|
648
648
|
inputAttributes?: React.InputHTMLAttributes<HTMLInputElement>;
|
|
649
|
+
/**
|
|
650
|
+
* Enables Web MCP tool registration for this component.
|
|
651
|
+
* Requires a parent `WebMcpProvider` from `@progress/kendo-react-webmcp`.
|
|
652
|
+
*/
|
|
653
|
+
webMcp?: boolean | WebMcpProps;
|
|
649
654
|
/**
|
|
650
655
|
* @hidden
|
|
651
656
|
* This prop is provided by the withAdaptiveModeContext HOC to subscribe to AdaptiveModeContext.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { ComboBoxHandle } from './ComboBox/ComboBox.js';
|
|
9
|
+
import { ComboBoxProps } from './ComboBox/ComboBoxProps';
|
|
10
|
+
/**
|
|
11
|
+
* ComboBox wrapper that integrates the Web MCP hook.
|
|
12
|
+
*
|
|
13
|
+
* @hidden
|
|
14
|
+
*/
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
/** @hidden */
|
|
17
|
+
export declare const ComboBoxWrapper: React.ForwardRefExoticComponent<ComboBoxProps & React.RefAttributes<ComboBoxHandle>>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),b=require("./ComboBox/ComboBox.js"),n=require("@progress/kendo-react-common");function i(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const c=i(u),a=c.forwardRef((e,t)=>{const[o,r]=n.useMergedRef(t);return n.useWebMcpRegister("combobox",o,e,e.webMcp),c.createElement(b.ComboBox,{...e,ref:r})});a.displayName="KendoReactComboBox";exports.ComboBoxWrapper=a;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import * as o from "react";
|
|
9
|
+
import { ComboBox as f } from "./ComboBox/ComboBox.mjs";
|
|
10
|
+
import { useMergedRef as a, useWebMcpRegister as c } from "@progress/kendo-react-common";
|
|
11
|
+
const b = o.forwardRef((e, r) => {
|
|
12
|
+
const [m, t] = a(r);
|
|
13
|
+
return c("combobox", m, e, e.webMcp), /* @__PURE__ */ o.createElement(f, { ...e, ref: t });
|
|
14
|
+
});
|
|
15
|
+
b.displayName = "KendoReactComboBox";
|
|
16
|
+
export {
|
|
17
|
+
b as ComboBoxWrapper
|
|
18
|
+
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Wt=require("react"),L=require("prop-types"),o=require("@progress/kendo-react-common"),_t=require("@progress/kendo-react-labels"),Ut=require("@progress/kendo-svg-icons"),Gt=require("../common/ListContainer.js"),jt=require("../common/ListFilter.js"),tt=require("../common/GroupStickyHeader.js"),$t=require("../common/ListDefaultItem.js"),Yt=require("../common/List.js"),rt=require("../common/DropDownBase.js"),d=require("../common/utils.js"),nt=require("../package-metadata.js"),Jt=require("@progress/kendo-react-buttons"),Qt=require("@progress/kendo-react-intl"),Y=require("../messages/index.js"),Rt=require("@progress/kendo-react-layout"),Xt=require("../common/AdaptiveMode.js");function Zt(M){const J=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(M){for(const O in M)if(O!=="default"){const re=Object.getOwnPropertyDescriptor(M,O);Object.defineProperty(J,O,re.get?re:{enumerable:!0,get:()=>M[O]})}}return J.default=M,Object.freeze(J)}const a=Zt(Wt),en="Please select a value from the list!",fe=a.forwardRef((M,J)=>{let O=!1;const re=o.getLicenseMessage(nt.packageMetadata),n=o.usePropsContext(ot,M),{delay:st=P.delay,tabIndex:at=P.tabIndex,ignoreCase:Q=P.ignoreCase,size:T=P.size,rounded:Ne=P.rounded,fillMode:ve=P.fillMode}=n;if(n.filterable||n.virtual){const e=[];n.filterable&&e.push("filterable"),n.virtual&&e.push("virtualization"),O=!o.validatePackage(nt.packageMetadata,{component:"DropDownList",features:e})}const E=o.useUnstyled(),ye=o.useId(n.id),De=()=>{var e;if(o.canUseDOM)return((e=V.current)==null?void 0:e.ownerDocument)||window.document},it=()=>{var e,r;(e=t==null?void 0:t.current)!=null&&e.wrapper&&((r=t==null?void 0:t.current)==null||r.wrapper.focus({preventScroll:!0}))},k=()=>{let e;return A.current!==void 0&&A.current!==null?e=A.current:n.value!==void 0?e=n.value:f.value!==void 0&&f.value!==null?e=f.value:n.defaultValue!==void 0&&n.defaultValue!==null&&(e=n.defaultValue),!d.isPresent(e)&&n.defaultItem!==void 0&&n.defaultItem!==null&&(e=n.defaultItem),e},lt=()=>{const{dataItemKey:e}=n,r=d.getFilteredData(n),s=k();return r.findIndex(c=>d.areSame(c,s,e))},he=()=>n.required!==void 0?n.required:P.required,Ie=()=>{const e=n.validationMessage!==void 0,r=k(),s=!he()||r!==null&&r!==""&&r!==void 0,c=n.valid!==void 0?n.valid:s;return{customError:e,valid:c,valueMissing:r===null}},dt=()=>n.validityStyles!==void 0?n.validityStyles:P.validityStyles,oe=e=>{se.current=!0,e.focus(),window.setTimeout(()=>se.current=!1,30)},we=()=>{X.current&&oe(X.current),n.adaptive&&setTimeout(()=>{X.current&&oe(X.current)},300)},ct=a.useCallback(e=>{for(const r of e)Ft(r.target.clientWidth)},[]),Me=()=>{var e;(e=Le.current)!=null&&e.setCustomValidity&&Le.current.setCustomValidity(Ie().valid?"":n.validationMessage||en)},q=(e,r)=>{const s=k();d.areSame(s,e,n.dataItemKey)||(n.value===void 0&&(r.data.value=e),t.current.updateComponentArgs({value:e}),A.current=e,r.events.push({type:"onChange"}))},b=e=>{var r;(r=t==null?void 0:t.current)==null||r.applyState(e),A.current=void 0},R=(e,r)=>{var m;const{virtual:s,dataItemKey:c,defaultItem:l}=n,p=d.getFilteredData(n),g=s?s.skip:0,v=k(),u=e===-1&&l!==void 0?l:p[e-g],y=!d.areSame(u,v,c);q(u,r),y&&((m=t==null?void 0:t.current)==null||m.triggerPageChangeCornerItems(u,r))},z=(e,r,s)=>{var C,D;const{defaultItem:c,dataItemKey:l,virtual:p={skip:0,total:0,pageSize:0}}=n,g=k(),v=d.getFilteredData(n),u=(C=t==null?void 0:t.current)==null?void 0:C.vs,y=v.findIndex(h=>d.areSame(h,g,l)),m=(D=t==null?void 0:t.current)==null?void 0:D.navigation.navigate({current:p.skip+y,max:(u!=null&&u.enabled?p.total:v.length)-1,min:c!==void 0?-1:0,keyCode:r,skipItems:s||void 0});m!==void 0&&R(m,e),b(e)},ut=e=>{V.current=e,t.current.wrapper=e},pt=e=>a.createElement("select",{name:n.name,ref:r=>{Le.current=r},tabIndex:-1,"aria-hidden":!0,title:n.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},a.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,e):e})),Se=()=>{const{textField:e,dataItemKey:r,virtual:s={skip:0},focusedItemIndex:c=d.itemIndexStartsWith,filterable:l,skipDisabledItems:p=!0}=n,g=k(),v=d.getFilteredData(n),u=n.filter?n.filter:f.text;return p&&e&&!u&&!g?v.findIndex(y=>!y.disabled):d.isPresent(g)&&u===void 0||l&&u===""?v.findIndex(y=>d.areSame(y,g,r)):u?ke.current?c(v,u,e):v.findIndex(y=>d.areSame(y,g,r)):s.skip===0?0:-1},Oe=(e,r)=>r!==void 0&&r!==-1&&e&&e.length>0&&e[r].disabled,xe=()=>{const e=d.getFilteredData(n),r=t.current.initState(),s=Se();Oe(e,s)&&(q(null,r),b(r))},Ce=e=>{if(e.isPropagationStopped())return;const r=t.current.initState();r.syntheticEvent=e,f.focused||(r.data.focused=!0),xe(),t.current.togglePopup(r),b(r)},Te=e=>{var N,me,U,ge,$,Ze,et;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:r,disabled:s,defaultItem:c,leftRightKeysNavigation:l=!0,virtual:p={skip:0,total:0,pageSize:0},dataItemKey:g,groupField:v="",textField:u,skipDisabledItems:y=!0}=n,m=d.getFilteredData(n),C=k(),D=m.findIndex(w=>d.areSame(w,C,g)),h=n.opened!==void 0?n.opened:f.opened,i=e.keyCode,F=i===o.Keys.home||i===o.Keys.end,K=i===o.Keys.up||i===o.Keys.down,j=!h&&(e.altKey&&i===o.Keys.down||i===o.Keys.enter||i===o.Keys.space),ne=h&&(e.altKey&&i===o.Keys.up||i===o.Keys.esc),ue=l&&(i===o.Keys.left||i===o.Keys.right),pe=K||ue&&!r||F,I=t.current.initState();if(I.syntheticEvent=e,!s){if(F&&((N=t==null?void 0:t.current)!=null&&N.vs.enabled))i===o.Keys.home?p.skip!==0?((me=t==null?void 0:t.current)==null||me.triggerOnPageChange(I,0,p.pageSize),B.current=!0):q(m[0],I):p.skip<p.total-p.pageSize?((U=t==null?void 0:t.current)==null||U.triggerOnPageChange(I,p.total-p.pageSize,p.pageSize),B.current=!0):q(m[m.length-1],I);else if(h&&i===o.Keys.pageUp)e.preventDefault(),(ge=t==null?void 0:t.current)==null||ge.scrollPopupByPageSize(-1);else if(h&&i===o.Keys.pageDown)e.preventDefault(),($=t==null?void 0:t.current)==null||$.scrollPopupByPageSize(1);else if(h&&i===o.Keys.enter){const w=Se();Oe(m,w)?(q(null,I),b(I)):R(w,I),(Ze=t==null?void 0:t.current)==null||Ze.togglePopup(I),e.preventDefault()}else if(j||ne)ne&&xe(),(et=t==null?void 0:t.current)==null||et.togglePopup(I),e.preventDefault();else if(pe){if(ke.current=!1,v!==""&&u)if(!y&&h)z(I,i);else{let w;if(i===o.Keys.down||i===o.Keys.right){const S=m.slice(D+1).find(x=>!x.disabled);w=S&&m.indexOf(S)}else if(i===o.Keys.up||i===o.Keys.left){let S;if(D===0&&c)w=-1;else if(D===-1)S=m,w=m.findIndex(x=>!x.disabled);else{S=m.slice(0,D);let x=S.pop();for(;x&&x.disabled;)x=S.pop();w=x&&m.indexOf(x)}}if(w!==void 0){const S=w-D;z(I,i,S)}else w===void 0&&D===m.length-1&&z(I,i)}else if(!y&&h||F)z(I,i);else if(u){let w;if(i===o.Keys.down||i===o.Keys.right){const S=m.slice(D+1).find(x=>!x.disabled);w=S&&m.indexOf(S)}else if(i===o.Keys.up||i===o.Keys.left){let S;if(D===0&&c)w=-1;else if(D===-1)S=m,w=m.findIndex(x=>!x.disabled);else{S=m.slice(0,D);let x=S.pop();for(;x&&x.disabled;)x=S.pop();w=x&&m.indexOf(x)}}if(w!==void 0){const S=w-D;z(I,i,S)}else w===void 0&&D===m.length-1&&z(I,i)}else z(I,i);e.preventDefault()}b(I)}},mt=e=>{const r=t.current.initState();r.syntheticEvent=e.syntheticEvent,n.filter===void 0&&(r.data.text=e.target.value),t.current.filterChanged(e.target.value,r),ke.current=!0,b(r),ee({group:void 0,text:String(e.target.value)})},qe=e=>{const r=n.filter!==void 0?n.filter:f.text;return n.filterable&&a.createElement(jt,{value:r,ref:s=>{X.current=s&&s.element},onChange:mt,onKeyDown:Te,size:e?"large":T,rounded:Ne,fillMode:ve,renderListFilterWrapper:!0,placeholder:We.toLanguageString(Y.dropDownListAdaptiveFilterPlaceholder,Y.messages[Y.dropDownListAdaptiveFilterPlaceholder])})},gt=e=>{var s;const r=t.current.initState();r.syntheticEvent=e,(s=t==null?void 0:t.current)==null||s.togglePopup(r),q(n.defaultItem,r),b(r)},ft=()=>{const{textField:e,defaultItem:r,dataItemKey:s}=n,c=k();return r!==void 0&&a.createElement($t,{defaultItem:r,textField:e,selected:d.areSame(c,r,s),key:"defaultitemkey",onClick:gt})},vt=(e,r)=>{var s;(s=t==null?void 0:t.current)==null||s.handleItemClick(e,r),A.current=void 0},yt=e=>{const{vs:r,list:s}=t.current;r.scrollHandler(e);const{groupField:c}=n;let l=d.getFilteredData(n);if(!(!c||!l.length)&&c){const p=Be.current=Be.current||(r.enabled?r.itemHeight:s?s.children[0].offsetHeight:0),v=e.target.scrollTop-r.skip*p;l=t.current.getGroupedDataModernMode(l,c);let u=l[0][c];for(let y=1;y<l.length&&!(p*y>v);y++)l[y]&&l[y][c]&&(u=l[y][c]);u!==f.group&&ee({group:u})}},ze=()=>{var i;const{textField:e,dataItemKey:r,virtual:s={skip:0,total:void 0},groupHeaderItemRender:c,listNoDataRender:l,itemRender:p}=n,g=d.getFilteredData(n),v=E&&E.uDropDownList,u=t.current.vs,y=s.skip,m=n.opened!==void 0?n.opened:f.opened,C=t.current.getPopupSettings(),D=`translateY(${u.translate}px)`,h=k();return a.createElement(Yt,{id:Ee,show:m,data:g.slice(),focusedIndex:Se(),value:h,textField:e,valueField:r,optionsGuid:Ge,groupField:n.groupField,listRef:F=>{u.list=t.current.list=F},wrapperStyle:{maxHeight:_?void 0:C.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:v})),listStyle:u.enabled?{transform:D}:void 0,key:"listkey",skip:y,onClick:vt,itemRender:p,groupHeaderItemRender:c,noDataRender:l,onScroll:yt,wrapperRef:u.scrollerRef,scroller:(i=t==null?void 0:t.current)==null?void 0:i.renderScrollElement(),ariaSetSize:s.total})},Dt=()=>{const{groupField:e}=n,r=d.getFilteredData(n),s=n.opened!==void 0?n.opened:f.opened,c=E&&E.uDropDownList,l={title:n.adaptiveTitle||n.label,subTitle:n.adaptiveSubtitle,expand:s,onClose:g=>Ce(g),windowWidth:be,mobileFilter:qe(!0)};let{group:p}=f;return p===void 0&&e!==void 0&&(p=d.getItemValue(r[0],e)),a.createElement(Xt.AdaptiveMode,{...l},a.createElement(Rt.ActionSheetContent,null,a.createElement("div",{className:o.classNames(o.uDropDownList.listContainer({c,popup:!1}))},St())))},ht=()=>{f.focused&&window.setTimeout(()=>{f.focused&&t.current.wrapper&&oe(t.current.wrapper)})},It=e=>{"onMouseDownOutside"in(n.popupSettings||{})&&n.popupSettings.onMouseDownOutside.call(void 0,e)},wt=()=>{const{header:e,footer:r,dir:s,groupField:c,groupStickyHeaderItemRender:l,list:p}=n,g=d.getFilteredData(n),v=t.current,u=v.getPopupSettings(),y=n.opened!==void 0?n.opened:f.opened,m=u.width!==void 0?u.width:v.popupWidth,C=E&&E.uDropDownList,D={dir:s!==void 0?s:v.dirCalculated,width:m,popupSettings:{...u,popupClass:o.classNames(u.popupClass,o.uDropDownList.listContainer({c:C,popup:!0})),anchor:u.anchor||V.current,show:y,onOpen:we,onClose:ht,onMouseDownOutside:It},itemsCount:[g.length]};let{group:h}=f;return h===void 0&&c!==void 0&&(h=d.getItemValue(g[0],c)),a.createElement(Gt,{...D},qe(!1),e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:C}))},e),a.createElement("div",{className:o.classNames(o.uDropDownList.list({c:C,size:T,virtual:t.current.vs.enabled}))},ft(),!p&&h&&g.length!==0&&a.createElement(tt,{group:h,render:l}),ze()),r&&a.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:C}))},r),O&&a.createElement(o.WatermarkOverlay,{message:re}))},St=()=>{const{header:e,footer:r,groupStickyHeaderItemRender:s,groupField:c,list:l}=n,p=d.getFilteredData(n),g=E&&E.uDropDownList;let{group:v}=f;return v===void 0&&c!==void 0&&(v=d.getItemValue(p[0],c)),a.createElement(a.Fragment,null,e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:g}))},e),a.createElement("div",{className:o.classNames("k-list",{[`k-list-${_?"lg":o.sizeMap[T]||T}`]:_||T})},!l&&v&&p.length!==0&&a.createElement(tt,{group:v,render:s}),ze()),r&&a.createElement("div",{className:"k-list-footer"},r))},xt=e=>{const{dataItemKey:r}=n,s=d.getFilteredData(n),c=k();let l=s.map((K,j)=>({item:K,itemIndex:j}));const p=G.current.word,g=G.current.last,v=d.sameCharsOnly(p,g);let u=l.length,y=Math.max(0,s.findIndex(K=>d.areSame(K,c,r))),m;n.defaultItem&&(m={item:n.defaultItem,itemIndex:-1},u+=1,y+=1),y+=v?1:0,l=d.shuffleData(l,y,m);let C,D,h,i=0;const{textField:F}=n;for(;i<u;){if(C=d.getItemValue(l[i].item,F),D=v&&d.matchText(C,g,Q),h=d.matchText(C,p,Q),D||h){i=l[i].itemIndex;break}i++}if(i!==u){const K=t.current.initState();K.syntheticEvent=e,R(i,K),b(K),A.current=void 0}},Ct=e=>{clearTimeout(Ae.current),n.filterable||(Ae.current=window.setTimeout(()=>G.current.word="",st),xt(e))},Lt=e=>{se.current||t.current.handleFocus(e)},kt=e=>{if(se.current||!f.focused)return;const r=n.opened!==void 0?n.opened:f.opened,s=t.current.initState();s.syntheticEvent=e,s.data.focused=!1,s.events.push({type:"onBlur"}),r&&xe(),r&&!_&&t.current.togglePopup(s),b(s)},Kt=e=>{if(n.filterable||e.which===0||e.keyCode===o.Keys.enter)return;let r=String.fromCharCode(e.charCode||e.keyCode);Q&&(r=r.toLowerCase()),r===" "&&e.preventDefault(),G.current={word:G.current.word+r,last:G.current.last+r},Ct(e)},bt=()=>{const e=t.current.initState();e.data.opened=f.opened,t.current.togglePopup(e),b(e)},Ve=a.useRef(null),V=a.useRef(null),Le=a.useRef(null),X=a.useRef(null);a.useImperativeHandle(Ve,()=>({get element(){return V.current},get index(){return lt()},get name(){return n.name},get validity(){return Ie()},get value(){return k()},get focused(){return f.focused},get opened(){return f.opened},focus:it,props:n,togglePopup:bt})),a.useImperativeHandle(J,()=>Ve.current);const Ae=a.useRef(null),G=a.useRef({word:"",last:""}),se=a.useRef(!1),A=a.useRef(null),B=a.useRef(!1),ke=a.useRef(!1),H=a.useRef({}),Ke=a.useRef({}),t=a.useRef(new rt({props:n,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),Be=a.useRef(0),Z=a.useRef(null),[f,Et]=a.useState({}),[be,Ft]=a.useState(),[,He]=a.useReducer(e=>e,!0),We=Qt.useLocalization(),_e=n.name||n.id,Pt=a.useCallback(e=>{if(e==null||!t.current)return;const r=d.getFilteredData(n),{textField:s}=n,c=String(e),l=d.getItemIndexByText(r,c,s,!1,Q),p=l!==-1?r[l]:void 0;if(p!==void 0){const g=t.current.initState();g.syntheticEvent={target:V.current},q(p,g),b(g)}},[n,Q]);o.useKendoPaste(V,{fieldName:_e,onValueChange:Pt,enabled:!!_e});const ee=e=>{Et({...f,...e})};a.useEffect(()=>{t.current.updateComponentArgs({props:n,setState:ee,state:f,forceUpdate:He,element:V.current,handleItemSelect:R,value:k()})},[ee,f,He,R,k]),a.useEffect(()=>{var y,m,C,D,h,i,F,K,j,ne,ue,pe,I;const{dataItemKey:e,virtual:r,groupField:s="",textField:c}=n,l=d.getFilteredData(n),p=H.current.virtual?H.current.virtual.total:0,g=n.opened!==void 0?n.opened:f.opened,v=H.current.opened!==void 0?H.current.opened:Ke.current.opened,u=!v&&g;if((y=t==null?void 0:t.current)==null||y.didUpdate(),(m=t==null?void 0:t.current)!=null&&m.getPopupSettings().animate||u&&we(),r&&r.total!==p)(C=t==null?void 0:t.current)==null||C.vs.calcScrollElementHeight(),(D=t==null?void 0:t.current)==null||D.vs.reset();else{const N=k(),me=H.current.value!==void 0?H.current.value:Ke.current.value;let U=l.findIndex($=>d.areSame($,N,e));s!==""&&N&&c&&(U=(i=(h=t==null?void 0:t.current)==null?void 0:h.getGroupedDataModernMode(l,s))==null?void 0:i.map($=>$[c]).indexOf(N[c]));const ge=!d.areSame(me,N,e);u&&r?(F=t==null?void 0:t.current)==null||F.scrollToVirtualItem(r,U):u&&!r?(we(),l&&l.length!==0&&((K=t==null?void 0:t.current)==null||K.resetGroupStickyHeader(l[0][s],{setState:ee,group:f.group,state:f})),(j=t==null?void 0:t.current)==null||j.scrollToItem(U)):g&&v&&N&&ge&&!B.current?(ue=t==null?void 0:t.current)==null||ue.scrollToItem(U,(ne=t==null?void 0:t.current)==null?void 0:ne.vs.enabled):g&&v&&B.current&&(B.current&&r&&r.skip===0?(pe=t==null?void 0:t.current)==null||pe.vs.reset():B.current&&r&&r.skip===r.total-r.pageSize&&((I=t==null?void 0:t.current)==null||I.vs.scrollToEnd()))}B.current=!1,Ke.current=f,H.current=n,Me()}),a.useEffect(()=>{var e,r;return Z.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ct.bind(void 0)),(e=t==null?void 0:t.current)==null||e.didMount(),Me(),(r=De())!=null&&r.body&&Z.current&&Z.current.observe(De().body),()=>{var s;(s=De())!=null&&s.body&&Z.current&&Z.current.disconnect()}},[]);const Ue=ye+"-accessibility-id",Ee=ye+"-listbox-id",Ge=ye+"-guid",Nt=We.toLanguageString(Y.dropDownListArrowBtnAriaLabel,Y.messages[Y.dropDownListArrowBtnAriaLabel]),{style:ae,className:Mt,label:Fe,dir:Ot,virtual:W,adaptive:tn,dataItemKey:Tt,disabled:ie,loading:je,iconClassName:$e,svgIcon:qt,valueRender:Ye}=n,le=n.opened!==void 0?n.opened:f.opened,de=k(),Pe=d.getItemValue(de,n.textField),Je=!dt()||Ie().valid,ce=t.current,zt=ce.vs,te=E&&E.uDropDownList;zt.enabled=W!==void 0;const Qe=o.useAdaptiveModeContext(),_=!!(be&&Qe&&be<=Qe.medium&&n.adaptive);W!==void 0&&(ce.vs.skip=W.skip,ce.vs.total=W.total,ce.vs.pageSize=W.pageSize);const Vt=d.getFilteredData(n),{focused:At}=f,Bt=Vt.findIndex(e=>d.areSame(e,de,Tt)),Re=a.createElement("span",{id:Ue,className:o.classNames(o.uDropDownList.inputInner({c:te}))},Pe&&a.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:te}))},Pe)),Ht=Ye!==void 0?Ye.call(void 0,Re,de):Re,Xe=a.createElement(a.Fragment,null,a.createElement("span",{ref:ut,className:o.classNames(o.uDropDownList.wrapper({c:te,size:T,rounded:Ne,fillMode:ve,focused:At,disabled:ie,invalid:!Je,loading:je,required:he()}),Mt),style:Fe?{...ae,width:void 0}:ae,dir:Ot,onMouseDown:le?e=>{e.target.nodeName!=="INPUT"&&(oe(t.current.wrapper),e.preventDefault())}:void 0,onFocus:_?e=>Ce(e):Lt,onBlur:kt,tabIndex:o.getTabIndex(at,ie),accessKey:n.accessKey,onKeyDown:Te,onKeyPress:Kt,onClick:ie?void 0:Ce,role:"combobox","aria-required":he(),"aria-disabled":ie||void 0,"aria-haspopup":"listbox","aria-expanded":le||!1,"aria-owns":Ee,"aria-activedescendant":le?"option-"+Ge+"-"+(Bt+(W?W.skip:0)):void 0,"aria-label":n.ariaLabel||n.label,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy||Ue,"aria-controls":le?Ee:void 0,id:n.id,title:n.title},Ht,je&&a.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:te})),name:"loading"}),a.createElement(Jt.Button,{tabIndex:-1,type:"button","aria-label":Nt,size:T,fillMode:ve,className:o.classNames(o.uDropDownList.inputButton({c:te})),iconClass:$e,svgIcon:$e?void 0:qt||Ut.chevronDownIcon,onMouseDown:e=>f.focused&&e.preventDefault()}),pt(de),!_&&wt()),_&&Dt());return Fe?a.createElement(_t.FloatingLabel,{label:Fe,editorValue:Pe,editorValid:Je,editorDisabled:n.disabled,style:{width:ae?ae.width:void 0},children:Xe}):Xe});fe.propTypes={delay:L.number,ignoreCase:L.bool,iconClassName:L.string,svgIcon:o.svgIconPropType,defaultItem:L.any,valueRender:L.func,valueMap:L.func,validationMessage:L.string,required:L.bool,id:L.string,ariaLabelledBy:L.string,ariaDescribedBy:L.string,ariaLabel:L.string,leftRightKeysNavigation:L.bool,title:L.string,groupField:L.string,list:L.any,skipDisabledItems:L.bool};const P={delay:500,tabIndex:0,ignoreCase:!0,...rt.defaultProps,required:!1,size:void 0,rounded:void 0,fillMode:void 0};fe.displayName="KendoReactDropDownList";const ot=o.createPropsContext();fe.displayName="KendoReactDropDownList";exports.DropDownList=fe;exports.DropDownListPropsContext=ot;exports.dropDownListDefaultProps=P;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Wt=require("react"),L=require("prop-types"),o=require("@progress/kendo-react-common"),_t=require("@progress/kendo-react-labels"),Ut=require("@progress/kendo-svg-icons"),Gt=require("../common/ListContainer.js"),jt=require("../common/ListFilter.js"),tt=require("../common/GroupStickyHeader.js"),$t=require("../common/ListDefaultItem.js"),Rt=require("../common/List.js"),rt=require("../common/DropDownBase.js"),d=require("../common/utils.js"),nt=require("../package-metadata.js"),Yt=require("@progress/kendo-react-buttons"),Jt=require("@progress/kendo-react-intl"),R=require("../messages/index.js"),Qt=require("@progress/kendo-react-layout"),Xt=require("../common/AdaptiveMode.js");function Zt(M){const Y=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(M){for(const O in M)if(O!=="default"){const re=Object.getOwnPropertyDescriptor(M,O);Object.defineProperty(Y,O,re.get?re:{enumerable:!0,get:()=>M[O]})}}return Y.default=M,Object.freeze(Y)}const a=Zt(Wt),en="Please select a value from the list!",fe=a.forwardRef((M,Y)=>{let O=!1;const re=o.getLicenseMessage(nt.packageMetadata),n=o.usePropsContext(ot,M),{delay:st=P.delay,tabIndex:at=P.tabIndex,ignoreCase:J=P.ignoreCase,size:T=P.size,rounded:Me=P.rounded,fillMode:ve=P.fillMode}=n;if(n.filterable||n.virtual){const e=[];n.filterable&&e.push("filterable"),n.virtual&&e.push("virtualization"),O=!o.validatePackage(nt.packageMetadata,{component:"DropDownList",features:e})}const E=o.useUnstyled(),ye=o.useId(n.id),De=()=>{var e;if(o.canUseDOM)return((e=V.current)==null?void 0:e.ownerDocument)||window.document},it=()=>{var e,r;(e=t==null?void 0:t.current)!=null&&e.wrapper&&((r=t==null?void 0:t.current)==null||r.wrapper.focus({preventScroll:!0}))},k=()=>{let e;return A.current!==void 0&&A.current!==null?e=A.current:n.value!==void 0?e=n.value:f.value!==void 0&&f.value!==null?e=f.value:n.defaultValue!==void 0&&n.defaultValue!==null&&(e=n.defaultValue),!d.isPresent(e)&&n.defaultItem!==void 0&&n.defaultItem!==null&&(e=n.defaultItem),e},lt=()=>{const{dataItemKey:e}=n,r=d.getFilteredData(n),s=k();return r.findIndex(c=>d.areSame(c,s,e))},he=()=>n.required!==void 0?n.required:P.required,Ie=()=>{const e=n.validationMessage!==void 0,r=k(),s=!he()||r!==null&&r!==""&&r!==void 0,c=n.valid!==void 0?n.valid:s;return{customError:e,valid:c,valueMissing:r===null}},dt=()=>n.validityStyles!==void 0?n.validityStyles:P.validityStyles,oe=e=>{se.current=!0,e.focus(),window.setTimeout(()=>se.current=!1,30)},we=()=>{X.current&&oe(X.current),n.adaptive&&setTimeout(()=>{X.current&&oe(X.current)},300)},ct=a.useCallback(e=>{for(const r of e)Ft(r.target.clientWidth)},[]),Oe=()=>{var e;(e=ke.current)!=null&&e.setCustomValidity&&ke.current.setCustomValidity(Ie().valid?"":n.validationMessage||en)},q=(e,r)=>{const s=k();d.areSame(s,e,n.dataItemKey)||(n.value===void 0&&(r.data.value=e),t.current.updateComponentArgs({value:e}),A.current=e,r.events.push({type:"onChange"}))},K=e=>{var r;(r=t==null?void 0:t.current)==null||r.applyState(e),A.current=void 0},Q=(e,r)=>{var m;const{virtual:s,dataItemKey:c,defaultItem:l}=n,p=d.getFilteredData(n),g=s?s.skip:0,v=k(),u=e===-1&&l!==void 0?l:p[e-g],y=!d.areSame(u,v,c);q(u,r),y&&((m=t==null?void 0:t.current)==null||m.triggerPageChangeCornerItems(u,r))},z=(e,r,s)=>{var C,D;const{defaultItem:c,dataItemKey:l,virtual:p={skip:0,total:0,pageSize:0}}=n,g=k(),v=d.getFilteredData(n),u=(C=t==null?void 0:t.current)==null?void 0:C.vs,y=v.findIndex(h=>d.areSame(h,g,l)),m=(D=t==null?void 0:t.current)==null?void 0:D.navigation.navigate({current:p.skip+y,max:(u!=null&&u.enabled?p.total:v.length)-1,min:c!==void 0?-1:0,keyCode:r,skipItems:s||void 0});m!==void 0&&Q(m,e),K(e)},ut=e=>{V.current=e,t.current.wrapper=e},pt=e=>a.createElement("select",{name:n.name,ref:r=>{ke.current=r},tabIndex:-1,"aria-hidden":!0,title:n.label,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},a.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,e):e})),Se=()=>{const{textField:e,dataItemKey:r,virtual:s={skip:0},focusedItemIndex:c=d.itemIndexStartsWith,filterable:l,skipDisabledItems:p=!0}=n,g=k(),v=d.getFilteredData(n),u=n.filter?n.filter:f.text;return p&&e&&!u&&!g?v.findIndex(y=>!y.disabled):d.isPresent(g)&&u===void 0||l&&u===""?v.findIndex(y=>d.areSame(y,g,r)):u?be.current?c(v,u,e):v.findIndex(y=>d.areSame(y,g,r)):s.skip===0?0:-1},Te=(e,r)=>r!==void 0&&r!==-1&&e&&e.length>0&&e[r].disabled,xe=()=>{const e=d.getFilteredData(n),r=t.current.initState(),s=Se();Te(e,s)&&(q(null,r),K(r))},Ce=e=>{if(e.isPropagationStopped())return;const r=t.current.initState();r.syntheticEvent=e,f.focused||(r.data.focused=!0),xe(),t.current.togglePopup(r),K(r)},qe=e=>{var N,me,U,ge,$,Ze,et;e&&e.target instanceof Element&&e.target.nodeName==="INPUT"&&e.stopPropagation&&e.stopPropagation();const{filterable:r,disabled:s,defaultItem:c,leftRightKeysNavigation:l=!0,virtual:p={skip:0,total:0,pageSize:0},dataItemKey:g,groupField:v="",textField:u,skipDisabledItems:y=!0}=n,m=d.getFilteredData(n),C=k(),D=m.findIndex(w=>d.areSame(w,C,g)),h=n.opened!==void 0?n.opened:f.opened,i=e.keyCode,F=i===o.Keys.home||i===o.Keys.end,b=i===o.Keys.up||i===o.Keys.down,j=!h&&(e.altKey&&i===o.Keys.down||i===o.Keys.enter||i===o.Keys.space),ne=h&&(e.altKey&&i===o.Keys.up||i===o.Keys.esc),ue=l&&(i===o.Keys.left||i===o.Keys.right),pe=b||ue&&!r||F,I=t.current.initState();if(I.syntheticEvent=e,!s){if(F&&((N=t==null?void 0:t.current)!=null&&N.vs.enabled))i===o.Keys.home?p.skip!==0?((me=t==null?void 0:t.current)==null||me.triggerOnPageChange(I,0,p.pageSize),B.current=!0):q(m[0],I):p.skip<p.total-p.pageSize?((U=t==null?void 0:t.current)==null||U.triggerOnPageChange(I,p.total-p.pageSize,p.pageSize),B.current=!0):q(m[m.length-1],I);else if(h&&i===o.Keys.pageUp)e.preventDefault(),(ge=t==null?void 0:t.current)==null||ge.scrollPopupByPageSize(-1);else if(h&&i===o.Keys.pageDown)e.preventDefault(),($=t==null?void 0:t.current)==null||$.scrollPopupByPageSize(1);else if(h&&i===o.Keys.enter){const w=Se();Te(m,w)?(q(null,I),K(I)):Q(w,I),(Ze=t==null?void 0:t.current)==null||Ze.togglePopup(I),e.preventDefault()}else if(j||ne)ne&&xe(),(et=t==null?void 0:t.current)==null||et.togglePopup(I),e.preventDefault();else if(pe){if(be.current=!1,v!==""&&u)if(!y&&h)z(I,i);else{let w;if(i===o.Keys.down||i===o.Keys.right){const S=m.slice(D+1).find(x=>!x.disabled);w=S&&m.indexOf(S)}else if(i===o.Keys.up||i===o.Keys.left){let S;if(D===0&&c)w=-1;else if(D===-1)S=m,w=m.findIndex(x=>!x.disabled);else{S=m.slice(0,D);let x=S.pop();for(;x&&x.disabled;)x=S.pop();w=x&&m.indexOf(x)}}if(w!==void 0){const S=w-D;z(I,i,S)}else w===void 0&&D===m.length-1&&z(I,i)}else if(!y&&h||F)z(I,i);else if(u){let w;if(i===o.Keys.down||i===o.Keys.right){const S=m.slice(D+1).find(x=>!x.disabled);w=S&&m.indexOf(S)}else if(i===o.Keys.up||i===o.Keys.left){let S;if(D===0&&c)w=-1;else if(D===-1)S=m,w=m.findIndex(x=>!x.disabled);else{S=m.slice(0,D);let x=S.pop();for(;x&&x.disabled;)x=S.pop();w=x&&m.indexOf(x)}}if(w!==void 0){const S=w-D;z(I,i,S)}else w===void 0&&D===m.length-1&&z(I,i)}else z(I,i);e.preventDefault()}K(I)}},mt=e=>{const r=t.current.initState();r.syntheticEvent=e.syntheticEvent,n.filter===void 0&&(r.data.text=e.target.value),t.current.filterChanged(e.target.value,r),be.current=!0,K(r),ee({group:void 0,text:String(e.target.value)})},ze=e=>{const r=n.filter!==void 0?n.filter:f.text;return n.filterable&&a.createElement(jt,{value:r,ref:s=>{X.current=s&&s.element},onChange:mt,onKeyDown:qe,size:e?"large":T,rounded:Me,fillMode:ve,renderListFilterWrapper:!0,placeholder:We.toLanguageString(R.dropDownListAdaptiveFilterPlaceholder,R.messages[R.dropDownListAdaptiveFilterPlaceholder])})},gt=e=>{var s;const r=t.current.initState();r.syntheticEvent=e,(s=t==null?void 0:t.current)==null||s.togglePopup(r),q(n.defaultItem,r),K(r)},ft=()=>{const{textField:e,defaultItem:r,dataItemKey:s}=n,c=k();return r!==void 0&&a.createElement($t,{defaultItem:r,textField:e,selected:d.areSame(c,r,s),key:"defaultitemkey",onClick:gt})},vt=(e,r)=>{var s;(s=t==null?void 0:t.current)==null||s.handleItemClick(e,r),A.current=void 0},yt=e=>{const{vs:r,list:s}=t.current;r.scrollHandler(e);const{groupField:c}=n;let l=d.getFilteredData(n);if(!(!c||!l.length)&&c){const p=Be.current=Be.current||(r.enabled?r.itemHeight:s?s.children[0].offsetHeight:0),v=e.target.scrollTop-r.skip*p;l=t.current.getGroupedDataModernMode(l,c);let u=l[0][c];for(let y=1;y<l.length&&!(p*y>v);y++)l[y]&&l[y][c]&&(u=l[y][c]);u!==f.group&&ee({group:u})}},Ve=()=>{var i;const{textField:e,dataItemKey:r,virtual:s={skip:0,total:void 0},groupHeaderItemRender:c,listNoDataRender:l,itemRender:p}=n,g=d.getFilteredData(n),v=E&&E.uDropDownList,u=t.current.vs,y=s.skip,m=n.opened!==void 0?n.opened:f.opened,C=t.current.getPopupSettings(),D=`translateY(${u.translate}px)`,h=k();return a.createElement(Rt,{id:Fe,show:m,data:g.slice(),focusedIndex:Se(),value:h,textField:e,valueField:r,optionsGuid:Ge,groupField:n.groupField,listRef:F=>{u.list=t.current.list=F},wrapperStyle:{maxHeight:_?void 0:C.height},wrapperCssClass:o.classNames(o.uDropDownList.listContent({c:v})),listStyle:u.enabled?{transform:D}:void 0,key:"listkey",skip:y,onClick:vt,itemRender:p,groupHeaderItemRender:c,noDataRender:l,onScroll:yt,wrapperRef:u.scrollerRef,scroller:(i=t==null?void 0:t.current)==null?void 0:i.renderScrollElement(),ariaSetSize:s.total})},Dt=()=>{const{groupField:e}=n,r=d.getFilteredData(n),s=n.opened!==void 0?n.opened:f.opened,c=E&&E.uDropDownList,l={title:n.adaptiveTitle||n.label,subTitle:n.adaptiveSubtitle,expand:s,onClose:g=>Ce(g),windowWidth:Ee,mobileFilter:ze(!0)};let{group:p}=f;return p===void 0&&e!==void 0&&(p=d.getItemValue(r[0],e)),a.createElement(Xt.AdaptiveMode,{...l},a.createElement(Qt.ActionSheetContent,null,a.createElement("div",{className:o.classNames(o.uDropDownList.listContainer({c,popup:!1}))},St())))},ht=()=>{f.focused&&window.setTimeout(()=>{f.focused&&t.current.wrapper&&oe(t.current.wrapper)})},It=e=>{"onMouseDownOutside"in(n.popupSettings||{})&&n.popupSettings.onMouseDownOutside.call(void 0,e)},wt=()=>{const{header:e,footer:r,dir:s,groupField:c,groupStickyHeaderItemRender:l,list:p}=n,g=d.getFilteredData(n),v=t.current,u=v.getPopupSettings(),y=n.opened!==void 0?n.opened:f.opened,m=u.width!==void 0?u.width:v.popupWidth,C=E&&E.uDropDownList,D={dir:s!==void 0?s:v.dirCalculated,width:m,popupSettings:{...u,popupClass:o.classNames(u.popupClass,o.uDropDownList.listContainer({c:C,popup:!0})),anchor:u.anchor||V.current,show:y,onOpen:we,onClose:ht,onMouseDownOutside:It},itemsCount:[g.length]};let{group:h}=f;return h===void 0&&c!==void 0&&(h=d.getItemValue(g[0],c)),a.createElement(Gt,{...D},ze(!1),e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:C}))},e),a.createElement("div",{className:o.classNames(o.uDropDownList.list({c:C,size:T,virtual:t.current.vs.enabled}))},ft(),!p&&h&&g.length!==0&&a.createElement(tt,{group:h,render:l}),Ve()),r&&a.createElement("div",{className:o.classNames(o.uDropDownList.listFooter({c:C}))},r),O&&a.createElement(o.WatermarkOverlay,{message:re}))},St=()=>{const{header:e,footer:r,groupStickyHeaderItemRender:s,groupField:c,list:l}=n,p=d.getFilteredData(n),g=E&&E.uDropDownList;let{group:v}=f;return v===void 0&&c!==void 0&&(v=d.getItemValue(p[0],c)),a.createElement(a.Fragment,null,e&&a.createElement("div",{className:o.classNames(o.uDropDownList.listHeader({c:g}))},e),a.createElement("div",{className:o.classNames("k-list",{[`k-list-${_?"lg":o.sizeMap[T]||T}`]:_||T})},!l&&v&&p.length!==0&&a.createElement(tt,{group:v,render:s}),Ve()),r&&a.createElement("div",{className:"k-list-footer"},r))},xt=e=>{const{dataItemKey:r}=n,s=d.getFilteredData(n),c=k();let l=s.map((b,j)=>({item:b,itemIndex:j}));const p=G.current.word,g=G.current.last,v=d.sameCharsOnly(p,g);let u=l.length,y=Math.max(0,s.findIndex(b=>d.areSame(b,c,r))),m;n.defaultItem&&(m={item:n.defaultItem,itemIndex:-1},u+=1,y+=1),y+=v?1:0,l=d.shuffleData(l,y,m);let C,D,h,i=0;const{textField:F}=n;for(;i<u;){if(C=d.getItemValue(l[i].item,F),D=v&&d.matchText(C,g,J),h=d.matchText(C,p,J),D||h){i=l[i].itemIndex;break}i++}if(i!==u){const b=t.current.initState();b.syntheticEvent=e,Q(i,b),K(b),A.current=void 0}},Ct=e=>{clearTimeout(Ae.current),n.filterable||(Ae.current=window.setTimeout(()=>G.current.word="",st),xt(e))},Lt=e=>{se.current||t.current.handleFocus(e)},kt=e=>{if(se.current||!f.focused)return;const r=n.opened!==void 0?n.opened:f.opened,s=t.current.initState();s.syntheticEvent=e,s.data.focused=!1,s.events.push({type:"onBlur"}),r&&xe(),r&&!_&&t.current.togglePopup(s),K(s)},bt=e=>{if(n.filterable||e.which===0||e.keyCode===o.Keys.enter)return;let r=String.fromCharCode(e.charCode||e.keyCode);J&&(r=r.toLowerCase()),r===" "&&e.preventDefault(),G.current={word:G.current.word+r,last:G.current.last+r},Ct(e)},Kt=()=>{const e=t.current.initState();e.data.opened=f.opened,t.current.togglePopup(e),K(e)},Le=a.useRef(null),V=a.useRef(null),ke=a.useRef(null),X=a.useRef(null);a.useImperativeHandle(Le,()=>({get element(){return V.current},get index(){return lt()},get name(){return n.name},get validity(){return Ie()},get value(){return k()},get focused(){return f.focused},get opened(){return f.opened},focus:it,props:n,togglePopup:Kt})),a.useImperativeHandle(Y,()=>Le.current),o.useWebMcpRegister("dropdownlist",Le,n,n.webMcp);const Ae=a.useRef(null),G=a.useRef({word:"",last:""}),se=a.useRef(!1),A=a.useRef(null),B=a.useRef(!1),be=a.useRef(!1),H=a.useRef({}),Ke=a.useRef({}),t=a.useRef(new rt({props:n,setState:()=>{},state:{},forceUpdate:()=>{},element:null,value:null,handleItemSelect:()=>{}})),Be=a.useRef(0),Z=a.useRef(null),[f,Et]=a.useState({}),[Ee,Ft]=a.useState(),[,He]=a.useReducer(e=>e,!0),We=Jt.useLocalization(),_e=n.name||n.id,Pt=a.useCallback(e=>{if(e==null||!t.current)return;const r=d.getFilteredData(n),{textField:s}=n,c=String(e),l=d.getItemIndexByText(r,c,s,!1,J),p=l!==-1?r[l]:void 0;if(p!==void 0){const g=t.current.initState();g.syntheticEvent={target:V.current},q(p,g),K(g)}},[n,J]);o.useKendoPaste(V,{fieldName:_e,onValueChange:Pt,enabled:!!_e});const ee=e=>{Et({...f,...e})};a.useEffect(()=>{t.current.updateComponentArgs({props:n,setState:ee,state:f,forceUpdate:He,element:V.current,handleItemSelect:Q,value:k()})},[ee,f,He,Q,k]),a.useEffect(()=>{var y,m,C,D,h,i,F,b,j,ne,ue,pe,I;const{dataItemKey:e,virtual:r,groupField:s="",textField:c}=n,l=d.getFilteredData(n),p=H.current.virtual?H.current.virtual.total:0,g=n.opened!==void 0?n.opened:f.opened,v=H.current.opened!==void 0?H.current.opened:Ke.current.opened,u=!v&&g;if((y=t==null?void 0:t.current)==null||y.didUpdate(),(m=t==null?void 0:t.current)!=null&&m.getPopupSettings().animate||u&&we(),r&&r.total!==p)(C=t==null?void 0:t.current)==null||C.vs.calcScrollElementHeight(),(D=t==null?void 0:t.current)==null||D.vs.reset();else{const N=k(),me=H.current.value!==void 0?H.current.value:Ke.current.value;let U=l.findIndex($=>d.areSame($,N,e));s!==""&&N&&c&&(U=(i=(h=t==null?void 0:t.current)==null?void 0:h.getGroupedDataModernMode(l,s))==null?void 0:i.map($=>$[c]).indexOf(N[c]));const ge=!d.areSame(me,N,e);u&&r?(F=t==null?void 0:t.current)==null||F.scrollToVirtualItem(r,U):u&&!r?(we(),l&&l.length!==0&&((b=t==null?void 0:t.current)==null||b.resetGroupStickyHeader(l[0][s],{setState:ee,group:f.group,state:f})),(j=t==null?void 0:t.current)==null||j.scrollToItem(U)):g&&v&&N&&ge&&!B.current?(ue=t==null?void 0:t.current)==null||ue.scrollToItem(U,(ne=t==null?void 0:t.current)==null?void 0:ne.vs.enabled):g&&v&&B.current&&(B.current&&r&&r.skip===0?(pe=t==null?void 0:t.current)==null||pe.vs.reset():B.current&&r&&r.skip===r.total-r.pageSize&&((I=t==null?void 0:t.current)==null||I.vs.scrollToEnd()))}B.current=!1,Ke.current=f,H.current=n,Oe()}),a.useEffect(()=>{var e,r;return Z.current=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(ct.bind(void 0)),(e=t==null?void 0:t.current)==null||e.didMount(),Oe(),(r=De())!=null&&r.body&&Z.current&&Z.current.observe(De().body),()=>{var s;(s=De())!=null&&s.body&&Z.current&&Z.current.disconnect()}},[]);const Ue=ye+"-accessibility-id",Fe=ye+"-listbox-id",Ge=ye+"-guid",Nt=We.toLanguageString(R.dropDownListArrowBtnAriaLabel,R.messages[R.dropDownListArrowBtnAriaLabel]),{style:ae,className:Mt,label:Pe,dir:Ot,virtual:W,adaptive:tn,dataItemKey:Tt,disabled:ie,loading:je,iconClassName:$e,svgIcon:qt,valueRender:Re}=n,le=n.opened!==void 0?n.opened:f.opened,de=k(),Ne=d.getItemValue(de,n.textField),Ye=!dt()||Ie().valid,ce=t.current,zt=ce.vs,te=E&&E.uDropDownList;zt.enabled=W!==void 0;const Je=o.useAdaptiveModeContext(),_=!!(Ee&&Je&&Ee<=Je.medium&&n.adaptive);W!==void 0&&(ce.vs.skip=W.skip,ce.vs.total=W.total,ce.vs.pageSize=W.pageSize);const Vt=d.getFilteredData(n),{focused:At}=f,Bt=Vt.findIndex(e=>d.areSame(e,de,Tt)),Qe=a.createElement("span",{id:Ue,className:o.classNames(o.uDropDownList.inputInner({c:te}))},Ne&&a.createElement("span",{className:o.classNames(o.uDropDownList.inputText({c:te}))},Ne)),Ht=Re!==void 0?Re.call(void 0,Qe,de):Qe,Xe=a.createElement(a.Fragment,null,a.createElement("span",{ref:ut,className:o.classNames(o.uDropDownList.wrapper({c:te,size:T,rounded:Me,fillMode:ve,focused:At,disabled:ie,invalid:!Ye,loading:je,required:he()}),Mt),style:Pe?{...ae,width:void 0}:ae,dir:Ot,onMouseDown:le?e=>{e.target.nodeName!=="INPUT"&&(oe(t.current.wrapper),e.preventDefault())}:void 0,onFocus:_?e=>Ce(e):Lt,onBlur:kt,tabIndex:o.getTabIndex(at,ie),accessKey:n.accessKey,onKeyDown:qe,onKeyPress:bt,onClick:ie?void 0:Ce,role:"combobox","aria-required":he(),"aria-disabled":ie||void 0,"aria-haspopup":"listbox","aria-expanded":le||!1,"aria-owns":Fe,"aria-activedescendant":le?"option-"+Ge+"-"+(Bt+(W?W.skip:0)):void 0,"aria-label":n.ariaLabel||n.label,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy||Ue,"aria-controls":le?Fe:void 0,id:n.id,title:n.title},Ht,je&&a.createElement(o.IconWrap,{className:o.classNames(o.uDropDownList.loadingIcon({c:te})),name:"loading"}),a.createElement(Yt.Button,{tabIndex:-1,type:"button","aria-label":Nt,size:T,fillMode:ve,className:o.classNames(o.uDropDownList.inputButton({c:te})),iconClass:$e,svgIcon:$e?void 0:qt||Ut.chevronDownIcon,onMouseDown:e=>f.focused&&e.preventDefault()}),pt(de),!_&&wt()),_&&Dt());return Pe?a.createElement(_t.FloatingLabel,{label:Pe,editorValue:Ne,editorValid:Ye,editorDisabled:n.disabled,style:{width:ae?ae.width:void 0},children:Xe}):Xe});fe.propTypes={delay:L.number,ignoreCase:L.bool,iconClassName:L.string,svgIcon:o.svgIconPropType,defaultItem:L.any,valueRender:L.func,valueMap:L.func,validationMessage:L.string,required:L.bool,id:L.string,ariaLabelledBy:L.string,ariaDescribedBy:L.string,ariaLabel:L.string,leftRightKeysNavigation:L.bool,title:L.string,groupField:L.string,list:L.any,skipDisabledItems:L.bool};const P={delay:500,tabIndex:0,ignoreCase:!0,...rt.defaultProps,required:!1,size:void 0,rounded:void 0,fillMode:void 0};fe.displayName="KendoReactDropDownList";const ot=o.createPropsContext();fe.displayName="KendoReactDropDownList";exports.DropDownList=fe;exports.DropDownListPropsContext=ot;exports.dropDownListDefaultProps=P;
|