@progress/kendo-react-dropdowns 7.3.0 → 7.4.0-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +209 -195
- package/common/List.js +1 -1
- package/common/List.mjs +70 -69
- package/common/utils.js +1 -1
- package/common/utils.mjs +28 -24
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +21 -12
- package/index.d.ts +21 -12
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
package/common/List.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";const
|
|
8
|
+
"use client";"use strict";const x=require("react"),M=require("./ListItem.js"),O=require("./ListGroupItem.js"),f=require("./utils.js"),D=require("@progress/kendo-react-intl"),k=require("../messages/index.js");function j(s){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const e in s)if(e!=="default"){const t=Object.getOwnPropertyDescriptor(s,e);Object.defineProperty(r,e,t.get?t:{enumerable:!0,get:()=>s[e]})}}return r.default=s,Object.freeze(r)}const o=j(x);class N extends o.Component{renderItems(){const{textField:r,valueField:e,groupField:t,groupMode:n,isMultiColumn:v,optionsGuid:c,skip:d=0,virtual:u,focusedIndex:p,hasDuplicates:S,highlightSelected:m=!0,value:g,data:E,itemRender:w,groupHeaderItemRender:q}=this.props,R=Array.isArray(g);let C=0;return E.map((a,i)=>{const I=d+i,y=d+i+C,z=S?g?p===i:!1:a.disabled?!1:m&&(!R&&f.areSame(a,g,e)||R&&g.findIndex(L=>f.areSame(L,a,e))!==-1);let l,h,b;return i>0&&t!==void 0&&(h=f.getItemValue(a,t),b=f.getItemValue(E[i-1],t),h&&b&&h!==b&&(l=h)),l!==void 0&&n==="modern"&&(C+=1),[l!==void 0&&n==="modern"&&o.createElement(O,{id:`option-${c}-${y}`,virtual:u,key:I+"-group-item",group:l,isMultiColumn:v,render:q}),o.createElement(M,{id:`option-${c}-${l!==void 0&&n==="modern"?y+1:y}`,virtual:u,dataItem:a,groupMode:n,selected:z,focused:p===i,index:I,key:I,onClick:this.props.onClick,textField:r,group:l,render:w,disabled:a.disabled})]})}renderNoValueElement(r){const e=this.props.noDataRender,t=o.createElement("div",{className:"k-nodata"},o.createElement("div",null,r.toLanguageString(k.nodata,k.messages[k.nodata])));return e?e.call(void 0,t):t}render(){const r=D.provideLocalizationService(this),{id:e,show:t,wrapperCssClass:n,wrapperStyle:v,listStyle:c,listRef:d,wrapperRef:u,listClassName:p="k-list-ul",ariaSetSize:S}=this.props,m=this.renderItems();return m.length?o.createElement("div",{className:n,style:v,ref:u,onMouseDown:this.props.onMouseDown,onBlur:this.props.onBlur,onScroll:this.props.onScroll,unselectable:"on"},o.createElement("ul",{id:e,role:"listbox","aria-hidden":t?void 0:!0,"aria-setsize":S,className:p,ref:d,style:c},m),this.props.scroller&&o.createElement("div",{className:"k-height-container"},this.props.scroller)):this.renderNoValueElement(r)}}D.registerForLocalization(N);module.exports=N;
|
package/common/List.mjs
CHANGED
|
@@ -6,112 +6,113 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { areSame as
|
|
13
|
-
import { provideLocalizationService as
|
|
14
|
-
import { nodata as
|
|
15
|
-
class
|
|
9
|
+
import * as t from "react";
|
|
10
|
+
import z from "./ListItem.mjs";
|
|
11
|
+
import x from "./ListGroupItem.mjs";
|
|
12
|
+
import { areSame as C, getItemValue as N } from "./utils.mjs";
|
|
13
|
+
import { provideLocalizationService as F, registerForLocalization as M } from "@progress/kendo-react-intl";
|
|
14
|
+
import { nodata as R, messages as $ } from "../messages/index.mjs";
|
|
15
|
+
class A extends t.Component {
|
|
16
16
|
renderItems() {
|
|
17
17
|
const {
|
|
18
|
-
textField:
|
|
19
|
-
valueField:
|
|
18
|
+
textField: l,
|
|
19
|
+
valueField: r,
|
|
20
20
|
groupField: e,
|
|
21
21
|
groupMode: o,
|
|
22
|
-
isMultiColumn:
|
|
23
|
-
optionsGuid:
|
|
24
|
-
skip:
|
|
25
|
-
virtual:
|
|
26
|
-
focusedIndex:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
isMultiColumn: f,
|
|
23
|
+
optionsGuid: n,
|
|
24
|
+
skip: d = 0,
|
|
25
|
+
virtual: p,
|
|
26
|
+
focusedIndex: c,
|
|
27
|
+
hasDuplicates: v,
|
|
28
|
+
highlightSelected: m = !0,
|
|
29
|
+
value: u,
|
|
30
|
+
data: E,
|
|
31
|
+
itemRender: w,
|
|
32
|
+
groupHeaderItemRender: D
|
|
33
|
+
} = this.props, y = Array.isArray(u);
|
|
34
|
+
let k = 0;
|
|
35
|
+
return E.map((s, i) => {
|
|
36
|
+
const g = d + i, I = d + i + k, L = v ? u ? c === i : !1 : s.disabled ? !1 : m && (!y && C(s, u, r) || y && u.findIndex((b) => C(b, s, r)) !== -1);
|
|
37
|
+
let a, h, S;
|
|
38
|
+
return i > 0 && e !== void 0 && (h = N(s, e), S = N(E[i - 1], e), h && S && h !== S && (a = h)), a !== void 0 && o === "modern" && (k += 1), [
|
|
39
|
+
a !== void 0 && o === "modern" && /* @__PURE__ */ t.createElement(
|
|
40
|
+
x,
|
|
40
41
|
{
|
|
41
|
-
id: `option-${
|
|
42
|
-
virtual:
|
|
43
|
-
key:
|
|
44
|
-
group:
|
|
45
|
-
isMultiColumn:
|
|
46
|
-
render:
|
|
42
|
+
id: `option-${n}-${I}`,
|
|
43
|
+
virtual: p,
|
|
44
|
+
key: g + "-group-item",
|
|
45
|
+
group: a,
|
|
46
|
+
isMultiColumn: f,
|
|
47
|
+
render: D
|
|
47
48
|
}
|
|
48
49
|
),
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
50
|
+
/* @__PURE__ */ t.createElement(
|
|
51
|
+
z,
|
|
51
52
|
{
|
|
52
|
-
id: `option-${
|
|
53
|
-
virtual:
|
|
54
|
-
dataItem:
|
|
53
|
+
id: `option-${n}-${a !== void 0 && o === "modern" ? I + 1 : I}`,
|
|
54
|
+
virtual: p,
|
|
55
|
+
dataItem: s,
|
|
55
56
|
groupMode: o,
|
|
56
57
|
selected: L,
|
|
57
|
-
focused:
|
|
58
|
-
index:
|
|
59
|
-
key:
|
|
58
|
+
focused: c === i,
|
|
59
|
+
index: g,
|
|
60
|
+
key: g,
|
|
60
61
|
onClick: this.props.onClick,
|
|
61
|
-
textField:
|
|
62
|
-
group:
|
|
63
|
-
render:
|
|
64
|
-
disabled:
|
|
62
|
+
textField: l,
|
|
63
|
+
group: a,
|
|
64
|
+
render: w,
|
|
65
|
+
disabled: s.disabled
|
|
65
66
|
}
|
|
66
67
|
)
|
|
67
68
|
];
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
|
-
renderNoValueElement(
|
|
71
|
-
const
|
|
72
|
-
return
|
|
71
|
+
renderNoValueElement(l) {
|
|
72
|
+
const r = this.props.noDataRender, e = /* @__PURE__ */ t.createElement("div", { className: "k-nodata" }, /* @__PURE__ */ t.createElement("div", null, l.toLanguageString(R, $[R])));
|
|
73
|
+
return r ? r.call(void 0, e) : e;
|
|
73
74
|
}
|
|
74
75
|
render() {
|
|
75
|
-
const
|
|
76
|
-
id:
|
|
76
|
+
const l = F(this), {
|
|
77
|
+
id: r,
|
|
77
78
|
show: e,
|
|
78
79
|
wrapperCssClass: o,
|
|
79
|
-
wrapperStyle:
|
|
80
|
-
listStyle:
|
|
81
|
-
listRef:
|
|
82
|
-
wrapperRef:
|
|
83
|
-
listClassName:
|
|
80
|
+
wrapperStyle: f,
|
|
81
|
+
listStyle: n,
|
|
82
|
+
listRef: d,
|
|
83
|
+
wrapperRef: p,
|
|
84
|
+
listClassName: c = "k-list-ul",
|
|
84
85
|
ariaSetSize: v
|
|
85
|
-
} = this.props,
|
|
86
|
-
return
|
|
86
|
+
} = this.props, m = this.renderItems();
|
|
87
|
+
return m.length ? /* @__PURE__ */ t.createElement(
|
|
87
88
|
"div",
|
|
88
89
|
{
|
|
89
90
|
className: o,
|
|
90
|
-
style:
|
|
91
|
-
ref:
|
|
91
|
+
style: f,
|
|
92
|
+
ref: p,
|
|
92
93
|
onMouseDown: this.props.onMouseDown,
|
|
93
94
|
onBlur: this.props.onBlur,
|
|
94
95
|
onScroll: this.props.onScroll,
|
|
95
96
|
unselectable: "on"
|
|
96
97
|
},
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ t.createElement(
|
|
98
99
|
"ul",
|
|
99
100
|
{
|
|
100
|
-
id:
|
|
101
|
+
id: r,
|
|
101
102
|
role: "listbox",
|
|
102
103
|
"aria-hidden": e ? void 0 : !0,
|
|
103
104
|
"aria-setsize": v,
|
|
104
|
-
className:
|
|
105
|
-
ref:
|
|
106
|
-
style:
|
|
105
|
+
className: c,
|
|
106
|
+
ref: d,
|
|
107
|
+
style: n
|
|
107
108
|
},
|
|
108
|
-
|
|
109
|
+
m
|
|
109
110
|
),
|
|
110
|
-
this.props.scroller && /* @__PURE__ */
|
|
111
|
-
) : this.renderNoValueElement(
|
|
111
|
+
this.props.scroller && /* @__PURE__ */ t.createElement("div", { className: "k-height-container" }, this.props.scroller)
|
|
112
|
+
) : this.renderNoValueElement(l);
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
|
-
|
|
115
|
+
M(A);
|
|
115
116
|
export {
|
|
116
|
-
|
|
117
|
+
A as default
|
|
117
118
|
};
|
package/common/utils.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=e=>e!=null,I=(e,t)=>{for(let s=0;s<e.length;s++)if(e.charAt(s)!==t)return!1;return!0},d=(e,t,s)=>{let n=e;return s&&(n=[s].concat(n)),n.slice(t).concat(n.slice(0,t))},m=(e,t,s)=>{if(!f(e))return!1;let n=String(e);return s&&(n=n.toLowerCase()),n.indexOf(t)===0},D=(e,t,s,n,r)=>{const o=e.offsetHeight,h=t.children.item(s),i=h.offsetTop+(r?n-e.scrollTop:0),u=h.offsetHeight;if(r){let l=0;i+u>o?l=i+u-o:i<0&&(l=i),l!==0?e.scrollTop+=l:e.scrollTop===0&&n!==0&&(e.scrollTop=n)}else i+u>o+e.scrollTop?e.scrollTop=i+u-o:i<e.scrollTop&&(e.scrollTop-=e.scrollTop-i)},a=(e,t,s)=>{let n=-1;if(t){t=t.toLowerCase();for(let r=0;r<e.length;r++){const o=(c(e[r],s)||"")+"";if(o&&o.toLowerCase().startsWith(t)){n=r;break}}}return n},p=(e,t,s,n=!1)=>{const r=o=>n?o:o.toLowerCase();return e.findIndex(o=>s?r(c(o,s))===r(t):r(t)===r(o.toString()))},c=(e,t)=>{if(t&&f(e)){const s=t.split(".");let n=e;return s.forEach(r=>{n=n?n[r]:void 0}),n}return e},x=(e,t,s)=>{if(!e)return;const n=e.findIndex(r=>c(r,t)===s);return e[n]},T=(e=[],t=[],s)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!g(e[n],t[n],s))return!1;return!0},C=(e,t,s)=>{t.forEach(n=>{const r=e.findIndex(o=>g(o,n,s));r!==-1&&e.splice(r,1)})},g=(e,t,s)=>e===t||f(e)===f(t)&&c(e,s)===c(t,s),y=(e,t,s)=>{if(t){const n=p(e,t,s,!0);return n!==-1?e[n]:e[a(e,t,s)]}return e[0]},S=(e,t=[],s)=>{let n="";if(e){const r=t[a(t,e,s)];if(r){const o=c(r,s);e.toLowerCase()!==o.toLowerCase()&&(n=o.substring(e.length))}}return n},w=e=>{e.target.nodeName!=="INPUT"&&e.preventDefault()},L=(e,t,s)=>!!e!=!!t||e.text!==t.text?!1:e===t||T(e.data,t.data,s),P=e=>{const t=e.filter((s,n)=>e.some((r,o)=>r===s&&o!==n));return Array.from(new Set(t))};exports.areSame=g;exports.findByFieldValue=x;exports.getFocusedItem=y;exports.getItemIndexByText=p;exports.getItemValue=c;exports.getPlainDataDuplicates=P;exports.isPresent=f;exports.itemIndexStartsWith=a;exports.matchDataCollections=T;exports.matchTags=L;exports.matchText=m;exports.preventDefaultNonInputs=w;exports.removeDataItems=C;exports.sameCharsOnly=I;exports.scrollToItem=D;exports.shuffleData=d;exports.suggestValue=S;
|
package/common/utils.mjs
CHANGED
|
@@ -6,27 +6,27 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
const
|
|
9
|
+
const l = (e) => e != null, a = (e, t) => {
|
|
10
10
|
for (let r = 0; r < e.length; r++)
|
|
11
11
|
if (e.charAt(r) !== t)
|
|
12
12
|
return !1;
|
|
13
13
|
return !0;
|
|
14
|
-
},
|
|
14
|
+
}, d = (e, t, r) => {
|
|
15
15
|
let n = e;
|
|
16
16
|
return r && (n = [r].concat(n)), n.slice(t).concat(n.slice(0, t));
|
|
17
|
-
},
|
|
18
|
-
if (!
|
|
17
|
+
}, x = (e, t, r) => {
|
|
18
|
+
if (!l(e))
|
|
19
19
|
return !1;
|
|
20
20
|
let n = String(e);
|
|
21
21
|
return r && (n = n.toLowerCase()), n.indexOf(t) === 0;
|
|
22
|
-
},
|
|
23
|
-
const o = e.offsetHeight,
|
|
22
|
+
}, C = (e, t, r, n, s) => {
|
|
23
|
+
const o = e.offsetHeight, g = t.children.item(r), f = g.offsetTop + (s ? n - e.scrollTop : 0), c = g.offsetHeight;
|
|
24
24
|
if (s) {
|
|
25
25
|
let u = 0;
|
|
26
26
|
f + c > o ? u = f + c - o : f < 0 && (u = f), u !== 0 ? e.scrollTop += u : e.scrollTop === 0 && n !== 0 && (e.scrollTop = n);
|
|
27
27
|
} else
|
|
28
28
|
f + c > o + e.scrollTop ? e.scrollTop = f + c - o : f < e.scrollTop && (e.scrollTop -= e.scrollTop - f);
|
|
29
|
-
},
|
|
29
|
+
}, h = (e, t, r) => {
|
|
30
30
|
let n = -1;
|
|
31
31
|
if (t) {
|
|
32
32
|
t = t.toLowerCase();
|
|
@@ -43,7 +43,7 @@ const h = (e) => e != null, d = (e, t) => {
|
|
|
43
43
|
const s = (o) => n ? o : o.toLowerCase();
|
|
44
44
|
return e.findIndex((o) => r ? s(i(o, r)) === s(t) : s(t) === s(o.toString()));
|
|
45
45
|
}, i = (e, t) => {
|
|
46
|
-
if (t &&
|
|
46
|
+
if (t && l(e)) {
|
|
47
47
|
const r = t.split(".");
|
|
48
48
|
let n = e;
|
|
49
49
|
return r.forEach((s) => {
|
|
@@ -65,45 +65,49 @@ const h = (e) => e != null, d = (e, t) => {
|
|
|
65
65
|
if (!p(e[n], t[n], r))
|
|
66
66
|
return !1;
|
|
67
67
|
return !0;
|
|
68
|
-
},
|
|
68
|
+
}, D = (e, t, r) => {
|
|
69
69
|
t.forEach((n) => {
|
|
70
70
|
const s = e.findIndex((o) => p(o, n, r));
|
|
71
71
|
s !== -1 && e.splice(s, 1);
|
|
72
72
|
});
|
|
73
|
-
}, p = (e, t, r) => e === t ||
|
|
73
|
+
}, p = (e, t, r) => e === t || l(e) === l(t) && i(e, r) === i(t, r), L = (e, t, r) => {
|
|
74
74
|
if (t) {
|
|
75
75
|
const n = T(e, t, r, !0);
|
|
76
|
-
return n !== -1 ? e[n] : e[
|
|
76
|
+
return n !== -1 ? e[n] : e[h(e, t, r)];
|
|
77
77
|
}
|
|
78
78
|
return e[0];
|
|
79
79
|
}, H = (e, t = [], r) => {
|
|
80
80
|
let n = "";
|
|
81
81
|
if (e) {
|
|
82
|
-
const s = t[
|
|
82
|
+
const s = t[h(t, e, r)];
|
|
83
83
|
if (s) {
|
|
84
84
|
const o = i(s, r);
|
|
85
85
|
e.toLowerCase() !== o.toLowerCase() && (n = o.substring(e.length));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
return n;
|
|
89
|
-
},
|
|
89
|
+
}, S = (e) => {
|
|
90
90
|
e.target.nodeName !== "INPUT" && e.preventDefault();
|
|
91
|
-
},
|
|
91
|
+
}, y = (e, t, r) => !!e != !!t || e.text !== t.text ? !1 : e === t || I(e.data, t.data, r), N = (e) => {
|
|
92
|
+
const t = e.filter((r, n) => e.some((s, o) => s === r && o !== n));
|
|
93
|
+
return Array.from(new Set(t));
|
|
94
|
+
};
|
|
92
95
|
export {
|
|
93
96
|
p as areSame,
|
|
94
97
|
w as findByFieldValue,
|
|
95
|
-
|
|
98
|
+
L as getFocusedItem,
|
|
96
99
|
T as getItemIndexByText,
|
|
97
100
|
i as getItemValue,
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
N as getPlainDataDuplicates,
|
|
102
|
+
l as isPresent,
|
|
103
|
+
h as itemIndexStartsWith,
|
|
100
104
|
I as matchDataCollections,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
y as matchTags,
|
|
106
|
+
x as matchText,
|
|
107
|
+
S as preventDefaultNonInputs,
|
|
108
|
+
D as removeDataItems,
|
|
109
|
+
a as sameCharsOnly,
|
|
110
|
+
C as scrollToItem,
|
|
111
|
+
d as shuffleData,
|
|
108
112
|
H as suggestValue
|
|
109
113
|
};
|