@progress/kendo-react-listbox 8.1.1 → 8.2.0-develop.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ListBox.js +1 -1
- package/ListBox.mjs +153 -91
- package/ListBoxToolbar.js +1 -1
- package/ListBoxToolbar.mjs +137 -117
- package/dist/cdn/js/kendo-react-listbox.js +1 -1
- package/index.d.mts +52 -63
- package/index.d.ts +52 -63
- package/package-metadata.mjs +1 -1
- package/package.json +4 -4
- package/utils.mjs +1 -4
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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"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"),U=require("./package-metadata.js");function V(o){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const m in o)if(m!=="default"){const g=Object.getOwnPropertyDescriptor(o,m);Object.defineProperty(f,m,g.get?g:{enumerable:!0,get:()=>o[m]})}}return f.default=o,Object.freeze(f)}const s=V(G),D=s.forwardRef((o,f)=>{a.validatePackage(U.packageMetadata);const{id:m,style:g,data:c,textField:h,className:T,valueField:S,selectedField:v,onDrop:L,onKeyDown:N,onDragStart:C,onDragLeave:K,onDragOver:F,onItemClick:z,onItemSelect:y,onKeyboardNavigate:d,size:b=k.size,draggable:q=k.draggable,toolbarPosition:p=k.toolbarPosition}=o,x=s.useRef(null),O=s.useRef(null),w=s.useRef(null),n=s.useCallback(()=>({element:w.current,props:o}),[]);s.useImperativeHandle(O,n),s.useImperativeHandle(f,()=>O.current);const P=m+"-accessibility-id",I=a.kendoThemeMaps.sizeMap[b]||b,M=t=>{if(v)return!!t[v]},_=t=>h?t[h]:t.toString(),A=t=>{N&&a.dispatchEvent(N,t,n(),void 0)},j=t=>{t.target.classList.contains("k-list-content")&&(o.data.length>0?a.dispatchEvent(o.onDrop,t,n(),{dataItem:o.data[o.data.length-1]}):a.dispatchEvent(o.onDrop,t,n(),{dataItem:null}))},B=()=>p===R.toolbarPosition.NONE||o.toolbar===void 0?"":`k-listbox-actions-${p}`,H=t=>{K&&t.target.classList.contains("k-list-content")&&a.dispatchEvent(K,t,n(),void 0)},E=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(y,e,n(),{dataItem:c[r]}),a.dispatchEvent(y,e,n(),{dataItem:c[r]})},ArrowDown:(t,i,e)=>{if(e.metaKey&&e.shiftKey)a.dispatchEvent(d,e,n(),{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(y,e,n(),{dataItem:l}),i.focusNext(t))}},ArrowUp:(t,i,e)=>{if(e.metaKey&&e.shiftKey)a.dispatchEvent(d,e,n(),{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(y,e,n(),{dataItem:l}),i.focusPrevious(t))}},ArrowLeft:(t,i,e)=>{e.metaKey&&e.shiftKey?a.dispatchEvent(d,e,n(),{actionName:"transferAllFrom"}):e.metaKey&&a.dispatchEvent(d,e,n(),{actionName:"transferFrom"})},ArrowRight:(t,i,e)=>{e.metaKey&&e.shiftKey?a.dispatchEvent(d,e,n(),{actionName:"transferAllTo"}):e.metaKey&&a.dispatchEvent(d,e,n(),{actionName:"transferTo"})},Backspace:(t,i,e)=>{a.dispatchEvent(d,e,n(),{actionName:"remove"})}}}}),[c]),$=s.useCallback(E.triggerKeyboardEvent.bind(E),[c]);return s.useEffect(()=>(E.initializeRovingTab(),()=>E.removeFocusListener()),[c]),s.createElement("div",{id:m,ref:w,style:g,unselectable:"on",className:a.classNames(T,"k-listbox",{[`k-listbox-${I}`]:b},B())},o.toolbar&&p!=="bottom"&&s.createElement(o.toolbar,null),s.createElement("div",{className:"k-list-scroller k-selectable","data-role":"selectable",ref:x,onDragOver:t=>t.preventDefault(),onDrop:j,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:A},c.map((t,i)=>{const e=M(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:q,onDragStart:l=>{a.dispatchEvent(C,l,n(),{dataItem:t})},onDragOver:l=>{l.preventDefault(),a.dispatchEvent(F,l,n(),{dataItem:t})},onDrop:l=>{a.dispatchEvent(L,l,n(),{dataItem:t})},onClick:l=>{a.dispatchEvent(z,l,n(),{dataItem:t})}};return o.item?s.createElement(o.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"},_(t)))}))))),o.toolbar&&p==="bottom"&&s.createElement(o.toolbar,null),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)})))}),k={toolbarPosition:R.toolbarPosition.RIGHT,draggable:!0,size:"medium"};D.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};D.displayName="ListBoxInner";exports.ListBox=D;
|
package/ListBox.mjs
CHANGED
|
@@ -6,102 +6,164 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import { toolbarPosition as
|
|
13
|
-
import { packageMetadata as
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
9
|
+
import * as a from "react";
|
|
10
|
+
import f from "prop-types";
|
|
11
|
+
import { validatePackage as V, kendoThemeMaps as j, Navigation as J, dispatchEvent as l, classNames as k } from "@progress/kendo-react-common";
|
|
12
|
+
import { toolbarPosition as O } from "./interfaces/Enums.mjs";
|
|
13
|
+
import { packageMetadata as Q } from "./package-metadata.mjs";
|
|
14
|
+
const R = a.forwardRef((s, T) => {
|
|
15
|
+
V(Q);
|
|
16
|
+
const {
|
|
17
|
+
id: K,
|
|
18
|
+
style: F,
|
|
19
|
+
data: c,
|
|
20
|
+
textField: b,
|
|
21
|
+
className: L,
|
|
22
|
+
valueField: C,
|
|
23
|
+
selectedField: x,
|
|
24
|
+
onDrop: v,
|
|
25
|
+
onKeyDown: N,
|
|
26
|
+
onDragStart: z,
|
|
27
|
+
onDragLeave: p,
|
|
28
|
+
onDragOver: S,
|
|
29
|
+
onItemClick: A,
|
|
30
|
+
onItemSelect: d,
|
|
31
|
+
onKeyboardNavigate: m,
|
|
32
|
+
size: u = D.size,
|
|
33
|
+
draggable: B = D.draggable,
|
|
34
|
+
toolbarPosition: y = D.toolbarPosition
|
|
35
|
+
} = s, E = a.useRef(null), h = a.useRef(null), w = a.useRef(null), o = a.useCallback(() => ({
|
|
36
|
+
element: w.current,
|
|
37
|
+
props: s
|
|
38
|
+
}), []);
|
|
39
|
+
a.useImperativeHandle(h, o), a.useImperativeHandle(T, () => h.current);
|
|
40
|
+
const I = K + "-accessibility-id", P = j.sizeMap[u] || u, H = (t) => {
|
|
41
|
+
if (x)
|
|
42
|
+
return !!t[x];
|
|
43
|
+
}, M = (t) => b ? t[b] : t.toString(), _ = (t) => {
|
|
44
|
+
N && l(N, t, o(), void 0);
|
|
45
|
+
}, $ = (t) => {
|
|
46
|
+
t.target.classList.contains("k-list-content") && (s.data.length > 0 ? l(s.onDrop, t, o(), { dataItem: s.data[s.data.length - 1] }) : l(s.onDrop, t, o(), { dataItem: null }));
|
|
47
|
+
}, q = () => y === O.NONE || s.toolbar === void 0 ? "" : `k-listbox-actions-${y}`, G = (t) => {
|
|
48
|
+
p && t.target.classList.contains("k-list-content") && l(p, t, o(), void 0);
|
|
49
|
+
}, g = a.useMemo(
|
|
50
|
+
() => new J({
|
|
51
|
+
root: E,
|
|
52
|
+
selectors: [".k-list-item"],
|
|
53
|
+
tabIndex: 0,
|
|
54
|
+
keyboardEvents: {
|
|
55
|
+
keydown: {
|
|
56
|
+
Space: (t, i, e) => {
|
|
57
|
+
const r = i.elements.indexOf(t);
|
|
58
|
+
e.metaKey && l(d, e, o(), { dataItem: c[r] }), l(d, e, o(), { dataItem: c[r] });
|
|
59
|
+
},
|
|
60
|
+
ArrowDown: (t, i, e) => {
|
|
61
|
+
if (e.metaKey && e.shiftKey)
|
|
62
|
+
l(m, e, o(), { actionName: "moveDown" });
|
|
63
|
+
else if (e.metaKey && !e.shiftKey)
|
|
64
|
+
e.preventDefault(), i.focusNext(t);
|
|
65
|
+
else if (!(e.shiftKey && !e.metaKey)) {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
const r = i.elements.indexOf(t), n = c[r + 1];
|
|
68
|
+
n && (l(d, e, o(), { dataItem: n }), i.focusNext(t));
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
ArrowUp: (t, i, e) => {
|
|
72
|
+
if (e.metaKey && e.shiftKey)
|
|
73
|
+
l(m, e, o(), { actionName: "moveUp" });
|
|
74
|
+
else if (e.metaKey && !e.shiftKey)
|
|
75
|
+
e.preventDefault(), i.focusPrevious(t);
|
|
76
|
+
else if (!(e.shiftKey && !e.metaKey)) {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
const r = i.elements.indexOf(t), n = c[r - 1];
|
|
79
|
+
n && (l(d, e, o(), { dataItem: n }), i.focusPrevious(t));
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
ArrowLeft: (t, i, e) => {
|
|
83
|
+
e.metaKey && e.shiftKey ? l(m, e, o(), { actionName: "transferAllFrom" }) : e.metaKey && l(m, e, o(), { actionName: "transferFrom" });
|
|
84
|
+
},
|
|
85
|
+
ArrowRight: (t, i, e) => {
|
|
86
|
+
e.metaKey && e.shiftKey ? l(m, e, o(), { actionName: "transferAllTo" }) : e.metaKey && l(m, e, o(), { actionName: "transferTo" });
|
|
87
|
+
},
|
|
88
|
+
Backspace: (t, i, e) => {
|
|
89
|
+
l(m, e, o(), { actionName: "remove" });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}),
|
|
94
|
+
[c]
|
|
95
|
+
), U = a.useCallback(g.triggerKeyboardEvent.bind(g), [c]);
|
|
96
|
+
return a.useEffect(() => (g.initializeRovingTab(), () => g.removeFocusListener()), [c]), /* @__PURE__ */ a.createElement(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
id: K,
|
|
100
|
+
ref: w,
|
|
101
|
+
style: F,
|
|
102
|
+
unselectable: "on",
|
|
103
|
+
className: k(
|
|
104
|
+
L,
|
|
105
|
+
"k-listbox",
|
|
106
|
+
{ [`k-listbox-${P}`]: u },
|
|
107
|
+
q()
|
|
108
|
+
)
|
|
109
|
+
},
|
|
110
|
+
s.toolbar && y !== "bottom" && /* @__PURE__ */ a.createElement(s.toolbar, null),
|
|
111
|
+
/* @__PURE__ */ a.createElement(
|
|
36
112
|
"div",
|
|
37
113
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
style: this.props.style,
|
|
46
|
-
unselectable: "on"
|
|
114
|
+
className: "k-list-scroller k-selectable",
|
|
115
|
+
"data-role": "selectable",
|
|
116
|
+
ref: E,
|
|
117
|
+
onDragOver: (t) => t.preventDefault(),
|
|
118
|
+
onDrop: $,
|
|
119
|
+
onDragLeave: G,
|
|
120
|
+
onKeyDown: U
|
|
47
121
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return this.props.item ? /* @__PURE__ */ e.createElement(this.props.item, { selected: i, dataItem: t, ...n, key: n.key }, /* @__PURE__ */ e.createElement("span", { className: "k-list-item-text" }, t.name)) : /* @__PURE__ */ e.createElement("li", { ...n, key: n.key }, /* @__PURE__ */ e.createElement("span", { className: "k-list-item-text" }, this.renderItem(t)));
|
|
82
|
-
}))))
|
|
83
|
-
),
|
|
84
|
-
this.props.toolbar && this.props.toolbarPosition === "bottom" && /* @__PURE__ */ e.createElement(this.props.toolbar, null),
|
|
85
|
-
/* @__PURE__ */ e.createElement("select", { style: { display: "none" }, multiple: !0, "data-role": "listbox" }, this.props.data.map((t, a) => {
|
|
86
|
-
const i = t[this.props.valueField || this.props.textField];
|
|
87
|
-
return /* @__PURE__ */ e.createElement("option", { key: a, value: i }, i);
|
|
88
|
-
}))
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
p.propTypes = {
|
|
93
|
-
size: r.oneOf([null, "small", "medium", "large"]),
|
|
94
|
-
toolbarPosition: r.oneOf(["none", "top", "bottom", "left", "right"]),
|
|
95
|
-
textField: r.string,
|
|
96
|
-
valueField: r.string,
|
|
97
|
-
selectedField: r.string,
|
|
98
|
-
data: r.array
|
|
99
|
-
}, p.defaultProps = {
|
|
100
|
-
toolbarPosition: d.RIGHT,
|
|
122
|
+
/* @__PURE__ */ a.createElement("div", { className: k("k-list", { [`k-list-${P}`]: u }) }, /* @__PURE__ */ a.createElement("div", { className: "k-list-content" }, /* @__PURE__ */ a.createElement("ul", { className: "k-list-ul", role: "listbox", "aria-label": "listbox-container", onKeyDown: _ }, c.map((t, i) => {
|
|
123
|
+
const e = H(t), r = {
|
|
124
|
+
className: k("k-list-item", { "k-selected": e }),
|
|
125
|
+
role: "option",
|
|
126
|
+
key: i,
|
|
127
|
+
id: I + i,
|
|
128
|
+
"aria-selected": e,
|
|
129
|
+
"data-uid": I + i,
|
|
130
|
+
draggable: B,
|
|
131
|
+
onDragStart: (n) => {
|
|
132
|
+
l(z, n, o(), { dataItem: t });
|
|
133
|
+
},
|
|
134
|
+
onDragOver: (n) => {
|
|
135
|
+
n.preventDefault(), l(S, n, o(), { dataItem: t });
|
|
136
|
+
},
|
|
137
|
+
onDrop: (n) => {
|
|
138
|
+
l(v, n, o(), { dataItem: t });
|
|
139
|
+
},
|
|
140
|
+
onClick: (n) => {
|
|
141
|
+
l(A, n, o(), { dataItem: t });
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
return s.item ? /* @__PURE__ */ a.createElement(s.item, { selected: e, dataItem: t, ...r, key: r.key }, /* @__PURE__ */ a.createElement("span", { className: "k-list-item-text" }, t.name)) : /* @__PURE__ */ a.createElement("li", { ...r, key: r.key }, /* @__PURE__ */ a.createElement("span", { className: "k-list-item-text" }, M(t)));
|
|
145
|
+
}))))
|
|
146
|
+
),
|
|
147
|
+
s.toolbar && y === "bottom" && /* @__PURE__ */ a.createElement(s.toolbar, null),
|
|
148
|
+
/* @__PURE__ */ a.createElement("select", { style: { display: "none" }, multiple: !0, "data-role": "listbox" }, c.map((t, i) => {
|
|
149
|
+
const e = t[C || b];
|
|
150
|
+
return /* @__PURE__ */ a.createElement("option", { key: i, value: e }, e);
|
|
151
|
+
}))
|
|
152
|
+
);
|
|
153
|
+
}), D = {
|
|
154
|
+
toolbarPosition: O.RIGHT,
|
|
101
155
|
draggable: !0,
|
|
102
156
|
size: "medium"
|
|
103
157
|
};
|
|
104
|
-
|
|
158
|
+
R.propTypes = {
|
|
159
|
+
size: f.oneOf([null, "small", "medium", "large"]),
|
|
160
|
+
toolbarPosition: f.oneOf(["none", "top", "bottom", "left", "right"]),
|
|
161
|
+
textField: f.string.isRequired,
|
|
162
|
+
valueField: f.string,
|
|
163
|
+
selectedField: f.string,
|
|
164
|
+
data: f.array.isRequired
|
|
165
|
+
};
|
|
166
|
+
R.displayName = "ListBoxInner";
|
|
105
167
|
export {
|
|
106
|
-
|
|
168
|
+
R as ListBox
|
|
107
169
|
};
|
package/ListBoxToolbar.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react"),f=require("prop-types"),k=require("@progress/kendo-react-common"),B=require("@progress/kendo-react-buttons"),j=require("@progress/kendo-react-intl"),o=require("@progress/kendo-svg-icons"),U=require("./messages/index.js");function _(l){const g=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const i in l)if(i!=="default"){const b=Object.getOwnPropertyDescriptor(l,i);Object.defineProperty(g,i,b.get?b:{enumerable:!0,get:()=>l[i]})}}return g.default=l,Object.freeze(g)}const r=_(P),D=[{name:"moveUp",iconName:"caret-alt-up",svgIcon:o.caretAltUpIcon},{name:"moveDown",iconName:"caret-alt-down",svgIcon:o.caretAltDownIcon},{name:"transferTo",iconName:"caret-alt-right",svgIcon:o.caretAltRightIcon},{name:"transferFrom",iconName:"caret-alt-left",svgIcon:o.caretAltLeftIcon},{name:"transferAllTo",iconName:"caret-double-alt-right",svgIcon:o.caretDoubleAltRightIcon},{name:"transferAllFrom",iconName:"caret-double-alt-left",svgIcon:o.caretDoubleAltLeftIcon},{name:"remove",iconName:"x",svgIcon:o.xIcon}],p=r.forwardRef((l,g)=>{const{tools:i,dir:b,onToolClick:w,size:L=h.size,data:d=h.data,dataConnected:n=h.dataConnected,selectedField:C=h.selectedField}=l,F=j.useLocalization(),A=r.useRef(null),T=r.useRef(null),x=r.useCallback(()=>({onToolClick:w,props:l,context:{},state:{},refs:{}}),[]);r.useImperativeHandle(T,x),r.useImperativeHandle(g,()=>T.current);const y=(t,e,c)=>{c.preventDefault(),e.focusNext(t)},N=(t,e,c)=>{c.preventDefault(),e.focusPrevious(t)},v=r.useMemo(()=>new k.Navigation({root:A,selectors:[".k-button:not([disabled])"],tabIndex:0,keyboardEvents:{keydown:{ArrowDown:y,ArrowRight:y,ArrowUp:N,ArrowLeft:N,Enter:(t,e,c)=>{t.click(),e.focusElement(e.current,t)}}}}),[]),S=r.useCallback(v.triggerKeyboardEvent.bind(v),[]);r.useEffect(()=>(v.initializeRovingTab(),()=>v.removeFocusListener()),[]);const q=t=>{switch(t.name){case"caret-alt-right":return o.caretAltLeftIcon;case"caret-alt-left":return o.caretAltRightIcon;case"caret-double-alt-right":return o.caretDoubleAltLeftIcon;case"caret-double-alt-left":return o.caretDoubleAltRightIcon}return t},E=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},O=(t,e)=>{k.dispatchEvent(w,t,x(),{toolName:e})},z=t=>{let e=!0;const c=C||"selected",a=d.length,I=n.length,u=d.findIndex(s=>s[c]===!0)>=0,m=n.findIndex(s=>s[c]===!0)>=0;switch(t){case"moveUp":u?e=d.length>0?d[0].selected:!0:m?e=n.length>0?n[0].selected:!0:e=!0;break;case"moveDown":u?e=d[a-1]?d[a-1].selected:!0:m?e=n.length>0?n[I-1].selected:!0:e=!0;break;case"transferTo":e=!(n&&u);break;case"transferFrom":n?e=!(n&&m):e=!0;break;case"transferAllTo":e=!(n&&d.length>0);break;case"transferAllFrom":e=!(n&&n.length>0);break;case"remove":e=!(u||m);break}return e},R=b==="rtl";return r.createElement("div",{className:k.classNames("k-listbox-actions"),ref:A,onKeyDown:S},i&&i.map((t,e)=>{const c=D.findIndex(s=>s.name===t),a=D[c],I=z(a.name),u=`listbox.${a.name}`,m=F.toLanguageString(u,U.messages[u]);return r.createElement(B.Button,{size:L,key:e,disabled:I,"data-command":a.name,title:m,"aria-label":m,icon:R?E(a.iconName):a.iconName,svgIcon:R?q(a.svgIcon):a.svgIcon,onClick:s=>{s.preventDefault(),O(s,a.name)}})}))}),h={data:[],dataConnected:[],selectedField:"selected",size:"medium"};p.propTypes={data:f.array.isRequired,dataConnected:f.array.isRequired,tools:f.array,selectedField:f.string,dir:f.string,size:f.oneOf([null,"small","medium","large"])};p.displayName="ListBoxToolbarInner";exports.ListBoxToolbar=p;
|
package/ListBoxToolbar.mjs
CHANGED
|
@@ -6,130 +6,150 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
const
|
|
17
|
-
{ name: "moveUp", iconName: "caret-alt-up", svgIcon:
|
|
18
|
-
{ name: "moveDown", iconName: "caret-alt-down", svgIcon:
|
|
19
|
-
{ name: "transferTo", iconName: "caret-alt-right", svgIcon:
|
|
20
|
-
{ name: "transferFrom", iconName: "caret-alt-left", svgIcon:
|
|
21
|
-
{ name: "transferAllTo", iconName: "caret-double-alt-right", svgIcon:
|
|
22
|
-
{ name: "transferAllFrom", iconName: "caret-double-alt-left", svgIcon:
|
|
23
|
-
{ name: "remove", iconName: "x", svgIcon:
|
|
24
|
-
],
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
r ? e = this.props.data[i - 1] ? this.props.data[i - 1].selected : !0 : s ? e = this.props.dataConnected.length > 0 ? this.props.dataConnected[a - 1].selected : !0 : e = !0;
|
|
61
|
-
break;
|
|
62
|
-
case "transferTo":
|
|
63
|
-
e = !(this.props.dataConnected && r);
|
|
64
|
-
break;
|
|
65
|
-
case "transferFrom":
|
|
66
|
-
this.props.dataConnected ? e = !(this.props.dataConnected && s) : e = !0;
|
|
67
|
-
break;
|
|
68
|
-
case "transferAllTo":
|
|
69
|
-
e = !(this.props.dataConnected && this.props.data.length > 0);
|
|
70
|
-
break;
|
|
71
|
-
case "transferAllFrom":
|
|
72
|
-
e = !(this.props.dataConnected && this.props.dataConnected.length > 0);
|
|
73
|
-
break;
|
|
74
|
-
case "remove":
|
|
75
|
-
e = !(r || s);
|
|
76
|
-
break;
|
|
9
|
+
import * as n from "react";
|
|
10
|
+
import d from "prop-types";
|
|
11
|
+
import { Navigation as K, classNames as q, dispatchEvent as O } from "@progress/kendo-react-common";
|
|
12
|
+
import { Button as M } from "@progress/kendo-react-buttons";
|
|
13
|
+
import { useLocalization as _ } from "@progress/kendo-react-intl";
|
|
14
|
+
import { caretAltUpIcon as $, caretAltDownIcon as j, caretAltRightIcon as T, caretAltLeftIcon as A, caretDoubleAltRightIcon as y, caretDoubleAltLeftIcon as D, xIcon as G } from "@progress/kendo-svg-icons";
|
|
15
|
+
import { messages as J } from "./messages/index.mjs";
|
|
16
|
+
const N = [
|
|
17
|
+
{ name: "moveUp", iconName: "caret-alt-up", svgIcon: $ },
|
|
18
|
+
{ name: "moveDown", iconName: "caret-alt-down", svgIcon: j },
|
|
19
|
+
{ name: "transferTo", iconName: "caret-alt-right", svgIcon: T },
|
|
20
|
+
{ name: "transferFrom", iconName: "caret-alt-left", svgIcon: A },
|
|
21
|
+
{ name: "transferAllTo", iconName: "caret-double-alt-right", svgIcon: y },
|
|
22
|
+
{ name: "transferAllFrom", iconName: "caret-double-alt-left", svgIcon: D },
|
|
23
|
+
{ name: "remove", iconName: "x", svgIcon: G }
|
|
24
|
+
], F = n.forwardRef((g, L) => {
|
|
25
|
+
const {
|
|
26
|
+
tools: b,
|
|
27
|
+
dir: R,
|
|
28
|
+
onToolClick: v,
|
|
29
|
+
size: C = m.size,
|
|
30
|
+
data: l = m.data,
|
|
31
|
+
dataConnected: a = m.dataConnected,
|
|
32
|
+
selectedField: E = m.selectedField
|
|
33
|
+
} = g, z = _(), h = n.useRef(null), p = n.useRef(null), I = n.useCallback(() => ({
|
|
34
|
+
onToolClick: v,
|
|
35
|
+
props: g,
|
|
36
|
+
context: {},
|
|
37
|
+
state: {},
|
|
38
|
+
refs: {}
|
|
39
|
+
}), []);
|
|
40
|
+
n.useImperativeHandle(p, I), n.useImperativeHandle(L, () => p.current);
|
|
41
|
+
const k = (t, e, o) => {
|
|
42
|
+
o.preventDefault(), e.focusNext(t);
|
|
43
|
+
}, w = (t, e, o) => {
|
|
44
|
+
o.preventDefault(), e.focusPrevious(t);
|
|
45
|
+
}, u = n.useMemo(
|
|
46
|
+
() => new K({
|
|
47
|
+
root: h,
|
|
48
|
+
selectors: [".k-button:not([disabled])"],
|
|
49
|
+
tabIndex: 0,
|
|
50
|
+
keyboardEvents: {
|
|
51
|
+
keydown: {
|
|
52
|
+
ArrowDown: k,
|
|
53
|
+
ArrowRight: k,
|
|
54
|
+
ArrowUp: w,
|
|
55
|
+
ArrowLeft: w,
|
|
56
|
+
Enter: (t, e, o) => {
|
|
57
|
+
t.click(), e.focusElement(e.current, t);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
77
60
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"
|
|
61
|
+
}),
|
|
62
|
+
[]
|
|
63
|
+
), S = n.useCallback(u.triggerKeyboardEvent.bind(u), []);
|
|
64
|
+
n.useEffect(() => (u.initializeRovingTab(), () => u.removeFocusListener()), []);
|
|
65
|
+
const B = (t) => {
|
|
66
|
+
switch (t.name) {
|
|
67
|
+
case "caret-alt-right":
|
|
68
|
+
return A;
|
|
69
|
+
case "caret-alt-left":
|
|
70
|
+
return T;
|
|
71
|
+
case "caret-double-alt-right":
|
|
72
|
+
return D;
|
|
73
|
+
case "caret-double-alt-left":
|
|
74
|
+
return y;
|
|
75
|
+
}
|
|
76
|
+
return t;
|
|
77
|
+
}, P = (t) => {
|
|
78
|
+
switch (t) {
|
|
79
|
+
case "caret-alt-right":
|
|
80
|
+
return "caret-alt-left";
|
|
81
|
+
case "caret-alt-left":
|
|
82
|
+
return "caret-alt-right";
|
|
83
|
+
case "caret-double-alt-right":
|
|
84
|
+
return "caret-double-alt-left";
|
|
85
|
+
case "caret-double-alt-left":
|
|
86
|
+
return "caret-double-alt-right";
|
|
87
|
+
}
|
|
88
|
+
return t;
|
|
89
|
+
}, U = (t, e) => {
|
|
90
|
+
O(v, t, I(), { toolName: e });
|
|
91
|
+
}, H = (t) => {
|
|
92
|
+
let e = !0;
|
|
93
|
+
const o = E || "selected", r = l.length, f = a.length, s = l.findIndex((c) => c[o] === !0) >= 0, i = a.findIndex((c) => c[o] === !0) >= 0;
|
|
94
|
+
switch (t) {
|
|
95
|
+
case "moveUp":
|
|
96
|
+
s ? e = l.length > 0 ? l[0].selected : !0 : i ? e = a.length > 0 ? a[0].selected : !0 : e = !0;
|
|
97
|
+
break;
|
|
98
|
+
case "moveDown":
|
|
99
|
+
s ? e = l[r - 1] ? l[r - 1].selected : !0 : i ? e = a.length > 0 ? a[f - 1].selected : !0 : e = !0;
|
|
100
|
+
break;
|
|
101
|
+
case "transferTo":
|
|
102
|
+
e = !(a && s);
|
|
103
|
+
break;
|
|
104
|
+
case "transferFrom":
|
|
105
|
+
a ? e = !(a && i) : e = !0;
|
|
106
|
+
break;
|
|
107
|
+
case "transferAllTo":
|
|
108
|
+
e = !(a && l.length > 0);
|
|
109
|
+
break;
|
|
110
|
+
case "transferAllFrom":
|
|
111
|
+
e = !(a && a.length > 0);
|
|
112
|
+
break;
|
|
113
|
+
case "remove":
|
|
114
|
+
e = !(s || i);
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
return e;
|
|
118
|
+
}, x = R === "rtl";
|
|
119
|
+
return /* @__PURE__ */ n.createElement("div", { className: q("k-listbox-actions"), ref: h, onKeyDown: S }, b && b.map((t, e) => {
|
|
120
|
+
const o = N.findIndex((c) => c.name === t), r = N[o], f = H(r.name), s = `listbox.${r.name}`, i = z.toLanguageString(s, J[s]);
|
|
121
|
+
return /* @__PURE__ */ n.createElement(
|
|
122
|
+
M,
|
|
91
123
|
{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
"data-command": a.name,
|
|
105
|
-
title: o,
|
|
106
|
-
"aria-label": o,
|
|
107
|
-
icon: this.isRtl ? this.checkFontIcon(a.iconName) : a.iconName,
|
|
108
|
-
svgIcon: this.isRtl ? this.checkSvgIcon(a.svgIcon) : a.svgIcon,
|
|
109
|
-
onClick: (l) => {
|
|
110
|
-
l.preventDefault(), this.handleToolClick(l, a.name || null);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
);
|
|
114
|
-
})
|
|
124
|
+
size: C,
|
|
125
|
+
key: e,
|
|
126
|
+
disabled: f,
|
|
127
|
+
"data-command": r.name,
|
|
128
|
+
title: i,
|
|
129
|
+
"aria-label": i,
|
|
130
|
+
icon: x ? P(r.iconName) : r.iconName,
|
|
131
|
+
svgIcon: x ? B(r.svgIcon) : r.svgIcon,
|
|
132
|
+
onClick: (c) => {
|
|
133
|
+
c.preventDefault(), U(c, r.name);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
115
136
|
);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
d.propTypes = {
|
|
119
|
-
data: n.array,
|
|
120
|
-
dataConnected: n.array,
|
|
121
|
-
tools: n.array,
|
|
122
|
-
selectedField: n.string,
|
|
123
|
-
dir: n.string,
|
|
124
|
-
size: n.oneOf([null, "small", "medium", "large"])
|
|
125
|
-
}, d.defaultProps = {
|
|
137
|
+
}));
|
|
138
|
+
}), m = {
|
|
126
139
|
data: [],
|
|
127
140
|
dataConnected: [],
|
|
128
141
|
selectedField: "selected",
|
|
129
142
|
size: "medium"
|
|
130
143
|
};
|
|
131
|
-
|
|
132
|
-
|
|
144
|
+
F.propTypes = {
|
|
145
|
+
data: d.array.isRequired,
|
|
146
|
+
dataConnected: d.array.isRequired,
|
|
147
|
+
tools: d.array,
|
|
148
|
+
selectedField: d.string,
|
|
149
|
+
dir: d.string,
|
|
150
|
+
size: d.oneOf([null, "small", "medium", "large"])
|
|
151
|
+
};
|
|
152
|
+
F.displayName = "ListBoxToolbarInner";
|
|
133
153
|
export {
|
|
134
|
-
|
|
154
|
+
F as ListBoxToolbar
|
|
135
155
|
};
|
|
@@ -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
|
-
!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,s,o,a,r,n){"use strict";function i(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(s){if("default"!==s){var o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:function(){return e[s]}})}})),t.default=e,Object.freeze(t)}var l=i(t),c=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e))(c||{});const p={name:"@progress/kendo-react-listbox",productName:"KendoReact",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:1607357111,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-react-ui/components/my-license/"},d=class extends l.PureComponent{constructor(e){super(e),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&&o.dispatchEvent(this.props.onKeyDown,e,this,void 0)},this.handleContainerDrop=e=>{e.target.classList.contains("k-list-content")&&(this.props.data.length>0?o.dispatchEvent(this.props.onDrop,e,this,{dataItem:this.props.data[this.props.data.length-1]}):o.dispatchEvent(this.props.onDrop,e,this,{dataItem:null}))},this.setToolbarPosition=()=>this.props.toolbarPosition===c.NONE||void 0===this.props.toolbar?"":`k-listbox-actions-${this.props.toolbarPosition}`,this.handleOnDragLeave=e=>{this.props.onDragLeave&&e.target.classList.contains("k-list-content")&&o.dispatchEvent(this.props.onDragLeave,e,this,void 0)},o.validatePackage(p)}get itemGuid(){return this.props.id+"-accessibility-id"}render(){const e=o.kendoThemeMaps.sizeMap[this.props.size]||this.props.size;return l.createElement("div",{id:this.props.id,className:o.classNames(this.props.className,"k-listbox",{[`k-listbox-${e}`]:this.props.size},this.setToolbarPosition()),style:this.props.style,unselectable:"on"},this.props.toolbar&&"bottom"!==this.props.toolbarPosition&&l.createElement(this.props.toolbar,null),l.createElement("div",{className:"k-list-scroller k-selectable","data-role":"selectable",onDragOver:e=>e.preventDefault(),onDrop:this.handleContainerDrop,onDragLeave:this.handleOnDragLeave},l.createElement("div",{className:o.classNames("k-list",{[`k-list-${e}`]:this.props.size})},l.createElement("div",{className:"k-list-content"},l.createElement("ul",{className:"k-list-ul",role:"listbox","aria-label":"listbox-container",tabIndex:0,onKeyDown:this.handleKeyDown},this.props.data.map(((e,t)=>{const s=this.setSelected(e),a={className:o.classNames("k-list-item",{"k-selected":s}),role:"option","aria-selected":s,key:t,id:this.itemGuid+t,"data-uid":this.itemGuid+t,draggable:this.props.draggable,onDragStart:t=>o.dispatchEvent(this.props.onDragStart,t,this,{dataItem:e}),onDragOver:t=>{t.preventDefault(),o.dispatchEvent(this.props.onDragOver,t,this,{dataItem:e})},onDrop:t=>o.dispatchEvent(this.props.onDrop,t,this,{dataItem:e}),onClick:t=>o.dispatchEvent(this.props.onItemClick,t,this,{dataItem:e})};return this.props.item?l.createElement(this.props.item,{selected:s,dataItem:e,...a,key:a.key},l.createElement("span",{className:"k-list-item-text"},e.name)):l.createElement("li",{...a,key:a.key},l.createElement("span",{className:"k-list-item-text"},this.renderItem(e)))})))))),this.props.toolbar&&"bottom"===this.props.toolbarPosition&&l.createElement(this.props.toolbar,null),l.createElement("select",{style:{display:"none"},multiple:!0,"data-role":"listbox"},this.props.data.map(((e,t)=>{const s=e[this.props.valueField||this.props.textField];return l.createElement("option",{key:t,value:s},s)}))))}};d.propTypes={size:s.oneOf([null,"small","medium","large"]),toolbarPosition:s.oneOf(["none","top","bottom","left","right"]),textField:s.string,valueField:s.string,selectedField:s.string,data:s.array},d.defaultProps={toolbarPosition:c.RIGHT,draggable:!0,size:"medium"};let h=d;const m={"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"},u=[{name:"moveUp",iconName:"caret-alt-up",svgIcon:n.caretAltUpIcon},{name:"moveDown",iconName:"caret-alt-down",svgIcon:n.caretAltDownIcon},{name:"transferTo",iconName:"caret-alt-right",svgIcon:n.caretAltRightIcon},{name:"transferFrom",iconName:"caret-alt-left",svgIcon:n.caretAltLeftIcon},{name:"transferAllTo",iconName:"caret-double-alt-right",svgIcon:n.caretDoubleAltRightIcon},{name:"transferAllFrom",iconName:"caret-double-alt-left",svgIcon:n.caretDoubleAltLeftIcon},{name:"remove",iconName:"x",svgIcon:n.xIcon}],g=class extends l.PureComponent{constructor(){super(...arguments),this.checkSvgIcon=e=>{switch(e.name){case"caret-alt-right":return n.caretAltLeftIcon;case"caret-alt-left":return n.caretAltRightIcon;case"caret-double-alt-right":return n.caretDoubleAltLeftIcon;case"caret-double-alt-left":return n.caretDoubleAltRightIcon}return e},this.checkFontIcon=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},this.handleToolClick=(e,t)=>{o.dispatchEvent(this.props.onToolClick,e,this,{toolName:t})},this.isItemDisabled=e=>{let t=!0;const s=this.props.selectedField||"selected",o=this.props.data.length,a=this.props.dataConnected.length,r=this.props.data.findIndex((e=>!0===e[s]))>=0,n=this.props.dataConnected.findIndex((e=>!0===e[s]))>=0;switch(e){case"moveUp":t=r?!(this.props.data.length>0)||this.props.data[0].selected:!n||(!(this.props.dataConnected.length>0)||this.props.dataConnected[0].selected);break;case"moveDown":t=r?!this.props.data[o-1]||this.props.data[o-1].selected:!n||(!(this.props.dataConnected.length>0)||this.props.dataConnected[a-1].selected);break;case"transferTo":t=!(this.props.dataConnected&&r);break;case"transferFrom":t=!this.props.dataConnected||!(this.props.dataConnected&&n);break;case"transferAllTo":t=!(this.props.dataConnected&&this.props.data.length>0);break;case"transferAllFrom":t=!(this.props.dataConnected&&this.props.dataConnected.length>0);break;case"remove":t=!(r||n)}return t}}get isRtl(){return"rtl"===this.props.dir}render(){const e=r.provideLocalizationService(this);return l.createElement("div",{className:o.classNames("k-listbox-actions")},this.props.tools&&this.props.tools.map(((t,s)=>{const o=u.findIndex((e=>e.name===t)),r=u[o],n=this.isItemDisabled(r.name),i=`listbox.${r.name}`,c=e.toLanguageString(i,m[i]);return l.createElement(a.Button,{size:this.props.size,key:s,disabled:n,"data-command":r.name,title:c,"aria-label":c,icon:this.isRtl?this.checkFontIcon(r.iconName):r.iconName,svgIcon:this.isRtl?this.checkSvgIcon(r.svgIcon):r.svgIcon,onClick:e=>{e.preventDefault(),this.handleToolClick(e,r.name||null)}})})))}};g.propTypes={data:s.array,dataConnected:s.array,tools:s.array,selectedField:s.string,dir:s.string,size:s.oneOf([null,"small","medium","large"])},g.defaultProps={data:[],dataConnected:[],selectedField:"selected",size:"medium"};let b=g;r.registerForLocalization(b);const f=(e,t,s)=>{const o=s.splice(e,1)[0];return s.splice(t,0,o),s},v=o.withIdHOC(h);v.displayName="KendoReactListBox",e.ListBox=v,e.ListBoxToolbar=b,e.moveItem=f,e.processListBoxData=(e=[],t=[],s,o)=>{let a=[],r=[],n=[];const i={listBoxOneData:e,listBoxTwoData:t};switch(s){case"moveUp":a=[...e],a.forEach(((e,t)=>{e[o]&&(a=f(t,t-1,a))})),n=[...t],n.forEach(((e,t)=>{e[o]&&(n=f(t,t-1,n))})),i.listBoxOneData=a,i.listBoxTwoData=n;break;case"moveDown":a=e.reverse(),a.forEach(((e,t)=>{e[o]&&(a=f(t,t-1,a))})),n=t.reverse(),n.forEach(((e,t)=>{e[o]&&(n=f(t,t-1,n))})),i.listBoxOneData=[...a].reverse(),i.listBoxTwoData=[...n].reverse();break;case"transferTo":a=e.filter((e=>!e[o])),r=e.filter((e=>e[o])),n=t.concat(r),i.listBoxOneData=a,i.listBoxTwoData=n;break;case"transferFrom":n=t.filter((e=>!e[o])),r=t.filter((e=>e[o])),a=e.concat(r),i.listBoxOneData=a,i.listBoxTwoData=n;break;case"transferAllTo":i.listBoxOneData=[],i.listBoxTwoData=t.concat(e);break;case"transferAllFrom":i.listBoxOneData=t.concat(e),i.listBoxTwoData=[];break;case"remove":n=t.filter((e=>!e[o])),a=e.filter((e=>!e[o])),i.listBoxOneData=a,i.listBoxTwoData=n}return i},e.processListBoxDragAndDrop=(e=[],t=[],s,o,a)=>{const r=e.findIndex((e=>e[a]===s[a])),n=t.findIndex((e=>e[a]===s[a])),i=null!==o?e.findIndex((e=>e[a]===o[a])):-1,l=null!==o?t.findIndex((e=>e[a]===o[a])):-1,c=r>=0,p=n>=0,d=i>=0,h=l>=0,m=[...e],u=[...t];return c&&d?{listBoxOneData:f(r,i,e),listBoxTwoData:t}:p&&h?{listBoxOneData:e,listBoxTwoData:f(n,l,t)}:c&&(h||null===o)?(null===o?u.push(e[r]):u.splice(l+1,0,e[r]),m.splice(r,1),{listBoxOneData:m,listBoxTwoData:u}):p&&(d||null===o)?(null===o?m.push(t[n]):m.splice(i+1,0,t[n]),u.splice(n,1),{listBoxOneData:m,listBoxTwoData:u}):{listBoxOneData:e,listBoxTwoData:t}}}));
|
|
8
|
+
!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",productCodes:["KENDOUIREACT","KENDOUICOMPLETE"],publishDate:1607357111,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-${E}`)},e.toolbar&&"bottom"!==E&&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)))})))))),e.toolbar&&"bottom"===E&&i.createElement(e.toolbar,null),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}}}));
|
package/index.d.mts
CHANGED
|
@@ -8,56 +8,50 @@
|
|
|
8
8
|
import { BaseEvent } from '@progress/kendo-react-common';
|
|
9
9
|
import { ComponentType } from 'react';
|
|
10
10
|
import { ForwardRefExoticComponent } from 'react';
|
|
11
|
-
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
12
|
-
import PropTypes from 'prop-types';
|
|
13
11
|
import * as React_2 from 'react';
|
|
14
12
|
import { RefAttributes } from 'react';
|
|
15
13
|
|
|
16
14
|
/** @hidden */
|
|
17
15
|
export declare const ListBox: ForwardRefExoticComponent<ListBoxProps & RefAttributes<any>>;
|
|
18
16
|
|
|
19
|
-
declare
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
declare const ListBox_2: React_2.ForwardRefExoticComponent<ListBoxProps & React_2.RefAttributes<ListBoxHandle | null>>;
|
|
18
|
+
|
|
19
|
+
/** @hidden */
|
|
20
|
+
declare type ListBox_2 = ListBoxHandle;
|
|
21
|
+
|
|
22
|
+
export declare interface ListBoxDragEvent extends BaseEvent<ListBox_2> {
|
|
23
|
+
dataItem?: any;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare interface ListBoxDragLeaveEvent extends BaseEvent<ListBox_2> {
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export declare interface ListBoxEvent extends BaseEvent<ListBox_2> {
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The ListBox ref.
|
|
34
|
+
*/
|
|
35
|
+
declare interface ListBoxHandle {
|
|
31
36
|
/**
|
|
32
|
-
*
|
|
37
|
+
* The current element or `null` if there is no one.
|
|
33
38
|
*/
|
|
34
|
-
|
|
35
|
-
toolbarPosition: toolbarPosition;
|
|
36
|
-
draggable: boolean;
|
|
37
|
-
size: string;
|
|
38
|
-
};
|
|
39
|
-
private get itemGuid();
|
|
40
|
-
constructor(props: ListBoxProps);
|
|
39
|
+
element: HTMLDivElement | null;
|
|
41
40
|
/**
|
|
42
|
-
*
|
|
41
|
+
* The props value of the ListBox.
|
|
43
42
|
*/
|
|
44
|
-
|
|
45
|
-
private setSelected;
|
|
46
|
-
private renderItem;
|
|
47
|
-
private handleKeyDown;
|
|
48
|
-
private handleContainerDrop;
|
|
49
|
-
private setToolbarPosition;
|
|
50
|
-
private handleOnDragLeave;
|
|
43
|
+
props: ListBoxProps;
|
|
51
44
|
}
|
|
52
45
|
|
|
53
|
-
export declare interface
|
|
46
|
+
export declare interface ListBoxItemClickEvent extends BaseEvent<ListBox_2> {
|
|
54
47
|
dataItem?: any;
|
|
55
48
|
}
|
|
56
49
|
|
|
57
|
-
declare interface
|
|
50
|
+
export declare interface ListBoxItemNavigateEvent extends BaseEvent<ListBox_2> {
|
|
51
|
+
actionName?: string;
|
|
58
52
|
}
|
|
59
53
|
|
|
60
|
-
export declare interface
|
|
54
|
+
export declare interface ListBoxItemSelectEvent extends BaseEvent<ListBox_2> {
|
|
61
55
|
dataItem?: any;
|
|
62
56
|
}
|
|
63
57
|
|
|
@@ -134,6 +128,10 @@ export declare interface ListBoxProps {
|
|
|
134
128
|
* Fires when an item from the ListBox is clicked. Contains the clicked item.
|
|
135
129
|
*/
|
|
136
130
|
onItemClick?: (event: ListBoxItemClickEvent) => void;
|
|
131
|
+
/**
|
|
132
|
+
* Fires when an item from the ListBox is selected. Contains the selected item.
|
|
133
|
+
*/
|
|
134
|
+
onItemSelect?: (event: ListBoxItemSelectEvent) => void;
|
|
137
135
|
/**
|
|
138
136
|
* Fires on keydown over the ListBox list items. It can be use to add keyboard extra keyboard navigation option.
|
|
139
137
|
*/
|
|
@@ -154,44 +152,35 @@ export declare interface ListBoxProps {
|
|
|
154
152
|
* Fires when a dragged element or text selection leaves the ListBox element.
|
|
155
153
|
*/
|
|
156
154
|
onDragLeave?: (event: ListBoxDragLeaveEvent) => void;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export declare class ListBoxToolbar extends React_2.PureComponent<ListBoxToolbarProps, {}> {
|
|
160
|
-
/**
|
|
161
|
-
* @hidden
|
|
162
|
-
*/
|
|
163
|
-
static propTypes: {
|
|
164
|
-
data: PropTypes.Requireable<any[]>;
|
|
165
|
-
dataConnected: PropTypes.Requireable<any[]>;
|
|
166
|
-
tools: PropTypes.Requireable<any[]>;
|
|
167
|
-
selectedField: PropTypes.Requireable<string>;
|
|
168
|
-
dir: PropTypes.Requireable<string>;
|
|
169
|
-
size: PropTypes.Requireable<string | null>;
|
|
170
|
-
};
|
|
171
|
-
/**
|
|
172
|
-
* @hidden
|
|
173
|
-
*/
|
|
174
|
-
static defaultProps: {
|
|
175
|
-
data: never[];
|
|
176
|
-
dataConnected: never[];
|
|
177
|
-
selectedField: string;
|
|
178
|
-
size: string;
|
|
179
|
-
};
|
|
180
|
-
private get isRtl();
|
|
181
155
|
/**
|
|
182
|
-
*
|
|
156
|
+
* Fires when keyboard navigation action is triggered.
|
|
183
157
|
*/
|
|
184
|
-
|
|
185
|
-
private checkSvgIcon;
|
|
186
|
-
private checkFontIcon;
|
|
187
|
-
private handleToolClick;
|
|
188
|
-
private isItemDisabled;
|
|
158
|
+
onKeyboardNavigate?: (event: ListBoxItemNavigateEvent) => void;
|
|
189
159
|
}
|
|
190
160
|
|
|
161
|
+
export declare const ListBoxToolbar: React_2.ForwardRefExoticComponent<ListBoxToolbarProps & React_2.RefAttributes<ListBoxToolbarHandle | null>>;
|
|
162
|
+
|
|
163
|
+
/** @hidden */
|
|
164
|
+
export declare type ListBoxToolbar = ListBoxToolbarHandle;
|
|
165
|
+
|
|
191
166
|
export declare interface ListBoxToolbarClickEvent extends BaseEvent<ListBoxToolbar> {
|
|
192
167
|
toolName?: string;
|
|
193
168
|
}
|
|
194
169
|
|
|
170
|
+
declare interface ListBoxToolbarEvent extends BaseEvent<ListBoxToolbar> {
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @hidden
|
|
175
|
+
*/
|
|
176
|
+
declare interface ListBoxToolbarHandle {
|
|
177
|
+
onToolClick?: (event: ListBoxToolbarEvent) => void;
|
|
178
|
+
props: ListBoxToolbarProps;
|
|
179
|
+
context: {};
|
|
180
|
+
state: {};
|
|
181
|
+
refs: {};
|
|
182
|
+
}
|
|
183
|
+
|
|
195
184
|
export declare interface ListBoxToolbarProps {
|
|
196
185
|
/**
|
|
197
186
|
* Sets the tools of the ListBoxToolbar. By default, the ListBoxToolbar renders no tools.
|
package/index.d.ts
CHANGED
|
@@ -8,56 +8,50 @@
|
|
|
8
8
|
import { BaseEvent } from '@progress/kendo-react-common';
|
|
9
9
|
import { ComponentType } from 'react';
|
|
10
10
|
import { ForwardRefExoticComponent } from 'react';
|
|
11
|
-
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
12
|
-
import PropTypes from 'prop-types';
|
|
13
11
|
import * as React_2 from 'react';
|
|
14
12
|
import { RefAttributes } from 'react';
|
|
15
13
|
|
|
16
14
|
/** @hidden */
|
|
17
15
|
export declare const ListBox: ForwardRefExoticComponent<ListBoxProps & RefAttributes<any>>;
|
|
18
16
|
|
|
19
|
-
declare
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
17
|
+
declare const ListBox_2: React_2.ForwardRefExoticComponent<ListBoxProps & React_2.RefAttributes<ListBoxHandle | null>>;
|
|
18
|
+
|
|
19
|
+
/** @hidden */
|
|
20
|
+
declare type ListBox_2 = ListBoxHandle;
|
|
21
|
+
|
|
22
|
+
export declare interface ListBoxDragEvent extends BaseEvent<ListBox_2> {
|
|
23
|
+
dataItem?: any;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
declare interface ListBoxDragLeaveEvent extends BaseEvent<ListBox_2> {
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export declare interface ListBoxEvent extends BaseEvent<ListBox_2> {
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The ListBox ref.
|
|
34
|
+
*/
|
|
35
|
+
declare interface ListBoxHandle {
|
|
31
36
|
/**
|
|
32
|
-
*
|
|
37
|
+
* The current element or `null` if there is no one.
|
|
33
38
|
*/
|
|
34
|
-
|
|
35
|
-
toolbarPosition: toolbarPosition;
|
|
36
|
-
draggable: boolean;
|
|
37
|
-
size: string;
|
|
38
|
-
};
|
|
39
|
-
private get itemGuid();
|
|
40
|
-
constructor(props: ListBoxProps);
|
|
39
|
+
element: HTMLDivElement | null;
|
|
41
40
|
/**
|
|
42
|
-
*
|
|
41
|
+
* The props value of the ListBox.
|
|
43
42
|
*/
|
|
44
|
-
|
|
45
|
-
private setSelected;
|
|
46
|
-
private renderItem;
|
|
47
|
-
private handleKeyDown;
|
|
48
|
-
private handleContainerDrop;
|
|
49
|
-
private setToolbarPosition;
|
|
50
|
-
private handleOnDragLeave;
|
|
43
|
+
props: ListBoxProps;
|
|
51
44
|
}
|
|
52
45
|
|
|
53
|
-
export declare interface
|
|
46
|
+
export declare interface ListBoxItemClickEvent extends BaseEvent<ListBox_2> {
|
|
54
47
|
dataItem?: any;
|
|
55
48
|
}
|
|
56
49
|
|
|
57
|
-
declare interface
|
|
50
|
+
export declare interface ListBoxItemNavigateEvent extends BaseEvent<ListBox_2> {
|
|
51
|
+
actionName?: string;
|
|
58
52
|
}
|
|
59
53
|
|
|
60
|
-
export declare interface
|
|
54
|
+
export declare interface ListBoxItemSelectEvent extends BaseEvent<ListBox_2> {
|
|
61
55
|
dataItem?: any;
|
|
62
56
|
}
|
|
63
57
|
|
|
@@ -134,6 +128,10 @@ export declare interface ListBoxProps {
|
|
|
134
128
|
* Fires when an item from the ListBox is clicked. Contains the clicked item.
|
|
135
129
|
*/
|
|
136
130
|
onItemClick?: (event: ListBoxItemClickEvent) => void;
|
|
131
|
+
/**
|
|
132
|
+
* Fires when an item from the ListBox is selected. Contains the selected item.
|
|
133
|
+
*/
|
|
134
|
+
onItemSelect?: (event: ListBoxItemSelectEvent) => void;
|
|
137
135
|
/**
|
|
138
136
|
* Fires on keydown over the ListBox list items. It can be use to add keyboard extra keyboard navigation option.
|
|
139
137
|
*/
|
|
@@ -154,44 +152,35 @@ export declare interface ListBoxProps {
|
|
|
154
152
|
* Fires when a dragged element or text selection leaves the ListBox element.
|
|
155
153
|
*/
|
|
156
154
|
onDragLeave?: (event: ListBoxDragLeaveEvent) => void;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export declare class ListBoxToolbar extends React_2.PureComponent<ListBoxToolbarProps, {}> {
|
|
160
|
-
/**
|
|
161
|
-
* @hidden
|
|
162
|
-
*/
|
|
163
|
-
static propTypes: {
|
|
164
|
-
data: PropTypes.Requireable<any[]>;
|
|
165
|
-
dataConnected: PropTypes.Requireable<any[]>;
|
|
166
|
-
tools: PropTypes.Requireable<any[]>;
|
|
167
|
-
selectedField: PropTypes.Requireable<string>;
|
|
168
|
-
dir: PropTypes.Requireable<string>;
|
|
169
|
-
size: PropTypes.Requireable<string | null>;
|
|
170
|
-
};
|
|
171
|
-
/**
|
|
172
|
-
* @hidden
|
|
173
|
-
*/
|
|
174
|
-
static defaultProps: {
|
|
175
|
-
data: never[];
|
|
176
|
-
dataConnected: never[];
|
|
177
|
-
selectedField: string;
|
|
178
|
-
size: string;
|
|
179
|
-
};
|
|
180
|
-
private get isRtl();
|
|
181
155
|
/**
|
|
182
|
-
*
|
|
156
|
+
* Fires when keyboard navigation action is triggered.
|
|
183
157
|
*/
|
|
184
|
-
|
|
185
|
-
private checkSvgIcon;
|
|
186
|
-
private checkFontIcon;
|
|
187
|
-
private handleToolClick;
|
|
188
|
-
private isItemDisabled;
|
|
158
|
+
onKeyboardNavigate?: (event: ListBoxItemNavigateEvent) => void;
|
|
189
159
|
}
|
|
190
160
|
|
|
161
|
+
export declare const ListBoxToolbar: React_2.ForwardRefExoticComponent<ListBoxToolbarProps & React_2.RefAttributes<ListBoxToolbarHandle | null>>;
|
|
162
|
+
|
|
163
|
+
/** @hidden */
|
|
164
|
+
export declare type ListBoxToolbar = ListBoxToolbarHandle;
|
|
165
|
+
|
|
191
166
|
export declare interface ListBoxToolbarClickEvent extends BaseEvent<ListBoxToolbar> {
|
|
192
167
|
toolName?: string;
|
|
193
168
|
}
|
|
194
169
|
|
|
170
|
+
declare interface ListBoxToolbarEvent extends BaseEvent<ListBoxToolbar> {
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @hidden
|
|
175
|
+
*/
|
|
176
|
+
declare interface ListBoxToolbarHandle {
|
|
177
|
+
onToolClick?: (event: ListBoxToolbarEvent) => void;
|
|
178
|
+
props: ListBoxToolbarProps;
|
|
179
|
+
context: {};
|
|
180
|
+
state: {};
|
|
181
|
+
refs: {};
|
|
182
|
+
}
|
|
183
|
+
|
|
195
184
|
export declare interface ListBoxToolbarProps {
|
|
196
185
|
/**
|
|
197
186
|
* Sets the tools of the ListBoxToolbar. By default, the ListBoxToolbar renders no tools.
|
package/package-metadata.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const e = {
|
|
|
10
10
|
name: "@progress/kendo-react-listbox",
|
|
11
11
|
productName: "KendoReact",
|
|
12
12
|
productCodes: ["KENDOUIREACT", "KENDOUICOMPLETE"],
|
|
13
|
-
publishDate:
|
|
13
|
+
publishDate: 1720791487,
|
|
14
14
|
version: "",
|
|
15
15
|
licensingDocsUrl: "https://www.telerik.com/kendo-react-ui/components/my-license/"
|
|
16
16
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-react-listbox",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0-develop.10",
|
|
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": "8.
|
|
27
|
-
"@progress/kendo-react-common": "8.
|
|
28
|
-
"@progress/kendo-react-intl": "8.
|
|
26
|
+
"@progress/kendo-react-buttons": "8.2.0-develop.10",
|
|
27
|
+
"@progress/kendo-react-common": "8.2.0-develop.10",
|
|
28
|
+
"@progress/kendo-react-intl": "8.2.0-develop.10",
|
|
29
29
|
"@progress/kendo-svg-icons": "^3.0.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"
|
package/utils.mjs
CHANGED
|
@@ -8,10 +8,7 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
const k = (t = [], e = [], I, c) => {
|
|
10
10
|
let r = [], i = [], s = [];
|
|
11
|
-
const f = {
|
|
12
|
-
listBoxOneData: t,
|
|
13
|
-
listBoxTwoData: e
|
|
14
|
-
};
|
|
11
|
+
const f = { listBoxOneData: t, listBoxTwoData: e };
|
|
15
12
|
switch (I) {
|
|
16
13
|
case "moveUp":
|
|
17
14
|
r = [...t], r.forEach((n, o) => {
|