@progress/kendo-react-listbox 9.5.0-develop.6 → 10.0.0-develop.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ListBox.js +1 -1
- package/ListBox.mjs +17 -19
- package/dist/cdn/js/kendo-react-listbox.js +1 -1
- package/package.json +5 -11
- package/package-metadata.js +0 -8
- package/package-metadata.mjs +0 -19
package/ListBox.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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("react"),u=require("prop-types"),a=require("@progress/kendo-react-common"),R=require("./interfaces/Enums.js")
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("react"),u=require("prop-types"),a=require("@progress/kendo-react-common"),R=require("./interfaces/Enums.js");function U(n){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const m in n)if(m!=="default"){const y=Object.getOwnPropertyDescriptor(n,m);Object.defineProperty(f,m,y.get?y:{enumerable:!0,get:()=>n[m]})}}return f.default=n,Object.freeze(f)}const s=U(G),k=s.forwardRef((n,f)=>{const{id:m,style:y,data:c,textField:h,className:T,valueField:S,selectedField:D,onDrop:L,onKeyDown:N,onDragStart:C,onDragLeave:v,onDragOver:F,onItemClick:z,onItemSelect:g,onKeyboardNavigate:d,size:b=E.size,draggable:_=E.draggable,toolbarPosition:K=E.toolbarPosition}=n,x=s.useRef(null),O=s.useRef(null),w=s.useRef(null),o=s.useCallback(()=>({element:w.current,props:n}),[]);s.useImperativeHandle(O,o),s.useImperativeHandle(f,()=>O.current);const P=m+"-accessibility-id",I=a.kendoThemeMaps.sizeMap[b]||b,q=t=>{if(D)return!!t[D]},A=t=>h?t[h]:t.toString(),j=t=>{N&&a.dispatchEvent(N,t,o(),void 0)},B=t=>{t.target.classList.contains("k-list-content")&&(n.data.length>0?a.dispatchEvent(n.onDrop,t,o(),{dataItem:n.data[n.data.length-1]}):a.dispatchEvent(n.onDrop,t,o(),{dataItem:null}))},M=()=>K===R.toolbarPosition.NONE||n.toolbar===void 0?`k-listbox-actions-${E.toolbarPosition}`:`k-listbox-actions-${K}`,H=t=>{v&&t.target.classList.contains("k-list-content")&&a.dispatchEvent(v,t,o(),void 0)},p=s.useMemo(()=>new a.Navigation({root:x,selectors:[".k-list-item"],tabIndex:0,keyboardEvents:{keydown:{Space:(t,i,e)=>{const r=i.elements.indexOf(t);e.metaKey&&a.dispatchEvent(g,e,o(),{dataItem:c[r]}),a.dispatchEvent(g,e,o(),{dataItem:c[r]})},ArrowDown:(t,i,e)=>{if(e.metaKey&&e.shiftKey)a.dispatchEvent(d,e,o(),{actionName:"moveDown"});else if(e.metaKey&&!e.shiftKey)e.preventDefault(),i.focusNext(t);else if(!(e.shiftKey&&!e.metaKey)){e.preventDefault();const r=i.elements.indexOf(t),l=c[r+1];l&&(a.dispatchEvent(g,e,o(),{dataItem:l}),i.focusNext(t))}},ArrowUp:(t,i,e)=>{if(e.metaKey&&e.shiftKey)a.dispatchEvent(d,e,o(),{actionName:"moveUp"});else if(e.metaKey&&!e.shiftKey)e.preventDefault(),i.focusPrevious(t);else if(!(e.shiftKey&&!e.metaKey)){e.preventDefault();const r=i.elements.indexOf(t),l=c[r-1];l&&(a.dispatchEvent(g,e,o(),{dataItem:l}),i.focusPrevious(t))}},ArrowLeft:(t,i,e)=>{e.metaKey&&e.shiftKey?a.dispatchEvent(d,e,o(),{actionName:"transferAllFrom"}):e.metaKey&&a.dispatchEvent(d,e,o(),{actionName:"transferFrom"})},ArrowRight:(t,i,e)=>{e.metaKey&&e.shiftKey?a.dispatchEvent(d,e,o(),{actionName:"transferAllTo"}):e.metaKey&&a.dispatchEvent(d,e,o(),{actionName:"transferTo"})},Backspace:(t,i,e)=>{a.dispatchEvent(d,e,o(),{actionName:"remove"})}}}}),[c]),$=s.useCallback(p.triggerKeyboardEvent.bind(p),[c]);return s.useEffect(()=>(p.initializeRovingTab(),()=>p.removeFocusListener()),[c]),s.createElement("div",{id:m,ref:w,style:y,unselectable:"on",className:a.classNames(T,"k-listbox",{[`k-listbox-${I}`]:b},M())},n.toolbar&&s.createElement(n.toolbar,null),s.createElement("div",{className:"k-list-scroller k-selectable","data-role":"selectable",ref:x,onDragOver:t=>t.preventDefault(),onDrop:B,onDragLeave:H,onKeyDown:$},s.createElement("div",{className:a.classNames("k-list",{[`k-list-${I}`]:b})},s.createElement("div",{className:"k-list-content"},s.createElement("ul",{className:"k-list-ul",role:"listbox","aria-label":"listbox-container",onKeyDown:j},c.map((t,i)=>{const e=q(t),r={className:a.classNames("k-list-item",{"k-selected":e}),role:"option",key:i,id:P+i,"aria-selected":e,"data-uid":P+i,draggable:_,onDragStart:l=>{a.dispatchEvent(C,l,o(),{dataItem:t})},onDragOver:l=>{l.preventDefault(),a.dispatchEvent(F,l,o(),{dataItem:t})},onDrop:l=>{a.dispatchEvent(L,l,o(),{dataItem:t})},onClick:l=>{a.dispatchEvent(z,l,o(),{dataItem:t})}};return n.item?s.createElement(n.item,{selected:e,dataItem:t,...r,key:r.key},s.createElement("span",{className:"k-list-item-text"},t.name)):s.createElement("li",{...r,key:r.key},s.createElement("span",{className:"k-list-item-text"},A(t)))}))))),s.createElement("select",{style:{display:"none"},multiple:!0,"data-role":"listbox"},c.map((t,i)=>{const e=t[S||h];return s.createElement("option",{key:i,value:e},e)})))}),E={toolbarPosition:R.toolbarPosition.RIGHT,draggable:!0,size:"medium"};k.propTypes={size:u.oneOf([null,"small","medium","large"]),toolbarPosition:u.oneOf(["none","top","bottom","left","right"]),textField:u.string.isRequired,valueField:u.string,selectedField:u.string,data:u.array.isRequired};k.displayName="ListBoxInner";exports.ListBox=k;
|
package/ListBox.mjs
CHANGED
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import * as a from "react";
|
|
9
9
|
import f from "prop-types";
|
|
10
|
-
import {
|
|
10
|
+
import { kendoThemeMaps as V, Navigation as j, dispatchEvent as s, classNames as k } from "@progress/kendo-react-common";
|
|
11
11
|
import { toolbarPosition as O } from "./interfaces/Enums.mjs";
|
|
12
|
-
import { packageMetadata as Q } from "./package-metadata.mjs";
|
|
13
12
|
const R = a.forwardRef((n, T) => {
|
|
14
|
-
V(Q);
|
|
15
13
|
const {
|
|
16
14
|
id: D,
|
|
17
15
|
style: F,
|
|
@@ -20,17 +18,17 @@ const R = a.forwardRef((n, T) => {
|
|
|
20
18
|
className: L,
|
|
21
19
|
valueField: C,
|
|
22
20
|
selectedField: K,
|
|
23
|
-
onDrop:
|
|
21
|
+
onDrop: z,
|
|
24
22
|
onKeyDown: x,
|
|
25
|
-
onDragStart:
|
|
26
|
-
onDragLeave:
|
|
27
|
-
onDragOver:
|
|
23
|
+
onDragStart: S,
|
|
24
|
+
onDragLeave: N,
|
|
25
|
+
onDragOver: v,
|
|
28
26
|
onItemClick: A,
|
|
29
27
|
onItemSelect: d,
|
|
30
28
|
onKeyboardNavigate: m,
|
|
31
29
|
size: u = g.size,
|
|
32
30
|
draggable: $ = g.draggable,
|
|
33
|
-
toolbarPosition:
|
|
31
|
+
toolbarPosition: p = g.toolbarPosition
|
|
34
32
|
} = n, E = a.useRef(null), h = a.useRef(null), w = a.useRef(null), o = a.useCallback(
|
|
35
33
|
() => ({
|
|
36
34
|
element: w.current,
|
|
@@ -39,21 +37,21 @@ const R = a.forwardRef((n, T) => {
|
|
|
39
37
|
[]
|
|
40
38
|
);
|
|
41
39
|
a.useImperativeHandle(h, o), a.useImperativeHandle(T, () => h.current);
|
|
42
|
-
const I = D + "-accessibility-id", P =
|
|
40
|
+
const I = D + "-accessibility-id", P = V.sizeMap[u] || u, B = (t) => {
|
|
43
41
|
if (K)
|
|
44
42
|
return !!t[K];
|
|
45
|
-
}, H = (t) => b ? t[b] : t.toString(),
|
|
43
|
+
}, H = (t) => b ? t[b] : t.toString(), _ = (t) => {
|
|
46
44
|
x && s(x, t, o(), void 0);
|
|
47
|
-
},
|
|
45
|
+
}, M = (t) => {
|
|
48
46
|
t.target.classList.contains("k-list-content") && (n.data.length > 0 ? s(n.onDrop, t, o(), {
|
|
49
47
|
dataItem: n.data[n.data.length - 1]
|
|
50
48
|
}) : s(n.onDrop, t, o(), {
|
|
51
49
|
dataItem: null
|
|
52
50
|
}));
|
|
53
|
-
}, q = () =>
|
|
54
|
-
|
|
51
|
+
}, q = () => p === O.NONE || n.toolbar === void 0 ? `k-listbox-actions-${g.toolbarPosition}` : `k-listbox-actions-${p}`, G = (t) => {
|
|
52
|
+
N && t.target.classList.contains("k-list-content") && s(N, t, o(), void 0);
|
|
55
53
|
}, y = a.useMemo(
|
|
56
|
-
() => new
|
|
54
|
+
() => new j({
|
|
57
55
|
root: E,
|
|
58
56
|
selectors: [".k-list-item"],
|
|
59
57
|
tabIndex: 0,
|
|
@@ -135,7 +133,7 @@ const R = a.forwardRef((n, T) => {
|
|
|
135
133
|
"data-role": "selectable",
|
|
136
134
|
ref: E,
|
|
137
135
|
onDragOver: (t) => t.preventDefault(),
|
|
138
|
-
onDrop:
|
|
136
|
+
onDrop: M,
|
|
139
137
|
onDragLeave: G,
|
|
140
138
|
onKeyDown: U
|
|
141
139
|
},
|
|
@@ -145,7 +143,7 @@ const R = a.forwardRef((n, T) => {
|
|
|
145
143
|
className: "k-list-ul",
|
|
146
144
|
role: "listbox",
|
|
147
145
|
"aria-label": "listbox-container",
|
|
148
|
-
onKeyDown:
|
|
146
|
+
onKeyDown: _
|
|
149
147
|
},
|
|
150
148
|
c.map((t, i) => {
|
|
151
149
|
const e = B(t), r = {
|
|
@@ -158,17 +156,17 @@ const R = a.forwardRef((n, T) => {
|
|
|
158
156
|
draggable: $,
|
|
159
157
|
onDragStart: (l) => {
|
|
160
158
|
s(
|
|
161
|
-
|
|
159
|
+
S,
|
|
162
160
|
l,
|
|
163
161
|
o(),
|
|
164
162
|
{ dataItem: t }
|
|
165
163
|
);
|
|
166
164
|
},
|
|
167
165
|
onDragOver: (l) => {
|
|
168
|
-
l.preventDefault(), s(
|
|
166
|
+
l.preventDefault(), s(v, l, o(), { dataItem: t });
|
|
169
167
|
},
|
|
170
168
|
onDrop: (l) => {
|
|
171
|
-
s(
|
|
169
|
+
s(z, l, o(), { dataItem: t });
|
|
172
170
|
},
|
|
173
171
|
onClick: (l) => {
|
|
174
172
|
s(A, l, o(), { dataItem: t });
|
|
@@ -12,4 +12,4 @@
|
|
|
12
12
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
13
13
|
*-------------------------------------------------------------------------------------------
|
|
14
14
|
*/
|
|
15
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(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")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-buttons","@progress/kendo-react-intl","@progress/kendo-svg-icons"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactListbox={},e.React,e.PropTypes,e.KendoReactCommon,e.KendoReactButtons,e.KendoReactIntl,e.KendoSvgIcons)}(this,(function(e,t,a,o,n,r,s){"use strict";function l(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var o=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,o.get?o:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var i=l(t),c=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e))(c||{});const d={name:"@progress/kendo-react-listbox",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate:1607357111,version:"$VERSION",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},m=i.forwardRef(((e,t)=>{o.validatePackage(d);const{id:a,style:n,data:r,textField:s,className:l,valueField:m,selectedField:f,onDrop:p,onKeyDown:v,onDragStart:b,onDragLeave:g,onDragOver:x,onItemClick:D,onItemSelect:h,onKeyboardNavigate:k,size:y=u.size,draggable:I=u.draggable,toolbarPosition:E=u.toolbarPosition}=e,w=i.useRef(null),T=i.useRef(null),N=i.useRef(null),B=i.useCallback((()=>({element:N.current,props:e})),[]);i.useImperativeHandle(T,B),i.useImperativeHandle(t,(()=>T.current));const O=a+"-accessibility-id",K=o.kendoThemeMaps.sizeMap[y]||y,A=i.useMemo((()=>new o.Navigation({root:w,selectors:[".k-list-item"],tabIndex:0,keyboardEvents:{keydown:{Space:(e,t,a)=>{const n=t.elements.indexOf(e);a.metaKey&&o.dispatchEvent(h,a,B(),{dataItem:r[n]}),o.dispatchEvent(h,a,B(),{dataItem:r[n]})},ArrowDown:(e,t,a)=>{if(a.metaKey&&a.shiftKey)o.dispatchEvent(k,a,B(),{actionName:"moveDown"});else if(a.metaKey&&!a.shiftKey)a.preventDefault(),t.focusNext(e);else if(!a.shiftKey||a.metaKey){a.preventDefault();const n=t.elements.indexOf(e),s=r[n+1];s&&(o.dispatchEvent(h,a,B(),{dataItem:s}),t.focusNext(e))}},ArrowUp:(e,t,a)=>{if(a.metaKey&&a.shiftKey)o.dispatchEvent(k,a,B(),{actionName:"moveUp"});else if(a.metaKey&&!a.shiftKey)a.preventDefault(),t.focusPrevious(e);else if(!a.shiftKey||a.metaKey){a.preventDefault();const n=t.elements.indexOf(e),s=r[n-1];s&&(o.dispatchEvent(h,a,B(),{dataItem:s}),t.focusPrevious(e))}},ArrowLeft:(e,t,a)=>{a.metaKey&&a.shiftKey?o.dispatchEvent(k,a,B(),{actionName:"transferAllFrom"}):a.metaKey&&o.dispatchEvent(k,a,B(),{actionName:"transferFrom"})},ArrowRight:(e,t,a)=>{a.metaKey&&a.shiftKey?o.dispatchEvent(k,a,B(),{actionName:"transferAllTo"}):a.metaKey&&o.dispatchEvent(k,a,B(),{actionName:"transferTo"})},Backspace:(e,t,a)=>{o.dispatchEvent(k,a,B(),{actionName:"remove"})}}}})),[r]),R=i.useCallback(A.triggerKeyboardEvent.bind(A),[r]);return i.useEffect((()=>(A.initializeRovingTab(),()=>A.removeFocusListener())),[r]),i.createElement("div",{id:a,ref:N,style:n,unselectable:"on",className:o.classNames(l,"k-listbox",{[`k-listbox-${K}`]:y},E===c.NONE||void 0===e.toolbar?`k-listbox-actions-${u.toolbarPosition}`:`k-listbox-actions-${E}`)},e.toolbar&&i.createElement(e.toolbar,null),i.createElement("div",{className:"k-list-scroller k-selectable","data-role":"selectable",ref:w,onDragOver:e=>e.preventDefault(),onDrop:t=>{t.target.classList.contains("k-list-content")&&(e.data.length>0?o.dispatchEvent(e.onDrop,t,B(),{dataItem:e.data[e.data.length-1]}):o.dispatchEvent(e.onDrop,t,B(),{dataItem:null}))},onDragLeave:e=>{g&&e.target.classList.contains("k-list-content")&&o.dispatchEvent(g,e,B(),void 0)},onKeyDown:R},i.createElement("div",{className:o.classNames("k-list",{[`k-list-${K}`]:y})},i.createElement("div",{className:"k-list-content"},i.createElement("ul",{className:"k-list-ul",role:"listbox","aria-label":"listbox-container",onKeyDown:e=>{v&&o.dispatchEvent(v,e,B(),void 0)}},r.map(((t,a)=>{const n=(e=>{if(f)return!!e[f]})(t),r={className:o.classNames("k-list-item",{"k-selected":n}),role:"option",key:a,id:O+a,"aria-selected":n,"data-uid":O+a,draggable:I,onDragStart:e=>{o.dispatchEvent(b,e,B(),{dataItem:t})},onDragOver:e=>{e.preventDefault(),o.dispatchEvent(x,e,B(),{dataItem:t})},onDrop:e=>{o.dispatchEvent(p,e,B(),{dataItem:t})},onClick:e=>{o.dispatchEvent(D,e,B(),{dataItem:t})}};return e.item?i.createElement(e.item,{selected:n,dataItem:t,...r,key:r.key},i.createElement("span",{className:"k-list-item-text"},t.name)):i.createElement("li",{...r,key:r.key},i.createElement("span",{className:"k-list-item-text"},(e=>s?e[s]:e.toString())(t)))})))))),i.createElement("select",{style:{display:"none"},multiple:!0,"data-role":"listbox"},r.map(((e,t)=>{const a=e[m||s];return i.createElement("option",{key:t,value:a},a)}))))})),u={toolbarPosition:c.RIGHT,draggable:!0,size:"medium"};m.propTypes={size:a.oneOf([null,"small","medium","large"]),toolbarPosition:a.oneOf(["none","top","bottom","left","right"]),textField:a.string.isRequired,valueField:a.string,selectedField:a.string,data:a.array.isRequired},m.displayName="ListBoxInner";const f={"listbox.moveUp":"Move Up","listbox.moveDown":"Move Down","listbox.transferTo":"Transfer To","listbox.transferFrom":"Transfer From","listbox.transferAllTo":"Transfer All To","listbox.transferAllFrom":"Transfer All From","listbox.remove":"Delete"},p=[{name:"moveUp",iconName:"caret-alt-up",svgIcon:s.caretAltUpIcon},{name:"moveDown",iconName:"caret-alt-down",svgIcon:s.caretAltDownIcon},{name:"transferTo",iconName:"caret-alt-right",svgIcon:s.caretAltRightIcon},{name:"transferFrom",iconName:"caret-alt-left",svgIcon:s.caretAltLeftIcon},{name:"transferAllTo",iconName:"caret-double-alt-right",svgIcon:s.caretDoubleAltRightIcon},{name:"transferAllFrom",iconName:"caret-double-alt-left",svgIcon:s.caretDoubleAltLeftIcon},{name:"remove",iconName:"x",svgIcon:s.xIcon}],v=i.forwardRef(((e,t)=>{const{tools:a,dir:l,onToolClick:c,size:d=b.size,data:m=b.data,dataConnected:u=b.dataConnected,selectedField:v=b.selectedField}=e,g=r.useLocalization(),x=i.useRef(null),D=i.useRef(null),h=i.useCallback((()=>({onToolClick:c,props:e,context:{},state:{},refs:{}})),[]);i.useImperativeHandle(D,h),i.useImperativeHandle(t,(()=>D.current));const k=(e,t,a)=>{a.preventDefault(),t.focusNext(e)},y=(e,t,a)=>{a.preventDefault(),t.focusPrevious(e)},I=i.useMemo((()=>new o.Navigation({root:x,selectors:[".k-button:not([disabled])"],tabIndex:0,keyboardEvents:{keydown:{ArrowDown:k,ArrowRight:k,ArrowUp:y,ArrowLeft:y,Enter:(e,t,a)=>{e.click(),t.focusElement(t.current,e)}}}})),[]),E=i.useCallback(I.triggerKeyboardEvent.bind(I),[]);i.useEffect((()=>(I.initializeRovingTab(),()=>I.removeFocusListener())),[]);const w=e=>{switch(e.name){case"caret-alt-right":return s.caretAltLeftIcon;case"caret-alt-left":return s.caretAltRightIcon;case"caret-double-alt-right":return s.caretDoubleAltLeftIcon;case"caret-double-alt-left":return s.caretDoubleAltRightIcon}return e},T=e=>{switch(e){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 e},N="rtl"===l;return i.createElement("div",{className:o.classNames("k-listbox-actions"),ref:x,onKeyDown:E},a&&a.map(((e,t)=>{const a=p.findIndex((t=>t.name===e)),r=p[a],s=(e=>{let t=!0;const a=v||"selected",o=m.length,n=u.length,r=m.findIndex((e=>!0===e[a]))>=0,s=u.findIndex((e=>!0===e[a]))>=0;switch(e){case"moveUp":t=r?!(m.length>0)||m[0].selected:!s||!(u.length>0)||u[0].selected;break;case"moveDown":t=r?!m[o-1]||m[o-1].selected:!s||!(u.length>0)||u[n-1].selected;break;case"transferTo":t=!(u&&r);break;case"transferFrom":t=!u||!(u&&s);break;case"transferAllTo":t=!(u&&m.length>0);break;case"transferAllFrom":t=!(u&&u.length>0);break;case"remove":t=!(r||s)}return t})(r.name),l=`listbox.${r.name}`,b=g.toLanguageString(l,f[l]);return i.createElement(n.Button,{size:d,key:t,disabled:s,"data-command":r.name,title:b,"aria-label":b,icon:N?T(r.iconName):r.iconName,svgIcon:N?w(r.svgIcon):r.svgIcon,onClick:e=>{e.preventDefault(),((e,t)=>{o.dispatchEvent(c,e,h(),{toolName:t})})(e,r.name)}})})))})),b={data:[],dataConnected:[],selectedField:"selected",size:"medium"};v.propTypes={data:a.array.isRequired,dataConnected:a.array.isRequired,tools:a.array,selectedField:a.string,dir:a.string,size:a.oneOf([null,"small","medium","large"])},v.displayName="ListBoxToolbarInner";const g=(e,t,a)=>{const o=a.splice(e,1)[0];return a.splice(t,0,o),a},x=o.withIdHOC(m);x.displayName="KendoReactListBox",e.ListBox=x,e.ListBoxToolbar=v,e.moveItem=g,e.processListBoxData=(e=[],t=[],a,o)=>{let n=[],r=[],s=[];const l={listBoxOneData:e,listBoxTwoData:t};switch(a){case"moveUp":n=[...e],n.forEach(((e,t)=>{e[o]&&(n=g(t,t-1,n))})),s=[...t],s.forEach(((e,t)=>{e[o]&&(s=g(t,t-1,s))})),l.listBoxOneData=n,l.listBoxTwoData=s;break;case"moveDown":n=e.reverse(),n.forEach(((e,t)=>{e[o]&&(n=g(t,t-1,n))})),s=t.reverse(),s.forEach(((e,t)=>{e[o]&&(s=g(t,t-1,s))})),l.listBoxOneData=[...n].reverse(),l.listBoxTwoData=[...s].reverse();break;case"transferTo":n=e.filter((e=>!e[o])),r=e.filter((e=>e[o])),s=t.concat(r),l.listBoxOneData=n,l.listBoxTwoData=s;break;case"transferFrom":s=t.filter((e=>!e[o])),r=t.filter((e=>e[o])),n=e.concat(r),l.listBoxOneData=n,l.listBoxTwoData=s;break;case"transferAllTo":l.listBoxOneData=[],l.listBoxTwoData=t.concat(e);break;case"transferAllFrom":l.listBoxOneData=t.concat(e),l.listBoxTwoData=[];break;case"remove":s=t.filter((e=>!e[o])),n=e.filter((e=>!e[o])),l.listBoxOneData=n,l.listBoxTwoData=s}return l},e.processListBoxDragAndDrop=(e=[],t=[],a,o,n)=>{const r=e.findIndex((e=>e[n]===a[n])),s=t.findIndex((e=>e[n]===a[n])),l=null!==o?e.findIndex((e=>e[n]===o[n])):-1,i=null!==o?t.findIndex((e=>e[n]===o[n])):-1,c=r>=0,d=s>=0,m=l>=0,u=i>=0,f=[...e],p=[...t];return c&&m?{listBoxOneData:g(r,l,e),listBoxTwoData:t}:d&&u?{listBoxOneData:e,listBoxTwoData:g(s,i,t)}:c&&(u||null===o)?(null===o?p.push(e[r]):p.splice(i+1,0,e[r]),f.splice(r,1),{listBoxOneData:f,listBoxTwoData:p}):d&&(m||null===o)?(null===o?f.push(t[s]):f.splice(l+1,0,t[s]),p.splice(s,1),{listBoxOneData:f,listBoxTwoData:p}):{listBoxOneData:e,listBoxTwoData:t}}}));
|
|
15
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(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")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@progress/kendo-react-common","@progress/kendo-react-buttons","@progress/kendo-react-intl","@progress/kendo-svg-icons"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoReactListbox={},e.React,e.PropTypes,e.KendoReactCommon,e.KendoReactButtons,e.KendoReactIntl,e.KendoSvgIcons)}(this,(function(e,t,a,o,n,r,s){"use strict";function l(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(a){if("default"!==a){var o=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,o.get?o:{enumerable:!0,get:function(){return e[a]}})}})),t.default=e,Object.freeze(t)}var i=l(t),c=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e))(c||{});const d=i.forwardRef(((e,t)=>{const{id:a,style:n,data:r,textField:s,className:l,valueField:d,selectedField:u,onDrop:f,onKeyDown:p,onDragStart:v,onDragLeave:b,onDragOver:g,onItemClick:x,onItemSelect:h,onKeyboardNavigate:D,size:k=m.size,draggable:y=m.draggable,toolbarPosition:I=m.toolbarPosition}=e,E=i.useRef(null),w=i.useRef(null),T=i.useRef(null),N=i.useCallback((()=>({element:T.current,props:e})),[]);i.useImperativeHandle(w,N),i.useImperativeHandle(t,(()=>w.current));const B=a+"-accessibility-id",O=o.kendoThemeMaps.sizeMap[k]||k,K=i.useMemo((()=>new o.Navigation({root:E,selectors:[".k-list-item"],tabIndex:0,keyboardEvents:{keydown:{Space:(e,t,a)=>{const n=t.elements.indexOf(e);a.metaKey&&o.dispatchEvent(h,a,N(),{dataItem:r[n]}),o.dispatchEvent(h,a,N(),{dataItem:r[n]})},ArrowDown:(e,t,a)=>{if(a.metaKey&&a.shiftKey)o.dispatchEvent(D,a,N(),{actionName:"moveDown"});else if(a.metaKey&&!a.shiftKey)a.preventDefault(),t.focusNext(e);else if(!a.shiftKey||a.metaKey){a.preventDefault();const n=t.elements.indexOf(e),s=r[n+1];s&&(o.dispatchEvent(h,a,N(),{dataItem:s}),t.focusNext(e))}},ArrowUp:(e,t,a)=>{if(a.metaKey&&a.shiftKey)o.dispatchEvent(D,a,N(),{actionName:"moveUp"});else if(a.metaKey&&!a.shiftKey)a.preventDefault(),t.focusPrevious(e);else if(!a.shiftKey||a.metaKey){a.preventDefault();const n=t.elements.indexOf(e),s=r[n-1];s&&(o.dispatchEvent(h,a,N(),{dataItem:s}),t.focusPrevious(e))}},ArrowLeft:(e,t,a)=>{a.metaKey&&a.shiftKey?o.dispatchEvent(D,a,N(),{actionName:"transferAllFrom"}):a.metaKey&&o.dispatchEvent(D,a,N(),{actionName:"transferFrom"})},ArrowRight:(e,t,a)=>{a.metaKey&&a.shiftKey?o.dispatchEvent(D,a,N(),{actionName:"transferAllTo"}):a.metaKey&&o.dispatchEvent(D,a,N(),{actionName:"transferTo"})},Backspace:(e,t,a)=>{o.dispatchEvent(D,a,N(),{actionName:"remove"})}}}})),[r]),A=i.useCallback(K.triggerKeyboardEvent.bind(K),[r]);return i.useEffect((()=>(K.initializeRovingTab(),()=>K.removeFocusListener())),[r]),i.createElement("div",{id:a,ref:T,style:n,unselectable:"on",className:o.classNames(l,"k-listbox",{[`k-listbox-${O}`]:k},I===c.NONE||void 0===e.toolbar?`k-listbox-actions-${m.toolbarPosition}`:`k-listbox-actions-${I}`)},e.toolbar&&i.createElement(e.toolbar,null),i.createElement("div",{className:"k-list-scroller k-selectable","data-role":"selectable",ref:E,onDragOver:e=>e.preventDefault(),onDrop:t=>{t.target.classList.contains("k-list-content")&&(e.data.length>0?o.dispatchEvent(e.onDrop,t,N(),{dataItem:e.data[e.data.length-1]}):o.dispatchEvent(e.onDrop,t,N(),{dataItem:null}))},onDragLeave:e=>{b&&e.target.classList.contains("k-list-content")&&o.dispatchEvent(b,e,N(),void 0)},onKeyDown:A},i.createElement("div",{className:o.classNames("k-list",{[`k-list-${O}`]:k})},i.createElement("div",{className:"k-list-content"},i.createElement("ul",{className:"k-list-ul",role:"listbox","aria-label":"listbox-container",onKeyDown:e=>{p&&o.dispatchEvent(p,e,N(),void 0)}},r.map(((t,a)=>{const n=(e=>{if(u)return!!e[u]})(t),r={className:o.classNames("k-list-item",{"k-selected":n}),role:"option",key:a,id:B+a,"aria-selected":n,"data-uid":B+a,draggable:y,onDragStart:e=>{o.dispatchEvent(v,e,N(),{dataItem:t})},onDragOver:e=>{e.preventDefault(),o.dispatchEvent(g,e,N(),{dataItem:t})},onDrop:e=>{o.dispatchEvent(f,e,N(),{dataItem:t})},onClick:e=>{o.dispatchEvent(x,e,N(),{dataItem:t})}};return e.item?i.createElement(e.item,{selected:n,dataItem:t,...r,key:r.key},i.createElement("span",{className:"k-list-item-text"},t.name)):i.createElement("li",{...r,key:r.key},i.createElement("span",{className:"k-list-item-text"},(e=>s?e[s]:e.toString())(t)))})))))),i.createElement("select",{style:{display:"none"},multiple:!0,"data-role":"listbox"},r.map(((e,t)=>{const a=e[d||s];return i.createElement("option",{key:t,value:a},a)}))))})),m={toolbarPosition:c.RIGHT,draggable:!0,size:"medium"};d.propTypes={size:a.oneOf([null,"small","medium","large"]),toolbarPosition:a.oneOf(["none","top","bottom","left","right"]),textField:a.string.isRequired,valueField:a.string,selectedField:a.string,data:a.array.isRequired},d.displayName="ListBoxInner";const u={"listbox.moveUp":"Move Up","listbox.moveDown":"Move Down","listbox.transferTo":"Transfer To","listbox.transferFrom":"Transfer From","listbox.transferAllTo":"Transfer All To","listbox.transferAllFrom":"Transfer All From","listbox.remove":"Delete"},f=[{name:"moveUp",iconName:"caret-alt-up",svgIcon:s.caretAltUpIcon},{name:"moveDown",iconName:"caret-alt-down",svgIcon:s.caretAltDownIcon},{name:"transferTo",iconName:"caret-alt-right",svgIcon:s.caretAltRightIcon},{name:"transferFrom",iconName:"caret-alt-left",svgIcon:s.caretAltLeftIcon},{name:"transferAllTo",iconName:"caret-double-alt-right",svgIcon:s.caretDoubleAltRightIcon},{name:"transferAllFrom",iconName:"caret-double-alt-left",svgIcon:s.caretDoubleAltLeftIcon},{name:"remove",iconName:"x",svgIcon:s.xIcon}],p=i.forwardRef(((e,t)=>{const{tools:a,dir:l,onToolClick:c,size:d=v.size,data:m=v.data,dataConnected:p=v.dataConnected,selectedField:b=v.selectedField}=e,g=r.useLocalization(),x=i.useRef(null),h=i.useRef(null),D=i.useCallback((()=>({onToolClick:c,props:e,context:{},state:{},refs:{}})),[]);i.useImperativeHandle(h,D),i.useImperativeHandle(t,(()=>h.current));const k=(e,t,a)=>{a.preventDefault(),t.focusNext(e)},y=(e,t,a)=>{a.preventDefault(),t.focusPrevious(e)},I=i.useMemo((()=>new o.Navigation({root:x,selectors:[".k-button:not([disabled])"],tabIndex:0,keyboardEvents:{keydown:{ArrowDown:k,ArrowRight:k,ArrowUp:y,ArrowLeft:y,Enter:(e,t,a)=>{e.click(),t.focusElement(t.current,e)}}}})),[]),E=i.useCallback(I.triggerKeyboardEvent.bind(I),[]);i.useEffect((()=>(I.initializeRovingTab(),()=>I.removeFocusListener())),[]);const w=e=>{switch(e.name){case"caret-alt-right":return s.caretAltLeftIcon;case"caret-alt-left":return s.caretAltRightIcon;case"caret-double-alt-right":return s.caretDoubleAltLeftIcon;case"caret-double-alt-left":return s.caretDoubleAltRightIcon}return e},T=e=>{switch(e){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 e},N="rtl"===l;return i.createElement("div",{className:o.classNames("k-listbox-actions"),ref:x,onKeyDown:E},a&&a.map(((e,t)=>{const a=f.findIndex((t=>t.name===e)),r=f[a],s=(e=>{let t=!0;const a=b||"selected",o=m.length,n=p.length,r=m.findIndex((e=>!0===e[a]))>=0,s=p.findIndex((e=>!0===e[a]))>=0;switch(e){case"moveUp":t=r?!(m.length>0)||m[0].selected:!s||!(p.length>0)||p[0].selected;break;case"moveDown":t=r?!m[o-1]||m[o-1].selected:!s||!(p.length>0)||p[n-1].selected;break;case"transferTo":t=!(p&&r);break;case"transferFrom":t=!p||!(p&&s);break;case"transferAllTo":t=!(p&&m.length>0);break;case"transferAllFrom":t=!(p&&p.length>0);break;case"remove":t=!(r||s)}return t})(r.name),l=`listbox.${r.name}`,v=g.toLanguageString(l,u[l]);return i.createElement(n.Button,{size:d,key:t,disabled:s,"data-command":r.name,title:v,"aria-label":v,icon:N?T(r.iconName):r.iconName,svgIcon:N?w(r.svgIcon):r.svgIcon,onClick:e=>{e.preventDefault(),((e,t)=>{o.dispatchEvent(c,e,D(),{toolName:t})})(e,r.name)}})})))})),v={data:[],dataConnected:[],selectedField:"selected",size:"medium"};p.propTypes={data:a.array.isRequired,dataConnected:a.array.isRequired,tools:a.array,selectedField:a.string,dir:a.string,size:a.oneOf([null,"small","medium","large"])},p.displayName="ListBoxToolbarInner";const b=(e,t,a)=>{const o=a.splice(e,1)[0];return a.splice(t,0,o),a},g=o.withIdHOC(d);g.displayName="KendoReactListBox",e.ListBox=g,e.ListBoxToolbar=p,e.moveItem=b,e.processListBoxData=(e=[],t=[],a,o)=>{let n=[],r=[],s=[];const l={listBoxOneData:e,listBoxTwoData:t};switch(a){case"moveUp":n=[...e],n.forEach(((e,t)=>{e[o]&&(n=b(t,t-1,n))})),s=[...t],s.forEach(((e,t)=>{e[o]&&(s=b(t,t-1,s))})),l.listBoxOneData=n,l.listBoxTwoData=s;break;case"moveDown":n=e.reverse(),n.forEach(((e,t)=>{e[o]&&(n=b(t,t-1,n))})),s=t.reverse(),s.forEach(((e,t)=>{e[o]&&(s=b(t,t-1,s))})),l.listBoxOneData=[...n].reverse(),l.listBoxTwoData=[...s].reverse();break;case"transferTo":n=e.filter((e=>!e[o])),r=e.filter((e=>e[o])),s=t.concat(r),l.listBoxOneData=n,l.listBoxTwoData=s;break;case"transferFrom":s=t.filter((e=>!e[o])),r=t.filter((e=>e[o])),n=e.concat(r),l.listBoxOneData=n,l.listBoxTwoData=s;break;case"transferAllTo":l.listBoxOneData=[],l.listBoxTwoData=t.concat(e);break;case"transferAllFrom":l.listBoxOneData=t.concat(e),l.listBoxTwoData=[];break;case"remove":s=t.filter((e=>!e[o])),n=e.filter((e=>!e[o])),l.listBoxOneData=n,l.listBoxTwoData=s}return l},e.processListBoxDragAndDrop=(e=[],t=[],a,o,n)=>{const r=e.findIndex((e=>e[n]===a[n])),s=t.findIndex((e=>e[n]===a[n])),l=null!==o?e.findIndex((e=>e[n]===o[n])):-1,i=null!==o?t.findIndex((e=>e[n]===o[n])):-1,c=r>=0,d=s>=0,m=l>=0,u=i>=0,f=[...e],p=[...t];return c&&m?{listBoxOneData:b(r,l,e),listBoxTwoData:t}:d&&u?{listBoxOneData:e,listBoxTwoData:b(s,i,t)}:c&&(u||null===o)?(null===o?p.push(e[r]):p.splice(i+1,0,e[r]),f.splice(r,1),{listBoxOneData:f,listBoxTwoData:p}):d&&(m||null===o)?(null===o?f.push(t[s]):f.splice(l+1,0,t[s]),p.splice(s,1),{listBoxOneData:f,listBoxTwoData:p}):{listBoxOneData:e,listBoxTwoData:t}}}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-listbox",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-develop.1",
|
|
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",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"sideEffects": false,
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@progress/kendo-licensing": "^1.5.0",
|
|
29
|
-
"@progress/kendo-react-buttons": "
|
|
30
|
-
"@progress/kendo-react-common": "
|
|
31
|
-
"@progress/kendo-react-intl": "
|
|
29
|
+
"@progress/kendo-react-buttons": "10.0.0-develop.1",
|
|
30
|
+
"@progress/kendo-react-common": "10.0.0-develop.1",
|
|
31
|
+
"@progress/kendo-react-intl": "10.0.0-develop.1",
|
|
32
32
|
"@progress/kendo-svg-icons": "^4.0.0",
|
|
33
33
|
"react": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",
|
|
34
34
|
"react-dom": "^16.8.2 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc"
|
|
@@ -50,13 +50,7 @@
|
|
|
50
50
|
],
|
|
51
51
|
"@progress": {
|
|
52
52
|
"friendlyName": "ListBox",
|
|
53
|
-
"framework": "KendoReact"
|
|
54
|
-
"package": {
|
|
55
|
-
"productName": "KendoReact",
|
|
56
|
-
"productCode": "KENDOUIREACT",
|
|
57
|
-
"publishDate": 1741088125,
|
|
58
|
-
"licensingDocsUrl": "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
59
|
-
}
|
|
53
|
+
"framework": "KendoReact"
|
|
60
54
|
},
|
|
61
55
|
"publishConfig": {
|
|
62
56
|
"access": "public"
|
package/package-metadata.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
*-------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
-
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
-
*-------------------------------------------------------------------------------------------
|
|
7
|
-
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={name:"@progress/kendo-react-listbox",productName:"KendoReact",productCode:"KENDOUIREACT",productCodes:["KENDOUIREACT"],publishDate: 1741088125,version:"9.5.0-develop.6",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"};exports.packageMetadata=e;
|
package/package-metadata.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
*-------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
5
|
-
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
-
*-------------------------------------------------------------------------------------------
|
|
7
|
-
*/
|
|
8
|
-
const e = {
|
|
9
|
-
name: "@progress/kendo-react-listbox",
|
|
10
|
-
productName: "KendoReact",
|
|
11
|
-
productCode: "KENDOUIREACT",
|
|
12
|
-
productCodes: ["KENDOUIREACT"],
|
|
13
|
-
publishDate: 1741088125,
|
|
14
|
-
version: "9.5.0-develop.6",
|
|
15
|
-
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
e as packageMetadata
|
|
19
|
-
};
|