@progress/kendo-react-dropdowns 7.2.4-develop.3 → 7.3.0-develop.1
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 +8 -0
- package/AutoComplete/AutoComplete.mjs +458 -0
- package/ComboBox/ComboBox.js +8 -0
- package/ComboBox/ComboBox.mjs +618 -0
- package/DropDownList/DropDownList.js +8 -0
- package/DropDownList/DropDownList.mjs +630 -0
- package/DropDownTree/DropDownTree.js +8 -0
- package/DropDownTree/DropDownTree.mjs +550 -0
- package/DropDownTree/ListNoData.js +8 -0
- package/DropDownTree/ListNoData.mjs +13 -0
- package/DropDownTree/useDropdownWidth.js +8 -0
- package/DropDownTree/useDropdownWidth.mjs +25 -0
- package/MultiColumnComboBox/MultiColumnComboBox.js +8 -0
- package/MultiColumnComboBox/MultiColumnComboBox.mjs +186 -0
- package/MultiSelect/MultiSelect.js +8 -0
- package/MultiSelect/MultiSelect.mjs +694 -0
- package/MultiSelect/TagList.js +8 -0
- package/MultiSelect/TagList.mjs +48 -0
- package/MultiSelectTree/MultiSelectTree.js +8 -0
- package/MultiSelectTree/MultiSelectTree.mjs +590 -0
- package/MultiSelectTree/utils.js +8 -0
- package/MultiSelectTree/utils.mjs +74 -0
- package/common/AdaptiveMode.js +8 -0
- package/common/AdaptiveMode.mjs +73 -0
- package/common/ClearButton.js +8 -0
- package/common/ClearButton.mjs +38 -0
- package/common/DropDownBase.js +8 -0
- package/common/DropDownBase.mjs +194 -0
- package/common/GroupStickyHeader.js +8 -0
- package/common/GroupStickyHeader.mjs +22 -0
- package/common/List.js +8 -0
- package/common/List.mjs +117 -0
- package/common/ListContainer.js +8 -0
- package/common/ListContainer.mjs +33 -0
- package/common/ListDefaultItem.js +8 -0
- package/common/ListDefaultItem.mjs +36 -0
- package/common/ListFilter.js +8 -0
- package/common/ListFilter.mjs +49 -0
- package/common/ListGroupItem.js +8 -0
- package/common/ListGroupItem.mjs +32 -0
- package/common/ListItem.js +8 -0
- package/common/ListItem.mjs +49 -0
- package/common/MultiColumnList.js +8 -0
- package/common/MultiColumnList.mjs +28 -0
- package/common/Navigation.js +8 -0
- package/common/Navigation.mjs +29 -0
- package/common/SearchBar.js +8 -0
- package/common/SearchBar.mjs +65 -0
- package/common/VirtualScroll.js +8 -0
- package/common/VirtualScroll.mjs +75 -0
- package/common/constants.js +8 -0
- package/common/constants.mjs +13 -0
- package/common/settings.js +8 -0
- package/common/settings.mjs +12 -0
- package/common/utils.js +8 -0
- package/common/utils.mjs +109 -0
- package/common/withCustomComponent.js +8 -0
- package/common/withCustomComponent.mjs +13 -0
- package/dist/cdn/js/kendo-react-dropdowns.js +8 -5
- package/index.d.mts +4098 -5
- package/index.d.ts +4098 -31
- package/index.js +8 -5
- package/index.mjs +55 -4429
- package/messages/index.js +8 -0
- package/messages/index.mjs +27 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +9 -9
- package/AutoComplete/AutoComplete.d.ts +0 -236
- package/AutoComplete/AutoCompleteProps.d.ts +0 -254
- package/ComboBox/ComboBox.d.ts +0 -254
- package/ComboBox/ComboBoxProps.d.ts +0 -324
- package/DropDownList/DropDownList.d.ts +0 -264
- package/DropDownList/DropDownListProps.d.ts +0 -329
- package/DropDownTree/DropDownTree.d.ts +0 -74
- package/DropDownTree/DropDownTreeProps.d.ts +0 -297
- package/DropDownTree/ListNoData.d.ts +0 -10
- package/DropDownTree/useDropdownWidth.d.ts +0 -10
- package/MultiColumnComboBox/MultiColumnComboBox.d.ts +0 -300
- package/MultiSelect/MultiSelect.d.ts +0 -262
- package/MultiSelect/MultiSelectProps.d.ts +0 -325
- package/MultiSelect/TagList.d.ts +0 -42
- package/MultiSelectTree/MultiSelectTree.d.ts +0 -85
- package/MultiSelectTree/MultiSelectTreeProps.d.ts +0 -324
- package/MultiSelectTree/utils.d.ts +0 -21
- package/common/AdaptiveMode.d.ts +0 -25
- package/common/ClearButton.d.ts +0 -18
- package/common/DropDownBase.d.ts +0 -180
- package/common/GroupStickyHeader.d.ts +0 -28
- package/common/List.d.ts +0 -50
- package/common/ListContainer.d.ts +0 -22
- package/common/ListDefaultItem.d.ts +0 -20
- package/common/ListFilter.d.ts +0 -23
- package/common/ListGroupItem.d.ts +0 -37
- package/common/ListItem.d.ts +0 -65
- package/common/MultiColumnList.d.ts +0 -9
- package/common/Navigation.d.ts +0 -17
- package/common/SearchBar.d.ts +0 -47
- package/common/VirtualScroll.d.ts +0 -45
- package/common/constants.d.ts +0 -8
- package/common/events.d.ts +0 -76
- package/common/filterDescriptor.d.ts +0 -45
- package/common/settings.d.ts +0 -109
- package/common/utils.d.ts +0 -70
- package/common/withCustomComponent.d.ts +0 -11
- package/messages/index.d.ts +0 -44
- package/package-metadata.d.ts +0 -9
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";const f=require("react"),m=require("@progress/kendo-react-buttons");function g(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return o.default=e,Object.freeze(o)}const s=g(f),v=e=>e.syntheticEvent.preventDefault(),h=e=>e.syntheticEvent.stopPropagation();class y extends s.Component{render(){const{data:o,guid:n,focused:r,tagRender:c,tag:i,onTagDelete:l,size:p}=this.props;return s.createElement(s.Fragment,null,o.map((t,u)=>{const a=i?s.createElement(i,{key:t.text+u,tagData:t,guid:n,focusedTag:r,onTagDelete:l}):s.createElement(m.Chip,{id:`tag-${n}-${t.text.replace(/\s+/g,"-")}`,"aria-selected":!0,role:"option","aria-setsize":o.length,key:t.text+u,text:t.text,removable:!0,onRemove:d=>l.call(void 0,t.data,d.syntheticEvent),onMouseDown:v,onClick:h,className:t===r?"k-focus":void 0,size:p});return c?c(t,a):a}),this.props.children)}}module.exports=y;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as t from "react";
|
|
10
|
+
import { Chip as d } from "@progress/kendo-react-buttons";
|
|
11
|
+
const v = (o) => o.syntheticEvent.preventDefault(), f = (o) => o.syntheticEvent.stopPropagation();
|
|
12
|
+
class g extends t.Component {
|
|
13
|
+
render() {
|
|
14
|
+
const { data: n, guid: s, focused: r, tagRender: c, tag: i, onTagDelete: l, size: m } = this.props;
|
|
15
|
+
return /* @__PURE__ */ t.createElement(t.Fragment, null, n.map((e, p) => {
|
|
16
|
+
const a = i ? /* @__PURE__ */ t.createElement(
|
|
17
|
+
i,
|
|
18
|
+
{
|
|
19
|
+
key: e.text + p,
|
|
20
|
+
tagData: e,
|
|
21
|
+
guid: s,
|
|
22
|
+
focusedTag: r,
|
|
23
|
+
onTagDelete: l
|
|
24
|
+
}
|
|
25
|
+
) : /* @__PURE__ */ t.createElement(
|
|
26
|
+
d,
|
|
27
|
+
{
|
|
28
|
+
id: `tag-${s}-${e.text.replace(/\s+/g, "-")}`,
|
|
29
|
+
"aria-selected": !0,
|
|
30
|
+
role: "option",
|
|
31
|
+
"aria-setsize": n.length,
|
|
32
|
+
key: e.text + p,
|
|
33
|
+
text: e.text,
|
|
34
|
+
removable: !0,
|
|
35
|
+
onRemove: (u) => l.call(void 0, e.data, u.syntheticEvent),
|
|
36
|
+
onMouseDown: v,
|
|
37
|
+
onClick: f,
|
|
38
|
+
className: e === r ? "k-focus" : void 0,
|
|
39
|
+
size: m
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
return c ? c(e, a) : a;
|
|
43
|
+
}), this.props.children);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
g as default
|
|
48
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use 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;
|
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as t from "react";
|
|
10
|
+
import a from "prop-types";
|
|
11
|
+
import { createPropsContext as at, usePropsContext as it, validatePackage as ot, useId as rt, getTabIndex as lt, useRtl as st, canUseDOM as ct, noop as Z, Keys as r, classNames as ee, IconWrap as ut, kendoThemeMaps as dt } from "@progress/kendo-react-common";
|
|
12
|
+
import { Popup as pt } from "@progress/kendo-react-popup";
|
|
13
|
+
import { useLocalization as ft } from "@progress/kendo-react-intl";
|
|
14
|
+
import { TreeView as Te } from "@progress/kendo-react-treeview";
|
|
15
|
+
import { packageMetadata as mt } from "../package-metadata.mjs";
|
|
16
|
+
import { getItemValue as gt, areSame as vt, matchTags as De } from "../common/utils.mjs";
|
|
17
|
+
import { useDropdownWidth as ht } from "../DropDownTree/useDropdownWidth.mjs";
|
|
18
|
+
import { ListNoData as bt } from "../DropDownTree/ListNoData.mjs";
|
|
19
|
+
import { nodata as te, messages as ne, adaptiveModeFooterCancel as Re, adaptiveModeFooterApply as Me } from "../messages/index.mjs";
|
|
20
|
+
import { FloatingLabel as yt } from "@progress/kendo-react-labels";
|
|
21
|
+
import Ct from "../MultiSelect/TagList.mjs";
|
|
22
|
+
import Et from "../common/ClearButton.mjs";
|
|
23
|
+
import Ne from "../common/ListFilter.mjs";
|
|
24
|
+
import { AdaptiveMode as kt } from "../common/AdaptiveMode.mjs";
|
|
25
|
+
import { ActionSheetContent as Ft } from "@progress/kendo-react-layout";
|
|
26
|
+
import { MOBILE_MEDIUM_DEVISE as xt } from "../common/constants.mjs";
|
|
27
|
+
const It = "Please select a value from the list!", { sizeMap: Pe, roundedMap: wt } = dt, St = (O) => O.split("_").map((R) => parseInt(R, 10)), Tt = (O, R) => {
|
|
28
|
+
const { validationMessage: n, valid: K, required: F } = O;
|
|
29
|
+
return {
|
|
30
|
+
customError: n !== void 0,
|
|
31
|
+
valid: !!(K !== void 0 ? K : !F || R),
|
|
32
|
+
valueMissing: !R
|
|
33
|
+
};
|
|
34
|
+
}, D = {
|
|
35
|
+
checkField: "checkField",
|
|
36
|
+
checkIndeterminateField: "checkIndeterminateField",
|
|
37
|
+
subItemsField: "items",
|
|
38
|
+
popupSettings: {
|
|
39
|
+
animate: !0,
|
|
40
|
+
width: "200px",
|
|
41
|
+
height: "200px"
|
|
42
|
+
},
|
|
43
|
+
size: "medium",
|
|
44
|
+
rounded: "medium",
|
|
45
|
+
fillMode: "solid",
|
|
46
|
+
required: !1,
|
|
47
|
+
validityStyles: !0
|
|
48
|
+
}, Dt = at(), de = t.forwardRef((O, R) => {
|
|
49
|
+
const n = it(Dt, O);
|
|
50
|
+
ot(mt);
|
|
51
|
+
const K = rt(), F = n.id || K, {
|
|
52
|
+
data: q = [],
|
|
53
|
+
dataItemKey: x,
|
|
54
|
+
popupSettings: M = {},
|
|
55
|
+
style: B = {},
|
|
56
|
+
opened: I,
|
|
57
|
+
disabled: C,
|
|
58
|
+
onOpen: ae = Z,
|
|
59
|
+
onClose: A = Z,
|
|
60
|
+
placeholder: pe,
|
|
61
|
+
label: L,
|
|
62
|
+
name: Oe,
|
|
63
|
+
checkField: fe = D.checkField,
|
|
64
|
+
checkIndeterminateField: me = D.checkIndeterminateField,
|
|
65
|
+
subItemsField: ge = D.subItemsField,
|
|
66
|
+
validationMessage: W,
|
|
67
|
+
valid: Be,
|
|
68
|
+
tags: ve,
|
|
69
|
+
value: m,
|
|
70
|
+
required: he = D.required,
|
|
71
|
+
validityStyles: Le = D.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, oe] = t.useState(!1), [re, qe] = t.useState(), [Ae, We] = t.useState([]), [ye, ze] = t.useState(""), P = !!(re && re <= xt && n.adaptive), s = I !== void 0 ? I : Ke, le = !!(Array.isArray(m) && m.length), se = Tt({ validationMessage: W, valid: Be, required: he }, le), S = st(y, n.dir), _e = {
|
|
73
|
+
width: ht(y, D, M, B),
|
|
74
|
+
...S !== void 0 ? { direction: S } : {}
|
|
75
|
+
}, $e = t.useCallback(() => y.current && y.current.focus(), []);
|
|
76
|
+
H.current = ve === void 0 ? (m || []).map((e) => ({ text: gt(e, n.textField), data: [e] })) : [...ve], t.useImperativeHandle(
|
|
77
|
+
l,
|
|
78
|
+
() => ({
|
|
79
|
+
props: n,
|
|
80
|
+
element: y.current,
|
|
81
|
+
focus: $e
|
|
82
|
+
})
|
|
83
|
+
), t.useImperativeHandle(R, () => l.current);
|
|
84
|
+
const He = t.useCallback(
|
|
85
|
+
() => {
|
|
86
|
+
_.current && _.current.setCustomValidity && _.current.setCustomValidity(
|
|
87
|
+
se.valid ? "" : W === void 0 ? It : W
|
|
88
|
+
);
|
|
89
|
+
},
|
|
90
|
+
[W, se]
|
|
91
|
+
);
|
|
92
|
+
t.useEffect(He), t.useEffect(() => {
|
|
93
|
+
const e = ct && window.ResizeObserver && new window.ResizeObserver(tt.bind(void 0));
|
|
94
|
+
return document != null && document.body && e && e.observe(document.body), () => {
|
|
95
|
+
e && e.disconnect();
|
|
96
|
+
};
|
|
97
|
+
}, []), t.useEffect(
|
|
98
|
+
() => {
|
|
99
|
+
G.current && s && G.current.setPosition(G.current._popup);
|
|
100
|
+
},
|
|
101
|
+
[m, s]
|
|
102
|
+
);
|
|
103
|
+
const k = t.useCallback(
|
|
104
|
+
(e, i, o) => {
|
|
105
|
+
if (n.onChange) {
|
|
106
|
+
const b = {
|
|
107
|
+
items: i,
|
|
108
|
+
operation: o,
|
|
109
|
+
...e
|
|
110
|
+
};
|
|
111
|
+
n.onChange.call(void 0, b);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
[n.onChange]
|
|
115
|
+
), U = t.useCallback(
|
|
116
|
+
(e) => {
|
|
117
|
+
if (vt(e.item, m, x) || !l.current)
|
|
118
|
+
return;
|
|
119
|
+
const { item: i, nativeEvent: o, syntheticEvent: b } = e, T = {
|
|
120
|
+
syntheticEvent: b,
|
|
121
|
+
nativeEvent: o,
|
|
122
|
+
target: l.current
|
|
123
|
+
};
|
|
124
|
+
k(T, [i], "toggle");
|
|
125
|
+
},
|
|
126
|
+
[m, x, k]
|
|
127
|
+
), j = t.useCallback(
|
|
128
|
+
(e) => {
|
|
129
|
+
if (!s) {
|
|
130
|
+
if (ae) {
|
|
131
|
+
const i = { ...e };
|
|
132
|
+
ae.call(void 0, i);
|
|
133
|
+
}
|
|
134
|
+
I === void 0 && (be(!0), We(m || []), P && setTimeout(() => {
|
|
135
|
+
var i;
|
|
136
|
+
u((i = ie.current) == null ? void 0 : i.element);
|
|
137
|
+
}, 300));
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
[s, I, ae, P, ie]
|
|
141
|
+
), g = t.useCallback(
|
|
142
|
+
(e) => {
|
|
143
|
+
if (s) {
|
|
144
|
+
if (A) {
|
|
145
|
+
const i = { ...e };
|
|
146
|
+
A.call(void 0, i);
|
|
147
|
+
}
|
|
148
|
+
I === void 0 && be(!1);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
[s, I, A]
|
|
152
|
+
), h = t.useCallback(
|
|
153
|
+
(e) => {
|
|
154
|
+
$.current = !0, e(), window.setTimeout(() => $.current = !1, 0);
|
|
155
|
+
},
|
|
156
|
+
[]
|
|
157
|
+
), u = t.useCallback(
|
|
158
|
+
(e) => {
|
|
159
|
+
e && h(() => e.focus());
|
|
160
|
+
},
|
|
161
|
+
[h]
|
|
162
|
+
), Ge = t.useCallback(
|
|
163
|
+
() => {
|
|
164
|
+
var e;
|
|
165
|
+
!d && s ? g({ target: l.current }) : n.filterable ? u((e = w.current) == null ? void 0 : e.element) : u(E.current && E.current.element);
|
|
166
|
+
},
|
|
167
|
+
[d, s, u, g, n.filterable]
|
|
168
|
+
), Ue = t.useCallback(
|
|
169
|
+
() => {
|
|
170
|
+
d && u(y.current);
|
|
171
|
+
},
|
|
172
|
+
[d, u]
|
|
173
|
+
), je = t.useCallback(
|
|
174
|
+
(e) => {
|
|
175
|
+
if (!d && !$.current && (oe(!0), n.onFocus && l.current)) {
|
|
176
|
+
const i = {
|
|
177
|
+
syntheticEvent: e,
|
|
178
|
+
nativeEvent: e.nativeEvent,
|
|
179
|
+
target: l.current
|
|
180
|
+
};
|
|
181
|
+
n.onFocus.call(void 0, i);
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
[d, n.onFocus]
|
|
185
|
+
), Je = t.useCallback(
|
|
186
|
+
(e) => {
|
|
187
|
+
if (d && !$.current && l.current) {
|
|
188
|
+
oe(!1);
|
|
189
|
+
const i = {
|
|
190
|
+
syntheticEvent: e,
|
|
191
|
+
nativeEvent: e.nativeEvent,
|
|
192
|
+
target: l.current
|
|
193
|
+
};
|
|
194
|
+
if (n.onBlur) {
|
|
195
|
+
const o = { ...i };
|
|
196
|
+
n.onBlur.call(void 0, o);
|
|
197
|
+
}
|
|
198
|
+
P || g(i);
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
[d, n.onBlur, s, I, A]
|
|
202
|
+
), Qe = t.useCallback(
|
|
203
|
+
() => {
|
|
204
|
+
d && h(Z);
|
|
205
|
+
},
|
|
206
|
+
[d, h]
|
|
207
|
+
), Xe = t.useCallback(
|
|
208
|
+
(e) => {
|
|
209
|
+
if (!e.isDefaultPrevented() && l.current) {
|
|
210
|
+
oe(!0);
|
|
211
|
+
const i = {
|
|
212
|
+
syntheticEvent: e,
|
|
213
|
+
nativeEvent: e.nativeEvent,
|
|
214
|
+
target: l.current
|
|
215
|
+
};
|
|
216
|
+
s || j(i);
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
[s, j]
|
|
220
|
+
), Ye = t.useCallback(
|
|
221
|
+
(e) => {
|
|
222
|
+
var Y, Se;
|
|
223
|
+
const { keyCode: i, altKey: o } = e, b = E.current && E.current.element;
|
|
224
|
+
if (!l.current || e.isDefaultPrevented() && ((Y = w.current) == null ? void 0 : Y.element) === e.target)
|
|
225
|
+
return;
|
|
226
|
+
const T = {
|
|
227
|
+
syntheticEvent: e,
|
|
228
|
+
nativeEvent: e.nativeEvent,
|
|
229
|
+
target: l.current
|
|
230
|
+
};
|
|
231
|
+
if (m && m.length > 0 && (i === r.left || i === r.right || i === r.home || i === r.end || i === r.delete)) {
|
|
232
|
+
const c = H.current;
|
|
233
|
+
let p = N ? c.findIndex((nt) => De(nt, N, x)) : -1, f;
|
|
234
|
+
const ue = p !== -1;
|
|
235
|
+
i === r.left ? (ue ? p = Math.max(0, p - 1) : p = c.length - 1, f = c[p]) : i === r.right ? p === c.length - 1 ? f = void 0 : ue && (p = Math.min(c.length - 1, p + 1), f = c[p]) : i === r.home ? f = c[0] : i === r.end ? f = c[c.length - 1] : i === r.delete && ue && k(T, c[p].data, "delete"), f !== N && Ve(f);
|
|
236
|
+
}
|
|
237
|
+
if (s)
|
|
238
|
+
if (i === r.esc || o && i === r.up)
|
|
239
|
+
e.preventDefault(), g(T);
|
|
240
|
+
else if (b && b.querySelector(".k-focus") && (i === r.up || i === r.down || i === r.left || i === r.right || i === r.home || i === r.end)) {
|
|
241
|
+
if (i === r.up && ((Se = w.current) != null && Se.element)) {
|
|
242
|
+
const c = Array.from(b.querySelectorAll(".k-treeview-item")), p = [...c].reverse().find((f) => !!(f && f.querySelector(".k-focus")));
|
|
243
|
+
if (p && c.indexOf(p) === 0)
|
|
244
|
+
return h(() => {
|
|
245
|
+
var f;
|
|
246
|
+
u((f = w.current) == null ? void 0 : f.element);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
h(Z);
|
|
250
|
+
} else
|
|
251
|
+
i === r.down && h(() => {
|
|
252
|
+
var c;
|
|
253
|
+
u(((c = w.current) == null ? void 0 : c.element) || b);
|
|
254
|
+
});
|
|
255
|
+
else
|
|
256
|
+
o && i === r.down && (e.preventDefault(), j(T));
|
|
257
|
+
},
|
|
258
|
+
[s, g, u, h, j, N, x, m, k]
|
|
259
|
+
), Ce = t.useCallback(
|
|
260
|
+
(e) => {
|
|
261
|
+
const { keyCode: i, altKey: o } = e;
|
|
262
|
+
o || i !== r.up && i !== r.down || (e.preventDefault(), h(
|
|
263
|
+
i === r.up ? () => {
|
|
264
|
+
u(y.current);
|
|
265
|
+
} : () => {
|
|
266
|
+
u(E.current && E.current.element);
|
|
267
|
+
}
|
|
268
|
+
));
|
|
269
|
+
},
|
|
270
|
+
[u, h]
|
|
271
|
+
), ce = t.useCallback(
|
|
272
|
+
(e) => {
|
|
273
|
+
if (!l.current)
|
|
274
|
+
return;
|
|
275
|
+
const i = {
|
|
276
|
+
syntheticEvent: e,
|
|
277
|
+
nativeEvent: e.nativeEvent,
|
|
278
|
+
target: l.current
|
|
279
|
+
};
|
|
280
|
+
k(i, [], "clear"), g(i), e.preventDefault();
|
|
281
|
+
},
|
|
282
|
+
[k, g]
|
|
283
|
+
), Ze = t.useCallback(
|
|
284
|
+
(e, i) => {
|
|
285
|
+
var o;
|
|
286
|
+
g({ target: l.current }), d || u((o = w.current) == null ? void 0 : o.element), k({
|
|
287
|
+
syntheticEvent: i,
|
|
288
|
+
nativeEvent: i.nativeEvent,
|
|
289
|
+
target: l.current
|
|
290
|
+
}, e, "delete");
|
|
291
|
+
},
|
|
292
|
+
[k, g, u, d]
|
|
293
|
+
), Ee = t.useCallback(
|
|
294
|
+
(e) => {
|
|
295
|
+
if (n.onExpandChange && l.current) {
|
|
296
|
+
const { item: i, itemHierarchicalIndex: o, nativeEvent: b, syntheticEvent: T } = e, Y = {
|
|
297
|
+
level: St(o),
|
|
298
|
+
item: i,
|
|
299
|
+
nativeEvent: b,
|
|
300
|
+
syntheticEvent: T,
|
|
301
|
+
target: l.current
|
|
302
|
+
};
|
|
303
|
+
n.onExpandChange.call(void 0, Y);
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
[n.onExpandChange]
|
|
307
|
+
), ke = t.useCallback(
|
|
308
|
+
(e) => {
|
|
309
|
+
if (n.onFilterChange && l.current) {
|
|
310
|
+
const o = {
|
|
311
|
+
filter: { field: n.textField, operator: "contains", value: e.target.value },
|
|
312
|
+
syntheticEvent: e.syntheticEvent,
|
|
313
|
+
nativeEvent: e.nativeEvent,
|
|
314
|
+
target: l.current
|
|
315
|
+
};
|
|
316
|
+
n.onFilterChange.call(void 0, o), n.filter === void 0 && ze(e.target.value);
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
[n.onFilterChange, n.filter, n.textField]
|
|
320
|
+
), Fe = t.useCallback(
|
|
321
|
+
(e) => {
|
|
322
|
+
if (!l.current)
|
|
323
|
+
return;
|
|
324
|
+
const i = {
|
|
325
|
+
syntheticEvent: e,
|
|
326
|
+
nativeEvent: e.nativeEvent,
|
|
327
|
+
target: l.current
|
|
328
|
+
};
|
|
329
|
+
n.onCancel && n.onCancel.call(void 0, i), g(i), e.preventDefault();
|
|
330
|
+
},
|
|
331
|
+
[n.onCancel, g]
|
|
332
|
+
), et = () => {
|
|
333
|
+
const e = n.filterable ? /* @__PURE__ */ t.createElement(
|
|
334
|
+
Ne,
|
|
335
|
+
{
|
|
336
|
+
value: n.filter === void 0 ? ye : n.filter,
|
|
337
|
+
ref: ie,
|
|
338
|
+
onChange: ke,
|
|
339
|
+
onKeyDown: Ce,
|
|
340
|
+
size: v,
|
|
341
|
+
rounded: V,
|
|
342
|
+
fillMode: Q
|
|
343
|
+
}
|
|
344
|
+
) : null, i = {
|
|
345
|
+
adaptiveTitle: n.adaptiveTitle,
|
|
346
|
+
expand: s,
|
|
347
|
+
onClose: (o) => n.onCancel ? Fe(o) : ce(o),
|
|
348
|
+
windowWidth: re,
|
|
349
|
+
mobileFilter: e,
|
|
350
|
+
footer: {
|
|
351
|
+
cancelText: J.toLanguageString(Re, ne[Re]),
|
|
352
|
+
onCancel: (o) => n.onCancel ? Fe(o) : ce(o),
|
|
353
|
+
applyText: J.toLanguageString(Me, ne[Me]),
|
|
354
|
+
onApply: (o) => g(o)
|
|
355
|
+
}
|
|
356
|
+
};
|
|
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(
|
|
358
|
+
Te,
|
|
359
|
+
{
|
|
360
|
+
ref: E,
|
|
361
|
+
tabIndex: z,
|
|
362
|
+
data: q,
|
|
363
|
+
focusIdField: x,
|
|
364
|
+
textField: n.textField,
|
|
365
|
+
checkField: fe,
|
|
366
|
+
checkIndeterminateField: me,
|
|
367
|
+
expandField: n.expandField,
|
|
368
|
+
childrenField: ge,
|
|
369
|
+
expandIcons: !0,
|
|
370
|
+
onItemClick: U,
|
|
371
|
+
onCheckChange: U,
|
|
372
|
+
onExpandChange: Ee,
|
|
373
|
+
checkboxes: !0,
|
|
374
|
+
size: v,
|
|
375
|
+
item: n.item,
|
|
376
|
+
dir: S
|
|
377
|
+
}
|
|
378
|
+
) : /* @__PURE__ */ t.createElement(xe, null, J.toLanguageString(te, ne[te]))))));
|
|
379
|
+
}, tt = t.useCallback(
|
|
380
|
+
(e) => {
|
|
381
|
+
for (let i of e)
|
|
382
|
+
qe(i.target.clientWidth);
|
|
383
|
+
},
|
|
384
|
+
[]
|
|
385
|
+
), xe = n.listNoData || bt, J = ft(), Ie = !Le || se.valid, { size: v, rounded: V, fillMode: Q } = n, X = P && s ? Ae : H.current, we = /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
|
|
386
|
+
"span",
|
|
387
|
+
{
|
|
388
|
+
className: ee("k-multiselecttree k-input", n.className, {
|
|
389
|
+
[`k-input-${Pe[v] || v}`]: v,
|
|
390
|
+
[`k-rounded-${wt[V] || V}`]: V,
|
|
391
|
+
[`k-input-${Q}`]: Q,
|
|
392
|
+
"k-focus": d && !C,
|
|
393
|
+
"k-invalid": !Ie,
|
|
394
|
+
"k-disabled": C,
|
|
395
|
+
"k-loading": n.loading,
|
|
396
|
+
"k-required": he
|
|
397
|
+
}),
|
|
398
|
+
tabIndex: z,
|
|
399
|
+
accessKey: n.accessKey,
|
|
400
|
+
id: F,
|
|
401
|
+
style: L ? { ...B, width: void 0 } : B,
|
|
402
|
+
dir: S,
|
|
403
|
+
ref: y,
|
|
404
|
+
onKeyDown: C ? void 0 : Ye,
|
|
405
|
+
onMouseDown: Qe,
|
|
406
|
+
onFocus: je,
|
|
407
|
+
onBlur: Je,
|
|
408
|
+
role: "combobox",
|
|
409
|
+
"aria-haspopup": "tree",
|
|
410
|
+
"aria-expanded": s,
|
|
411
|
+
"aria-disabled": C,
|
|
412
|
+
"aria-label": L,
|
|
413
|
+
"aria-labelledby": n.ariaLabelledBy,
|
|
414
|
+
"aria-describedby": n.ariaDescribedBy ? n.ariaDescribedBy : "tagslist-" + F,
|
|
415
|
+
"aria-required": n.required,
|
|
416
|
+
onClick: C ? void 0 : Xe
|
|
417
|
+
},
|
|
418
|
+
/* @__PURE__ */ t.createElement(
|
|
419
|
+
"div",
|
|
420
|
+
{
|
|
421
|
+
id: "tagslist-" + F,
|
|
422
|
+
className: ee("k-input-values k-chip-list k-selection-multiple", {
|
|
423
|
+
[`k-chip-list-${Pe[v] || v}`]: v
|
|
424
|
+
})
|
|
425
|
+
},
|
|
426
|
+
X.length > 0 && /* @__PURE__ */ t.createElement(
|
|
427
|
+
Ct,
|
|
428
|
+
{
|
|
429
|
+
tag: n.tag,
|
|
430
|
+
onTagDelete: Ze,
|
|
431
|
+
data: X,
|
|
432
|
+
guid: F,
|
|
433
|
+
focused: N ? H.current.find((e) => De(e, N, x)) : void 0,
|
|
434
|
+
size: v
|
|
435
|
+
}
|
|
436
|
+
)
|
|
437
|
+
),
|
|
438
|
+
/* @__PURE__ */ t.createElement("span", { className: "k-input-inner" }, X.length === 0 && /* @__PURE__ */ t.createElement("span", { className: "k-input-value-text" }, pe)),
|
|
439
|
+
n.loading && /* @__PURE__ */ t.createElement(ut, { className: "k-input-loading-icon", name: "loading" }),
|
|
440
|
+
le && !C && X.length > 0 && /* @__PURE__ */ t.createElement(Et, { onClick: ce }),
|
|
441
|
+
/* @__PURE__ */ t.createElement(
|
|
442
|
+
"select",
|
|
443
|
+
{
|
|
444
|
+
name: Oe,
|
|
445
|
+
ref: _,
|
|
446
|
+
tabIndex: -1,
|
|
447
|
+
"aria-hidden": !0,
|
|
448
|
+
title: L,
|
|
449
|
+
style: { opacity: 0, width: 1, border: 0, zIndex: -1, position: "absolute", left: "50%" }
|
|
450
|
+
},
|
|
451
|
+
/* @__PURE__ */ t.createElement(
|
|
452
|
+
"option",
|
|
453
|
+
{
|
|
454
|
+
value: n.valueMap ? n.valueMap.call(void 0, m) : m
|
|
455
|
+
}
|
|
456
|
+
)
|
|
457
|
+
),
|
|
458
|
+
!P && /* @__PURE__ */ t.createElement(
|
|
459
|
+
pt,
|
|
460
|
+
{
|
|
461
|
+
...M,
|
|
462
|
+
popupClass: ee(
|
|
463
|
+
M.popupClass,
|
|
464
|
+
"k-multiselecttree-popup"
|
|
465
|
+
),
|
|
466
|
+
className: ee(M.className, { "k-rtl": S === "rtl" }),
|
|
467
|
+
style: _e,
|
|
468
|
+
anchor: M.anchor || y.current,
|
|
469
|
+
show: s,
|
|
470
|
+
onOpen: Ge,
|
|
471
|
+
onClose: Ue,
|
|
472
|
+
ref: G
|
|
473
|
+
},
|
|
474
|
+
n.filterable && /* @__PURE__ */ t.createElement(
|
|
475
|
+
Ne,
|
|
476
|
+
{
|
|
477
|
+
value: n.filter === void 0 ? ye : n.filter,
|
|
478
|
+
ref: w,
|
|
479
|
+
onChange: ke,
|
|
480
|
+
onKeyDown: Ce,
|
|
481
|
+
tabIndex: z,
|
|
482
|
+
size: v,
|
|
483
|
+
rounded: V,
|
|
484
|
+
fillMode: Q
|
|
485
|
+
}
|
|
486
|
+
),
|
|
487
|
+
q.length > 0 ? /* @__PURE__ */ t.createElement(
|
|
488
|
+
Te,
|
|
489
|
+
{
|
|
490
|
+
style: { height: M.height },
|
|
491
|
+
ref: E,
|
|
492
|
+
tabIndex: z,
|
|
493
|
+
data: q,
|
|
494
|
+
focusIdField: x,
|
|
495
|
+
textField: n.textField,
|
|
496
|
+
checkField: fe,
|
|
497
|
+
checkIndeterminateField: me,
|
|
498
|
+
expandField: n.expandField,
|
|
499
|
+
childrenField: ge,
|
|
500
|
+
expandIcons: !0,
|
|
501
|
+
onItemClick: U,
|
|
502
|
+
onCheckChange: U,
|
|
503
|
+
onExpandChange: Ee,
|
|
504
|
+
checkboxes: !0,
|
|
505
|
+
size: v,
|
|
506
|
+
item: n.item,
|
|
507
|
+
dir: S
|
|
508
|
+
}
|
|
509
|
+
) : /* @__PURE__ */ t.createElement(xe, null, J.toLanguageString(te, ne[te]))
|
|
510
|
+
)
|
|
511
|
+
), P && et());
|
|
512
|
+
return L ? /* @__PURE__ */ t.createElement(
|
|
513
|
+
yt,
|
|
514
|
+
{
|
|
515
|
+
label: L,
|
|
516
|
+
editorValue: le,
|
|
517
|
+
editorPlaceholder: pe,
|
|
518
|
+
editorValid: Ie,
|
|
519
|
+
editorDisabled: C,
|
|
520
|
+
editorId: F,
|
|
521
|
+
style: { width: B ? B.width : void 0 },
|
|
522
|
+
children: we,
|
|
523
|
+
dir: S
|
|
524
|
+
}
|
|
525
|
+
) : we;
|
|
526
|
+
}), Rt = {
|
|
527
|
+
opened: a.bool,
|
|
528
|
+
disabled: a.bool,
|
|
529
|
+
dir: a.string,
|
|
530
|
+
tabIndex: a.number,
|
|
531
|
+
accessKey: a.string,
|
|
532
|
+
data: a.array,
|
|
533
|
+
value: a.any,
|
|
534
|
+
valueMap: a.func,
|
|
535
|
+
placeholder: a.string,
|
|
536
|
+
dataItemKey: a.string.isRequired,
|
|
537
|
+
textField: a.string.isRequired,
|
|
538
|
+
checkField: a.string,
|
|
539
|
+
checkIndeterminateField: a.string,
|
|
540
|
+
expandField: a.string,
|
|
541
|
+
subItemsField: a.string,
|
|
542
|
+
className: a.string,
|
|
543
|
+
style: a.object,
|
|
544
|
+
label: a.string,
|
|
545
|
+
validationMessage: a.string,
|
|
546
|
+
validityStyles: a.bool,
|
|
547
|
+
valid: a.bool,
|
|
548
|
+
required: a.bool,
|
|
549
|
+
name: a.string,
|
|
550
|
+
id: a.string,
|
|
551
|
+
ariaLabelledBy: a.string,
|
|
552
|
+
ariaDescribedBy: a.string,
|
|
553
|
+
filterable: a.bool,
|
|
554
|
+
filter: a.string,
|
|
555
|
+
loading: a.bool,
|
|
556
|
+
tags: a.arrayOf(a.shape({
|
|
557
|
+
text: a.string,
|
|
558
|
+
data: a.arrayOf(a.any)
|
|
559
|
+
})),
|
|
560
|
+
popupSettings: a.shape({
|
|
561
|
+
animate: a.oneOfType([a.bool, a.shape({
|
|
562
|
+
openDuration: a.number,
|
|
563
|
+
closeDuration: a.number
|
|
564
|
+
})]),
|
|
565
|
+
popupClass: a.string,
|
|
566
|
+
className: a.string,
|
|
567
|
+
appendTo: a.any,
|
|
568
|
+
width: a.oneOfType([a.string, a.number]),
|
|
569
|
+
height: a.oneOfType([a.string, a.number])
|
|
570
|
+
}),
|
|
571
|
+
onOpen: a.func,
|
|
572
|
+
onClose: a.func,
|
|
573
|
+
onFocus: a.func,
|
|
574
|
+
onBlur: a.func,
|
|
575
|
+
onChange: a.func,
|
|
576
|
+
onFilterChange: a.func,
|
|
577
|
+
onExpandChange: a.func,
|
|
578
|
+
onCancel: a.func,
|
|
579
|
+
item: a.func,
|
|
580
|
+
listNoData: a.func,
|
|
581
|
+
adaptiveTitle: a.string,
|
|
582
|
+
adaptive: a.bool
|
|
583
|
+
};
|
|
584
|
+
de.displayName = "KendoReactMultiSelectTree";
|
|
585
|
+
de.defaultProps = D;
|
|
586
|
+
de.propTypes = Rt;
|
|
587
|
+
export {
|
|
588
|
+
de as MultiSelectTree,
|
|
589
|
+
Dt as MultiSelectTreePropsContext
|
|
590
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@progress/kendo-react-common"),r=(i,m)=>{const u={};return i&&i.length&&i.forEach(f=>{u[m(f)]=!0}),u},G=(i,m)=>{const{items:u,dataItemKey:f,value:p,subItemsField:w="items",operation:V}=m,t=S.getter(f),I=r(p,t);if(V==="clear")return[];if(V==="delete"){const n=r(u,t);return p.filter(e=>!n[t(e)])}const y=u[0],C=t(y),d=S.getter(w),a=[...i],c=[];let M=[],g;for(;a.length;){const n=a.pop();if(C===t(n)){M=c.map(e=>e.item),g=n;break}else{c&&c.length&&c[c.length-1].parentPosition===a.length&&c.pop();const e=d(n);e&&e.length&&(c.push({item:n,parentPosition:a.length}),a.push(...e))}}const b=[...d(g)||[]];let k=[];for(;b.length;){const n=b.pop();k.push(n);const e=d(n);e&&e.length&&b.push(...e)}const P=!I[C],l=[];if(P){l.push(...p),l.push(g),l.push(...k.filter(s=>!I[t(s)]));const n=M.filter(s=>!I[t(s)]),e=r(l,t);for(let s=n.length-1;s>-1;s--){const h=n[s],o=d(h);if(o.filter(T=>e[t(T)]).length<o.length)break;l.push(h),e[t(h)]=!0}}else{const n=t(g),e=r(k,t),s=r(M,t);l.push(...p.filter(h=>{const o=t(h);return!e[o]&&n!==o&&!s[o]}))}return l};exports.getMultiSelectTreeValue=G;exports.getValueMap=r;
|