@progress/kendo-react-dropdowns 8.2.0-develop.9 → 8.2.1-develop.1
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 +206 -208
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +216 -218
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +222 -227
- package/MultiColumnComboBox/MultiColumnComboBox.js +1 -1
- package/MultiColumnComboBox/MultiColumnComboBox.mjs +79 -85
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +329 -330
- package/common/utils.js +1 -1
- package/common/utils.mjs +25 -21
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +10 -2
- package/index.d.ts +10 -2
- package/package-metadata.mjs +1 -1
- package/package.json +9 -9
|
@@ -8,315 +8,314 @@
|
|
|
8
8
|
"use client";
|
|
9
9
|
import * as f from "react";
|
|
10
10
|
import m from "prop-types";
|
|
11
|
-
import { Keys as u, classNames as
|
|
12
|
-
import { plusIcon as
|
|
13
|
-
import { FloatingLabel as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import { ActiveDescendant as
|
|
21
|
-
import { areSame as
|
|
22
|
-
import { packageMetadata as
|
|
23
|
-
import
|
|
24
|
-
import { AdaptiveMode as
|
|
25
|
-
import { ActionSheetContent as
|
|
26
|
-
import { MOBILE_MEDIUM_DEVISE as
|
|
27
|
-
import { provideLocalizationService as
|
|
28
|
-
import { adaptiveModeFooterCancel as
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
const { sizeMap:
|
|
11
|
+
import { Keys as u, classNames as y, IconWrap as R, validatePackage as X, canUseDOM as L, createPropsContext as Z, withIdHOC as tt, withPropsContext as et, kendoThemeMaps as st } from "@progress/kendo-react-common";
|
|
12
|
+
import { plusIcon as it } from "@progress/kendo-svg-icons";
|
|
13
|
+
import { FloatingLabel as ot } from "@progress/kendo-react-labels";
|
|
14
|
+
import at from "../common/ListContainer.mjs";
|
|
15
|
+
import nt from "../common/List.mjs";
|
|
16
|
+
import lt from "../common/GroupStickyHeader.mjs";
|
|
17
|
+
import dt from "./TagList.mjs";
|
|
18
|
+
import rt from "../common/SearchBar.mjs";
|
|
19
|
+
import F from "../common/DropDownBase.mjs";
|
|
20
|
+
import { ActiveDescendant as k } from "../common/settings.mjs";
|
|
21
|
+
import { getFilteredData as I, areSame as E, removeDataItems as w, isPresent as M, getItemValue as O, preventDefaultNonInputs as ht, matchTags as B, itemIndexStartsWith as pt } from "../common/utils.mjs";
|
|
22
|
+
import { packageMetadata as ct } from "../package-metadata.mjs";
|
|
23
|
+
import ut from "../common/ClearButton.mjs";
|
|
24
|
+
import { AdaptiveMode as ft } from "../common/AdaptiveMode.mjs";
|
|
25
|
+
import { ActionSheetContent as gt } from "@progress/kendo-react-layout";
|
|
26
|
+
import { MOBILE_MEDIUM_DEVISE as mt } from "../common/constants.mjs";
|
|
27
|
+
import { provideLocalizationService as vt } from "@progress/kendo-react-intl";
|
|
28
|
+
import { adaptiveModeFooterCancel as z, messages as V, adaptiveModeFooterApply as H } from "../messages/index.mjs";
|
|
29
|
+
import It from "../common/ListFilter.mjs";
|
|
30
|
+
import A from "../common/withCustomComponent.mjs";
|
|
31
|
+
const { sizeMap: D, roundedMap: yt } = st, bt = "Please enter a valid value!", $ = (T) => T.preventDefault(), q = (T) => T === 2, b = class b extends f.Component {
|
|
32
32
|
constructor(n) {
|
|
33
33
|
super(n), this.state = {
|
|
34
|
-
activedescendant:
|
|
34
|
+
activedescendant: k.PopupList,
|
|
35
35
|
currentValue: []
|
|
36
|
-
}, this._element = null, this._valueItemsDuringOnChange = null, this.base = new
|
|
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
|
-
}, this.handleItemSelect = (
|
|
39
|
-
const {
|
|
40
|
-
this._lastSelectedOrDeslectedItemIndex =
|
|
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));
|
|
40
|
+
this._lastSelectedOrDeslectedItemIndex = a.findIndex((g) => E(g, c, o));
|
|
41
41
|
let i = [];
|
|
42
|
-
|
|
43
|
-
}, this.onTagDelete = (
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
}, this.itemFocus = (
|
|
49
|
-
const {
|
|
50
|
-
l &&
|
|
51
|
-
}, this.componentRef = (
|
|
52
|
-
this._element =
|
|
53
|
-
}, this.searchbarRef = (
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
}, this.onChangeHandler = (
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
}, this.clearButtonClick = (
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
}, this.onInputKeyDown = (
|
|
65
|
-
const {
|
|
66
|
-
if (l.syntheticEvent =
|
|
67
|
-
return this.onTagsNavigate(
|
|
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);
|
|
43
|
+
}, this.onTagDelete = (e, t) => {
|
|
44
|
+
const o = this.base.initState();
|
|
45
|
+
o.syntheticEvent = t, this.opened && this.base.togglePopup(o), !this.state.focused && !this.mobileMode && (o.data.focused = !0, this.focus());
|
|
46
|
+
const s = this.value;
|
|
47
|
+
w(s, e, this.props.dataItemKey), this.triggerOnChange(s, o), this.applyState(o);
|
|
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);
|
|
51
|
+
}, this.componentRef = (e) => {
|
|
52
|
+
this._element = e, this.base.wrapper = e;
|
|
53
|
+
}, this.searchbarRef = (e) => {
|
|
54
|
+
const t = this._input = e && e.input;
|
|
55
|
+
t && this.state.focused && window.setTimeout(() => t.focus(), 0);
|
|
56
|
+
}, this.onChangeHandler = (e) => {
|
|
57
|
+
const t = this.base.initState(), o = e.target.value;
|
|
58
|
+
t.syntheticEvent = e, this.props.filter === void 0 && (t.data.text = o), t.data.focusedIndex = void 0, this.opened || (this.base.togglePopup(t), this.setState({ currentValue: this.value })), this.base.filterChanged(o, t), this.applyState(t), this.setState({ group: void 0 });
|
|
59
|
+
}, this.clearButtonClick = (e) => {
|
|
60
|
+
const t = this.base.initState();
|
|
61
|
+
t.syntheticEvent = e, e.stopPropagation(), this.value.length > 0 && this.triggerOnChange([], t), this.state.focusedIndex !== void 0 && (t.data.focusedIndex = void 0), this.opened && this.base.togglePopup(t);
|
|
62
|
+
const o = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
63
|
+
M(o) && o !== "" && this.base.filterChanged("", t), this.state.text && (t.data.text = ""), this._lastSelectedOrDeslectedItemIndex = null, this.applyState(t);
|
|
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);
|
|
68
68
|
const g = () => {
|
|
69
|
-
|
|
69
|
+
e.preventDefault(), this.base.togglePopup(l), this.applyState(l);
|
|
70
70
|
};
|
|
71
71
|
if (this.opened)
|
|
72
72
|
if (a === u.pageUp)
|
|
73
|
-
|
|
73
|
+
e.preventDefault(), this.base.scrollPopupByPageSize(-1);
|
|
74
74
|
else if (a === u.pageDown)
|
|
75
|
-
|
|
76
|
-
else if ((
|
|
77
|
-
const
|
|
78
|
-
this.updateStateOnKeyboardNavigation(
|
|
79
|
-
} else if ((
|
|
80
|
-
const
|
|
81
|
-
this.itemFocus(
|
|
82
|
-
} else if ((
|
|
83
|
-
const
|
|
84
|
-
this.itemFocus(0, l), this.updateStateOnKeyboardNavigation(
|
|
85
|
-
} else if (
|
|
86
|
-
let
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
} else if (
|
|
90
|
-
let
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
} else if (
|
|
75
|
+
e.preventDefault(), this.base.scrollPopupByPageSize(1);
|
|
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);
|
|
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);
|
|
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);
|
|
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));
|
|
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));
|
|
93
|
+
} else if (e.altKey && a === u.up)
|
|
94
94
|
g();
|
|
95
95
|
else if (a === u.up || a === u.down) {
|
|
96
|
-
if (o !== "" &&
|
|
97
|
-
if (!this.props.skipDisabledItems &&
|
|
96
|
+
if (o !== "" && t)
|
|
97
|
+
if (!this.props.skipDisabledItems && c)
|
|
98
98
|
this.onNavigate(l, a);
|
|
99
99
|
else {
|
|
100
|
-
let
|
|
100
|
+
let r = 0;
|
|
101
101
|
if (a === u.down || a === u.right) {
|
|
102
|
-
const
|
|
103
|
-
|
|
102
|
+
const p = s.slice(i + 1).find((v) => !v.disabled && v[t]);
|
|
103
|
+
r = p && s.findIndex((v) => v[t] === p[t]);
|
|
104
104
|
} else if (a === u.up || a === u.left) {
|
|
105
|
-
let
|
|
105
|
+
let p;
|
|
106
106
|
if (i === -1)
|
|
107
|
-
|
|
107
|
+
p = s, r = s.findIndex((v) => !v.disabled && v[t]);
|
|
108
108
|
else {
|
|
109
|
-
|
|
110
|
-
let v =
|
|
109
|
+
p = s.slice(0, i);
|
|
110
|
+
let v = p.pop();
|
|
111
111
|
for (; v && v.disabled; )
|
|
112
|
-
v =
|
|
113
|
-
|
|
112
|
+
v = p.pop();
|
|
113
|
+
r = v && s.findIndex((S) => S[t] === v[t]);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
118
|
-
this.onNavigate(l, a,
|
|
116
|
+
if (r) {
|
|
117
|
+
const p = r - i;
|
|
118
|
+
this.onNavigate(l, a, p);
|
|
119
119
|
} else
|
|
120
|
-
|
|
120
|
+
r !== void 0 && this.onNavigate(l, a);
|
|
121
121
|
}
|
|
122
|
-
else if (!this.props.skipDisabledItems &&
|
|
122
|
+
else if (!this.props.skipDisabledItems && c)
|
|
123
123
|
this.onNavigate(l, a);
|
|
124
124
|
else {
|
|
125
|
-
let
|
|
125
|
+
let r = null;
|
|
126
126
|
if (a === u.down || a === u.right)
|
|
127
|
-
|
|
127
|
+
r = s.slice(i + 1).find((p) => !p.disabled);
|
|
128
128
|
else if (a === u.up || a === u.left) {
|
|
129
|
-
const
|
|
130
|
-
for (
|
|
131
|
-
|
|
129
|
+
const p = s.slice(0, i);
|
|
130
|
+
for (r = p.pop(); r && r.disabled; )
|
|
131
|
+
r = p.pop();
|
|
132
132
|
}
|
|
133
|
-
if (
|
|
134
|
-
const
|
|
135
|
-
this.onNavigate(l, a,
|
|
133
|
+
if (r) {
|
|
134
|
+
const p = r.id - i - 1;
|
|
135
|
+
this.onNavigate(l, a, p);
|
|
136
136
|
} else
|
|
137
137
|
this.onNavigate(l, a);
|
|
138
138
|
}
|
|
139
|
-
this.applyState(l),
|
|
139
|
+
this.applyState(l), e.preventDefault();
|
|
140
140
|
} else
|
|
141
|
-
a === u.enter ? (
|
|
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();
|
|
142
142
|
else
|
|
143
|
-
|
|
143
|
+
e.altKey && a === u.down ? g() : a === u.esc && this.clearButtonClick(e);
|
|
144
144
|
}, this.listContainerContent = () => {
|
|
145
|
-
const { header:
|
|
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(
|
|
146
146
|
"div",
|
|
147
147
|
{
|
|
148
|
-
className:
|
|
149
|
-
[`k-list-${
|
|
148
|
+
className: y("k-list", {
|
|
149
|
+
[`k-list-${D[s] || s}`]: s
|
|
150
150
|
}),
|
|
151
151
|
key: "customitem",
|
|
152
152
|
onClick: this.customItemSelect,
|
|
153
|
-
onMouseDown:
|
|
153
|
+
onMouseDown: $
|
|
154
154
|
},
|
|
155
155
|
/* @__PURE__ */ f.createElement(
|
|
156
156
|
"div",
|
|
157
157
|
{
|
|
158
|
-
className:
|
|
158
|
+
className: y("k-list-item k-custom-item", { "k-focus": q(l) }),
|
|
159
159
|
style: { fontStyle: "italic" }
|
|
160
160
|
},
|
|
161
161
|
i,
|
|
162
|
-
/* @__PURE__ */ f.createElement(
|
|
162
|
+
/* @__PURE__ */ f.createElement(R, { name: "plus", icon: it, style: { position: "absolute", right: "0.5em" } })
|
|
163
163
|
)
|
|
164
164
|
);
|
|
165
|
-
let { group:
|
|
166
|
-
return
|
|
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(
|
|
167
167
|
"div",
|
|
168
168
|
{
|
|
169
|
-
className:
|
|
169
|
+
className: y(
|
|
170
170
|
"k-list",
|
|
171
171
|
{
|
|
172
|
-
[`k-list-${this.mobileMode ? "lg" :
|
|
172
|
+
[`k-list-${this.mobileMode ? "lg" : D[s] || s}`]: s,
|
|
173
173
|
"k-virtual-list": this.base.vs.enabled
|
|
174
174
|
}
|
|
175
175
|
)
|
|
176
176
|
},
|
|
177
|
-
!
|
|
177
|
+
!c && r && d.length !== 0 && /* @__PURE__ */ f.createElement(lt, { group: r, 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
|
|
182
|
-
dir:
|
|
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 = {
|
|
182
|
+
dir: t !== void 0 ? t : e.dirCalculated,
|
|
183
183
|
width: a,
|
|
184
184
|
popupSettings: {
|
|
185
|
-
...
|
|
186
|
-
popupClass:
|
|
187
|
-
|
|
185
|
+
...s,
|
|
186
|
+
popupClass: y(
|
|
187
|
+
s.popupClass,
|
|
188
188
|
"k-list-container",
|
|
189
189
|
"k-multiselect-popup"
|
|
190
190
|
),
|
|
191
|
-
anchor:
|
|
191
|
+
anchor: s.anchor || this.element,
|
|
192
192
|
show: this.opened,
|
|
193
193
|
onOpen: this.onPopupOpened,
|
|
194
194
|
onClose: this.onPopupClosed
|
|
195
195
|
},
|
|
196
|
-
itemsCount: [
|
|
196
|
+
itemsCount: [o.length, this.value.length]
|
|
197
197
|
};
|
|
198
|
-
return /* @__PURE__ */ f.createElement(
|
|
198
|
+
return /* @__PURE__ */ f.createElement(at, { ...h }, this.listContainerContent());
|
|
199
199
|
}, this.renderAdaptiveListContainer = () => {
|
|
200
|
-
const { adaptiveTitle:
|
|
201
|
-
this.localization =
|
|
202
|
-
const
|
|
203
|
-
|
|
200
|
+
const { adaptiveTitle: e, filterable: t, filter: o } = this.props, { windowWidth: s = 0 } = this.state, a = o !== void 0 ? o : this.state.text;
|
|
201
|
+
this.localization = vt(this);
|
|
202
|
+
const h = t ? /* @__PURE__ */ f.createElement(
|
|
203
|
+
It,
|
|
204
204
|
{
|
|
205
205
|
value: a,
|
|
206
|
-
ref: (
|
|
206
|
+
ref: (d) => this._adaptiveInput = d && d.element,
|
|
207
207
|
onChange: this.onChangeHandler,
|
|
208
208
|
onKeyDown: this.onInputKeyDown,
|
|
209
209
|
size: this.props.size,
|
|
210
210
|
rounded: this.props.rounded,
|
|
211
211
|
fillMode: this.props.fillMode
|
|
212
212
|
}
|
|
213
|
-
) : null,
|
|
214
|
-
adaptiveTitle:
|
|
213
|
+
) : null, c = {
|
|
214
|
+
adaptiveTitle: e,
|
|
215
215
|
expand: this.opened,
|
|
216
|
-
onClose: (
|
|
217
|
-
windowWidth:
|
|
218
|
-
mobileFilter:
|
|
216
|
+
onClose: (d) => this.onCancel(d),
|
|
217
|
+
windowWidth: s,
|
|
218
|
+
mobileFilter: h,
|
|
219
219
|
footer: {
|
|
220
|
-
cancelText: this.localization.toLanguageString(
|
|
220
|
+
cancelText: this.localization.toLanguageString(z, V[z]),
|
|
221
221
|
onCancel: this.onCancel,
|
|
222
|
-
applyText: this.localization.toLanguageString(
|
|
222
|
+
applyText: this.localization.toLanguageString(H, V[H]),
|
|
223
223
|
onApply: this.closePopup
|
|
224
224
|
}
|
|
225
225
|
};
|
|
226
|
-
return /* @__PURE__ */ f.createElement(
|
|
227
|
-
}, this.closePopup = (
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
}, this.onCancel = (
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
const
|
|
236
|
-
|
|
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())));
|
|
227
|
+
}, this.closePopup = (e) => {
|
|
228
|
+
const t = this.base.initState();
|
|
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" });
|
|
230
|
+
const o = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
231
|
+
M(o) && o !== "" && this.base.filterChanged("", t), this.state.text && (t.data.text = ""), this.applyState(t);
|
|
232
|
+
}, this.onCancel = (e) => {
|
|
233
|
+
const t = this.base.initState();
|
|
234
|
+
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: "onCancel" });
|
|
235
|
+
const o = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
236
|
+
M(o) && o !== "" && this.base.filterChanged("", t), this.state.text && (t.data.text = ""), this.applyState(t);
|
|
237
237
|
}, this.renderList = () => {
|
|
238
238
|
const {
|
|
239
|
-
data: t = [],
|
|
240
239
|
textField: e,
|
|
241
|
-
listNoDataRender:
|
|
240
|
+
listNoDataRender: t,
|
|
242
241
|
itemRender: o,
|
|
243
|
-
groupHeaderItemRender:
|
|
244
|
-
dataItemKey:
|
|
245
|
-
virtual:
|
|
246
|
-
} = this.props,
|
|
242
|
+
groupHeaderItemRender: s,
|
|
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)`;
|
|
247
246
|
return /* @__PURE__ */ f.createElement(
|
|
248
|
-
|
|
247
|
+
nt,
|
|
249
248
|
{
|
|
250
249
|
id: this.base.listBoxId,
|
|
251
250
|
show: this.opened,
|
|
252
|
-
data:
|
|
253
|
-
focusedIndex: i -
|
|
251
|
+
data: c.slice(),
|
|
252
|
+
focusedIndex: i - h.skip,
|
|
254
253
|
value: this.value,
|
|
255
254
|
textField: e,
|
|
256
|
-
valueField:
|
|
255
|
+
valueField: a,
|
|
257
256
|
optionsGuid: this.base.guid,
|
|
258
257
|
groupField: this.props.groupField,
|
|
259
258
|
groupMode: "modern",
|
|
260
|
-
listRef: (
|
|
261
|
-
|
|
259
|
+
listRef: (r) => {
|
|
260
|
+
d.list = this.base.list = r;
|
|
262
261
|
},
|
|
263
262
|
wrapperStyle: this.mobileMode ? {} : { maxHeight: l.height },
|
|
264
263
|
wrapperCssClass: "k-list-content",
|
|
265
|
-
listStyle:
|
|
264
|
+
listStyle: d.enabled ? { transform: g } : void 0,
|
|
266
265
|
key: "listKey",
|
|
267
|
-
skip:
|
|
266
|
+
skip: h.skip,
|
|
268
267
|
onClick: this.handleItemClick,
|
|
269
268
|
itemRender: o,
|
|
270
|
-
groupHeaderItemRender:
|
|
271
|
-
noDataRender:
|
|
272
|
-
onMouseDown:
|
|
269
|
+
groupHeaderItemRender: s,
|
|
270
|
+
noDataRender: t,
|
|
271
|
+
onMouseDown: $,
|
|
273
272
|
onBlur: this.handleBlur,
|
|
274
273
|
onScroll: this.onScroll,
|
|
275
|
-
wrapperRef:
|
|
274
|
+
wrapperRef: d.scrollerRef,
|
|
276
275
|
scroller: this.base.renderScrollElement(),
|
|
277
|
-
ariaSetSize:
|
|
276
|
+
ariaSetSize: h.total
|
|
278
277
|
}
|
|
279
278
|
);
|
|
280
|
-
}, this.onScroll = (
|
|
281
|
-
const { vs:
|
|
282
|
-
|
|
283
|
-
const { groupField:
|
|
284
|
-
let
|
|
285
|
-
if (!(!
|
|
286
|
-
const
|
|
287
|
-
a = this.base.getGroupedDataModernMode(a,
|
|
288
|
-
let i = a[0][
|
|
289
|
-
for (let l = 1; l < a.length && !(
|
|
290
|
-
a[l] && a[l][
|
|
279
|
+
}, this.onScroll = (e) => {
|
|
280
|
+
const { vs: t, list: o } = this.base;
|
|
281
|
+
t.scrollHandler(e);
|
|
282
|
+
const { groupField: s } = this.props;
|
|
283
|
+
let a = I(this.props);
|
|
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;
|
|
286
|
+
a = this.base.getGroupedDataModernMode(a, s);
|
|
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]);
|
|
291
290
|
i !== this.state.group && this.setState({
|
|
292
291
|
group: i
|
|
293
292
|
});
|
|
294
293
|
}
|
|
295
|
-
}, this.customItemSelect = (
|
|
296
|
-
const
|
|
297
|
-
if (!
|
|
294
|
+
}, this.customItemSelect = (e) => {
|
|
295
|
+
const t = this.props.filter !== void 0 ? this.props.filter : this.state.text, { textField: o } = this.props;
|
|
296
|
+
if (!t)
|
|
298
297
|
return;
|
|
299
|
-
const o = this.base.initState();
|
|
300
|
-
o.syntheticEvent = t;
|
|
301
|
-
const a = s ? { [s]: e } : e;
|
|
302
|
-
this.state.text !== void 0 && (o.data.text = ""), o.data.focusedIndex = void 0, this.base.filterChanged("", o);
|
|
303
|
-
const p = [...this.value, a];
|
|
304
|
-
this.triggerOnChange(p, o), this.base.togglePopup(o), this.applyState(o);
|
|
305
|
-
}, this.handleWrapperClick = (t) => {
|
|
306
|
-
const e = this._input;
|
|
307
|
-
!this.opened && e && this.focusElement(e);
|
|
308
298
|
const s = this.base.initState();
|
|
309
|
-
s.syntheticEvent =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
299
|
+
s.syntheticEvent = e;
|
|
300
|
+
const a = o ? { [o]: t } : t;
|
|
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);
|
|
304
|
+
}, this.handleWrapperClick = (e) => {
|
|
305
|
+
const t = this._input;
|
|
306
|
+
!this.opened && t && this.focusElement(t);
|
|
307
|
+
const o = this.base.initState();
|
|
308
|
+
o.syntheticEvent = e, !this.state.focused && !this.mobileMode && (o.events.push({ type: "onFocus" }), o.data.focused = !0), this.mobileMode && (this.setState({ currentValue: this.tagsToRender }), this.mobileMode && window.setTimeout(() => this._adaptiveInput && this._adaptiveInput.focus(), 300)), this.base.togglePopup(o), this.applyState(o);
|
|
309
|
+
}, this.handleItemClick = (e, t) => {
|
|
310
|
+
const o = this.base.initState();
|
|
311
|
+
o.syntheticEvent = t, this.handleItemSelect(e, o), this.props.autoClose && !this.mobileMode && this.base.togglePopup(o), t.stopPropagation(), this.applyState(o);
|
|
312
|
+
}, this.handleBlur = (e) => {
|
|
314
313
|
if (!this.state.focused || this._skipFocusEvent)
|
|
315
314
|
return;
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
}, this.handleFocus = (
|
|
319
|
-
this._skipFocusEvent || this.base.handleFocus(
|
|
315
|
+
const t = this.base.initState(), { allowCustom: o, filterable: s } = this.props;
|
|
316
|
+
t.syntheticEvent = e, t.data.focused = !1, t.events.push({ type: "onBlur" }), this.opened && !this.mobileMode && (this.state.opened && (t.data.opened = !1), t.events.push({ type: "onClose" })), !o && !s && this.state.text && (t.data.text = ""), this.applyState(t);
|
|
317
|
+
}, this.handleFocus = (e) => {
|
|
318
|
+
this._skipFocusEvent || this.base.handleFocus(e);
|
|
320
319
|
}, this.onPopupOpened = () => {
|
|
321
320
|
this._input && this.state.focused && !this.mobileMode && this.focusElement(this._input);
|
|
322
321
|
}, this.onPopupClosed = () => {
|
|
@@ -325,15 +324,15 @@ const { sizeMap: w, roundedMap: Ie } = te, ye = "Please enter a valid value!", A
|
|
|
325
324
|
}, 0);
|
|
326
325
|
}, this.setValidity = () => {
|
|
327
326
|
this._input && this._input.setCustomValidity && this._input.setCustomValidity(
|
|
328
|
-
this.validity.valid ? "" : this.props.validationMessage ||
|
|
327
|
+
this.validity.valid ? "" : this.props.validationMessage || bt
|
|
329
328
|
);
|
|
330
|
-
},
|
|
329
|
+
}, X(ct);
|
|
331
330
|
}
|
|
332
331
|
get _inputId() {
|
|
333
332
|
return this.props.id;
|
|
334
333
|
}
|
|
335
334
|
get document() {
|
|
336
|
-
if (
|
|
335
|
+
if (L)
|
|
337
336
|
return this.element && this.element.ownerDocument || document;
|
|
338
337
|
}
|
|
339
338
|
/** @hidden */
|
|
@@ -346,16 +345,16 @@ const { sizeMap: w, roundedMap: Ie } = te, ye = "Please enter a valid value!", A
|
|
|
346
345
|
}
|
|
347
346
|
/** @hidden */
|
|
348
347
|
get tagsToRender() {
|
|
349
|
-
const { tags: n, textField:
|
|
350
|
-
return n === void 0 ? this.value.forEach((
|
|
351
|
-
|
|
352
|
-
}) :
|
|
348
|
+
const { tags: n, textField: e } = this.props, t = [];
|
|
349
|
+
return n === void 0 ? this.value.forEach((o) => {
|
|
350
|
+
t.push({ text: O(o, e), data: [o] });
|
|
351
|
+
}) : t.push(...n), t;
|
|
353
352
|
}
|
|
354
353
|
/**
|
|
355
354
|
* The mobile mode of the ComboBox.
|
|
356
355
|
*/
|
|
357
356
|
get mobileMode() {
|
|
358
|
-
return !!(this.state.windowWidth && this.state.windowWidth <=
|
|
357
|
+
return !!(this.state.windowWidth && this.state.windowWidth <= mt && this.props.adaptive);
|
|
359
358
|
}
|
|
360
359
|
/**
|
|
361
360
|
* Represents the value of the MultiSelect.
|
|
@@ -374,36 +373,36 @@ const { sizeMap: w, roundedMap: Ie } = te, ye = "Please enter a valid value!", A
|
|
|
374
373
|
* Represents the validity state into which the MultiSelect is set.
|
|
375
374
|
*/
|
|
376
375
|
get validity() {
|
|
377
|
-
const n = this.props.validationMessage !== void 0,
|
|
376
|
+
const n = this.props.validationMessage !== void 0, e = !this.required || this.value !== null && this.value.length > 0 && this.value !== void 0, t = this.props.valid !== void 0 ? this.props.valid : e;
|
|
378
377
|
return {
|
|
379
378
|
customError: n,
|
|
380
|
-
valid:
|
|
379
|
+
valid: t,
|
|
381
380
|
valueMissing: this.value === null
|
|
382
381
|
};
|
|
383
382
|
}
|
|
384
383
|
/** @hidden */
|
|
385
384
|
get required() {
|
|
386
|
-
return this.props.required !== void 0 ? this.props.required :
|
|
385
|
+
return this.props.required !== void 0 ? this.props.required : b.defaultProps.required;
|
|
387
386
|
}
|
|
388
387
|
get validityStyles() {
|
|
389
|
-
return this.props.validityStyles !== void 0 ? this.props.validityStyles :
|
|
388
|
+
return this.props.validityStyles !== void 0 ? this.props.validityStyles : b.defaultProps.validityStyles;
|
|
390
389
|
}
|
|
391
390
|
/** @hidden */
|
|
392
|
-
componentDidUpdate(n,
|
|
391
|
+
componentDidUpdate(n, e) {
|
|
393
392
|
var g;
|
|
394
|
-
const { virtual:
|
|
395
|
-
if (this.base.didUpdate(), !l.animate && i && this.onPopupClosed(),
|
|
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)
|
|
396
395
|
this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
|
|
397
396
|
else {
|
|
398
|
-
let { focusedItem:
|
|
399
|
-
|
|
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);
|
|
400
399
|
}
|
|
401
400
|
this.scrollToFocused = !1, this.setValidity();
|
|
402
401
|
}
|
|
403
402
|
/** @hidden */
|
|
404
403
|
componentDidMount() {
|
|
405
404
|
var n;
|
|
406
|
-
this.observerResize =
|
|
405
|
+
this.observerResize = L && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (n = this.document) != null && n.body && this.observerResize && this.observerResize.observe(this.document.body);
|
|
407
406
|
}
|
|
408
407
|
/** @hidden */
|
|
409
408
|
componentWillUnmount() {
|
|
@@ -411,19 +410,19 @@ const { sizeMap: w, roundedMap: Ie } = te, ye = "Please enter a valid value!", A
|
|
|
411
410
|
(n = this.document) != null && n.body && this.observerResize && this.observerResize.disconnect();
|
|
412
411
|
}
|
|
413
412
|
/** @hidden */
|
|
414
|
-
onNavigate(n,
|
|
415
|
-
const { allowCustom:
|
|
416
|
-
if (this.opened &&
|
|
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;
|
|
415
|
+
if (this.opened && e === u.up && i)
|
|
417
416
|
this.state.focusedIndex !== void 0 && (n.data.focusedIndex = void 0);
|
|
418
417
|
else {
|
|
419
|
-
const
|
|
420
|
-
keyCode:
|
|
421
|
-
current:
|
|
422
|
-
max: (g.enabled ? g.total :
|
|
423
|
-
min:
|
|
424
|
-
skipItems:
|
|
418
|
+
const r = l.navigation.navigate({
|
|
419
|
+
keyCode: e,
|
|
420
|
+
current: c,
|
|
421
|
+
max: (g.enabled ? g.total : s.length) - 1,
|
|
422
|
+
min: d ? -1 : 0,
|
|
423
|
+
skipItems: t || void 0
|
|
425
424
|
});
|
|
426
|
-
|
|
425
|
+
r !== void 0 && (this.itemFocus(r, n), this.scrollToFocused = !0);
|
|
427
426
|
}
|
|
428
427
|
this.applyState(n);
|
|
429
428
|
}
|
|
@@ -431,191 +430,191 @@ const { sizeMap: w, roundedMap: Ie } = te, ye = "Please enter a valid value!", A
|
|
|
431
430
|
render() {
|
|
432
431
|
const {
|
|
433
432
|
style: n,
|
|
434
|
-
className:
|
|
435
|
-
label:
|
|
436
|
-
dir:
|
|
437
|
-
disabled:
|
|
433
|
+
className: e,
|
|
434
|
+
label: t,
|
|
435
|
+
dir: o,
|
|
436
|
+
disabled: s,
|
|
438
437
|
textField: a,
|
|
439
|
-
dataItemKey:
|
|
440
|
-
virtual:
|
|
441
|
-
size:
|
|
438
|
+
dataItemKey: h,
|
|
439
|
+
virtual: c,
|
|
440
|
+
size: d,
|
|
442
441
|
rounded: i,
|
|
443
442
|
fillMode: l,
|
|
444
443
|
loading: g,
|
|
445
|
-
filter:
|
|
446
|
-
} = this.props, { text:
|
|
447
|
-
|
|
448
|
-
const
|
|
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;
|
|
446
|
+
C.enabled = c !== void 0, c !== void 0 && (C.skip = c.skip, C.total = c.total, C.pageSize = c.pageSize);
|
|
447
|
+
const x = this.mobileMode && this.opened ? W : this.tagsToRender;
|
|
449
448
|
this.setItems(this.tagsToRender, this._tags);
|
|
450
|
-
const
|
|
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(
|
|
451
450
|
"div",
|
|
452
451
|
{
|
|
453
452
|
ref: this.componentRef,
|
|
454
|
-
className:
|
|
455
|
-
[`k-input-${
|
|
456
|
-
[`k-rounded-${
|
|
453
|
+
className: y("k-multiselect k-input", e, {
|
|
454
|
+
[`k-input-${D[d] || d}`]: d,
|
|
455
|
+
[`k-rounded-${yt[i] || i}`]: i,
|
|
457
456
|
[`k-input-${l}`]: l,
|
|
458
|
-
"k-focus": v && !
|
|
459
|
-
"k-invalid": !
|
|
460
|
-
"k-disabled":
|
|
457
|
+
"k-focus": v && !s,
|
|
458
|
+
"k-invalid": !K,
|
|
459
|
+
"k-disabled": s,
|
|
461
460
|
"k-loading": g,
|
|
462
461
|
"k-required": this.required
|
|
463
462
|
}),
|
|
464
|
-
style:
|
|
465
|
-
dir:
|
|
463
|
+
style: t ? { ...n, width: void 0 } : n,
|
|
464
|
+
dir: o,
|
|
466
465
|
onFocus: this.handleFocus,
|
|
467
466
|
onBlur: this.handleBlur,
|
|
468
467
|
onClick: this.handleWrapperClick,
|
|
469
|
-
onMouseDown:
|
|
468
|
+
onMouseDown: ht
|
|
470
469
|
},
|
|
471
|
-
this.props.prefix && /* @__PURE__ */ f.createElement(
|
|
472
|
-
/* @__PURE__ */ f.createElement("div", { className:
|
|
470
|
+
this.props.prefix && /* @__PURE__ */ f.createElement(U, { ...Y }),
|
|
471
|
+
/* @__PURE__ */ f.createElement("div", { className: y("k-input-values") }, /* @__PURE__ */ f.createElement(
|
|
473
472
|
"div",
|
|
474
473
|
{
|
|
475
|
-
className:
|
|
474
|
+
className: y(
|
|
476
475
|
"k-chip-list",
|
|
477
|
-
{ [`k-chip-list-${
|
|
476
|
+
{ [`k-chip-list-${D[d] || d}`]: d }
|
|
478
477
|
),
|
|
479
478
|
role: "listbox",
|
|
480
479
|
id: "tagslist-" + this.base.guid
|
|
481
480
|
},
|
|
482
|
-
|
|
483
|
-
|
|
481
|
+
x && x.length > 0 && /* @__PURE__ */ f.createElement(
|
|
482
|
+
dt,
|
|
484
483
|
{
|
|
485
484
|
tagRender: this.props.tagRender,
|
|
486
485
|
onTagDelete: this.onTagDelete,
|
|
487
|
-
data:
|
|
486
|
+
data: x,
|
|
488
487
|
guid: this.base.guid,
|
|
489
|
-
focused:
|
|
490
|
-
size:
|
|
488
|
+
focused: S ? x.find((Q) => B(Q, S, h)) : void 0,
|
|
489
|
+
size: d
|
|
491
490
|
}
|
|
492
491
|
)
|
|
493
|
-
), this.renderSearchBar(
|
|
494
|
-
g && /* @__PURE__ */ f.createElement(
|
|
495
|
-
this.props.suffix && /* @__PURE__ */ f.createElement(
|
|
496
|
-
|
|
492
|
+
), this.renderSearchBar(_)),
|
|
493
|
+
g && /* @__PURE__ */ f.createElement(R, { className: "k-input-loading-icon", name: "loading" }),
|
|
494
|
+
this.props.suffix && /* @__PURE__ */ f.createElement(j, { ...J }),
|
|
495
|
+
G && /* @__PURE__ */ f.createElement(ut, { onClick: this.clearButtonClick }),
|
|
497
496
|
!this.mobileMode && this.renderListContainer()
|
|
498
497
|
), this.mobileMode && this.renderAdaptiveListContainer());
|
|
499
|
-
return
|
|
500
|
-
|
|
498
|
+
return t ? /* @__PURE__ */ f.createElement(
|
|
499
|
+
ot,
|
|
501
500
|
{
|
|
502
|
-
label:
|
|
503
|
-
editorId:
|
|
504
|
-
editorValue:
|
|
505
|
-
editorValid:
|
|
506
|
-
editorDisabled:
|
|
501
|
+
label: t,
|
|
502
|
+
editorId: _,
|
|
503
|
+
editorValue: p || O(this.value[0], a),
|
|
504
|
+
editorValid: K,
|
|
505
|
+
editorDisabled: s,
|
|
507
506
|
style: { width: n ? n.width : void 0 },
|
|
508
|
-
children:
|
|
507
|
+
children: N
|
|
509
508
|
}
|
|
510
|
-
) :
|
|
509
|
+
) : N;
|
|
511
510
|
}
|
|
512
511
|
renderSearchBar(n) {
|
|
513
|
-
const { activedescendant:
|
|
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}`;
|
|
514
513
|
return /* @__PURE__ */ f.createElement(
|
|
515
|
-
|
|
514
|
+
rt,
|
|
516
515
|
{
|
|
517
516
|
id: n,
|
|
518
|
-
size: Math.max((i || "").length,
|
|
517
|
+
size: Math.max((i || "").length, c.length, 1),
|
|
519
518
|
tabIndex: this.props.tabIndex,
|
|
520
519
|
accessKey: this.props.accessKey,
|
|
521
520
|
placeholder: this.mobileMode && this.opened ? l : i,
|
|
522
|
-
value:
|
|
521
|
+
value: c,
|
|
523
522
|
onChange: this.onChangeHandler,
|
|
524
523
|
onKeyDown: this.onInputKeyDown,
|
|
525
524
|
ref: this.searchbarRef,
|
|
526
|
-
disabled:
|
|
525
|
+
disabled: s,
|
|
527
526
|
expanded: this.opened,
|
|
528
527
|
owns: this.base.listBoxId,
|
|
529
528
|
role: "combobox",
|
|
530
529
|
activedescendant: g,
|
|
531
|
-
ariaDescribedBy: `tagslist-${this.base.guid}${
|
|
530
|
+
ariaDescribedBy: `tagslist-${this.base.guid}${h ? " " + h : ""}`,
|
|
532
531
|
ariaLabelledBy: this.props.ariaLabelledBy,
|
|
533
532
|
ariaRequired: this.required
|
|
534
533
|
}
|
|
535
534
|
);
|
|
536
535
|
}
|
|
537
|
-
onTagsNavigate(n,
|
|
538
|
-
const
|
|
539
|
-
let
|
|
540
|
-
const
|
|
541
|
-
if (
|
|
542
|
-
|
|
543
|
-
else if (
|
|
544
|
-
|
|
545
|
-
else if (
|
|
546
|
-
|
|
547
|
-
else if (
|
|
548
|
-
|
|
549
|
-
else if (
|
|
550
|
-
if (
|
|
536
|
+
onTagsNavigate(n, e) {
|
|
537
|
+
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;
|
|
540
|
+
if (t === u.left)
|
|
541
|
+
d ? h = Math.max(0, h - 1) : h = s.length - 1, c = s[h];
|
|
542
|
+
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]);
|
|
544
|
+
else if (t === u.home && !n.shiftKey)
|
|
545
|
+
c = s[0];
|
|
546
|
+
else if (t === u.end && !n.shiftKey)
|
|
547
|
+
c = s[s.length - 1];
|
|
548
|
+
else if (t === u.delete) {
|
|
549
|
+
if (d) {
|
|
551
550
|
const i = this.value;
|
|
552
|
-
|
|
551
|
+
w(i, s[h].data, a), this.triggerOnChange(i, e);
|
|
553
552
|
}
|
|
554
|
-
} else if (
|
|
553
|
+
} else if (t === u.backspace) {
|
|
555
554
|
const i = this.value;
|
|
556
|
-
if (
|
|
557
|
-
|
|
558
|
-
else if (!
|
|
559
|
-
const l =
|
|
560
|
-
|
|
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);
|
|
561
560
|
}
|
|
562
561
|
}
|
|
563
|
-
|
|
562
|
+
c !== o && (e.data.focusedTag = c, e.data.activedescendant = k.TagsList), this.applyState(e);
|
|
564
563
|
}
|
|
565
|
-
triggerOnChange(n,
|
|
566
|
-
this.props.value === void 0 && (
|
|
564
|
+
triggerOnChange(n, e) {
|
|
565
|
+
this.props.value === void 0 && (e.data.value = [...n]), this._valueItemsDuringOnChange = [], this.setItems(n, this._valueItemsDuringOnChange), e.events.push({ type: "onChange" });
|
|
567
566
|
}
|
|
568
|
-
selectFocusedItem(n,
|
|
569
|
-
const {
|
|
570
|
-
|
|
567
|
+
selectFocusedItem(n, e) {
|
|
568
|
+
const { virtual: t } = this.props, o = I(this.props), { focusedIndex: s } = e || this.getFocusedState(), a = t ? t.skip : 0;
|
|
569
|
+
o[s - a] !== void 0 && this.handleItemClick(s, n);
|
|
571
570
|
}
|
|
572
|
-
setItems(n,
|
|
573
|
-
|
|
571
|
+
setItems(n, e) {
|
|
572
|
+
e.length = 0, e.push(...n);
|
|
574
573
|
}
|
|
575
574
|
getFocusedState() {
|
|
576
|
-
const { focusedIndex: n } = this.state,
|
|
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;
|
|
577
576
|
let l;
|
|
578
577
|
if (n !== void 0)
|
|
579
578
|
return {
|
|
580
579
|
focusedIndex: n,
|
|
581
|
-
focusedItem:
|
|
580
|
+
focusedItem: d[n - i],
|
|
582
581
|
focusedType: 1
|
|
583
582
|
/* ListItem */
|
|
584
583
|
};
|
|
585
584
|
const g = this.value;
|
|
586
|
-
if (
|
|
585
|
+
if (t && e)
|
|
587
586
|
return {
|
|
588
587
|
focusedItem: null,
|
|
589
588
|
focusedIndex: -1,
|
|
590
589
|
focusedType: 2
|
|
591
590
|
/* CustomItem */
|
|
592
591
|
};
|
|
593
|
-
if (
|
|
594
|
-
return l =
|
|
595
|
-
focusedItem:
|
|
592
|
+
if (e)
|
|
593
|
+
return l = h(d, e, a), {
|
|
594
|
+
focusedItem: d[l],
|
|
596
595
|
focusedIndex: l + i,
|
|
597
596
|
focusedType: 1
|
|
598
597
|
/* ListItem */
|
|
599
598
|
};
|
|
600
599
|
if (g.length) {
|
|
601
|
-
const
|
|
602
|
-
return l =
|
|
600
|
+
const r = g[g.length - 1];
|
|
601
|
+
return l = d.findIndex((p) => E(p, r, o)), d[l] !== void 0 ? {
|
|
603
602
|
focusedIndex: l + i,
|
|
604
|
-
focusedItem:
|
|
603
|
+
focusedItem: d[l],
|
|
605
604
|
focusedType: 1
|
|
606
605
|
/* ListItem */
|
|
607
606
|
} : { focusedType: 0, focusedIndex: -1 };
|
|
608
|
-
} else if (
|
|
609
|
-
const
|
|
607
|
+
} else if (c && a && !e && i === 0) {
|
|
608
|
+
const r = d.findIndex((p) => !p.disabled && p[a]);
|
|
610
609
|
return {
|
|
611
|
-
focusedIndex:
|
|
612
|
-
focusedItem:
|
|
610
|
+
focusedIndex: r,
|
|
611
|
+
focusedItem: d[r - i],
|
|
613
612
|
focusedType: 1
|
|
614
613
|
/* ListItem */
|
|
615
614
|
};
|
|
616
615
|
}
|
|
617
616
|
return i === 0 ? {
|
|
618
|
-
focusedItem:
|
|
617
|
+
focusedItem: d[0],
|
|
619
618
|
focusedIndex: 0,
|
|
620
619
|
focusedType: 1
|
|
621
620
|
/* ListItem */
|
|
@@ -628,8 +627,8 @@ const { sizeMap: w, roundedMap: Ie } = te, ye = "Please enter a valid value!", A
|
|
|
628
627
|
this.base.applyState(n), this._valueItemsDuringOnChange = null;
|
|
629
628
|
}
|
|
630
629
|
calculateMedia(n) {
|
|
631
|
-
for (const
|
|
632
|
-
this.setState({ windowWidth:
|
|
630
|
+
for (const e of n)
|
|
631
|
+
this.setState({ windowWidth: e.target.clientWidth });
|
|
633
632
|
}
|
|
634
633
|
/**
|
|
635
634
|
* Updates the state of the MultiSelect when the complex keyboard navigation that
|
|
@@ -638,20 +637,20 @@ const { sizeMap: w, roundedMap: Ie } = te, ye = "Please enter a valid value!", A
|
|
|
638
637
|
* @param {Array<string | Object>} dataToSet Defines the array of new values that will be applied to the MultiSelect
|
|
639
638
|
* @param {MultiSelectInternalState} state The current state of the MultiSelect
|
|
640
639
|
*/
|
|
641
|
-
updateStateOnKeyboardNavigation(n,
|
|
642
|
-
this.setState({ value: n }), this.triggerOnChange(n,
|
|
640
|
+
updateStateOnKeyboardNavigation(n, e) {
|
|
641
|
+
this.setState({ value: n }), this.triggerOnChange(n, e), this.applyState(e);
|
|
643
642
|
}
|
|
644
643
|
/**
|
|
645
644
|
* Returns the last element that was selected or deselected. Needed for the keyboard navigation specifications
|
|
646
645
|
*
|
|
647
646
|
* @param {number} correction A correction is needed depending on if UP or DOWN key is pressed
|
|
648
647
|
*/
|
|
649
|
-
getLastSelectedOrDeselectedIndex(n,
|
|
650
|
-
return this._lastSelectedOrDeslectedItemIndex === null && (this._lastSelectedOrDeslectedItemIndex =
|
|
648
|
+
getLastSelectedOrDeselectedIndex(n, e) {
|
|
649
|
+
return this._lastSelectedOrDeslectedItemIndex === null && (this._lastSelectedOrDeslectedItemIndex = e), this._lastSelectedOrDeslectedItemIndex !== null ? this._lastSelectedOrDeslectedItemIndex + n : null;
|
|
651
650
|
}
|
|
652
651
|
};
|
|
653
|
-
|
|
654
|
-
...
|
|
652
|
+
b.displayName = "MultiSelect", b.propTypes = {
|
|
653
|
+
...F.propTypes,
|
|
655
654
|
autoClose: m.bool,
|
|
656
655
|
value: m.arrayOf(m.any),
|
|
657
656
|
defaultValue: m.arrayOf(m.any),
|
|
@@ -671,8 +670,8 @@ y.displayName = "MultiSelect", y.propTypes = {
|
|
|
671
670
|
adaptiveTitle: m.string,
|
|
672
671
|
onCancel: m.func,
|
|
673
672
|
skipDisabledItems: m.bool
|
|
674
|
-
},
|
|
675
|
-
...
|
|
673
|
+
}, b.defaultProps = {
|
|
674
|
+
...F.defaultProps,
|
|
676
675
|
autoClose: !0,
|
|
677
676
|
required: !1,
|
|
678
677
|
size: "medium",
|
|
@@ -683,11 +682,11 @@ y.displayName = "MultiSelect", y.propTypes = {
|
|
|
683
682
|
prefix: void 0,
|
|
684
683
|
suffix: void 0
|
|
685
684
|
};
|
|
686
|
-
let
|
|
687
|
-
const
|
|
688
|
-
|
|
685
|
+
let P = b;
|
|
686
|
+
const xt = Z(), St = tt(et(xt, P));
|
|
687
|
+
St.displayName = "KendoReactMultiSelect";
|
|
689
688
|
export {
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
689
|
+
St as MultiSelect,
|
|
690
|
+
xt as MultiSelectPropsContext,
|
|
691
|
+
P as MultiSelectWithoutContext
|
|
693
692
|
};
|