@progress/kendo-react-dropdowns 7.4.0 → 7.5.0-develop.10
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.js +1 -1
- package/AutoComplete/AutoComplete.mjs +30 -29
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +57 -55
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +57 -55
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +188 -184
- package/DropDownTree/useDropdownWidth.js +1 -1
- package/DropDownTree/useDropdownWidth.mjs +12 -9
- package/MultiSelectTree/MultiSelectTree.js +1 -1
- package/MultiSelectTree/MultiSelectTree.mjs +92 -90
- package/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +10 -5
- package/common/DropDownBase.js +1 -1
- package/common/DropDownBase.mjs +81 -77
- package/common/ListFilter.js +1 -1
- package/common/ListFilter.mjs +31 -26
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +4 -0
- package/index.d.ts +4 -0
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
|
@@ -7,19 +7,22 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as p from "react";
|
|
10
|
-
function u(
|
|
11
|
-
const [
|
|
10
|
+
function u(t, e, n) {
|
|
11
|
+
const [d, i] = p.useState(e);
|
|
12
12
|
return p.useEffect(
|
|
13
13
|
() => {
|
|
14
|
-
|
|
14
|
+
d !== void 0 && t.current && i(t.current.offsetWidth);
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
),
|
|
16
|
+
n
|
|
17
|
+
), d;
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
function r(t) {
|
|
20
|
+
return typeof t == "string" ? Number(t.replace("px", "")) : t || void 0;
|
|
21
|
+
}
|
|
22
|
+
function W(t, e, n, d) {
|
|
23
|
+
const i = r(e.popupSettings.width), s = (n.width !== void 0 && r(n.width)) !== i, c = d.width !== void 0, h = s ? n.width : c ? d.width : i, o = r(u(t, h));
|
|
24
|
+
return s || c ? h : o && i && o > i ? o : i;
|
|
22
25
|
}
|
|
23
26
|
export {
|
|
24
|
-
|
|
27
|
+
W as useDropdownWidth
|
|
25
28
|
};
|
|
@@ -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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ze=require("react"),a=require("prop-types"),i=require("@progress/kendo-react-common"),et=require("@progress/kendo-react-popup"),tt=require("@progress/kendo-react-intl"),we=require("@progress/kendo-react-treeview"),nt=require("../package-metadata.js"),ee=require("../common/utils.js"),at=require("../DropDownTree/useDropdownWidth.js"),st=require("../DropDownTree/ListNoData.js"),m=require("../messages/index.js"),it=require("@progress/kendo-react-labels"),ot=require("../MultiSelect/TagList.js"),rt=require("../common/ClearButton.js"),Ie=require("../common/ListFilter.js"),lt=require("../common/AdaptiveMode.js"),ct=require("@progress/kendo-react-layout"),ut=require("../common/constants.js");function dt(h){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const w=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(b,t,w.get?w:{enumerable:!0,get:()=>h[t]})}}return b.default=h,Object.freeze(b)}const n=dt(Ze),pt="Please select a value from the list!",{sizeMap:Te,roundedMap:ft}=i.kendoThemeMaps,gt=h=>h.split("_").map(b=>parseInt(b,10)),vt=(h,b)=>{const{validationMessage:t,valid:w,required:I}=h;return{customError:t!==void 0,valid:!!(w!==void 0?w:!I||b),valueMissing:!b}},q={checkField:"checkField",checkIndeterminateField:"checkIndeterminateField",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},size:"medium",rounded:"medium",fillMode:"solid",required:!1,validityStyles:!0},Ke=i.createPropsContext(),te=n.forwardRef((h,b)=>{const t=i.usePropsContext(Ke,h);i.validatePackage(nt.packageMetadata);const w=i.useId(),I=t.id||w,{data:B=[],dataItemKey:T,popupSettings:N={},style:L={},opened:K,disabled:F,onOpen:ne=i.noop,onClose:W=i.noop,placeholder:ue,label:V,name:Me,checkField:de=q.checkField,checkIndeterminateField:pe=q.checkIndeterminateField,subItemsField:fe=q.subItemsField,validationMessage:z,valid:Re,tags:ge,value:g,required:ve=q.required,validityStyles:De=q.validityStyles}=t,_=i.getTabIndex(t.tabIndex,F),r=n.useRef(null),E=n.useRef(null),M=n.useRef(null),ae=n.useRef(null),j=n.useRef(null),x=n.useRef(null),$=n.useRef(!1),H=n.useRef([]),G=n.useRef(null),[O,qe]=n.useState(),[Ne,me]=n.useState(!1),[d,se]=n.useState(!1),[ie,Oe]=n.useState(),[Pe,Le]=n.useState([]),[he,Ve]=n.useState(""),P=!!(ie&&ie<=ut.MOBILE_MEDIUM_DEVISE&&t.adaptive),l=K!==void 0?K:Ne,oe=!!(Array.isArray(g)&&g.length),re=vt({validationMessage:z,valid:Re,required:ve},oe),R=i.useRtl(E,t.dir),Ae={width:at.useDropdownWidth(E,q,N,L),...R!==void 0?{direction:R}:{}},Be=n.useCallback(()=>E.current&&E.current.focus(),[]);H.current=ge===void 0?(g||[]).map(e=>({text:ee.getItemValue(e,t.textField),data:[e]})):[...ge],n.useImperativeHandle(r,()=>({props:t,element:E.current,focus:Be})),n.useImperativeHandle(b,()=>r.current);const We=n.useCallback(()=>{j.current&&j.current.setCustomValidity&&j.current.setCustomValidity(re.valid?"":z===void 0?pt:z)},[z,re]);n.useEffect(We),n.useEffect(()=>{const e=i.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Xe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{e&&e.disconnect()}},[]),n.useEffect(()=>{G.current&&l&&G.current.setPosition(G.current._popup)},[g,l]);const S=n.useCallback((e,s,o)=>{if(t.onChange){const C={items:s,operation:o,...e};t.onChange.call(void 0,C)}},[t.onChange]),U=n.useCallback(e=>{if(ee.areSame(e.item,g,T)||!r.current)return;const{item:s,nativeEvent:o,syntheticEvent:C}=e,D={syntheticEvent:C,nativeEvent:o,target:r.current};S(D,[s],"toggle")},[g,T,S]),J=n.useCallback(e=>{if(!l){if(ne){const s={...e};ne.call(void 0,s)}K===void 0&&(me(!0),Le(g||[]),P&&setTimeout(()=>{var s;u((s=ae.current)==null?void 0:s.element)},300))}},[l,K,ne,P,ae]),v=n.useCallback(e=>{if(l){if(W){const s={...e};W.call(void 0,s)}K===void 0&&me(!1)}},[l,K,W]),k=n.useCallback(e=>{$.current=!0,e(),window.setTimeout(()=>$.current=!1,0)},[]),u=n.useCallback(e=>{e&&k(()=>e.focus())},[k]),ze=n.useCallback(()=>{var e;!d&&l?v({target:r.current}):t.filterable?u((e=M.current)==null?void 0:e.element):u(x.current&&x.current.element)},[d,l,u,v,t.filterable]),_e=n.useCallback(()=>{d&&u(E.current)},[d,u]),je=n.useCallback(e=>{if(!d&&!$.current&&(se(!0),t.onFocus&&r.current)){const s={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};t.onFocus.call(void 0,s)}},[d,t.onFocus]),$e=n.useCallback(e=>{if(d&&!$.current&&r.current){se(!1);const s={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};if(t.onBlur){const o={...s};t.onBlur.call(void 0,o)}P||v(s)}},[d,t.onBlur,l,K,W]),He=n.useCallback(()=>{d&&k(i.noop)},[d,k]),Ge=n.useCallback(e=>{if(!e.isDefaultPrevented()&&r.current){se(!0);const s={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};l||J(s)}},[l,J]),Ue=n.useCallback(e=>{var Z,Se;const{keyCode:s,altKey:o}=e,C=x.current&&x.current.element;if(!r.current||e.isDefaultPrevented()&&((Z=M.current)==null?void 0:Z.element)===e.target)return;const D={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};if(g&&g.length>0&&(s===i.Keys.left||s===i.Keys.right||s===i.Keys.home||s===i.Keys.end||s===i.Keys.delete)){const c=H.current;let p=O?c.findIndex(Ye=>ee.matchTags(Ye,O,T)):-1,f;const ce=p!==-1;s===i.Keys.left?(ce?p=Math.max(0,p-1):p=c.length-1,f=c[p]):s===i.Keys.right?p===c.length-1?f=void 0:ce&&(p=Math.min(c.length-1,p+1),f=c[p]):s===i.Keys.home?f=c[0]:s===i.Keys.end?f=c[c.length-1]:s===i.Keys.delete&&ce&&S(D,c[p].data,"delete"),f!==O&&qe(f)}if(l)if(s===i.Keys.esc||o&&s===i.Keys.up)e.preventDefault(),v(D);else if(C&&C.querySelector(".k-focus")&&(s===i.Keys.up||s===i.Keys.down||s===i.Keys.left||s===i.Keys.right||s===i.Keys.home||s===i.Keys.end)){if(s===i.Keys.up&&((Se=M.current)!=null&&Se.element)){const c=Array.from(C.querySelectorAll(".k-treeview-item")),p=[...c].reverse().find(f=>!!(f&&f.querySelector(".k-focus")));if(p&&c.indexOf(p)===0)return k(()=>{var f;u((f=M.current)==null?void 0:f.element)})}k(i.noop)}else s===i.Keys.down&&k(()=>{var c;u(((c=M.current)==null?void 0:c.element)||C)});else o&&s===i.Keys.down&&(e.preventDefault(),J(D))},[l,v,u,k,J,O,T,g,S]),ye=n.useCallback(e=>{const{keyCode:s,altKey:o}=e;o||s!==i.Keys.up&&s!==i.Keys.down||(e.preventDefault(),k(s===i.Keys.up?()=>{u(E.current)}:()=>{u(x.current&&x.current.element)}))},[u,k]),le=n.useCallback(e=>{if(!r.current)return;const s={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};S(s,[],"clear"),v(s),e.preventDefault()},[S,v]),Je=n.useCallback((e,s)=>{var o;v({target:r.current}),d||u((o=M.current)==null?void 0:o.element),S({syntheticEvent:s,nativeEvent:s.nativeEvent,target:r.current},e,"delete")},[S,v,u,d]),be=n.useCallback(e=>{if(t.onExpandChange&&r.current){const{item:s,itemHierarchicalIndex:o,nativeEvent:C,syntheticEvent:D}=e,Z={level:gt(o),item:s,nativeEvent:C,syntheticEvent:D,target:r.current};t.onExpandChange.call(void 0,Z)}},[t.onExpandChange]),ke=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&&Ve(e.target.value)}},[t.onFilterChange,t.filter,t.textField]),Ce=n.useCallback(e=>{if(!r.current)return;const s={syntheticEvent:e,nativeEvent:e.nativeEvent,target:r.current};t.onCancel&&t.onCancel.call(void 0,s),v(s),e.preventDefault()},[t.onCancel,v]),Qe=()=>{const e=t.filterable?n.createElement(Ie,{value:t.filter===void 0?he:t.filter,ref:ae,onChange:ke,onKeyDown:ye,size:y,rounded:A,fillMode:X}):null,s={adaptiveTitle:t.adaptiveTitle,expand:l,onClose:o=>t.onCancel?Ce(o):le(o),windowWidth:ie,mobileFilter:e,footer:{cancelText:Q.toLanguageString(m.adaptiveModeFooterCancel,m.messages[m.adaptiveModeFooterCancel]),onCancel:o=>t.onCancel?Ce(o):le(o),applyText:Q.toLanguageString(m.adaptiveModeFooterApply,m.messages[m.adaptiveModeFooterApply]),onApply:o=>v(o)}};return n.createElement(lt.AdaptiveMode,{...s},n.createElement(ct.ActionSheetContent,{className:"!k-overflow-hidden"},n.createElement("div",{className:"k-list-container"},n.createElement("div",{className:"k-list k-list-lg"},B.length>0?n.createElement(we.TreeView,{ref:x,tabIndex:_,data:B,focusIdField:T,textField:t.textField,checkField:de,checkIndeterminateField:pe,expandField:t.expandField,childrenField:fe,expandIcons:!0,onItemClick:U,onCheckChange:U,onExpandChange:be,checkboxes:!0,size:y,item:t.item,dir:R}):n.createElement(Ee,null,Q.toLanguageString(m.nodata,m.messages[m.nodata]))))))},Xe=n.useCallback(e=>{for(let s of e)Oe(s.target.clientWidth)},[]),Ee=t.listNoData||st.ListNoData,Q=tt.useLocalization(),Fe=!De||re.valid,{size:y,rounded:A,fillMode:X}=t,Y=P&&l?Pe:H.current,xe=n.createElement(n.Fragment,null,n.createElement("span",{className:i.classNames("k-multiselecttree k-input",t.className,{[`k-input-${Te[y]||y}`]:y,[`k-rounded-${ft[A]||A}`]:A,[`k-input-${X}`]:X,"k-focus":d&&!F,"k-invalid":!Fe,"k-disabled":F,"k-loading":t.loading,"k-required":ve}),tabIndex:_,accessKey:t.accessKey,id:I,style:V?{...L,width:void 0}:L,dir:R,ref:E,onKeyDown:F?void 0:Ue,onMouseDown:He,onFocus:je,onBlur:$e,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-"+I,"aria-required":t.required,onClick:F?void 0:Ge},n.createElement("div",{id:"tagslist-"+I,className:i.classNames("k-input-values k-chip-list k-selection-multiple",{[`k-chip-list-${Te[y]||y}`]:y})},Y.length>0&&n.createElement(ot,{tag:t.tag,onTagDelete:Je,data:Y,guid:I,focused:O?H.current.find(e=>ee.matchTags(e,O,T)):void 0,size:y})),n.createElement("span",{className:"k-input-inner"},Y.length===0&&n.createElement("span",{className:"k-input-value-text"},ue)),t.loading&&n.createElement(i.IconWrap,{className:"k-input-loading-icon",name:"loading"}),oe&&!F&&Y.length>0&&n.createElement(rt,{onClick:le}),n.createElement("select",{name:Me,ref:j,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})),!P&&n.createElement(et.Popup,{...N,popupClass:i.classNames(N.popupClass,"k-multiselecttree-popup"),className:i.classNames(N.className,{"k-rtl":R==="rtl"}),style:Ae,anchor:N.anchor||E.current,show:l,onOpen:ze,onClose:_e,ref:G},t.filterable&&n.createElement(Ie,{value:t.filter===void 0?he:t.filter,ref:M,onChange:ke,onKeyDown:ye,tabIndex:_,size:y,rounded:A,fillMode:X}),B.length>0?n.createElement(we.TreeView,{style:{height:N.height},ref:x,tabIndex:_,data:B,focusIdField:T,textField:t.textField,checkField:de,checkIndeterminateField:pe,expandField:t.expandField,childrenField:fe,expandIcons:!0,onItemClick:U,onCheckChange:U,onExpandChange:be,checkboxes:!0,size:y,item:t.item,dir:R}):n.createElement(Ee,null,Q.toLanguageString(m.nodata,m.messages[m.nodata])))),P&&Qe());return V?n.createElement(it.FloatingLabel,{label:V,editorValue:oe,editorPlaceholder:ue,editorValid:Fe,editorDisabled:F,editorId:I,style:{width:L?L.width:void 0},children:xe,dir:R}):xe}),mt={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,adaptive:a.bool};te.displayName="KendoReactMultiSelectTree";te.defaultProps=q;te.propTypes=mt;exports.MultiSelectTree=te;exports.MultiSelectTreePropsContext=Ke;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ze=require("react"),a=require("prop-types"),s=require("@progress/kendo-react-common"),et=require("@progress/kendo-react-popup"),tt=require("@progress/kendo-react-intl"),we=require("@progress/kendo-react-treeview"),nt=require("../package-metadata.js"),ee=require("../common/utils.js"),at=require("../DropDownTree/useDropdownWidth.js"),rt=require("../DropDownTree/ListNoData.js"),m=require("../messages/index.js"),st=require("@progress/kendo-react-labels"),it=require("../MultiSelect/TagList.js"),ot=require("../common/ClearButton.js"),Ie=require("../common/ListFilter.js"),lt=require("../common/AdaptiveMode.js"),ct=require("@progress/kendo-react-layout"),ut=require("../common/constants.js");function dt(h){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const t in h)if(t!=="default"){const I=Object.getOwnPropertyDescriptor(h,t);Object.defineProperty(b,t,I.get?I:{enumerable:!0,get:()=>h[t]})}}return b.default=h,Object.freeze(b)}const n=dt(Ze),pt="Please select a value from the list!",{sizeMap:Te,roundedMap:ft}=s.kendoThemeMaps,gt=h=>h.split("_").map(b=>parseInt(b,10)),vt=(h,b)=>{const{validationMessage:t,valid:I,required:T}=h;return{customError:t!==void 0,valid:!!(I!==void 0?I:!T||b),valueMissing:!b}},w={checkField:"checkField",checkIndeterminateField:"checkIndeterminateField",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},size:"medium",rounded:"medium",fillMode:"solid",required:!1,validityStyles:!0},Ke=s.createPropsContext(),te=n.forwardRef((h,b)=>{const t=s.usePropsContext(Ke,h);s.validatePackage(nt.packageMetadata);const I=s.useId(),T=t.id||I,{data:B=[],dataItemKey:K,popupSettings:N={},style:L={},opened:M,disabled:F,onOpen:ne=s.noop,onClose:W=s.noop,placeholder:ue,label:V,name:Me,checkField:de=w.checkField,checkIndeterminateField:pe=w.checkIndeterminateField,subItemsField:fe=w.subItemsField,validationMessage:z,valid:Re,tags:ge,value:g,required:ve=w.required,validityStyles:De=w.validityStyles}=t,_=s.getTabIndex(t.tabIndex,F),o=n.useRef(null),E=n.useRef(null),R=n.useRef(null),ae=n.useRef(null),j=n.useRef(null),x=n.useRef(null),$=n.useRef(!1),H=n.useRef([]),G=n.useRef(null),[P,qe]=n.useState(),[Ne,me]=n.useState(!1),[d,re]=n.useState(!1),[se,Pe]=n.useState(),[Oe,Le]=n.useState([]),[he,Ve]=n.useState(""),O=!!(se&&se<=ut.MOBILE_MEDIUM_DEVISE&&t.adaptive),l=M!==void 0?M:Ne,ie=!!(Array.isArray(g)&&g.length),oe=vt({validationMessage:z,valid:Re,required:ve},ie),D=s.useRtl(E,t.dir),Ae={width:at.useDropdownWidth(E,w,{...w.popupSettings,...N},L),...D!==void 0?{direction:D}:{}},Be=n.useCallback(()=>E.current&&E.current.focus(),[]);H.current=ge===void 0?(g||[]).map(e=>({text:ee.getItemValue(e,t.textField),data:[e]})):[...ge],n.useImperativeHandle(o,()=>({props:t,element:E.current,focus:Be})),n.useImperativeHandle(b,()=>o.current);const We=n.useCallback(()=>{j.current&&j.current.setCustomValidity&&j.current.setCustomValidity(oe.valid?"":z===void 0?pt:z)},[z,oe]);n.useEffect(We),n.useEffect(()=>{const e=s.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Xe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{e&&e.disconnect()}},[]),n.useEffect(()=>{G.current&&l&&G.current.setPosition(G.current._popup)},[g,l]);const S=n.useCallback((e,r,i)=>{if(t.onChange){const k={items:r,operation:i,...e};t.onChange.call(void 0,k)}},[t.onChange]),U=n.useCallback(e=>{if(ee.areSame(e.item,g,K)||!o.current)return;const{item:r,nativeEvent:i,syntheticEvent:k}=e,q={syntheticEvent:k,nativeEvent:i,target:o.current};S(q,[r],"toggle")},[g,K,S]),J=n.useCallback(e=>{if(!l){if(ne){const r={...e};ne.call(void 0,r)}M===void 0&&(me(!0),Le(g||[]),O&&setTimeout(()=>{var r;u((r=ae.current)==null?void 0:r.element)},300))}},[l,M,ne,O,ae]),v=n.useCallback(e=>{if(l){if(W){const r={...e};W.call(void 0,r)}M===void 0&&me(!1)}},[l,M,W]),C=n.useCallback(e=>{$.current=!0,e(),window.setTimeout(()=>$.current=!1,0)},[]),u=n.useCallback(e=>{e&&C(()=>e.focus())},[C]),ze=n.useCallback(()=>{var e;!d&&l?v({target:o.current}):t.filterable?u((e=R.current)==null?void 0:e.element):u(x.current&&x.current.element)},[d,l,u,v,t.filterable]),_e=n.useCallback(()=>{d&&u(E.current)},[d,u]),je=n.useCallback(e=>{if(!d&&!$.current&&(re(!0),t.onFocus&&o.current)){const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};t.onFocus.call(void 0,r)}},[d,t.onFocus]),$e=n.useCallback(e=>{if(d&&!$.current&&o.current){re(!1);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};if(t.onBlur){const i={...r};t.onBlur.call(void 0,i)}O||v(r)}},[d,t.onBlur,l,M,W]),He=n.useCallback(()=>{d&&C(s.noop)},[d,C]),Ge=n.useCallback(e=>{if(!e.isDefaultPrevented()&&o.current){re(!0);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};l||J(r)}},[l,J]),Ue=n.useCallback(e=>{var Z,Se;const{keyCode:r,altKey:i}=e,k=x.current&&x.current.element;if(!o.current||e.isDefaultPrevented()&&((Z=R.current)==null?void 0:Z.element)===e.target)return;const q={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};if(g&&g.length>0&&(r===s.Keys.left||r===s.Keys.right||r===s.Keys.home||r===s.Keys.end||r===s.Keys.delete)){const c=H.current;let p=P?c.findIndex(Ye=>ee.matchTags(Ye,P,K)):-1,f;const ce=p!==-1;r===s.Keys.left?(ce?p=Math.max(0,p-1):p=c.length-1,f=c[p]):r===s.Keys.right?p===c.length-1?f=void 0:ce&&(p=Math.min(c.length-1,p+1),f=c[p]):r===s.Keys.home?f=c[0]:r===s.Keys.end?f=c[c.length-1]:r===s.Keys.delete&&ce&&S(q,c[p].data,"delete"),f!==P&&qe(f)}if(l)if(r===s.Keys.esc||i&&r===s.Keys.up)e.preventDefault(),v(q);else if(k&&k.querySelector(".k-focus")&&(r===s.Keys.up||r===s.Keys.down||r===s.Keys.left||r===s.Keys.right||r===s.Keys.home||r===s.Keys.end)){if(r===s.Keys.up&&((Se=R.current)!=null&&Se.element)){const c=Array.from(k.querySelectorAll(".k-treeview-item")),p=[...c].reverse().find(f=>!!(f&&f.querySelector(".k-focus")));if(p&&c.indexOf(p)===0)return C(()=>{var f;u((f=R.current)==null?void 0:f.element)})}C(s.noop)}else r===s.Keys.down&&C(()=>{var c;u(((c=R.current)==null?void 0:c.element)||k)});else i&&r===s.Keys.down&&(e.preventDefault(),J(q))},[l,v,u,C,J,P,K,g,S]),ye=n.useCallback(e=>{const{keyCode:r,altKey:i}=e;i||r!==s.Keys.up&&r!==s.Keys.down||(e.preventDefault(),C(r===s.Keys.up?()=>{u(E.current)}:()=>{u(x.current&&x.current.element)}))},[u,C]),le=n.useCallback(e=>{if(!o.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};S(r,[],"clear"),v(r),e.preventDefault()},[S,v]),Je=n.useCallback((e,r)=>{var i;v({target:o.current}),d||u((i=R.current)==null?void 0:i.element),S({syntheticEvent:r,nativeEvent:r.nativeEvent,target:o.current},e,"delete")},[S,v,u,d]),be=n.useCallback(e=>{if(t.onExpandChange&&o.current){const{item:r,itemHierarchicalIndex:i,nativeEvent:k,syntheticEvent:q}=e,Z={level:gt(i),item:r,nativeEvent:k,syntheticEvent:q,target:o.current};t.onExpandChange.call(void 0,Z)}},[t.onExpandChange]),Ce=n.useCallback(e=>{if(t.onFilterChange&&o.current){const i={filter:{field:t.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:o.current};t.onFilterChange.call(void 0,i),t.filter===void 0&&Ve(e.target.value)}},[t.onFilterChange,t.filter,t.textField]),ke=n.useCallback(e=>{if(!o.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};t.onCancel&&t.onCancel.call(void 0,r),v(r),e.preventDefault()},[t.onCancel,v]),Qe=()=>{const e=t.filterable?n.createElement(Ie,{value:t.filter===void 0?he:t.filter,ref:ae,onChange:Ce,onKeyDown:ye,size:y,rounded:A,fillMode:X}):null,r={adaptiveTitle:t.adaptiveTitle,expand:l,onClose:i=>t.onCancel?ke(i):le(i),windowWidth:se,mobileFilter:e,footer:{cancelText:Q.toLanguageString(m.adaptiveModeFooterCancel,m.messages[m.adaptiveModeFooterCancel]),onCancel:i=>t.onCancel?ke(i):le(i),applyText:Q.toLanguageString(m.adaptiveModeFooterApply,m.messages[m.adaptiveModeFooterApply]),onApply:i=>v(i)}};return n.createElement(lt.AdaptiveMode,{...r},n.createElement(ct.ActionSheetContent,{className:"!k-overflow-hidden"},n.createElement("div",{className:"k-list-container"},n.createElement("div",{className:"k-list k-list-lg"},B.length>0?n.createElement(we.TreeView,{ref:x,tabIndex:_,data:B,focusIdField:K,textField:t.textField,checkField:de,checkIndeterminateField:pe,expandField:t.expandField,childrenField:fe,expandIcons:!0,onItemClick:U,onCheckChange:U,onExpandChange:be,checkboxes:!0,size:y,item:t.item,dir:D}):n.createElement(Ee,null,Q.toLanguageString(m.nodata,m.messages[m.nodata]))))))},Xe=n.useCallback(e=>{for(let r of e)Pe(r.target.clientWidth)},[]),Ee=t.listNoData||rt.ListNoData,Q=tt.useLocalization(),Fe=!De||oe.valid,{size:y,rounded:A,fillMode:X}=t,Y=O&&l?Oe:H.current,xe=n.createElement(n.Fragment,null,n.createElement("span",{className:s.classNames("k-multiselecttree k-input",t.className,{[`k-input-${Te[y]||y}`]:y,[`k-rounded-${ft[A]||A}`]:A,[`k-input-${X}`]:X,"k-focus":d&&!F,"k-invalid":!Fe,"k-disabled":F,"k-loading":t.loading,"k-required":ve}),tabIndex:_,accessKey:t.accessKey,id:T,style:V?{...L,width:void 0}:L,dir:D,ref:E,onKeyDown:F?void 0:Ue,onMouseDown:He,onFocus:je,onBlur:$e,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-"+T,"aria-required":t.required,onClick:F?void 0:Ge},n.createElement("div",{id:"tagslist-"+T,className:s.classNames("k-input-values k-chip-list",{[`k-chip-list-${Te[y]||y}`]:y})},Y.length>0&&n.createElement(it,{tag:t.tag,onTagDelete:Je,data:Y,guid:T,focused:P?H.current.find(e=>ee.matchTags(e,P,K)):void 0,size:y})),n.createElement("span",{className:"k-input-inner"},Y.length===0&&n.createElement("span",{className:"k-input-value-text"},ue)),t.loading&&n.createElement(s.IconWrap,{className:"k-input-loading-icon",name:"loading"}),ie&&!F&&Y.length>0&&n.createElement(ot,{onClick:le}),n.createElement("select",{name:Me,ref:j,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})),!O&&n.createElement(et.Popup,{...N,popupClass:s.classNames(N.popupClass,"k-multiselecttree-popup"),className:s.classNames(N.className,{"k-rtl":D==="rtl"}),style:Ae,anchor:N.anchor||E.current,show:l,onOpen:ze,onClose:_e,ref:G},t.filterable&&n.createElement(Ie,{value:t.filter===void 0?he:t.filter,ref:R,onChange:Ce,onKeyDown:ye,tabIndex:_,size:y,rounded:A,fillMode:X,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),B.length>0?n.createElement(we.TreeView,{style:{height:N.height},ref:x,tabIndex:_,data:B,focusIdField:K,textField:t.textField,checkField:de,checkIndeterminateField:pe,expandField:t.expandField,childrenField:fe,expandIcons:!0,onItemClick:U,onCheckChange:U,onExpandChange:be,checkboxes:!0,size:y,item:t.item,dir:D}):n.createElement(Ee,null,Q.toLanguageString(m.nodata,m.messages[m.nodata])))),O&&Qe());return V?n.createElement(st.FloatingLabel,{label:V,editorValue:ie,editorPlaceholder:ue,editorValid:Fe,editorDisabled:F,editorId:T,style:{width:L?L.width:void 0},children:xe,dir:D}):xe}),mt={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,adaptive:a.bool};te.displayName="KendoReactMultiSelectTree";te.defaultProps=w;te.propTypes=mt;exports.MultiSelectTree=te;exports.MultiSelectTreePropsContext=Ke;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as t from "react";
|
|
10
10
|
import a from "prop-types";
|
|
11
|
-
import { createPropsContext as at, usePropsContext as it, validatePackage as
|
|
11
|
+
import { createPropsContext as at, usePropsContext as it, validatePackage as rt, useId as ot, getTabIndex as lt, useRtl as st, canUseDOM as ct, noop as Z, Keys as o, classNames as ee, IconWrap as ut, kendoThemeMaps as dt } from "@progress/kendo-react-common";
|
|
12
12
|
import { Popup as pt } from "@progress/kendo-react-popup";
|
|
13
13
|
import { useLocalization as ft } from "@progress/kendo-react-intl";
|
|
14
14
|
import { TreeView as Te } from "@progress/kendo-react-treeview";
|
|
@@ -24,14 +24,14 @@ import Ne from "../common/ListFilter.mjs";
|
|
|
24
24
|
import { AdaptiveMode as kt } from "../common/AdaptiveMode.mjs";
|
|
25
25
|
import { ActionSheetContent as Ft } from "@progress/kendo-react-layout";
|
|
26
26
|
import { MOBILE_MEDIUM_DEVISE as xt } from "../common/constants.mjs";
|
|
27
|
-
const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap:
|
|
28
|
-
const { validationMessage: n, valid: K, required:
|
|
27
|
+
const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: St } = dt, wt = (O) => O.split("_").map((R) => parseInt(R, 10)), Tt = (O, R) => {
|
|
28
|
+
const { validationMessage: n, valid: K, required: x } = O;
|
|
29
29
|
return {
|
|
30
30
|
customError: n !== void 0,
|
|
31
|
-
valid: !!(K !== void 0 ? K : !
|
|
31
|
+
valid: !!(K !== void 0 ? K : !x || R),
|
|
32
32
|
valueMissing: !R
|
|
33
33
|
};
|
|
34
|
-
},
|
|
34
|
+
}, F = {
|
|
35
35
|
checkField: "checkField",
|
|
36
36
|
checkIndeterminateField: "checkIndeterminateField",
|
|
37
37
|
subItemsField: "items",
|
|
@@ -47,31 +47,31 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
47
47
|
validityStyles: !0
|
|
48
48
|
}, Dt = at(), de = t.forwardRef((O, R) => {
|
|
49
49
|
const n = it(Dt, O);
|
|
50
|
-
|
|
51
|
-
const K =
|
|
50
|
+
rt(mt);
|
|
51
|
+
const K = ot(), x = n.id || K, {
|
|
52
52
|
data: q = [],
|
|
53
|
-
dataItemKey:
|
|
53
|
+
dataItemKey: I,
|
|
54
54
|
popupSettings: M = {},
|
|
55
|
-
style:
|
|
56
|
-
opened:
|
|
55
|
+
style: L = {},
|
|
56
|
+
opened: S,
|
|
57
57
|
disabled: C,
|
|
58
58
|
onOpen: ae = Z,
|
|
59
59
|
onClose: A = Z,
|
|
60
60
|
placeholder: pe,
|
|
61
|
-
label:
|
|
61
|
+
label: B,
|
|
62
62
|
name: Oe,
|
|
63
|
-
checkField: fe =
|
|
64
|
-
checkIndeterminateField: me =
|
|
65
|
-
subItemsField: ge =
|
|
63
|
+
checkField: fe = F.checkField,
|
|
64
|
+
checkIndeterminateField: me = F.checkIndeterminateField,
|
|
65
|
+
subItemsField: ge = F.subItemsField,
|
|
66
66
|
validationMessage: W,
|
|
67
|
-
valid:
|
|
67
|
+
valid: Le,
|
|
68
68
|
tags: ve,
|
|
69
69
|
value: m,
|
|
70
|
-
required: he =
|
|
71
|
-
validityStyles:
|
|
72
|
-
} = n, z = lt(n.tabIndex, C), l = t.useRef(null), y = t.useRef(null), w = t.useRef(null), ie = t.useRef(null), _ = t.useRef(null), E = t.useRef(null), $ = t.useRef(!1), H = t.useRef([]), G = t.useRef(null), [N, Ve] = t.useState(), [Ke, be] = t.useState(!1), [d,
|
|
73
|
-
width: ht(y,
|
|
74
|
-
...
|
|
70
|
+
required: he = F.required,
|
|
71
|
+
validityStyles: Be = F.validityStyles
|
|
72
|
+
} = n, z = lt(n.tabIndex, C), l = t.useRef(null), y = t.useRef(null), w = t.useRef(null), ie = t.useRef(null), _ = t.useRef(null), E = t.useRef(null), $ = t.useRef(!1), H = t.useRef([]), G = t.useRef(null), [N, Ve] = t.useState(), [Ke, be] = t.useState(!1), [d, re] = t.useState(!1), [oe, qe] = t.useState(), [Ae, We] = t.useState([]), [ye, ze] = t.useState(""), P = !!(oe && oe <= xt && n.adaptive), s = S !== void 0 ? S : Ke, le = !!(Array.isArray(m) && m.length), se = Tt({ validationMessage: W, valid: Le, required: he }, le), T = st(y, n.dir), _e = {
|
|
73
|
+
width: ht(y, F, { ...F.popupSettings, ...M }, L),
|
|
74
|
+
...T !== void 0 ? { direction: T } : {}
|
|
75
75
|
}, $e = t.useCallback(() => y.current && y.current.focus(), []);
|
|
76
76
|
H.current = ve === void 0 ? (m || []).map((e) => ({ text: gt(e, n.textField), data: [e] })) : [...ve], t.useImperativeHandle(
|
|
77
77
|
l,
|
|
@@ -101,11 +101,11 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
101
101
|
[m, s]
|
|
102
102
|
);
|
|
103
103
|
const k = t.useCallback(
|
|
104
|
-
(e, i,
|
|
104
|
+
(e, i, r) => {
|
|
105
105
|
if (n.onChange) {
|
|
106
106
|
const b = {
|
|
107
107
|
items: i,
|
|
108
|
-
operation:
|
|
108
|
+
operation: r,
|
|
109
109
|
...e
|
|
110
110
|
};
|
|
111
111
|
n.onChange.call(void 0, b);
|
|
@@ -114,16 +114,16 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
114
114
|
[n.onChange]
|
|
115
115
|
), U = t.useCallback(
|
|
116
116
|
(e) => {
|
|
117
|
-
if (vt(e.item, m,
|
|
117
|
+
if (vt(e.item, m, I) || !l.current)
|
|
118
118
|
return;
|
|
119
|
-
const { item: i, nativeEvent:
|
|
119
|
+
const { item: i, nativeEvent: r, syntheticEvent: b } = e, D = {
|
|
120
120
|
syntheticEvent: b,
|
|
121
|
-
nativeEvent:
|
|
121
|
+
nativeEvent: r,
|
|
122
122
|
target: l.current
|
|
123
123
|
};
|
|
124
|
-
k(
|
|
124
|
+
k(D, [i], "toggle");
|
|
125
125
|
},
|
|
126
|
-
[m,
|
|
126
|
+
[m, I, k]
|
|
127
127
|
), j = t.useCallback(
|
|
128
128
|
(e) => {
|
|
129
129
|
if (!s) {
|
|
@@ -131,13 +131,13 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
131
131
|
const i = { ...e };
|
|
132
132
|
ae.call(void 0, i);
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
S === void 0 && (be(!0), We(m || []), P && setTimeout(() => {
|
|
135
135
|
var i;
|
|
136
136
|
u((i = ie.current) == null ? void 0 : i.element);
|
|
137
137
|
}, 300));
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
|
-
[s,
|
|
140
|
+
[s, S, ae, P, ie]
|
|
141
141
|
), g = t.useCallback(
|
|
142
142
|
(e) => {
|
|
143
143
|
if (s) {
|
|
@@ -145,10 +145,10 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
145
145
|
const i = { ...e };
|
|
146
146
|
A.call(void 0, i);
|
|
147
147
|
}
|
|
148
|
-
|
|
148
|
+
S === void 0 && be(!1);
|
|
149
149
|
}
|
|
150
150
|
},
|
|
151
|
-
[s,
|
|
151
|
+
[s, S, A]
|
|
152
152
|
), h = t.useCallback(
|
|
153
153
|
(e) => {
|
|
154
154
|
$.current = !0, e(), window.setTimeout(() => $.current = !1, 0);
|
|
@@ -172,7 +172,7 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
172
172
|
[d, u]
|
|
173
173
|
), je = t.useCallback(
|
|
174
174
|
(e) => {
|
|
175
|
-
if (!d && !$.current && (
|
|
175
|
+
if (!d && !$.current && (re(!0), n.onFocus && l.current)) {
|
|
176
176
|
const i = {
|
|
177
177
|
syntheticEvent: e,
|
|
178
178
|
nativeEvent: e.nativeEvent,
|
|
@@ -185,20 +185,20 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
185
185
|
), Je = t.useCallback(
|
|
186
186
|
(e) => {
|
|
187
187
|
if (d && !$.current && l.current) {
|
|
188
|
-
|
|
188
|
+
re(!1);
|
|
189
189
|
const i = {
|
|
190
190
|
syntheticEvent: e,
|
|
191
191
|
nativeEvent: e.nativeEvent,
|
|
192
192
|
target: l.current
|
|
193
193
|
};
|
|
194
194
|
if (n.onBlur) {
|
|
195
|
-
const
|
|
196
|
-
n.onBlur.call(void 0,
|
|
195
|
+
const r = { ...i };
|
|
196
|
+
n.onBlur.call(void 0, r);
|
|
197
197
|
}
|
|
198
198
|
P || g(i);
|
|
199
199
|
}
|
|
200
200
|
},
|
|
201
|
-
[d, n.onBlur, s,
|
|
201
|
+
[d, n.onBlur, s, S, A]
|
|
202
202
|
), Qe = t.useCallback(
|
|
203
203
|
() => {
|
|
204
204
|
d && h(Z);
|
|
@@ -207,7 +207,7 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
207
207
|
), Xe = t.useCallback(
|
|
208
208
|
(e) => {
|
|
209
209
|
if (!e.isDefaultPrevented() && l.current) {
|
|
210
|
-
|
|
210
|
+
re(!0);
|
|
211
211
|
const i = {
|
|
212
212
|
syntheticEvent: e,
|
|
213
213
|
nativeEvent: e.nativeEvent,
|
|
@@ -219,26 +219,26 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
219
219
|
[s, j]
|
|
220
220
|
), Ye = t.useCallback(
|
|
221
221
|
(e) => {
|
|
222
|
-
var Y,
|
|
223
|
-
const { keyCode: i, altKey:
|
|
222
|
+
var Y, we;
|
|
223
|
+
const { keyCode: i, altKey: r } = e, b = E.current && E.current.element;
|
|
224
224
|
if (!l.current || e.isDefaultPrevented() && ((Y = w.current) == null ? void 0 : Y.element) === e.target)
|
|
225
225
|
return;
|
|
226
|
-
const
|
|
226
|
+
const D = {
|
|
227
227
|
syntheticEvent: e,
|
|
228
228
|
nativeEvent: e.nativeEvent,
|
|
229
229
|
target: l.current
|
|
230
230
|
};
|
|
231
|
-
if (m && m.length > 0 && (i ===
|
|
231
|
+
if (m && m.length > 0 && (i === o.left || i === o.right || i === o.home || i === o.end || i === o.delete)) {
|
|
232
232
|
const c = H.current;
|
|
233
|
-
let p = N ? c.findIndex((nt) => De(nt, N,
|
|
233
|
+
let p = N ? c.findIndex((nt) => De(nt, N, I)) : -1, f;
|
|
234
234
|
const ue = p !== -1;
|
|
235
|
-
i ===
|
|
235
|
+
i === o.left ? (ue ? p = Math.max(0, p - 1) : p = c.length - 1, f = c[p]) : i === o.right ? p === c.length - 1 ? f = void 0 : ue && (p = Math.min(c.length - 1, p + 1), f = c[p]) : i === o.home ? f = c[0] : i === o.end ? f = c[c.length - 1] : i === o.delete && ue && k(D, c[p].data, "delete"), f !== N && Ve(f);
|
|
236
236
|
}
|
|
237
237
|
if (s)
|
|
238
|
-
if (i ===
|
|
239
|
-
e.preventDefault(), g(
|
|
240
|
-
else if (b && b.querySelector(".k-focus") && (i ===
|
|
241
|
-
if (i ===
|
|
238
|
+
if (i === o.esc || r && i === o.up)
|
|
239
|
+
e.preventDefault(), g(D);
|
|
240
|
+
else if (b && b.querySelector(".k-focus") && (i === o.up || i === o.down || i === o.left || i === o.right || i === o.home || i === o.end)) {
|
|
241
|
+
if (i === o.up && ((we = w.current) != null && we.element)) {
|
|
242
242
|
const c = Array.from(b.querySelectorAll(".k-treeview-item")), p = [...c].reverse().find((f) => !!(f && f.querySelector(".k-focus")));
|
|
243
243
|
if (p && c.indexOf(p) === 0)
|
|
244
244
|
return h(() => {
|
|
@@ -248,19 +248,19 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
248
248
|
}
|
|
249
249
|
h(Z);
|
|
250
250
|
} else
|
|
251
|
-
i ===
|
|
251
|
+
i === o.down && h(() => {
|
|
252
252
|
var c;
|
|
253
253
|
u(((c = w.current) == null ? void 0 : c.element) || b);
|
|
254
254
|
});
|
|
255
255
|
else
|
|
256
|
-
|
|
256
|
+
r && i === o.down && (e.preventDefault(), j(D));
|
|
257
257
|
},
|
|
258
|
-
[s, g, u, h, j, N,
|
|
258
|
+
[s, g, u, h, j, N, I, m, k]
|
|
259
259
|
), Ce = t.useCallback(
|
|
260
260
|
(e) => {
|
|
261
|
-
const { keyCode: i, altKey:
|
|
262
|
-
|
|
263
|
-
i ===
|
|
261
|
+
const { keyCode: i, altKey: r } = e;
|
|
262
|
+
r || i !== o.up && i !== o.down || (e.preventDefault(), h(
|
|
263
|
+
i === o.up ? () => {
|
|
264
264
|
u(y.current);
|
|
265
265
|
} : () => {
|
|
266
266
|
u(E.current && E.current.element);
|
|
@@ -282,8 +282,8 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
282
282
|
[k, g]
|
|
283
283
|
), Ze = t.useCallback(
|
|
284
284
|
(e, i) => {
|
|
285
|
-
var
|
|
286
|
-
g({ target: l.current }), d || u((
|
|
285
|
+
var r;
|
|
286
|
+
g({ target: l.current }), d || u((r = w.current) == null ? void 0 : r.element), k({
|
|
287
287
|
syntheticEvent: i,
|
|
288
288
|
nativeEvent: i.nativeEvent,
|
|
289
289
|
target: l.current
|
|
@@ -293,11 +293,11 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
293
293
|
), Ee = t.useCallback(
|
|
294
294
|
(e) => {
|
|
295
295
|
if (n.onExpandChange && l.current) {
|
|
296
|
-
const { item: i, itemHierarchicalIndex:
|
|
297
|
-
level:
|
|
296
|
+
const { item: i, itemHierarchicalIndex: r, nativeEvent: b, syntheticEvent: D } = e, Y = {
|
|
297
|
+
level: wt(r),
|
|
298
298
|
item: i,
|
|
299
299
|
nativeEvent: b,
|
|
300
|
-
syntheticEvent:
|
|
300
|
+
syntheticEvent: D,
|
|
301
301
|
target: l.current
|
|
302
302
|
};
|
|
303
303
|
n.onExpandChange.call(void 0, Y);
|
|
@@ -307,13 +307,13 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
307
307
|
), ke = t.useCallback(
|
|
308
308
|
(e) => {
|
|
309
309
|
if (n.onFilterChange && l.current) {
|
|
310
|
-
const
|
|
310
|
+
const r = {
|
|
311
311
|
filter: { field: n.textField, operator: "contains", value: e.target.value },
|
|
312
312
|
syntheticEvent: e.syntheticEvent,
|
|
313
313
|
nativeEvent: e.nativeEvent,
|
|
314
314
|
target: l.current
|
|
315
315
|
};
|
|
316
|
-
n.onFilterChange.call(void 0,
|
|
316
|
+
n.onFilterChange.call(void 0, r), n.filter === void 0 && ze(e.target.value);
|
|
317
317
|
}
|
|
318
318
|
},
|
|
319
319
|
[n.onFilterChange, n.filter, n.textField]
|
|
@@ -344,14 +344,14 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
344
344
|
) : null, i = {
|
|
345
345
|
adaptiveTitle: n.adaptiveTitle,
|
|
346
346
|
expand: s,
|
|
347
|
-
onClose: (
|
|
348
|
-
windowWidth:
|
|
347
|
+
onClose: (r) => n.onCancel ? Fe(r) : ce(r),
|
|
348
|
+
windowWidth: oe,
|
|
349
349
|
mobileFilter: e,
|
|
350
350
|
footer: {
|
|
351
351
|
cancelText: J.toLanguageString(Re, ne[Re]),
|
|
352
|
-
onCancel: (
|
|
352
|
+
onCancel: (r) => n.onCancel ? Fe(r) : ce(r),
|
|
353
353
|
applyText: J.toLanguageString(Me, ne[Me]),
|
|
354
|
-
onApply: (
|
|
354
|
+
onApply: (r) => g(r)
|
|
355
355
|
}
|
|
356
356
|
};
|
|
357
357
|
return /* @__PURE__ */ t.createElement(kt, { ...i }, /* @__PURE__ */ t.createElement(Ft, { className: "!k-overflow-hidden" }, /* @__PURE__ */ t.createElement("div", { className: "k-list-container" }, /* @__PURE__ */ t.createElement("div", { className: "k-list k-list-lg" }, q.length > 0 ? /* @__PURE__ */ t.createElement(
|
|
@@ -360,7 +360,7 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
360
360
|
ref: E,
|
|
361
361
|
tabIndex: z,
|
|
362
362
|
data: q,
|
|
363
|
-
focusIdField:
|
|
363
|
+
focusIdField: I,
|
|
364
364
|
textField: n.textField,
|
|
365
365
|
checkField: fe,
|
|
366
366
|
checkIndeterminateField: me,
|
|
@@ -373,7 +373,7 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
373
373
|
checkboxes: !0,
|
|
374
374
|
size: v,
|
|
375
375
|
item: n.item,
|
|
376
|
-
dir:
|
|
376
|
+
dir: T
|
|
377
377
|
}
|
|
378
378
|
) : /* @__PURE__ */ t.createElement(xe, null, J.toLanguageString(te, ne[te]))))));
|
|
379
379
|
}, tt = t.useCallback(
|
|
@@ -382,12 +382,12 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
382
382
|
qe(i.target.clientWidth);
|
|
383
383
|
},
|
|
384
384
|
[]
|
|
385
|
-
), xe = n.listNoData || bt, J = ft(), Ie = !
|
|
385
|
+
), xe = n.listNoData || bt, J = ft(), Ie = !Be || se.valid, { size: v, rounded: V, fillMode: Q } = n, X = P && s ? Ae : H.current, Se = /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
386
386
|
"span",
|
|
387
387
|
{
|
|
388
388
|
className: ee("k-multiselecttree k-input", n.className, {
|
|
389
389
|
[`k-input-${Pe[v] || v}`]: v,
|
|
390
|
-
[`k-rounded-${
|
|
390
|
+
[`k-rounded-${St[V] || V}`]: V,
|
|
391
391
|
[`k-input-${Q}`]: Q,
|
|
392
392
|
"k-focus": d && !C,
|
|
393
393
|
"k-invalid": !Ie,
|
|
@@ -397,9 +397,9 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
397
397
|
}),
|
|
398
398
|
tabIndex: z,
|
|
399
399
|
accessKey: n.accessKey,
|
|
400
|
-
id:
|
|
401
|
-
style:
|
|
402
|
-
dir:
|
|
400
|
+
id: x,
|
|
401
|
+
style: B ? { ...L, width: void 0 } : L,
|
|
402
|
+
dir: T,
|
|
403
403
|
ref: y,
|
|
404
404
|
onKeyDown: C ? void 0 : Ye,
|
|
405
405
|
onMouseDown: Qe,
|
|
@@ -409,17 +409,17 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
409
409
|
"aria-haspopup": "tree",
|
|
410
410
|
"aria-expanded": s,
|
|
411
411
|
"aria-disabled": C,
|
|
412
|
-
"aria-label":
|
|
412
|
+
"aria-label": B,
|
|
413
413
|
"aria-labelledby": n.ariaLabelledBy,
|
|
414
|
-
"aria-describedby": n.ariaDescribedBy ? n.ariaDescribedBy : "tagslist-" +
|
|
414
|
+
"aria-describedby": n.ariaDescribedBy ? n.ariaDescribedBy : "tagslist-" + x,
|
|
415
415
|
"aria-required": n.required,
|
|
416
416
|
onClick: C ? void 0 : Xe
|
|
417
417
|
},
|
|
418
418
|
/* @__PURE__ */ t.createElement(
|
|
419
419
|
"div",
|
|
420
420
|
{
|
|
421
|
-
id: "tagslist-" +
|
|
422
|
-
className: ee("k-input-values k-chip-list
|
|
421
|
+
id: "tagslist-" + x,
|
|
422
|
+
className: ee("k-input-values k-chip-list", {
|
|
423
423
|
[`k-chip-list-${Pe[v] || v}`]: v
|
|
424
424
|
})
|
|
425
425
|
},
|
|
@@ -429,8 +429,8 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
429
429
|
tag: n.tag,
|
|
430
430
|
onTagDelete: Ze,
|
|
431
431
|
data: X,
|
|
432
|
-
guid:
|
|
433
|
-
focused: N ? H.current.find((e) => De(e, N,
|
|
432
|
+
guid: x,
|
|
433
|
+
focused: N ? H.current.find((e) => De(e, N, I)) : void 0,
|
|
434
434
|
size: v
|
|
435
435
|
}
|
|
436
436
|
)
|
|
@@ -445,7 +445,7 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
445
445
|
ref: _,
|
|
446
446
|
tabIndex: -1,
|
|
447
447
|
"aria-hidden": !0,
|
|
448
|
-
title:
|
|
448
|
+
title: B,
|
|
449
449
|
style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" }
|
|
450
450
|
},
|
|
451
451
|
/* @__PURE__ */ t.createElement(
|
|
@@ -463,7 +463,7 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
463
463
|
M.popupClass,
|
|
464
464
|
"k-multiselecttree-popup"
|
|
465
465
|
),
|
|
466
|
-
className: ee(M.className, { "k-rtl":
|
|
466
|
+
className: ee(M.className, { "k-rtl": T === "rtl" }),
|
|
467
467
|
style: _e,
|
|
468
468
|
anchor: M.anchor || y.current,
|
|
469
469
|
show: s,
|
|
@@ -481,7 +481,9 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
481
481
|
tabIndex: z,
|
|
482
482
|
size: v,
|
|
483
483
|
rounded: V,
|
|
484
|
-
fillMode: Q
|
|
484
|
+
fillMode: Q,
|
|
485
|
+
renderListFilterWrapper: !0,
|
|
486
|
+
renderPrefixSeparator: !0
|
|
485
487
|
}
|
|
486
488
|
),
|
|
487
489
|
q.length > 0 ? /* @__PURE__ */ t.createElement(
|
|
@@ -491,7 +493,7 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
491
493
|
ref: E,
|
|
492
494
|
tabIndex: z,
|
|
493
495
|
data: q,
|
|
494
|
-
focusIdField:
|
|
496
|
+
focusIdField: I,
|
|
495
497
|
textField: n.textField,
|
|
496
498
|
checkField: fe,
|
|
497
499
|
checkIndeterminateField: me,
|
|
@@ -504,25 +506,25 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
504
506
|
checkboxes: !0,
|
|
505
507
|
size: v,
|
|
506
508
|
item: n.item,
|
|
507
|
-
dir:
|
|
509
|
+
dir: T
|
|
508
510
|
}
|
|
509
511
|
) : /* @__PURE__ */ t.createElement(xe, null, J.toLanguageString(te, ne[te]))
|
|
510
512
|
)
|
|
511
513
|
), P && et());
|
|
512
|
-
return
|
|
514
|
+
return B ? /* @__PURE__ */ t.createElement(
|
|
513
515
|
yt,
|
|
514
516
|
{
|
|
515
|
-
label:
|
|
517
|
+
label: B,
|
|
516
518
|
editorValue: le,
|
|
517
519
|
editorPlaceholder: pe,
|
|
518
520
|
editorValid: Ie,
|
|
519
521
|
editorDisabled: C,
|
|
520
|
-
editorId:
|
|
521
|
-
style: { width:
|
|
522
|
-
children:
|
|
523
|
-
dir:
|
|
522
|
+
editorId: x,
|
|
523
|
+
style: { width: L ? L.width : void 0 },
|
|
524
|
+
children: Se,
|
|
525
|
+
dir: T
|
|
524
526
|
}
|
|
525
|
-
) :
|
|
527
|
+
) : Se;
|
|
526
528
|
}), Rt = {
|
|
527
529
|
opened: a.bool,
|
|
528
530
|
disabled: a.bool,
|
|
@@ -582,7 +584,7 @@ const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt
|
|
|
582
584
|
adaptive: a.bool
|
|
583
585
|
};
|
|
584
586
|
de.displayName = "KendoReactMultiSelectTree";
|
|
585
|
-
de.defaultProps =
|
|
587
|
+
de.defaultProps = F;
|
|
586
588
|
de.propTypes = Rt;
|
|
587
589
|
export {
|
|
588
590
|
de as MultiSelectTree,
|
package/common/AdaptiveMode.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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react"),c=require("@progress/kendo-react-layout"),h=require("@progress/kendo-svg-icons"),l=require("@progress/kendo-react-buttons"),v=require("@progress/kendo-react-common");function g(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const n in a)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(a,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>a[n]})}}return t.default=a,Object.freeze(t)}const e=g(f),r=500,E=a=>{const{footer:t,children:n,windowWidth:o=0,navigatable:d,navigatableElements:m,expand:u,animation:b,onClose:i,adaptiveTitle:p,mobileFilter:s}=a,k={navigatable:d||!1,navigatableElements:m||[],expand:u,animation:b!==!1,onClose:i,animationStyles:o<=r?{top:0,width:"100%",height:"100%"}:void 0,className:v.classNames("k-actionsheet","k-adaptive-actionsheet",o<=r?"k-actionsheet-fullscreen":"k-actionsheet-bottom")};return e.createElement(c.ActionSheet,{...k},e.createElement(c.ActionSheetHeader,{className:"k-text-center"},e.createElement("div",{className:"k-actionsheet-titlebar-group k-hbox"},e.createElement("div",{className:"k-actionsheet-title"},e.createElement("div",{className:"k-text-center"},p),e.createElement("div",{className:"k-actionsheet-subtitle k-text-center"})),e.createElement("div",{className:"k-actionsheet-actions"},e.createElement(l.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",icon:"x",svgIcon:h.xIcon,onClick:i}))),s&&e.createElement("div",{className:"k-actionsheet-titlebar-group k-actionsheet-filter"},s)),n,t&&e.createElement(c.ActionSheetFooter,{className:"k-actions k-actions-stretched"},e.createElement(l.Button,{size:"large",tabIndex:0,"aria-label":t.cancelText,"aria-disabled":"false",type:"button",onClick:t.onCancel},t.cancelText),e.createElement(l.Button,{tabIndex:0,themeColor:"primary",size:"large","aria-label":t.applyText,"aria-disabled":"false",type:"button",onClick:t.onApply},t.applyText)))};exports.AdaptiveMode=E;
|
package/common/AdaptiveMode.mjs
CHANGED
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as e from "react";
|
|
10
|
-
import { ActionSheet as
|
|
10
|
+
import { ActionSheet as k, ActionSheetHeader as f, ActionSheetFooter as E } from "@progress/kendo-react-layout";
|
|
11
11
|
import { xIcon as v } from "@progress/kendo-svg-icons";
|
|
12
12
|
import { Button as a } from "@progress/kendo-react-buttons";
|
|
13
|
-
|
|
13
|
+
import { classNames as x } from "@progress/kendo-react-common";
|
|
14
|
+
const o = 500, C = (c) => {
|
|
14
15
|
const {
|
|
15
16
|
footer: t,
|
|
16
17
|
children: s,
|
|
@@ -29,9 +30,13 @@ const o = 500, y = (c) => {
|
|
|
29
30
|
animation: p !== !1,
|
|
30
31
|
onClose: n,
|
|
31
32
|
animationStyles: l <= o ? { top: 0, width: "100%", height: "100%" } : void 0,
|
|
32
|
-
className:
|
|
33
|
+
className: x(
|
|
34
|
+
"k-actionsheet",
|
|
35
|
+
"k-adaptive-actionsheet",
|
|
36
|
+
l <= o ? "k-actionsheet-fullscreen" : "k-actionsheet-bottom"
|
|
37
|
+
)
|
|
33
38
|
};
|
|
34
|
-
return /* @__PURE__ */ e.createElement(
|
|
39
|
+
return /* @__PURE__ */ e.createElement(k, { ...h }, /* @__PURE__ */ e.createElement(f, { className: "k-text-center" }, /* @__PURE__ */ e.createElement("div", { className: "k-actionsheet-titlebar-group k-hbox" }, /* @__PURE__ */ e.createElement("div", { className: "k-actionsheet-title" }, /* @__PURE__ */ e.createElement("div", { className: "k-text-center" }, b), /* @__PURE__ */ e.createElement("div", { className: "k-actionsheet-subtitle k-text-center" })), /* @__PURE__ */ e.createElement("div", { className: "k-actionsheet-actions" }, /* @__PURE__ */ e.createElement(
|
|
35
40
|
a,
|
|
36
41
|
{
|
|
37
42
|
tabIndex: 0,
|
|
@@ -69,5 +74,5 @@ const o = 500, y = (c) => {
|
|
|
69
74
|
)));
|
|
70
75
|
};
|
|
71
76
|
export {
|
|
72
|
-
|
|
77
|
+
C as AdaptiveMode
|
|
73
78
|
};
|