@progress/kendo-react-listbox 7.2.4-develop.3 → 7.2.4-develop.4
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 +8 -0
- package/ListBox.mjs +105 -0
- package/ListBoxToolbar.js +8 -0
- package/ListBoxToolbar.mjs +132 -0
- package/dist/cdn/js/kendo-react-listbox.js +8 -5
- package/index.d.mts +271 -5
- package/index.d.ts +271 -12
- package/index.js +8 -5
- package/index.mjs +18 -297
- package/interfaces/Enums.js +8 -0
- package/interfaces/Enums.mjs +12 -0
- package/messages/index.js +8 -0
- package/messages/index.mjs +27 -0
- package/package-metadata.js +8 -0
- package/package-metadata.mjs +19 -0
- package/package.json +4 -4
- package/utils.js +8 -0
- package/utils.mjs +73 -0
- package/ListBox.d.ts +0 -41
- package/ListBoxToolbar.d.ts +0 -36
- package/interfaces/Enums.d.ts +0 -11
- package/interfaces/ListBoxEvents.d.ts +0 -20
- package/interfaces/ListBoxProps.d.ts +0 -98
- package/interfaces/ListBoxToolBarProps.d.ts +0 -40
- package/messages/index.d.ts +0 -44
- package/package-metadata.d.ts +0 -9
- package/utils.d.ts +0 -35
package/ListBox.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react"),r=require("prop-types"),a=require("@progress/kendo-react-common"),d=require("./interfaces/Enums.js"),m=require("./package-metadata.js");function u(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const s=u(h),p=class p extends s.PureComponent{constructor(e){super(e),this.setSelected=t=>{if(this.props.selectedField)return!!t[this.props.selectedField]},this.renderItem=t=>this.props.textField?t[this.props.textField]:t.toString(),this.handleKeyDown=t=>{this.props.onKeyDown&&a.dispatchEvent(this.props.onKeyDown,t,this,void 0)},this.handleContainerDrop=t=>{t.target.classList.contains("k-list-content")&&(this.props.data.length>0?a.dispatchEvent(this.props.onDrop,t,this,{dataItem:this.props.data[this.props.data.length-1]}):a.dispatchEvent(this.props.onDrop,t,this,{dataItem:null}))},this.setToolbarPosition=()=>this.props.toolbarPosition===d.toolbarPosition.NONE||this.props.toolbar===void 0?"":`k-listbox-actions-${this.props.toolbarPosition}`,this.handleOnDragLeave=t=>{this.props.onDragLeave&&t.target.classList.contains("k-list-content")&&a.dispatchEvent(this.props.onDragLeave,t,this,void 0)},a.validatePackage(m.packageMetadata)}get itemGuid(){return this.props.id+"-accessibility-id"}render(){return s.createElement("div",{id:this.props.id,className:a.classNames(this.props.className,"k-listbox",this.setToolbarPosition()),style:this.props.style,unselectable:"on"},this.props.toolbar&&this.props.toolbarPosition!=="bottom"&&s.createElement(this.props.toolbar,null),s.createElement("div",{className:"k-list-scroller k-selectable","data-role":"selectable",onDragOver:e=>e.preventDefault(),onDrop:this.handleContainerDrop,onDragLeave:this.handleOnDragLeave},s.createElement("div",{className:a.classNames("k-list",{[`k-list-${a.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]:this.props.size})},s.createElement("div",{className:"k-list-content"},s.createElement("ul",{className:"k-list-ul",role:"listbox","aria-label":"listbox-container",tabIndex:0,onKeyDown:this.handleKeyDown},this.props.data.map((e,t)=>{const o=this.setSelected(e),l={className:a.classNames("k-list-item",{"k-selected":o}),role:"option","aria-selected":o,key:t,id:this.itemGuid+t,"data-uid":this.itemGuid+t,draggable:this.props.draggable,onDragStart:i=>a.dispatchEvent(this.props.onDragStart,i,this,{dataItem:e}),onDragOver:i=>{i.preventDefault(),a.dispatchEvent(this.props.onDragOver,i,this,{dataItem:e})},onDrop:i=>a.dispatchEvent(this.props.onDrop,i,this,{dataItem:e}),onClick:i=>a.dispatchEvent(this.props.onItemClick,i,this,{dataItem:e})};return this.props.item?s.createElement(this.props.item,{selected:o,dataItem:e,...l,key:l.key},s.createElement("span",{className:"k-list-item-text"},e.name)):s.createElement("li",{...l,key:l.key},s.createElement("span",{className:"k-list-item-text"},this.renderItem(e)))}))))),this.props.toolbar&&this.props.toolbarPosition==="bottom"&&s.createElement(this.props.toolbar,null),s.createElement("select",{style:{display:"none"},multiple:!0,"data-role":"listbox"},this.props.data.map((e,t)=>{const o=e[this.props.valueField||this.props.textField];return s.createElement("option",{key:t,value:o},o)})))}};p.propTypes={size:r.oneOf([null,"small","medium","large"]),toolbarPosition:r.oneOf(["none","top","bottom","left","right"]),textField:r.string,valueField:r.string,selectedField:r.string,data:r.array},p.defaultProps={toolbarPosition:d.toolbarPosition.RIGHT,draggable:!0,size:"medium"};let c=p;exports.ListBox=c;
|
package/ListBox.mjs
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as s from "react";
|
|
10
|
+
import r from "prop-types";
|
|
11
|
+
import { dispatchEvent as i, validatePackage as c, classNames as p, kendoThemeMaps as m } from "@progress/kendo-react-common";
|
|
12
|
+
import { toolbarPosition as h } from "./interfaces/Enums.mjs";
|
|
13
|
+
import { packageMetadata as u } from "./package-metadata.mjs";
|
|
14
|
+
const n = class n extends s.PureComponent {
|
|
15
|
+
constructor(e) {
|
|
16
|
+
super(e), this.setSelected = (t) => {
|
|
17
|
+
if (this.props.selectedField)
|
|
18
|
+
return !!t[this.props.selectedField];
|
|
19
|
+
}, this.renderItem = (t) => this.props.textField ? t[this.props.textField] : t.toString(), this.handleKeyDown = (t) => {
|
|
20
|
+
this.props.onKeyDown && i(this.props.onKeyDown, t, this, void 0);
|
|
21
|
+
}, this.handleContainerDrop = (t) => {
|
|
22
|
+
t.target.classList.contains("k-list-content") && (this.props.data.length > 0 ? i(this.props.onDrop, t, this, { dataItem: this.props.data[this.props.data.length - 1] }) : i(this.props.onDrop, t, this, { dataItem: null }));
|
|
23
|
+
}, this.setToolbarPosition = () => this.props.toolbarPosition === h.NONE || this.props.toolbar === void 0 ? "" : `k-listbox-actions-${this.props.toolbarPosition}`, this.handleOnDragLeave = (t) => {
|
|
24
|
+
this.props.onDragLeave && t.target.classList.contains("k-list-content") && i(this.props.onDragLeave, t, this, void 0);
|
|
25
|
+
}, c(u);
|
|
26
|
+
}
|
|
27
|
+
get itemGuid() {
|
|
28
|
+
return this.props.id + "-accessibility-id";
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @hidden
|
|
32
|
+
*/
|
|
33
|
+
render() {
|
|
34
|
+
return /* @__PURE__ */ s.createElement(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
id: this.props.id,
|
|
38
|
+
className: p(
|
|
39
|
+
this.props.className,
|
|
40
|
+
"k-listbox",
|
|
41
|
+
this.setToolbarPosition()
|
|
42
|
+
),
|
|
43
|
+
style: this.props.style,
|
|
44
|
+
unselectable: "on"
|
|
45
|
+
},
|
|
46
|
+
this.props.toolbar && this.props.toolbarPosition !== "bottom" && /* @__PURE__ */ s.createElement(this.props.toolbar, null),
|
|
47
|
+
/* @__PURE__ */ s.createElement(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
className: "k-list-scroller k-selectable",
|
|
51
|
+
"data-role": "selectable",
|
|
52
|
+
onDragOver: (e) => e.preventDefault(),
|
|
53
|
+
onDrop: this.handleContainerDrop,
|
|
54
|
+
onDragLeave: this.handleOnDragLeave
|
|
55
|
+
},
|
|
56
|
+
/* @__PURE__ */ s.createElement("div", { className: p("k-list", {
|
|
57
|
+
[`k-list-${m.sizeMap[this.props.size] || this.props.size}`]: this.props.size
|
|
58
|
+
}) }, /* @__PURE__ */ s.createElement("div", { className: "k-list-content" }, /* @__PURE__ */ s.createElement("ul", { className: "k-list-ul", role: "listbox", "aria-label": "listbox-container", tabIndex: 0, onKeyDown: this.handleKeyDown }, this.props.data.map((e, t) => {
|
|
59
|
+
const a = this.setSelected(e), l = {
|
|
60
|
+
className: p(
|
|
61
|
+
"k-list-item",
|
|
62
|
+
{
|
|
63
|
+
"k-selected": a
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
role: "option",
|
|
67
|
+
"aria-selected": a,
|
|
68
|
+
key: t,
|
|
69
|
+
id: this.itemGuid + t,
|
|
70
|
+
"data-uid": this.itemGuid + t,
|
|
71
|
+
draggable: this.props.draggable,
|
|
72
|
+
onDragStart: (o) => i(this.props.onDragStart, o, this, { dataItem: e }),
|
|
73
|
+
onDragOver: (o) => {
|
|
74
|
+
o.preventDefault(), i(this.props.onDragOver, o, this, { dataItem: e });
|
|
75
|
+
},
|
|
76
|
+
onDrop: (o) => i(this.props.onDrop, o, this, { dataItem: e }),
|
|
77
|
+
onClick: (o) => i(this.props.onItemClick, o, this, { dataItem: e })
|
|
78
|
+
};
|
|
79
|
+
return this.props.item ? /* @__PURE__ */ s.createElement(this.props.item, { selected: a, dataItem: e, ...l, key: l.key }, /* @__PURE__ */ s.createElement("span", { className: "k-list-item-text" }, e.name)) : /* @__PURE__ */ s.createElement("li", { ...l, key: l.key }, /* @__PURE__ */ s.createElement("span", { className: "k-list-item-text" }, this.renderItem(e)));
|
|
80
|
+
}))))
|
|
81
|
+
),
|
|
82
|
+
this.props.toolbar && this.props.toolbarPosition === "bottom" && /* @__PURE__ */ s.createElement(this.props.toolbar, null),
|
|
83
|
+
/* @__PURE__ */ s.createElement("select", { style: { display: "none" }, multiple: !0, "data-role": "listbox" }, this.props.data.map((e, t) => {
|
|
84
|
+
const a = e[this.props.valueField || this.props.textField];
|
|
85
|
+
return /* @__PURE__ */ s.createElement("option", { key: t, value: a }, a);
|
|
86
|
+
}))
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
n.propTypes = {
|
|
91
|
+
size: r.oneOf([null, "small", "medium", "large"]),
|
|
92
|
+
toolbarPosition: r.oneOf(["none", "top", "bottom", "left", "right"]),
|
|
93
|
+
textField: r.string,
|
|
94
|
+
valueField: r.string,
|
|
95
|
+
selectedField: r.string,
|
|
96
|
+
data: r.array
|
|
97
|
+
}, n.defaultProps = {
|
|
98
|
+
toolbarPosition: h.RIGHT,
|
|
99
|
+
draggable: !0,
|
|
100
|
+
size: "medium"
|
|
101
|
+
};
|
|
102
|
+
let d = n;
|
|
103
|
+
export {
|
|
104
|
+
d as ListBox
|
|
105
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react"),g=require("@progress/kendo-react-common"),v=require("@progress/kendo-react-buttons"),b=require("@progress/kendo-react-intl"),k=require("./messages/index.js"),i=require("prop-types"),a=require("@progress/kendo-svg-icons");function C(l){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const e in l)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(l,e);Object.defineProperty(t,e,r.get?r:{enumerable:!0,get:()=>l[e]})}}return t.default=l,Object.freeze(t)}const m=C(I),f=[{name:"moveUp",iconName:"caret-alt-up",svgIcon:a.caretAltUpIcon},{name:"moveDown",iconName:"caret-alt-down",svgIcon:a.caretAltDownIcon},{name:"transferTo",iconName:"caret-alt-right",svgIcon:a.caretAltRightIcon},{name:"transferFrom",iconName:"caret-alt-left",svgIcon:a.caretAltLeftIcon},{name:"transferAllTo",iconName:"caret-double-alt-right",svgIcon:a.caretDoubleAltRightIcon},{name:"transferAllFrom",iconName:"caret-double-alt-left",svgIcon:a.caretDoubleAltLeftIcon},{name:"remove",iconName:"x",svgIcon:a.xIcon}],u=class u extends m.PureComponent{constructor(){super(...arguments),this.checkSvgIcon=t=>{switch(t.name){case"caret-alt-right":return a.caretAltLeftIcon;case"caret-alt-left":return a.caretAltRightIcon;case"caret-double-alt-right":return a.caretDoubleAltLeftIcon;case"caret-double-alt-left":return a.caretDoubleAltRightIcon}return t},this.checkFontIcon=t=>{switch(t){case"caret-alt-right":return"caret-alt-left";case"caret-alt-left":return"caret-alt-right";case"caret-double-alt-right":return"caret-double-alt-left";case"caret-double-alt-left":return"caret-double-alt-right"}return t},this.handleToolClick=(t,e)=>{g.dispatchEvent(this.props.onToolClick,t,this,{toolName:e})},this.isItemDisabled=t=>{let e=!0;const r=this.props.selectedField||"selected",d=this.props.data.length,n=this.props.dataConnected.length,o=this.props.data.findIndex(c=>c[r]===!0)>=0,s=this.props.dataConnected.findIndex(c=>c[r]===!0)>=0;switch(t){case"moveUp":o?e=this.props.data.length>0?this.props.data[0].selected:!0:s?e=this.props.dataConnected.length>0?this.props.dataConnected[0].selected:!0:e=!0;break;case"moveDown":o?e=this.props.data[d-1]?this.props.data[d-1].selected:!0:s?e=this.props.dataConnected.length>0?this.props.dataConnected[n-1].selected:!0:e=!0;break;case"transferTo":e=!(this.props.dataConnected&&o);break;case"transferFrom":this.props.dataConnected?e=!(this.props.dataConnected&&s):e=!0;break;case"transferAllTo":e=!(this.props.dataConnected&&this.props.data.length>0);break;case"transferAllFrom":e=!(this.props.dataConnected&&this.props.dataConnected.length>0);break;case"remove":e=!(o||s);break}return e}}get isRtl(){return this.props.dir==="rtl"}render(){const t=b.provideLocalizationService(this);return m.createElement("div",{className:g.classNames("k-listbox-actions")},this.props.tools&&this.props.tools.map((e,r)=>{const d=f.findIndex(h=>h.name===e),n=f[d],o=this.isItemDisabled(n.name),s=`listbox.${n.name}`,c=t.toLanguageString(s,k.messages[s]);return m.createElement(v.Button,{key:r,disabled:o,"data-command":n.name,title:c,"aria-label":c,icon:this.isRtl?this.checkFontIcon(n.iconName):n.iconName,svgIcon:this.isRtl?this.checkSvgIcon(n.svgIcon):n.svgIcon,onClick:h=>{h.preventDefault(),this.handleToolClick(h,n.name||null)}})}))}};u.propTypes={data:i.array,dataConnected:i.array,tools:i.array,selectedField:i.string,dir:i.string},u.defaultProps={data:[],dataConnected:[],selectedField:"selected"};let p=u;b.registerForLocalization(p);exports.ListBoxToolbar=p;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
"use client";
|
|
9
|
+
import * as p from "react";
|
|
10
|
+
import { dispatchEvent as I, classNames as b } from "@progress/kendo-react-common";
|
|
11
|
+
import { Button as C } from "@progress/kendo-react-buttons";
|
|
12
|
+
import { provideLocalizationService as k, registerForLocalization as N } from "@progress/kendo-react-intl";
|
|
13
|
+
import { messages as F } from "./messages/index.mjs";
|
|
14
|
+
import n from "prop-types";
|
|
15
|
+
import { caretDoubleAltRightIcon as u, caretDoubleAltLeftIcon as g, caretAltRightIcon as f, caretAltLeftIcon as v, caretAltUpIcon as A, caretAltDownIcon as D, xIcon as T } from "@progress/kendo-svg-icons";
|
|
16
|
+
const m = [
|
|
17
|
+
{ name: "moveUp", iconName: "caret-alt-up", svgIcon: A },
|
|
18
|
+
{ name: "moveDown", iconName: "caret-alt-down", svgIcon: D },
|
|
19
|
+
{ name: "transferTo", iconName: "caret-alt-right", svgIcon: f },
|
|
20
|
+
{ name: "transferFrom", iconName: "caret-alt-left", svgIcon: v },
|
|
21
|
+
{ name: "transferAllTo", iconName: "caret-double-alt-right", svgIcon: u },
|
|
22
|
+
{ name: "transferAllFrom", iconName: "caret-double-alt-left", svgIcon: g },
|
|
23
|
+
{ name: "remove", iconName: "x", svgIcon: T }
|
|
24
|
+
], d = class d extends p.PureComponent {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments), this.checkSvgIcon = (t) => {
|
|
27
|
+
switch (t.name) {
|
|
28
|
+
case "caret-alt-right":
|
|
29
|
+
return v;
|
|
30
|
+
case "caret-alt-left":
|
|
31
|
+
return f;
|
|
32
|
+
case "caret-double-alt-right":
|
|
33
|
+
return g;
|
|
34
|
+
case "caret-double-alt-left":
|
|
35
|
+
return u;
|
|
36
|
+
}
|
|
37
|
+
return t;
|
|
38
|
+
}, this.checkFontIcon = (t) => {
|
|
39
|
+
switch (t) {
|
|
40
|
+
case "caret-alt-right":
|
|
41
|
+
return "caret-alt-left";
|
|
42
|
+
case "caret-alt-left":
|
|
43
|
+
return "caret-alt-right";
|
|
44
|
+
case "caret-double-alt-right":
|
|
45
|
+
return "caret-double-alt-left";
|
|
46
|
+
case "caret-double-alt-left":
|
|
47
|
+
return "caret-double-alt-right";
|
|
48
|
+
}
|
|
49
|
+
return t;
|
|
50
|
+
}, this.handleToolClick = (t, e) => {
|
|
51
|
+
I(this.props.onToolClick, t, this, { toolName: e });
|
|
52
|
+
}, this.isItemDisabled = (t) => {
|
|
53
|
+
let e = !0;
|
|
54
|
+
const c = this.props.selectedField || "selected", l = this.props.data.length, a = this.props.dataConnected.length, s = this.props.data.findIndex((o) => o[c] === !0) >= 0, r = this.props.dataConnected.findIndex((o) => o[c] === !0) >= 0;
|
|
55
|
+
switch (t) {
|
|
56
|
+
case "moveUp":
|
|
57
|
+
s ? e = this.props.data.length > 0 ? this.props.data[0].selected : !0 : r ? e = this.props.dataConnected.length > 0 ? this.props.dataConnected[0].selected : !0 : e = !0;
|
|
58
|
+
break;
|
|
59
|
+
case "moveDown":
|
|
60
|
+
s ? e = this.props.data[l - 1] ? this.props.data[l - 1].selected : !0 : r ? 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 && s);
|
|
64
|
+
break;
|
|
65
|
+
case "transferFrom":
|
|
66
|
+
this.props.dataConnected ? e = !(this.props.dataConnected && r) : 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 = !(s || r);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
return e;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
get isRtl() {
|
|
82
|
+
return this.props.dir === "rtl";
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @hidden
|
|
86
|
+
*/
|
|
87
|
+
render() {
|
|
88
|
+
const t = k(this);
|
|
89
|
+
return /* @__PURE__ */ p.createElement(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
className: b(
|
|
93
|
+
"k-listbox-actions"
|
|
94
|
+
)
|
|
95
|
+
},
|
|
96
|
+
this.props.tools && this.props.tools.map((e, c) => {
|
|
97
|
+
const l = m.findIndex((i) => i.name === e), a = m[l], s = this.isItemDisabled(a.name), r = `listbox.${a.name}`, o = t.toLanguageString(r, F[r]);
|
|
98
|
+
return /* @__PURE__ */ p.createElement(
|
|
99
|
+
C,
|
|
100
|
+
{
|
|
101
|
+
key: c,
|
|
102
|
+
disabled: s,
|
|
103
|
+
"data-command": a.name,
|
|
104
|
+
title: o,
|
|
105
|
+
"aria-label": o,
|
|
106
|
+
icon: this.isRtl ? this.checkFontIcon(a.iconName) : a.iconName,
|
|
107
|
+
svgIcon: this.isRtl ? this.checkSvgIcon(a.svgIcon) : a.svgIcon,
|
|
108
|
+
onClick: (i) => {
|
|
109
|
+
i.preventDefault(), this.handleToolClick(i, a.name || null);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
})
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
d.propTypes = {
|
|
118
|
+
data: n.array,
|
|
119
|
+
dataConnected: n.array,
|
|
120
|
+
tools: n.array,
|
|
121
|
+
selectedField: n.string,
|
|
122
|
+
dir: n.string
|
|
123
|
+
}, d.defaultProps = {
|
|
124
|
+
data: [],
|
|
125
|
+
dataConnected: [],
|
|
126
|
+
selectedField: "selected"
|
|
127
|
+
};
|
|
128
|
+
let h = d;
|
|
129
|
+
N(h);
|
|
130
|
+
export {
|
|
131
|
+
h as ListBoxToolbar
|
|
132
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
!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(){return l.createElement("div",{id:this.props.id,className:o.classNames(this.props.className,"k-listbox",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-${o.kendoThemeMaps.sizeMap[this.props.size]||this.props.size}`]: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,{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},g.defaultProps={data:[],dataConnected:[],selectedField:"selected"};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}}}));
|
package/index.d.mts
CHANGED
|
@@ -1,5 +1,271 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
*-------------------------------------------------------------------------------------------
|
|
4
|
+
* Copyright © 2024 Progress Software Corporation. All rights reserved.
|
|
5
|
+
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
+
*-------------------------------------------------------------------------------------------
|
|
7
|
+
*/
|
|
8
|
+
import { BaseEvent } from '@progress/kendo-react-common';
|
|
9
|
+
import { ComponentType } from 'react';
|
|
10
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
11
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
12
|
+
import PropTypes from 'prop-types';
|
|
13
|
+
import * as React_2 from 'react';
|
|
14
|
+
import { RefAttributes } from 'react';
|
|
15
|
+
|
|
16
|
+
/** @hidden */
|
|
17
|
+
export declare const ListBox: ForwardRefExoticComponent<ListBoxProps & RefAttributes<any>>;
|
|
18
|
+
|
|
19
|
+
declare class ListBox_2 extends React_2.PureComponent<ListBoxProps, {}> {
|
|
20
|
+
/**
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
static propTypes: {
|
|
24
|
+
size: PropTypes.Requireable<string | null>;
|
|
25
|
+
toolbarPosition: PropTypes.Requireable<string>;
|
|
26
|
+
textField: PropTypes.Requireable<string>;
|
|
27
|
+
valueField: PropTypes.Requireable<string>;
|
|
28
|
+
selectedField: PropTypes.Requireable<string>;
|
|
29
|
+
data: PropTypes.Requireable<any[]>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
static defaultProps: {
|
|
35
|
+
toolbarPosition: toolbarPosition;
|
|
36
|
+
draggable: boolean;
|
|
37
|
+
size: string;
|
|
38
|
+
};
|
|
39
|
+
private get itemGuid();
|
|
40
|
+
constructor(props: ListBoxProps);
|
|
41
|
+
/**
|
|
42
|
+
* @hidden
|
|
43
|
+
*/
|
|
44
|
+
render(): JSX_2.Element;
|
|
45
|
+
private setSelected;
|
|
46
|
+
private renderItem;
|
|
47
|
+
private handleKeyDown;
|
|
48
|
+
private handleContainerDrop;
|
|
49
|
+
private setToolbarPosition;
|
|
50
|
+
private handleOnDragLeave;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export declare interface ListBoxDragEvent extends BaseEvent<ListBox_2> {
|
|
54
|
+
dataItem?: any;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare interface ListBoxDragLeaveEvent extends BaseEvent<ListBox_2> {
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export declare interface ListBoxItemClickEvent extends BaseEvent<ListBox_2> {
|
|
61
|
+
dataItem?: any;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export declare interface ListBoxKeyDownEvent extends BaseEvent<ListBox_2> {
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Represents the props of the [KendoReact ListBox component]({% slug overview_listbox %}).
|
|
69
|
+
*/
|
|
70
|
+
export declare interface ListBoxProps {
|
|
71
|
+
/**
|
|
72
|
+
* Sets a `class` of the ListBox container.
|
|
73
|
+
*/
|
|
74
|
+
className?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Sets a `id` of the ListBox container.
|
|
77
|
+
*/
|
|
78
|
+
id?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Configures the `size` of the ListBox.
|
|
81
|
+
*
|
|
82
|
+
* The available options are:
|
|
83
|
+
* - small
|
|
84
|
+
* - medium
|
|
85
|
+
* - large
|
|
86
|
+
* - null—Does not set a size `className`.
|
|
87
|
+
*
|
|
88
|
+
* @default `medium`
|
|
89
|
+
*/
|
|
90
|
+
size?: null | 'small' | 'medium' | 'large';
|
|
91
|
+
/**
|
|
92
|
+
* Specifies the styles which are set to the ListBox container.
|
|
93
|
+
*/
|
|
94
|
+
style?: React.CSSProperties;
|
|
95
|
+
/**
|
|
96
|
+
* Set the data of the ListBox.
|
|
97
|
+
*/
|
|
98
|
+
data: Array<any>;
|
|
99
|
+
/**
|
|
100
|
+
* Makes the items of the ListBox draggable. The items are draggable by default.
|
|
101
|
+
*/
|
|
102
|
+
draggable?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Set the selected field of the ListBox. Based on that value of that field, an item will be selected or not.
|
|
105
|
+
*/
|
|
106
|
+
selectedField?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Sets the data item field that represents the item text. If the data contains only primitive values, do not define it.
|
|
109
|
+
*/
|
|
110
|
+
textField: string;
|
|
111
|
+
/**
|
|
112
|
+
* The field that be used during form submit. Defaults to the textField if not set.
|
|
113
|
+
*/
|
|
114
|
+
valueField?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Sets the position of the toolbar of the ListBox if one is set. The ListBox may have no toolbar.
|
|
117
|
+
* * The possible values are:
|
|
118
|
+
* * `top`
|
|
119
|
+
* * `bottom`
|
|
120
|
+
* * `left`
|
|
121
|
+
* * `right` (Default)
|
|
122
|
+
* * `none`
|
|
123
|
+
*/
|
|
124
|
+
toolbarPosition?: toolbarPosition | string;
|
|
125
|
+
/**
|
|
126
|
+
* Renders a toolbar component next to the ListBox.
|
|
127
|
+
*/
|
|
128
|
+
toolbar?: null | ComponentType<any>;
|
|
129
|
+
/**
|
|
130
|
+
* Defines the component that will be rendered for each item of the data collection.
|
|
131
|
+
*/
|
|
132
|
+
item?: React.ComponentType<any>;
|
|
133
|
+
/**
|
|
134
|
+
* Fires when an item from the ListBox is clicked. Contains the clicked item.
|
|
135
|
+
*/
|
|
136
|
+
onItemClick?: (event: ListBoxItemClickEvent) => void;
|
|
137
|
+
/**
|
|
138
|
+
* Fires on keydown over the ListBox list items. It can be use to add keyboard extra keyboard navigation option.
|
|
139
|
+
*/
|
|
140
|
+
onKeyDown?: (event: ListBoxKeyDownEvent) => void;
|
|
141
|
+
/**
|
|
142
|
+
* Fires when an the user start to drag an item from the ListBox. The event contains information for the item that is being dragged.
|
|
143
|
+
*/
|
|
144
|
+
onDragStart?: (event: ListBoxDragEvent) => void;
|
|
145
|
+
/**
|
|
146
|
+
* Fires when an the user drags over an item from the ListBox. The event contains information for the item that is dragged over.
|
|
147
|
+
*/
|
|
148
|
+
onDragOver?: (event: ListBoxDragEvent) => void;
|
|
149
|
+
/**
|
|
150
|
+
* Fires when an the user drops an item. The event contains information for the drop target item.
|
|
151
|
+
*/
|
|
152
|
+
onDrop?: (event: ListBoxDragEvent) => void;
|
|
153
|
+
/**
|
|
154
|
+
* Fires when a dragged element or text selection leaves the ListBox element.
|
|
155
|
+
*/
|
|
156
|
+
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
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* @hidden
|
|
172
|
+
*/
|
|
173
|
+
static defaultProps: {
|
|
174
|
+
data: never[];
|
|
175
|
+
dataConnected: never[];
|
|
176
|
+
selectedField: string;
|
|
177
|
+
};
|
|
178
|
+
private get isRtl();
|
|
179
|
+
/**
|
|
180
|
+
* @hidden
|
|
181
|
+
*/
|
|
182
|
+
render(): JSX_2.Element;
|
|
183
|
+
private checkSvgIcon;
|
|
184
|
+
private checkFontIcon;
|
|
185
|
+
private handleToolClick;
|
|
186
|
+
private isItemDisabled;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export declare interface ListBoxToolbarClickEvent extends BaseEvent<ListBoxToolbar> {
|
|
190
|
+
toolName?: string;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export declare interface ListBoxToolbarProps {
|
|
194
|
+
/**
|
|
195
|
+
* Sets the tools of the ListBoxToolbar. By default, the ListBoxToolbar renders no tools.
|
|
196
|
+
* The built-in tools are:
|
|
197
|
+
* * `moveUp`
|
|
198
|
+
* * `moveDown`
|
|
199
|
+
* * `transferTo`
|
|
200
|
+
* * `transferFrom`
|
|
201
|
+
* * `transferAllTo`
|
|
202
|
+
* * `transferAllFrom`
|
|
203
|
+
* * `remove`
|
|
204
|
+
*/
|
|
205
|
+
tools?: Array<string>;
|
|
206
|
+
/**
|
|
207
|
+
* The data of the main ListBox.
|
|
208
|
+
*/
|
|
209
|
+
data: Array<any>;
|
|
210
|
+
/**
|
|
211
|
+
* The data of the connected ListBox.
|
|
212
|
+
*/
|
|
213
|
+
dataConnected: Array<any>;
|
|
214
|
+
/**
|
|
215
|
+
* Set the selected field of the ListBoxToolbar.
|
|
216
|
+
* Based on that value of that field the ListBoxToolbar will determine which actions are allowed and which disabled.
|
|
217
|
+
*/
|
|
218
|
+
selectedField?: string;
|
|
219
|
+
/**
|
|
220
|
+
* Fires when one of the ListBoxToolbar tools is clicked.
|
|
221
|
+
*/
|
|
222
|
+
onToolClick?: (event: ListBoxToolbarClickEvent) => void;
|
|
223
|
+
/**
|
|
224
|
+
* @hidden
|
|
225
|
+
*/
|
|
226
|
+
dir?: string;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @hidden
|
|
231
|
+
*/
|
|
232
|
+
export declare const moveItem: (from: number, to: number, data: Array<any>) => any[];
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Process the data collection/s based on the clicked ListBoxToolbar tool.
|
|
236
|
+
*
|
|
237
|
+
* @param {T[]} listBoxOneData - The first data collection.
|
|
238
|
+
* @param {T[]} listBoxTwoData - The second data collection. Pass an empty array if there is only one ListBox.
|
|
239
|
+
* @param {string} toolName - The tool that was clicked.
|
|
240
|
+
* @param {string} selectedField - The field that contains the selected information in the data object.
|
|
241
|
+
* @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
|
|
242
|
+
*/
|
|
243
|
+
export declare const processListBoxData: (listBoxOneData: any[] | undefined, listBoxTwoData: any[] | undefined, toolName: string, selectedField: string) => {
|
|
244
|
+
listBoxOneData: any[];
|
|
245
|
+
listBoxTwoData: any[];
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Process the data collection/s based on the dragged and drop item.
|
|
250
|
+
*
|
|
251
|
+
* @param {T[]} listBoxOneData - The first data collection.
|
|
252
|
+
* @param {T[]} listBoxTwoData - The second data collection. Pass an empty array if there is only one ListBox.
|
|
253
|
+
* @param {any} dragItem - The item that was dragged.
|
|
254
|
+
* @param {any} dropItem - The drop target item.
|
|
255
|
+
* @param {string} valueField - The field which points to the unique value of each data item.
|
|
256
|
+
* @returns {{listBoxOneData: T[], listBoxTwoData: t[]}} - The object that contains the new data collections.
|
|
257
|
+
*/
|
|
258
|
+
export declare const processListBoxDragAndDrop: (listBoxOneData: any[] | undefined, listBoxTwoData: any[] | undefined, dragItem: any, dropItem: any, valueField: string) => {
|
|
259
|
+
listBoxOneData: any[];
|
|
260
|
+
listBoxTwoData: any[];
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
declare enum toolbarPosition {
|
|
264
|
+
TOP = "top",
|
|
265
|
+
BOTTOM = "bottom",
|
|
266
|
+
LEFT = "left",
|
|
267
|
+
RIGHT = "right",
|
|
268
|
+
NONE = "none"
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export { }
|