@progress/kendo-react-dropdowns 9.4.0-develop.6 → 9.4.0-develop.7
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 +0 -1
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +0 -1
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +0 -1
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +0 -1
- package/DropDownTree/ListNoData.js +1 -1
- package/DropDownTree/ListNoData.mjs +0 -1
- package/DropDownTree/useDropdownWidth.js +1 -1
- package/DropDownTree/useDropdownWidth.mjs +7 -8
- package/MultiColumnComboBox/MultiColumnComboBox.js +1 -1
- package/MultiColumnComboBox/MultiColumnComboBox.mjs +0 -1
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +0 -1
- package/MultiSelect/TagList.js +1 -1
- package/MultiSelect/TagList.mjs +8 -9
- package/MultiSelectTree/MultiSelectTree.js +1 -1
- package/MultiSelectTree/MultiSelectTree.mjs +0 -1
- package/MultiSelectTree/utils.js +1 -1
- package/MultiSelectTree/utils.mjs +16 -17
- package/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +7 -8
- package/common/ClearButton.js +1 -1
- package/common/ClearButton.mjs +5 -6
- package/common/DropDownBase.js +1 -1
- package/common/DropDownBase.mjs +0 -1
- package/common/GroupStickyHeader.js +1 -1
- package/common/GroupStickyHeader.mjs +4 -5
- package/common/List.js +1 -1
- package/common/List.mjs +0 -1
- package/common/ListContainer.js +1 -1
- package/common/ListContainer.mjs +7 -8
- package/common/ListDefaultItem.js +1 -1
- package/common/ListDefaultItem.mjs +9 -10
- package/common/ListFilter.js +1 -1
- package/common/ListFilter.mjs +4 -5
- package/common/ListGroupItem.js +1 -1
- package/common/ListGroupItem.mjs +5 -6
- package/common/ListItem.js +1 -1
- package/common/ListItem.mjs +0 -1
- package/common/MultiColumnList.js +1 -1
- package/common/MultiColumnList.mjs +4 -5
- package/common/Navigation.js +1 -1
- package/common/Navigation.mjs +0 -1
- package/common/SearchBar.js +1 -1
- package/common/SearchBar.mjs +3 -4
- package/common/VirtualScrollStatic.js +1 -1
- package/common/VirtualScrollStatic.mjs +0 -1
- package/common/settings.js +1 -1
- package/common/settings.mjs +0 -1
- package/common/utils.js +1 -1
- package/common/utils.mjs +24 -25
- package/common/withCustomComponent.js +1 -1
- package/common/withCustomComponent.mjs +2 -3
- package/index.js +2 -1
- package/index.mjs +2 -2
- package/messages/index.js +1 -1
- package/messages/index.mjs +4 -5
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -3
- package/package.json +10 -10
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("react"),v=require("prop-types"),h=require("@progress/kendo-react-common"),W=require("@progress/kendo-svg-icons"),j=require("@progress/kendo-react-labels"),G=require("../common/ListContainer.js"),U=require("../common/List.js"),Y=require("../common/GroupStickyHeader.js"),J=require("./TagList.js"),Q=require("../common/SearchBar.js"),K=require("../common/DropDownBase.js"),D=require("../common/settings.js"),g=require("../common/utils.js"),X=require("../package-metadata.js"),Z=require("../common/ClearButton.js"),ee=require("../common/AdaptiveMode.js"),te=require("@progress/kendo-react-layout"),se=require("@progress/kendo-react-intl"),C=require("../messages/index.js"),ie=require("../common/ListFilter.js"),P=require("../common/withCustomComponent.js");function oe(I){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(I){for(const e in I)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(I,e);Object.defineProperty(n,e,t.get?t:{enumerable:!0,get:()=>I[e]})}}return n.default=I,Object.freeze(n)}const f=oe($),{sizeMap:w,roundedMap:ae}=h.kendoThemeMaps,ne="Please enter a valid value!",E=I=>I.preventDefault(),_=I=>I===2,b=class b extends f.Component{constructor(n){super(n),this.state={activedescendant:D.ActiveDescendant.PopupList,currentValue:[]},this._element=null,this._valueItemsDuringOnChange=null,this.base=new K(this),this._tags=[],this._input=null,this._adaptiveInput=null,this._skipFocusEvent=!1,this._lastSelectedOrDeslectedItemIndex=null,this.itemHeight=0,this.scrollToFocused=!1,this.localization=null,this.focus=()=>{this._input&&this._input.focus()},this.handleItemSelect=(e,t)=>{const{dataItemKey:o,virtual:s}=this.props,a=g.getFilteredData(this.props),p=s?s.skip:0,u=a[e-p],r=this.value.findIndex(m=>g.areSame(m,u,o));this._lastSelectedOrDeslectedItemIndex=a.findIndex(m=>g.areSame(m,u,o));let i=[];r!==-1?(i=this.value,i.splice(r,1)):i=[...this.value,u],(this.props.filter!==void 0?this.props.filter:this.state.text)&&!this.mobileMode&&(this.state.text&&(t.data.text=""),this.base.filterChanged("",t)),this._adaptiveInput&&this._adaptiveInput.blur(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.triggerOnChange(i,t),this.base.triggerPageChangeCornerItems(u,t)},this.onTagDelete=(e,t)=>{const o=this.base.initState();o.syntheticEvent=t,this.opened&&this.base.togglePopup(o),!this.state.focused&&!this.mobileMode&&(o.data.focused=!0,this.focus());const s=this.value;g.removeDataItems(s,e,this.props.dataItemKey),this.triggerOnChange(s,o),this.applyState(o)},this.itemFocus=(e,t)=>{const{allowCustom:o,virtual:s}=this.props,a=g.getFilteredData(this.props),p=s?s.skip:0,u=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedIndex:r}=this.getFocusedState(),i=o&&u,l=a[e-p];l&&r!==e?this.state.focusedIndex!==e&&(t.data.focusedIndex=e,t.data.activedescendant=D.ActiveDescendant.PopupList):i&&e===-1&&this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.base.triggerPageChangeCornerItems(l,t)},this.componentRef=e=>{this._element=e,this.base.wrapper=e},this.searchbarRef=e=>{const t=this._input=e&&e.input;t&&this.state.focused&&window.setTimeout(()=>t.focus(),0)},this.onChangeHandler=e=>{const t=this.base.initState(),o=e.target.value;t.syntheticEvent=e,this.props.filter===void 0&&(t.data.text=o),t.data.focusedIndex=void 0,this.opened||(this.base.togglePopup(t),this.setState({currentValue:this.value})),this.base.filterChanged(o,t),this.applyState(t),this.setState({group:void 0})},this.clearButtonClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.value.length>0&&this.triggerOnChange([],t),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t);const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this._lastSelectedOrDeslectedItemIndex=null,this.applyState(t)},this.onInputKeyDown=e=>{const{textField:t,groupField:o}=this.props,s=g.getFilteredData(this.props),a=e.keyCode,p=this.props.filter!==void 0?this.props.filter:this.state.text,u=this.props.opened!==void 0?this.props.opened:this.state.opened,{focusedItem:r,focusedIndex:i}=this.getFocusedState(),l=this.base.initState();if(l.syntheticEvent=e,!p&&this.value.length>0&&(a===h.Keys.left||a===h.Keys.right||a===h.Keys.home||a===h.Keys.end||a===h.Keys.delete||a===h.Keys.backspace)&&!e.shiftKey)return this.onTagsNavigate(e,l);const m=()=>{e.preventDefault(),this.base.togglePopup(l),this.applyState(l)};if(this.opened)if(a===h.Keys.pageUp)e.preventDefault(),this.base.scrollPopupByPageSize(-1);else if(a===h.Keys.pageDown)e.preventDefault(),this.base.scrollPopupByPageSize(1);else if((e.ctrlKey||e.metaKey)&&e.code==="KeyA"){const c=(this.state.value&&this.state.value.length)===s.length?[]:s;this.updateStateOnKeyboardNavigation(c,l)}else if((e.ctrlKey||e.metaKey)&&e.shiftKey&&e.keyCode===h.Keys.end){const d=s.slice(this.getFocusedState().focusedIndex);this.itemFocus(s.length-1,l),this.updateStateOnKeyboardNavigation(d,l)}else if((e.ctrlKey||e.metaKey)&&e.shiftKey&&e.keyCode===h.Keys.home){const d=s.slice(0,this.getFocusedState().focusedIndex+1);this.itemFocus(0,l),this.updateStateOnKeyboardNavigation(d,l)}else if(e.shiftKey&&e.keyCode===h.Keys.up){let d;const c=this.getLastSelectedOrDeselectedIndex(1,i);c===null?d=i!==0?s.slice(i-1,i):[s[i]]:c===i?d=[s[c-1]]:i>=0&&(d=c>i?s.slice(i-1,c):s.slice(c-1,i)),d&&d.length>0&&(i>=1&&this.itemFocus(i-1,l),this.updateStateOnKeyboardNavigation(d,l))}else if(e.shiftKey&&e.keyCode===h.Keys.down){let d;const c=this.getLastSelectedOrDeselectedIndex(0,i);c===null?d=i!==s.length-1?s.slice(i,i+1):[s[i]]:c===i?d=s.slice(i,i+2):i>=0&&(d=c>i?s.slice(i+1,c+1):s.slice(c,i+2)),d&&d.length>=1&&(this.itemFocus(i+1,l),this.updateStateOnKeyboardNavigation(d,l))}else if(e.altKey&&a===h.Keys.up)m();else if(a===h.Keys.up||a===h.Keys.down){if(o!==""&&t)if(!this.props.skipDisabledItems&&u)this.onNavigate(l,a);else{let d=0;if(a===h.Keys.down||a===h.Keys.right){const c=s.slice(i+1).find(y=>!y.disabled&&y[t]);d=c&&s.findIndex(y=>y[t]===c[t])}else if(a===h.Keys.up||a===h.Keys.left){let c;if(i===-1)c=s,d=s.findIndex(y=>!y.disabled&&y[t]);else{c=s.slice(0,i);let y=c.pop();for(;y&&y.disabled;)y=c.pop();d=y&&s.findIndex(x=>x[t]===y[t])}}if(d){const c=d-i;this.onNavigate(l,a,c)}else d!==void 0&&this.onNavigate(l,a)}else if(!this.props.skipDisabledItems&&u)this.onNavigate(l,a);else{let d=null;if(a===h.Keys.down||a===h.Keys.right)d=s.slice(i+1).find(c=>!c.disabled);else if(a===h.Keys.up||a===h.Keys.left){const c=s.slice(0,i);for(d=c.pop();d&&d.disabled;)d=c.pop()}if(d){const c=d.id-i-1;this.onNavigate(l,a,c)}else this.onNavigate(l,a)}this.applyState(l),e.preventDefault()}else a===h.Keys.enter?(e.preventDefault(),this.props.allowCustom&&p&&r===null?this.customItemSelect(e):r&&r.disabled?m():this.selectFocusedItem(e)):a===h.Keys.esc&&m();else e.altKey&&a===h.Keys.down?m():a===h.Keys.esc&&this.clearButtonClick(e)},this.listContainerContent=()=>{const{header:e,footer:t,allowCustom:o,size:s,groupStickyHeaderItemRender:a,groupField:p,list:u}=this.props,r=g.getFilteredData(this.props),i=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedType:l}=this.getFocusedState(),m=o&&i&&f.createElement("div",{className:h.classNames("k-list",{[`k-list-${w[s]||s}`]:s}),key:"customitem",onClick:this.customItemSelect,onMouseDown:E},f.createElement("div",{className:h.classNames("k-list-item k-custom-item",{"k-focus":_(l)}),style:{fontStyle:"italic"}},i,f.createElement(h.IconWrap,{name:"plus",icon:W.plusIcon,style:{position:"absolute",right:"0.5em"}})));let{group:d}=this.state;return d===void 0&&p!==void 0&&(d=g.getItemValue(r[0],p)),f.createElement(f.Fragment,null,e&&f.createElement("div",{className:"k-list-header"},e),m,f.createElement("div",{className:h.classNames("k-list",{[`k-list-${this.mobileMode?"lg":w[s]||s}`]:s,"k-virtual-list":this.base.vs.enabled})},!u&&d&&r.length!==0&&f.createElement(Y,{group:d,groupMode:"modern",render:a}),this.renderList()),t&&f.createElement("div",{className:"k-list-footer"},t))},this.renderListContainer=()=>{const e=this.base,{dir:t}=this.props,o=g.getFilteredData(this.props),s=this.base.getPopupSettings(),a=s.width!==void 0?s.width:e.popupWidth,p={dir:t!==void 0?t:e.dirCalculated,width:a,popupSettings:{...s,popupClass:h.classNames(s.popupClass,"k-list-container","k-multiselect-popup"),anchor:s.anchor||this.element,show:this.opened,onOpen:this.onPopupOpened,onClose:this.onPopupClosed},itemsCount:[o.length,this.value.length]};return f.createElement(G,{...p},this.listContainerContent())},this.renderAdaptiveListContainer=()=>{const{adaptiveTitle:e,filterable:t,filter:o}=this.props,{windowWidth:s=0}=this.state,a=o!==void 0?o:this.state.text;this.localization=se.provideLocalizationService(this);const p=t?f.createElement(ie,{value:a,ref:r=>this._adaptiveInput=r&&r.element,onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode}):null,u={title:e,expand:this.opened,onClose:r=>this.onCancel(r),windowWidth:s,mobileFilter:p,footer:{cancelText:this.localization.toLanguageString(C.adaptiveModeFooterCancel,C.messages[C.adaptiveModeFooterCancel]),onCancel:this.onCancel,applyText:this.localization.toLanguageString(C.adaptiveModeFooterApply,C.messages[C.adaptiveModeFooterApply]),onApply:this.closePopup}};return f.createElement(ee.AdaptiveMode,{...u},f.createElement(te.ActionSheetContent,{overflowHidden:!0},f.createElement("div",{className:"k-list-container"},this.listContainerContent())))},this.closePopup=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t),t.events.push({type:"onClose"});const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this.applyState(t)},this.onCancel=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t),t.events.push({type:"onCancel"});const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this.applyState(t)},this.renderList=()=>{const{textField:e,listNoDataRender:t,itemRender:o,groupHeaderItemRender:s,dataItemKey:a,virtual:p={skip:0,total:void 0}}=this.props,u=g.getFilteredData(this.props),r=this.base.vs,{focusedIndex:i}=this.getFocusedState(),l=this.base.getPopupSettings(),m=`translateY(${r.translate}px)`;return f.createElement(U,{id:this.base.listBoxId,show:this.opened,data:u.slice(),focusedIndex:i-p.skip,value:this.value,textField:e,valueField:a,optionsGuid:this.base.guid,groupField:this.props.groupField,groupMode:"modern",listRef:d=>{r.list=this.base.list=d},wrapperStyle:this.mobileMode?{}:{maxHeight:l.height},wrapperCssClass:"k-list-content",listStyle:r.enabled?{transform:m}:void 0,key:"listKey",skip:p.skip,onClick:this.handleItemClick,itemRender:o,groupHeaderItemRender:s,noDataRender:t,onMouseDown:E,onBlur:this.handleBlur,onScroll:this.onScroll,wrapperRef:r.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:p.total})},this.onScroll=e=>{const{vs:t,list:o}=this.base;t.scrollHandler(e);const{groupField:s}=this.props;let a=g.getFilteredData(this.props);if(!(!s||!a.length)&&s){const p=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:o?o.children[0].offsetHeight:0),r=e.target.scrollTop-t.skip*p;a=this.base.getGroupedDataModernMode(a,s);let i=a[0][s];for(let l=1;l<a.length&&!(p*l>r);l++)a[l]&&a[l][s]&&(i=a[l][s]);i!==this.state.group&&this.setState({group:i})}},this.customItemSelect=e=>{const t=this.props.filter!==void 0?this.props.filter:this.state.text,{textField:o}=this.props;if(!t)return;const s=this.base.initState();s.syntheticEvent=e;const a=o?{[o]:t}:t;this.state.text!==void 0&&(s.data.text=""),s.data.focusedIndex=void 0,this.base.filterChanged("",s);const p=[...this.value,a];this.triggerOnChange(p,s),this.base.togglePopup(s),this.applyState(s)},this.handleWrapperClick=e=>{const t=this._input;!this.opened&&t&&this.focusElement(t);const o=this.base.initState();o.syntheticEvent=e,!this.state.focused&&!this.mobileMode&&(o.events.push({type:"onFocus"}),o.data.focused=!0),this.mobileMode&&(this.setState({currentValue:this.tagsToRender}),this.mobileMode&&window.setTimeout(()=>this._adaptiveInput&&this._adaptiveInput.focus(),300)),this.base.togglePopup(o),this.applyState(o)},this.handleItemClick=(e,t)=>{const o=this.base.initState();o.syntheticEvent=t,this.handleItemSelect(e,o),this.props.autoClose&&!this.mobileMode&&this.base.togglePopup(o),t.stopPropagation(),this.applyState(o)},this.handleBlur=e=>{if(!this.state.focused||this._skipFocusEvent)return;const t=this.base.initState(),{allowCustom:o,filterable:s}=this.props;t.syntheticEvent=e,t.data.focused=!1,t.events.push({type:"onBlur"}),this.opened&&!this.mobileMode&&(this.state.opened&&(t.data.opened=!1),t.events.push({type:"onClose"})),!o&&!s&&this.state.text&&(t.data.text=""),this.applyState(t)},this.handleFocus=e=>{this._skipFocusEvent||this.base.handleFocus(e)},this.onPopupOpened=()=>{this._input&&this.state.focused&&!this.mobileMode&&this.focusElement(this._input)},this.onPopupClosed=()=>{this.state.focused&&window.setTimeout(()=>{this.state.focused&&this.focusElement(this._input)},0)},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||ne)},h.validatePackage(X.packageMetadata)}get _inputId(){return this.props.id}get document(){if(h.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get opened(){return!!(this.props.opened!==void 0?this.props.opened:this.state.opened)}get tagsToRender(){const{tags:n,textField:e}=this.props,t=[];return n===void 0?this.value.forEach(o=>{t.push({text:g.getItemValue(o,e),data:[o]})}):t.push(...n),t}get mobileMode(){var e;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((e=this.props._adaptiveMode)==null?void 0:e.medium)&&this.props.adaptive)}get value(){const n=[];return this._valueItemsDuringOnChange?n.push(...this._valueItemsDuringOnChange):this.props.value?n.push(...this.props.value):this.state.value?n.push(...this.state.value):this.props.defaultValue&&n.push(...this.props.defaultValue),n}get name(){return this.props.name}get validity(){const n=this.props.validationMessage!==void 0,e=!this.required||this.value!==null&&this.value.length>0&&this.value!==void 0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:n,valid:t,valueMissing:this.value===null}}get required(){return this.props.required!==void 0?this.props.required:b.defaultProps.required}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:b.defaultProps.validityStyles}componentDidUpdate(n,e){var m;const{virtual:t,groupField:o=""}=this.props,s=g.getFilteredData(this.props),a=t?t.skip:0,p=n.virtual?n.virtual.total:0,u=n.opened!==void 0?n.opened:e.opened,r=!u&&this.opened,i=u&&!this.opened,l=this.base.getPopupSettings();if(this.base.didUpdate(),!l.animate&&i&&this.onPopupClosed(),t&&t.total!==p)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{let{focusedItem:d,focusedIndex:c}=this.getFocusedState();o!==""&&(c=(m=this.base.getGroupedDataModernMode(s,o))==null?void 0:m.indexOf(d)),r&&t?this.base.scrollToVirtualItem(t,c-a):r&&!t?(s&&s.length!==0&&this.base.resetGroupStickyHeader(s[0][o],this),this.base.scrollToItem(c)):this.opened&&u&&d&&this.scrollToFocused&&this.base.scrollToItem(c-a)}this.scrollToFocused=!1,this.setValidity()}componentDidMount(){var n;this.observerResize=h.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(n=this.document)!=null&&n.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentWillUnmount(){var n;(n=this.document)!=null&&n.body&&this.observerResize&&this.observerResize.disconnect()}onNavigate(n,e,t){const{allowCustom:o}=this.props,s=g.getFilteredData(this.props),a=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedType:p,focusedIndex:u}=this.getFocusedState(),r=o&&a,i=_(p),l=this.base,m=l.vs;if(this.opened&&e===h.Keys.up&&i)this.state.focusedIndex!==void 0&&(n.data.focusedIndex=void 0);else{const d=l.navigation.navigate({keyCode:e,current:u,max:(m.enabled?m.total:s.length)-1,min:r?-1:0,skipItems:t||void 0});d!==void 0&&(this.itemFocus(d,n),this.scrollToFocused=!0)}this.applyState(n)}render(){const{style:n,className:e,label:t,dir:o,disabled:s,textField:a,dataItemKey:p,virtual:u,size:r,rounded:i,fillMode:l,loading:m,filter:d}=this.props,{text:c,focused:y,focusedTag:x,currentValue:q}=this.state,k=this.base.vs,T=this.props.id||this._inputId;k.enabled=u!==void 0,u!==void 0&&(k.skip=u.skip,k.total=u.total,k.pageSize=u.pageSize);const S=this.mobileMode&&this.opened?q:this.tagsToRender;this.setItems(this.tagsToRender,this._tags);const M=!this.validityStyles||this.validity.valid,L=!!(d!==void 0?d:c)||S&&S.length>0,[z,B]=P(this.props.prefix||f.Fragment),[V,A]=P(this.props.suffix||f.Fragment),O=f.createElement(f.Fragment,null,f.createElement("div",{ref:this.componentRef,className:h.classNames("k-multiselect k-input",e,{[`k-input-${w[r]||r}`]:r,[`k-rounded-${ae[i]||i}`]:i,[`k-input-${l}`]:l,"k-focus":y&&!s,"k-invalid":!M,"k-disabled":s,"k-loading":m,"k-required":this.required}),style:t?{...n,width:void 0}:n,dir:o,onFocus:this.handleFocus,onBlur:this.handleBlur,onClick:this.handleWrapperClick,onMouseDown:g.preventDefaultNonInputs},this.props.prefix&&f.createElement(z,{...B}),f.createElement("div",{className:h.classNames("k-input-values")},f.createElement("div",{className:h.classNames("k-chip-list",{[`k-chip-list-${w[r]||r}`]:r}),role:"listbox",id:"tagslist-"+this.base.guid},S&&S.length>0&&f.createElement(J,{tagRender:this.props.tagRender,onTagDelete:this.onTagDelete,data:S,guid:this.base.guid,focused:x?S.find(H=>g.matchTags(H,x,p)):void 0,size:r})),this.renderSearchBar(T)),m&&f.createElement(h.IconWrap,{className:"k-input-loading-icon",name:"loading"}),this.props.suffix&&f.createElement(V,{...A}),L&&f.createElement(Z,{onClick:this.clearButtonClick}),!this.mobileMode&&this.renderListContainer()),this.mobileMode&&this.renderAdaptiveListContainer());return t?f.createElement(j.FloatingLabel,{label:t,editorId:T,editorValue:c||g.getItemValue(this.value[0],a),editorValid:M,editorDisabled:s,style:{width:n?n.width:void 0},children:O}):O}renderSearchBar(n){const{activedescendant:e,focusedTag:t,currentValue:o}=this.state,{disabled:s,placeholder:a,ariaDescribedBy:p,ariaLabelledBy:u,ariaLabel:r,inputAttributes:i}=this.props,l=!this.mobileMode&&(this.props.filter!==void 0?this.props.filter:this.state.text)||"",{focusedIndex:m}=this.getFocusedState(),d=this.value.length===0&&!l?a:void 0,c=o&&o.length>0?void 0:a,y=e===D.ActiveDescendant.TagsList&&t!==void 0?`tag-${this.base.guid}-${t.text.replace(/\s+/g,"-")}`:`option-${this.base.guid}-${m}`,x={accessKey:this.props.accessKey,tabIndex:this.props.tabIndex};return f.createElement(Q,{id:n,size:Math.max((d||"").length,l.length,1),placeholder:this.mobileMode&&this.opened?c:d,value:l,onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,ref:this.searchbarRef,disabled:s,expanded:this.opened,owns:this.base.listBoxId,role:"combobox",activedescendant:y,ariaDescribedBy:`tagslist-${this.base.guid}${p?" "+p:""}`,ariaLabelledBy:u,ariaRequired:this.required,ariaLabel:r,inputAttributes:i,...x})}onTagsNavigate(n,e){const t=n.keyCode,{focusedTag:o}=this.state,s=this._tags,a=this.props.dataItemKey;let p=o?s.findIndex(i=>g.matchTags(i,o,a)):-1,u;const r=p!==-1;if(t===h.Keys.left)r?p=Math.max(0,p-1):p=s.length-1,u=s[p];else if(t===h.Keys.right)p===s.length-1?u=void 0:r&&(p=Math.min(s.length-1,p+1),u=s[p]);else if(t===h.Keys.home&&!n.shiftKey)u=s[0];else if(t===h.Keys.end&&!n.shiftKey)u=s[s.length-1];else if(t===h.Keys.delete){if(r){const i=this.value;g.removeDataItems(i,s[p].data,a),this.triggerOnChange(i,e)}}else if(t===h.Keys.backspace){const i=this.value;if(r)g.removeDataItems(i,s[p].data,a),this.triggerOnChange(i,e);else if(!r&&s.length){const l=s.pop();g.removeDataItems(i,l.data,a),this.triggerOnChange(i,e)}}u!==o&&(e.data.focusedTag=u,e.data.activedescendant=D.ActiveDescendant.TagsList),this.applyState(e)}triggerOnChange(n,e){this.props.value===void 0&&(e.data.value=[...n]),this._valueItemsDuringOnChange=[],this.setItems(n,this._valueItemsDuringOnChange),e.events.push({type:"onChange"})}selectFocusedItem(n,e){const{virtual:t}=this.props,o=g.getFilteredData(this.props),{focusedIndex:s}=e||this.getFocusedState(),a=t?t.skip:0;o[s-a]!==void 0&&this.handleItemClick(s,n)}setItems(n,e){e.length=0,e.push(...n)}getFocusedState(){const{focusedIndex:n}=this.state,e=this.props.filter!==void 0?this.props.filter:this.state.text,{allowCustom:t,dataItemKey:o,virtual:s,textField:a,focusedItemIndex:p=g.itemIndexStartsWith,skipDisabledItems:u}=this.props,r=g.getFilteredData(this.props),i=s&&s.skip||0;let l;if(n!==void 0)return{focusedIndex:n,focusedItem:r[n-i],focusedType:1};const m=this.value;if(t&&e)return{focusedItem:null,focusedIndex:-1,focusedType:2};if(e)return l=p(r,e,a),{focusedItem:r[l],focusedIndex:l+i,focusedType:1};if(m.length){const d=m[m.length-1];return l=r.findIndex(c=>g.areSame(c,d,o)),r[l]!==void 0?{focusedIndex:l+i,focusedItem:r[l],focusedType:1}:{focusedType:0,focusedIndex:-1}}else if(u&&a&&!e&&i===0){const d=r.findIndex(c=>!c.disabled&&c[a]);return{focusedIndex:d,focusedItem:r[d-i],focusedType:1}}return i===0?{focusedItem:r[0],focusedIndex:0,focusedType:1}:{focusedType:0,focusedIndex:-1}}focusElement(n){this._skipFocusEvent=!0,n.focus(),window.setTimeout(()=>this._skipFocusEvent=!1,0)}applyState(n){this.base.applyState(n),this._valueItemsDuringOnChange=null}calculateMedia(n){for(const e of n)this.setState({windowWidth:e.target.clientWidth})}updateStateOnKeyboardNavigation(n,e){this.setState({value:n}),this.triggerOnChange(n,e),this.applyState(e)}getLastSelectedOrDeselectedIndex(n,e){return this._lastSelectedOrDeslectedItemIndex===null&&(this._lastSelectedOrDeslectedItemIndex=e),this._lastSelectedOrDeslectedItemIndex!==null?this._lastSelectedOrDeslectedItemIndex+n:null}};b.displayName="MultiSelect",b.propTypes={...K.propTypes,autoClose:v.bool,value:v.arrayOf(v.any),defaultValue:v.arrayOf(v.any),dataItemKey:v.string,placeholder:v.string,tags:v.arrayOf(v.shape({text:v.string,data:v.arrayOf(v.any)})),tagRender:v.func,id:v.string,ariaLabelledBy:v.string,ariaDescribedBy:v.string,groupField:v.string,list:v.any,adaptive:v.bool,adaptiveTitle:v.string,onCancel:v.func,skipDisabledItems:v.bool,inputAttributes:v.object},b.defaultProps={...K.defaultProps,autoClose:!0,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern",skipDisabledItems:!0,prefix:void 0,suffix:void 0};let F=b;const N=h.createPropsContext(),R=h.withIdHOC(h.withPropsContext(N,h.withAdaptiveModeContext(F)));R.displayName="KendoReactMultiSelect";exports.MultiSelect=R;exports.MultiSelectPropsContext=N;exports.MultiSelectWithoutContext=F;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("react"),v=require("prop-types"),h=require("@progress/kendo-react-common"),W=require("@progress/kendo-svg-icons"),j=require("@progress/kendo-react-labels"),G=require("../common/ListContainer.js"),U=require("../common/List.js"),Y=require("../common/GroupStickyHeader.js"),J=require("./TagList.js"),Q=require("../common/SearchBar.js"),K=require("../common/DropDownBase.js"),D=require("../common/settings.js"),g=require("../common/utils.js"),X=require("../package-metadata.js"),Z=require("../common/ClearButton.js"),ee=require("../common/AdaptiveMode.js"),te=require("@progress/kendo-react-layout"),se=require("@progress/kendo-react-intl"),C=require("../messages/index.js"),ie=require("../common/ListFilter.js"),P=require("../common/withCustomComponent.js");function oe(I){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(I){for(const e in I)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(I,e);Object.defineProperty(n,e,t.get?t:{enumerable:!0,get:()=>I[e]})}}return n.default=I,Object.freeze(n)}const f=oe($),{sizeMap:w,roundedMap:ae}=h.kendoThemeMaps,ne="Please enter a valid value!",E=I=>I.preventDefault(),_=I=>I===2,b=class b extends f.Component{constructor(n){super(n),this.state={activedescendant:D.ActiveDescendant.PopupList,currentValue:[]},this._element=null,this._valueItemsDuringOnChange=null,this.base=new K(this),this._tags=[],this._input=null,this._adaptiveInput=null,this._skipFocusEvent=!1,this._lastSelectedOrDeslectedItemIndex=null,this.itemHeight=0,this.scrollToFocused=!1,this.localization=null,this.focus=()=>{this._input&&this._input.focus()},this.handleItemSelect=(e,t)=>{const{dataItemKey:o,virtual:s}=this.props,a=g.getFilteredData(this.props),p=s?s.skip:0,u=a[e-p],r=this.value.findIndex(m=>g.areSame(m,u,o));this._lastSelectedOrDeslectedItemIndex=a.findIndex(m=>g.areSame(m,u,o));let i=[];r!==-1?(i=this.value,i.splice(r,1)):i=[...this.value,u],(this.props.filter!==void 0?this.props.filter:this.state.text)&&!this.mobileMode&&(this.state.text&&(t.data.text=""),this.base.filterChanged("",t)),this._adaptiveInput&&this._adaptiveInput.blur(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.triggerOnChange(i,t),this.base.triggerPageChangeCornerItems(u,t)},this.onTagDelete=(e,t)=>{const o=this.base.initState();o.syntheticEvent=t,this.opened&&this.base.togglePopup(o),!this.state.focused&&!this.mobileMode&&(o.data.focused=!0,this.focus());const s=this.value;g.removeDataItems(s,e,this.props.dataItemKey),this.triggerOnChange(s,o),this.applyState(o)},this.itemFocus=(e,t)=>{const{allowCustom:o,virtual:s}=this.props,a=g.getFilteredData(this.props),p=s?s.skip:0,u=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedIndex:r}=this.getFocusedState(),i=o&&u,l=a[e-p];l&&r!==e?this.state.focusedIndex!==e&&(t.data.focusedIndex=e,t.data.activedescendant=D.ActiveDescendant.PopupList):i&&e===-1&&this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.base.triggerPageChangeCornerItems(l,t)},this.componentRef=e=>{this._element=e,this.base.wrapper=e},this.searchbarRef=e=>{const t=this._input=e&&e.input;t&&this.state.focused&&window.setTimeout(()=>t.focus(),0)},this.onChangeHandler=e=>{const t=this.base.initState(),o=e.target.value;t.syntheticEvent=e,this.props.filter===void 0&&(t.data.text=o),t.data.focusedIndex=void 0,this.opened||(this.base.togglePopup(t),this.setState({currentValue:this.value})),this.base.filterChanged(o,t),this.applyState(t),this.setState({group:void 0})},this.clearButtonClick=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.value.length>0&&this.triggerOnChange([],t),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t);const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this._lastSelectedOrDeslectedItemIndex=null,this.applyState(t)},this.onInputKeyDown=e=>{const{textField:t,groupField:o}=this.props,s=g.getFilteredData(this.props),a=e.keyCode,p=this.props.filter!==void 0?this.props.filter:this.state.text,u=this.props.opened!==void 0?this.props.opened:this.state.opened,{focusedItem:r,focusedIndex:i}=this.getFocusedState(),l=this.base.initState();if(l.syntheticEvent=e,!p&&this.value.length>0&&(a===h.Keys.left||a===h.Keys.right||a===h.Keys.home||a===h.Keys.end||a===h.Keys.delete||a===h.Keys.backspace)&&!e.shiftKey)return this.onTagsNavigate(e,l);const m=()=>{e.preventDefault(),this.base.togglePopup(l),this.applyState(l)};if(this.opened)if(a===h.Keys.pageUp)e.preventDefault(),this.base.scrollPopupByPageSize(-1);else if(a===h.Keys.pageDown)e.preventDefault(),this.base.scrollPopupByPageSize(1);else if((e.ctrlKey||e.metaKey)&&e.code==="KeyA"){const c=(this.state.value&&this.state.value.length)===s.length?[]:s;this.updateStateOnKeyboardNavigation(c,l)}else if((e.ctrlKey||e.metaKey)&&e.shiftKey&&e.keyCode===h.Keys.end){const d=s.slice(this.getFocusedState().focusedIndex);this.itemFocus(s.length-1,l),this.updateStateOnKeyboardNavigation(d,l)}else if((e.ctrlKey||e.metaKey)&&e.shiftKey&&e.keyCode===h.Keys.home){const d=s.slice(0,this.getFocusedState().focusedIndex+1);this.itemFocus(0,l),this.updateStateOnKeyboardNavigation(d,l)}else if(e.shiftKey&&e.keyCode===h.Keys.up){let d;const c=this.getLastSelectedOrDeselectedIndex(1,i);c===null?d=i!==0?s.slice(i-1,i):[s[i]]:c===i?d=[s[c-1]]:i>=0&&(d=c>i?s.slice(i-1,c):s.slice(c-1,i)),d&&d.length>0&&(i>=1&&this.itemFocus(i-1,l),this.updateStateOnKeyboardNavigation(d,l))}else if(e.shiftKey&&e.keyCode===h.Keys.down){let d;const c=this.getLastSelectedOrDeselectedIndex(0,i);c===null?d=i!==s.length-1?s.slice(i,i+1):[s[i]]:c===i?d=s.slice(i,i+2):i>=0&&(d=c>i?s.slice(i+1,c+1):s.slice(c,i+2)),d&&d.length>=1&&(this.itemFocus(i+1,l),this.updateStateOnKeyboardNavigation(d,l))}else if(e.altKey&&a===h.Keys.up)m();else if(a===h.Keys.up||a===h.Keys.down){if(o!==""&&t)if(!this.props.skipDisabledItems&&u)this.onNavigate(l,a);else{let d=0;if(a===h.Keys.down||a===h.Keys.right){const c=s.slice(i+1).find(y=>!y.disabled&&y[t]);d=c&&s.findIndex(y=>y[t]===c[t])}else if(a===h.Keys.up||a===h.Keys.left){let c;if(i===-1)c=s,d=s.findIndex(y=>!y.disabled&&y[t]);else{c=s.slice(0,i);let y=c.pop();for(;y&&y.disabled;)y=c.pop();d=y&&s.findIndex(x=>x[t]===y[t])}}if(d){const c=d-i;this.onNavigate(l,a,c)}else d!==void 0&&this.onNavigate(l,a)}else if(!this.props.skipDisabledItems&&u)this.onNavigate(l,a);else{let d=null;if(a===h.Keys.down||a===h.Keys.right)d=s.slice(i+1).find(c=>!c.disabled);else if(a===h.Keys.up||a===h.Keys.left){const c=s.slice(0,i);for(d=c.pop();d&&d.disabled;)d=c.pop()}if(d){const c=d.id-i-1;this.onNavigate(l,a,c)}else this.onNavigate(l,a)}this.applyState(l),e.preventDefault()}else a===h.Keys.enter?(e.preventDefault(),this.props.allowCustom&&p&&r===null?this.customItemSelect(e):r&&r.disabled?m():this.selectFocusedItem(e)):a===h.Keys.esc&&m();else e.altKey&&a===h.Keys.down?m():a===h.Keys.esc&&this.clearButtonClick(e)},this.listContainerContent=()=>{const{header:e,footer:t,allowCustom:o,size:s,groupStickyHeaderItemRender:a,groupField:p,list:u}=this.props,r=g.getFilteredData(this.props),i=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedType:l}=this.getFocusedState(),m=o&&i&&f.createElement("div",{className:h.classNames("k-list",{[`k-list-${w[s]||s}`]:s}),key:"customitem",onClick:this.customItemSelect,onMouseDown:E},f.createElement("div",{className:h.classNames("k-list-item k-custom-item",{"k-focus":_(l)}),style:{fontStyle:"italic"}},i,f.createElement(h.IconWrap,{name:"plus",icon:W.plusIcon,style:{position:"absolute",right:"0.5em"}})));let{group:d}=this.state;return d===void 0&&p!==void 0&&(d=g.getItemValue(r[0],p)),f.createElement(f.Fragment,null,e&&f.createElement("div",{className:"k-list-header"},e),m,f.createElement("div",{className:h.classNames("k-list",{[`k-list-${this.mobileMode?"lg":w[s]||s}`]:s,"k-virtual-list":this.base.vs.enabled})},!u&&d&&r.length!==0&&f.createElement(Y,{group:d,groupMode:"modern",render:a}),this.renderList()),t&&f.createElement("div",{className:"k-list-footer"},t))},this.renderListContainer=()=>{const e=this.base,{dir:t}=this.props,o=g.getFilteredData(this.props),s=this.base.getPopupSettings(),a=s.width!==void 0?s.width:e.popupWidth,p={dir:t!==void 0?t:e.dirCalculated,width:a,popupSettings:{...s,popupClass:h.classNames(s.popupClass,"k-list-container","k-multiselect-popup"),anchor:s.anchor||this.element,show:this.opened,onOpen:this.onPopupOpened,onClose:this.onPopupClosed},itemsCount:[o.length,this.value.length]};return f.createElement(G,{...p},this.listContainerContent())},this.renderAdaptiveListContainer=()=>{const{adaptiveTitle:e,filterable:t,filter:o}=this.props,{windowWidth:s=0}=this.state,a=o!==void 0?o:this.state.text;this.localization=se.provideLocalizationService(this);const p=t?f.createElement(ie,{value:a,ref:r=>this._adaptiveInput=r&&r.element,onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,size:this.props.size,rounded:this.props.rounded,fillMode:this.props.fillMode}):null,u={title:e,expand:this.opened,onClose:r=>this.onCancel(r),windowWidth:s,mobileFilter:p,footer:{cancelText:this.localization.toLanguageString(C.adaptiveModeFooterCancel,C.messages[C.adaptiveModeFooterCancel]),onCancel:this.onCancel,applyText:this.localization.toLanguageString(C.adaptiveModeFooterApply,C.messages[C.adaptiveModeFooterApply]),onApply:this.closePopup}};return f.createElement(ee.AdaptiveMode,{...u},f.createElement(te.ActionSheetContent,{overflowHidden:!0},f.createElement("div",{className:"k-list-container"},this.listContainerContent())))},this.closePopup=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t),t.events.push({type:"onClose"});const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this.applyState(t)},this.onCancel=e=>{const t=this.base.initState();t.syntheticEvent=e,e.stopPropagation(),this.state.focusedIndex!==void 0&&(t.data.focusedIndex=void 0),this.opened&&this.base.togglePopup(t),t.events.push({type:"onCancel"});const o=this.props.filter!==void 0?this.props.filter:this.state.text;g.isPresent(o)&&o!==""&&this.base.filterChanged("",t),this.state.text&&(t.data.text=""),this.applyState(t)},this.renderList=()=>{const{textField:e,listNoDataRender:t,itemRender:o,groupHeaderItemRender:s,dataItemKey:a,virtual:p={skip:0,total:void 0}}=this.props,u=g.getFilteredData(this.props),r=this.base.vs,{focusedIndex:i}=this.getFocusedState(),l=this.base.getPopupSettings(),m=`translateY(${r.translate}px)`;return f.createElement(U,{id:this.base.listBoxId,show:this.opened,data:u.slice(),focusedIndex:i-p.skip,value:this.value,textField:e,valueField:a,optionsGuid:this.base.guid,groupField:this.props.groupField,groupMode:"modern",listRef:d=>{r.list=this.base.list=d},wrapperStyle:this.mobileMode?{}:{maxHeight:l.height},wrapperCssClass:"k-list-content",listStyle:r.enabled?{transform:m}:void 0,key:"listKey",skip:p.skip,onClick:this.handleItemClick,itemRender:o,groupHeaderItemRender:s,noDataRender:t,onMouseDown:E,onBlur:this.handleBlur,onScroll:this.onScroll,wrapperRef:r.scrollerRef,scroller:this.base.renderScrollElement(),ariaSetSize:p.total})},this.onScroll=e=>{const{vs:t,list:o}=this.base;t.scrollHandler(e);const{groupField:s}=this.props;let a=g.getFilteredData(this.props);if(!(!s||!a.length)&&s){const p=this.itemHeight=this.itemHeight||(t.enabled?t.itemHeight:o?o.children[0].offsetHeight:0),r=e.target.scrollTop-t.skip*p;a=this.base.getGroupedDataModernMode(a,s);let i=a[0][s];for(let l=1;l<a.length&&!(p*l>r);l++)a[l]&&a[l][s]&&(i=a[l][s]);i!==this.state.group&&this.setState({group:i})}},this.customItemSelect=e=>{const t=this.props.filter!==void 0?this.props.filter:this.state.text,{textField:o}=this.props;if(!t)return;const s=this.base.initState();s.syntheticEvent=e;const a=o?{[o]:t}:t;this.state.text!==void 0&&(s.data.text=""),s.data.focusedIndex=void 0,this.base.filterChanged("",s);const p=[...this.value,a];this.triggerOnChange(p,s),this.base.togglePopup(s),this.applyState(s)},this.handleWrapperClick=e=>{const t=this._input;!this.opened&&t&&this.focusElement(t);const o=this.base.initState();o.syntheticEvent=e,!this.state.focused&&!this.mobileMode&&(o.events.push({type:"onFocus"}),o.data.focused=!0),this.mobileMode&&(this.setState({currentValue:this.tagsToRender}),this.mobileMode&&window.setTimeout(()=>this._adaptiveInput&&this._adaptiveInput.focus(),300)),this.base.togglePopup(o),this.applyState(o)},this.handleItemClick=(e,t)=>{const o=this.base.initState();o.syntheticEvent=t,this.handleItemSelect(e,o),this.props.autoClose&&!this.mobileMode&&this.base.togglePopup(o),t.stopPropagation(),this.applyState(o)},this.handleBlur=e=>{if(!this.state.focused||this._skipFocusEvent)return;const t=this.base.initState(),{allowCustom:o,filterable:s}=this.props;t.syntheticEvent=e,t.data.focused=!1,t.events.push({type:"onBlur"}),this.opened&&!this.mobileMode&&(this.state.opened&&(t.data.opened=!1),t.events.push({type:"onClose"})),!o&&!s&&this.state.text&&(t.data.text=""),this.applyState(t)},this.handleFocus=e=>{this._skipFocusEvent||this.base.handleFocus(e)},this.onPopupOpened=()=>{this._input&&this.state.focused&&!this.mobileMode&&this.focusElement(this._input)},this.onPopupClosed=()=>{this.state.focused&&window.setTimeout(()=>{this.state.focused&&this.focusElement(this._input)},0)},this.setValidity=()=>{this._input&&this._input.setCustomValidity&&this._input.setCustomValidity(this.validity.valid?"":this.props.validationMessage||ne)},h.validatePackage(X.packageMetadata)}get _inputId(){return this.props.id}get document(){if(h.canUseDOM)return this.element&&this.element.ownerDocument||document}get element(){return this._element}get opened(){return!!(this.props.opened!==void 0?this.props.opened:this.state.opened)}get tagsToRender(){const{tags:n,textField:e}=this.props,t=[];return n===void 0?this.value.forEach(o=>{t.push({text:g.getItemValue(o,e),data:[o]})}):t.push(...n),t}get mobileMode(){var e;return!!(this.state.windowWidth&&this.props._adaptiveMode&&this.state.windowWidth<=((e=this.props._adaptiveMode)==null?void 0:e.medium)&&this.props.adaptive)}get value(){const n=[];return this._valueItemsDuringOnChange?n.push(...this._valueItemsDuringOnChange):this.props.value?n.push(...this.props.value):this.state.value?n.push(...this.state.value):this.props.defaultValue&&n.push(...this.props.defaultValue),n}get name(){return this.props.name}get validity(){const n=this.props.validationMessage!==void 0,e=!this.required||this.value!==null&&this.value.length>0&&this.value!==void 0,t=this.props.valid!==void 0?this.props.valid:e;return{customError:n,valid:t,valueMissing:this.value===null}}get required(){return this.props.required!==void 0?this.props.required:b.defaultProps.required}get validityStyles(){return this.props.validityStyles!==void 0?this.props.validityStyles:b.defaultProps.validityStyles}componentDidUpdate(n,e){var m;const{virtual:t,groupField:o=""}=this.props,s=g.getFilteredData(this.props),a=t?t.skip:0,p=n.virtual?n.virtual.total:0,u=n.opened!==void 0?n.opened:e.opened,r=!u&&this.opened,i=u&&!this.opened,l=this.base.getPopupSettings();if(this.base.didUpdate(),!l.animate&&i&&this.onPopupClosed(),t&&t.total!==p)this.base.vs.calcScrollElementHeight(),this.base.vs.reset();else{let{focusedItem:d,focusedIndex:c}=this.getFocusedState();o!==""&&(c=(m=this.base.getGroupedDataModernMode(s,o))==null?void 0:m.indexOf(d)),r&&t?this.base.scrollToVirtualItem(t,c-a):r&&!t?(s&&s.length!==0&&this.base.resetGroupStickyHeader(s[0][o],this),this.base.scrollToItem(c)):this.opened&&u&&d&&this.scrollToFocused&&this.base.scrollToItem(c-a)}this.scrollToFocused=!1,this.setValidity()}componentDidMount(){var n;this.observerResize=h.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(this.calculateMedia.bind(this)),this.base.didMount(),this.setValidity(),(n=this.document)!=null&&n.body&&this.observerResize&&this.observerResize.observe(this.document.body)}componentWillUnmount(){var n;(n=this.document)!=null&&n.body&&this.observerResize&&this.observerResize.disconnect()}onNavigate(n,e,t){const{allowCustom:o}=this.props,s=g.getFilteredData(this.props),a=this.props.filter!==void 0?this.props.filter:this.state.text,{focusedType:p,focusedIndex:u}=this.getFocusedState(),r=o&&a,i=_(p),l=this.base,m=l.vs;if(this.opened&&e===h.Keys.up&&i)this.state.focusedIndex!==void 0&&(n.data.focusedIndex=void 0);else{const d=l.navigation.navigate({keyCode:e,current:u,max:(m.enabled?m.total:s.length)-1,min:r?-1:0,skipItems:t||void 0});d!==void 0&&(this.itemFocus(d,n),this.scrollToFocused=!0)}this.applyState(n)}render(){const{style:n,className:e,label:t,dir:o,disabled:s,textField:a,dataItemKey:p,virtual:u,size:r,rounded:i,fillMode:l,loading:m,filter:d}=this.props,{text:c,focused:y,focusedTag:x,currentValue:q}=this.state,k=this.base.vs,T=this.props.id||this._inputId;k.enabled=u!==void 0,u!==void 0&&(k.skip=u.skip,k.total=u.total,k.pageSize=u.pageSize);const S=this.mobileMode&&this.opened?q:this.tagsToRender;this.setItems(this.tagsToRender,this._tags);const M=!this.validityStyles||this.validity.valid,L=!!(d!==void 0?d:c)||S&&S.length>0,[z,B]=P(this.props.prefix||f.Fragment),[V,A]=P(this.props.suffix||f.Fragment),O=f.createElement(f.Fragment,null,f.createElement("div",{ref:this.componentRef,className:h.classNames("k-multiselect k-input",e,{[`k-input-${w[r]||r}`]:r,[`k-rounded-${ae[i]||i}`]:i,[`k-input-${l}`]:l,"k-focus":y&&!s,"k-invalid":!M,"k-disabled":s,"k-loading":m,"k-required":this.required}),style:t?{...n,width:void 0}:n,dir:o,onFocus:this.handleFocus,onBlur:this.handleBlur,onClick:this.handleWrapperClick,onMouseDown:g.preventDefaultNonInputs},this.props.prefix&&f.createElement(z,{...B}),f.createElement("div",{className:h.classNames("k-input-values")},f.createElement("div",{className:h.classNames("k-chip-list",{[`k-chip-list-${w[r]||r}`]:r}),role:"listbox",id:"tagslist-"+this.base.guid},S&&S.length>0&&f.createElement(J,{tagRender:this.props.tagRender,onTagDelete:this.onTagDelete,data:S,guid:this.base.guid,focused:x?S.find(H=>g.matchTags(H,x,p)):void 0,size:r})),this.renderSearchBar(T)),m&&f.createElement(h.IconWrap,{className:"k-input-loading-icon",name:"loading"}),this.props.suffix&&f.createElement(V,{...A}),L&&f.createElement(Z,{onClick:this.clearButtonClick}),!this.mobileMode&&this.renderListContainer()),this.mobileMode&&this.renderAdaptiveListContainer());return t?f.createElement(j.FloatingLabel,{label:t,editorId:T,editorValue:c||g.getItemValue(this.value[0],a),editorValid:M,editorDisabled:s,style:{width:n?n.width:void 0},children:O}):O}renderSearchBar(n){const{activedescendant:e,focusedTag:t,currentValue:o}=this.state,{disabled:s,placeholder:a,ariaDescribedBy:p,ariaLabelledBy:u,ariaLabel:r,inputAttributes:i}=this.props,l=!this.mobileMode&&(this.props.filter!==void 0?this.props.filter:this.state.text)||"",{focusedIndex:m}=this.getFocusedState(),d=this.value.length===0&&!l?a:void 0,c=o&&o.length>0?void 0:a,y=e===D.ActiveDescendant.TagsList&&t!==void 0?`tag-${this.base.guid}-${t.text.replace(/\s+/g,"-")}`:`option-${this.base.guid}-${m}`,x={accessKey:this.props.accessKey,tabIndex:this.props.tabIndex};return f.createElement(Q,{id:n,size:Math.max((d||"").length,l.length,1),placeholder:this.mobileMode&&this.opened?c:d,value:l,onChange:this.onChangeHandler,onKeyDown:this.onInputKeyDown,ref:this.searchbarRef,disabled:s,expanded:this.opened,owns:this.base.listBoxId,role:"combobox",activedescendant:y,ariaDescribedBy:`tagslist-${this.base.guid}${p?" "+p:""}`,ariaLabelledBy:u,ariaRequired:this.required,ariaLabel:r,inputAttributes:i,...x})}onTagsNavigate(n,e){const t=n.keyCode,{focusedTag:o}=this.state,s=this._tags,a=this.props.dataItemKey;let p=o?s.findIndex(i=>g.matchTags(i,o,a)):-1,u;const r=p!==-1;if(t===h.Keys.left)r?p=Math.max(0,p-1):p=s.length-1,u=s[p];else if(t===h.Keys.right)p===s.length-1?u=void 0:r&&(p=Math.min(s.length-1,p+1),u=s[p]);else if(t===h.Keys.home&&!n.shiftKey)u=s[0];else if(t===h.Keys.end&&!n.shiftKey)u=s[s.length-1];else if(t===h.Keys.delete){if(r){const i=this.value;g.removeDataItems(i,s[p].data,a),this.triggerOnChange(i,e)}}else if(t===h.Keys.backspace){const i=this.value;if(r)g.removeDataItems(i,s[p].data,a),this.triggerOnChange(i,e);else if(!r&&s.length){const l=s.pop();g.removeDataItems(i,l.data,a),this.triggerOnChange(i,e)}}u!==o&&(e.data.focusedTag=u,e.data.activedescendant=D.ActiveDescendant.TagsList),this.applyState(e)}triggerOnChange(n,e){this.props.value===void 0&&(e.data.value=[...n]),this._valueItemsDuringOnChange=[],this.setItems(n,this._valueItemsDuringOnChange),e.events.push({type:"onChange"})}selectFocusedItem(n,e){const{virtual:t}=this.props,o=g.getFilteredData(this.props),{focusedIndex:s}=e||this.getFocusedState(),a=t?t.skip:0;o[s-a]!==void 0&&this.handleItemClick(s,n)}setItems(n,e){e.length=0,e.push(...n)}getFocusedState(){const{focusedIndex:n}=this.state,e=this.props.filter!==void 0?this.props.filter:this.state.text,{allowCustom:t,dataItemKey:o,virtual:s,textField:a,focusedItemIndex:p=g.itemIndexStartsWith,skipDisabledItems:u}=this.props,r=g.getFilteredData(this.props),i=s&&s.skip||0;let l;if(n!==void 0)return{focusedIndex:n,focusedItem:r[n-i],focusedType:1};const m=this.value;if(t&&e)return{focusedItem:null,focusedIndex:-1,focusedType:2};if(e)return l=p(r,e,a),{focusedItem:r[l],focusedIndex:l+i,focusedType:1};if(m.length){const d=m[m.length-1];return l=r.findIndex(c=>g.areSame(c,d,o)),r[l]!==void 0?{focusedIndex:l+i,focusedItem:r[l],focusedType:1}:{focusedType:0,focusedIndex:-1}}else if(u&&a&&!e&&i===0){const d=r.findIndex(c=>!c.disabled&&c[a]);return{focusedIndex:d,focusedItem:r[d-i],focusedType:1}}return i===0?{focusedItem:r[0],focusedIndex:0,focusedType:1}:{focusedType:0,focusedIndex:-1}}focusElement(n){this._skipFocusEvent=!0,n.focus(),window.setTimeout(()=>this._skipFocusEvent=!1,0)}applyState(n){this.base.applyState(n),this._valueItemsDuringOnChange=null}calculateMedia(n){for(const e of n)this.setState({windowWidth:e.target.clientWidth})}updateStateOnKeyboardNavigation(n,e){this.setState({value:n}),this.triggerOnChange(n,e),this.applyState(e)}getLastSelectedOrDeselectedIndex(n,e){return this._lastSelectedOrDeslectedItemIndex===null&&(this._lastSelectedOrDeslectedItemIndex=e),this._lastSelectedOrDeslectedItemIndex!==null?this._lastSelectedOrDeslectedItemIndex+n:null}};b.displayName="MultiSelect",b.propTypes={...K.propTypes,autoClose:v.bool,value:v.arrayOf(v.any),defaultValue:v.arrayOf(v.any),dataItemKey:v.string,placeholder:v.string,tags:v.arrayOf(v.shape({text:v.string,data:v.arrayOf(v.any)})),tagRender:v.func,id:v.string,ariaLabelledBy:v.string,ariaDescribedBy:v.string,groupField:v.string,list:v.any,adaptive:v.bool,adaptiveTitle:v.string,onCancel:v.func,skipDisabledItems:v.bool,inputAttributes:v.object},b.defaultProps={...K.defaultProps,autoClose:!0,required:!1,size:"medium",rounded:"medium",fillMode:"solid",groupMode:"modern",skipDisabledItems:!0,prefix:void 0,suffix:void 0};let F=b;const N=h.createPropsContext(),R=h.withIdHOC(h.withPropsContext(N,h.withAdaptiveModeContext(F)));R.displayName="KendoReactMultiSelect";exports.MultiSelect=R;exports.MultiSelectPropsContext=N;exports.MultiSelectWithoutContext=F;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as f from "react";
|
|
10
9
|
import m from "prop-types";
|
|
11
10
|
import { Keys as u, classNames as b, IconWrap as R, validatePackage as X, canUseDOM as L, createPropsContext as Z, withIdHOC as tt, withPropsContext as et, withAdaptiveModeContext as st, kendoThemeMaps as it } from "@progress/kendo-react-common";
|
package/MultiSelect/TagList.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use
|
|
8
|
+
"use strict";const f=require("react"),m=require("@progress/kendo-react-buttons");function g(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return o.default=e,Object.freeze(o)}const s=g(f),v=e=>e.syntheticEvent.preventDefault(),h=e=>e.syntheticEvent.stopPropagation();class y extends s.Component{render(){const{data:o,guid:n,focused:r,tagRender:c,tag:i,onTagDelete:l,size:p}=this.props;return s.createElement(s.Fragment,null,o.map((t,a)=>{const u=i?s.createElement(i,{key:t.text+a,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+a,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,u):u}),this.props.children)}}module.exports=y;
|
package/MultiSelect/TagList.mjs
CHANGED
|
@@ -5,37 +5,36 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as t from "react";
|
|
10
|
-
import { Chip as
|
|
9
|
+
import { Chip as u } from "@progress/kendo-react-buttons";
|
|
11
10
|
const v = (o) => o.syntheticEvent.preventDefault(), f = (o) => o.syntheticEvent.stopPropagation();
|
|
12
11
|
class g extends t.Component {
|
|
13
12
|
render() {
|
|
14
|
-
const { data: n, guid:
|
|
13
|
+
const { data: n, guid: r, focused: s, tagRender: c, tag: i, onTagDelete: l, size: m } = this.props;
|
|
15
14
|
return /* @__PURE__ */ t.createElement(t.Fragment, null, n.map((e, p) => {
|
|
16
15
|
const a = i ? /* @__PURE__ */ t.createElement(
|
|
17
16
|
i,
|
|
18
17
|
{
|
|
19
18
|
key: e.text + p,
|
|
20
19
|
tagData: e,
|
|
21
|
-
guid:
|
|
22
|
-
focusedTag:
|
|
20
|
+
guid: r,
|
|
21
|
+
focusedTag: s,
|
|
23
22
|
onTagDelete: l
|
|
24
23
|
}
|
|
25
24
|
) : /* @__PURE__ */ t.createElement(
|
|
26
|
-
|
|
25
|
+
u,
|
|
27
26
|
{
|
|
28
|
-
id: `tag-${
|
|
27
|
+
id: `tag-${r}-${e.text.replace(/\s+/g, "-")}`,
|
|
29
28
|
"aria-selected": !0,
|
|
30
29
|
role: "option",
|
|
31
30
|
"aria-setsize": n.length,
|
|
32
31
|
key: e.text + p,
|
|
33
32
|
text: e.text,
|
|
34
33
|
removable: !0,
|
|
35
|
-
onRemove: (
|
|
34
|
+
onRemove: (d) => l.call(void 0, e.data, d.syntheticEvent),
|
|
36
35
|
onMouseDown: v,
|
|
37
36
|
onClick: f,
|
|
38
|
-
className: e ===
|
|
37
|
+
className: e === s ? "k-focus" : void 0,
|
|
39
38
|
size: m
|
|
40
39
|
}
|
|
41
40
|
);
|
|
@@ -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 et=require("react"),a=require("prop-types"),o=require("@progress/kendo-react-common"),tt=require("@progress/kendo-react-popup"),nt=require("@progress/kendo-react-intl"),Ie=require("@progress/kendo-react-treeview"),at=require("../package-metadata.js"),ee=require("../common/utils.js"),rt=require("../DropDownTree/useDropdownWidth.js"),ot=require("../DropDownTree/ListNoData.js"),v=require("../messages/index.js"),it=require("@progress/kendo-react-labels"),st=require("../MultiSelect/TagList.js"),lt=require("../common/ClearButton.js"),Te=require("../common/ListFilter.js"),ct=require("../common/AdaptiveMode.js"),ut=require("@progress/kendo-react-layout");function dt(h){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const n in h)if(n!=="default"){const I=Object.getOwnPropertyDescriptor(h,n);Object.defineProperty(b,n,I.get?I:{enumerable:!0,get:()=>h[n]})}}return b.default=h,Object.freeze(b)}const t=dt(et),pt="Please select a value from the list!",{sizeMap:Ke,roundedMap:ft}=o.kendoThemeMaps,gt=h=>h.split("_").map(b=>parseInt(b,10)),mt=(h,b)=>{const{validationMessage:n,valid:I,required:T}=h;return{customError:n!==void 0,valid:!!(I!==void 0?I:!T||b),valueMissing:!b}},E={checkField:"checkField",checkIndeterminateField:"checkIndeterminateField",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},size:"medium",rounded:"medium",fillMode:"solid",required:!1,validityStyles:!0},Me=o.createPropsContext(),ce=t.forwardRef((h,b)=>{const n=o.usePropsContext(Me,h);o.validatePackage(at.packageMetadata);const I=o.useId(),T=n.id||I,{data:B=[],dataItemKey:K,style:L={},placeholder:ue,label:A,name:Re,validationMessage:W,valid:De,tags:de,value:g,opened:M,disabled:x,popupSettings:N=E.popupSettings,checkField:pe=E.checkField,checkIndeterminateField:fe=E.checkIndeterminateField,subItemsField:ge=E.subItemsField,size:y=E.size,rounded:V=E.rounded,fillMode:z=E.fillMode,required:me=E.required,validityStyles:qe=E.validityStyles,onOpen:te=o.noop,onClose:j=o.noop}=n,_=o.getTabIndex(n.tabIndex,x),s=t.useRef(null),F=t.useRef(null),R=t.useRef(null),ne=t.useRef(null),H=t.useRef(null),S=t.useRef(null),$=t.useRef(!1),G=t.useRef([]),U=t.useRef(null),[P,Ne]=t.useState(),[Pe,ve]=t.useState(!1),[d,ae]=t.useState(!1),[re,Oe]=t.useState(),[Le,Ae]=t.useState([]),[he,Ve]=t.useState(""),l=M!==void 0?M:Pe,oe=!!(Array.isArray(g)&&g.length),ie=mt({validationMessage:W,valid:De,required:me},oe),D=o.useRtl(F,n.dir),Be={width:rt.useDropdownWidth(F,E,N,L),...D!==void 0?{direction:D}:{}},We=t.useCallback(()=>F.current&&F.current.focus(),[]),ye=o.useAdaptiveModeContext(),O=!!(re&&ye&&re<=ye.medium&&n.adaptive);G.current=de===void 0?(g||[]).map(e=>({text:ee.getItemValue(e,n.textField),data:[e]})):[...de],t.useImperativeHandle(s,()=>({props:n,element:F.current,focus:We})),t.useImperativeHandle(b,()=>s.current);const ze=t.useCallback(()=>{H.current&&H.current.setCustomValidity&&H.current.setCustomValidity(ie.valid?"":W===void 0?pt:W)},[W,ie]);t.useEffect(ze),t.useEffect(()=>{const e=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Ye.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{e&&e.disconnect()}},[]),t.useEffect(()=>{U.current&&l&&U.current.setPosition(U.current.element)},[g,l]);const w=t.useCallback((e,r,i)=>{if(n.onChange){const k={items:r,operation:i,...e};n.onChange.call(void 0,k)}},[n.onChange]),J=t.useCallback(e=>{if(ee.areSame(e.item,g,K)||!s.current)return;const{item:r,nativeEvent:i,syntheticEvent:k}=e,q={syntheticEvent:k,nativeEvent:i,target:s.current};w(q,[r],"toggle")},[g,K,w]),Q=t.useCallback(e=>{if(!l){if(te){const r={...e};te.call(void 0,r)}M===void 0&&(ve(!0),Ae(g||[]),O&&setTimeout(()=>{var r;u((r=ne.current)==null?void 0:r.element)},300))}},[l,M,te,O,ne]),m=t.useCallback(e=>{if(l){if(j){const r={...e};j.call(void 0,r)}M===void 0&&ve(!1)}},[l,M,j]),C=t.useCallback(e=>{$.current=!0,e(),window.setTimeout(()=>$.current=!1,0)},[]),u=t.useCallback(e=>{e&&C(()=>e.focus())},[C]),je=t.useCallback(()=>{var e;!d&&l?m({target:s.current}):n.filterable?u((e=R.current)==null?void 0:e.element):u(S.current&&S.current.element)},[d,l,u,m,n.filterable]),_e=t.useCallback(()=>{d&&u(F.current)},[d,u]),He=t.useCallback(e=>{if(!d&&!$.current&&(ae(!0),n.onFocus&&s.current)){const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};n.onFocus.call(void 0,r)}},[d,n.onFocus]),$e=t.useCallback(e=>{if(d&&!$.current&&s.current){ae(!1);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};if(n.onBlur){const i={...r};n.onBlur.call(void 0,i)}O||m(r)}},[d,n.onBlur,l,M,j]),Ge=t.useCallback(()=>{d&&C(o.noop)},[d,C]),Ue=t.useCallback(e=>{if(!e.isDefaultPrevented()&&s.current){ae(!0);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};l||Q(r)}},[l,Q]),Je=t.useCallback(e=>{var Z,we;const{keyCode:r,altKey:i}=e,k=S.current&&S.current.element;if(!s.current||e.isDefaultPrevented()&&((Z=R.current)==null?void 0:Z.element)===e.target)return;const q={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};if(g&&g.length>0&&(r===o.Keys.left||r===o.Keys.right||r===o.Keys.home||r===o.Keys.end||r===o.Keys.delete)){const c=G.current;let p=P?c.findIndex(Ze=>ee.matchTags(Ze,P,K)):-1,f;const le=p!==-1;r===o.Keys.left?(le?p=Math.max(0,p-1):p=c.length-1,f=c[p]):r===o.Keys.right?p===c.length-1?f=void 0:le&&(p=Math.min(c.length-1,p+1),f=c[p]):r===o.Keys.home?f=c[0]:r===o.Keys.end?f=c[c.length-1]:r===o.Keys.delete&&le&&w(q,c[p].data,"delete"),f!==P&&Ne(f)}if(l)if(r===o.Keys.esc||i&&r===o.Keys.up)e.preventDefault(),m(q);else if(k&&k.querySelector(".k-focus")&&(r===o.Keys.up||r===o.Keys.down||r===o.Keys.left||r===o.Keys.right||r===o.Keys.home||r===o.Keys.end)){if(r===o.Keys.up&&((we=R.current)!=null&&we.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(o.noop)}else r===o.Keys.down&&C(()=>{var c;u(((c=R.current)==null?void 0:c.element)||k)});else i&&r===o.Keys.down&&(e.preventDefault(),Q(q))},[l,m,u,C,Q,P,K,g,w]),be=t.useCallback(e=>{const{keyCode:r,altKey:i}=e;i||r!==o.Keys.up&&r!==o.Keys.down||(e.preventDefault(),C(r===o.Keys.up?()=>{u(F.current)}:()=>{u(S.current&&S.current.element)}))},[u,C]),se=t.useCallback(e=>{if(!s.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};w(r,[],"clear"),m(r),e.preventDefault()},[w,m]),Qe=t.useCallback((e,r)=>{var i;m({target:s.current}),d||u((i=R.current)==null?void 0:i.element),w({syntheticEvent:r,nativeEvent:r.nativeEvent,target:s.current},e,"delete")},[w,m,u,d]),Ce=t.useCallback(e=>{if(n.onExpandChange&&s.current){const{item:r,itemHierarchicalIndex:i,nativeEvent:k,syntheticEvent:q}=e,Z={level:gt(i),item:r,nativeEvent:k,syntheticEvent:q,target:s.current};n.onExpandChange.call(void 0,Z)}},[n.onExpandChange]),ke=t.useCallback(e=>{if(n.onFilterChange&&s.current){const i={filter:{field:n.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:s.current};n.onFilterChange.call(void 0,i),n.filter===void 0&&Ve(e.target.value)}},[n.onFilterChange,n.filter,n.textField]),Ee=t.useCallback(e=>{if(!s.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};n.onCancel&&n.onCancel.call(void 0,r),m(r),e.preventDefault()},[n.onCancel,m]),Xe=()=>{const e=n.filterable?t.createElement(Te,{value:n.filter===void 0?he:n.filter,ref:ne,onChange:ke,onKeyDown:be,size:y,rounded:V,fillMode:z}):null,r={title:n.adaptiveTitle,expand:l,onClose:i=>n.onCancel?Ee(i):se(i),windowWidth:re,mobileFilter:e,footer:{cancelText:X.toLanguageString(v.adaptiveModeFooterCancel,v.messages[v.adaptiveModeFooterCancel]),onCancel:i=>n.onCancel?Ee(i):se(i),applyText:X.toLanguageString(v.adaptiveModeFooterApply,v.messages[v.adaptiveModeFooterApply]),onApply:i=>m(i)}};return t.createElement(ct.AdaptiveMode,{...r},t.createElement(ut.ActionSheetContent,{overflowHidden:!0},t.createElement("div",{className:"k-list-container"},t.createElement("div",{className:"k-list k-list-lg"},B.length>0?t.createElement(Ie.TreeView,{ref:S,tabIndex:_,data:B,focusIdField:K,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:Ce,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Fe,null,X.toLanguageString(v.nodata,v.messages[v.nodata]))))))},Ye=t.useCallback(e=>{for(const r of e)Oe(r.target.clientWidth)},[]),Fe=n.listNoData||ot.ListNoData,X=nt.useLocalization(),xe=!qe||ie.valid,Y=O&&l?Le:G.current,Se=t.createElement(t.Fragment,null,t.createElement("span",{className:o.classNames("k-multiselecttree k-input",n.className,{[`k-input-${Ke[y]||y}`]:y,[`k-rounded-${ft[V]||V}`]:V,[`k-input-${z}`]:z,"k-focus":d&&!x,"k-invalid":!xe,"k-disabled":x,"k-loading":n.loading,"k-required":me}),tabIndex:_,accessKey:n.accessKey,id:T,style:A?{...L,width:void 0}:L,dir:D,ref:F,onKeyDown:x?void 0:Je,onMouseDown:Ge,onFocus:He,onBlur:$e,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":x,"aria-label":A,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy?n.ariaDescribedBy:"tagslist-"+T,"aria-required":n.required,onClick:x?void 0:Ue},t.createElement("div",{id:"tagslist-"+T,className:o.classNames("k-input-values k-chip-list",{[`k-chip-list-${Ke[y]||y}`]:y})},Y.length>0&&t.createElement(st,{tag:n.tag,onTagDelete:Qe,data:Y,guid:T,focused:P?G.current.find(e=>ee.matchTags(e,P,K)):void 0,size:y})),t.createElement("span",{className:"k-input-inner"},Y.length===0&&t.createElement("span",{className:"k-input-value-text"},ue)),n.loading&&t.createElement(o.IconWrap,{className:"k-input-loading-icon",name:"loading"}),oe&&!x&&Y.length>0&&t.createElement(lt,{onClick:se}),t.createElement("select",{name:Re,ref:H,tabIndex:-1,"aria-hidden":!0,title:A,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,g):g})),!O&&t.createElement(tt.Popup,{...N,popupClass:o.classNames(N.popupClass,"k-multiselecttree-popup"),className:o.classNames(N.className,{"k-rtl":D==="rtl"}),style:Be,anchor:N.anchor||F.current,show:l,onOpen:je,onClose:_e,ref:U},n.filterable&&t.createElement(Te,{value:n.filter===void 0?he:n.filter,ref:R,onChange:ke,onKeyDown:be,tabIndex:_,size:y,rounded:V,fillMode:z,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),B.length>0?t.createElement(Ie.TreeView,{style:{height:N.height},ref:S,tabIndex:_,data:B,focusIdField:K,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:Ce,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Fe,null,X.toLanguageString(v.nodata,v.messages[v.nodata])))),O&&Xe());return A?t.createElement(it.FloatingLabel,{label:A,editorValue:oe,editorPlaceholder:ue,editorValid:xe,editorDisabled:x,editorId:T,style:{width:L?L.width:void 0},children:Se,dir:D}):Se}),vt={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};ce.displayName="KendoReactMultiSelectTree";ce.propTypes=vt;exports.MultiSelectTree=ce;exports.MultiSelectTreePropsContext=Me;
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const et=require("react"),a=require("prop-types"),o=require("@progress/kendo-react-common"),tt=require("@progress/kendo-react-popup"),nt=require("@progress/kendo-react-intl"),Ie=require("@progress/kendo-react-treeview"),at=require("../package-metadata.js"),ee=require("../common/utils.js"),rt=require("../DropDownTree/useDropdownWidth.js"),ot=require("../DropDownTree/ListNoData.js"),v=require("../messages/index.js"),it=require("@progress/kendo-react-labels"),st=require("../MultiSelect/TagList.js"),lt=require("../common/ClearButton.js"),Te=require("../common/ListFilter.js"),ct=require("../common/AdaptiveMode.js"),ut=require("@progress/kendo-react-layout");function dt(h){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const n in h)if(n!=="default"){const I=Object.getOwnPropertyDescriptor(h,n);Object.defineProperty(b,n,I.get?I:{enumerable:!0,get:()=>h[n]})}}return b.default=h,Object.freeze(b)}const t=dt(et),pt="Please select a value from the list!",{sizeMap:Ke,roundedMap:ft}=o.kendoThemeMaps,gt=h=>h.split("_").map(b=>parseInt(b,10)),mt=(h,b)=>{const{validationMessage:n,valid:I,required:T}=h;return{customError:n!==void 0,valid:!!(I!==void 0?I:!T||b),valueMissing:!b}},E={checkField:"checkField",checkIndeterminateField:"checkIndeterminateField",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},size:"medium",rounded:"medium",fillMode:"solid",required:!1,validityStyles:!0},Me=o.createPropsContext(),ce=t.forwardRef((h,b)=>{const n=o.usePropsContext(Me,h);o.validatePackage(at.packageMetadata);const I=o.useId(),T=n.id||I,{data:B=[],dataItemKey:K,style:L={},placeholder:ue,label:A,name:Re,validationMessage:W,valid:De,tags:de,value:g,opened:M,disabled:x,popupSettings:N=E.popupSettings,checkField:pe=E.checkField,checkIndeterminateField:fe=E.checkIndeterminateField,subItemsField:ge=E.subItemsField,size:y=E.size,rounded:V=E.rounded,fillMode:z=E.fillMode,required:me=E.required,validityStyles:qe=E.validityStyles,onOpen:te=o.noop,onClose:j=o.noop}=n,_=o.getTabIndex(n.tabIndex,x),s=t.useRef(null),F=t.useRef(null),R=t.useRef(null),ne=t.useRef(null),H=t.useRef(null),S=t.useRef(null),$=t.useRef(!1),G=t.useRef([]),U=t.useRef(null),[P,Ne]=t.useState(),[Pe,ve]=t.useState(!1),[d,ae]=t.useState(!1),[re,Oe]=t.useState(),[Le,Ae]=t.useState([]),[he,Ve]=t.useState(""),l=M!==void 0?M:Pe,oe=!!(Array.isArray(g)&&g.length),ie=mt({validationMessage:W,valid:De,required:me},oe),D=o.useRtl(F,n.dir),Be={width:rt.useDropdownWidth(F,E,N,L),...D!==void 0?{direction:D}:{}},We=t.useCallback(()=>F.current&&F.current.focus(),[]),ye=o.useAdaptiveModeContext(),O=!!(re&&ye&&re<=ye.medium&&n.adaptive);G.current=de===void 0?(g||[]).map(e=>({text:ee.getItemValue(e,n.textField),data:[e]})):[...de],t.useImperativeHandle(s,()=>({props:n,element:F.current,focus:We})),t.useImperativeHandle(b,()=>s.current);const ze=t.useCallback(()=>{H.current&&H.current.setCustomValidity&&H.current.setCustomValidity(ie.valid?"":W===void 0?pt:W)},[W,ie]);t.useEffect(ze),t.useEffect(()=>{const e=o.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Ye.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{e&&e.disconnect()}},[]),t.useEffect(()=>{U.current&&l&&U.current.setPosition(U.current.element)},[g,l]);const w=t.useCallback((e,r,i)=>{if(n.onChange){const k={items:r,operation:i,...e};n.onChange.call(void 0,k)}},[n.onChange]),J=t.useCallback(e=>{if(ee.areSame(e.item,g,K)||!s.current)return;const{item:r,nativeEvent:i,syntheticEvent:k}=e,q={syntheticEvent:k,nativeEvent:i,target:s.current};w(q,[r],"toggle")},[g,K,w]),Q=t.useCallback(e=>{if(!l){if(te){const r={...e};te.call(void 0,r)}M===void 0&&(ve(!0),Ae(g||[]),O&&setTimeout(()=>{var r;u((r=ne.current)==null?void 0:r.element)},300))}},[l,M,te,O,ne]),m=t.useCallback(e=>{if(l){if(j){const r={...e};j.call(void 0,r)}M===void 0&&ve(!1)}},[l,M,j]),C=t.useCallback(e=>{$.current=!0,e(),window.setTimeout(()=>$.current=!1,0)},[]),u=t.useCallback(e=>{e&&C(()=>e.focus())},[C]),je=t.useCallback(()=>{var e;!d&&l?m({target:s.current}):n.filterable?u((e=R.current)==null?void 0:e.element):u(S.current&&S.current.element)},[d,l,u,m,n.filterable]),_e=t.useCallback(()=>{d&&u(F.current)},[d,u]),He=t.useCallback(e=>{if(!d&&!$.current&&(ae(!0),n.onFocus&&s.current)){const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};n.onFocus.call(void 0,r)}},[d,n.onFocus]),$e=t.useCallback(e=>{if(d&&!$.current&&s.current){ae(!1);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};if(n.onBlur){const i={...r};n.onBlur.call(void 0,i)}O||m(r)}},[d,n.onBlur,l,M,j]),Ge=t.useCallback(()=>{d&&C(o.noop)},[d,C]),Ue=t.useCallback(e=>{if(!e.isDefaultPrevented()&&s.current){ae(!0);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};l||Q(r)}},[l,Q]),Je=t.useCallback(e=>{var Z,we;const{keyCode:r,altKey:i}=e,k=S.current&&S.current.element;if(!s.current||e.isDefaultPrevented()&&((Z=R.current)==null?void 0:Z.element)===e.target)return;const q={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};if(g&&g.length>0&&(r===o.Keys.left||r===o.Keys.right||r===o.Keys.home||r===o.Keys.end||r===o.Keys.delete)){const c=G.current;let p=P?c.findIndex(Ze=>ee.matchTags(Ze,P,K)):-1,f;const le=p!==-1;r===o.Keys.left?(le?p=Math.max(0,p-1):p=c.length-1,f=c[p]):r===o.Keys.right?p===c.length-1?f=void 0:le&&(p=Math.min(c.length-1,p+1),f=c[p]):r===o.Keys.home?f=c[0]:r===o.Keys.end?f=c[c.length-1]:r===o.Keys.delete&&le&&w(q,c[p].data,"delete"),f!==P&&Ne(f)}if(l)if(r===o.Keys.esc||i&&r===o.Keys.up)e.preventDefault(),m(q);else if(k&&k.querySelector(".k-focus")&&(r===o.Keys.up||r===o.Keys.down||r===o.Keys.left||r===o.Keys.right||r===o.Keys.home||r===o.Keys.end)){if(r===o.Keys.up&&((we=R.current)!=null&&we.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(o.noop)}else r===o.Keys.down&&C(()=>{var c;u(((c=R.current)==null?void 0:c.element)||k)});else i&&r===o.Keys.down&&(e.preventDefault(),Q(q))},[l,m,u,C,Q,P,K,g,w]),be=t.useCallback(e=>{const{keyCode:r,altKey:i}=e;i||r!==o.Keys.up&&r!==o.Keys.down||(e.preventDefault(),C(r===o.Keys.up?()=>{u(F.current)}:()=>{u(S.current&&S.current.element)}))},[u,C]),se=t.useCallback(e=>{if(!s.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};w(r,[],"clear"),m(r),e.preventDefault()},[w,m]),Qe=t.useCallback((e,r)=>{var i;m({target:s.current}),d||u((i=R.current)==null?void 0:i.element),w({syntheticEvent:r,nativeEvent:r.nativeEvent,target:s.current},e,"delete")},[w,m,u,d]),Ce=t.useCallback(e=>{if(n.onExpandChange&&s.current){const{item:r,itemHierarchicalIndex:i,nativeEvent:k,syntheticEvent:q}=e,Z={level:gt(i),item:r,nativeEvent:k,syntheticEvent:q,target:s.current};n.onExpandChange.call(void 0,Z)}},[n.onExpandChange]),ke=t.useCallback(e=>{if(n.onFilterChange&&s.current){const i={filter:{field:n.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:s.current};n.onFilterChange.call(void 0,i),n.filter===void 0&&Ve(e.target.value)}},[n.onFilterChange,n.filter,n.textField]),Ee=t.useCallback(e=>{if(!s.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:s.current};n.onCancel&&n.onCancel.call(void 0,r),m(r),e.preventDefault()},[n.onCancel,m]),Xe=()=>{const e=n.filterable?t.createElement(Te,{value:n.filter===void 0?he:n.filter,ref:ne,onChange:ke,onKeyDown:be,size:y,rounded:V,fillMode:z}):null,r={title:n.adaptiveTitle,expand:l,onClose:i=>n.onCancel?Ee(i):se(i),windowWidth:re,mobileFilter:e,footer:{cancelText:X.toLanguageString(v.adaptiveModeFooterCancel,v.messages[v.adaptiveModeFooterCancel]),onCancel:i=>n.onCancel?Ee(i):se(i),applyText:X.toLanguageString(v.adaptiveModeFooterApply,v.messages[v.adaptiveModeFooterApply]),onApply:i=>m(i)}};return t.createElement(ct.AdaptiveMode,{...r},t.createElement(ut.ActionSheetContent,{overflowHidden:!0},t.createElement("div",{className:"k-list-container"},t.createElement("div",{className:"k-list k-list-lg"},B.length>0?t.createElement(Ie.TreeView,{ref:S,tabIndex:_,data:B,focusIdField:K,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:Ce,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Fe,null,X.toLanguageString(v.nodata,v.messages[v.nodata]))))))},Ye=t.useCallback(e=>{for(const r of e)Oe(r.target.clientWidth)},[]),Fe=n.listNoData||ot.ListNoData,X=nt.useLocalization(),xe=!qe||ie.valid,Y=O&&l?Le:G.current,Se=t.createElement(t.Fragment,null,t.createElement("span",{className:o.classNames("k-multiselecttree k-input",n.className,{[`k-input-${Ke[y]||y}`]:y,[`k-rounded-${ft[V]||V}`]:V,[`k-input-${z}`]:z,"k-focus":d&&!x,"k-invalid":!xe,"k-disabled":x,"k-loading":n.loading,"k-required":me}),tabIndex:_,accessKey:n.accessKey,id:T,style:A?{...L,width:void 0}:L,dir:D,ref:F,onKeyDown:x?void 0:Je,onMouseDown:Ge,onFocus:He,onBlur:$e,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":x,"aria-label":A,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy?n.ariaDescribedBy:"tagslist-"+T,"aria-required":n.required,onClick:x?void 0:Ue},t.createElement("div",{id:"tagslist-"+T,className:o.classNames("k-input-values k-chip-list",{[`k-chip-list-${Ke[y]||y}`]:y})},Y.length>0&&t.createElement(st,{tag:n.tag,onTagDelete:Qe,data:Y,guid:T,focused:P?G.current.find(e=>ee.matchTags(e,P,K)):void 0,size:y})),t.createElement("span",{className:"k-input-inner"},Y.length===0&&t.createElement("span",{className:"k-input-value-text"},ue)),n.loading&&t.createElement(o.IconWrap,{className:"k-input-loading-icon",name:"loading"}),oe&&!x&&Y.length>0&&t.createElement(lt,{onClick:se}),t.createElement("select",{name:Re,ref:H,tabIndex:-1,"aria-hidden":!0,title:A,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,g):g})),!O&&t.createElement(tt.Popup,{...N,popupClass:o.classNames(N.popupClass,"k-multiselecttree-popup"),className:o.classNames(N.className,{"k-rtl":D==="rtl"}),style:Be,anchor:N.anchor||F.current,show:l,onOpen:je,onClose:_e,ref:U},n.filterable&&t.createElement(Te,{value:n.filter===void 0?he:n.filter,ref:R,onChange:ke,onKeyDown:be,tabIndex:_,size:y,rounded:V,fillMode:z,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),B.length>0?t.createElement(Ie.TreeView,{style:{height:N.height},ref:S,tabIndex:_,data:B,focusIdField:K,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:Ce,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Fe,null,X.toLanguageString(v.nodata,v.messages[v.nodata])))),O&&Xe());return A?t.createElement(it.FloatingLabel,{label:A,editorValue:oe,editorPlaceholder:ue,editorValid:xe,editorDisabled:x,editorId:T,style:{width:L?L.width:void 0},children:Se,dir:D}):Se}),vt={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};ce.displayName="KendoReactMultiSelectTree";ce.propTypes=vt;exports.MultiSelectTree=ce;exports.MultiSelectTreePropsContext=Me;
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as t from "react";
|
|
10
9
|
import n from "prop-types";
|
|
11
10
|
import { createPropsContext as it, usePropsContext as rt, validatePackage as ot, useId as lt, getTabIndex as st, useRtl as ct, useAdaptiveModeContext as ut, canUseDOM as dt, noop as Z, Keys as o, classNames as ee, IconWrap as pt, kendoThemeMaps as ft } from "@progress/kendo-react-common";
|
package/MultiSelectTree/utils.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
|
|
8
|
+
"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)||[]],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],o=[];if(P){o.push(...p),o.push(g),o.push(...k.filter(s=>!I[t(s)]));const n=M.filter(s=>!I[t(s)]),e=r(o,t);for(let s=n.length-1;s>-1;s--){const h=n[s],l=d(h);if(l.filter(T=>e[t(T)]).length<l.length)break;o.push(h),e[t(h)]=!0}}else{const n=t(g),e=r(k,t),s=r(M,t);o.push(...p.filter(h=>{const l=t(h);return!e[l]&&n!==l&&!s[l]}))}return o};exports.getMultiSelectTreeValue=G;exports.getValueMap=r;
|
|
@@ -5,22 +5,21 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import { getter as V } from "@progress/kendo-react-common";
|
|
10
|
-
const
|
|
9
|
+
const a = (l, f) => {
|
|
11
10
|
const i = {};
|
|
12
|
-
return
|
|
11
|
+
return l && l.length && l.forEach((g) => {
|
|
13
12
|
i[f(g)] = !0;
|
|
14
13
|
}), i;
|
|
15
|
-
}, E = (
|
|
16
|
-
const { items: i, dataItemKey: g, value:
|
|
14
|
+
}, E = (l, f) => {
|
|
15
|
+
const { items: i, dataItemKey: g, value: u, subItemsField: x = "items", operation: w } = f, t = V(g), I = a(u, t);
|
|
17
16
|
if (w === "clear")
|
|
18
17
|
return [];
|
|
19
18
|
if (w === "delete") {
|
|
20
|
-
const n =
|
|
21
|
-
return
|
|
19
|
+
const n = a(i, t);
|
|
20
|
+
return u.filter((e) => !n[t(e)]);
|
|
22
21
|
}
|
|
23
|
-
const G = i[0], C = t(G), d = V(x), h = [...
|
|
22
|
+
const G = i[0], C = t(G), d = V(x), h = [...l], c = [];
|
|
24
23
|
let b = [], m;
|
|
25
24
|
for (; h.length; ) {
|
|
26
25
|
const n = h.pop();
|
|
@@ -42,20 +41,20 @@ const u = (r, f) => {
|
|
|
42
41
|
}
|
|
43
42
|
const L = !I[C], o = [];
|
|
44
43
|
if (L) {
|
|
45
|
-
o.push(...
|
|
46
|
-
const n = b.filter((s) => !I[t(s)]), e =
|
|
44
|
+
o.push(...u), o.push(m), o.push(...M.filter((s) => !I[t(s)]));
|
|
45
|
+
const n = b.filter((s) => !I[t(s)]), e = a(o, t);
|
|
47
46
|
for (let s = n.length - 1; s > -1; s--) {
|
|
48
|
-
const p = n[s],
|
|
49
|
-
if (
|
|
47
|
+
const p = n[s], r = d(p);
|
|
48
|
+
if (r.filter((P) => e[t(P)]).length < r.length)
|
|
50
49
|
break;
|
|
51
50
|
o.push(p), e[t(p)] = !0;
|
|
52
51
|
}
|
|
53
52
|
} else {
|
|
54
|
-
const n = t(m), e =
|
|
53
|
+
const n = t(m), e = a(M, t), s = a(b, t);
|
|
55
54
|
o.push(
|
|
56
|
-
...
|
|
57
|
-
const
|
|
58
|
-
return !e[
|
|
55
|
+
...u.filter((p) => {
|
|
56
|
+
const r = t(p);
|
|
57
|
+
return !e[r] && n !== r && !s[r];
|
|
59
58
|
})
|
|
60
59
|
);
|
|
61
60
|
}
|
|
@@ -63,5 +62,5 @@ const u = (r, f) => {
|
|
|
63
62
|
};
|
|
64
63
|
export {
|
|
65
64
|
E as getMultiSelectTreeValue,
|
|
66
|
-
|
|
65
|
+
a as getValueMap
|
|
67
66
|
};
|
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
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react"),r=require("@progress/kendo-react-layout"),y=require("@progress/kendo-svg-icons"),i=require("@progress/kendo-react-buttons"),x=require("@progress/kendo-react-common");function h(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(e,a,o.get?o:{enumerable:!0,get:()=>t[a]})}}return e.default=t,Object.freeze(e)}const n=h(v),k=t=>{const{footer:e,windowWidth:a=0,mobileFilter:o,children:s,navigatable:d,navigatableElements:u,expand:b,animation:p,title:m,subTitle:f,onClose:c}=t,l=x.useAdaptiveModeContext(),g={navigatable:d||!1,navigatableElements:u||[],expand:b,animation:p!==!1,actions:n.createElement(i.Button,{tabIndex:0,"aria-label":"Cancel","aria-disabled":"false",type:"button",fillMode:"flat",icon:"x",svgIcon:y.xIcon,onClick:c}),filter:o,onClose:c,animationStyles:l&&a<=l.small?{top:0,width:"100%",height:"100%"}:void 0,title:m,subTitle:f,className:"k-adaptive-actionsheet",position:l&&a<=l.small?"fullscreen":void 0};return n.createElement(r.ActionSheet,{...g},s,e&&n.createElement(r.ActionSheetFooter,{className:"k-actions k-actions-stretched"},n.createElement(i.Button,{size:"large",tabIndex:0,"aria-label":e.cancelText,"aria-disabled":"false",type:"button",onClick:e.onCancel},e.cancelText),n.createElement(i.Button,{tabIndex:0,themeColor:"primary",size:"large","aria-label":e.applyText,"aria-disabled":"false",type:"button",onClick:e.onApply},e.applyText)))};exports.AdaptiveMode=k;
|
package/common/AdaptiveMode.mjs
CHANGED
|
@@ -5,16 +5,15 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as t from "react";
|
|
10
9
|
import { ActionSheet as h, ActionSheetFooter as u } from "@progress/kendo-react-layout";
|
|
11
10
|
import { xIcon as v } from "@progress/kendo-svg-icons";
|
|
12
|
-
import { Button as
|
|
11
|
+
import { Button as o } from "@progress/kendo-react-buttons";
|
|
13
12
|
import { useAdaptiveModeContext as C } from "@progress/kendo-react-common";
|
|
14
13
|
const I = (i) => {
|
|
15
14
|
const {
|
|
16
15
|
footer: e,
|
|
17
|
-
windowWidth:
|
|
16
|
+
windowWidth: n = 0,
|
|
18
17
|
mobileFilter: r,
|
|
19
18
|
children: s,
|
|
20
19
|
navigatable: c,
|
|
@@ -30,7 +29,7 @@ const I = (i) => {
|
|
|
30
29
|
expand: d,
|
|
31
30
|
animation: p !== !1,
|
|
32
31
|
actions: /* @__PURE__ */ t.createElement(
|
|
33
|
-
|
|
32
|
+
o,
|
|
34
33
|
{
|
|
35
34
|
tabIndex: 0,
|
|
36
35
|
"aria-label": "Cancel",
|
|
@@ -44,14 +43,14 @@ const I = (i) => {
|
|
|
44
43
|
),
|
|
45
44
|
filter: r,
|
|
46
45
|
onClose: l,
|
|
47
|
-
animationStyles: a &&
|
|
46
|
+
animationStyles: a && n <= a.small ? { top: 0, width: "100%", height: "100%" } : void 0,
|
|
48
47
|
title: b,
|
|
49
48
|
subTitle: f,
|
|
50
49
|
className: "k-adaptive-actionsheet",
|
|
51
|
-
position: a &&
|
|
50
|
+
position: a && n <= a.small ? "fullscreen" : void 0
|
|
52
51
|
};
|
|
53
52
|
return /* @__PURE__ */ t.createElement(h, { ...x }, s, e && /* @__PURE__ */ t.createElement(u, { className: "k-actions k-actions-stretched" }, /* @__PURE__ */ t.createElement(
|
|
54
|
-
|
|
53
|
+
o,
|
|
55
54
|
{
|
|
56
55
|
size: "large",
|
|
57
56
|
tabIndex: 0,
|
|
@@ -62,7 +61,7 @@ const I = (i) => {
|
|
|
62
61
|
},
|
|
63
62
|
e.cancelText
|
|
64
63
|
), /* @__PURE__ */ t.createElement(
|
|
65
|
-
|
|
64
|
+
o,
|
|
66
65
|
{
|
|
67
66
|
tabIndex: 0,
|
|
68
67
|
themeColor: "primary",
|
package/common/ClearButton.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
|
|
8
|
+
"use strict";const i=require("react"),d=require("@progress/kendo-react-intl"),s=require("../messages/index.js"),c=require("@progress/kendo-react-common"),m=require("@progress/kendo-svg-icons");function p(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const a=p(i),f=e=>{const n=d.useLocalization(),t=c.useUnstyled(),o=t&&t.uDropDownsBase,r=n.toLanguageString(s.clear,s.messages[s.clear]),l=u=>u.preventDefault();return a.createElement("span",{className:c.classNames(c.uDropDownsBase.clearButton({c:o})),role:"button",onClick:e.onClick,onMouseDown:l,tabIndex:-1,title:r,key:"clearbutton"},a.createElement(c.IconWrap,{name:"x",icon:m.xIcon}))};module.exports=f;
|
package/common/ClearButton.mjs
CHANGED
|
@@ -5,18 +5,17 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
import * as o from "react";
|
|
8
|
+
import * as e from "react";
|
|
10
9
|
import { useLocalization as m } from "@progress/kendo-react-intl";
|
|
11
10
|
import { clear as t, messages as i } from "../messages/index.mjs";
|
|
12
11
|
import { useUnstyled as u, classNames as p, uDropDownsBase as f, IconWrap as d } from "@progress/kendo-react-common";
|
|
13
12
|
import { xIcon as D } from "@progress/kendo-svg-icons";
|
|
14
13
|
const b = (n) => {
|
|
15
|
-
const
|
|
16
|
-
return /* @__PURE__ */
|
|
14
|
+
const a = m(), o = u(), s = o && o.uDropDownsBase, r = a.toLanguageString(t, i[t]), c = (l) => l.preventDefault();
|
|
15
|
+
return /* @__PURE__ */ e.createElement(
|
|
17
16
|
"span",
|
|
18
17
|
{
|
|
19
|
-
className: p(f.clearButton({ c:
|
|
18
|
+
className: p(f.clearButton({ c: s })),
|
|
20
19
|
role: "button",
|
|
21
20
|
onClick: n.onClick,
|
|
22
21
|
onMouseDown: c,
|
|
@@ -24,7 +23,7 @@ const b = (n) => {
|
|
|
24
23
|
title: r,
|
|
25
24
|
key: "clearbutton"
|
|
26
25
|
},
|
|
27
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ e.createElement(d, { name: "x", icon: D })
|
|
28
27
|
);
|
|
29
28
|
};
|
|
30
29
|
export {
|
package/common/DropDownBase.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
|
|
8
|
+
"use strict";const v=require("react"),n=require("prop-types"),y=require("./VirtualScrollStatic.js"),S=require("./Navigation.js"),c=require("./utils.js");function b(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const P=b(v),a=class a{constructor(e){this.wrapper=null,this.list=null,this.vs=new y.VirtualScroll,this.navigation=new S.Navigation,this.handleItemClick=(t,s)=>{const i=this.initState();i.syntheticEvent=s,s.stopPropagation(),this.component.handleItemSelect(t,i),this.togglePopup(i),this.applyState(i)},this.handleFocus=t=>{if(!this.component.state.focused){const s=this.initState();s.data.focused=!0,s.events.push({type:"onFocus"}),s.syntheticEvent=t,this.applyState(s)}},this.filterChanged=(t,s)=>{const{textField:i,filterable:o}=this.component.props;o&&s.events.push({type:"onFilterChange",filter:{field:i,operator:"contains",ignoreCase:!0,value:t}})},this.togglePopup=t=>{const s=this.component.props,i=s.opened!==void 0?s.opened:this.component.state.opened;s.opened===void 0&&(t.data.opened=!i),i?t.events.push({type:"onClose"}):(t.events.push({type:"onOpen"}),this.calculatePopupWidth())},this.pageChange=(t,s)=>{const i=this.initState();i.syntheticEvent=s,this.triggerOnPageChange(i,t.skip,t.take),this.applyState(i)},this.scrollToVirtualItem=(t,s)=>{const i=this.vs;if(t.skip===0)i.reset();else{let o=i.translate;o===0&&(i.calcScrollElementHeight(),o=i.itemHeight*t.skip,i.translateTo(o,!0)),s<0&&o>0&&(o+=i.itemHeight*(t.pageSize/4)),i.container&&(i.container.scrollTop=o),this.scrollToItem(s,!0)}},this.scrollPopupByPageSize=t=>{var p,u,d,g,f,m;const s=this.vs,i=(u=(p=this.list)==null?void 0:p.parentElement)==null?void 0:u.scrollTop,o=s.enabled&&s.itemHeight?s.itemHeight:this.list?this.list.children[0].offsetHeight:0,r=(g=(d=this.list)==null?void 0:d.parentElement)==null?void 0:g.offsetHeight;i!==void 0&&r!==void 0&&((m=(f=this.list)==null?void 0:f.parentElement)==null||m.scroll({top:i+t*Math.floor(r/o)*o}))},this.renderScrollElement=()=>{const t=this.vs;return t.enabled&&P.createElement("div",{ref:s=>t.scrollElement=s,key:"scrollElementKey"})},this.resetGroupStickyHeader=(t,s)=>{t!==s.state.group&&s.setState({group:t})},this.listBoxId=e.props.id+"list",this.guid=e.props.id,this.component=e,this.vs.PageChange=this.pageChange}didUpdate(){this.vs.listTransform&&this.vs.list&&(this.vs.list.style.transform=this.vs.listTransform,this.vs.listTransform="")}didMount(){const e=this.component.props,t=e.popupSettings||{},s=e.style||{},i=t.width;let o=e.opened===!0;i===void 0&&this.calculatePopupWidth(),e.dir===void 0&&s.direction===void 0&&(this.calculateDir(),o=!0),o&&this.component.forceUpdate()}calculateDir(){const e=this.component.element;e&&e.ownerDocument&&e.ownerDocument.defaultView&&(this.dirCalculated=e.ownerDocument.defaultView.getComputedStyle(e).direction||void 0)}calculatePopupWidth(){this.wrapper&&(this.popupWidth=this.wrapper.offsetWidth+"px")}scrollToItem(e,t,s){const i=this.list||this.vs.list;if(!i&&!s&&setTimeout(()=>{this.scrollToItem(e,t,!0)},10),e===0&&t&&this.vs.skip===0){this.vs.reset();return}if(i&&e>=0){const o=this.vs,r=o.container||i.parentNode,p=t!==void 0?t:o.enabled;c.scrollToItem(r,i,e,o.translate,p)}}updateComponentArgs(e){for(let t in e)Object.hasOwnProperty.call(e,t)&&(this.component[t]=e[t])}initState(){return{data:{},events:[],syntheticEvent:void 0}}applyState(e){Object.keys(e.data).length>0&&this.component.setState(e.data);const t={syntheticEvent:e.syntheticEvent,nativeEvent:e.syntheticEvent?e.syntheticEvent.nativeEvent:void 0,target:this.component,value:this.component.value};e.events.forEach(s=>{const i=s.type;delete s.type;const o=i&&this.component.props[i];o&&o.call(void 0,{...t,...s})})}triggerOnPageChange(e,t,s){const i=this.component.props.virtual;if(i){const o=Math.min(Math.max(0,t),Math.max(0,i.total-s));o!==i.skip&&e.events.push({type:"onPageChange",page:{skip:o,take:s}})}}triggerPageChangeCornerItems(e,t){const s=this.component.props,{data:i=[],dataItemKey:o,virtual:r}=s,p=s.opened!==void 0?s.opened:this.component.state.opened;e&&r&&this.vs.enabled&&(r.skip>0&&c.areSame(e,i[0],o)?this.triggerOnPageChange(t,r.skip-1,r.pageSize):!p&&r.skip+r.pageSize<r.total&&c.areSame(e,i[i.length-1],o)&&this.triggerOnPageChange(t,r.skip+1,r.pageSize))}getPopupSettings(){return Object.assign({},a.defaultProps.popupSettings,this.component.props.popupSettings)}getAdaptiveAnimation(){const e=this.getPopupSettings();return e.animate!==void 0?e.animate:!0}getGroupedDataModernMode(e,t){const s=[];return e.forEach((i,o)=>{e[o-1]&&i[t]!==e[o-1][t]&&s.push({[t]:i[t]}),s.push(e[o])}),s}};a.basicPropTypes={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,textField:n.string,className:n.string,label:n.string,loading:n.bool,popupSettings:n.shape({animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),popupClass:n.string,className:n.string,appendTo:n.any,width:n.oneOfType([n.string,n.number]),height:n.oneOfType([n.string,n.number])}),onOpen:n.func,onClose:n.func,onFocus:n.func,onBlur:n.func,onChange:n.func,itemRender:n.func,listNoDataRender:n.func,focusedItemIndex:n.func,header:n.node,footer:n.node},a.propTypes={...a.basicPropTypes,value:n.any,defaultValue:n.any,filterable:n.bool,filter:n.string,virtual:n.shape({pageSize:n.number.isRequired,skip:n.number.isRequired,total:n.number.isRequired}),onFilterChange:n.func,onPageChange:n.func},a.defaultProps={popupSettings:{height:"200px"},required:!1,validityStyles:!0};let h=a;module.exports=h;
|
package/common/DropDownBase.mjs
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as m from "react";
|
|
10
9
|
import n from "prop-types";
|
|
11
10
|
import { VirtualScroll as v } from "./VirtualScrollStatic.mjs";
|
|
@@ -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
|
|
8
|
+
"use strict";const c=require("@progress/kendo-react-common"),u=require("react");function d(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const r=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,r.get?r:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const l=d(u),i=e=>{const{group:t,groupMode:s,render:r}=e,o=c.useUnstyled(),n=o&&o.uDropDownsBase,a=l.createElement("div",{className:c.classNames(c.uDropDownsBase.groupStickyHeader({c:n}))},s==="classic"?t:l.createElement("div",{className:c.classNames(c.uDropDownsBase.listHeaderText({c:n}))},t));return r!==void 0?r.call(void 0,a,e):a};module.exports=i;
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import { useUnstyled as i, classNames as c, uDropDownsBase as d } from "@progress/kendo-react-common";
|
|
10
9
|
import * as l from "react";
|
|
11
|
-
const
|
|
12
|
-
const { group: s, groupMode: n, render:
|
|
13
|
-
return
|
|
10
|
+
const u = (e) => {
|
|
11
|
+
const { group: s, groupMode: n, render: r } = e, t = i(), a = t && t.uDropDownsBase, o = /* @__PURE__ */ l.createElement("div", { className: c(d.groupStickyHeader({ c: a })) }, n === "classic" ? s : /* @__PURE__ */ l.createElement("div", { className: c(d.listHeaderText({ c: a })) }, s));
|
|
12
|
+
return r !== void 0 ? r.call(void 0, o, e) : o;
|
|
14
13
|
};
|
|
15
14
|
export {
|
|
16
|
-
|
|
15
|
+
u as default
|
|
17
16
|
};
|
package/common/List.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
|
|
8
|
+
"use strict";const U=require("react"),J=require("./ListItem.js"),K=require("./ListGroupItem.js"),f=require("./utils.js"),Q=require("@progress/kendo-react-intl"),S=require("../messages/index.js"),n=require("@progress/kendo-react-common");function W(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return l.default=e,Object.freeze(l)}const r=W(U),X=e=>{const l=Q.useLocalization(),t=n.useUnstyled(),s=t&&t.uDropDownsBase,{id:q,show:B,wrapperCssClass:M,wrapperStyle:z,listStyle:L,listRef:O,wrapperRef:j,listClassName:x,ariaSetSize:$}=e,b=(()=>{const{textField:i,valueField:c,groupField:g,groupMode:w,isMultiColumn:F,optionsGuid:C,skip:N=0,virtual:R,focusedIndex:h,hasDuplicates:G,highlightSelected:V=!0,value:u,data:E,itemRender:_,groupHeaderItemRender:P}=e,k=Array.isArray(u);let D=0;return E.map((a,o)=>{const p=N+o,v=N+o+D,H=G?u?h===o:!1:a.disabled?!1:V&&(!k&&f.areSame(a,u,c)||k&&u.findIndex(T=>f.areSame(T,a,c))!==-1);let d,m,y;o>0&&g!==void 0&&(m=f.getItemValue(a,g),y=f.getItemValue(E[o-1],g),m&&y&&m!==y&&(d=m));const I=d!==void 0&&w==="modern";return I?D+=1:D=0,[I&&r.createElement(K,{id:`option-${C}-${v}`,virtual:R,key:p+"-group-item",group:d,isMultiColumn:F,render:P}),r.createElement(J,{id:`option-${C}-${I?v+1:v}`,virtual:R,dataItem:a,groupMode:w,selected:H,focused:h===o,index:p,key:p,onClick:e.onClick,textField:i,group:d,render:_,disabled:a.disabled})]})})(),A=()=>{const i=e.noDataRender,c=r.createElement("div",{className:n.classNames(n.uDropDownsBase.noData({c:s}))},r.createElement("div",null,l.toLanguageString(S.nodata,S.messages[S.nodata])));return i?i.call(void 0,c):c};return b.length?r.createElement("div",{className:M,style:z,ref:j,onMouseDown:e.onMouseDown,onBlur:e.onBlur,onScroll:e.onScroll,unselectable:"on"},r.createElement("ul",{id:q,role:"listbox","aria-hidden":B?void 0:!0,"aria-setsize":$,className:x||n.classNames(n.uDropDownsBase.ul({c:s})),ref:O,style:L},b),e.scroller&&r.createElement("div",{className:n.classNames(n.uDropDownsBase.heightContainer({c:s}))},e.scroller)):A()};module.exports=X;
|
package/common/List.mjs
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";
|
|
9
8
|
import * as t from "react";
|
|
10
9
|
import T from "./ListItem.mjs";
|
|
11
10
|
import W from "./ListGroupItem.mjs";
|
package/common/ListContainer.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
|
|
8
|
+
"use strict";const i=require("react"),s=require("@progress/kendo-react-popup");function u(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const a=u(i),p=e=>{const{children:n,width:t,dir:r,itemsCount:o,popupSettings:c}=e;return a.createElement(s.Popup,{style:{width:t,direction:r},contentKey:o&&o.join(),...c},n)};module.exports=p;
|
package/common/ListContainer.mjs
CHANGED
|
@@ -5,19 +5,18 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import { Popup as c } from "@progress/kendo-react-popup";
|
|
8
|
+
import * as p from "react";
|
|
9
|
+
import { Popup as s } from "@progress/kendo-react-popup";
|
|
11
10
|
const a = (e) => {
|
|
12
|
-
const { children:
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
|
|
11
|
+
const { children: o, width: n, dir: i, itemsCount: t, popupSettings: r } = e;
|
|
12
|
+
return /* @__PURE__ */ p.createElement(
|
|
13
|
+
s,
|
|
15
14
|
{
|
|
16
|
-
style: { width:
|
|
15
|
+
style: { width: n, direction: i },
|
|
17
16
|
contentKey: t && t.join(),
|
|
18
17
|
...r
|
|
19
18
|
},
|
|
20
|
-
|
|
19
|
+
o
|
|
21
20
|
);
|
|
22
21
|
};
|
|
23
22
|
export {
|