@progress/kendo-react-listbox 7.0.3-develop.9 → 7.1.0-develop.2
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/dist/cdn/js/kendo-react-listbox.js +1 -1
- package/index.mjs +1 -1
- package/package.json +4 -4
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
(function(d,b){typeof exports=="object"&&typeof module
|
|
5
|
+
(function(d,b){typeof exports=="object"&&typeof module!="undefined"?b(exports,require("react"),require("prop-types"),require("@progress/kendo-react-common"),require("@progress/kendo-react-buttons"),require("@progress/kendo-react-intl"),require("@progress/kendo-svg-icons")):typeof define=="function"&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-buttons","@progress/kendo-react-intl","@progress/kendo-svg-icons"],b):(d=typeof globalThis!="undefined"?globalThis:d||self,b(d.KendoReactListbox={},d.React,d.PropTypes,d.KendoReactCommon,d.KendoReactButtons,d.KendoReactIntl,d.KendoSvgIcons))})(this,function(d,b,u,h,w,k,f){"use strict";"use client";function F(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const p=F(b);var E=(a=>(a.TOP="top",a.BOTTOM="bottom",a.LEFT="left",a.RIGHT="right",a.NONE="none",a))(E||{});const O={name:"@progress/kendo-react-listbox",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:1607357111,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};let L=class extends p.PureComponent{constructor(t){super(t),this.setSelected=e=>{if(this.props.selectedField)return!!e[this.props.selectedField]},this.renderItem=e=>this.props.textField?e[this.props.textField]:e.toString(),this.handleKeyDown=e=>{this.props.onKeyDown&&h.dispatchEvent(this.props.onKeyDown,e,this,void 0)},this.handleContainerDrop=e=>{e.target.classList.contains("k-list-content")&&(this.props.data.length>0?h.dispatchEvent(this.props.onDrop,e,this,{dataItem:this.props.data[this.props.data.length-1]}):h.dispatchEvent(this.props.onDrop,e,this,{dataItem:null}))},this.setToolbarPosition=()=>this.props.toolbarPosition===E.NONE||this.props.toolbar===void 0?"":`k-listbox-actions-${this.props.toolbarPosition}`,this.handleOnDragLeave=e=>{this.props.onDragLeave&&e.target.classList.contains("k-list-content")&&h.dispatchEvent(this.props.onDragLeave,e,this,void 0)},h.validatePackage(O)}get itemGuid(){return this.props.id+"-accessibility-id"}render(){return p.createElement("div",{id:this.props.id,className:h.classNames(this.props.className,"k-listbox",this.setToolbarPosition()),style:this.props.style,unselectable:"on"},this.props.toolbar&&this.props.toolbarPosition!=="bottom"&&p.createElement(this.props.toolbar,null),p.createElement("div",{className:"k-list-scroller k-selectable","data-role":"selectable",onDragOver:t=>t.preventDefault(),onDrop:this.handleContainerDrop,onDragLeave:this.handleOnDragLeave},p.createElement("div",{className:h.classNames("k-list",{[`k-list-${h.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size})},p.createElement("div",{className:"k-list-content"},p.createElement("ul",{className:"k-list-ul",role:"listbox","aria-label":"listbox-container",tabIndex:0,onKeyDown:this.handleKeyDown},this.props.data.map((t,e)=>{const s=this.setSelected(t),r={className:h.classNames("k-list-item",{"k-selected":s}),role:"option","aria-selected":s,key:e,id:this.itemGuid+e,"data-uid":this.itemGuid+e,draggable:this.props.draggable,onDragStart:o=>h.dispatchEvent(this.props.onDragStart,o,this,{dataItem:t}),onDragOver:o=>{o.preventDefault(),h.dispatchEvent(this.props.onDragOver,o,this,{dataItem:t})},onDrop:o=>h.dispatchEvent(this.props.onDrop,o,this,{dataItem:t}),onClick:o=>h.dispatchEvent(this.props.onItemClick,o,this,{dataItem:t})};return this.props.item?p.createElement(this.props.item,{selected:s,dataItem:t,...r,key:r.key},p.createElement("span",{className:"k-list-item-text"},t.name)):p.createElement("li",{...r,key:r.key},p.createElement("span",{className:"k-list-item-text"},this.renderItem(t)))}))))),this.props.toolbar&&this.props.toolbarPosition==="bottom"&&p.createElement(this.props.toolbar,null),p.createElement("select",{style:{display:"none"},multiple:!0,"data-role":"listbox"},this.props.data.map((t,e)=>{const s=t[this.props.valueField||this.props.textField];return p.createElement("option",{key:e,value:s},s)})))}};L.propTypes={size:u.oneOf([null,"small","medium","large"]),toolbarPosition:u.oneOf(["none","top","bottom","left","right"]),textField:u.string,valueField:u.string,selectedField:u.string,data:u.array},L.defaultProps={toolbarPosition:E.RIGHT,draggable:!0,size:"medium"};const C="listbox.moveUp",K="listbox.moveDown",S="listbox.transferTo",z="listbox.transferFrom",U="listbox.transferAllTo",M="listbox.transferAllFrom",j="listbox.remove",q={[C]:"Move Up",[K]:"Move Down",[S]:"Transfer To",[z]:"Transfer From",[U]:"Transfer All To",[M]:"Transfer All From",[j]:"Delete"},N=[{name:"moveUp",iconName:"caret-alt-up",svgIcon:f.caretAltUpIcon},{name:"moveDown",iconName:"caret-alt-down",svgIcon:f.caretAltDownIcon},{name:"transferTo",iconName:"caret-alt-right",svgIcon:f.caretAltRightIcon},{name:"transferFrom",iconName:"caret-alt-left",svgIcon:f.caretAltLeftIcon},{name:"transferAllTo",iconName:"caret-double-alt-right",svgIcon:f.caretDoubleAltRightIcon},{name:"transferAllFrom",iconName:"caret-double-alt-left",svgIcon:f.caretDoubleAltLeftIcon},{name:"remove",iconName:"x",svgIcon:f.xIcon}];class D extends p.PureComponent{constructor(){super(...arguments),this.checkSvgIcon=t=>{switch(t.name){case"caret-alt-right":return f.caretAltLeftIcon;case"caret-alt-left":return f.caretAltRightIcon;case"caret-double-alt-right":return f.caretDoubleAltLeftIcon;case"caret-double-alt-left":return f.caretDoubleAltRightIcon}return t},this.checkFontIcon=t=>{switch(t){case"caret-alt-right":return"caret-alt-left";case"caret-alt-left":return"caret-alt-right";case"caret-double-alt-right":return"caret-double-alt-left";case"caret-double-alt-left":return"caret-double-alt-right"}return t},this.handleToolClick=(t,e)=>{h.dispatchEvent(this.props.onToolClick,t,this,{toolName:e})},this.isItemDisabled=t=>{let e=!0;const s=this.props.selectedField||"selected",r=this.props.data.length,o=this.props.dataConnected.length,i=this.props.data.findIndex(n=>n[s]===!0)>=0,c=this.props.dataConnected.findIndex(n=>n[s]===!0)>=0;switch(t){case"moveUp":i?e=this.props.data.length>0?this.props.data[0].selected:!0:c?e=this.props.dataConnected.length>0?this.props.dataConnected[0].selected:!0:e=!0;break;case"moveDown":i?e=this.props.data[r-1]?this.props.data[r-1].selected:!0:c?e=this.props.dataConnected.length>0?this.props.dataConnected[o-1].selected:!0:e=!0;break;case"transferTo":e=!(this.props.dataConnected&&i);break;case"transferFrom":this.props.dataConnected?e=!(this.props.dataConnected&&c):e=!0;break;case"transferAllTo":e=!(this.props.dataConnected&&this.props.data.length>0);break;case"transferAllFrom":e=!(this.props.dataConnected&&this.props.dataConnected.length>0);break;case"remove":e=!(i||c);break}return e}}get isRtl(){return this.props.dir==="rtl"}render(){const t=k.provideLocalizationService(this);return p.createElement("div",{className:h.classNames("k-listbox-actions")},this.props.tools&&this.props.tools.map((e,s)=>{const r=N.findIndex(l=>l.name===e),o=N[r],i=this.isItemDisabled(o.name),c=`listbox.${o.name}`,n=t.toLanguageString(c,q[c]);return p.createElement(w.Button,{key:s,disabled:i,"data-command":o.name,title:n,"aria-label":n,icon:this.isRtl?this.checkFontIcon(o.iconName):o.iconName,svgIcon:this.isRtl?this.checkSvgIcon(o.svgIcon):o.svgIcon,onClick:l=>{l.preventDefault(),this.handleToolClick(l,o.name||null)}})}))}}D.propTypes={data:u.array,dataConnected:u.array,tools:u.array,selectedField:u.string,dir:u.string},D.defaultProps={data:[],dataConnected:[],selectedField:"selected"},k.registerForLocalization(D);const G=(a=[],t=[],e,s)=>{let r=[],o=[],i=[];const c={listBoxOneData:a,listBoxTwoData:t};switch(e){case"moveUp":r=[...a],r.forEach((n,l)=>{n[s]&&(r=m(l,l-1,r))}),i=[...t],i.forEach((n,l)=>{n[s]&&(i=m(l,l-1,i))}),c.listBoxOneData=r,c.listBoxTwoData=i;break;case"moveDown":r=a.reverse(),r.forEach((n,l)=>{n[s]&&(r=m(l,l-1,r))}),i=t.reverse(),i.forEach((n,l)=>{n[s]&&(i=m(l,l-1,i))}),c.listBoxOneData=[...r].reverse(),c.listBoxTwoData=[...i].reverse();break;case"transferTo":r=a.filter(n=>!n[s]),o=a.filter(n=>n[s]),i=t.concat(o),c.listBoxOneData=r,c.listBoxTwoData=i;break;case"transferFrom":i=t.filter(n=>!n[s]),o=t.filter(n=>n[s]),r=a.concat(o),c.listBoxOneData=r,c.listBoxTwoData=i;break;case"transferAllTo":c.listBoxOneData=[],c.listBoxTwoData=t.concat(a);break;case"transferAllFrom":c.listBoxOneData=t.concat(a),c.listBoxTwoData=[];break;case"remove":i=t.filter(n=>!n[s]),r=a.filter(n=>!n[s]),c.listBoxOneData=r,c.listBoxTwoData=i;break}return c},m=(a,t,e)=>{const s=e.splice(a,1)[0];return e.splice(t,0,s),e},P=(a=[],t=[],e,s,r)=>{const o=a.findIndex(g=>g[r]===e[r]),i=t.findIndex(g=>g[r]===e[r]),c=s!==null?a.findIndex(g=>g[r]===s[r]):-1,n=s!==null?t.findIndex(g=>g[r]===s[r]):-1,l=o>=0,T=i>=0,y=c>=0,A=n>=0,v=[...a],I=[...t];return l&&y?{listBoxOneData:m(o,c,a),listBoxTwoData:t}:T&&A?{listBoxOneData:a,listBoxTwoData:m(i,n,t)}:l&&(A||s===null)?(s===null?I.push(a[o]):I.splice(n+1,0,a[o]),v.splice(o,1),{listBoxOneData:v,listBoxTwoData:I}):T&&(y||s===null)?(s===null?v.push(t[i]):v.splice(c+1,0,t[i]),I.splice(i,1),{listBoxOneData:v,listBoxTwoData:I}):{listBoxOneData:a,listBoxTwoData:t}},x=h.withIdHOC(L);x.displayName="KendoReactListBox",d.ListBox=x,d.ListBoxToolbar=D,d.moveItem=m,d.processListBoxData=G,d.processListBoxDragAndDrop=P,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
package/index.mjs
CHANGED
|
@@ -14,7 +14,7 @@ const z = {
|
|
|
14
14
|
name: "@progress/kendo-react-listbox",
|
|
15
15
|
productName: "KendoReact",
|
|
16
16
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
17
|
-
publishDate:
|
|
17
|
+
publishDate: 1705399036,
|
|
18
18
|
version: "",
|
|
19
19
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
20
20
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-listbox",
|
|
3
|
-
"version": "7.0
|
|
3
|
+
"version": "7.1.0-develop.2",
|
|
4
4
|
"description": "React ListBox enables you to display a list of items and manage the data between multiple lists. KendoReact ListBox package",
|
|
5
5
|
"author": "Progress",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@progress/kendo-licensing": "^1.3.4",
|
|
26
|
-
"@progress/kendo-react-buttons": "7.0
|
|
27
|
-
"@progress/kendo-react-common": "7.0
|
|
28
|
-
"@progress/kendo-react-intl": "7.0
|
|
26
|
+
"@progress/kendo-react-buttons": "7.1.0-develop.2",
|
|
27
|
+
"@progress/kendo-react-common": "7.1.0-develop.2",
|
|
28
|
+
"@progress/kendo-react-intl": "7.1.0-develop.2",
|
|
29
29
|
"@progress/kendo-svg-icons": "^2.1.0",
|
|
30
30
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0",
|
|
31
31
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0"
|