@progress/kendo-react-dropdowns 13.3.0-develop.8 → 13.3.0
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 +297 -295
- package/common/utils.js +1 -1
- package/common/utils.mjs +30 -30
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +13 -0
- package/index.d.ts +13 -0
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=e=>e!=null,d=(e,t)=>{for(let r=0;r<e.length;r++)if(e.charAt(r)!==t)return!1;return!0},I=(e,t,r)=>{let n=e;return r&&(n=[r].concat(n)),n.slice(t).concat(n.slice(0,t))},m=(e,t,r)=>{if(!u(e))return!1;let n=String(e);return r&&(n=n.toLowerCase()),n.indexOf(t)===0},D=(e,t,r,n,s)=>{const o=e.offsetHeight,i=t.children.item(r),f=i.offsetTop+(s?n-e.scrollTop:0),l=i.offsetHeight;if(s){let a=0;f+l>o?a=f+l-o:f<0&&(a=f),a!==0?e.scrollTop+=a:e.scrollTop===0&&n!==0&&(e.scrollTop=n)}else f+l>o+e.scrollTop?e.scrollTop=f+l-o:f<e.scrollTop&&(e.scrollTop-=e.scrollTop-f)},g=(e,t,r)=>{let n=-1;if(t){t=t.toLowerCase();for(let s=0;s<e.length;s++){const o=(c(e[s],r)||"")+"";if(o&&o.toLowerCase().startsWith(t)){n=s;break}}}return n},p=(e,t,r,n=!1,s=!1)=>{const o=i=>s||!n?i.toLowerCase():i;return e.findIndex(i=>r?o(c(i,r))===o(t):o(t)===o(i.toString()))},c=(e,t)=>{if(t&&u(e)){const r=t.split(".");let n=e;return r.forEach(s=>{n=n?n[s]:void 0}),n}return e},x=(e,t,r)=>{if(!e)return;const n=e.findIndex(s=>c(s,t)===r);return e[n]},T=(e=[],t=[],r)=>{if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!h(e[n],t[n],r))return!1;return!0},C=(e,t,r)=>{t.forEach(n=>{const s=e.findIndex(o=>h(o,n,r));s!==-1&&e.splice(s,1)})},h=(e,t,r)=>e===t||u(e)===u(t)&&c(e,r)===c(t,r),y=(e,t,r)=>{if(t){const n=p(e,t,r,!0);return n!==-1?e[n]:e[g(e,t,r)]}return e[0]},S=(e,t=[],r)=>{let n="";if(e){const s=t[g(t,e,r)];if(s){const o=c(s,r);e.toLowerCase()!==o.toLowerCase()&&(n=o.substring(e.length))}}return n},w=e=>{e.target.nodeName!=="INPUT"&&e.preventDefault()},L=(e,t,r)=>!!e!=!!t||e.text!==t.text?!1:e===t||T(e.data,t.data,r),P=e=>{const t=e.filter((r,n)=>e.some((s,o)=>s===r&&o!==n));return Array.from(new Set(t))},V=e=>{const{data:t=[],groupField:r}=e;return r?t.filter(n=>r&&n[r]!==void 0):t};exports.areSame=h;exports.findByFieldValue=x;exports.getFilteredData=V;exports.getFocusedItem=y;exports.getItemIndexByText=p;exports.getItemValue=c;exports.getPlainDataDuplicates=P;exports.isPresent=u;exports.itemIndexStartsWith=g;exports.matchDataCollections=T;exports.matchTags=L;exports.matchText=m;exports.preventDefaultNonInputs=w;exports.removeDataItems=C;exports.sameCharsOnly=d;exports.scrollToItem=D;exports.shuffleData=I;exports.suggestValue=S;
|
package/common/utils.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
const
|
|
8
|
+
const g = (e) => e != null, d = (e, t) => {
|
|
9
9
|
for (let r = 0; r < e.length; r++)
|
|
10
10
|
if (e.charAt(r) !== t)
|
|
11
11
|
return !1;
|
|
@@ -14,46 +14,46 @@ const l = (e) => e != null, d = (e, t) => {
|
|
|
14
14
|
let n = e;
|
|
15
15
|
return r && (n = [r].concat(n)), n.slice(t).concat(n.slice(0, t));
|
|
16
16
|
}, x = (e, t, r) => {
|
|
17
|
-
if (!
|
|
17
|
+
if (!g(e))
|
|
18
18
|
return !1;
|
|
19
19
|
let n = String(e);
|
|
20
20
|
return r && (n = n.toLowerCase()), n.indexOf(t) === 0;
|
|
21
|
-
}, C = (e, t, r, n,
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
let
|
|
25
|
-
|
|
21
|
+
}, C = (e, t, r, n, s) => {
|
|
22
|
+
const o = e.offsetHeight, f = t.children.item(r), i = f.offsetTop + (s ? n - e.scrollTop : 0), u = f.offsetHeight;
|
|
23
|
+
if (s) {
|
|
24
|
+
let l = 0;
|
|
25
|
+
i + u > o ? l = i + u - o : i < 0 && (l = i), l !== 0 ? e.scrollTop += l : e.scrollTop === 0 && n !== 0 && (e.scrollTop = n);
|
|
26
26
|
} else
|
|
27
|
-
|
|
27
|
+
i + u > o + e.scrollTop ? e.scrollTop = i + u - o : i < e.scrollTop && (e.scrollTop -= e.scrollTop - i);
|
|
28
28
|
}, h = (e, t, r) => {
|
|
29
29
|
let n = -1;
|
|
30
30
|
if (t) {
|
|
31
31
|
t = t.toLowerCase();
|
|
32
|
-
for (let
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
n =
|
|
32
|
+
for (let s = 0; s < e.length; s++) {
|
|
33
|
+
const o = (c(e[s], r) || "") + "";
|
|
34
|
+
if (o && o.toLowerCase().startsWith(t)) {
|
|
35
|
+
n = s;
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
return n;
|
|
41
|
-
}, T = (e, t, r, n = !1) => {
|
|
42
|
-
const o = (
|
|
43
|
-
return e.findIndex((
|
|
44
|
-
},
|
|
45
|
-
if (t &&
|
|
41
|
+
}, T = (e, t, r, n = !1, s = !1) => {
|
|
42
|
+
const o = (f) => s || !n ? f.toLowerCase() : f;
|
|
43
|
+
return e.findIndex((f) => r ? o(c(f, r)) === o(t) : o(t) === o(f.toString()));
|
|
44
|
+
}, c = (e, t) => {
|
|
45
|
+
if (t && g(e)) {
|
|
46
46
|
const r = t.split(".");
|
|
47
47
|
let n = e;
|
|
48
|
-
return r.forEach((
|
|
49
|
-
n = n ? n[
|
|
48
|
+
return r.forEach((s) => {
|
|
49
|
+
n = n ? n[s] : void 0;
|
|
50
50
|
}), n;
|
|
51
51
|
}
|
|
52
52
|
return e;
|
|
53
53
|
}, D = (e, t, r) => {
|
|
54
54
|
if (!e)
|
|
55
55
|
return;
|
|
56
|
-
const n = e.findIndex((
|
|
56
|
+
const n = e.findIndex((s) => c(s, t) === r);
|
|
57
57
|
return e[n];
|
|
58
58
|
}, a = (e = [], t = [], r) => {
|
|
59
59
|
if (e === t)
|
|
@@ -66,10 +66,10 @@ const l = (e) => e != null, d = (e, t) => {
|
|
|
66
66
|
return !0;
|
|
67
67
|
}, w = (e, t, r) => {
|
|
68
68
|
t.forEach((n) => {
|
|
69
|
-
const
|
|
70
|
-
|
|
69
|
+
const s = e.findIndex((o) => p(o, n, r));
|
|
70
|
+
s !== -1 && e.splice(s, 1);
|
|
71
71
|
});
|
|
72
|
-
}, p = (e, t, r) => e === t ||
|
|
72
|
+
}, p = (e, t, r) => e === t || g(e) === g(t) && c(e, r) === c(t, r), L = (e, t, r) => {
|
|
73
73
|
if (t) {
|
|
74
74
|
const n = T(e, t, r, !0);
|
|
75
75
|
return n !== -1 ? e[n] : e[h(e, t, r)];
|
|
@@ -78,10 +78,10 @@ const l = (e) => e != null, d = (e, t) => {
|
|
|
78
78
|
}, H = (e, t = [], r) => {
|
|
79
79
|
let n = "";
|
|
80
80
|
if (e) {
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
83
|
-
const
|
|
84
|
-
e.toLowerCase() !==
|
|
81
|
+
const s = t[h(t, e, r)];
|
|
82
|
+
if (s) {
|
|
83
|
+
const o = c(s, r);
|
|
84
|
+
e.toLowerCase() !== o.toLowerCase() && (n = o.substring(e.length));
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
return n;
|
|
@@ -89,7 +89,7 @@ const l = (e) => e != null, d = (e, t) => {
|
|
|
89
89
|
e.target.nodeName !== "INPUT" && e.preventDefault();
|
|
90
90
|
}, y = (e, t, r) => !!e != !!t || e.text !== t.text ? !1 : e === t || a(e.data, t.data, r), N = (e) => {
|
|
91
91
|
const t = e.filter(
|
|
92
|
-
(r, n) => e.some((
|
|
92
|
+
(r, n) => e.some((s, o) => s === r && o !== n)
|
|
93
93
|
);
|
|
94
94
|
return Array.from(new Set(t));
|
|
95
95
|
}, O = (e) => {
|
|
@@ -102,9 +102,9 @@ export {
|
|
|
102
102
|
O as getFilteredData,
|
|
103
103
|
L as getFocusedItem,
|
|
104
104
|
T as getItemIndexByText,
|
|
105
|
-
|
|
105
|
+
c as getItemValue,
|
|
106
106
|
N as getPlainDataDuplicates,
|
|
107
|
-
|
|
107
|
+
g as isPresent,
|
|
108
108
|
h as itemIndexStartsWith,
|
|
109
109
|
a as matchDataCollections,
|
|
110
110
|
y as matchTags,
|