@progress/kendo-react-dropdowns 15.0.1-develop.1 → 15.0.1-develop.10

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.
@@ -6,97 +6,103 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as m from "react";
9
- import n from "prop-types";
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(s) {
15
- this.wrapper = null, this.list = null, this.vs = new v(), this.navigation = new y(), this.handleItemClick = (t, e) => {
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 = e, e.stopPropagation(), this.component.handleItemSelect(t, i), this.togglePopup(i), this.applyState(i);
18
- }, this.handleFocus = (t) => {
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 e = this.initState();
21
- e.data.focused = !0, e.events.push({ type: "onFocus" }), e.syntheticEvent = t, this.applyState(e);
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 = (t, e) => {
24
- const { textField: i, filterable: o } = this.component.props;
25
- o && e.events.push({
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: t
31
+ value: e
32
32
  }
33
33
  });
34
- }, this.togglePopup = (t) => {
35
- const e = this.component.props, i = e.opened !== void 0 ? e.opened : this.component.state.opened;
36
- e.opened === void 0 && (t.data.opened = !i), i ? t.events.push({ type: "onClose" }) : (t.events.push({ type: "onOpen" }), this.calculatePopupWidth());
37
- }, this.pageChange = (t, e) => {
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 = e, this.triggerOnPageChange(i, t.skip, t.take), this.applyState(i);
40
- }, this.scrollToVirtualItem = (t, e) => {
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 (t.skip === 0)
42
+ if (e.skip === 0)
43
43
  i.reset();
44
44
  else {
45
- let o = i.translate;
46
- 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);
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 = (t) => {
48
+ }, this.scrollPopupByPageSize = (e) => {
49
49
  var r, l, h, c, u, d;
50
- 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;
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 + t * Math.floor(p / o) * o
52
+ top: i + e * Math.floor(p / n) * n
53
53
  }));
54
54
  }, this.renderScrollElement = () => {
55
- const t = this.vs;
56
- return t.enabled && /* @__PURE__ */ m.createElement(
55
+ const e = this.vs;
56
+ return e.enabled && /* @__PURE__ */ m.createElement(
57
57
  "div",
58
58
  {
59
- ref: (e) => {
60
- t.scrollElement = e;
59
+ ref: (s) => {
60
+ e.scrollElement = s;
61
61
  },
62
62
  key: "scrollElementKey"
63
63
  }
64
64
  );
65
- }, this.resetGroupStickyHeader = (t, e) => {
66
- t !== e.state.group && e.setState({ group: t });
67
- }, this.listBoxId = s.props.id + "list", this.guid = s.props.id, this.component = s, this.vs.PageChange = this.pageChange;
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 s = this.component.props, t = s.popupSettings || {}, e = s.style || {}, i = t.width;
74
- let o = s.opened === !0;
75
- i === void 0 && this.calculatePopupWidth(), s.dir === void 0 && e.direction === void 0 && (this.calculateDir(), o = !0), o && this.component.forceUpdate();
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 s = this.component.element;
79
- s && s.ownerDocument && s.ownerDocument.defaultView && (this.dirCalculated = s.ownerDocument.defaultView.getComputedStyle(s).direction || void 0);
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(s, t, e) {
90
+ scrollToItem(t, e, s) {
85
91
  const i = this.list || this.vs.list;
86
- if (!i && !e && setTimeout(() => {
87
- this.scrollToItem(s, t, !0);
88
- }, 10), s === 0 && t && this.vs.skip === 0) {
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 && s >= 0) {
93
- const o = this.vs, p = o.container || i.parentNode, r = t !== void 0 ? t : o.enabled;
94
- S(p, i, s, o.translate, r);
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(s) {
98
- for (const t in s)
99
- Object.hasOwnProperty.call(s, t) && (this.component[t] = s[t]);
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(s) {
109
- Object.keys(s.data).length > 0 && this.component.setState(s.data);
110
- const t = {
111
- syntheticEvent: s.syntheticEvent,
112
- nativeEvent: s.syntheticEvent ? s.syntheticEvent.nativeEvent : void 0,
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
- s.events.forEach((e) => {
117
- const i = e.type;
118
- delete e.type;
119
- const o = i && this.component.props[i];
120
- o && o.call(void 0, {
121
- ...t,
122
- ...e
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(s, t, e) {
132
+ triggerOnPageChange(t, e, s) {
127
133
  const i = this.component.props.virtual;
128
134
  if (i) {
129
- const o = Math.min(Math.max(0, t), Math.max(0, i.total - e));
130
- o !== i.skip && s.events.push({
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: o, take: e }
138
+ page: { skip: n, take: s }
133
139
  });
134
140
  }
135
141
  }
136
- triggerPageChangeCornerItems(s, t) {
137
- const e = this.component.props, { data: i = [], dataItemKey: o, virtual: p } = e, r = e.opened !== void 0 ? e.opened : this.component.state.opened;
138
- 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));
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 s = this.getPopupSettings();
145
- return s.animate !== void 0 ? s.animate : !0;
150
+ const t = this.getPopupSettings();
151
+ return t.animate !== void 0 ? t.animate : !0;
146
152
  }
147
- getGroupedDataModernMode(s, t) {
148
- const e = [];
149
- return s.forEach((i, o) => {
150
- s[o - 1] && i[t] !== s[o - 1][t] && e.push({ [t]: i[t] }), e.push(s[o]);
151
- }), e;
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: n.bool,
156
- disabled: n.bool,
157
- dir: n.string,
158
- tabIndex: n.number,
159
- accessKey: n.string,
160
- data: n.array,
161
- textField: n.string,
162
- className: n.string,
163
- label: n.string,
164
- loading: n.bool,
165
- popupSettings: n.shape({
166
- animate: n.oneOfType([
167
- n.bool,
168
- n.shape({
169
- openDuration: n.number,
170
- closeDuration: n.number
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: n.string,
174
- className: n.string,
175
- appendTo: n.any,
176
- width: n.oneOfType([n.string, n.number]),
177
- height: n.oneOfType([n.string, n.number])
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: n.func,
180
- onClose: n.func,
181
- onFocus: n.func,
182
- onBlur: n.func,
183
- onChange: n.func,
184
- itemRender: n.func,
185
- listNoDataRender: n.func,
186
- focusedItemIndex: n.func,
187
- header: n.node,
188
- footer: n.node
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: n.any,
192
- defaultValue: n.any,
193
- filterable: n.bool,
194
- filter: n.string,
195
- virtual: n.shape({
196
- pageSize: n.number.isRequired,
197
- skip: n.number.isRequired,
198
- total: n.number.isRequired
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: n.func,
201
- onPageChange: n.func
206
+ onFilterChange: o.func,
207
+ onPageChange: o.func
202
208
  }, a.defaultProps = {
203
209
  popupSettings: {
204
210
  height: "200px"