@progress/kendo-react-dropdowns 11.2.0-develop.2 → 11.2.0-develop.4
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/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +103 -104
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +82 -81
- package/DropDownTree/useDropdownWidth.js +1 -1
- package/DropDownTree/useDropdownWidth.mjs +8 -8
- package/MultiColumnComboBox/MultiColumnComboBox.js +1 -1
- package/MultiColumnComboBox/MultiColumnComboBox.mjs +66 -61
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +12 -15
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +0 -1
- package/index.d.ts +0 -1
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
|
@@ -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 Qe=require("react"),n=require("prop-types"),r=require("@progress/kendo-react-common"),Ye=require("@progress/kendo-react-popup"),et=require("@progress/kendo-react-intl"),Fe=require("@progress/kendo-react-treeview"),tt=require("../package-metadata.js"),X=require("../common/utils.js"),nt=require("./useDropdownWidth.js"),at=require("./ListNoData.js"),h=require("../messages/index.js"),ot=require("@progress/kendo-react-labels"),Ie=require("../common/ListFilter.js"),rt=require("@progress/kendo-react-buttons"),Se=require("@progress/kendo-svg-icons"),st=require("../common/AdaptiveMode.js"),it=require("@progress/kendo-react-layout");function lt(u){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const E in u)if(E!=="default"){const s=Object.getOwnPropertyDescriptor(u,E);Object.defineProperty(f,E,s.get?s:{enumerable:!0,get:()=>u[E]})}}return f.default=u,Object.freeze(f)}const t=lt(Qe),{sizeMap:ct,roundedMap:ut}=r.kendoThemeMaps,dt=12e3,pt=2e3,ft="Please select a value from the list!",mt=u=>t.createElement("span",{className:"k-input-value-text"},u.children),Re=u=>u.split("_").map(f=>parseInt(f,10)),vt=(u,f)=>{const{validationMessage:E,valid:s,required:o}=u;return{customError:E!==void 0,valid:!!(s!==void 0?s:!o||f),valueMissing:!f}},oe={selectField:"selected",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},data:[],required:!1,style:{},validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid"},Te=r.createPropsContext(),re=t.forwardRef((u,f)=>{const E=!r.validatePackage(tt.packageMetadata,{component:"DropDownTree"}),s=r.usePropsContext(Te,u),o={...oe,...s},Pe=r.useId(),se=o.id||Pe,{data:M,dataItemKey:N,popupSettings:C={},style:O,opened:d,disabled:S,onOpen:V=r.noop,onClose:v=r.noop,placeholder:H,label:R,name:qe,selectField:j,subItemsField:L,validationMessage:Z,valid:Ke,required:G,validityStyles:Me}=o,J=r.getTabIndex(o.tabIndex,S),i=t.useRef(null),g=t.useRef(null),T=t.useRef(null),Q=t.useRef(null),$=t.useRef(null),k=t.useRef(null),U=t.useRef(!1),[ie,Ne]=t.useState(void 0),D=o.value!==void 0,b=D?o.value:ie!==void 0?ie:o.defaultValue,W=X.isPresent(b),Y=W?X.getItemValue(b,o.textField):"",ee=vt({validationMessage:Z,valid:Ke,required:G},W),le=t.useContext(r.ZIndexContext),Oe=le?le+pt:dt,Ve=t.useCallback(()=>g.current&&g.current.focus(),[]);t.useImperativeHandle(i,()=>({props:o,element:g.current,focus:Ve})),t.useImperativeHandle(f,()=>i.current);const w=r.useRtl(g,o.dir),Le={width:nt.useDropdownWidth(g,oe,{...oe.popupSettings,...C},O),...w!==void 0?{direction:w}:{}},[We,ce]=t.useState(!1),l=d!==void 0?d:We,[p,te]=t.useState(!1),[ne,ze]=t.useState(),[ue,Be]=t.useState(""),de=r.useAdaptiveModeContext(),x=!!(ne&&de&&ne<=de.medium&&o.adaptive),Ae=t.useCallback(()=>{$.current&&$.current.setCustomValidity&&$.current.setCustomValidity(ee.valid?"":Z===void 0?ft:Z)},[Z,ee]);t.useEffect(Ae),t.useEffect(()=>{const e=r.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Ge.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const pe=t.useCallback(e=>{if(!l){if(V){const a={...e};V.call(void 0,a)}d===void 0&&ce(!0)}},[l,d,V]),F=t.useCallback(e=>{if(l){if(v){const a={...e};v.call(void 0,a)}d===void 0&&(ce(!1),x&&setTimeout(()=>{var a;y((a=Q.current)==null?void 0:a.element)},300))}},[l,d,v,x]),fe=t.useCallback(e=>{if(!e.isDefaultPrevented()&&i.current){te(!0);const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};(l?F:pe)(a)}},[l,d,V,v]),P=t.useCallback(e=>{U.current=!0,e(),window.setTimeout(()=>U.current=!1,0)},[]),_e=t.useCallback(e=>{var I,De;const{keyCode:a,altKey:c}=e,m=k.current&&k.current.element;if(!i.current||e.isDefaultPrevented()&&((I=T.current)==null?void 0:I.element)===e.target)return;const K={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(l)if(a===r.Keys.esc||c&&a===r.Keys.up)e.preventDefault(),F(K);else if(m&&m.querySelector(".k-focus")&&(a===r.Keys.up||a===r.Keys.down||a===r.Keys.left||a===r.Keys.right||a===r.Keys.home||a===r.Keys.end)){if(a===r.Keys.up&&((De=T.current)!=null&&De.element)){const A=Array.from(m.querySelectorAll(".k-treeview-item")),we=[...A].reverse().find(_=>!!(_&&_.querySelector(".k-focus")));if(we&&A.indexOf(we)===0)return P(()=>{var _;y((_=T.current)==null?void 0:_.element)})}P(r.noop)}else a===r.Keys.down&&P(()=>{var A;y(((A=T.current)==null?void 0:A.element)||m)});else c&&a===r.Keys.down?(e.preventDefault(),pe(K)):l||a===r.Keys.esc&&be(e)},[l,d,V,v]),me=t.useCallback(e=>{const{keyCode:a,altKey:c}=e;c||a!==r.Keys.up&&a!==r.Keys.down||(e.preventDefault(),P(a===r.Keys.up?()=>{y(g.current)}:()=>{y(k.current&&k.current.element)}))},[]),y=t.useCallback(e=>{e&&P(()=>e.focus())},[]),He=t.useCallback(()=>{var e;!p&&l&&!d?F({target:i.current}):s.filterable?y((e=T.current)==null?void 0:e.element):y(k.current&&k.current.element)},[v,s.filterable,p,d,l]),je=t.useCallback(()=>{p&&y(g.current)},[p]),Ze=t.useCallback(e=>{if(!p&&!U.current&&(te(!0),s.onFocus&&i.current)){const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};s.onFocus.call(void 0,a)}},[p,s.onFocus]),$e=t.useCallback(e=>{if(p&&!U.current&&i.current){te(!1);const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(s.onBlur){const c={...a};s.onBlur.call(void 0,c)}x||F(a)}},[p,s.onBlur,l,d,v]),Ue=t.useCallback(()=>{p&&P(r.noop),x&&setTimeout(()=>{var e;y((e=Q.current)==null?void 0:e.element)},300)},[p,x]),ve=t.useCallback((e,a,c)=>{if(s.onChange){const m={value:a,level:c?Re(c):[],...e};s.onChange.call(void 0,m)}D||Ne(a)},[s.onChange,D]),ge=t.useCallback(e=>{if(X.areSame(e.item,b,N)||!i.current)return;const{item:a,itemHierarchicalIndex:c,nativeEvent:m,syntheticEvent:K}=e,I={syntheticEvent:K,nativeEvent:m,target:i.current};ve(I,a,c),F(I)},[D,b,s.onChange,N,l,d,v]),be=t.useCallback(e=>{if(!i.current)return;const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};ve(a,null),F(a),e.preventDefault()},[D,s.onChange,l,d,v]),ye=t.useCallback(e=>{if(e.syntheticEvent.stopPropagation(),s.onExpandChange&&i.current){const{item:a,itemHierarchicalIndex:c,nativeEvent:m,syntheticEvent:K}=e,I={level:Re(c),item:a,nativeEvent:m,syntheticEvent:K,target:i.current};s.onExpandChange.call(void 0,I)}},[s.onExpandChange]),he=t.useCallback(e=>{if(s.onFilterChange&&i.current){const c={filter:{field:s.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:i.current};s.onFilterChange.call(void 0,c),s.filter===void 0&&Be(e.target.value)}},[s.onFilterChange,s.filter,s.textField]),Xe=()=>{const e=o.filterable?t.createElement(Ie,{value:o.filter===void 0?ue:o.filter,ref:Q,onChange:he,onKeyDown:me,size:"large",rounded:z,fillMode:B,placeholder:H}):null,a={title:o.adaptiveTitle||R,subTitle:o.adaptiveSubtitle,expand:l,onClose:c=>F(c),windowWidth:ne,mobileFilter:e};return t.createElement(st.AdaptiveMode,{...a},t.createElement(it.ActionSheetContent,null,M.length>0?t.createElement(Fe.TreeView,{ref:k,tabIndex:J,data:Ee,focusIdField:N,textField:o.textField,selectField:j,expandField:o.expandField,childrenField:L,expandIcons:!0,onItemClick:ge,onExpandChange:ye,size:"large",item:o.item,dir:w,animate:C.animate}):t.createElement(Ce,null,ae.toLanguageString(h.nodata,h.messages[h.nodata]))))},Ge=t.useCallback(e=>{for(const a of e)ze(a.target.clientWidth)},[]),Ee=t.useMemo(()=>D||!W?M:r.mapTree(M,L,e=>r.extendDataItem(e,L,{[j]:X.areSame(e,b,N)})),[M,b,D,W,j,L]),Ce=o.listNoData||at.ListNoData,Je=o.valueHolder||mt,ae=et.useLocalization(),ke=!Me||ee.valid,{size:q,rounded:z,fillMode:B}=o,xe=t.createElement(t.Fragment,null,t.createElement("span",{className:r.classNames("k-dropdowntree k-picker",o.className,{[`k-picker-${ct[q]||q}`]:q,[`k-rounded-${ut[z]||z}`]:z,[`k-picker-${B}`]:B,"k-focus":p,"k-invalid":!ke,"k-loading":o.loading,"k-required":G,"k-disabled":o.disabled}),tabIndex:J,accessKey:o.accessKey,id:se,style:R?{...O,width:void 0}:O,dir:w,ref:g,onKeyDown:S?void 0:_e,onMouseDown:Ue,onClick:S?void 0:fe,onFocus:x?e=>fe(e):Ze,onBlur:$e,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":S,"aria-label":R,"aria-labelledby":o.ariaLabelledBy,"aria-describedby":o.ariaDescribedBy,"aria-required":G},t.createElement("span",{className:"k-input-inner"},(Y||H)&&t.createElement(Je,{item:b},Y||H)),o.loading&&t.createElement(r.IconWrap,{className:"k-input-loading-icon",name:"loading"}),W&&!S&&t.createElement("span",{onClick:be,className:"k-clear-value",title:ae.toLanguageString(h.clear,h.messages[h.clear]),role:"button",tabIndex:-1,onMouseDown:e=>e.preventDefault()},t.createElement(r.IconWrap,{name:"x",icon:Se.xIcon})),t.createElement(rt.Button,{tabIndex:-1,type:"button","aria-label":"select",className:"k-input-button",size:q,fillMode:B,themeColor:"base",rounded:null,icon:"caret-alt-down",svgIcon:Se.caretAltDownIcon}),t.createElement("select",{name:qe,ref:$,tabIndex:-1,"aria-hidden":!0,title:R,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:o.valueMap?o.valueMap.call(void 0,b):b})),!x&&t.createElement(r.ZIndexContext.Provider,{value:Oe},t.createElement(Ye.Popup,{...C,className:r.classNames(C.className,{"k-rtl":w==="rtl"}),popupClass:r.classNames(C.popupClass,"k-dropdowntree-popup k-list-container"),style:Le,anchor:C.anchor||g.current,show:l,onOpen:He,onClose:je},o.filterable&&t.createElement(Ie,{value:o.filter===void 0?ue:o.filter,ref:T,onChange:he,onKeyDown:me,size:q,rounded:z,fillMode:B,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),M.length>0?t.createElement(Fe.TreeView,{style:{height:C.height},ref:k,tabIndex:J,data:Ee,focusIdField:N,textField:o.textField,selectField:j,expandField:o.expandField,childrenField:L,expandIcons:!0,onItemClick:ge,onExpandChange:ye,size:q,item:o.item,dir:w,animate:C.animate}):t.createElement(Ce,null,ae.toLanguageString(h.nodata,h.messages[h.nodata])),E&&t.createElement(r.WatermarkOverlay,null)))),x&&Xe());return R?t.createElement(ot.FloatingLabel,{label:R,editorValue:Y,editorPlaceholder:H,editorValid:ke,editorDisabled:S,editorId:se,style:{width:O?O.width:void 0},children:xe,dir:w}):xe}),gt={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,value:n.any,valueMap:n.func,placeholder:n.string,dataItemKey:n.string.isRequired,textField:n.string.isRequired,selectField:n.string,expandField:n.string,subItemsField:n.string,className:n.string,style:n.object,label:n.string,validationMessage:n.string,validityStyles:n.bool,valid:n.bool,required:n.bool,name:n.string,id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,filterable:n.bool,filter:n.string,loading:n.bool,popupSettings:n.shape({animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),popupClass:n.string,className:n.string,appendTo:n.any,width:n.oneOfType([n.string,n.number]),height:n.oneOfType([n.string,n.number])}),onOpen:n.func,onClose:n.func,onFocus:n.func,onBlur:n.func,onChange:n.func,onFilterChange:n.func,onExpandChange:n.func,item:n.func,valueHolder:n.func,listNoData:n.func,adaptiveTitle:n.string,adaptiveSubtitle:n.string,adaptive:n.bool};re.displayName="KendoReactDropDownTree";re.propTypes=gt;exports.DropDownTree=re;exports.DropDownTreePropsContext=Te;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Qe=require("react"),n=require("prop-types"),r=require("@progress/kendo-react-common"),Ye=require("@progress/kendo-react-popup"),et=require("@progress/kendo-react-intl"),Fe=require("@progress/kendo-react-treeview"),tt=require("../package-metadata.js"),X=require("../common/utils.js"),nt=require("./useDropdownWidth.js"),at=require("./ListNoData.js"),h=require("../messages/index.js"),ot=require("@progress/kendo-react-labels"),Ie=require("../common/ListFilter.js"),rt=require("@progress/kendo-react-buttons"),Se=require("@progress/kendo-svg-icons"),st=require("../common/AdaptiveMode.js"),it=require("@progress/kendo-react-layout");function lt(u){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(u){for(const E in u)if(E!=="default"){const s=Object.getOwnPropertyDescriptor(u,E);Object.defineProperty(m,E,s.get?s:{enumerable:!0,get:()=>u[E]})}}return m.default=u,Object.freeze(m)}const t=lt(Qe),{sizeMap:ct,roundedMap:ut}=r.kendoThemeMaps,dt=12e3,pt=2e3,ft="Please select a value from the list!",mt=u=>t.createElement("span",{className:"k-input-value-text"},u.children),Re=u=>u.split("_").map(m=>parseInt(m,10)),vt=(u,m)=>{const{validationMessage:E,valid:s,required:o}=u;return{customError:E!==void 0,valid:!!(s!==void 0?s:!o||m),valueMissing:!m}},oe={selectField:"selected",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},data:[],required:!1,style:{},validityStyles:!0,size:"medium",rounded:"medium",fillMode:"solid"},Te=r.createPropsContext(),re=t.forwardRef((u,m)=>{const E=!r.validatePackage(tt.packageMetadata,{component:"DropDownTree"}),s=r.usePropsContext(Te,u),o={...oe,...s},Pe=r.useId(),se=o.id||Pe,{data:N,dataItemKey:O,popupSettings:C={},style:V,opened:d,disabled:S,onOpen:L=r.noop,onClose:v=r.noop,placeholder:H,label:R,name:qe,selectField:j,subItemsField:W,validationMessage:Z,valid:Ke,required:G,validityStyles:Me}=o,J=r.getTabIndex(o.tabIndex,S),i=t.useRef(null),g=t.useRef(null),T=t.useRef(null),Q=t.useRef(null),$=t.useRef(null),x=t.useRef(null),U=t.useRef(!1),[ie,Ne]=t.useState(void 0),D=o.value!==void 0,b=D?o.value:ie!==void 0?ie:o.defaultValue,z=X.isPresent(b),Y=z?X.getItemValue(b,o.textField):"",ee=vt({validationMessage:Z,valid:Ke,required:G},z),le=t.useContext(r.ZIndexContext),Oe=le?le+pt:dt,Ve=t.useCallback(()=>g.current&&g.current.focus(),[]);t.useImperativeHandle(i,()=>({props:o,element:g.current,focus:Ve})),t.useImperativeHandle(m,()=>i.current);const w=r.useRtl(g,o.dir),Le={width:nt.useDropdownWidth(g,oe,{...oe.popupSettings,...C},V),...w!==void 0?{direction:w}:{}},[We,ce]=t.useState(!1),l=d!==void 0?d:We,[f,te]=t.useState(!1),[ne,ze]=t.useState(),[ue,Ae]=t.useState(""),de=r.useAdaptiveModeContext(),k=!!(ne&&de&&ne<=de.medium&&o.adaptive),Be=t.useCallback(()=>{$.current&&$.current.setCustomValidity&&$.current.setCustomValidity(ee.valid?"":Z===void 0?ft:Z)},[Z,ee]);t.useEffect(Be),t.useEffect(()=>{const e=r.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Ge.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{document!=null&&document.body&&e&&e.disconnect()}},[]);const pe=t.useCallback(e=>{if(!l){if(L){const a={...e};L.call(void 0,a)}d===void 0&&ce(!0)}},[l,d,L]),F=t.useCallback(e=>{if(l){if(v){const a={...e};v.call(void 0,a)}d===void 0&&(ce(!1),k&&setTimeout(()=>{var a;y((a=Q.current)==null?void 0:a.element)},300))}},[l,d,v,k]),fe=t.useCallback(e=>{if(!e.isDefaultPrevented()&&i.current){te(!0);const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};(l?F:pe)(a)}},[l,d,L,v]),P=t.useCallback(e=>{U.current=!0,e(),window.setTimeout(()=>U.current=!1,0)},[]),_e=t.useCallback(e=>{var I,De;const{keyCode:a,altKey:c}=e,p=x.current&&x.current.element;if(!i.current||e.isDefaultPrevented()&&((I=T.current)==null?void 0:I.element)===e.target)return;const K={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(l)if(a===r.Keys.esc||c&&a===r.Keys.up)e.preventDefault(),F(K);else if(p&&p.querySelector(".k-focus")&&(a===r.Keys.up||a===r.Keys.down||a===r.Keys.left||a===r.Keys.right||a===r.Keys.home||a===r.Keys.end)){if(a===r.Keys.up&&((De=T.current)!=null&&De.element)){const _=Array.from(p.querySelectorAll(".k-treeview-item")),we=[..._].reverse().find(M=>M==null?void 0:M.querySelector(".k-focus"));if(we&&_.indexOf(we)===0)return P(()=>{var M;y((M=T.current)==null?void 0:M.element)})}P(r.noop)}else a===r.Keys.down&&P(()=>{var _;y(((_=T.current)==null?void 0:_.element)||p)});else c&&a===r.Keys.down?(e.preventDefault(),pe(K)):l||a===r.Keys.esc&&be(e)},[l,d,L,v]),me=t.useCallback(e=>{const{keyCode:a,altKey:c}=e;c||a!==r.Keys.up&&a!==r.Keys.down||(e.preventDefault(),P(a===r.Keys.up?()=>{y(g.current)}:()=>{var p;y((p=x.current)==null?void 0:p.element)}))},[]),y=t.useCallback(e=>{e&&P(()=>e.focus())},[]),He=t.useCallback(()=>{var e;!f&&l&&!d?F({target:i.current}):s.filterable?y((e=T.current)==null?void 0:e.element):y(x.current&&x.current.element)},[v,s.filterable,f,d,l]),je=t.useCallback(()=>{f&&y(g.current)},[f]),Ze=t.useCallback(e=>{if(!f&&!U.current&&(te(!0),s.onFocus&&i.current)){const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};s.onFocus.call(void 0,a)}},[f,s.onFocus]),$e=t.useCallback(e=>{if(f&&!U.current&&i.current){te(!1);const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};if(s.onBlur){const c={...a};s.onBlur.call(void 0,c)}k||F(a)}},[f,s.onBlur,l,d,v]),Ue=t.useCallback(()=>{f&&P(r.noop),k&&setTimeout(()=>{var e;y((e=Q.current)==null?void 0:e.element)},300)},[f,k]),ve=t.useCallback((e,a,c)=>{if(s.onChange){const p={value:a,level:c?Re(c):[],...e};s.onChange.call(void 0,p)}D||Ne(a)},[s.onChange,D]),ge=t.useCallback(e=>{if(X.areSame(e.item,b,O)||!i.current)return;const{item:a,itemHierarchicalIndex:c,nativeEvent:p,syntheticEvent:K}=e,I={syntheticEvent:K,nativeEvent:p,target:i.current};ve(I,a,c),F(I)},[D,b,s.onChange,O,l,d,v]),be=t.useCallback(e=>{if(!i.current)return;const a={syntheticEvent:e,nativeEvent:e.nativeEvent,target:i.current};ve(a,null),F(a),e.preventDefault()},[D,s.onChange,l,d,v]),ye=t.useCallback(e=>{if(e.syntheticEvent.stopPropagation(),s.onExpandChange&&i.current){const{item:a,itemHierarchicalIndex:c,nativeEvent:p,syntheticEvent:K}=e,I={level:Re(c),item:a,nativeEvent:p,syntheticEvent:K,target:i.current};s.onExpandChange.call(void 0,I)}},[s.onExpandChange]),he=t.useCallback(e=>{if(s.onFilterChange&&i.current){const c={filter:{field:s.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:i.current};s.onFilterChange.call(void 0,c),s.filter===void 0&&Ae(e.target.value)}},[s.onFilterChange,s.filter,s.textField]),Xe=()=>{const e=o.filterable?t.createElement(Ie,{value:o.filter===void 0?ue:o.filter,ref:Q,onChange:he,onKeyDown:me,size:"large",rounded:A,fillMode:B,placeholder:H}):null,a={title:o.adaptiveTitle||R,subTitle:o.adaptiveSubtitle,expand:l,onClose:c=>F(c),windowWidth:ne,mobileFilter:e};return t.createElement(st.AdaptiveMode,{...a},t.createElement(it.ActionSheetContent,null,N.length>0?t.createElement(Fe.TreeView,{ref:x,tabIndex:J,data:Ee,focusIdField:O,textField:o.textField,selectField:j,expandField:o.expandField,childrenField:W,expandIcons:!0,onItemClick:ge,onExpandChange:ye,size:"large",item:o.item,dir:w,animate:C.animate}):t.createElement(Ce,null,ae.toLanguageString(h.nodata,h.messages[h.nodata]))))},Ge=t.useCallback(e=>{for(const a of e)ze(a.target.clientWidth)},[]),Ee=t.useMemo(()=>D||!z?N:r.mapTree(N,W,e=>r.extendDataItem(e,W,{[j]:X.areSame(e,b,O)})),[N,b,D,z,j,W]),Ce=o.listNoData||at.ListNoData,Je=o.valueHolder||mt,ae=et.useLocalization(),ke=!Me||ee.valid,{size:q,rounded:A,fillMode:B}=o,xe=t.createElement(t.Fragment,null,t.createElement("span",{className:r.classNames("k-dropdowntree k-picker",o.className,{[`k-picker-${ct[q]||q}`]:q,[`k-rounded-${ut[A]||A}`]:A,[`k-picker-${B}`]:B,"k-focus":f,"k-invalid":!ke,"k-loading":o.loading,"k-required":G,"k-disabled":o.disabled}),tabIndex:J,accessKey:o.accessKey,id:se,style:R?{...V,width:void 0}:V,dir:w,ref:g,onKeyDown:S?void 0:_e,onMouseDown:Ue,onClick:S?void 0:fe,onFocus:k?e=>fe(e):Ze,onBlur:$e,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":S,"aria-label":R,"aria-labelledby":o.ariaLabelledBy,"aria-describedby":o.ariaDescribedBy,"aria-required":G},t.createElement("span",{className:"k-input-inner"},(Y||H)&&t.createElement(Je,{item:b},Y||H)),o.loading&&t.createElement(r.IconWrap,{className:"k-input-loading-icon",name:"loading"}),z&&!S&&t.createElement("span",{onClick:be,className:"k-clear-value",title:ae.toLanguageString(h.clear,h.messages[h.clear]),role:"button",tabIndex:-1,onMouseDown:e=>e.preventDefault()},t.createElement(r.IconWrap,{name:"x",icon:Se.xIcon})),t.createElement(rt.Button,{tabIndex:-1,type:"button","aria-label":"select",className:"k-input-button",size:q,fillMode:B,themeColor:"base",rounded:null,icon:"caret-alt-down",svgIcon:Se.caretAltDownIcon}),t.createElement("select",{name:qe,ref:$,tabIndex:-1,"aria-hidden":!0,title:R,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:o.valueMap?o.valueMap.call(void 0,b):b})),!k&&t.createElement(r.ZIndexContext.Provider,{value:Oe},t.createElement(Ye.Popup,{...C,className:r.classNames(C.className,{"k-rtl":w==="rtl"}),popupClass:r.classNames(C.popupClass,"k-dropdowntree-popup k-list-container"),style:Le,anchor:C.anchor||g.current,show:l,onOpen:He,onClose:je},o.filterable&&t.createElement(Ie,{value:o.filter===void 0?ue:o.filter,ref:T,onChange:he,onKeyDown:me,size:q,rounded:A,fillMode:B,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),N.length>0?t.createElement(Fe.TreeView,{style:{height:C.height},ref:x,tabIndex:J,data:Ee,focusIdField:O,textField:o.textField,selectField:j,expandField:o.expandField,childrenField:W,expandIcons:!0,onItemClick:ge,onExpandChange:ye,size:q,item:o.item,dir:w,animate:C.animate}):t.createElement(Ce,null,ae.toLanguageString(h.nodata,h.messages[h.nodata])),E&&t.createElement(r.WatermarkOverlay,null)))),k&&Xe());return R?t.createElement(ot.FloatingLabel,{label:R,editorValue:Y,editorPlaceholder:H,editorValid:ke,editorDisabled:S,editorId:se,style:{width:V?V.width:void 0},children:xe,dir:w}):xe}),gt={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,value:n.any,valueMap:n.func,placeholder:n.string,dataItemKey:n.string.isRequired,textField:n.string.isRequired,selectField:n.string,expandField:n.string,subItemsField:n.string,className:n.string,style:n.object,label:n.string,validationMessage:n.string,validityStyles:n.bool,valid:n.bool,required:n.bool,name:n.string,id:n.string,ariaLabelledBy:n.string,ariaDescribedBy:n.string,filterable:n.bool,filter:n.string,loading:n.bool,popupSettings:n.shape({animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),popupClass:n.string,className:n.string,appendTo:n.any,width:n.oneOfType([n.string,n.number]),height:n.oneOfType([n.string,n.number])}),onOpen:n.func,onClose:n.func,onFocus:n.func,onBlur:n.func,onChange:n.func,onFilterChange:n.func,onExpandChange:n.func,item:n.func,valueHolder:n.func,listNoData:n.func,adaptiveTitle:n.string,adaptiveSubtitle:n.string,adaptive:n.bool};re.displayName="KendoReactDropDownTree";re.propTypes=gt;exports.DropDownTree=re;exports.DropDownTreePropsContext=Te;
|
|
@@ -22,8 +22,8 @@ import { Button as kt } from "@progress/kendo-react-buttons";
|
|
|
22
22
|
import { xIcon as xt, caretAltDownIcon as wt } from "@progress/kendo-svg-icons";
|
|
23
23
|
import { AdaptiveMode as Dt } from "../common/AdaptiveMode.mjs";
|
|
24
24
|
import { ActionSheetContent as Ft } from "@progress/kendo-react-layout";
|
|
25
|
-
const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please select a value from the list!", Mt = (
|
|
26
|
-
const { validationMessage: j, valid: r, required: a } =
|
|
25
|
+
const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please select a value from the list!", Mt = (E) => /* @__PURE__ */ t.createElement("span", { className: "k-input-value-text" }, E.children), Ne = (E) => E.split("_").map((D) => parseInt(D, 10)), Nt = (E, D) => {
|
|
26
|
+
const { validationMessage: j, valid: r, required: a } = E;
|
|
27
27
|
return {
|
|
28
28
|
customError: j !== void 0,
|
|
29
29
|
valid: !!(r !== void 0 ? r : !a || D),
|
|
@@ -44,43 +44,43 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
44
44
|
size: "medium",
|
|
45
45
|
rounded: "medium",
|
|
46
46
|
fillMode: "solid"
|
|
47
|
-
}, Ot = nt(), Oe = t.forwardRef((
|
|
48
|
-
const j = !ot(gt, { component: "DropDownTree" }), r = at(Ot,
|
|
47
|
+
}, Ot = nt(), Oe = t.forwardRef((E, D) => {
|
|
48
|
+
const j = !ot(gt, { component: "DropDownTree" }), r = at(Ot, E), a = {
|
|
49
49
|
...ie,
|
|
50
50
|
...r
|
|
51
51
|
}, Ve = rt(), le = a.id || Ve, {
|
|
52
|
-
data:
|
|
53
|
-
dataItemKey:
|
|
52
|
+
data: N,
|
|
53
|
+
dataItemKey: O,
|
|
54
54
|
popupSettings: b = {},
|
|
55
|
-
style:
|
|
55
|
+
style: V,
|
|
56
56
|
opened: u,
|
|
57
57
|
disabled: F,
|
|
58
|
-
onOpen:
|
|
58
|
+
onOpen: W = U,
|
|
59
59
|
onClose: m = U,
|
|
60
|
-
placeholder:
|
|
60
|
+
placeholder: B,
|
|
61
61
|
label: I,
|
|
62
62
|
name: We,
|
|
63
63
|
selectField: H,
|
|
64
|
-
subItemsField:
|
|
64
|
+
subItemsField: L,
|
|
65
65
|
validationMessage: _,
|
|
66
66
|
valid: Le,
|
|
67
67
|
required: G,
|
|
68
68
|
validityStyles: Ke
|
|
69
|
-
} = a, J = it(a.tabIndex, F), i = t.useRef(null), f = t.useRef(null), S = t.useRef(null), Q = t.useRef(null), Z = t.useRef(null),
|
|
69
|
+
} = a, J = it(a.tabIndex, F), i = t.useRef(null), f = t.useRef(null), S = t.useRef(null), Q = t.useRef(null), Z = t.useRef(null), y = t.useRef(null), $ = t.useRef(!1), [se, ze] = t.useState(void 0), C = a.value !== void 0, v = C ? a.value : se !== void 0 ? se : a.defaultValue, K = ht(v), Y = K ? bt(v, a.textField) : "", ee = Nt({ validationMessage: _, valid: Le, required: G }, K), ce = t.useContext(Ie), qe = ce ? ce + Rt : Tt, Ae = t.useCallback(() => f.current && f.current.focus(), []);
|
|
70
70
|
t.useImperativeHandle(i, () => ({
|
|
71
71
|
props: a,
|
|
72
72
|
element: f.current,
|
|
73
|
-
focus:
|
|
73
|
+
focus: Ae
|
|
74
74
|
})), t.useImperativeHandle(D, () => i.current);
|
|
75
|
-
const k = lt(f, a.dir),
|
|
75
|
+
const k = lt(f, a.dir), Be = {
|
|
76
76
|
width: Et(
|
|
77
77
|
f,
|
|
78
78
|
ie,
|
|
79
79
|
{ ...ie.popupSettings, ...b },
|
|
80
|
-
|
|
80
|
+
V
|
|
81
81
|
),
|
|
82
82
|
...k !== void 0 ? { direction: k } : {}
|
|
83
|
-
}, [He, ue] = t.useState(!1), l = u !== void 0 ? u : He, [
|
|
83
|
+
}, [He, ue] = t.useState(!1), l = u !== void 0 ? u : He, [p, te] = t.useState(!1), [ne, _e] = t.useState(), [de, Ze] = t.useState(""), pe = st(), h = !!(ne && pe && ne <= pe.medium && a.adaptive), $e = t.useCallback(() => {
|
|
84
84
|
Z.current && Z.current.setCustomValidity && Z.current.setCustomValidity(
|
|
85
85
|
ee.valid ? "" : _ === void 0 ? Pt : _
|
|
86
86
|
);
|
|
@@ -94,14 +94,14 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
94
94
|
const me = t.useCallback(
|
|
95
95
|
(e) => {
|
|
96
96
|
if (!l) {
|
|
97
|
-
if (
|
|
97
|
+
if (W) {
|
|
98
98
|
const o = { ...e };
|
|
99
|
-
|
|
99
|
+
W.call(void 0, o);
|
|
100
100
|
}
|
|
101
101
|
u === void 0 && ue(!0);
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
|
-
[l, u,
|
|
104
|
+
[l, u, W]
|
|
105
105
|
), x = t.useCallback(
|
|
106
106
|
(e) => {
|
|
107
107
|
if (l) {
|
|
@@ -109,13 +109,13 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
109
109
|
const o = { ...e };
|
|
110
110
|
m.call(void 0, o);
|
|
111
111
|
}
|
|
112
|
-
u === void 0 && (ue(!1),
|
|
112
|
+
u === void 0 && (ue(!1), h && setTimeout(() => {
|
|
113
113
|
var o;
|
|
114
114
|
g((o = Q.current) == null ? void 0 : o.element);
|
|
115
115
|
}, 300));
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
-
[l, u, m,
|
|
118
|
+
[l, u, m, h]
|
|
119
119
|
), fe = t.useCallback(
|
|
120
120
|
(e) => {
|
|
121
121
|
if (!e.isDefaultPrevented() && i.current) {
|
|
@@ -128,13 +128,13 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
128
128
|
(l ? x : me)(o);
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
|
-
[l, u,
|
|
131
|
+
[l, u, W, m]
|
|
132
132
|
), T = t.useCallback((e) => {
|
|
133
133
|
$.current = !0, e(), window.setTimeout(() => $.current = !1, 0);
|
|
134
134
|
}, []), Ue = t.useCallback(
|
|
135
135
|
(e) => {
|
|
136
136
|
var w, De;
|
|
137
|
-
const { keyCode: o, altKey: s } = e,
|
|
137
|
+
const { keyCode: o, altKey: s } = e, d = y.current && y.current.element;
|
|
138
138
|
if (!i.current || e.isDefaultPrevented() && ((w = S.current) == null ? void 0 : w.element) === e.target)
|
|
139
139
|
return;
|
|
140
140
|
const P = {
|
|
@@ -145,42 +145,43 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
145
145
|
if (l)
|
|
146
146
|
if (o === c.esc || s && o === c.up)
|
|
147
147
|
e.preventDefault(), x(P);
|
|
148
|
-
else if (
|
|
148
|
+
else if (d && d.querySelector(".k-focus") && (o === c.up || o === c.down || o === c.left || o === c.right || o === c.home || o === c.end)) {
|
|
149
149
|
if (o === c.up && ((De = S.current) != null && De.element)) {
|
|
150
|
-
const
|
|
151
|
-
if (Fe &&
|
|
150
|
+
const A = Array.from(d.querySelectorAll(".k-treeview-item")), Fe = [...A].reverse().find((M) => M == null ? void 0 : M.querySelector(".k-focus"));
|
|
151
|
+
if (Fe && A.indexOf(Fe) === 0)
|
|
152
152
|
return T(() => {
|
|
153
|
-
var
|
|
154
|
-
g((
|
|
153
|
+
var M;
|
|
154
|
+
g((M = S.current) == null ? void 0 : M.element);
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
T(U);
|
|
158
158
|
} else o === c.down && T(() => {
|
|
159
|
-
var
|
|
160
|
-
g(((
|
|
159
|
+
var A;
|
|
160
|
+
g(((A = S.current) == null ? void 0 : A.element) || d);
|
|
161
161
|
});
|
|
162
162
|
else s && o === c.down ? (e.preventDefault(), me(P)) : l || o === c.esc && he(e);
|
|
163
163
|
},
|
|
164
|
-
[l, u,
|
|
164
|
+
[l, u, W, m]
|
|
165
165
|
), ve = t.useCallback((e) => {
|
|
166
166
|
const { keyCode: o, altKey: s } = e;
|
|
167
167
|
s || o !== c.up && o !== c.down || (e.preventDefault(), T(
|
|
168
168
|
o === c.up ? () => {
|
|
169
169
|
g(f.current);
|
|
170
170
|
} : () => {
|
|
171
|
-
|
|
171
|
+
var d;
|
|
172
|
+
g((d = y.current) == null ? void 0 : d.element);
|
|
172
173
|
}
|
|
173
174
|
));
|
|
174
175
|
}, []), g = t.useCallback((e) => {
|
|
175
176
|
e && T(() => e.focus());
|
|
176
177
|
}, []), Xe = t.useCallback(() => {
|
|
177
178
|
var e;
|
|
178
|
-
!
|
|
179
|
-
}, [m, r.filterable,
|
|
180
|
-
|
|
181
|
-
}, [
|
|
179
|
+
!p && l && !u ? x({ target: i.current }) : r.filterable ? g((e = S.current) == null ? void 0 : e.element) : g(y.current && y.current.element);
|
|
180
|
+
}, [m, r.filterable, p, u, l]), je = t.useCallback(() => {
|
|
181
|
+
p && g(f.current);
|
|
182
|
+
}, [p]), Ge = t.useCallback(
|
|
182
183
|
(e) => {
|
|
183
|
-
if (!
|
|
184
|
+
if (!p && !$.current && (te(!0), r.onFocus && i.current)) {
|
|
184
185
|
const o = {
|
|
185
186
|
syntheticEvent: e,
|
|
186
187
|
nativeEvent: e.nativeEvent,
|
|
@@ -189,10 +190,10 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
189
190
|
r.onFocus.call(void 0, o);
|
|
190
191
|
}
|
|
191
192
|
},
|
|
192
|
-
[
|
|
193
|
+
[p, r.onFocus]
|
|
193
194
|
), Je = t.useCallback(
|
|
194
195
|
(e) => {
|
|
195
|
-
if (
|
|
196
|
+
if (p && !$.current && i.current) {
|
|
196
197
|
te(!1);
|
|
197
198
|
const o = {
|
|
198
199
|
syntheticEvent: e,
|
|
@@ -203,40 +204,40 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
203
204
|
const s = { ...o };
|
|
204
205
|
r.onBlur.call(void 0, s);
|
|
205
206
|
}
|
|
206
|
-
|
|
207
|
+
h || x(o);
|
|
207
208
|
}
|
|
208
209
|
},
|
|
209
|
-
[
|
|
210
|
+
[p, r.onBlur, l, u, m]
|
|
210
211
|
), Qe = t.useCallback(() => {
|
|
211
|
-
|
|
212
|
+
p && T(U), h && setTimeout(() => {
|
|
212
213
|
var e;
|
|
213
214
|
g((e = Q.current) == null ? void 0 : e.element);
|
|
214
215
|
}, 300);
|
|
215
|
-
}, [
|
|
216
|
+
}, [p, h]), ge = t.useCallback(
|
|
216
217
|
(e, o, s) => {
|
|
217
218
|
if (r.onChange) {
|
|
218
|
-
const
|
|
219
|
+
const d = {
|
|
219
220
|
value: o,
|
|
220
221
|
level: s ? Ne(s) : [],
|
|
221
222
|
...e
|
|
222
223
|
};
|
|
223
|
-
r.onChange.call(void 0,
|
|
224
|
+
r.onChange.call(void 0, d);
|
|
224
225
|
}
|
|
225
226
|
C || ze(o);
|
|
226
227
|
},
|
|
227
228
|
[r.onChange, C]
|
|
228
229
|
), be = t.useCallback(
|
|
229
230
|
(e) => {
|
|
230
|
-
if (Re(e.item, v,
|
|
231
|
+
if (Re(e.item, v, O) || !i.current)
|
|
231
232
|
return;
|
|
232
|
-
const { item: o, itemHierarchicalIndex: s, nativeEvent:
|
|
233
|
+
const { item: o, itemHierarchicalIndex: s, nativeEvent: d, syntheticEvent: P } = e, w = {
|
|
233
234
|
syntheticEvent: P,
|
|
234
|
-
nativeEvent:
|
|
235
|
+
nativeEvent: d,
|
|
235
236
|
target: i.current
|
|
236
237
|
};
|
|
237
238
|
ge(w, o, s), x(w);
|
|
238
239
|
},
|
|
239
|
-
[C, v, r.onChange,
|
|
240
|
+
[C, v, r.onChange, O, l, u, m]
|
|
240
241
|
), he = t.useCallback(
|
|
241
242
|
(e) => {
|
|
242
243
|
if (!i.current)
|
|
@@ -252,10 +253,10 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
252
253
|
), Ee = t.useCallback(
|
|
253
254
|
(e) => {
|
|
254
255
|
if (e.syntheticEvent.stopPropagation(), r.onExpandChange && i.current) {
|
|
255
|
-
const { item: o, itemHierarchicalIndex: s, nativeEvent:
|
|
256
|
+
const { item: o, itemHierarchicalIndex: s, nativeEvent: d, syntheticEvent: P } = e, w = {
|
|
256
257
|
level: Ne(s),
|
|
257
258
|
item: o,
|
|
258
|
-
nativeEvent:
|
|
259
|
+
nativeEvent: d,
|
|
259
260
|
syntheticEvent: P,
|
|
260
261
|
target: i.current
|
|
261
262
|
};
|
|
@@ -289,9 +290,9 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
289
290
|
onChange: ye,
|
|
290
291
|
onKeyDown: ve,
|
|
291
292
|
size: "large",
|
|
292
|
-
rounded:
|
|
293
|
-
fillMode:
|
|
294
|
-
placeholder:
|
|
293
|
+
rounded: z,
|
|
294
|
+
fillMode: q,
|
|
295
|
+
placeholder: B
|
|
295
296
|
}
|
|
296
297
|
) : null, o = {
|
|
297
298
|
title: a.adaptiveTitle || I,
|
|
@@ -301,17 +302,17 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
301
302
|
windowWidth: ne,
|
|
302
303
|
mobileFilter: e
|
|
303
304
|
};
|
|
304
|
-
return /* @__PURE__ */ t.createElement(Dt, { ...o }, /* @__PURE__ */ t.createElement(Ft, null,
|
|
305
|
+
return /* @__PURE__ */ t.createElement(Dt, { ...o }, /* @__PURE__ */ t.createElement(Ft, null, N.length > 0 ? /* @__PURE__ */ t.createElement(
|
|
305
306
|
Te,
|
|
306
307
|
{
|
|
307
|
-
ref:
|
|
308
|
+
ref: y,
|
|
308
309
|
tabIndex: J,
|
|
309
310
|
data: Ce,
|
|
310
|
-
focusIdField:
|
|
311
|
+
focusIdField: O,
|
|
311
312
|
textField: a.textField,
|
|
312
313
|
selectField: H,
|
|
313
314
|
expandField: a.expandField,
|
|
314
|
-
childrenField:
|
|
315
|
+
childrenField: L,
|
|
315
316
|
expandIcons: !0,
|
|
316
317
|
onItemClick: be,
|
|
317
318
|
onExpandChange: Ee,
|
|
@@ -324,18 +325,18 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
324
325
|
}, et = t.useCallback((e) => {
|
|
325
326
|
for (const o of e)
|
|
326
327
|
_e(o.target.clientWidth);
|
|
327
|
-
}, []), Ce = t.useMemo(() => C || !
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
(e) => dt(e,
|
|
331
|
-
), [
|
|
328
|
+
}, []), Ce = t.useMemo(() => C || !K ? N : ut(
|
|
329
|
+
N,
|
|
330
|
+
L,
|
|
331
|
+
(e) => dt(e, L, { [H]: Re(e, v, O) })
|
|
332
|
+
), [N, v, C, K, H, L]), ke = a.listNoData || yt, tt = a.valueHolder || Mt, oe = vt(), xe = !Ke || ee.valid, { size: R, rounded: z, fillMode: q } = a, we = /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
332
333
|
"span",
|
|
333
334
|
{
|
|
334
335
|
className: ae("k-dropdowntree k-picker", a.className, {
|
|
335
336
|
[`k-picker-${It[R] || R}`]: R,
|
|
336
|
-
[`k-rounded-${St[
|
|
337
|
-
[`k-picker-${
|
|
338
|
-
"k-focus":
|
|
337
|
+
[`k-rounded-${St[z] || z}`]: z,
|
|
338
|
+
[`k-picker-${q}`]: q,
|
|
339
|
+
"k-focus": p,
|
|
339
340
|
"k-invalid": !xe,
|
|
340
341
|
"k-loading": a.loading,
|
|
341
342
|
"k-required": G,
|
|
@@ -344,13 +345,13 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
344
345
|
tabIndex: J,
|
|
345
346
|
accessKey: a.accessKey,
|
|
346
347
|
id: le,
|
|
347
|
-
style: I ? { ...
|
|
348
|
+
style: I ? { ...V, width: void 0 } : V,
|
|
348
349
|
dir: k,
|
|
349
350
|
ref: f,
|
|
350
351
|
onKeyDown: F ? void 0 : Ue,
|
|
351
352
|
onMouseDown: Qe,
|
|
352
353
|
onClick: F ? void 0 : fe,
|
|
353
|
-
onFocus:
|
|
354
|
+
onFocus: h ? (e) => fe(e) : Ge,
|
|
354
355
|
onBlur: Je,
|
|
355
356
|
role: "combobox",
|
|
356
357
|
"aria-haspopup": "tree",
|
|
@@ -361,9 +362,9 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
361
362
|
"aria-describedby": a.ariaDescribedBy,
|
|
362
363
|
"aria-required": G
|
|
363
364
|
},
|
|
364
|
-
/* @__PURE__ */ t.createElement("span", { className: "k-input-inner" }, (Y ||
|
|
365
|
+
/* @__PURE__ */ t.createElement("span", { className: "k-input-inner" }, (Y || B) && /* @__PURE__ */ t.createElement(tt, { item: v }, Y || B)),
|
|
365
366
|
a.loading && /* @__PURE__ */ t.createElement(Se, { className: "k-input-loading-icon", name: "loading" }),
|
|
366
|
-
|
|
367
|
+
K && !F && /* @__PURE__ */ t.createElement(
|
|
367
368
|
"span",
|
|
368
369
|
{
|
|
369
370
|
onClick: he,
|
|
@@ -383,7 +384,7 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
383
384
|
"aria-label": "select",
|
|
384
385
|
className: "k-input-button",
|
|
385
386
|
size: R,
|
|
386
|
-
fillMode:
|
|
387
|
+
fillMode: q,
|
|
387
388
|
themeColor: "base",
|
|
388
389
|
rounded: null,
|
|
389
390
|
icon: "caret-alt-down",
|
|
@@ -402,13 +403,13 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
402
403
|
},
|
|
403
404
|
/* @__PURE__ */ t.createElement("option", { value: a.valueMap ? a.valueMap.call(void 0, v) : v })
|
|
404
405
|
),
|
|
405
|
-
!
|
|
406
|
+
!h && /* @__PURE__ */ t.createElement(Ie.Provider, { value: qe }, /* @__PURE__ */ t.createElement(
|
|
406
407
|
ft,
|
|
407
408
|
{
|
|
408
409
|
...b,
|
|
409
410
|
className: ae(b.className, { "k-rtl": k === "rtl" }),
|
|
410
411
|
popupClass: ae(b.popupClass, "k-dropdowntree-popup k-list-container"),
|
|
411
|
-
style:
|
|
412
|
+
style: Be,
|
|
412
413
|
anchor: b.anchor || f.current,
|
|
413
414
|
show: l,
|
|
414
415
|
onOpen: Xe,
|
|
@@ -422,24 +423,24 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
422
423
|
onChange: ye,
|
|
423
424
|
onKeyDown: ve,
|
|
424
425
|
size: R,
|
|
425
|
-
rounded:
|
|
426
|
-
fillMode:
|
|
426
|
+
rounded: z,
|
|
427
|
+
fillMode: q,
|
|
427
428
|
renderListFilterWrapper: !0,
|
|
428
429
|
renderPrefixSeparator: !0
|
|
429
430
|
}
|
|
430
431
|
),
|
|
431
|
-
|
|
432
|
+
N.length > 0 ? /* @__PURE__ */ t.createElement(
|
|
432
433
|
Te,
|
|
433
434
|
{
|
|
434
435
|
style: { height: b.height },
|
|
435
|
-
ref:
|
|
436
|
+
ref: y,
|
|
436
437
|
tabIndex: J,
|
|
437
438
|
data: Ce,
|
|
438
|
-
focusIdField:
|
|
439
|
+
focusIdField: O,
|
|
439
440
|
textField: a.textField,
|
|
440
441
|
selectField: H,
|
|
441
442
|
expandField: a.expandField,
|
|
442
|
-
childrenField:
|
|
443
|
+
childrenField: L,
|
|
443
444
|
expandIcons: !0,
|
|
444
445
|
onItemClick: be,
|
|
445
446
|
onExpandChange: Ee,
|
|
@@ -451,17 +452,17 @@ const { sizeMap: It, roundedMap: St } = mt, Tt = 12e3, Rt = 2e3, Pt = "Please se
|
|
|
451
452
|
) : /* @__PURE__ */ t.createElement(ke, null, oe.toLanguageString(X, re[X])),
|
|
452
453
|
j && /* @__PURE__ */ t.createElement(pt, null)
|
|
453
454
|
))
|
|
454
|
-
),
|
|
455
|
+
), h && Ye());
|
|
455
456
|
return I ? /* @__PURE__ */ t.createElement(
|
|
456
457
|
Ct,
|
|
457
458
|
{
|
|
458
459
|
label: I,
|
|
459
460
|
editorValue: Y,
|
|
460
|
-
editorPlaceholder:
|
|
461
|
+
editorPlaceholder: B,
|
|
461
462
|
editorValid: xe,
|
|
462
463
|
editorDisabled: F,
|
|
463
464
|
editorId: le,
|
|
464
|
-
style: { width:
|
|
465
|
+
style: { width: V ? V.width : void 0 },
|
|
465
466
|
children: we,
|
|
466
467
|
dir: k
|
|
467
468
|
}
|
|
@@ -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 f=require("react");function
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react");function a(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,i.get?i:{enumerable:!0,get:()=>t[e]})}}return n.default=t,Object.freeze(n)}const p=a(f);function h(t,n,e){const[i,o]=p.useState(n);return p.useEffect(()=>{i!==void 0&&t.current&&o(t.current.offsetWidth)},e),i}function c(t){return typeof t=="string"?Number(t.replace("px","")):t}function l(t,n,e,i){const o=c(n.popupSettings.width),d=(e.width!==void 0&&c(e.width))!==o,u=i.width!==void 0,s=d?e.width:u?i.width:o,r=c(h(t,s));return d||u?s:r&&o&&r>o?r:o}exports.useDropdownWidth=l;
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
function
|
|
10
|
-
const [d, i] =
|
|
11
|
-
return
|
|
8
|
+
import * as u from "react";
|
|
9
|
+
function c(t, e, n) {
|
|
10
|
+
const [d, i] = u.useState(e);
|
|
11
|
+
return u.useEffect(() => {
|
|
12
12
|
d !== void 0 && t.current && i(t.current.offsetWidth);
|
|
13
13
|
}, n), d;
|
|
14
14
|
}
|
|
15
15
|
function r(t) {
|
|
16
|
-
return typeof t == "string" ? Number(t.replace("px", "")) : t
|
|
16
|
+
return typeof t == "string" ? Number(t.replace("px", "")) : t;
|
|
17
17
|
}
|
|
18
|
-
function W(t,
|
|
19
|
-
const i = r(
|
|
20
|
-
return s || h ? p :
|
|
18
|
+
function W(t, e, n, d) {
|
|
19
|
+
const i = r(e.popupSettings.width), s = (n.width !== void 0 && r(n.width)) !== i, h = d.width !== void 0, p = s ? n.width : h ? d.width : i, o = r(c(t, p));
|
|
20
|
+
return s || h ? p : o && i && o > i ? o : i;
|
|
21
21
|
}
|
|
22
22
|
export {
|
|
23
23
|
W as useDropdownWidth
|
|
@@ -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 ue=require("react"),ie=require("prop-types"),de=require("../common/MultiColumnList.js"),
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ue=require("react"),ie=require("prop-types"),de=require("../common/MultiColumnList.js"),n=require("@progress/kendo-react-common"),j=require("../ComboBox/ComboBox.js"),ce=require("../common/utils.js"),K=require("../common/withCustomComponent.js");function pe(r){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const d=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(i,e,d.get?d:{enumerable:!0,get:()=>r[e]})}}return i.default=r,Object.freeze(i)}const t=pe(ue),me=(r,i)=>r?typeof r=="number"?r+"px":r:i,G=n.createPropsContext(),y=t.forwardRef((r,i)=>{const e=n.usePropsContext(G,r),d=t.useRef(null),c=t.useRef(null),S=n.getScrollbarWidth(),{columns:l=u.columns,popupSettings:f=u.popupSettings,size:W=u.size,rounded:z=u.rounded,fillMode:L=u.fillMode,className:_,prefix:D=void 0,suffix:$=void 0,onOpen:w,onClose:M,onFocus:N,onBlur:E,onChange:F,onFilterChange:H,onPageChange:R,...V}=e;t.useImperativeHandle(d,()=>{var o;return{element:((o=c.current)==null?void 0:o.element)||null,focus(){c.current&&c.current.focus()},get value(){var a;return(a=c.current)==null?void 0:a.value},get name(){var a;return(a=c.current)==null?void 0:a.name},props:e}}),t.useImperativeHandle(i,()=>d.current);const g=t.useMemo(()=>{if(e.groupField!==void 0&&e.data)return ce.getItemValue(e.data[0],e.groupField)},[e.data,e.groupField]),[k,b]=t.useState(g),[q,B]=t.useState(!0),[A]=D?K(e.prefix||t.Fragment):[],[J]=$?K(e.suffix||t.Fragment):[],Q=t.useMemo(()=>{const o=t.createElement("th",{className:"k-table-th",colSpan:l.length},k);return t.createElement(t.Fragment,null,e.header,t.createElement("div",{className:"k-table-header-wrap"},t.createElement("table",{className:"k-table",role:"presentation"},t.createElement("colgroup",null,l.map((a,p)=>t.createElement("col",{key:a.uniqueKey?a.uniqueKey:p,style:{width:a.width?a.width:u.width}}))),t.createElement("thead",{className:"k-table-thead"},t.createElement("tr",{className:"k-table-row"},l.map((a,p)=>t.createElement("th",{className:"k-table-th",key:a.uniqueKey?a.uniqueKey:p},a.header||" "))),k&&q&&t.createElement("tr",{className:"k-table-group-row"},e.groupStickyHeaderItemRender?e.groupStickyHeaderItemRender.call(void 0,o,{}):o)))))},[e.header,l,k,q]),U=t.useMemo(()=>`calc(${l.map(o=>me(o.width,u.width)).filter(Boolean).join(" + ")} + ${S}px + 4px)`,[l,S]),I=e.virtual?e.virtual.skip:0,X=t.useCallback((o,a)=>{const p=l.map((m,se)=>t.createElement("span",{className:e.itemRender?void 0:"k-table-td",style:e.itemRender?void 0:{width:m.width?m.width:u.width},key:m.uniqueKey?m.uniqueKey:se},m.field?String(n.getter(m.field)(a.dataItem)):""));let C,h,v,x,O=e.data||[];const P=a.index-I;e.groupField!==void 0&&(x=n.getter(e.groupField),h=x(O[P]),v=x(O[P-1]),h&&v&&h!==v&&(C=h)),C&&e.groupMode==="classic"&&p.push(t.createElement("div",{key:"group",className:"k-table-td k-table-group-td"},t.createElement("span",null,C)));const T=t.cloneElement(o,{...o.props,className:n.classNames("k-table-row",{"k-table-alt-row":a.index%2!==0,"k-focus":a.focused,"k-selected":a.selected,"k-first":!!C,"k-disabled":a.dataItem.disabled})},p);return e.itemRender?e.itemRender.call(void 0,T,a):T},[l,e.groupField,e.itemRender,e.data,I]),s=t.useCallback((o,a)=>{o&&o.call(void 0,{...a,target:d.current})},[]),Y=t.useCallback(o=>(e.virtual||b(g),s(w,o)),[s,w,e.virtual,g]),Z=t.useCallback(o=>s(M,o),[M]),ee=t.useCallback(o=>s(N,o),[N]),te=t.useCallback(o=>s(E,o),[E]),oe=t.useCallback(o=>s(F,o),[F]),ae=t.useCallback(o=>s(R,o),[R]),re=t.useCallback(o=>(b(g),s(H,{...o,mobileMode:o.target.mobileMode})),[H]),ne=t.useCallback(o=>{b(o.group)},[]);t.useEffect(()=>{n.setScrollbarWidth()}),t.useEffect(()=>{const o=e.data;b(g),o&&o.length!==0?B(!0):B(!1)},[e.data]);const le=t.useCallback(o=>t.createElement(de.MultiColumnList,{...o}),[]);return t.createElement(j.ComboBox,{...V,list:le,popupSettings:{...f,popupClass:n.classNames("k-dropdowngrid-popup",f.popupClass),width:f.width||U,className:f.className},ref:c,header:Q,itemRender:X,groupHeaderItemRender:e.groupHeaderItemRender,size:W,rounded:z,fillMode:L,groupMode:e.groupMode,groupField:e.groupField,isMultiColumn:!0,onOpen:Y,onClose:Z,onFocus:ee,onBlur:te,onChange:oe,onFilterChange:re,onPageChange:ae,onGroupScroll:ne,className:n.classNames("k-dropdowngrid",_),required:e.required,adaptive:e.adaptive,adaptiveFilter:e.adaptiveFilter,adaptiveTitle:e.adaptiveTitle,adaptiveSubtitle:e.adaptiveSubtitle,footer:e.footer,footerClassName:"k-table-footer",prefix:A,suffix:J})}),ge={...j.ComboBoxWithoutContext.propTypes,columns:ie.any.isRequired},u={columns:[],popupSettings:{},width:"200px",size:"medium",rounded:"medium",fillMode:"solid"};y.displayName="KendoMultiColumnComboBox";y.propTypes=ge;exports.MultiColumnComboBox=y;exports.MultiColumnComboBoxPropsContext=G;
|