@progress/kendo-react-dropdowns 14.5.0-develop.14 → 14.5.0-develop.15
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.d.ts +4 -23
- package/AutoComplete/AutoComplete.js +1 -1
- package/AutoComplete/AutoComplete.mjs +206 -196
- package/AutoComplete/AutoCompleteProps.d.ts +12 -0
- package/ComboBox/ComboBox.d.ts +1 -1
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +224 -224
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +253 -252
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +202 -196
- package/DropDownTree/DropDownTreeProps.d.ts +12 -0
- package/MultiSelect/MultiSelect.d.ts +2 -1
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +182 -175
- package/MultiSelect/TagList.js +1 -1
- package/MultiSelect/TagList.mjs +1 -1
- package/MultiSelectTree/MultiSelectTree.js +1 -1
- package/MultiSelectTree/MultiSelectTree.mjs +237 -221
- package/MultiSelectTree/MultiSelectTreeProps.d.ts +12 -0
- package/common/ClearButton.js +1 -1
- package/common/ClearButton.mjs +6 -7
- package/common/List.d.ts +1 -0
- package/common/List.js +1 -1
- package/common/List.mjs +84 -81
- package/common/ListFilter.js +1 -1
- package/common/ListFilter.mjs +20 -17
- package/common/SearchBar.d.ts +1 -0
- package/common/SearchBar.js +1 -1
- package/common/SearchBar.mjs +7 -7
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/messages/index.d.ts +14 -4
- package/messages/index.js +1 -1
- package/messages/index.mjs +15 -11
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
package/MultiSelect/TagList.js
CHANGED
|
@@ -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";const f=require("react"),m=require("@progress/kendo-react-buttons");function g(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return o.default=e,Object.freeze(o)}const s=g(f),v=e=>e.syntheticEvent.preventDefault(),h=e=>e.syntheticEvent.stopPropagation();class y extends s.Component{render(){const{data:o,guid:n,focused:r,tagRender:i,tag:l,onTagDelete:u,size:p}=this.props;return s.createElement(s.Fragment,null,o.map((t,c)=>{const a=l?s.createElement(l,{key:t.text+c,tagData:t,guid:n,focusedTag:r,onTagDelete:u}):s.createElement(m.Chip,{id:`tag-${n}-${t.text?t.text.replace(/\s+/g,"-"):c}`,
|
|
8
|
+
"use strict";const f=require("react"),m=require("@progress/kendo-react-buttons");function g(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return o.default=e,Object.freeze(o)}const s=g(f),v=e=>e.syntheticEvent.preventDefault(),h=e=>e.syntheticEvent.stopPropagation();class y extends s.Component{render(){const{data:o,guid:n,focused:r,tagRender:i,tag:l,onTagDelete:u,size:p}=this.props;return s.createElement(s.Fragment,null,o.map((t,c)=>{const a=l?s.createElement(l,{key:t.text+c,tagData:t,guid:n,focusedTag:r,onTagDelete:u}):s.createElement(m.Chip,{id:`tag-${n}-${t.text?t.text.replace(/\s+/g,"-"):c}`,ariaSelected:!0,role:"option","aria-setsize":o.length,key:t.text+c,text:t.text,removable:!0,onRemove:d=>u.call(void 0,t.data,d.syntheticEvent),onMouseDown:v,onClick:h,className:t===r?"k-focus":void 0,size:p});return i?i(t,a):a}),this.props.children)}}module.exports=y;
|
package/MultiSelect/TagList.mjs
CHANGED
|
@@ -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 nt=require("react"),a=require("prop-types"),s=require("@progress/kendo-react-common"),at=require("@progress/kendo-react-popup"),it=require("@progress/kendo-react-intl"),Ie=require("@progress/kendo-react-treeview"),Te=require("../package-metadata.js"),Z=require("../common/utils.js"),st=require("../DropDownTree/useDropdownWidth.js"),rt=require("../DropDownTree/ListNoData.js"),P=require("../messages/index.js"),ot=require("@progress/kendo-react-labels"),lt=require("../MultiSelect/TagList.js"),ct=require("../common/ClearButton.js"),Ke=require("../common/ListFilter.js"),ut=require("../common/AdaptiveMode.js"),dt=require("@progress/kendo-react-layout");function pt(m){const h=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const t in m)if(t!=="default"){const w=Object.getOwnPropertyDescriptor(m,t);Object.defineProperty(h,t,w.get?w:{enumerable:!0,get:()=>m[t]})}}return h.default=m,Object.freeze(h)}const n=pt(nt),ft="Please select a value from the list!",{sizeMap:Me,roundedMap:gt}=s.kendoThemeMaps,vt=m=>m.split("_").map(h=>parseInt(h,10)),mt=(m,h)=>{const{validationMessage:t,valid:w,required:ee}=m;return{customError:t!==void 0,valid:!!(w!==void 0?w:!ee||h),valueMissing:!h}},k={checkField:"checkField",checkIndeterminateField:"checkIndeterminateField",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},size:void 0,rounded:void 0,fillMode:void 0,required:!1,validityStyles:!0},Re=s.createPropsContext(),ce=n.forwardRef((m,h)=>{const t=s.usePropsContext(Re,m),w=!s.validatePackage(Te.packageMetadata,{component:"MultiSelectTree"}),ee=s.getLicenseMessage(Te.packageMetadata),De=s.useId(),N=t.id||De,{data:B=[],dataItemKey:I,style:L={},placeholder:te,label:V,name:qe,validationMessage:z,valid:Oe,tags:ue,value:g,opened:T,disabled:F,popupSettings:q=k.popupSettings,checkField:de=k.checkField,checkIndeterminateField:pe=k.checkIndeterminateField,subItemsField:fe=k.subItemsField,size:C=k.size,rounded:W=k.rounded,fillMode:A=k.fillMode,required:ge=k.required,validityStyles:Pe=k.validityStyles,onOpen:ne=s.noop,onClose:j=s.noop}=t,_=s.getTabIndex(t.tabIndex,F),r=n.useRef(null),E=n.useRef(null),K=n.useRef(null),ae=n.useRef(null),$=n.useRef(null),x=n.useRef(null),H=n.useRef(!1),G=n.useRef([]),U=n.useRef(null),[O,Ne]=n.useState(),[Le,ve]=n.useState(!1),[d,ie]=n.useState(!1),[se,Ve]=n.useState(),[We,Be]=n.useState([]),[me,ze]=n.useState(""),l=T!==void 0?T:Le,re=!!(Array.isArray(g)&&g.length),oe=mt({validationMessage:z,valid:Oe,required:ge},re),M=s.useRtl(E,t.dir),Ae={width:st.useDropdownWidth(E,k,q,L),...M!==void 0?{direction:M}:{}},je=n.useCallback(()=>E.current&&E.current.focus(),[]),he=s.useAdaptiveModeContext(),R=!!(se&&he&&se<=he.medium&&t.adaptive);G.current=ue===void 0?(g||[]).map(e=>({text:Z.getItemValue(e,t.textField),data:[e]})):[...ue],n.useImperativeHandle(r,()=>({props:t,element:E.current,focus:je})),n.useImperativeHandle(h,()=>r.current);const _e=n.useCallback(()=>{$.current&&$.current.setCustomValidity&&$.current.setCustomValidity(oe.valid?"":z===void 0?ft:z)},[z,oe]);n.useEffect(_e),n.useEffect(()=>{const e=s.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(et.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{e&&e.disconnect()}},[]),n.useEffect(()=>{U.current&&l&&U.current.setPosition(U.current.element)},[g,l]);const S=n.useCallback((e,i,o)=>{if(t.onChange){const b={items:i,operation:o,...e};t.onChange.call(void 0,b)}},[t.onChange]),J=n.useCallback(e=>{if(Z.areSame(e.item,g,I)||!r.current)return;const{item:i,nativeEvent:o,syntheticEvent:b}=e,D={syntheticEvent:b,nativeEvent:o,target:r.current};S(D,[i],"toggle")},[g,I,S]),Q=n.useCallback(e=>{if(!l){if(ne){const i={...e};ne.call(void 0,i)}T===void 0&&(ve(!0),Be(g||[]),R&&setTimeout(()=>{var i;u((i=ae.current)==null?void 0:i.element)},300))}},[l,T,ne,R,ae]),v=n.useCallback(e=>{if(l){if(j){const i={...e};j.call(void 0,i)}T===void 0&&ve(!1)}},[l,T,j]),y=n.useCallback(e=>{H.current=!0,e(),window.setTimeout(()=>H.current=!1,0)},[]),u=n.useCallback(e=>{e&&y(()=>e.focus())},[y]),$e=n.useCallback(()=>{var e;!d&&l?v({target:r.current}):t.filterable?u((e=K.current)==null?void 0:e.element):u(x.current&&x.current.element)},[d,l,u,v,t.filterable]),He=n.useCallback(()=>{d&&u(E.current)},[d,u]),Ge=n.useCallback(e=>{if(!d&&!H.current&&(ie(!0),t.onFocus&&r.current)){const i={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};t.onFocus.call(void 0,i)}},[d,t.onFocus]),Ue=n.useCallback(e=>{if(d&&!H.current&&r.current){ie(!1);const i={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};if(t.onBlur){const o={...i};t.onBlur.call(void 0,o)}R||v(i)}},[d,t.onBlur,l,T,j]),Je=n.useCallback(()=>{d&&y(s.noop)},[d,y]),ye=n.useCallback(e=>{if(!e.isDefaultPrevented()&&r.current){ie(!0);const i={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};l||Q(i)}},[l,Q]),Qe=n.useCallback(e=>{var Y,we;const{keyCode:i,altKey:o}=e,b=x.current&&x.current.element;if(!r.current||e.isDefaultPrevented()&&((Y=K.current)==null?void 0:Y.element)===e.target)return;const D={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};if(g&&g.length>0&&(i===s.Keys.left||i===s.Keys.right||i===s.Keys.home||i===s.Keys.end||i===s.Keys.delete)){const c=G.current;let p=O?c.findIndex(tt=>Z.matchTags(tt,O,I)):-1,f;const le=p!==-1;i===s.Keys.left?(le?p=Math.max(0,p-1):p=c.length-1,f=c[p]):i===s.Keys.right?p===c.length-1?f=void 0:le&&(p=Math.min(c.length-1,p+1),f=c[p]):i===s.Keys.home?f=c[0]:i===s.Keys.end?f=c[c.length-1]:i===s.Keys.delete&&le&&S(D,c[p].data,"delete"),f!==O&&Ne(f)}if(l)if(i===s.Keys.esc||o&&i===s.Keys.up)e.preventDefault(),v(D);else if(b&&b.querySelector(".k-focus")&&(i===s.Keys.up||i===s.Keys.down||i===s.Keys.left||i===s.Keys.right||i===s.Keys.home||i===s.Keys.end)){if(i===s.Keys.up&&((we=K.current)!=null&&we.element)){const c=Array.from(b.querySelectorAll(".k-treeview-item")),p=[...c].reverse().find(f=>!!(f&&f.querySelector(".k-focus")));if(p&&c.indexOf(p)===0)return y(()=>{var f;u((f=K.current)==null?void 0:f.element)})}y(s.noop)}else i===s.Keys.down&&y(()=>{var c;u(((c=K.current)==null?void 0:c.element)||b)});else o&&i===s.Keys.down&&(e.preventDefault(),Q(D))},[l,v,u,y,Q,O,I,g,S]),be=n.useCallback(e=>{const{keyCode:i,altKey:o}=e;o||i!==s.Keys.up&&i!==s.Keys.down||(e.preventDefault(),y(i===s.Keys.up?()=>{u(E.current)}:()=>{u(x.current&&x.current.element)}))},[u,y]),Xe=n.useCallback(e=>{if(!r.current)return;const i={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};S(i,[],"clear"),v(i),e.preventDefault()},[S,v]),Ye=n.useCallback((e,i)=>{var o;v({target:r.current}),d||u((o=K.current)==null?void 0:o.element),S({syntheticEvent:i,nativeEvent:i.nativeEvent,target:r.current},e,"delete")},[S,v,u,d]),ke=n.useCallback(e=>{if(t.onExpandChange&&r.current){const{item:i,itemHierarchicalIndex:o,nativeEvent:b,syntheticEvent:D}=e,Y={level:vt(o),item:i,nativeEvent:b,syntheticEvent:D,target:r.current};t.onExpandChange.call(void 0,Y)}},[t.onExpandChange]),Ce=n.useCallback(e=>{if(t.onFilterChange&&r.current){const o={filter:{field:t.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:r.current};t.onFilterChange.call(void 0,o),t.filter===void 0&&ze(e.target.value)}},[t.onFilterChange,t.filter,t.textField]);n.useCallback(e=>{if(!r.current)return;const i={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};t.onCancel&&t.onCancel.call(void 0,i),v(i),e.preventDefault()},[t.onCancel,v]);const Ze=()=>{const e=t.filterable?n.createElement(Ke,{value:t.filter===void 0?me:t.filter,ref:ae,onChange:Ce,onKeyDown:be,size:"large",rounded:W,fillMode:A,placeholder:te}):null,i={title:t.adaptiveTitle||t.label,subTitle:t.adaptiveSubtitle,expand:l,onClose:o=>v(o),windowWidth:se,mobileFilter:e};return n.createElement(ut.AdaptiveMode,{...i},n.createElement(dt.ActionSheetContent,null,B.length>0?n.createElement(Ie.TreeView,{ref:x,animate:!1,tabIndex:_,data:B,focusIdField:I,textField:t.textField,checkField:de,checkIndeterminateField:pe,expandField:t.expandField,childrenField:fe,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:ke,checkboxes:!0,size:"large",item:t.item,dir:M}):n.createElement(Ee,null,Fe.toLanguageString(P.nodata,P.messages[P.nodata]))))},et=n.useCallback(e=>{for(const i of e)Ve(i.target.clientWidth)},[]),Ee=t.listNoData||rt.ListNoData,Fe=it.useLocalization(),xe=!Pe||oe.valid,X=R&&l?We:G.current,Se=n.createElement(n.Fragment,null,n.createElement("span",{className:s.classNames("k-multiselecttree k-input",t.className,{[`k-input-${Me[C]||C}`]:C,[`k-rounded-${gt[W]||W}`]:W,[`k-input-${A}`]:A,"k-focus":d&&!F,"k-invalid":!xe,"k-disabled":F,"k-loading":t.loading,"k-required":ge}),tabIndex:_,accessKey:t.accessKey,id:N,style:V?{...L,width:void 0}:L,dir:M,ref:E,onKeyDown:F?void 0:Qe,onMouseDown:Je,onFocus:e=>{R?ye(e):Ge(e)},onBlur:Ue,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":F,"aria-label":V,"aria-labelledby":t.ariaLabelledBy,"aria-describedby":t.ariaDescribedBy?t.ariaDescribedBy:"tagslist-"+N,"aria-required":t.required,onClick:F?void 0:ye},n.createElement("div",{id:"tagslist-"+N,className:s.classNames("k-input-values k-chip-list",{[`k-chip-list-${Me[C]||C}`]:C})},X.length>0&&n.createElement(lt,{tag:t.tag,onTagDelete:Ye,data:X,guid:N,focused:O?G.current.find(e=>Z.matchTags(e,O,I)):void 0,size:C})),n.createElement("span",{className:"k-input-inner"},X.length===0&&n.createElement("span",{className:"k-input-value-text"},te)),t.loading&&n.createElement(s.IconWrap,{className:"k-input-loading-icon",name:"loading"}),re&&!F&&X.length>0&&n.createElement(ct,{onClick:Xe}),n.createElement("select",{name:qe,ref:$,tabIndex:-1,"aria-hidden":!0,title:V,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},n.createElement("option",{value:t.valueMap?t.valueMap.call(void 0,g):g})),!R&&n.createElement(at.Popup,{...q,popupClass:s.classNames(q.popupClass,"k-multiselecttree-popup"),className:s.classNames(q.className,{"k-rtl":M==="rtl"}),style:Ae,anchor:q.anchor||E.current,show:l,onOpen:$e,onClose:He,ref:U},t.filterable&&n.createElement(Ke,{value:t.filter===void 0?me:t.filter,ref:K,onChange:Ce,onKeyDown:be,tabIndex:_,size:C,rounded:W,fillMode:A,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),B.length>0?n.createElement(Ie.TreeView,{style:{height:q.height},animate:!1,ref:x,tabIndex:_,data:B,focusIdField:I,textField:t.textField,checkField:de,checkIndeterminateField:pe,expandField:t.expandField,childrenField:fe,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:ke,checkboxes:!0,size:C,item:t.item,dir:M}):n.createElement(Ee,null,Fe.toLanguageString(P.nodata,P.messages[P.nodata])),w&&n.createElement(s.WatermarkOverlay,{message:ee}))),R&&Ze());return V?n.createElement(ot.FloatingLabel,{label:V,editorValue:re,editorPlaceholder:te,editorValid:xe,editorDisabled:F,editorId:N,style:{width:L?L.width:void 0},children:Se,dir:M}):Se}),ht={opened:a.bool,disabled:a.bool,dir:a.string,tabIndex:a.number,accessKey:a.string,data:a.array,value:a.any,valueMap:a.func,placeholder:a.string,dataItemKey:a.string.isRequired,textField:a.string.isRequired,checkField:a.string,checkIndeterminateField:a.string,expandField:a.string,subItemsField:a.string,className:a.string,style:a.object,label:a.string,validationMessage:a.string,validityStyles:a.bool,valid:a.bool,required:a.bool,name:a.string,id:a.string,ariaLabelledBy:a.string,ariaDescribedBy:a.string,filterable:a.bool,filter:a.string,loading:a.bool,tags:a.arrayOf(a.shape({text:a.string,data:a.arrayOf(a.any)})),popupSettings:a.shape({animate:a.oneOfType([a.bool,a.shape({openDuration:a.number,closeDuration:a.number})]),popupClass:a.string,className:a.string,appendTo:a.any,width:a.oneOfType([a.string,a.number]),height:a.oneOfType([a.string,a.number])}),onOpen:a.func,onClose:a.func,onFocus:a.func,onBlur:a.func,onChange:a.func,onFilterChange:a.func,onExpandChange:a.func,onCancel:a.func,item:a.func,listNoData:a.func,adaptiveTitle:a.string,adaptiveSubtitle:a.string,adaptive:a.bool};ce.displayName="KendoReactMultiSelectTree";ce.propTypes=ht;exports.MultiSelectTree=ce;exports.MultiSelectTreePropsContext=Re;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const rt=require("react"),a=require("prop-types"),r=require("@progress/kendo-react-common"),st=require("@progress/kendo-react-popup"),ot=require("@progress/kendo-react-intl"),Ke=require("@progress/kendo-react-treeview"),Me=require("../package-metadata.js"),Z=require("../common/utils.js"),lt=require("../DropDownTree/useDropdownWidth.js"),ct=require("../DropDownTree/ListNoData.js"),F=require("../messages/index.js"),ut=require("@progress/kendo-react-labels"),dt=require("../MultiSelect/TagList.js"),pt=require("../common/ClearButton.js"),Re=require("../common/ListFilter.js"),ft=require("../common/AdaptiveMode.js"),gt=require("@progress/kendo-react-layout");function vt(m){const h=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const n in m)if(n!=="default"){const I=Object.getOwnPropertyDescriptor(m,n);Object.defineProperty(h,n,I.get?I:{enumerable:!0,get:()=>m[n]})}}return h.default=m,Object.freeze(h)}const t=vt(rt),mt="Please select a value from the list!",{sizeMap:De,roundedMap:ht}=r.kendoThemeMaps,yt=m=>m.split("_").map(h=>parseInt(h,10)),bt=(m,h)=>{const{validationMessage:n,valid:I,required:ee}=m;return{customError:n!==void 0,valid:!!(I!==void 0?I:!ee||h),valueMissing:!h}},k={checkField:"checkField",checkIndeterminateField:"checkIndeterminateField",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},size:void 0,rounded:void 0,fillMode:void 0,required:!1,validityStyles:!0},qe=r.createPropsContext(),pe=t.forwardRef((m,h)=>{var Ie;const n=r.usePropsContext(qe,m),I=!r.validatePackage(Me.packageMetadata,{component:"MultiSelectTree"}),ee=r.getLicenseMessage(Me.packageMetadata),Le=r.useId(),L=n.id||Le,te=`${L}-treeview`,{data:A=[],dataItemKey:T,style:N={},placeholder:ne,label:V,name:Oe,validationMessage:B,valid:Pe,tags:fe,value:g,opened:K,disabled:C,popupSettings:O=k.popupSettings,checkField:ge=k.checkField,checkIndeterminateField:ve=k.checkIndeterminateField,subItemsField:me=k.subItemsField,size:E=k.size,rounded:W=k.rounded,fillMode:j=k.fillMode,required:ae=k.required,validityStyles:Ne=k.validityStyles,onOpen:ie=r.noop,onClose:_=r.noop}=n,$=r.getTabIndex(n.tabIndex,C),s=t.useRef(null),x=t.useRef(null),M=t.useRef(null),re=t.useRef(null),H=t.useRef(null),S=t.useRef(null),G=t.useRef(!1),U=t.useRef([]),J=t.useRef(null),[P,Ve]=t.useState(),[We,he]=t.useState(!1),[d,se]=t.useState(!1),[oe,ze]=t.useState(),[Ae,Be]=t.useState([]),[ye,je]=t.useState(""),l=K!==void 0?K:We,le=!!(Array.isArray(g)&&g.length),ce=bt({validationMessage:B,valid:Pe,required:ae},le),R=r.useRtl(x,n.dir),_e={width:lt.useDropdownWidth(x,k,O,N),...R!==void 0?{direction:R}:{}},$e=t.useCallback(()=>x.current&&x.current.focus(),[]),be=r.useAdaptiveModeContext(),D=!!(oe&&be&&oe<=be.medium&&n.adaptive);U.current=fe===void 0?(g||[]).map(e=>({text:Z.getItemValue(e,n.textField),data:[e]})):[...fe],t.useImperativeHandle(s,()=>({props:n,element:x.current,focus:$e})),t.useImperativeHandle(h,()=>s.current);const He=t.useCallback(()=>{H.current&&H.current.setCustomValidity&&H.current.setCustomValidity(ce.valid?"":B===void 0?mt:B)},[B,ce]);t.useEffect(He),t.useEffect(()=>{const e=r.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(nt.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{e&&e.disconnect()}},[]),t.useEffect(()=>{J.current&&l&&J.current.setPosition(J.current.element)},[g,l]);const w=t.useCallback((e,i,o)=>{if(n.onChange){const b={items:i,operation:o,...e};n.onChange.call(void 0,b)}},[n.onChange]),Q=t.useCallback(e=>{if(Z.areSame(e.item,g,T)||!s.current)return;const{item:i,nativeEvent:o,syntheticEvent:b}=e,q={syntheticEvent:b,nativeEvent:o,target:s.current};w(q,[i],"toggle")},[g,T,w]),X=t.useCallback(e=>{if(!l){if(ie){const i={...e};ie.call(void 0,i)}K===void 0&&(he(!0),Be(g||[]),D&&setTimeout(()=>{var i;u((i=re.current)==null?void 0:i.element)},300))}},[l,K,ie,D,re]),v=t.useCallback(e=>{if(l){if(_){const i={...e};_.call(void 0,i)}K===void 0&&he(!1)}},[l,K,_]),y=t.useCallback(e=>{G.current=!0,e(),window.setTimeout(()=>G.current=!1,0)},[]),u=t.useCallback(e=>{e&&y(()=>e.focus())},[y]),Ge=t.useCallback(()=>{var e;!d&&l?v({target:s.current}):n.filterable?u((e=M.current)==null?void 0:e.element):u(S.current&&S.current.element)},[d,l,u,v,n.filterable]),Ue=t.useCallback(()=>{d&&u(x.current)},[d,u]),Je=t.useCallback(e=>{if(!d&&!G.current&&(se(!0),n.onFocus&&s.current)){const i={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};n.onFocus.call(void 0,i)}},[d,n.onFocus]),Qe=t.useCallback(e=>{if(d&&!G.current&&s.current){se(!1);const i={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};if(n.onBlur){const o={...i};n.onBlur.call(void 0,o)}D||v(i)}},[d,n.onBlur,l,K,_]),Xe=t.useCallback(()=>{d&&y(r.noop)},[d,y]),ke=t.useCallback(e=>{if(!e.isDefaultPrevented()&&s.current){se(!0);const i={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};l||X(i)}},[l,X]),Ye=t.useCallback(e=>{var Y,Te;const{keyCode:i,altKey:o}=e,b=S.current&&S.current.element;if(!s.current||e.isDefaultPrevented()&&((Y=M.current)==null?void 0:Y.element)===e.target)return;const q={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};if(g&&g.length>0&&(i===r.Keys.left||i===r.Keys.right||i===r.Keys.home||i===r.Keys.end||i===r.Keys.delete)){const c=U.current;let p=P?c.findIndex(it=>Z.matchTags(it,P,T)):-1,f;const de=p!==-1;i===r.Keys.left?(de?p=Math.max(0,p-1):p=c.length-1,f=c[p]):i===r.Keys.right?p===c.length-1?f=void 0:de&&(p=Math.min(c.length-1,p+1),f=c[p]):i===r.Keys.home?f=c[0]:i===r.Keys.end?f=c[c.length-1]:i===r.Keys.delete&&de&&w(q,c[p].data,"delete"),f!==P&&Ve(f)}if(l)if(i===r.Keys.esc||o&&i===r.Keys.up)e.preventDefault(),v(q);else if(b&&b.querySelector(".k-focus")&&(i===r.Keys.up||i===r.Keys.down||i===r.Keys.left||i===r.Keys.right||i===r.Keys.home||i===r.Keys.end)){if(i===r.Keys.up&&((Te=M.current)!=null&&Te.element)){const c=Array.from(b.querySelectorAll(".k-treeview-item")),p=[...c].reverse().find(f=>!!(f&&f.querySelector(".k-focus")));if(p&&c.indexOf(p)===0)return y(()=>{var f;u((f=M.current)==null?void 0:f.element)})}y(r.noop)}else i===r.Keys.down&&y(()=>{var c;u(((c=M.current)==null?void 0:c.element)||b)});else o&&i===r.Keys.down&&(e.preventDefault(),X(q))},[l,v,u,y,X,P,T,g,w]),Ce=t.useCallback(e=>{const{keyCode:i,altKey:o}=e;o||i!==r.Keys.up&&i!==r.Keys.down||(e.preventDefault(),y(i===r.Keys.up?()=>{u(x.current)}:()=>{u(S.current&&S.current.element)}))},[u,y]),Ze=t.useCallback(e=>{if(!s.current)return;const i={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};w(i,[],"clear"),v(i),e.preventDefault()},[w,v]),et=t.useCallback((e,i)=>{var o;v({target:s.current}),d||u((o=M.current)==null?void 0:o.element),w({syntheticEvent:i,nativeEvent:i.nativeEvent,target:s.current},e,"delete")},[w,v,u,d]),Ee=t.useCallback(e=>{if(n.onExpandChange&&s.current){const{item:i,itemHierarchicalIndex:o,nativeEvent:b,syntheticEvent:q}=e,Y={level:yt(o),item:i,nativeEvent:b,syntheticEvent:q,target:s.current};n.onExpandChange.call(void 0,Y)}},[n.onExpandChange]),xe=t.useCallback(e=>{if(n.onFilterChange&&s.current){const o={filter:{field:n.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:s.current};n.onFilterChange.call(void 0,o),n.filter===void 0&&je(e.target.value)}},[n.onFilterChange,n.filter,n.textField]);t.useCallback(e=>{if(!s.current)return;const i={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};n.onCancel&&n.onCancel.call(void 0,i),v(i),e.preventDefault()},[n.onCancel,v]);const tt=()=>{const e=n.filterable?t.createElement(Re,{value:n.filter===void 0?ye:n.filter,ref:re,onChange:xe,onKeyDown:Ce,size:"large",rounded:W,fillMode:j,placeholder:ne}):null,i={title:n.adaptiveTitle||n.label,subTitle:n.adaptiveSubtitle,expand:l,onClose:o=>v(o),windowWidth:oe,mobileFilter:e};return t.createElement(ft.AdaptiveMode,{...i},t.createElement(gt.ActionSheetContent,null,A.length>0?t.createElement(Ke.TreeView,{id:te,ref:S,animate:!1,tabIndex:$,data:A,focusIdField:T,textField:n.textField,checkField:ge,checkIndeterminateField:ve,expandField:n.expandField,childrenField:me,expandIcons:!0,onItemClick:Q,onCheckChange:Q,onExpandChange:Ee,checkboxes:!0,size:"large",item:n.item,dir:R}):t.createElement(Fe,null,ue.toLanguageString(F.nodata,F.messages[F.nodata]))))},nt=t.useCallback(e=>{for(const i of e)ze(i.target.clientWidth)},[]),Fe=n.listNoData||ct.ListNoData,ue=ot.useLocalization(),Se=!Ne||ce.valid,z=D&&l?Ae:U.current,at=(Ie=n.ariaDescribedBy)!=null?Ie:z.length>0?"tagslist-"+L:void 0,we=t.createElement(t.Fragment,null,t.createElement("span",{className:r.classNames("k-multiselecttree k-input",n.className,{[`k-input-${De[E]||E}`]:E,[`k-rounded-${ht[W]||W}`]:W,[`k-input-${j}`]:j,"k-focus":d&&!C,"k-invalid":!Se,"k-disabled":C,"k-loading":n.loading,"k-required":ae}),tabIndex:$,accessKey:n.accessKey,id:L,style:V?{...N,width:void 0}:N,dir:R,ref:x,onKeyDown:C?void 0:Ye,onMouseDown:Xe,onFocus:e=>{D?ke(e):Je(e)},onBlur:Qe,"aria-disabled":C||void 0,"aria-labelledby":n.ariaLabelledBy,onClick:C?void 0:ke},t.createElement("div",{id:"tagslist-"+L,className:r.classNames("k-input-values k-chip-list",{[`k-chip-list-${De[E]||E}`]:E}),role:"listbox","aria-label":ue.toLanguageString(F.chipListAriaLabel,F.messages[F.chipListAriaLabel]),"aria-orientation":"horizontal"},z.length>0&&t.createElement(dt,{tag:n.tag,onTagDelete:et,data:z,guid:L,focused:P?U.current.find(e=>Z.matchTags(e,P,T)):void 0,size:E})),t.createElement("span",{className:"k-input-inner",role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-autocomplete":"list","aria-label":n.ariaLabel||V,"aria-controls":l?te:void 0,"aria-describedby":at,"aria-disabled":C?!0:void 0,"aria-required":ae||void 0,tabIndex:0},z.length===0&&t.createElement("span",{className:"k-input-value-text"},ne)),n.loading&&t.createElement(r.IconWrap,{className:"k-input-loading-icon",name:"loading"}),le&&!C&&z.length>0&&t.createElement(pt,{onClick:Ze}),t.createElement("select",{name:Oe,ref:H,tabIndex:-1,"aria-hidden":!0,title:V,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,g):g})),!D&&t.createElement(st.Popup,{...O,popupClass:r.classNames(O.popupClass,"k-multiselecttree-popup"),className:r.classNames(O.className,{"k-rtl":R==="rtl"}),style:_e,anchor:O.anchor||x.current,show:l,onOpen:Ge,onClose:Ue,ref:J},n.filterable&&t.createElement(Re,{value:n.filter===void 0?ye:n.filter,ref:M,onChange:xe,onKeyDown:Ce,tabIndex:$,size:E,rounded:W,fillMode:j,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),A.length>0?t.createElement(Ke.TreeView,{id:te,style:{height:O.height},animate:!1,ref:S,tabIndex:$,data:A,focusIdField:T,textField:n.textField,checkField:ge,checkIndeterminateField:ve,expandField:n.expandField,childrenField:me,expandIcons:!0,onItemClick:Q,onCheckChange:Q,onExpandChange:Ee,checkboxes:!0,size:E,item:n.item,dir:R}):t.createElement(Fe,null,ue.toLanguageString(F.nodata,F.messages[F.nodata])),I&&t.createElement(r.WatermarkOverlay,{message:ee}))),D&&tt());return V?t.createElement(ut.FloatingLabel,{label:V,editorValue:le,editorPlaceholder:ne,editorValid:Se,editorDisabled:C,editorId:L,style:{width:N?N.width:void 0},children:we,dir:R}):we}),kt={opened:a.bool,disabled:a.bool,dir:a.string,tabIndex:a.number,accessKey:a.string,data:a.array,value:a.any,valueMap:a.func,placeholder:a.string,dataItemKey:a.string.isRequired,textField:a.string.isRequired,checkField:a.string,checkIndeterminateField:a.string,expandField:a.string,subItemsField:a.string,className:a.string,style:a.object,label:a.string,validationMessage:a.string,validityStyles:a.bool,valid:a.bool,required:a.bool,name:a.string,id:a.string,ariaLabelledBy:a.string,ariaDescribedBy:a.string,filterable:a.bool,filter:a.string,loading:a.bool,tags:a.arrayOf(a.shape({text:a.string,data:a.arrayOf(a.any)})),popupSettings:a.shape({animate:a.oneOfType([a.bool,a.shape({openDuration:a.number,closeDuration:a.number})]),popupClass:a.string,className:a.string,appendTo:a.any,width:a.oneOfType([a.string,a.number]),height:a.oneOfType([a.string,a.number])}),onOpen:a.func,onClose:a.func,onFocus:a.func,onBlur:a.func,onChange:a.func,onFilterChange:a.func,onExpandChange:a.func,onCancel:a.func,item:a.func,listNoData:a.func,adaptiveTitle:a.string,adaptiveSubtitle:a.string,adaptive:a.bool};pe.displayName="KendoReactMultiSelectTree";pe.propTypes=kt;exports.MultiSelectTree=pe;exports.MultiSelectTreePropsContext=qe;
|