@progress/kendo-react-dropdowns 9.0.0-develop.18 → 9.0.0-develop.19
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/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +591 -581
- package/common/DropDownBase.js +1 -1
- package/common/DropDownBase.mjs +119 -115
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +45 -229
- package/index.d.ts +45 -229
- package/index.js +1 -1
- package/index.mjs +39 -40
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
package/common/DropDownBase.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 v=require("react"),n=require("prop-types"),y=require("./VirtualScrollStatic.js"),S=require("./Navigation.js"),c=require("./utils.js");function b(l){const
|
|
8
|
+
"use client";"use strict";const v=require("react"),n=require("prop-types"),y=require("./VirtualScrollStatic.js"),S=require("./Navigation.js"),c=require("./utils.js");function b(l){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const t in l)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(l,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>l[t]})}}return e.default=l,Object.freeze(e)}const P=b(v),a=class a{constructor(e){this.wrapper=null,this.list=null,this.vs=new y.VirtualScroll,this.navigation=new S.Navigation,this.handleItemClick=(t,s)=>{const i=this.initState();i.syntheticEvent=s,s.stopPropagation(),this.component.handleItemSelect(t,i),this.togglePopup(i),this.applyState(i)},this.handleFocus=t=>{if(!this.component.state.focused){const s=this.initState();s.data.focused=!0,s.events.push({type:"onFocus"}),s.syntheticEvent=t,this.applyState(s)}},this.filterChanged=(t,s)=>{const{textField:i,filterable:o}=this.component.props;o&&s.events.push({type:"onFilterChange",filter:{field:i,operator:"contains",ignoreCase:!0,value:t}})},this.togglePopup=t=>{const s=this.component.props,i=s.opened!==void 0?s.opened:this.component.state.opened;s.opened===void 0&&(t.data.opened=!i),i?t.events.push({type:"onClose"}):(t.events.push({type:"onOpen"}),this.calculatePopupWidth())},this.pageChange=(t,s)=>{const i=this.initState();i.syntheticEvent=s,this.triggerOnPageChange(i,t.skip,t.take),this.applyState(i)},this.scrollToVirtualItem=(t,s)=>{const i=this.vs;if(t.skip===0)i.reset();else{let o=i.translate;o===0&&(i.calcScrollElementHeight(),o=i.itemHeight*t.skip,i.translateTo(o,!0)),s<0&&o>0&&(o+=i.itemHeight*(t.pageSize/4)),i.container&&(i.container.scrollTop=o),this.scrollToItem(s,!0)}},this.scrollPopupByPageSize=t=>{var p,u,d,g,f,m;const s=this.vs,i=(u=(p=this.list)==null?void 0:p.parentElement)==null?void 0:u.scrollTop,o=s.enabled&&s.itemHeight?s.itemHeight:this.list?this.list.children[0].offsetHeight:0,r=(g=(d=this.list)==null?void 0:d.parentElement)==null?void 0:g.offsetHeight;i!==void 0&&r!==void 0&&((m=(f=this.list)==null?void 0:f.parentElement)==null||m.scroll({top:i+t*Math.floor(r/o)*o}))},this.renderScrollElement=()=>{const t=this.vs;return t.enabled&&P.createElement("div",{ref:s=>t.scrollElement=s,key:"scrollElementKey"})},this.resetGroupStickyHeader=(t,s)=>{t!==s.state.group&&s.setState({group:t})},this.listBoxId=e.props.id+"list",this.guid=e.props.id,this.component=e,this.vs.PageChange=this.pageChange}didUpdate(){this.vs.listTransform&&this.vs.list&&(this.vs.list.style.transform=this.vs.listTransform,this.vs.listTransform="")}didMount(){const e=this.component.props,t=e.popupSettings||{},s=e.style||{},i=t.width;let o=e.opened===!0;i===void 0&&this.calculatePopupWidth(),e.dir===void 0&&s.direction===void 0&&(this.calculateDir(),o=!0),o&&this.component.forceUpdate()}calculateDir(){const e=this.component.element;e&&e.ownerDocument&&e.ownerDocument.defaultView&&(this.dirCalculated=e.ownerDocument.defaultView.getComputedStyle(e).direction||void 0)}calculatePopupWidth(){this.wrapper&&(this.popupWidth=this.wrapper.offsetWidth+"px")}scrollToItem(e,t,s){const i=this.list||this.vs.list;if(!i&&!s&&setTimeout(()=>{this.scrollToItem(e,t,!0)},10),e===0&&t&&this.vs.skip===0){this.vs.reset();return}if(i&&e>=0){const o=this.vs,r=o.container||i.parentNode,p=t!==void 0?t:o.enabled;c.scrollToItem(r,i,e,o.translate,p)}}updateComponentArgs(e){for(let t in e)Object.hasOwnProperty.call(e,t)&&(this.component[t]=e[t])}initState(){return{data:{},events:[],syntheticEvent:void 0}}applyState(e){Object.keys(e.data).length>0&&this.component.setState(e.data);const t={syntheticEvent:e.syntheticEvent,nativeEvent:e.syntheticEvent?e.syntheticEvent.nativeEvent:void 0,target:this.component,value:this.component.value};e.events.forEach(s=>{const i=s.type;delete s.type;const o=i&&this.component.props[i];o&&o.call(void 0,{...t,...s})})}triggerOnPageChange(e,t,s){const i=this.component.props.virtual;if(i){const o=Math.min(Math.max(0,t),Math.max(0,i.total-s));o!==i.skip&&e.events.push({type:"onPageChange",page:{skip:o,take:s}})}}triggerPageChangeCornerItems(e,t){const s=this.component.props,{data:i=[],dataItemKey:o,virtual:r}=s,p=s.opened!==void 0?s.opened:this.component.state.opened;e&&r&&this.vs.enabled&&(r.skip>0&&c.areSame(e,i[0],o)?this.triggerOnPageChange(t,r.skip-1,r.pageSize):!p&&r.skip+r.pageSize<r.total&&c.areSame(e,i[i.length-1],o)&&this.triggerOnPageChange(t,r.skip+1,r.pageSize))}getPopupSettings(){return Object.assign({},a.defaultProps.popupSettings,this.component.props.popupSettings)}getAdaptiveAnimation(){const e=this.getPopupSettings();return e.animate!==void 0?e.animate:!0}getGroupedDataModernMode(e,t){const s=[];return e.forEach((i,o)=>{e[o-1]&&i[t]!==e[o-1][t]&&s.push({[t]:i[t]}),s.push(e[o])}),s}};a.basicPropTypes={opened:n.bool,disabled:n.bool,dir:n.string,tabIndex:n.number,accessKey:n.string,data:n.array,textField:n.string,className:n.string,label:n.string,loading:n.bool,popupSettings:n.shape({animate:n.oneOfType([n.bool,n.shape({openDuration:n.number,closeDuration:n.number})]),popupClass:n.string,className:n.string,appendTo:n.any,width:n.oneOfType([n.string,n.number]),height:n.oneOfType([n.string,n.number])}),onOpen:n.func,onClose:n.func,onFocus:n.func,onBlur:n.func,onChange:n.func,itemRender:n.func,listNoDataRender:n.func,focusedItemIndex:n.func,header:n.node,footer:n.node},a.propTypes={...a.basicPropTypes,value:n.any,defaultValue:n.any,filterable:n.bool,filter:n.string,virtual:n.shape({pageSize:n.number.isRequired,skip:n.number.isRequired,total:n.number.isRequired}),onFilterChange:n.func,onPageChange:n.func},a.defaultProps={popupSettings:{height:"200px"},required:!1,validityStyles:!0};let h=a;module.exports=h;
|
package/common/DropDownBase.mjs
CHANGED
|
@@ -7,86 +7,90 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as m from "react";
|
|
10
|
-
import
|
|
10
|
+
import n from "prop-types";
|
|
11
11
|
import { VirtualScroll as v } from "./VirtualScrollStatic.mjs";
|
|
12
12
|
import { Navigation as y } from "./Navigation.mjs";
|
|
13
13
|
import { scrollToItem as S, areSame as g } from "./utils.mjs";
|
|
14
14
|
const a = class a {
|
|
15
|
-
constructor(
|
|
16
|
-
this.wrapper = null, this.list = null, this.vs = new v(), this.navigation = new y(), this.handleItemClick = (
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
}, this.handleFocus = (
|
|
15
|
+
constructor(s) {
|
|
16
|
+
this.wrapper = null, this.list = null, this.vs = new v(), this.navigation = new y(), this.handleItemClick = (t, e) => {
|
|
17
|
+
const i = this.initState();
|
|
18
|
+
i.syntheticEvent = e, e.stopPropagation(), this.component.handleItemSelect(t, i), this.togglePopup(i), this.applyState(i);
|
|
19
|
+
}, this.handleFocus = (t) => {
|
|
20
20
|
if (!this.component.state.focused) {
|
|
21
|
-
const
|
|
22
|
-
|
|
21
|
+
const e = this.initState();
|
|
22
|
+
e.data.focused = !0, e.events.push({ type: "onFocus" }), e.syntheticEvent = t, this.applyState(e);
|
|
23
23
|
}
|
|
24
|
-
}, this.filterChanged = (
|
|
25
|
-
const { textField:
|
|
26
|
-
o &&
|
|
24
|
+
}, this.filterChanged = (t, e) => {
|
|
25
|
+
const { textField: i, filterable: o } = this.component.props;
|
|
26
|
+
o && e.events.push({
|
|
27
27
|
type: "onFilterChange",
|
|
28
28
|
filter: {
|
|
29
|
-
field:
|
|
29
|
+
field: i,
|
|
30
30
|
operator: "contains",
|
|
31
31
|
ignoreCase: !0,
|
|
32
|
-
value:
|
|
32
|
+
value: t
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
|
-
}, this.togglePopup = (
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
}, this.pageChange = (
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
}, this.scrollToVirtualItem = (
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
|
|
35
|
+
}, this.togglePopup = (t) => {
|
|
36
|
+
const e = this.component.props, i = e.opened !== void 0 ? e.opened : this.component.state.opened;
|
|
37
|
+
e.opened === void 0 && (t.data.opened = !i), i ? t.events.push({ type: "onClose" }) : (t.events.push({ type: "onOpen" }), this.calculatePopupWidth());
|
|
38
|
+
}, this.pageChange = (t, e) => {
|
|
39
|
+
const i = this.initState();
|
|
40
|
+
i.syntheticEvent = e, this.triggerOnPageChange(i, t.skip, t.take), this.applyState(i);
|
|
41
|
+
}, this.scrollToVirtualItem = (t, e) => {
|
|
42
|
+
const i = this.vs;
|
|
43
|
+
if (t.skip === 0)
|
|
44
|
+
i.reset();
|
|
45
45
|
else {
|
|
46
|
-
let o =
|
|
47
|
-
o === 0 && (
|
|
46
|
+
let o = i.translate;
|
|
47
|
+
o === 0 && (i.calcScrollElementHeight(), o = i.itemHeight * t.skip, i.translateTo(o, !0)), e < 0 && o > 0 && (o += i.itemHeight * (t.pageSize / 4)), i.container && (i.container.scrollTop = o), this.scrollToItem(e, !0);
|
|
48
48
|
}
|
|
49
|
-
}, this.scrollPopupByPageSize = (
|
|
49
|
+
}, this.scrollPopupByPageSize = (t) => {
|
|
50
50
|
var r, l, h, c, u, d;
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
top:
|
|
51
|
+
const e = this.vs, i = (l = (r = this.list) == null ? void 0 : r.parentElement) == null ? void 0 : l.scrollTop, o = e.enabled && e.itemHeight ? e.itemHeight : this.list ? this.list.children[0].offsetHeight : 0, p = (c = (h = this.list) == null ? void 0 : h.parentElement) == null ? void 0 : c.offsetHeight;
|
|
52
|
+
i !== void 0 && p !== void 0 && ((d = (u = this.list) == null ? void 0 : u.parentElement) == null || d.scroll({
|
|
53
|
+
top: i + t * Math.floor(p / o) * o
|
|
54
54
|
}));
|
|
55
55
|
}, this.renderScrollElement = () => {
|
|
56
|
-
const
|
|
57
|
-
return
|
|
58
|
-
}, this.resetGroupStickyHeader = (
|
|
59
|
-
|
|
60
|
-
}, this.listBoxId =
|
|
56
|
+
const t = this.vs;
|
|
57
|
+
return t.enabled && /* @__PURE__ */ m.createElement("div", { ref: (e) => t.scrollElement = e, key: "scrollElementKey" });
|
|
58
|
+
}, this.resetGroupStickyHeader = (t, e) => {
|
|
59
|
+
t !== e.state.group && e.setState({ group: t });
|
|
60
|
+
}, this.listBoxId = s.props.id + "list", this.guid = s.props.id, this.component = s, this.vs.PageChange = this.pageChange;
|
|
61
61
|
}
|
|
62
62
|
didUpdate() {
|
|
63
63
|
this.vs.listTransform && this.vs.list && (this.vs.list.style.transform = this.vs.listTransform, this.vs.listTransform = "");
|
|
64
64
|
}
|
|
65
65
|
didMount() {
|
|
66
|
-
const
|
|
67
|
-
let o =
|
|
68
|
-
|
|
66
|
+
const s = this.component.props, t = s.popupSettings || {}, e = s.style || {}, i = t.width;
|
|
67
|
+
let o = s.opened === !0;
|
|
68
|
+
i === void 0 && this.calculatePopupWidth(), s.dir === void 0 && e.direction === void 0 && (this.calculateDir(), o = !0), o && this.component.forceUpdate();
|
|
69
69
|
}
|
|
70
70
|
calculateDir() {
|
|
71
|
-
const
|
|
72
|
-
|
|
71
|
+
const s = this.component.element;
|
|
72
|
+
s && s.ownerDocument && s.ownerDocument.defaultView && (this.dirCalculated = s.ownerDocument.defaultView.getComputedStyle(s).direction || void 0);
|
|
73
73
|
}
|
|
74
74
|
calculatePopupWidth() {
|
|
75
75
|
this.wrapper && (this.popupWidth = this.wrapper.offsetWidth + "px");
|
|
76
76
|
}
|
|
77
|
-
scrollToItem(
|
|
78
|
-
const
|
|
79
|
-
if (!
|
|
80
|
-
this.scrollToItem(
|
|
81
|
-
}, 10),
|
|
77
|
+
scrollToItem(s, t, e) {
|
|
78
|
+
const i = this.list || this.vs.list;
|
|
79
|
+
if (!i && !e && setTimeout(() => {
|
|
80
|
+
this.scrollToItem(s, t, !0);
|
|
81
|
+
}, 10), s === 0 && t && this.vs.skip === 0) {
|
|
82
82
|
this.vs.reset();
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
if (
|
|
86
|
-
const o = this.vs, p = o.container ||
|
|
87
|
-
S(p,
|
|
85
|
+
if (i && s >= 0) {
|
|
86
|
+
const o = this.vs, p = o.container || i.parentNode, r = t !== void 0 ? t : o.enabled;
|
|
87
|
+
S(p, i, s, o.translate, r);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
updateComponentArgs(s) {
|
|
91
|
+
for (let t in s)
|
|
92
|
+
Object.hasOwnProperty.call(s, t) && (this.component[t] = s[t]);
|
|
93
|
+
}
|
|
90
94
|
initState() {
|
|
91
95
|
return {
|
|
92
96
|
data: {},
|
|
@@ -94,100 +98,100 @@ const a = class a {
|
|
|
94
98
|
syntheticEvent: void 0
|
|
95
99
|
};
|
|
96
100
|
}
|
|
97
|
-
applyState(
|
|
98
|
-
Object.keys(
|
|
99
|
-
const
|
|
100
|
-
syntheticEvent:
|
|
101
|
-
nativeEvent:
|
|
101
|
+
applyState(s) {
|
|
102
|
+
Object.keys(s.data).length > 0 && this.component.setState(s.data);
|
|
103
|
+
const t = {
|
|
104
|
+
syntheticEvent: s.syntheticEvent,
|
|
105
|
+
nativeEvent: s.syntheticEvent ? s.syntheticEvent.nativeEvent : void 0,
|
|
102
106
|
target: this.component,
|
|
103
107
|
value: this.component.value
|
|
104
108
|
};
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
delete
|
|
108
|
-
const o =
|
|
109
|
+
s.events.forEach((e) => {
|
|
110
|
+
const i = e.type;
|
|
111
|
+
delete e.type;
|
|
112
|
+
const o = i && this.component.props[i];
|
|
109
113
|
o && o.call(void 0, {
|
|
110
|
-
...
|
|
111
|
-
...
|
|
114
|
+
...t,
|
|
115
|
+
...e
|
|
112
116
|
});
|
|
113
117
|
});
|
|
114
118
|
}
|
|
115
|
-
triggerOnPageChange(
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
118
|
-
const o = Math.min(Math.max(0,
|
|
119
|
-
o !==
|
|
119
|
+
triggerOnPageChange(s, t, e) {
|
|
120
|
+
const i = this.component.props.virtual;
|
|
121
|
+
if (i) {
|
|
122
|
+
const o = Math.min(Math.max(0, t), Math.max(0, i.total - e));
|
|
123
|
+
o !== i.skip && s.events.push({
|
|
120
124
|
type: "onPageChange",
|
|
121
|
-
page: { skip: o, take:
|
|
125
|
+
page: { skip: o, take: e }
|
|
122
126
|
});
|
|
123
127
|
}
|
|
124
128
|
}
|
|
125
|
-
triggerPageChangeCornerItems(
|
|
126
|
-
const
|
|
127
|
-
|
|
129
|
+
triggerPageChangeCornerItems(s, t) {
|
|
130
|
+
const e = this.component.props, { data: i = [], dataItemKey: o, virtual: p } = e, r = e.opened !== void 0 ? e.opened : this.component.state.opened;
|
|
131
|
+
s && p && this.vs.enabled && (p.skip > 0 && g(s, i[0], o) ? this.triggerOnPageChange(t, p.skip - 1, p.pageSize) : !r && p.skip + p.pageSize < p.total && g(s, i[i.length - 1], o) && this.triggerOnPageChange(t, p.skip + 1, p.pageSize));
|
|
128
132
|
}
|
|
129
133
|
getPopupSettings() {
|
|
130
134
|
return Object.assign({}, a.defaultProps.popupSettings, this.component.props.popupSettings);
|
|
131
135
|
}
|
|
132
136
|
getAdaptiveAnimation() {
|
|
133
|
-
const
|
|
134
|
-
return
|
|
137
|
+
const s = this.getPopupSettings();
|
|
138
|
+
return s.animate !== void 0 ? s.animate : !0;
|
|
135
139
|
}
|
|
136
|
-
getGroupedDataModernMode(
|
|
137
|
-
const
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
}),
|
|
140
|
+
getGroupedDataModernMode(s, t) {
|
|
141
|
+
const e = [];
|
|
142
|
+
return s.forEach((i, o) => {
|
|
143
|
+
s[o - 1] && i[t] !== s[o - 1][t] && e.push({ [t]: i[t] }), e.push(s[o]);
|
|
144
|
+
}), e;
|
|
141
145
|
}
|
|
142
146
|
};
|
|
143
147
|
a.basicPropTypes = {
|
|
144
|
-
opened:
|
|
145
|
-
disabled:
|
|
146
|
-
dir:
|
|
147
|
-
tabIndex:
|
|
148
|
-
accessKey:
|
|
149
|
-
data:
|
|
150
|
-
textField:
|
|
151
|
-
className:
|
|
152
|
-
label:
|
|
153
|
-
loading:
|
|
154
|
-
popupSettings:
|
|
155
|
-
animate:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
openDuration:
|
|
159
|
-
closeDuration:
|
|
148
|
+
opened: n.bool,
|
|
149
|
+
disabled: n.bool,
|
|
150
|
+
dir: n.string,
|
|
151
|
+
tabIndex: n.number,
|
|
152
|
+
accessKey: n.string,
|
|
153
|
+
data: n.array,
|
|
154
|
+
textField: n.string,
|
|
155
|
+
className: n.string,
|
|
156
|
+
label: n.string,
|
|
157
|
+
loading: n.bool,
|
|
158
|
+
popupSettings: n.shape({
|
|
159
|
+
animate: n.oneOfType([
|
|
160
|
+
n.bool,
|
|
161
|
+
n.shape({
|
|
162
|
+
openDuration: n.number,
|
|
163
|
+
closeDuration: n.number
|
|
160
164
|
})
|
|
161
165
|
]),
|
|
162
|
-
popupClass:
|
|
163
|
-
className:
|
|
164
|
-
appendTo:
|
|
165
|
-
width:
|
|
166
|
-
height:
|
|
166
|
+
popupClass: n.string,
|
|
167
|
+
className: n.string,
|
|
168
|
+
appendTo: n.any,
|
|
169
|
+
width: n.oneOfType([n.string, n.number]),
|
|
170
|
+
height: n.oneOfType([n.string, n.number])
|
|
167
171
|
}),
|
|
168
|
-
onOpen:
|
|
169
|
-
onClose:
|
|
170
|
-
onFocus:
|
|
171
|
-
onBlur:
|
|
172
|
-
onChange:
|
|
173
|
-
itemRender:
|
|
174
|
-
listNoDataRender:
|
|
175
|
-
focusedItemIndex:
|
|
176
|
-
header:
|
|
177
|
-
footer:
|
|
172
|
+
onOpen: n.func,
|
|
173
|
+
onClose: n.func,
|
|
174
|
+
onFocus: n.func,
|
|
175
|
+
onBlur: n.func,
|
|
176
|
+
onChange: n.func,
|
|
177
|
+
itemRender: n.func,
|
|
178
|
+
listNoDataRender: n.func,
|
|
179
|
+
focusedItemIndex: n.func,
|
|
180
|
+
header: n.node,
|
|
181
|
+
footer: n.node
|
|
178
182
|
}, a.propTypes = {
|
|
179
183
|
...a.basicPropTypes,
|
|
180
|
-
value:
|
|
181
|
-
defaultValue:
|
|
182
|
-
filterable:
|
|
183
|
-
filter:
|
|
184
|
-
virtual:
|
|
185
|
-
pageSize:
|
|
186
|
-
skip:
|
|
187
|
-
total:
|
|
184
|
+
value: n.any,
|
|
185
|
+
defaultValue: n.any,
|
|
186
|
+
filterable: n.bool,
|
|
187
|
+
filter: n.string,
|
|
188
|
+
virtual: n.shape({
|
|
189
|
+
pageSize: n.number.isRequired,
|
|
190
|
+
skip: n.number.isRequired,
|
|
191
|
+
total: n.number.isRequired
|
|
188
192
|
}),
|
|
189
|
-
onFilterChange:
|
|
190
|
-
onPageChange:
|
|
193
|
+
onFilterChange: n.func,
|
|
194
|
+
onPageChange: n.func
|
|
191
195
|
}, a.defaultProps = {
|
|
192
196
|
popupSettings: {
|
|
193
197
|
height: "200px"
|