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