@progress/kendo-react-dropdowns 8.2.1-develop.5 → 8.3.0-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.
@@ -36,18 +36,18 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
36
36
  }, this._element = null, this._valueItemsDuringOnChange = null, this.base = new F(this), this._tags = [], this._input = null, this._adaptiveInput = null, this._skipFocusEvent = !1, this._lastSelectedOrDeslectedItemIndex = null, this.itemHeight = 0, this.scrollToFocused = !1, this.localization = null, this.focus = () => {
37
37
  this._input && this._input.focus();
38
38
  }, this.handleItemSelect = (e, t) => {
39
- const { dataItemKey: o, virtual: s } = this.props, a = I(this.props), h = s ? s.skip : 0, c = a[e - h], d = this.value.findIndex((g) => E(g, c, o));
39
+ const { dataItemKey: o, virtual: s } = this.props, a = I(this.props), p = s ? s.skip : 0, c = a[e - p], r = this.value.findIndex((g) => E(g, c, o));
40
40
  this._lastSelectedOrDeslectedItemIndex = a.findIndex((g) => E(g, c, o));
41
41
  let i = [];
42
- d !== -1 ? (i = this.value, i.splice(d, 1)) : i = [...this.value, c], (this.props.filter !== void 0 ? this.props.filter : this.state.text) && !this.mobileMode && (this.state.text && (t.data.text = ""), this.base.filterChanged("", t)), this._adaptiveInput && this._adaptiveInput.blur(), this.state.focusedIndex !== void 0 && (t.data.focusedIndex = void 0), this.triggerOnChange(i, t), this.base.triggerPageChangeCornerItems(c, t);
42
+ r !== -1 ? (i = this.value, i.splice(r, 1)) : i = [...this.value, c], (this.props.filter !== void 0 ? this.props.filter : this.state.text) && !this.mobileMode && (this.state.text && (t.data.text = ""), this.base.filterChanged("", t)), this._adaptiveInput && this._adaptiveInput.blur(), this.state.focusedIndex !== void 0 && (t.data.focusedIndex = void 0), this.triggerOnChange(i, t), this.base.triggerPageChangeCornerItems(c, t);
43
43
  }, this.onTagDelete = (e, t) => {
44
44
  const o = this.base.initState();
45
45
  o.syntheticEvent = t, this.opened && this.base.togglePopup(o), !this.state.focused && !this.mobileMode && (o.data.focused = !0, this.focus());
46
46
  const s = this.value;
47
47
  w(s, e, this.props.dataItemKey), this.triggerOnChange(s, o), this.applyState(o);
48
48
  }, this.itemFocus = (e, t) => {
49
- const { allowCustom: o, virtual: s } = this.props, a = I(this.props), h = s ? s.skip : 0, c = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedIndex: d } = this.getFocusedState(), i = o && c, l = a[e - h];
50
- l && d !== e ? this.state.focusedIndex !== e && (t.data.focusedIndex = e, t.data.activedescendant = k.PopupList) : i && e === -1 && this.state.focusedIndex !== void 0 && (t.data.focusedIndex = void 0), this.base.triggerPageChangeCornerItems(l, t);
49
+ const { allowCustom: o, virtual: s } = this.props, a = I(this.props), p = s ? s.skip : 0, c = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedIndex: r } = this.getFocusedState(), i = o && c, d = a[e - p];
50
+ d && r !== e ? this.state.focusedIndex !== e && (t.data.focusedIndex = e, t.data.activedescendant = k.PopupList) : i && e === -1 && this.state.focusedIndex !== void 0 && (t.data.focusedIndex = void 0), this.base.triggerPageChangeCornerItems(d, t);
51
51
  }, this.componentRef = (e) => {
52
52
  this._element = e, this.base.wrapper = e;
53
53
  }, this.searchbarRef = (e) => {
@@ -62,11 +62,11 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
62
62
  const o = this.props.filter !== void 0 ? this.props.filter : this.state.text;
63
63
  M(o) && o !== "" && this.base.filterChanged("", t), this.state.text && (t.data.text = ""), this._lastSelectedOrDeslectedItemIndex = null, this.applyState(t);
64
64
  }, this.onInputKeyDown = (e) => {
65
- const { textField: t, groupField: o } = this.props, s = I(this.props), a = e.keyCode, h = this.props.filter !== void 0 ? this.props.filter : this.state.text, c = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { focusedItem: d, focusedIndex: i } = this.getFocusedState(), l = this.base.initState();
66
- if (l.syntheticEvent = e, !h && this.value.length > 0 && (a === u.left || a === u.right || a === u.home || a === u.end || a === u.delete || a === u.backspace) && !e.shiftKey)
67
- return this.onTagsNavigate(e, l);
65
+ const { textField: t, groupField: o } = this.props, s = I(this.props), a = e.keyCode, p = this.props.filter !== void 0 ? this.props.filter : this.state.text, c = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { focusedItem: r, focusedIndex: i } = this.getFocusedState(), d = this.base.initState();
66
+ if (d.syntheticEvent = e, !p && this.value.length > 0 && (a === u.left || a === u.right || a === u.home || a === u.end || a === u.delete || a === u.backspace) && !e.shiftKey)
67
+ return this.onTagsNavigate(e, d);
68
68
  const g = () => {
69
- e.preventDefault(), this.base.togglePopup(l), this.applyState(l);
69
+ e.preventDefault(), this.base.togglePopup(d), this.applyState(d);
70
70
  };
71
71
  if (this.opened)
72
72
  if (a === u.pageUp)
@@ -74,75 +74,75 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
74
74
  else if (a === u.pageDown)
75
75
  e.preventDefault(), this.base.scrollPopupByPageSize(1);
76
76
  else if ((e.ctrlKey || e.metaKey) && e.code === "KeyA") {
77
- const p = (this.state.value && this.state.value.length) === s.length ? [] : s;
78
- this.updateStateOnKeyboardNavigation(p, l);
77
+ const h = (this.state.value && this.state.value.length) === s.length ? [] : s;
78
+ this.updateStateOnKeyboardNavigation(h, d);
79
79
  } else if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.keyCode === u.end) {
80
- const r = s.slice(this.getFocusedState().focusedIndex);
81
- this.itemFocus(s.length - 1, l), this.updateStateOnKeyboardNavigation(r, l);
80
+ const l = s.slice(this.getFocusedState().focusedIndex);
81
+ this.itemFocus(s.length - 1, d), this.updateStateOnKeyboardNavigation(l, d);
82
82
  } else if ((e.ctrlKey || e.metaKey) && e.shiftKey && e.keyCode === u.home) {
83
- const r = s.slice(0, this.getFocusedState().focusedIndex + 1);
84
- this.itemFocus(0, l), this.updateStateOnKeyboardNavigation(r, l);
83
+ const l = s.slice(0, this.getFocusedState().focusedIndex + 1);
84
+ this.itemFocus(0, d), this.updateStateOnKeyboardNavigation(l, d);
85
85
  } else if (e.shiftKey && e.keyCode === u.up) {
86
- let r;
87
- const p = this.getLastSelectedOrDeselectedIndex(1, i);
88
- p === null ? r = i !== 0 ? s.slice(i - 1, i) : [s[i]] : p === i ? r = [s[p - 1]] : i >= 0 && (r = p > i ? s.slice(i - 1, p) : s.slice(p - 1, i)), r && r.length > 0 && (i >= 1 && this.itemFocus(i - 1, l), this.updateStateOnKeyboardNavigation(r, l));
86
+ let l;
87
+ const h = this.getLastSelectedOrDeselectedIndex(1, i);
88
+ h === null ? l = i !== 0 ? s.slice(i - 1, i) : [s[i]] : h === i ? l = [s[h - 1]] : i >= 0 && (l = h > i ? s.slice(i - 1, h) : s.slice(h - 1, i)), l && l.length > 0 && (i >= 1 && this.itemFocus(i - 1, d), this.updateStateOnKeyboardNavigation(l, d));
89
89
  } else if (e.shiftKey && e.keyCode === u.down) {
90
- let r;
91
- const p = this.getLastSelectedOrDeselectedIndex(0, i);
92
- p === null ? r = i !== s.length - 1 ? s.slice(i, i + 1) : [s[i]] : p === i ? r = s.slice(i, i + 2) : i >= 0 && (r = p > i ? s.slice(i + 1, p + 1) : s.slice(p, i + 2)), r && r.length >= 1 && (this.itemFocus(i + 1, l), this.updateStateOnKeyboardNavigation(r, l));
90
+ let l;
91
+ const h = this.getLastSelectedOrDeselectedIndex(0, i);
92
+ h === null ? l = i !== s.length - 1 ? s.slice(i, i + 1) : [s[i]] : h === i ? l = s.slice(i, i + 2) : i >= 0 && (l = h > i ? s.slice(i + 1, h + 1) : s.slice(h, i + 2)), l && l.length >= 1 && (this.itemFocus(i + 1, d), this.updateStateOnKeyboardNavigation(l, d));
93
93
  } else if (e.altKey && a === u.up)
94
94
  g();
95
95
  else if (a === u.up || a === u.down) {
96
96
  if (o !== "" && t)
97
97
  if (!this.props.skipDisabledItems && c)
98
- this.onNavigate(l, a);
98
+ this.onNavigate(d, a);
99
99
  else {
100
- let r = 0;
100
+ let l = 0;
101
101
  if (a === u.down || a === u.right) {
102
- const p = s.slice(i + 1).find((v) => !v.disabled && v[t]);
103
- r = p && s.findIndex((v) => v[t] === p[t]);
102
+ const h = s.slice(i + 1).find((v) => !v.disabled && v[t]);
103
+ l = h && s.findIndex((v) => v[t] === h[t]);
104
104
  } else if (a === u.up || a === u.left) {
105
- let p;
105
+ let h;
106
106
  if (i === -1)
107
- p = s, r = s.findIndex((v) => !v.disabled && v[t]);
107
+ h = s, l = s.findIndex((v) => !v.disabled && v[t]);
108
108
  else {
109
- p = s.slice(0, i);
110
- let v = p.pop();
109
+ h = s.slice(0, i);
110
+ let v = h.pop();
111
111
  for (; v && v.disabled; )
112
- v = p.pop();
113
- r = v && s.findIndex((S) => S[t] === v[t]);
112
+ v = h.pop();
113
+ l = v && s.findIndex((S) => S[t] === v[t]);
114
114
  }
115
115
  }
116
- if (r) {
117
- const p = r - i;
118
- this.onNavigate(l, a, p);
116
+ if (l) {
117
+ const h = l - i;
118
+ this.onNavigate(d, a, h);
119
119
  } else
120
- r !== void 0 && this.onNavigate(l, a);
120
+ l !== void 0 && this.onNavigate(d, a);
121
121
  }
122
122
  else if (!this.props.skipDisabledItems && c)
123
- this.onNavigate(l, a);
123
+ this.onNavigate(d, a);
124
124
  else {
125
- let r = null;
125
+ let l = null;
126
126
  if (a === u.down || a === u.right)
127
- r = s.slice(i + 1).find((p) => !p.disabled);
127
+ l = s.slice(i + 1).find((h) => !h.disabled);
128
128
  else if (a === u.up || a === u.left) {
129
- const p = s.slice(0, i);
130
- for (r = p.pop(); r && r.disabled; )
131
- r = p.pop();
129
+ const h = s.slice(0, i);
130
+ for (l = h.pop(); l && l.disabled; )
131
+ l = h.pop();
132
132
  }
133
- if (r) {
134
- const p = r.id - i - 1;
135
- this.onNavigate(l, a, p);
133
+ if (l) {
134
+ const h = l.id - i - 1;
135
+ this.onNavigate(d, a, h);
136
136
  } else
137
- this.onNavigate(l, a);
137
+ this.onNavigate(d, a);
138
138
  }
139
- this.applyState(l), e.preventDefault();
139
+ this.applyState(d), e.preventDefault();
140
140
  } else
141
- a === u.enter ? (e.preventDefault(), this.props.allowCustom && h && d === null ? this.customItemSelect(e) : d && d.disabled ? g() : this.selectFocusedItem(e)) : a === u.esc && g();
141
+ a === u.enter ? (e.preventDefault(), this.props.allowCustom && p && r === null ? this.customItemSelect(e) : r && r.disabled ? g() : this.selectFocusedItem(e)) : a === u.esc && g();
142
142
  else
143
143
  e.altKey && a === u.down ? g() : a === u.esc && this.clearButtonClick(e);
144
144
  }, this.listContainerContent = () => {
145
- const { header: e, footer: t, allowCustom: o, size: s, groupStickyHeaderItemRender: a, groupField: h, list: c } = this.props, d = I(this.props), i = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: l } = this.getFocusedState(), g = o && i && /* @__PURE__ */ f.createElement(
145
+ const { header: e, footer: t, allowCustom: o, size: s, groupStickyHeaderItemRender: a, groupField: p, list: c } = this.props, r = I(this.props), i = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: d } = this.getFocusedState(), g = o && i && /* @__PURE__ */ f.createElement(
146
146
  "div",
147
147
  {
148
148
  className: y("k-list", {
@@ -155,15 +155,15 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
155
155
  /* @__PURE__ */ f.createElement(
156
156
  "div",
157
157
  {
158
- className: y("k-list-item k-custom-item", { "k-focus": q(l) }),
158
+ className: y("k-list-item k-custom-item", { "k-focus": q(d) }),
159
159
  style: { fontStyle: "italic" }
160
160
  },
161
161
  i,
162
162
  /* @__PURE__ */ f.createElement(R, { name: "plus", icon: it, style: { position: "absolute", right: "0.5em" } })
163
163
  )
164
164
  );
165
- let { group: r } = this.state;
166
- return r === void 0 && h !== void 0 && (r = O(d[0], h)), /* @__PURE__ */ f.createElement(f.Fragment, null, e && /* @__PURE__ */ f.createElement("div", { className: "k-list-header" }, e), g, /* @__PURE__ */ f.createElement(
165
+ let { group: l } = this.state;
166
+ return l === void 0 && p !== void 0 && (l = O(r[0], p)), /* @__PURE__ */ f.createElement(f.Fragment, null, e && /* @__PURE__ */ f.createElement("div", { className: "k-list-header" }, e), g, /* @__PURE__ */ f.createElement(
167
167
  "div",
168
168
  {
169
169
  className: y(
@@ -174,11 +174,11 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
174
174
  }
175
175
  )
176
176
  },
177
- !c && r && d.length !== 0 && /* @__PURE__ */ f.createElement(lt, { group: r, groupMode: "modern", render: a }),
177
+ !c && l && r.length !== 0 && /* @__PURE__ */ f.createElement(lt, { group: l, groupMode: "modern", render: a }),
178
178
  this.renderList()
179
179
  ), t && /* @__PURE__ */ f.createElement("div", { className: "k-list-footer" }, t));
180
180
  }, this.renderListContainer = () => {
181
- const e = this.base, { dir: t } = this.props, o = I(this.props), s = this.base.getPopupSettings(), a = s.width !== void 0 ? s.width : e.popupWidth, h = {
181
+ const e = this.base, { dir: t } = this.props, o = I(this.props), s = this.base.getPopupSettings(), a = s.width !== void 0 ? s.width : e.popupWidth, p = {
182
182
  dir: t !== void 0 ? t : e.dirCalculated,
183
183
  width: a,
184
184
  popupSettings: {
@@ -195,15 +195,15 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
195
195
  },
196
196
  itemsCount: [o.length, this.value.length]
197
197
  };
198
- return /* @__PURE__ */ f.createElement(at, { ...h }, this.listContainerContent());
198
+ return /* @__PURE__ */ f.createElement(at, { ...p }, this.listContainerContent());
199
199
  }, this.renderAdaptiveListContainer = () => {
200
200
  const { adaptiveTitle: e, filterable: t, filter: o } = this.props, { windowWidth: s = 0 } = this.state, a = o !== void 0 ? o : this.state.text;
201
201
  this.localization = vt(this);
202
- const h = t ? /* @__PURE__ */ f.createElement(
202
+ const p = t ? /* @__PURE__ */ f.createElement(
203
203
  It,
204
204
  {
205
205
  value: a,
206
- ref: (d) => this._adaptiveInput = d && d.element,
206
+ ref: (r) => this._adaptiveInput = r && r.element,
207
207
  onChange: this.onChangeHandler,
208
208
  onKeyDown: this.onInputKeyDown,
209
209
  size: this.props.size,
@@ -213,9 +213,9 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
213
213
  ) : null, c = {
214
214
  adaptiveTitle: e,
215
215
  expand: this.opened,
216
- onClose: (d) => this.onCancel(d),
216
+ onClose: (r) => this.onCancel(r),
217
217
  windowWidth: s,
218
- mobileFilter: h,
218
+ mobileFilter: p,
219
219
  footer: {
220
220
  cancelText: this.localization.toLanguageString(z, V[z]),
221
221
  onCancel: this.onCancel,
@@ -223,7 +223,7 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
223
223
  onApply: this.closePopup
224
224
  }
225
225
  };
226
- return /* @__PURE__ */ f.createElement(ft, { ...c }, /* @__PURE__ */ f.createElement(gt, { className: "!k-overflow-hidden" }, /* @__PURE__ */ f.createElement("div", { className: "k-list-container" }, this.listContainerContent())));
226
+ return /* @__PURE__ */ f.createElement(ft, { ...c }, /* @__PURE__ */ f.createElement(gt, { overflowHidden: !0 }, /* @__PURE__ */ f.createElement("div", { className: "k-list-container" }, this.listContainerContent())));
227
227
  }, this.closePopup = (e) => {
228
228
  const t = this.base.initState();
229
229
  t.syntheticEvent = e, e.stopPropagation(), this.state.focusedIndex !== void 0 && (t.data.focusedIndex = void 0), this.opened && this.base.togglePopup(t), t.events.push({ type: "onClose" });
@@ -241,29 +241,29 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
241
241
  itemRender: o,
242
242
  groupHeaderItemRender: s,
243
243
  dataItemKey: a,
244
- virtual: h = { skip: 0, total: void 0 }
245
- } = this.props, c = I(this.props), d = this.base.vs, { focusedIndex: i } = this.getFocusedState(), l = this.base.getPopupSettings(), g = `translateY(${d.translate}px)`;
244
+ virtual: p = { skip: 0, total: void 0 }
245
+ } = this.props, c = I(this.props), r = this.base.vs, { focusedIndex: i } = this.getFocusedState(), d = this.base.getPopupSettings(), g = `translateY(${r.translate}px)`;
246
246
  return /* @__PURE__ */ f.createElement(
247
247
  nt,
248
248
  {
249
249
  id: this.base.listBoxId,
250
250
  show: this.opened,
251
251
  data: c.slice(),
252
- focusedIndex: i - h.skip,
252
+ focusedIndex: i - p.skip,
253
253
  value: this.value,
254
254
  textField: e,
255
255
  valueField: a,
256
256
  optionsGuid: this.base.guid,
257
257
  groupField: this.props.groupField,
258
258
  groupMode: "modern",
259
- listRef: (r) => {
260
- d.list = this.base.list = r;
259
+ listRef: (l) => {
260
+ r.list = this.base.list = l;
261
261
  },
262
- wrapperStyle: this.mobileMode ? {} : { maxHeight: l.height },
262
+ wrapperStyle: this.mobileMode ? {} : { maxHeight: d.height },
263
263
  wrapperCssClass: "k-list-content",
264
- listStyle: d.enabled ? { transform: g } : void 0,
264
+ listStyle: r.enabled ? { transform: g } : void 0,
265
265
  key: "listKey",
266
- skip: h.skip,
266
+ skip: p.skip,
267
267
  onClick: this.handleItemClick,
268
268
  itemRender: o,
269
269
  groupHeaderItemRender: s,
@@ -271,9 +271,9 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
271
271
  onMouseDown: $,
272
272
  onBlur: this.handleBlur,
273
273
  onScroll: this.onScroll,
274
- wrapperRef: d.scrollerRef,
274
+ wrapperRef: r.scrollerRef,
275
275
  scroller: this.base.renderScrollElement(),
276
- ariaSetSize: h.total
276
+ ariaSetSize: p.total
277
277
  }
278
278
  );
279
279
  }, this.onScroll = (e) => {
@@ -282,11 +282,11 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
282
282
  const { groupField: s } = this.props;
283
283
  let a = I(this.props);
284
284
  if (!(!s || !a.length) && s) {
285
- const h = this.itemHeight = this.itemHeight || (t.enabled ? t.itemHeight : o ? o.children[0].offsetHeight : 0), d = e.target.scrollTop - t.skip * h;
285
+ const p = this.itemHeight = this.itemHeight || (t.enabled ? t.itemHeight : o ? o.children[0].offsetHeight : 0), r = e.target.scrollTop - t.skip * p;
286
286
  a = this.base.getGroupedDataModernMode(a, s);
287
287
  let i = a[0][s];
288
- for (let l = 1; l < a.length && !(h * l > d); l++)
289
- a[l] && a[l][s] && (i = a[l][s]);
288
+ for (let d = 1; d < a.length && !(p * d > r); d++)
289
+ a[d] && a[d][s] && (i = a[d][s]);
290
290
  i !== this.state.group && this.setState({
291
291
  group: i
292
292
  });
@@ -299,8 +299,8 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
299
299
  s.syntheticEvent = e;
300
300
  const a = o ? { [o]: t } : t;
301
301
  this.state.text !== void 0 && (s.data.text = ""), s.data.focusedIndex = void 0, this.base.filterChanged("", s);
302
- const h = [...this.value, a];
303
- this.triggerOnChange(h, s), this.base.togglePopup(s), this.applyState(s);
302
+ const p = [...this.value, a];
303
+ this.triggerOnChange(p, s), this.base.togglePopup(s), this.applyState(s);
304
304
  }, this.handleWrapperClick = (e) => {
305
305
  const t = this._input;
306
306
  !this.opened && t && this.focusElement(t);
@@ -390,12 +390,12 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
390
390
  /** @hidden */
391
391
  componentDidUpdate(n, e) {
392
392
  var g;
393
- const { virtual: t, groupField: o = "" } = this.props, s = I(this.props), a = t ? t.skip : 0, h = n.virtual ? n.virtual.total : 0, c = n.opened !== void 0 ? n.opened : e.opened, d = !c && this.opened, i = c && !this.opened, l = this.base.getPopupSettings();
394
- if (this.base.didUpdate(), !l.animate && i && this.onPopupClosed(), t && t.total !== h)
393
+ const { virtual: t, groupField: o = "" } = this.props, s = I(this.props), a = t ? t.skip : 0, p = n.virtual ? n.virtual.total : 0, c = n.opened !== void 0 ? n.opened : e.opened, r = !c && this.opened, i = c && !this.opened, d = this.base.getPopupSettings();
394
+ if (this.base.didUpdate(), !d.animate && i && this.onPopupClosed(), t && t.total !== p)
395
395
  this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
396
396
  else {
397
- let { focusedItem: r, focusedIndex: p } = this.getFocusedState();
398
- o !== "" && (p = (g = this.base.getGroupedDataModernMode(s, o)) == null ? void 0 : g.indexOf(r)), d && t ? this.base.scrollToVirtualItem(t, p - a) : d && !t ? (s && s.length !== 0 && this.base.resetGroupStickyHeader(s[0][o], this), this.base.scrollToItem(p)) : this.opened && c && r && this.scrollToFocused && this.base.scrollToItem(p - a);
397
+ let { focusedItem: l, focusedIndex: h } = this.getFocusedState();
398
+ o !== "" && (h = (g = this.base.getGroupedDataModernMode(s, o)) == null ? void 0 : g.indexOf(l)), r && t ? this.base.scrollToVirtualItem(t, h - a) : r && !t ? (s && s.length !== 0 && this.base.resetGroupStickyHeader(s[0][o], this), this.base.scrollToItem(h)) : this.opened && c && l && this.scrollToFocused && this.base.scrollToItem(h - a);
399
399
  }
400
400
  this.scrollToFocused = !1, this.setValidity();
401
401
  }
@@ -411,18 +411,18 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
411
411
  }
412
412
  /** @hidden */
413
413
  onNavigate(n, e, t) {
414
- const { allowCustom: o } = this.props, s = I(this.props), a = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: h, focusedIndex: c } = this.getFocusedState(), d = o && a, i = q(h), l = this.base, g = l.vs;
414
+ const { allowCustom: o } = this.props, s = I(this.props), a = this.props.filter !== void 0 ? this.props.filter : this.state.text, { focusedType: p, focusedIndex: c } = this.getFocusedState(), r = o && a, i = q(p), d = this.base, g = d.vs;
415
415
  if (this.opened && e === u.up && i)
416
416
  this.state.focusedIndex !== void 0 && (n.data.focusedIndex = void 0);
417
417
  else {
418
- const r = l.navigation.navigate({
418
+ const l = d.navigation.navigate({
419
419
  keyCode: e,
420
420
  current: c,
421
421
  max: (g.enabled ? g.total : s.length) - 1,
422
- min: d ? -1 : 0,
422
+ min: r ? -1 : 0,
423
423
  skipItems: t || void 0
424
424
  });
425
- r !== void 0 && (this.itemFocus(r, n), this.scrollToFocused = !0);
425
+ l !== void 0 && (this.itemFocus(l, n), this.scrollToFocused = !0);
426
426
  }
427
427
  this.applyState(n);
428
428
  }
@@ -435,25 +435,25 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
435
435
  dir: o,
436
436
  disabled: s,
437
437
  textField: a,
438
- dataItemKey: h,
438
+ dataItemKey: p,
439
439
  virtual: c,
440
- size: d,
440
+ size: r,
441
441
  rounded: i,
442
- fillMode: l,
442
+ fillMode: d,
443
443
  loading: g,
444
- filter: r
445
- } = this.props, { text: p, focused: v, focusedTag: S, currentValue: W } = this.state, C = this.base.vs, _ = this.props.id || this._inputId;
444
+ filter: l
445
+ } = this.props, { text: h, focused: v, focusedTag: S, currentValue: W } = this.state, C = this.base.vs, _ = this.props.id || this._inputId;
446
446
  C.enabled = c !== void 0, c !== void 0 && (C.skip = c.skip, C.total = c.total, C.pageSize = c.pageSize);
447
447
  const x = this.mobileMode && this.opened ? W : this.tagsToRender;
448
448
  this.setItems(this.tagsToRender, this._tags);
449
- const K = !this.validityStyles || this.validity.valid, G = !!(r !== void 0 ? r : p) || x && x.length > 0, [U, Y] = A(this.props.prefix || f.Fragment), [j, J] = A(this.props.suffix || f.Fragment), N = /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement(
449
+ const K = !this.validityStyles || this.validity.valid, G = !!(l !== void 0 ? l : h) || x && x.length > 0, [U, Y] = A(this.props.prefix || f.Fragment), [j, J] = A(this.props.suffix || f.Fragment), N = /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement(
450
450
  "div",
451
451
  {
452
452
  ref: this.componentRef,
453
453
  className: y("k-multiselect k-input", e, {
454
- [`k-input-${D[d] || d}`]: d,
454
+ [`k-input-${D[r] || r}`]: r,
455
455
  [`k-rounded-${yt[i] || i}`]: i,
456
- [`k-input-${l}`]: l,
456
+ [`k-input-${d}`]: d,
457
457
  "k-focus": v && !s,
458
458
  "k-invalid": !K,
459
459
  "k-disabled": s,
@@ -473,7 +473,7 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
473
473
  {
474
474
  className: y(
475
475
  "k-chip-list",
476
- { [`k-chip-list-${D[d] || d}`]: d }
476
+ { [`k-chip-list-${D[r] || r}`]: r }
477
477
  ),
478
478
  role: "listbox",
479
479
  id: "tagslist-" + this.base.guid
@@ -485,8 +485,8 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
485
485
  onTagDelete: this.onTagDelete,
486
486
  data: x,
487
487
  guid: this.base.guid,
488
- focused: S ? x.find((Q) => B(Q, S, h)) : void 0,
489
- size: d
488
+ focused: S ? x.find((Q) => B(Q, S, p)) : void 0,
489
+ size: r
490
490
  }
491
491
  )
492
492
  ), this.renderSearchBar(_)),
@@ -500,7 +500,7 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
500
500
  {
501
501
  label: t,
502
502
  editorId: _,
503
- editorValue: p || O(this.value[0], a),
503
+ editorValue: h || O(this.value[0], a),
504
504
  editorValid: K,
505
505
  editorDisabled: s,
506
506
  style: { width: n ? n.width : void 0 },
@@ -509,16 +509,17 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
509
509
  ) : N;
510
510
  }
511
511
  renderSearchBar(n) {
512
- const { activedescendant: e, focusedTag: t, currentValue: o } = this.state, { disabled: s, placeholder: a, ariaDescribedBy: h } = this.props, c = !this.mobileMode && (this.props.filter !== void 0 ? this.props.filter : this.state.text) || "", { focusedIndex: d } = this.getFocusedState(), i = this.value.length === 0 && !c ? a : void 0, l = o && o.length > 0 ? void 0 : a, g = e === k.TagsList && t !== void 0 ? `tag-${this.base.guid}-${t.text.replace(/\s+/g, "-")}` : `option-${this.base.guid}-${d}`;
512
+ const { activedescendant: e, focusedTag: t, currentValue: o } = this.state, { disabled: s, placeholder: a, ariaDescribedBy: p, ariaLabelledBy: c, ariaLabel: r } = this.props, i = !this.mobileMode && (this.props.filter !== void 0 ? this.props.filter : this.state.text) || "", { focusedIndex: d } = this.getFocusedState(), g = this.value.length === 0 && !i ? a : void 0, l = o && o.length > 0 ? void 0 : a, h = e === k.TagsList && t !== void 0 ? `tag-${this.base.guid}-${t.text.replace(/\s+/g, "-")}` : `option-${this.base.guid}-${d}`, v = {
513
+ accessKey: this.props.accessKey,
514
+ tabIndex: this.props.tabIndex
515
+ };
513
516
  return /* @__PURE__ */ f.createElement(
514
517
  rt,
515
518
  {
516
519
  id: n,
517
- size: Math.max((i || "").length, c.length, 1),
518
- tabIndex: this.props.tabIndex,
519
- accessKey: this.props.accessKey,
520
- placeholder: this.mobileMode && this.opened ? l : i,
521
- value: c,
520
+ size: Math.max((g || "").length, i.length, 1),
521
+ placeholder: this.mobileMode && this.opened ? l : g,
522
+ value: i,
522
523
  onChange: this.onChangeHandler,
523
524
  onKeyDown: this.onInputKeyDown,
524
525
  ref: this.searchbarRef,
@@ -526,37 +527,39 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
526
527
  expanded: this.opened,
527
528
  owns: this.base.listBoxId,
528
529
  role: "combobox",
529
- activedescendant: g,
530
- ariaDescribedBy: `tagslist-${this.base.guid}${h ? " " + h : ""}`,
531
- ariaLabelledBy: this.props.ariaLabelledBy,
532
- ariaRequired: this.required
530
+ activedescendant: h,
531
+ ariaDescribedBy: `tagslist-${this.base.guid}${p ? " " + p : ""}`,
532
+ ariaLabelledBy: c,
533
+ ariaRequired: this.required,
534
+ ariaLabel: r,
535
+ ...v
533
536
  }
534
537
  );
535
538
  }
536
539
  onTagsNavigate(n, e) {
537
540
  const t = n.keyCode, { focusedTag: o } = this.state, s = this._tags, a = this.props.dataItemKey;
538
- let h = o ? s.findIndex((i) => B(i, o, a)) : -1, c;
539
- const d = h !== -1;
541
+ let p = o ? s.findIndex((i) => B(i, o, a)) : -1, c;
542
+ const r = p !== -1;
540
543
  if (t === u.left)
541
- d ? h = Math.max(0, h - 1) : h = s.length - 1, c = s[h];
544
+ r ? p = Math.max(0, p - 1) : p = s.length - 1, c = s[p];
542
545
  else if (t === u.right)
543
- h === s.length - 1 ? c = void 0 : d && (h = Math.min(s.length - 1, h + 1), c = s[h]);
546
+ p === s.length - 1 ? c = void 0 : r && (p = Math.min(s.length - 1, p + 1), c = s[p]);
544
547
  else if (t === u.home && !n.shiftKey)
545
548
  c = s[0];
546
549
  else if (t === u.end && !n.shiftKey)
547
550
  c = s[s.length - 1];
548
551
  else if (t === u.delete) {
549
- if (d) {
552
+ if (r) {
550
553
  const i = this.value;
551
- w(i, s[h].data, a), this.triggerOnChange(i, e);
554
+ w(i, s[p].data, a), this.triggerOnChange(i, e);
552
555
  }
553
556
  } else if (t === u.backspace) {
554
557
  const i = this.value;
555
- if (d)
556
- w(i, s[h].data, a), this.triggerOnChange(i, e);
557
- else if (!d && s.length) {
558
- const l = s.pop();
559
- w(i, l.data, a), this.triggerOnChange(i, e);
558
+ if (r)
559
+ w(i, s[p].data, a), this.triggerOnChange(i, e);
560
+ else if (!r && s.length) {
561
+ const d = s.pop();
562
+ w(i, d.data, a), this.triggerOnChange(i, e);
560
563
  }
561
564
  }
562
565
  c !== o && (e.data.focusedTag = c, e.data.activedescendant = k.TagsList), this.applyState(e);
@@ -572,12 +575,12 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
572
575
  e.length = 0, e.push(...n);
573
576
  }
574
577
  getFocusedState() {
575
- const { focusedIndex: n } = this.state, e = this.props.filter !== void 0 ? this.props.filter : this.state.text, { allowCustom: t, dataItemKey: o, virtual: s, textField: a, focusedItemIndex: h = pt, skipDisabledItems: c } = this.props, d = I(this.props), i = s && s.skip || 0;
576
- let l;
578
+ const { focusedIndex: n } = this.state, e = this.props.filter !== void 0 ? this.props.filter : this.state.text, { allowCustom: t, dataItemKey: o, virtual: s, textField: a, focusedItemIndex: p = pt, skipDisabledItems: c } = this.props, r = I(this.props), i = s && s.skip || 0;
579
+ let d;
577
580
  if (n !== void 0)
578
581
  return {
579
582
  focusedIndex: n,
580
- focusedItem: d[n - i],
583
+ focusedItem: r[n - i],
581
584
  focusedType: 1
582
585
  /* ListItem */
583
586
  };
@@ -590,31 +593,31 @@ const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $
590
593
  /* CustomItem */
591
594
  };
592
595
  if (e)
593
- return l = h(d, e, a), {
594
- focusedItem: d[l],
595
- focusedIndex: l + i,
596
+ return d = p(r, e, a), {
597
+ focusedItem: r[d],
598
+ focusedIndex: d + i,
596
599
  focusedType: 1
597
600
  /* ListItem */
598
601
  };
599
602
  if (g.length) {
600
- const r = g[g.length - 1];
601
- return l = d.findIndex((p) => E(p, r, o)), d[l] !== void 0 ? {
602
- focusedIndex: l + i,
603
- focusedItem: d[l],
603
+ const l = g[g.length - 1];
604
+ return d = r.findIndex((h) => E(h, l, o)), r[d] !== void 0 ? {
605
+ focusedIndex: d + i,
606
+ focusedItem: r[d],
604
607
  focusedType: 1
605
608
  /* ListItem */
606
609
  } : { focusedType: 0, focusedIndex: -1 };
607
610
  } else if (c && a && !e && i === 0) {
608
- const r = d.findIndex((p) => !p.disabled && p[a]);
611
+ const l = r.findIndex((h) => !h.disabled && h[a]);
609
612
  return {
610
- focusedIndex: r,
611
- focusedItem: d[r - i],
613
+ focusedIndex: l,
614
+ focusedItem: r[l - i],
612
615
  focusedType: 1
613
616
  /* ListItem */
614
617
  };
615
618
  }
616
619
  return i === 0 ? {
617
- focusedItem: d[0],
620
+ focusedItem: r[0],
618
621
  focusedIndex: 0,
619
622
  focusedType: 1
620
623
  /* ListItem */
@@ -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 Ze=require("react"),a=require("prop-types"),i=require("@progress/kendo-react-common"),et=require("@progress/kendo-react-popup"),tt=require("@progress/kendo-react-intl"),we=require("@progress/kendo-react-treeview"),nt=require("../package-metadata.js"),ee=require("../common/utils.js"),at=require("../DropDownTree/useDropdownWidth.js"),rt=require("../DropDownTree/ListNoData.js"),m=require("../messages/index.js"),it=require("@progress/kendo-react-labels"),st=require("../MultiSelect/TagList.js"),ot=require("../common/ClearButton.js"),Ie=require("../common/ListFilter.js"),lt=require("../common/AdaptiveMode.js"),ct=require("@progress/kendo-react-layout"),ut=require("../common/constants.js");function dt(h){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const n in h)if(n!=="default"){const I=Object.getOwnPropertyDescriptor(h,n);Object.defineProperty(b,n,I.get?I:{enumerable:!0,get:()=>h[n]})}}return b.default=h,Object.freeze(b)}const t=dt(Ze),pt="Please select a value from the list!",{sizeMap:Te,roundedMap:ft}=i.kendoThemeMaps,gt=h=>h.split("_").map(b=>parseInt(b,10)),vt=(h,b)=>{const{validationMessage:n,valid:I,required:T}=h;return{customError:n!==void 0,valid:!!(I!==void 0?I:!T||b),valueMissing:!b}},E={checkField:"checkField",checkIndeterminateField:"checkIndeterminateField",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},size:"medium",rounded:"medium",fillMode:"solid",required:!1,validityStyles:!0},Me=i.createPropsContext(),ce=t.forwardRef((h,b)=>{const n=i.usePropsContext(Me,h);i.validatePackage(nt.packageMetadata);const I=i.useId(),T=n.id||I,{data:B=[],dataItemKey:M,style:L={},placeholder:ue,label:V,name:Ke,validationMessage:W,valid:Re,tags:de,value:g,opened:K,disabled:x,popupSettings:N=E.popupSettings,checkField:pe=E.checkField,checkIndeterminateField:fe=E.checkIndeterminateField,subItemsField:ge=E.subItemsField,size:y=E.size,rounded:A=E.rounded,fillMode:z=E.fillMode,required:ve=E.required,validityStyles:De=E.validityStyles,onOpen:te=i.noop,onClose:_=i.noop}=n,j=i.getTabIndex(n.tabIndex,x),o=t.useRef(null),F=t.useRef(null),R=t.useRef(null),ne=t.useRef(null),$=t.useRef(null),S=t.useRef(null),H=t.useRef(!1),G=t.useRef([]),U=t.useRef(null),[O,qe]=t.useState(),[Ne,me]=t.useState(!1),[d,ae]=t.useState(!1),[re,Oe]=t.useState(),[Pe,Le]=t.useState([]),[he,Ve]=t.useState(""),P=!!(re&&re<=ut.MOBILE_MEDIUM_DEVISE&&n.adaptive),l=K!==void 0?K:Ne,ie=!!(Array.isArray(g)&&g.length),se=vt({validationMessage:W,valid:Re,required:ve},ie),D=i.useRtl(F,n.dir),Ae={width:at.useDropdownWidth(F,E,N,L),...D!==void 0?{direction:D}:{}},Be=t.useCallback(()=>F.current&&F.current.focus(),[]);G.current=de===void 0?(g||[]).map(e=>({text:ee.getItemValue(e,n.textField),data:[e]})):[...de],t.useImperativeHandle(o,()=>({props:n,element:F.current,focus:Be})),t.useImperativeHandle(b,()=>o.current);const We=t.useCallback(()=>{$.current&&$.current.setCustomValidity&&$.current.setCustomValidity(se.valid?"":W===void 0?pt:W)},[W,se]);t.useEffect(We),t.useEffect(()=>{const e=i.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Xe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{e&&e.disconnect()}},[]),t.useEffect(()=>{U.current&&l&&U.current.setPosition(U.current._popup)},[g,l]);const w=t.useCallback((e,r,s)=>{if(n.onChange){const k={items:r,operation:s,...e};n.onChange.call(void 0,k)}},[n.onChange]),J=t.useCallback(e=>{if(ee.areSame(e.item,g,M)||!o.current)return;const{item:r,nativeEvent:s,syntheticEvent:k}=e,q={syntheticEvent:k,nativeEvent:s,target:o.current};w(q,[r],"toggle")},[g,M,w]),Q=t.useCallback(e=>{if(!l){if(te){const r={...e};te.call(void 0,r)}K===void 0&&(me(!0),Le(g||[]),P&&setTimeout(()=>{var r;u((r=ne.current)==null?void 0:r.element)},300))}},[l,K,te,P,ne]),v=t.useCallback(e=>{if(l){if(_){const r={...e};_.call(void 0,r)}K===void 0&&me(!1)}},[l,K,_]),C=t.useCallback(e=>{H.current=!0,e(),window.setTimeout(()=>H.current=!1,0)},[]),u=t.useCallback(e=>{e&&C(()=>e.focus())},[C]),ze=t.useCallback(()=>{var e;!d&&l?v({target:o.current}):n.filterable?u((e=R.current)==null?void 0:e.element):u(S.current&&S.current.element)},[d,l,u,v,n.filterable]),_e=t.useCallback(()=>{d&&u(F.current)},[d,u]),je=t.useCallback(e=>{if(!d&&!H.current&&(ae(!0),n.onFocus&&o.current)){const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};n.onFocus.call(void 0,r)}},[d,n.onFocus]),$e=t.useCallback(e=>{if(d&&!H.current&&o.current){ae(!1);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};if(n.onBlur){const s={...r};n.onBlur.call(void 0,s)}P||v(r)}},[d,n.onBlur,l,K,_]),He=t.useCallback(()=>{d&&C(i.noop)},[d,C]),Ge=t.useCallback(e=>{if(!e.isDefaultPrevented()&&o.current){ae(!0);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};l||Q(r)}},[l,Q]),Ue=t.useCallback(e=>{var Z,Se;const{keyCode:r,altKey:s}=e,k=S.current&&S.current.element;if(!o.current||e.isDefaultPrevented()&&((Z=R.current)==null?void 0:Z.element)===e.target)return;const q={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};if(g&&g.length>0&&(r===i.Keys.left||r===i.Keys.right||r===i.Keys.home||r===i.Keys.end||r===i.Keys.delete)){const c=G.current;let p=O?c.findIndex(Ye=>ee.matchTags(Ye,O,M)):-1,f;const le=p!==-1;r===i.Keys.left?(le?p=Math.max(0,p-1):p=c.length-1,f=c[p]):r===i.Keys.right?p===c.length-1?f=void 0:le&&(p=Math.min(c.length-1,p+1),f=c[p]):r===i.Keys.home?f=c[0]:r===i.Keys.end?f=c[c.length-1]:r===i.Keys.delete&&le&&w(q,c[p].data,"delete"),f!==O&&qe(f)}if(l)if(r===i.Keys.esc||s&&r===i.Keys.up)e.preventDefault(),v(q);else if(k&&k.querySelector(".k-focus")&&(r===i.Keys.up||r===i.Keys.down||r===i.Keys.left||r===i.Keys.right||r===i.Keys.home||r===i.Keys.end)){if(r===i.Keys.up&&((Se=R.current)!=null&&Se.element)){const c=Array.from(k.querySelectorAll(".k-treeview-item")),p=[...c].reverse().find(f=>!!(f&&f.querySelector(".k-focus")));if(p&&c.indexOf(p)===0)return C(()=>{var f;u((f=R.current)==null?void 0:f.element)})}C(i.noop)}else r===i.Keys.down&&C(()=>{var c;u(((c=R.current)==null?void 0:c.element)||k)});else s&&r===i.Keys.down&&(e.preventDefault(),Q(q))},[l,v,u,C,Q,O,M,g,w]),ye=t.useCallback(e=>{const{keyCode:r,altKey:s}=e;s||r!==i.Keys.up&&r!==i.Keys.down||(e.preventDefault(),C(r===i.Keys.up?()=>{u(F.current)}:()=>{u(S.current&&S.current.element)}))},[u,C]),oe=t.useCallback(e=>{if(!o.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};w(r,[],"clear"),v(r),e.preventDefault()},[w,v]),Je=t.useCallback((e,r)=>{var s;v({target:o.current}),d||u((s=R.current)==null?void 0:s.element),w({syntheticEvent:r,nativeEvent:r.nativeEvent,target:o.current},e,"delete")},[w,v,u,d]),be=t.useCallback(e=>{if(n.onExpandChange&&o.current){const{item:r,itemHierarchicalIndex:s,nativeEvent:k,syntheticEvent:q}=e,Z={level:gt(s),item:r,nativeEvent:k,syntheticEvent:q,target:o.current};n.onExpandChange.call(void 0,Z)}},[n.onExpandChange]),Ce=t.useCallback(e=>{if(n.onFilterChange&&o.current){const s={filter:{field:n.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:o.current};n.onFilterChange.call(void 0,s),n.filter===void 0&&Ve(e.target.value)}},[n.onFilterChange,n.filter,n.textField]),ke=t.useCallback(e=>{if(!o.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};n.onCancel&&n.onCancel.call(void 0,r),v(r),e.preventDefault()},[n.onCancel,v]),Qe=()=>{const e=n.filterable?t.createElement(Ie,{value:n.filter===void 0?he:n.filter,ref:ne,onChange:Ce,onKeyDown:ye,size:y,rounded:A,fillMode:z}):null,r={adaptiveTitle:n.adaptiveTitle,expand:l,onClose:s=>n.onCancel?ke(s):oe(s),windowWidth:re,mobileFilter:e,footer:{cancelText:X.toLanguageString(m.adaptiveModeFooterCancel,m.messages[m.adaptiveModeFooterCancel]),onCancel:s=>n.onCancel?ke(s):oe(s),applyText:X.toLanguageString(m.adaptiveModeFooterApply,m.messages[m.adaptiveModeFooterApply]),onApply:s=>v(s)}};return t.createElement(lt.AdaptiveMode,{...r},t.createElement(ct.ActionSheetContent,{className:"!k-overflow-hidden"},t.createElement("div",{className:"k-list-container"},t.createElement("div",{className:"k-list k-list-lg"},B.length>0?t.createElement(we.TreeView,{ref:S,tabIndex:j,data:B,focusIdField:M,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:be,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Ee,null,X.toLanguageString(m.nodata,m.messages[m.nodata]))))))},Xe=t.useCallback(e=>{for(let r of e)Oe(r.target.clientWidth)},[]),Ee=n.listNoData||rt.ListNoData,X=tt.useLocalization(),Fe=!De||se.valid,Y=P&&l?Pe:G.current,xe=t.createElement(t.Fragment,null,t.createElement("span",{className:i.classNames("k-multiselecttree k-input",n.className,{[`k-input-${Te[y]||y}`]:y,[`k-rounded-${ft[A]||A}`]:A,[`k-input-${z}`]:z,"k-focus":d&&!x,"k-invalid":!Fe,"k-disabled":x,"k-loading":n.loading,"k-required":ve}),tabIndex:j,accessKey:n.accessKey,id:T,style:V?{...L,width:void 0}:L,dir:D,ref:F,onKeyDown:x?void 0:Ue,onMouseDown:He,onFocus:je,onBlur:$e,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":x,"aria-label":V,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy?n.ariaDescribedBy:"tagslist-"+T,"aria-required":n.required,onClick:x?void 0:Ge},t.createElement("div",{id:"tagslist-"+T,className:i.classNames("k-input-values k-chip-list",{[`k-chip-list-${Te[y]||y}`]:y})},Y.length>0&&t.createElement(st,{tag:n.tag,onTagDelete:Je,data:Y,guid:T,focused:O?G.current.find(e=>ee.matchTags(e,O,M)):void 0,size:y})),t.createElement("span",{className:"k-input-inner"},Y.length===0&&t.createElement("span",{className:"k-input-value-text"},ue)),n.loading&&t.createElement(i.IconWrap,{className:"k-input-loading-icon",name:"loading"}),ie&&!x&&Y.length>0&&t.createElement(ot,{onClick:oe}),t.createElement("select",{name:Ke,ref:$,tabIndex:-1,"aria-hidden":!0,title:V,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,g):g})),!P&&t.createElement(et.Popup,{...N,popupClass:i.classNames(N.popupClass,"k-multiselecttree-popup"),className:i.classNames(N.className,{"k-rtl":D==="rtl"}),style:Ae,anchor:N.anchor||F.current,show:l,onOpen:ze,onClose:_e,ref:U},n.filterable&&t.createElement(Ie,{value:n.filter===void 0?he:n.filter,ref:R,onChange:Ce,onKeyDown:ye,tabIndex:j,size:y,rounded:A,fillMode:z,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),B.length>0?t.createElement(we.TreeView,{style:{height:N.height},ref:S,tabIndex:j,data:B,focusIdField:M,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:be,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Ee,null,X.toLanguageString(m.nodata,m.messages[m.nodata])))),P&&Qe());return V?t.createElement(it.FloatingLabel,{label:V,editorValue:ie,editorPlaceholder:ue,editorValid:Fe,editorDisabled:x,editorId:T,style:{width:L?L.width:void 0},children:xe,dir:D}):xe}),mt={opened:a.bool,disabled:a.bool,dir:a.string,tabIndex:a.number,accessKey:a.string,data:a.array,value:a.any,valueMap:a.func,placeholder:a.string,dataItemKey:a.string.isRequired,textField:a.string.isRequired,checkField:a.string,checkIndeterminateField:a.string,expandField:a.string,subItemsField:a.string,className:a.string,style:a.object,label:a.string,validationMessage:a.string,validityStyles:a.bool,valid:a.bool,required:a.bool,name:a.string,id:a.string,ariaLabelledBy:a.string,ariaDescribedBy:a.string,filterable:a.bool,filter:a.string,loading:a.bool,tags:a.arrayOf(a.shape({text:a.string,data:a.arrayOf(a.any)})),popupSettings:a.shape({animate:a.oneOfType([a.bool,a.shape({openDuration:a.number,closeDuration:a.number})]),popupClass:a.string,className:a.string,appendTo:a.any,width:a.oneOfType([a.string,a.number]),height:a.oneOfType([a.string,a.number])}),onOpen:a.func,onClose:a.func,onFocus:a.func,onBlur:a.func,onChange:a.func,onFilterChange:a.func,onExpandChange:a.func,onCancel:a.func,item:a.func,listNoData:a.func,adaptiveTitle:a.string,adaptive:a.bool};ce.displayName="KendoReactMultiSelectTree";ce.propTypes=mt;exports.MultiSelectTree=ce;exports.MultiSelectTreePropsContext=Me;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ze=require("react"),a=require("prop-types"),i=require("@progress/kendo-react-common"),et=require("@progress/kendo-react-popup"),tt=require("@progress/kendo-react-intl"),we=require("@progress/kendo-react-treeview"),nt=require("../package-metadata.js"),ee=require("../common/utils.js"),at=require("../DropDownTree/useDropdownWidth.js"),rt=require("../DropDownTree/ListNoData.js"),m=require("../messages/index.js"),it=require("@progress/kendo-react-labels"),st=require("../MultiSelect/TagList.js"),ot=require("../common/ClearButton.js"),Ie=require("../common/ListFilter.js"),lt=require("../common/AdaptiveMode.js"),ct=require("@progress/kendo-react-layout"),ut=require("../common/constants.js");function dt(h){const b=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(h){for(const n in h)if(n!=="default"){const I=Object.getOwnPropertyDescriptor(h,n);Object.defineProperty(b,n,I.get?I:{enumerable:!0,get:()=>h[n]})}}return b.default=h,Object.freeze(b)}const t=dt(Ze),pt="Please select a value from the list!",{sizeMap:Te,roundedMap:ft}=i.kendoThemeMaps,gt=h=>h.split("_").map(b=>parseInt(b,10)),vt=(h,b)=>{const{validationMessage:n,valid:I,required:T}=h;return{customError:n!==void 0,valid:!!(I!==void 0?I:!T||b),valueMissing:!b}},E={checkField:"checkField",checkIndeterminateField:"checkIndeterminateField",subItemsField:"items",popupSettings:{animate:!0,width:"200px",height:"200px"},size:"medium",rounded:"medium",fillMode:"solid",required:!1,validityStyles:!0},Me=i.createPropsContext(),ce=t.forwardRef((h,b)=>{const n=i.usePropsContext(Me,h);i.validatePackage(nt.packageMetadata);const I=i.useId(),T=n.id||I,{data:B=[],dataItemKey:M,style:L={},placeholder:ue,label:V,name:Ke,validationMessage:W,valid:Re,tags:de,value:g,opened:K,disabled:x,popupSettings:N=E.popupSettings,checkField:pe=E.checkField,checkIndeterminateField:fe=E.checkIndeterminateField,subItemsField:ge=E.subItemsField,size:y=E.size,rounded:A=E.rounded,fillMode:z=E.fillMode,required:ve=E.required,validityStyles:De=E.validityStyles,onOpen:te=i.noop,onClose:_=i.noop}=n,j=i.getTabIndex(n.tabIndex,x),o=t.useRef(null),F=t.useRef(null),R=t.useRef(null),ne=t.useRef(null),H=t.useRef(null),S=t.useRef(null),$=t.useRef(!1),G=t.useRef([]),U=t.useRef(null),[O,qe]=t.useState(),[Ne,me]=t.useState(!1),[d,ae]=t.useState(!1),[re,Oe]=t.useState(),[Pe,Le]=t.useState([]),[he,Ve]=t.useState(""),P=!!(re&&re<=ut.MOBILE_MEDIUM_DEVISE&&n.adaptive),l=K!==void 0?K:Ne,ie=!!(Array.isArray(g)&&g.length),se=vt({validationMessage:W,valid:Re,required:ve},ie),D=i.useRtl(F,n.dir),Ae={width:at.useDropdownWidth(F,E,N,L),...D!==void 0?{direction:D}:{}},Be=t.useCallback(()=>F.current&&F.current.focus(),[]);G.current=de===void 0?(g||[]).map(e=>({text:ee.getItemValue(e,n.textField),data:[e]})):[...de],t.useImperativeHandle(o,()=>({props:n,element:F.current,focus:Be})),t.useImperativeHandle(b,()=>o.current);const We=t.useCallback(()=>{H.current&&H.current.setCustomValidity&&H.current.setCustomValidity(se.valid?"":W===void 0?pt:W)},[W,se]);t.useEffect(We),t.useEffect(()=>{const e=i.canUseDOM&&window.ResizeObserver&&new window.ResizeObserver(Xe.bind(void 0));return document!=null&&document.body&&e&&e.observe(document.body),()=>{e&&e.disconnect()}},[]),t.useEffect(()=>{U.current&&l&&U.current.setPosition(U.current._popup)},[g,l]);const w=t.useCallback((e,r,s)=>{if(n.onChange){const k={items:r,operation:s,...e};n.onChange.call(void 0,k)}},[n.onChange]),J=t.useCallback(e=>{if(ee.areSame(e.item,g,M)||!o.current)return;const{item:r,nativeEvent:s,syntheticEvent:k}=e,q={syntheticEvent:k,nativeEvent:s,target:o.current};w(q,[r],"toggle")},[g,M,w]),Q=t.useCallback(e=>{if(!l){if(te){const r={...e};te.call(void 0,r)}K===void 0&&(me(!0),Le(g||[]),P&&setTimeout(()=>{var r;u((r=ne.current)==null?void 0:r.element)},300))}},[l,K,te,P,ne]),v=t.useCallback(e=>{if(l){if(_){const r={...e};_.call(void 0,r)}K===void 0&&me(!1)}},[l,K,_]),C=t.useCallback(e=>{$.current=!0,e(),window.setTimeout(()=>$.current=!1,0)},[]),u=t.useCallback(e=>{e&&C(()=>e.focus())},[C]),ze=t.useCallback(()=>{var e;!d&&l?v({target:o.current}):n.filterable?u((e=R.current)==null?void 0:e.element):u(S.current&&S.current.element)},[d,l,u,v,n.filterable]),_e=t.useCallback(()=>{d&&u(F.current)},[d,u]),je=t.useCallback(e=>{if(!d&&!$.current&&(ae(!0),n.onFocus&&o.current)){const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};n.onFocus.call(void 0,r)}},[d,n.onFocus]),He=t.useCallback(e=>{if(d&&!$.current&&o.current){ae(!1);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};if(n.onBlur){const s={...r};n.onBlur.call(void 0,s)}P||v(r)}},[d,n.onBlur,l,K,_]),$e=t.useCallback(()=>{d&&C(i.noop)},[d,C]),Ge=t.useCallback(e=>{if(!e.isDefaultPrevented()&&o.current){ae(!0);const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};l||Q(r)}},[l,Q]),Ue=t.useCallback(e=>{var Z,Se;const{keyCode:r,altKey:s}=e,k=S.current&&S.current.element;if(!o.current||e.isDefaultPrevented()&&((Z=R.current)==null?void 0:Z.element)===e.target)return;const q={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};if(g&&g.length>0&&(r===i.Keys.left||r===i.Keys.right||r===i.Keys.home||r===i.Keys.end||r===i.Keys.delete)){const c=G.current;let p=O?c.findIndex(Ye=>ee.matchTags(Ye,O,M)):-1,f;const le=p!==-1;r===i.Keys.left?(le?p=Math.max(0,p-1):p=c.length-1,f=c[p]):r===i.Keys.right?p===c.length-1?f=void 0:le&&(p=Math.min(c.length-1,p+1),f=c[p]):r===i.Keys.home?f=c[0]:r===i.Keys.end?f=c[c.length-1]:r===i.Keys.delete&&le&&w(q,c[p].data,"delete"),f!==O&&qe(f)}if(l)if(r===i.Keys.esc||s&&r===i.Keys.up)e.preventDefault(),v(q);else if(k&&k.querySelector(".k-focus")&&(r===i.Keys.up||r===i.Keys.down||r===i.Keys.left||r===i.Keys.right||r===i.Keys.home||r===i.Keys.end)){if(r===i.Keys.up&&((Se=R.current)!=null&&Se.element)){const c=Array.from(k.querySelectorAll(".k-treeview-item")),p=[...c].reverse().find(f=>!!(f&&f.querySelector(".k-focus")));if(p&&c.indexOf(p)===0)return C(()=>{var f;u((f=R.current)==null?void 0:f.element)})}C(i.noop)}else r===i.Keys.down&&C(()=>{var c;u(((c=R.current)==null?void 0:c.element)||k)});else s&&r===i.Keys.down&&(e.preventDefault(),Q(q))},[l,v,u,C,Q,O,M,g,w]),ye=t.useCallback(e=>{const{keyCode:r,altKey:s}=e;s||r!==i.Keys.up&&r!==i.Keys.down||(e.preventDefault(),C(r===i.Keys.up?()=>{u(F.current)}:()=>{u(S.current&&S.current.element)}))},[u,C]),oe=t.useCallback(e=>{if(!o.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};w(r,[],"clear"),v(r),e.preventDefault()},[w,v]),Je=t.useCallback((e,r)=>{var s;v({target:o.current}),d||u((s=R.current)==null?void 0:s.element),w({syntheticEvent:r,nativeEvent:r.nativeEvent,target:o.current},e,"delete")},[w,v,u,d]),be=t.useCallback(e=>{if(n.onExpandChange&&o.current){const{item:r,itemHierarchicalIndex:s,nativeEvent:k,syntheticEvent:q}=e,Z={level:gt(s),item:r,nativeEvent:k,syntheticEvent:q,target:o.current};n.onExpandChange.call(void 0,Z)}},[n.onExpandChange]),Ce=t.useCallback(e=>{if(n.onFilterChange&&o.current){const s={filter:{field:n.textField,operator:"contains",value:e.target.value},syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:o.current};n.onFilterChange.call(void 0,s),n.filter===void 0&&Ve(e.target.value)}},[n.onFilterChange,n.filter,n.textField]),ke=t.useCallback(e=>{if(!o.current)return;const r={syntheticEvent:e,nativeEvent:e.nativeEvent,target:o.current};n.onCancel&&n.onCancel.call(void 0,r),v(r),e.preventDefault()},[n.onCancel,v]),Qe=()=>{const e=n.filterable?t.createElement(Ie,{value:n.filter===void 0?he:n.filter,ref:ne,onChange:Ce,onKeyDown:ye,size:y,rounded:A,fillMode:z}):null,r={adaptiveTitle:n.adaptiveTitle,expand:l,onClose:s=>n.onCancel?ke(s):oe(s),windowWidth:re,mobileFilter:e,footer:{cancelText:X.toLanguageString(m.adaptiveModeFooterCancel,m.messages[m.adaptiveModeFooterCancel]),onCancel:s=>n.onCancel?ke(s):oe(s),applyText:X.toLanguageString(m.adaptiveModeFooterApply,m.messages[m.adaptiveModeFooterApply]),onApply:s=>v(s)}};return t.createElement(lt.AdaptiveMode,{...r},t.createElement(ct.ActionSheetContent,{overflowHidden:!0},t.createElement("div",{className:"k-list-container"},t.createElement("div",{className:"k-list k-list-lg"},B.length>0?t.createElement(we.TreeView,{ref:S,tabIndex:j,data:B,focusIdField:M,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:be,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Ee,null,X.toLanguageString(m.nodata,m.messages[m.nodata]))))))},Xe=t.useCallback(e=>{for(let r of e)Oe(r.target.clientWidth)},[]),Ee=n.listNoData||rt.ListNoData,X=tt.useLocalization(),Fe=!De||se.valid,Y=P&&l?Pe:G.current,xe=t.createElement(t.Fragment,null,t.createElement("span",{className:i.classNames("k-multiselecttree k-input",n.className,{[`k-input-${Te[y]||y}`]:y,[`k-rounded-${ft[A]||A}`]:A,[`k-input-${z}`]:z,"k-focus":d&&!x,"k-invalid":!Fe,"k-disabled":x,"k-loading":n.loading,"k-required":ve}),tabIndex:j,accessKey:n.accessKey,id:T,style:V?{...L,width:void 0}:L,dir:D,ref:F,onKeyDown:x?void 0:Ue,onMouseDown:$e,onFocus:je,onBlur:He,role:"combobox","aria-haspopup":"tree","aria-expanded":l,"aria-disabled":x,"aria-label":V,"aria-labelledby":n.ariaLabelledBy,"aria-describedby":n.ariaDescribedBy?n.ariaDescribedBy:"tagslist-"+T,"aria-required":n.required,onClick:x?void 0:Ge},t.createElement("div",{id:"tagslist-"+T,className:i.classNames("k-input-values k-chip-list",{[`k-chip-list-${Te[y]||y}`]:y})},Y.length>0&&t.createElement(st,{tag:n.tag,onTagDelete:Je,data:Y,guid:T,focused:O?G.current.find(e=>ee.matchTags(e,O,M)):void 0,size:y})),t.createElement("span",{className:"k-input-inner"},Y.length===0&&t.createElement("span",{className:"k-input-value-text"},ue)),n.loading&&t.createElement(i.IconWrap,{className:"k-input-loading-icon",name:"loading"}),ie&&!x&&Y.length>0&&t.createElement(ot,{onClick:oe}),t.createElement("select",{name:Ke,ref:H,tabIndex:-1,"aria-hidden":!0,title:V,style:{opacity:0,width:1,border:0,zIndex:-1,position:"absolute",left:"50%"}},t.createElement("option",{value:n.valueMap?n.valueMap.call(void 0,g):g})),!P&&t.createElement(et.Popup,{...N,popupClass:i.classNames(N.popupClass,"k-multiselecttree-popup"),className:i.classNames(N.className,{"k-rtl":D==="rtl"}),style:Ae,anchor:N.anchor||F.current,show:l,onOpen:ze,onClose:_e,ref:U},n.filterable&&t.createElement(Ie,{value:n.filter===void 0?he:n.filter,ref:R,onChange:Ce,onKeyDown:ye,tabIndex:j,size:y,rounded:A,fillMode:z,renderListFilterWrapper:!0,renderPrefixSeparator:!0}),B.length>0?t.createElement(we.TreeView,{style:{height:N.height},ref:S,tabIndex:j,data:B,focusIdField:M,textField:n.textField,checkField:pe,checkIndeterminateField:fe,expandField:n.expandField,childrenField:ge,expandIcons:!0,onItemClick:J,onCheckChange:J,onExpandChange:be,checkboxes:!0,size:y,item:n.item,dir:D}):t.createElement(Ee,null,X.toLanguageString(m.nodata,m.messages[m.nodata])))),P&&Qe());return V?t.createElement(it.FloatingLabel,{label:V,editorValue:ie,editorPlaceholder:ue,editorValid:Fe,editorDisabled:x,editorId:T,style:{width:L?L.width:void 0},children:xe,dir:D}):xe}),mt={opened:a.bool,disabled:a.bool,dir:a.string,tabIndex:a.number,accessKey:a.string,data:a.array,value:a.any,valueMap:a.func,placeholder:a.string,dataItemKey:a.string.isRequired,textField:a.string.isRequired,checkField:a.string,checkIndeterminateField:a.string,expandField:a.string,subItemsField:a.string,className:a.string,style:a.object,label:a.string,validationMessage:a.string,validityStyles:a.bool,valid:a.bool,required:a.bool,name:a.string,id:a.string,ariaLabelledBy:a.string,ariaDescribedBy:a.string,filterable:a.bool,filter:a.string,loading:a.bool,tags:a.arrayOf(a.shape({text:a.string,data:a.arrayOf(a.any)})),popupSettings:a.shape({animate:a.oneOfType([a.bool,a.shape({openDuration:a.number,closeDuration:a.number})]),popupClass:a.string,className:a.string,appendTo:a.any,width:a.oneOfType([a.string,a.number]),height:a.oneOfType([a.string,a.number])}),onOpen:a.func,onClose:a.func,onFocus:a.func,onBlur:a.func,onChange:a.func,onFilterChange:a.func,onExpandChange:a.func,onCancel:a.func,item:a.func,listNoData:a.func,adaptiveTitle:a.string,adaptive:a.bool};ce.displayName="KendoReactMultiSelectTree";ce.propTypes=mt;exports.MultiSelectTree=ce;exports.MultiSelectTreePropsContext=Me;