@progress/kendo-react-dropdowns 11.0.0-develop.3 → 11.0.0-develop.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AutoComplete/AutoComplete.js +1 -1
- package/AutoComplete/AutoComplete.mjs +139 -136
- package/ComboBox/ComboBox.js +1 -1
- package/ComboBox/ComboBox.mjs +425 -461
- package/DropDownList/DropDownList.js +1 -1
- package/DropDownList/DropDownList.mjs +420 -442
- package/DropDownTree/DropDownTree.js +1 -1
- package/DropDownTree/DropDownTree.mjs +158 -155
- package/MultiColumnComboBox/MultiColumnComboBox.js +1 -1
- package/MultiColumnComboBox/MultiColumnComboBox.mjs +25 -24
- package/MultiSelect/MultiSelect.js +1 -1
- package/MultiSelect/MultiSelect.mjs +173 -181
- package/MultiSelectTree/MultiSelectTree.js +1 -1
- package/MultiSelectTree/MultiSelectTree.mjs +264 -269
- package/common/AdaptiveMode.js +1 -1
- package/common/AdaptiveMode.mjs +14 -13
- package/common/ListFilter.js +1 -1
- package/common/ListFilter.mjs +22 -20
- package/dist/cdn/js/kendo-react-dropdowns.js +1 -1
- package/index.d.mts +101 -15
- package/index.d.ts +101 -15
- package/messages/index.js +1 -1
- package/messages/index.mjs +16 -14
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +10 -10
package/ComboBox/ComboBox.mjs
CHANGED
|
@@ -5,189 +5,228 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import * as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import { FloatingLabel as
|
|
13
|
-
import { getPlainDataDuplicates as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { packageMetadata as
|
|
20
|
-
import
|
|
21
|
-
import { Button as
|
|
22
|
-
import { caretAltDownIcon as
|
|
23
|
-
import { comboArrowBtnAriaLabelExpand as
|
|
24
|
-
import { provideLocalizationService as
|
|
25
|
-
import {
|
|
26
|
-
import
|
|
27
|
-
|
|
8
|
+
import * as g from "react";
|
|
9
|
+
import m from "prop-types";
|
|
10
|
+
import _ from "../common/DropDownBase.mjs";
|
|
11
|
+
import { classNames as S, uComboBox as k, Keys as y, validatePackage as tt, svgIconPropType as et, canUseDOM as R, IconWrap as st, WatermarkOverlay as it, createPropsContext as ot, withIdHOC as at, withPropsContext as nt, withUnstyledHOC as lt, withAdaptiveModeContext as rt } from "@progress/kendo-react-common";
|
|
12
|
+
import { FloatingLabel as pt } from "@progress/kendo-react-labels";
|
|
13
|
+
import { getPlainDataDuplicates as dt, getFilteredData as C, areSame as F, getItemValue as D, isPresent as w, getItemIndexByText as A, suggestValue as ht, itemIndexStartsWith as z } from "../common/utils.mjs";
|
|
14
|
+
import ut from "../common/SearchBar.mjs";
|
|
15
|
+
import ct from "../common/ListContainer.mjs";
|
|
16
|
+
import gt from "../common/List.mjs";
|
|
17
|
+
import mt from "../common/ListFilter.mjs";
|
|
18
|
+
import K from "../common/GroupStickyHeader.mjs";
|
|
19
|
+
import { packageMetadata as vt } from "../package-metadata.mjs";
|
|
20
|
+
import ft from "../common/ClearButton.mjs";
|
|
21
|
+
import { Button as bt } from "@progress/kendo-react-buttons";
|
|
22
|
+
import { caretAltDownIcon as xt } from "@progress/kendo-svg-icons";
|
|
23
|
+
import { comboArrowBtnAriaLabelExpand as H, messages as W, comboArrowBtnAriaLabelCollapse as q } from "../messages/index.mjs";
|
|
24
|
+
import { provideLocalizationService as G } from "@progress/kendo-react-intl";
|
|
25
|
+
import { ActionSheetContent as It } from "@progress/kendo-react-layout";
|
|
26
|
+
import U from "../common/withCustomComponent.mjs";
|
|
27
|
+
import { AdaptiveMode as yt } from "../common/AdaptiveMode.mjs";
|
|
28
|
+
const Ct = "Please enter a valid value!", M = class M extends g.Component {
|
|
28
29
|
constructor(s) {
|
|
29
|
-
super(s), this.state = {}, this.base = new
|
|
30
|
+
super(s), this.state = {}, this.base = new _(this), this._element = null, this._suggested = "", this._skipBlur = !1, this._input = null, this._adaptiveFilterInput = null, this._skipFocus = !1, this.itemHeight = 0, this.duplicates = [], this.hasDuplicates = !1, this.showLicenseWatermark = !1, this.focus = () => {
|
|
30
31
|
this._input && this._input.focus();
|
|
31
32
|
}, this.checkForDuplicatePlainTextRecords = () => {
|
|
32
|
-
const
|
|
33
|
-
if (this.props.data && this.props.data.length > 0 && !
|
|
33
|
+
const t = this.props.textField !== void 0, e = this.props.dataItemKey !== void 0;
|
|
34
|
+
if (this.props.data && this.props.data.length > 0 && !t && !e) {
|
|
34
35
|
const i = this.props.data;
|
|
35
|
-
this.duplicates =
|
|
36
|
+
this.duplicates = dt(i), this.hasDuplicates = this.duplicates.length > 0;
|
|
36
37
|
}
|
|
37
|
-
}, this.handleItemSelect = (
|
|
38
|
-
const { virtual: i, dataItemKey:
|
|
39
|
-
this.triggerOnChange(
|
|
38
|
+
}, this.handleItemSelect = (t, e) => {
|
|
39
|
+
const { virtual: i, dataItemKey: r } = this.props, l = C(this.props), a = i ? i.skip : 0, p = l[t - a], n = this.hasDuplicates || !F(p, this.value, r);
|
|
40
|
+
this.triggerOnChange(p, e), this.state.text !== void 0 && (e.data.text = void 0), n && this.base.triggerPageChangeCornerItems(p, e);
|
|
40
41
|
}, this.onPopupOpened = () => {
|
|
41
42
|
setTimeout(() => {
|
|
42
43
|
this.mobileMode && this._adaptiveFilterInput && (this._skipBlur = !0, this._adaptiveFilterInput.focus(), this._skipBlur = !1);
|
|
43
44
|
}, 300);
|
|
44
|
-
}, this.componentRef = (
|
|
45
|
-
this._element =
|
|
46
|
-
}, this.toggleBtnClick = (
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
}, this.componentRef = (t) => {
|
|
46
|
+
this._element = t, this.base.wrapper = t;
|
|
47
|
+
}, this.toggleBtnClick = (t) => {
|
|
48
|
+
this._skipFocus = !0;
|
|
49
|
+
const { skipDisabledItems: e, textField: i } = this.props, r = C(this.props), l = this.getFocusedIndex(), a = this.getCurrentValueDisabledStatus(i, r, l), p = this.props.opened !== void 0 ? this.props.opened : this.state.opened, n = this.base.initState();
|
|
50
|
+
if (n.syntheticEvent = t, !e && i && a && this.clearValueOnToggleBtnClick(t), this.base.togglePopup(n), !p && this.mobileMode) {
|
|
49
51
|
const o = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text || null;
|
|
50
|
-
this.base.filterChanged(o,
|
|
52
|
+
this.base.filterChanged(o, n);
|
|
51
53
|
}
|
|
52
|
-
this.applyState(
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
this.applyState(n), setTimeout(() => {
|
|
55
|
+
this._skipFocus = !1;
|
|
56
|
+
}, 300);
|
|
57
|
+
}, this.closeOpenedApplyStateNonMobileMode = (t, e) => {
|
|
58
|
+
e && !this.mobileMode && this.base.togglePopup(t);
|
|
55
59
|
}, this.renderMobileListFilter = () => {
|
|
56
|
-
const
|
|
57
|
-
return /* @__PURE__ */
|
|
58
|
-
|
|
60
|
+
const t = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text, e = D(this.value, this.props.textField), i = w(t) ? t : e;
|
|
61
|
+
return /* @__PURE__ */ g.createElement(
|
|
62
|
+
mt,
|
|
59
63
|
{
|
|
60
64
|
value: i,
|
|
61
|
-
ref: (
|
|
62
|
-
this._adaptiveFilterInput =
|
|
65
|
+
ref: (r) => {
|
|
66
|
+
this._adaptiveFilterInput = r && r.element;
|
|
63
67
|
},
|
|
64
68
|
onChange: this.handleMobileFilterChange,
|
|
65
69
|
onKeyDown: this.onInputKeyDown,
|
|
66
70
|
size: "large",
|
|
67
71
|
rounded: this.props.rounded,
|
|
68
|
-
fillMode: this.props.fillMode
|
|
72
|
+
fillMode: this.props.fillMode,
|
|
73
|
+
placeholder: this.props.placeholder
|
|
69
74
|
}
|
|
70
75
|
);
|
|
71
|
-
}, this.
|
|
72
|
-
const t = this.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
}, this.listContainerContent = () => {
|
|
77
|
+
const { header: t, footer: e, size: i, groupStickyHeaderItemRender: r, groupField: l, list: a, groupMode: p, unstyled: n, virtual: o } = this.props, h = C(this.props), d = n && n.uComboBox;
|
|
78
|
+
let { group: v } = this.state;
|
|
79
|
+
return v === void 0 && l !== void 0 && (v = D(h[0], l)), /* @__PURE__ */ g.createElement(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
className: S(
|
|
83
|
+
k.list({
|
|
84
|
+
c: d,
|
|
85
|
+
list: a,
|
|
86
|
+
size: "large",
|
|
87
|
+
tableSize: i,
|
|
88
|
+
virtual: o
|
|
89
|
+
})
|
|
90
|
+
)
|
|
91
|
+
},
|
|
92
|
+
t && /* @__PURE__ */ g.createElement("div", { className: S(k.listHeader({ c: d })) }, t),
|
|
93
|
+
!a && v && h.length !== 0 && /* @__PURE__ */ g.createElement(K, { group: v, groupMode: p, render: r }),
|
|
94
|
+
this.renderList(),
|
|
95
|
+
e && /* @__PURE__ */ g.createElement(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
className: S(k.listFooter({ c: d }), this.props.footerClassName)
|
|
99
|
+
},
|
|
100
|
+
e
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
}, this.handleMobileFilterChange = (t) => {
|
|
104
|
+
const e = this.base.initState();
|
|
105
|
+
e.syntheticEvent = t.syntheticEvent, e.data.text = t.target.value, this.base.filterChanged(t.target.value, e), this.applyState(e);
|
|
106
|
+
}, this.onScroll = (t) => {
|
|
107
|
+
const { vs: e, list: i } = this.base;
|
|
108
|
+
e.scrollHandler(t);
|
|
109
|
+
const { groupField: r } = this.props;
|
|
110
|
+
let l = C(this.props);
|
|
111
|
+
if (!r || !l.length)
|
|
80
112
|
return;
|
|
81
|
-
const a = this.itemHeight = this.itemHeight || (
|
|
82
|
-
this.props.groupMode === "modern" && (
|
|
83
|
-
let o =
|
|
84
|
-
for (let
|
|
85
|
-
|
|
113
|
+
const a = this.itemHeight = this.itemHeight || (e.enabled ? e.itemHeight : i ? i.children[0].offsetHeight : 0), n = t.target.scrollTop - e.skip * a;
|
|
114
|
+
this.props.groupMode === "modern" && (l = this.base.getGroupedDataModernMode(l, r));
|
|
115
|
+
let o = l[0][r];
|
|
116
|
+
for (let h = 1; h < l.length && !(a * h > n); h++)
|
|
117
|
+
l[h] && l[h][r] && (o = l[h][r]);
|
|
86
118
|
o !== this.state.group && (this.setState({
|
|
87
119
|
group: o
|
|
88
120
|
}), this.props.onGroupScroll && this.props.onGroupScroll.call(void 0, { group: o }));
|
|
89
|
-
}, this.handleItemClick = (
|
|
90
|
-
this.navigationIndex =
|
|
91
|
-
}, this.handleBlur = (
|
|
121
|
+
}, this.handleItemClick = (t, e) => {
|
|
122
|
+
this.navigationIndex = t, this.base.handleItemClick(t, e), this._valueDuringOnChange = void 0;
|
|
123
|
+
}, this.handleBlur = (t) => {
|
|
92
124
|
if (this.state.focused && !this._skipBlur) {
|
|
93
|
-
const
|
|
94
|
-
|
|
125
|
+
const e = this.base.initState(), { textField: i } = this.props, r = C(this.props), l = this.getFocusedIndex(), p = !(l === -1) && this.getCurrentValueDisabledStatus(i, r, l);
|
|
126
|
+
e.data.focused = !1, e.events.push({ type: "onBlur" }), e.syntheticEvent = t, i && p && this.clearValueOnBlur(t), this.applyValueOnRejectSuggestions(t.currentTarget.value, e);
|
|
95
127
|
}
|
|
96
|
-
}, this.onInputClick = (
|
|
97
|
-
const
|
|
98
|
-
if (!
|
|
99
|
-
const
|
|
100
|
-
|
|
128
|
+
}, this.onInputClick = (t) => {
|
|
129
|
+
const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened, i = this.props.adaptiveFilter !== void 0 ? this.props.adaptiveFilter : this.state.text || null;
|
|
130
|
+
if (!e && this.mobileMode) {
|
|
131
|
+
const r = this.base.initState();
|
|
132
|
+
r.syntheticEvent = t, this.base.togglePopup(r), this.base.filterChanged(i, r), this.applyState(r);
|
|
101
133
|
}
|
|
102
|
-
}, this.onInputKeyDown = (
|
|
103
|
-
const { skipDisabledItems:
|
|
134
|
+
}, this.onInputKeyDown = (t) => {
|
|
135
|
+
const { skipDisabledItems: e, textField: i, dataItemKey: r, groupField: l } = this.props, a = C(this.props), p = this.value, n = Math.max(
|
|
104
136
|
0,
|
|
105
|
-
a.findIndex((
|
|
106
|
-
), o =
|
|
107
|
-
if (
|
|
108
|
-
if (
|
|
109
|
-
if (!this.props.skipDisabledItems &&
|
|
110
|
-
this.onNavigate(
|
|
137
|
+
a.findIndex((u) => F(u, p, r))
|
|
138
|
+
), o = t.keyCode, h = this.props.opened !== void 0 ? this.props.opened : this.state.opened, d = this.base.initState();
|
|
139
|
+
if (d.syntheticEvent = t, !t.altKey && (o === y.up || o === y.down)) {
|
|
140
|
+
if (t.preventDefault(), l !== "" && i)
|
|
141
|
+
if (!this.props.skipDisabledItems && h)
|
|
142
|
+
this.onNavigate(d, o);
|
|
111
143
|
else {
|
|
112
|
-
let
|
|
113
|
-
if (o ===
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
} else if (o ===
|
|
117
|
-
let
|
|
118
|
-
if (
|
|
119
|
-
|
|
144
|
+
let u = 0;
|
|
145
|
+
if (o === y.down || o === y.right) {
|
|
146
|
+
const c = a.slice(n + 1 < a.length ? n + 1 : n).find((f) => !f.disabled && f[i]);
|
|
147
|
+
u = c && a.findIndex((f) => f[i] === c[i]);
|
|
148
|
+
} else if (o === y.up || o === y.left) {
|
|
149
|
+
let c;
|
|
150
|
+
if (n === 0)
|
|
151
|
+
c = a, u = a.findIndex((f) => !f.disabled && f[i]);
|
|
120
152
|
else {
|
|
121
|
-
|
|
122
|
-
let f =
|
|
153
|
+
c = a.slice(0, n);
|
|
154
|
+
let f = c.pop();
|
|
123
155
|
for (; f && f.disabled; )
|
|
124
|
-
f =
|
|
125
|
-
|
|
156
|
+
f = c.pop();
|
|
157
|
+
u = f && a.findIndex((E) => E[i] === f[i]);
|
|
126
158
|
}
|
|
127
159
|
}
|
|
128
|
-
if (
|
|
129
|
-
const
|
|
130
|
-
this.onNavigate(
|
|
131
|
-
} else
|
|
160
|
+
if (u !== void 0) {
|
|
161
|
+
const c = u - n;
|
|
162
|
+
this.onNavigate(d, o, c);
|
|
163
|
+
} else u === void 0 && a.findIndex((c) => c[i] === p[i]) === a.length - 1 && this.onNavigate(d, o);
|
|
132
164
|
}
|
|
133
|
-
else if (!this.props.skipDisabledItems &&
|
|
134
|
-
this.onNavigate(
|
|
165
|
+
else if (!this.props.skipDisabledItems && h)
|
|
166
|
+
this.onNavigate(d, o);
|
|
135
167
|
else {
|
|
136
|
-
let
|
|
137
|
-
if (o ===
|
|
138
|
-
|
|
139
|
-
else if (o ===
|
|
140
|
-
const
|
|
141
|
-
for (
|
|
142
|
-
|
|
168
|
+
let u = null;
|
|
169
|
+
if (o === y.down || o === y.right)
|
|
170
|
+
u = a.slice(n + 1).find((c) => !c.disabled);
|
|
171
|
+
else if (o === y.up || o === y.left) {
|
|
172
|
+
const c = a.slice(0, n);
|
|
173
|
+
for (u = c.pop(); u && u.disabled; )
|
|
174
|
+
u = c.pop();
|
|
143
175
|
}
|
|
144
|
-
if (
|
|
145
|
-
const
|
|
146
|
-
this.onNavigate(
|
|
176
|
+
if (u) {
|
|
177
|
+
const c = u.id - n - 1;
|
|
178
|
+
this.onNavigate(d, o, c);
|
|
147
179
|
} else
|
|
148
|
-
this.onNavigate(
|
|
180
|
+
this.onNavigate(d, o);
|
|
149
181
|
}
|
|
150
|
-
this.applyState(
|
|
182
|
+
this.applyState(d);
|
|
151
183
|
}
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
}, this.inputOnChange = (
|
|
157
|
-
const
|
|
158
|
-
|
|
159
|
-
const i = this.props.opened !== void 0 ? this.props.opened : this.state.opened,
|
|
184
|
+
const v = () => {
|
|
185
|
+
t.preventDefault(), this.base.togglePopup(d), this.applyState(d);
|
|
186
|
+
}, x = this.getFocusedIndex(), I = x === -1, b = !I && this.getCurrentValueDisabledStatus(i, a, x);
|
|
187
|
+
h ? o === y.pageUp ? (t.preventDefault(), this.base.scrollPopupByPageSize(-1)) : o === y.pageDown ? (t.preventDefault(), this.base.scrollPopupByPageSize(1)) : t.altKey && o === y.up ? v() : o === y.enter ? (t.preventDefault(), (i && !I && t.currentTarget.value ? a[x][i] : void 0) ? !e && i && b ? this.clearValueOnEnterOrEsc(t) : b || this.applyValueOnEnter(t.currentTarget.value, d) : this.applyValueOnEnter(t.currentTarget.value, d)) : o === y.esc && (!e && i && b && this.clearValueOnEnterOrEsc(t), this.applyValueOnRejectSuggestions(t.currentTarget.value, d)) : !h && o === y.esc ? this.clearValueOnEnterOrEsc(t) : t.altKey && o === y.down && v();
|
|
188
|
+
}, this.inputOnChange = (t) => {
|
|
189
|
+
const e = this.base.initState();
|
|
190
|
+
e.syntheticEvent = t;
|
|
191
|
+
const i = this.props.opened !== void 0 ? this.props.opened : this.state.opened, r = t.currentTarget, l = r.value;
|
|
160
192
|
if (this.props.suggest) {
|
|
161
|
-
const a =
|
|
162
|
-
let
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
193
|
+
const a = r.selectionEnd === l.length;
|
|
194
|
+
let p = this.props.filter !== void 0 ? this.props.filter : this.state.text;
|
|
195
|
+
w(p) || (p = D(this.value, this.props.textField) || "");
|
|
196
|
+
const n = p && p === l, o = p && p.length > l.length;
|
|
197
|
+
n || o || !a ? this._suggested = "" : this.suggestValue(l);
|
|
166
198
|
}
|
|
167
|
-
this.props.filter === void 0 && (
|
|
168
|
-
}, this.clearButtonClick = (
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
}, this.clearValueOnEnterOrEsc = (
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
}, this.clearValueOnBlur = (
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
}, this.clearValueOnToggleBtnClick = (
|
|
178
|
-
const
|
|
179
|
-
|
|
199
|
+
this.props.filter === void 0 && (e.data.text = l), this.state.focusedItem !== void 0 && (e.data.focusedItem = void 0), i || this.base.togglePopup(e), this.base.filterChanged(l, e), this.applyState(e), this.setState({ group: void 0 });
|
|
200
|
+
}, this.clearButtonClick = (t) => {
|
|
201
|
+
const e = this.base.initState();
|
|
202
|
+
e.syntheticEvent = t, t.stopPropagation(), this.clearValue();
|
|
203
|
+
}, this.clearValueOnEnterOrEsc = (t) => {
|
|
204
|
+
const e = this.base.initState();
|
|
205
|
+
e.syntheticEvent = t, t.stopPropagation(), this.clearValue();
|
|
206
|
+
}, this.clearValueOnBlur = (t) => {
|
|
207
|
+
const e = this.base.initState();
|
|
208
|
+
e.syntheticEvent = t, t.stopPropagation(), this.clearValue();
|
|
209
|
+
}, this.clearValueOnToggleBtnClick = (t) => {
|
|
210
|
+
const e = this.base.initState();
|
|
211
|
+
e.syntheticEvent = t, t.stopPropagation(), this.clearValue();
|
|
180
212
|
}, this.setValidity = () => {
|
|
181
213
|
this._input && this._input.setCustomValidity && this._input.setCustomValidity(
|
|
182
|
-
this.validity.valid ? "" : this.props.validationMessage ||
|
|
214
|
+
this.validity.valid ? "" : this.props.validationMessage || Ct
|
|
183
215
|
);
|
|
184
|
-
}, this.
|
|
216
|
+
}, this.handleFocus = (t) => {
|
|
217
|
+
if (this._skipFocus)
|
|
218
|
+
return;
|
|
219
|
+
const e = this.base.initState();
|
|
220
|
+
e.syntheticEvent = t, this.mobileMode && !this._skipFocus && (this._skipFocus = !0, this.base.togglePopup(e), this.applyState(e), setTimeout(() => {
|
|
221
|
+
this._skipFocus = !1;
|
|
222
|
+
}, 300)), this.base.handleFocus(t);
|
|
223
|
+
}, this.showLicenseWatermark = !tt(vt, { component: "ComboBox" });
|
|
185
224
|
}
|
|
186
225
|
get _inputId() {
|
|
187
226
|
return this.props.id;
|
|
188
227
|
}
|
|
189
228
|
get document() {
|
|
190
|
-
if (
|
|
229
|
+
if (R)
|
|
191
230
|
return this.element && this.element.ownerDocument || document;
|
|
192
231
|
}
|
|
193
232
|
/** @hidden */
|
|
@@ -198,8 +237,8 @@ const ke = "Please enter a valid value!", F = class F extends c.Component {
|
|
|
198
237
|
* The mobile mode of the ComboBox.
|
|
199
238
|
*/
|
|
200
239
|
get mobileMode() {
|
|
201
|
-
var
|
|
202
|
-
return !!(this.state.windowWidth && this.props._adaptiveMode && this.state.windowWidth <= ((
|
|
240
|
+
var t;
|
|
241
|
+
return !!(this.state.windowWidth && this.props._adaptiveMode && this.state.windowWidth <= ((t = this.props._adaptiveMode) == null ? void 0 : t.medium) && this.props.adaptive);
|
|
203
242
|
}
|
|
204
243
|
/**
|
|
205
244
|
* The value of the ComboBox.
|
|
@@ -218,8 +257,8 @@ const ke = "Please enter a valid value!", F = class F extends c.Component {
|
|
|
218
257
|
* The index of the selected item.
|
|
219
258
|
*/
|
|
220
259
|
get index() {
|
|
221
|
-
const { dataItemKey: s } = this.props,
|
|
222
|
-
return
|
|
260
|
+
const { dataItemKey: s } = this.props, t = C(this.props), e = this.value;
|
|
261
|
+
return t.findIndex((i) => F(i, e, s));
|
|
223
262
|
}
|
|
224
263
|
/**
|
|
225
264
|
* Gets the `name` property of the ComboBox.
|
|
@@ -231,41 +270,41 @@ const ke = "Please enter a valid value!", F = class F extends c.Component {
|
|
|
231
270
|
* Represents the validity state into which the component is set.
|
|
232
271
|
*/
|
|
233
272
|
get validity() {
|
|
234
|
-
const s = this.props.validationMessage !== void 0,
|
|
273
|
+
const s = this.props.validationMessage !== void 0, t = !this.required || this.value !== null && this.value !== "" && this.value !== void 0, e = this.props.valid !== void 0 ? this.props.valid : t;
|
|
235
274
|
return {
|
|
236
275
|
customError: s,
|
|
237
|
-
valid:
|
|
276
|
+
valid: e,
|
|
238
277
|
valueMissing: this.value === null
|
|
239
278
|
};
|
|
240
279
|
}
|
|
241
280
|
get validityStyles() {
|
|
242
|
-
return this.props.validityStyles !== void 0 ? this.props.validityStyles :
|
|
281
|
+
return this.props.validityStyles !== void 0 ? this.props.validityStyles : M.defaultProps.validityStyles;
|
|
243
282
|
}
|
|
244
283
|
/** @hidden */
|
|
245
284
|
get required() {
|
|
246
|
-
return this.props.required !== void 0 ? this.props.required :
|
|
285
|
+
return this.props.required !== void 0 ? this.props.required : M.defaultProps.required;
|
|
247
286
|
}
|
|
248
287
|
/** @hidden */
|
|
249
|
-
componentDidUpdate(s,
|
|
250
|
-
var
|
|
251
|
-
const { dataItemKey:
|
|
288
|
+
componentDidUpdate(s, t) {
|
|
289
|
+
var v;
|
|
290
|
+
const { dataItemKey: e, virtual: i, groupField: r = "", textField: l } = this.props, a = C(this.props), p = s.virtual ? s.virtual.total : 0, n = this.props.opened !== void 0 ? this.props.opened : this.state.opened, o = s.opened !== void 0 ? s.opened : t.opened;
|
|
252
291
|
s.data !== a && this.checkForDuplicatePlainTextRecords();
|
|
253
|
-
const
|
|
254
|
-
if (this._valueOnDidUpdate =
|
|
292
|
+
const h = !o && n, d = this.value;
|
|
293
|
+
if (this._valueOnDidUpdate = d, this.base.didUpdate(), i && i.total !== p)
|
|
255
294
|
this.base.vs.calcScrollElementHeight(), this.base.vs.reset();
|
|
256
295
|
else {
|
|
257
|
-
const
|
|
258
|
-
let
|
|
259
|
-
this.props.groupMode === "modern" &&
|
|
260
|
-
const
|
|
261
|
-
|
|
296
|
+
const x = s.value !== void 0 ? s.value : t.value;
|
|
297
|
+
let I = this.hasDuplicates ? this.navigationIndex || 0 : a.findIndex((u) => F(u, d, e));
|
|
298
|
+
this.props.groupMode === "modern" && l && d && (I = (v = this.base.getGroupedDataModernMode(a, r)) == null ? void 0 : v.map((u) => u[l]).indexOf(d[l]));
|
|
299
|
+
const b = !F(x, d, e);
|
|
300
|
+
h && i ? this.base.scrollToVirtualItem(i, I) : h && !i ? (this.onPopupOpened(), a && a.length !== 0 && this.base.resetGroupStickyHeader(a[0][r], this), this.base.scrollToItem(I)) : (this.hasDuplicates || n && o && d && b) && this.base.scrollToItem(I);
|
|
262
301
|
}
|
|
263
|
-
|
|
302
|
+
h && this._input && this._input.focus(), this.setValidity();
|
|
264
303
|
}
|
|
265
304
|
/** @hidden */
|
|
266
305
|
componentDidMount() {
|
|
267
306
|
var s;
|
|
268
|
-
this.observerResize =
|
|
307
|
+
this.observerResize = R && window.ResizeObserver && new window.ResizeObserver(this.calculateMedia.bind(this)), this.base.didMount(), this.setValidity(), (s = this.document) != null && s.body && this.observerResize && this.observerResize.observe(this.document.body), this.checkForDuplicatePlainTextRecords();
|
|
269
308
|
}
|
|
270
309
|
/** @hidden */
|
|
271
310
|
componentWillUnmount() {
|
|
@@ -274,461 +313,386 @@ const ke = "Please enter a valid value!", F = class F extends c.Component {
|
|
|
274
313
|
}
|
|
275
314
|
/** @hidden */
|
|
276
315
|
render() {
|
|
277
|
-
const s =
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
),
|
|
281
|
-
|
|
282
|
-
|
|
316
|
+
const s = G(this).toLanguageString(
|
|
317
|
+
H,
|
|
318
|
+
W[H]
|
|
319
|
+
), t = G(this).toLanguageString(
|
|
320
|
+
q,
|
|
321
|
+
W[q]
|
|
283
322
|
), {
|
|
284
|
-
dir:
|
|
323
|
+
dir: e,
|
|
285
324
|
disabled: i,
|
|
286
|
-
clearButton:
|
|
287
|
-
label:
|
|
325
|
+
clearButton: r = M.defaultProps.clearButton,
|
|
326
|
+
label: l,
|
|
288
327
|
textField: a,
|
|
289
|
-
className:
|
|
290
|
-
style:
|
|
328
|
+
className: p,
|
|
329
|
+
style: n,
|
|
291
330
|
loading: o,
|
|
292
|
-
iconClassName:
|
|
293
|
-
virtual:
|
|
294
|
-
size:
|
|
295
|
-
rounded:
|
|
296
|
-
fillMode:
|
|
297
|
-
opened:
|
|
298
|
-
placeholder:
|
|
299
|
-
svgIcon:
|
|
331
|
+
iconClassName: h,
|
|
332
|
+
virtual: d,
|
|
333
|
+
size: v,
|
|
334
|
+
rounded: x,
|
|
335
|
+
fillMode: I,
|
|
336
|
+
opened: b = this.state.opened,
|
|
337
|
+
placeholder: u,
|
|
338
|
+
svgIcon: c,
|
|
300
339
|
unstyled: f
|
|
301
|
-
} = this.props, E = !this.validityStyles || this.validity.valid, O = this.props.filter !== void 0 ? this.props.filter : this.state.text,
|
|
302
|
-
|
|
303
|
-
const [
|
|
340
|
+
} = this.props, E = !this.validityStyles || this.validity.valid, O = this.props.filter !== void 0 ? this.props.filter : this.state.text, j = D(this.value, a), V = w(O) ? O : j, $ = r && (!!V || w(this.value)), B = this.base.vs, L = this.props.id || this._inputId, T = f && f.uComboBox;
|
|
341
|
+
B.enabled = d !== void 0, d !== void 0 && (B.skip = d.skip, B.total = d.total, B.pageSize = d.pageSize);
|
|
342
|
+
const [Y, J] = U(this.props.prefix || g.Fragment), [Q, X] = U(this.props.suffix || g.Fragment), N = /* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement(
|
|
304
343
|
"span",
|
|
305
344
|
{
|
|
306
|
-
className:
|
|
307
|
-
|
|
308
|
-
c:
|
|
309
|
-
size:
|
|
310
|
-
rounded:
|
|
311
|
-
fillMode:
|
|
345
|
+
className: S(
|
|
346
|
+
k.wrapper({
|
|
347
|
+
c: T,
|
|
348
|
+
size: v,
|
|
349
|
+
rounded: x,
|
|
350
|
+
fillMode: I,
|
|
312
351
|
disabled: i,
|
|
313
352
|
invalid: !E,
|
|
314
353
|
loading: o,
|
|
315
354
|
required: this.required
|
|
316
355
|
}),
|
|
317
|
-
|
|
356
|
+
p
|
|
318
357
|
),
|
|
319
358
|
ref: this.componentRef,
|
|
320
|
-
style:
|
|
321
|
-
dir:
|
|
359
|
+
style: l ? { ...n, width: void 0 } : n,
|
|
360
|
+
dir: e,
|
|
361
|
+
onFocus: this.handleFocus
|
|
322
362
|
},
|
|
323
|
-
this.props.prefix && /* @__PURE__ */
|
|
324
|
-
this.renderSearchBar(
|
|
325
|
-
|
|
326
|
-
o && /* @__PURE__ */
|
|
327
|
-
|
|
363
|
+
this.props.prefix && /* @__PURE__ */ g.createElement(Y, { ...J }),
|
|
364
|
+
this.renderSearchBar(V || "", L, u),
|
|
365
|
+
$ && !o && /* @__PURE__ */ g.createElement(ft, { onClick: this.clearButtonClick, key: "clearbutton" }),
|
|
366
|
+
o && /* @__PURE__ */ g.createElement(
|
|
367
|
+
st,
|
|
328
368
|
{
|
|
329
|
-
className:
|
|
369
|
+
className: S(k.loadingIcon({ c: T })),
|
|
330
370
|
name: "loading",
|
|
331
371
|
key: "loading"
|
|
332
372
|
}
|
|
333
373
|
),
|
|
334
|
-
this.props.suffix && /* @__PURE__ */
|
|
335
|
-
/* @__PURE__ */
|
|
336
|
-
|
|
374
|
+
this.props.suffix && /* @__PURE__ */ g.createElement(Q, { ...X }),
|
|
375
|
+
/* @__PURE__ */ g.createElement(
|
|
376
|
+
bt,
|
|
337
377
|
{
|
|
338
378
|
tabIndex: -1,
|
|
339
379
|
type: "button",
|
|
340
|
-
"aria-label":
|
|
341
|
-
icon:
|
|
342
|
-
svgIcon:
|
|
343
|
-
iconClass:
|
|
344
|
-
size:
|
|
345
|
-
fillMode:
|
|
380
|
+
"aria-label": b ? t : s,
|
|
381
|
+
icon: h ? void 0 : "caret-alt-down",
|
|
382
|
+
svgIcon: c || xt,
|
|
383
|
+
iconClass: h,
|
|
384
|
+
size: v,
|
|
385
|
+
fillMode: I,
|
|
346
386
|
rounded: null,
|
|
347
387
|
themeColor: "base",
|
|
348
|
-
className:
|
|
388
|
+
className: S(k.inputButton({ c: T })),
|
|
349
389
|
onClick: this.toggleBtnClick,
|
|
350
|
-
onMouseDown: (
|
|
390
|
+
onMouseDown: (Z) => Z.preventDefault()
|
|
351
391
|
}
|
|
352
392
|
),
|
|
353
|
-
!
|
|
354
|
-
),
|
|
355
|
-
return
|
|
356
|
-
|
|
393
|
+
!this.mobileMode && this.renderListContainer()
|
|
394
|
+
), this.mobileMode && this.renderAdaptiveListContainer());
|
|
395
|
+
return l ? /* @__PURE__ */ g.createElement(
|
|
396
|
+
pt,
|
|
357
397
|
{
|
|
358
|
-
label:
|
|
359
|
-
editorId:
|
|
360
|
-
editorValue:
|
|
398
|
+
label: l,
|
|
399
|
+
editorId: L,
|
|
400
|
+
editorValue: V,
|
|
361
401
|
editorValid: E,
|
|
362
402
|
editorDisabled: i,
|
|
363
|
-
style: { width:
|
|
364
|
-
children:
|
|
403
|
+
style: { width: n ? n.width : void 0 },
|
|
404
|
+
children: N,
|
|
365
405
|
unstyled: f
|
|
366
406
|
}
|
|
367
|
-
) :
|
|
407
|
+
) : N;
|
|
368
408
|
}
|
|
369
409
|
/** @hidden */
|
|
370
|
-
onNavigate(s,
|
|
371
|
-
const { virtual: i = { skip: 0 } } = this.props,
|
|
372
|
-
let a = -1,
|
|
373
|
-
const
|
|
410
|
+
onNavigate(s, t, e) {
|
|
411
|
+
const { virtual: i = { skip: 0 } } = this.props, r = C(this.props), l = this.props.filter ? this.props.filter : this.state.text;
|
|
412
|
+
let a = -1, p;
|
|
413
|
+
const n = this.base.vs, o = this.value;
|
|
374
414
|
this._suggested = "";
|
|
375
|
-
const
|
|
376
|
-
if (a = this.getFocusedIndex(
|
|
415
|
+
const h = this.hasDuplicates && this.duplicates.indexOf(o) !== -1;
|
|
416
|
+
if (a = this.getFocusedIndex(h), a !== -1 && !w(o))
|
|
377
417
|
this.handleItemSelect(a, s);
|
|
378
|
-
else if (
|
|
418
|
+
else if (l === "")
|
|
379
419
|
this.handleItemSelect(0, s);
|
|
380
420
|
else {
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
keyCode:
|
|
384
|
-
current:
|
|
385
|
-
max: (
|
|
421
|
+
const d = i.skip + a;
|
|
422
|
+
p = this.base.navigation.navigate({
|
|
423
|
+
keyCode: t,
|
|
424
|
+
current: d,
|
|
425
|
+
max: (n.enabled ? n.total : r.length) - 1,
|
|
386
426
|
min: 0,
|
|
387
|
-
skipItems:
|
|
388
|
-
}),
|
|
427
|
+
skipItems: e || void 0
|
|
428
|
+
}), p !== void 0 && this.handleItemSelect(p, s);
|
|
389
429
|
}
|
|
390
|
-
this.navigationIndex =
|
|
430
|
+
this.navigationIndex = p;
|
|
391
431
|
}
|
|
392
|
-
getCurrentValueDisabledStatus(s,
|
|
393
|
-
return s &&
|
|
432
|
+
getCurrentValueDisabledStatus(s, t, e) {
|
|
433
|
+
return s && t && t[e] && t[e].disabled;
|
|
394
434
|
}
|
|
395
|
-
applyValueOnEnter(s,
|
|
396
|
-
const { textField:
|
|
435
|
+
applyValueOnEnter(s, t) {
|
|
436
|
+
const { textField: e, allowCustom: i } = this.props, r = C(this.props), l = this.props.opened !== void 0 ? this.props.opened : this.state.opened, p = D(this.value, e) === s ? this.index : A(r, s, e), n = p !== -1;
|
|
397
437
|
let o;
|
|
398
|
-
if (this._suggested = "",
|
|
399
|
-
o =
|
|
438
|
+
if (this._suggested = "", n)
|
|
439
|
+
o = r[p];
|
|
400
440
|
else if (i)
|
|
401
|
-
o =
|
|
441
|
+
o = e !== void 0 ? { [e]: s } : s;
|
|
402
442
|
else
|
|
403
|
-
return this.selectFocusedItem(s,
|
|
404
|
-
this.triggerOnChange(o,
|
|
443
|
+
return this.selectFocusedItem(s, t);
|
|
444
|
+
this.triggerOnChange(o, t), l && this.base.togglePopup(t), this.props.filter === void 0 && this.state.text !== void 0 && (t.data.text = void 0), this.applyState(t);
|
|
405
445
|
}
|
|
406
|
-
applyValueOnRejectSuggestions(s,
|
|
407
|
-
const { textField:
|
|
408
|
-
if (this._suggested = "", s === a || s === "" && !
|
|
409
|
-
return this.closeOpenedApplyStateNonMobileMode(
|
|
410
|
-
const
|
|
446
|
+
applyValueOnRejectSuggestions(s, t) {
|
|
447
|
+
const { textField: e, allowCustom: i } = this.props, r = C(this.props), l = this.props.opened !== void 0 ? this.props.opened : this.state.opened, a = D(this.value, e);
|
|
448
|
+
if (this._suggested = "", s === a || s === "" && !w(a))
|
|
449
|
+
return this.closeOpenedApplyStateNonMobileMode(t, l), this.applyState(t);
|
|
450
|
+
const p = A(r, s, e, !0), n = p !== -1;
|
|
411
451
|
let o = null;
|
|
412
|
-
|
|
452
|
+
n ? o = r[p] : i && (o = s ? e ? { [e]: s } : s : null), this.triggerOnChange(o, t), this.state.text !== void 0 && (t.data.text = void 0, this.base.filterChanged("", t)), this.closeOpenedApplyStateNonMobileMode(t, l), this.applyState(t);
|
|
413
453
|
}
|
|
414
|
-
selectFocusedItem(s,
|
|
415
|
-
const
|
|
416
|
-
return
|
|
454
|
+
selectFocusedItem(s, t) {
|
|
455
|
+
const e = this.props.opened !== void 0 ? this.props.opened : this.state.opened, { textField: i, virtual: r = { skip: 0 }, focusedItemIndex: l = z } = this.props, a = C(this.props), p = r.skip, n = s === "" && p === 0 ? 0 : l(a, s, i);
|
|
456
|
+
return n !== -1 ? this.handleItemSelect(n + p, t) : (this.triggerOnChange(null, t), this.state.text !== void 0 && (t.data.text = void 0)), e && this.base.togglePopup(t), this.applyState(t);
|
|
417
457
|
}
|
|
418
458
|
renderAdaptiveListContainer() {
|
|
419
|
-
const { windowWidth: s = 0 } = this.state, {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
unstyled: u,
|
|
430
|
-
_adaptiveMode: p
|
|
431
|
-
} = this.props, y = S(this.props), b = this.props.opened !== void 0 ? this.props.opened : this.state.opened, x = this.base.getAdaptiveAnimation(), m = u && u.uComboBox, h = u && u.uDropDownsActionSheet;
|
|
432
|
-
let { group: g } = this.state;
|
|
433
|
-
g === void 0 && n !== void 0 && (g = M(y[0], n));
|
|
434
|
-
const f = {
|
|
435
|
-
navigatable: !1,
|
|
436
|
-
navigatableElements: [],
|
|
437
|
-
expand: b,
|
|
438
|
-
animation: x,
|
|
439
|
-
onClose: (E) => this.toggleBtnClick(E),
|
|
440
|
-
className: I(
|
|
441
|
-
B.wrapper({
|
|
442
|
-
c: h
|
|
443
|
-
}),
|
|
444
|
-
"k-adaptive-actionsheet"
|
|
445
|
-
),
|
|
446
|
-
animationStyles: s && p && s <= p.small ? { top: 0, width: "100%", height: "100%" } : void 0,
|
|
447
|
-
position: s && p && s <= p.small ? "fullscreen" : void 0
|
|
459
|
+
const { windowWidth: s = 0 } = this.state, { groupField: t, adaptiveTitle: e = this.props.label, adaptiveSubtitle: i } = this.props, r = C(this.props), l = this.props.opened !== void 0 ? this.props.opened : this.state.opened;
|
|
460
|
+
let { group: a } = this.state;
|
|
461
|
+
a === void 0 && t !== void 0 && (a = D(r[0], t));
|
|
462
|
+
const p = {
|
|
463
|
+
title: e || this.props.label,
|
|
464
|
+
subTitle: i,
|
|
465
|
+
expand: l,
|
|
466
|
+
onClose: (n) => this.toggleBtnClick(n),
|
|
467
|
+
windowWidth: s,
|
|
468
|
+
mobileFilter: this.renderMobileListFilter()
|
|
448
469
|
};
|
|
449
|
-
return /* @__PURE__ */
|
|
450
|
-
q,
|
|
451
|
-
{
|
|
452
|
-
tabIndex: 0,
|
|
453
|
-
"aria-label": "Cancel",
|
|
454
|
-
"aria-disabled": "false",
|
|
455
|
-
type: "button",
|
|
456
|
-
fillMode: "flat",
|
|
457
|
-
themeColor: "base",
|
|
458
|
-
size: "large",
|
|
459
|
-
onClick: this.toggleBtnClick,
|
|
460
|
-
icon: "x",
|
|
461
|
-
svgIcon: Ce
|
|
462
|
-
}
|
|
463
|
-
))), /* @__PURE__ */ c.createElement("div", { className: I(B.titleBarGroup({ c: h })) }, this.renderMobileListFilter())), /* @__PURE__ */ c.createElement(De, null, /* @__PURE__ */ c.createElement(
|
|
464
|
-
"div",
|
|
465
|
-
{
|
|
466
|
-
className: I(
|
|
467
|
-
w.listContainer({
|
|
468
|
-
c: m
|
|
469
|
-
})
|
|
470
|
-
)
|
|
471
|
-
},
|
|
472
|
-
/* @__PURE__ */ c.createElement(
|
|
473
|
-
"div",
|
|
474
|
-
{
|
|
475
|
-
className: I(
|
|
476
|
-
w.list({
|
|
477
|
-
c: m,
|
|
478
|
-
list: a,
|
|
479
|
-
size: "large",
|
|
480
|
-
tableSize: i,
|
|
481
|
-
virtual: d
|
|
482
|
-
})
|
|
483
|
-
)
|
|
484
|
-
},
|
|
485
|
-
e && /* @__PURE__ */ c.createElement("div", { className: I(w.listHeader({ c: m })) }, e),
|
|
486
|
-
!a && g && y.length !== 0 && /* @__PURE__ */ c.createElement(
|
|
487
|
-
W,
|
|
488
|
-
{
|
|
489
|
-
group: g,
|
|
490
|
-
groupMode: r,
|
|
491
|
-
render: o
|
|
492
|
-
}
|
|
493
|
-
),
|
|
494
|
-
this.renderList(),
|
|
495
|
-
t && /* @__PURE__ */ c.createElement(
|
|
496
|
-
"div",
|
|
497
|
-
{
|
|
498
|
-
className: I(
|
|
499
|
-
w.listFooter({ c: m }),
|
|
500
|
-
this.props.footerClassName
|
|
501
|
-
)
|
|
502
|
-
},
|
|
503
|
-
t
|
|
504
|
-
)
|
|
505
|
-
)
|
|
506
|
-
)));
|
|
470
|
+
return /* @__PURE__ */ g.createElement(yt, { ...p }, /* @__PURE__ */ g.createElement(It, null, /* @__PURE__ */ g.createElement("div", { className: "k-list-container" }, this.listContainerContent())));
|
|
507
471
|
}
|
|
508
472
|
renderListContainer() {
|
|
509
473
|
const s = this.base, {
|
|
510
|
-
dir:
|
|
511
|
-
header:
|
|
474
|
+
dir: t,
|
|
475
|
+
header: e,
|
|
512
476
|
footer: i,
|
|
513
|
-
groupField:
|
|
514
|
-
groupMode:
|
|
477
|
+
groupField: r,
|
|
478
|
+
groupMode: l,
|
|
515
479
|
size: a,
|
|
516
|
-
list:
|
|
517
|
-
virtual:
|
|
480
|
+
list: p,
|
|
481
|
+
virtual: n,
|
|
518
482
|
groupStickyHeaderItemRender: o,
|
|
519
|
-
unstyled:
|
|
520
|
-
} = this.props,
|
|
521
|
-
let { group:
|
|
522
|
-
return
|
|
523
|
-
|
|
483
|
+
unstyled: h
|
|
484
|
+
} = this.props, d = C(this.props), v = this.props.opened !== void 0 ? this.props.opened : this.state.opened, x = s.getPopupSettings(), I = x.width !== void 0 ? x.width : s.popupWidth, b = h && h.uComboBox;
|
|
485
|
+
let { group: u } = this.state;
|
|
486
|
+
return u === void 0 && r !== void 0 && (u = D(d[0], r)), /* @__PURE__ */ g.createElement(
|
|
487
|
+
ct,
|
|
524
488
|
{
|
|
525
|
-
width:
|
|
489
|
+
width: I,
|
|
526
490
|
popupSettings: {
|
|
527
|
-
...
|
|
528
|
-
anchor:
|
|
529
|
-
show:
|
|
530
|
-
popupClass:
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
c:
|
|
491
|
+
...x,
|
|
492
|
+
anchor: x.anchor || this.element,
|
|
493
|
+
show: v,
|
|
494
|
+
popupClass: S(
|
|
495
|
+
x.popupClass,
|
|
496
|
+
k.listContainer({
|
|
497
|
+
c: b,
|
|
534
498
|
popup: !0
|
|
535
499
|
})
|
|
536
500
|
)
|
|
537
501
|
},
|
|
538
|
-
dir:
|
|
539
|
-
itemsCount: [
|
|
502
|
+
dir: t !== void 0 ? t : this.base.dirCalculated,
|
|
503
|
+
itemsCount: [d.length]
|
|
540
504
|
},
|
|
541
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ g.createElement(
|
|
542
506
|
"div",
|
|
543
507
|
{
|
|
544
|
-
className:
|
|
545
|
-
|
|
546
|
-
c:
|
|
547
|
-
list:
|
|
508
|
+
className: S(
|
|
509
|
+
k.list({
|
|
510
|
+
c: b,
|
|
511
|
+
list: p,
|
|
548
512
|
size: a,
|
|
549
513
|
tableSize: a,
|
|
550
|
-
virtual:
|
|
514
|
+
virtual: n
|
|
551
515
|
})
|
|
552
516
|
)
|
|
553
517
|
},
|
|
554
|
-
|
|
555
|
-
!
|
|
518
|
+
e && /* @__PURE__ */ g.createElement("div", { className: S(k.listHeader({ c: b })) }, e),
|
|
519
|
+
!p && u && d.length !== 0 && /* @__PURE__ */ g.createElement(K, { group: u, groupMode: l, render: o }),
|
|
556
520
|
this.renderList(),
|
|
557
|
-
i && /* @__PURE__ */
|
|
521
|
+
i && /* @__PURE__ */ g.createElement(
|
|
558
522
|
"div",
|
|
559
523
|
{
|
|
560
|
-
className:
|
|
561
|
-
|
|
524
|
+
className: S(
|
|
525
|
+
k.listFooter({ c: b }),
|
|
562
526
|
this.props.footerClassName
|
|
563
527
|
)
|
|
564
528
|
},
|
|
565
529
|
i
|
|
566
530
|
)
|
|
567
531
|
),
|
|
568
|
-
this.showLicenseWatermark && /* @__PURE__ */
|
|
532
|
+
this.showLicenseWatermark && /* @__PURE__ */ g.createElement(it, null)
|
|
569
533
|
);
|
|
570
534
|
}
|
|
571
535
|
renderList() {
|
|
572
536
|
const s = this.base, {
|
|
573
|
-
textField:
|
|
574
|
-
dataItemKey:
|
|
537
|
+
textField: t,
|
|
538
|
+
dataItemKey: e,
|
|
575
539
|
listNoDataRender: i,
|
|
576
|
-
itemRender:
|
|
577
|
-
groupHeaderItemRender:
|
|
540
|
+
itemRender: r,
|
|
541
|
+
groupHeaderItemRender: l,
|
|
578
542
|
virtual: a = { skip: 0, total: void 0 },
|
|
579
|
-
unstyled:
|
|
580
|
-
} = this.props,
|
|
581
|
-
return /* @__PURE__ */
|
|
543
|
+
unstyled: p
|
|
544
|
+
} = this.props, n = C(this.props), o = s.getPopupSettings(), h = s.vs, d = a.skip, v = this.props.opened !== void 0 ? this.props.opened : this.state.opened, x = `translateY(${h.translate}px)`, I = v ? this.getFocusedIndex(this.hasDuplicates) : void 0, b = this.props.filter !== void 0 ? this.props.filter : this.state.text, u = D(this.value, t), c = w(b) && b !== u ? null : this.value, f = this.props.list || gt, E = p && p.uComboBox;
|
|
545
|
+
return /* @__PURE__ */ g.createElement(
|
|
582
546
|
f,
|
|
583
547
|
{
|
|
584
548
|
id: s.listBoxId,
|
|
585
549
|
virtual: !!a,
|
|
586
|
-
show:
|
|
587
|
-
data:
|
|
588
|
-
focusedIndex:
|
|
589
|
-
value:
|
|
590
|
-
textField:
|
|
591
|
-
valueField:
|
|
550
|
+
show: v,
|
|
551
|
+
data: n,
|
|
552
|
+
focusedIndex: I,
|
|
553
|
+
value: c,
|
|
554
|
+
textField: t,
|
|
555
|
+
valueField: e,
|
|
592
556
|
groupField: this.props.groupField,
|
|
593
557
|
groupMode: this.props.groupMode,
|
|
594
558
|
isMultiColumn: this.props.isMultiColumn,
|
|
595
559
|
optionsGuid: s.guid,
|
|
596
560
|
hasDuplicates: this.hasDuplicates,
|
|
597
561
|
listRef: (O) => {
|
|
598
|
-
|
|
562
|
+
h.list = this.base.list = O, this.itemHeight = 0;
|
|
599
563
|
},
|
|
600
564
|
wrapperStyle: this.state.windowWidth && this.props._adaptiveMode && this.state.windowWidth > this.props._adaptiveMode.medium ? { maxHeight: o.height } : {},
|
|
601
|
-
wrapperCssClass:
|
|
602
|
-
|
|
565
|
+
wrapperCssClass: S(
|
|
566
|
+
k.listContent({
|
|
603
567
|
c: E,
|
|
604
568
|
virtual: a
|
|
605
569
|
})
|
|
606
570
|
),
|
|
607
|
-
listStyle:
|
|
571
|
+
listStyle: h.enabled ? { transform: x } : void 0,
|
|
608
572
|
key: "listkey",
|
|
609
|
-
skip:
|
|
573
|
+
skip: d,
|
|
610
574
|
onClick: this.handleItemClick,
|
|
611
|
-
itemRender:
|
|
612
|
-
groupHeaderItemRender:
|
|
575
|
+
itemRender: r,
|
|
576
|
+
groupHeaderItemRender: l,
|
|
613
577
|
noDataRender: i,
|
|
614
578
|
onMouseDown: (O) => O.preventDefault(),
|
|
615
579
|
onScroll: this.onScroll,
|
|
616
|
-
wrapperRef:
|
|
580
|
+
wrapperRef: h.scrollerRef,
|
|
617
581
|
scroller: this.base.renderScrollElement(),
|
|
618
582
|
ariaSetSize: a.total
|
|
619
583
|
}
|
|
620
584
|
);
|
|
621
585
|
}
|
|
622
|
-
renderSearchBar(s,
|
|
586
|
+
renderSearchBar(s, t, e) {
|
|
623
587
|
const {
|
|
624
588
|
tabIndex: i,
|
|
625
|
-
disabled:
|
|
626
|
-
title:
|
|
589
|
+
disabled: r,
|
|
590
|
+
title: l,
|
|
627
591
|
ariaLabelledBy: a,
|
|
628
|
-
ariaDescribedBy:
|
|
629
|
-
dataItemKey:
|
|
592
|
+
ariaDescribedBy: p,
|
|
593
|
+
dataItemKey: n,
|
|
630
594
|
virtual: o = { skip: 0 },
|
|
631
|
-
accessKey:
|
|
632
|
-
unstyled:
|
|
633
|
-
inputAttributes:
|
|
634
|
-
} = this.props,
|
|
595
|
+
accessKey: h,
|
|
596
|
+
unstyled: d,
|
|
597
|
+
inputAttributes: v
|
|
598
|
+
} = this.props, x = C(this.props), I = this.props.opened !== void 0 ? this.props.opened : this.state.opened, b = this.value, u = Math.max(
|
|
635
599
|
0,
|
|
636
|
-
|
|
600
|
+
x.findIndex((c) => F(c, b, n))
|
|
637
601
|
);
|
|
638
|
-
return this._suggested && !
|
|
639
|
-
|
|
602
|
+
return this._suggested && !F(this._valueOnDidUpdate, b, n) && (this._suggested = ""), /* @__PURE__ */ g.createElement(
|
|
603
|
+
ut,
|
|
640
604
|
{
|
|
641
|
-
id:
|
|
642
|
-
readOnly:
|
|
643
|
-
placeholder:
|
|
605
|
+
id: t,
|
|
606
|
+
readOnly: I && this.mobileMode,
|
|
607
|
+
placeholder: e,
|
|
644
608
|
tabIndex: i,
|
|
645
|
-
title:
|
|
609
|
+
title: l,
|
|
646
610
|
value: s + this._suggested,
|
|
647
611
|
suggestedText: this._suggested,
|
|
648
|
-
ref: (
|
|
649
|
-
this._input =
|
|
612
|
+
ref: (c) => {
|
|
613
|
+
this._input = c && c.input;
|
|
650
614
|
},
|
|
651
615
|
onClick: this.onInputClick,
|
|
652
616
|
onKeyDown: this.onInputKeyDown,
|
|
653
617
|
onChange: this.inputOnChange,
|
|
654
618
|
onFocus: this.base.handleFocus,
|
|
655
619
|
onBlur: this.handleBlur,
|
|
656
|
-
disabled:
|
|
657
|
-
expanded:
|
|
620
|
+
disabled: r,
|
|
621
|
+
expanded: I,
|
|
658
622
|
owns: this.base.listBoxId,
|
|
659
|
-
activedescendant: `option-${this.base.guid}-${
|
|
623
|
+
activedescendant: `option-${this.base.guid}-${u + o.skip}`,
|
|
660
624
|
role: "combobox",
|
|
661
625
|
ariaLabelledBy: a,
|
|
662
626
|
ariaLabel: this.props.ariaLabel,
|
|
663
|
-
ariaDescribedBy:
|
|
627
|
+
ariaDescribedBy: p,
|
|
664
628
|
ariaRequired: this.required,
|
|
665
629
|
render: this.props.valueRender,
|
|
666
630
|
ariaControls: this.base.listBoxId,
|
|
667
|
-
unstyled:
|
|
668
|
-
inputAttributes:
|
|
631
|
+
unstyled: d,
|
|
632
|
+
inputAttributes: v
|
|
669
633
|
}
|
|
670
634
|
);
|
|
671
635
|
}
|
|
672
636
|
clearValue() {
|
|
673
637
|
const s = this.base.initState();
|
|
674
638
|
this._suggested = "", this.navigationIndex = void 0, this.base.filterChanged("", s), this.props.filter === void 0 && this.state.text !== void 0 && (s.data.text = void 0), this.triggerOnChange(null, s);
|
|
675
|
-
const
|
|
676
|
-
|
|
639
|
+
const t = this.props.opened !== void 0 ? this.props.opened : this.state.opened, e = this.mobileMode;
|
|
640
|
+
t && !e && this.base.togglePopup(s), this.applyState(s);
|
|
677
641
|
}
|
|
678
|
-
triggerOnChange(s,
|
|
679
|
-
const
|
|
680
|
-
!this.hasDuplicates && (!
|
|
642
|
+
triggerOnChange(s, t) {
|
|
643
|
+
const e = this.value;
|
|
644
|
+
!this.hasDuplicates && (!w(e) && !w(s) || F(e, s, this.props.dataItemKey)) || (this.props.value === void 0 && (t.data.value = s), this._valueDuringOnChange = s, t.events.push({ type: "onChange" }));
|
|
681
645
|
}
|
|
682
646
|
getFocusedIndex(s) {
|
|
683
|
-
const
|
|
684
|
-
textField:
|
|
647
|
+
const t = this.value, {
|
|
648
|
+
textField: e,
|
|
685
649
|
dataItemKey: i,
|
|
686
|
-
virtual:
|
|
687
|
-
focusedItemIndex:
|
|
650
|
+
virtual: r = { skip: 0 },
|
|
651
|
+
focusedItemIndex: l = z,
|
|
688
652
|
skipDisabledItems: a
|
|
689
|
-
} = this.props,
|
|
690
|
-
return s && this.navigationIndex !== void 0 ? this.navigationIndex :
|
|
653
|
+
} = this.props, p = C(this.props), n = this.props.filter ? this.props.filter : this.state.text;
|
|
654
|
+
return s && this.navigationIndex !== void 0 ? this.navigationIndex : w(t) && n === void 0 ? p.findIndex((o) => F(o, t, i)) : n ? l(p, n, e) : a && e && !n && r.skip === 0 ? p.findIndex((o) => !o.disabled && o[e]) : r.skip === 0 ? 0 : -1;
|
|
691
655
|
}
|
|
692
656
|
suggestValue(s) {
|
|
693
|
-
const { data:
|
|
694
|
-
this._suggested =
|
|
657
|
+
const { data: t, textField: e } = this.props;
|
|
658
|
+
this._suggested = ht(s, t, e);
|
|
695
659
|
}
|
|
696
660
|
applyState(s) {
|
|
697
661
|
this.base.applyState(s), this._valueDuringOnChange = void 0;
|
|
698
662
|
}
|
|
699
663
|
calculateMedia(s) {
|
|
700
|
-
for (const
|
|
701
|
-
this.setState({ windowWidth:
|
|
664
|
+
for (const t of s)
|
|
665
|
+
this.setState({ windowWidth: t.target.clientWidth });
|
|
702
666
|
}
|
|
703
667
|
};
|
|
704
|
-
|
|
705
|
-
...
|
|
706
|
-
size:
|
|
707
|
-
rounded:
|
|
708
|
-
fillMode:
|
|
709
|
-
dataItemKey:
|
|
710
|
-
groupField:
|
|
711
|
-
groupMode:
|
|
712
|
-
isMultiColumn:
|
|
713
|
-
suggest:
|
|
714
|
-
placeholder:
|
|
715
|
-
title:
|
|
716
|
-
allowCustom:
|
|
717
|
-
clearButton:
|
|
718
|
-
iconClassName:
|
|
719
|
-
svgIcon:
|
|
720
|
-
validationMessage:
|
|
721
|
-
required:
|
|
722
|
-
id:
|
|
723
|
-
ariaLabelledBy:
|
|
724
|
-
ariaLabel:
|
|
725
|
-
ariaDescribedBy:
|
|
726
|
-
list:
|
|
727
|
-
valueRender:
|
|
728
|
-
skipDisabledItems:
|
|
729
|
-
inputAttributes:
|
|
730
|
-
},
|
|
731
|
-
...
|
|
668
|
+
M.displayName = "ComboBox", M.propTypes = {
|
|
669
|
+
..._.propTypes,
|
|
670
|
+
size: m.oneOf([null, "small", "medium", "large"]),
|
|
671
|
+
rounded: m.oneOf([null, "small", "medium", "large", "full"]),
|
|
672
|
+
fillMode: m.oneOf([null, "solid", "flat", "outline"]),
|
|
673
|
+
dataItemKey: m.string,
|
|
674
|
+
groupField: m.string,
|
|
675
|
+
groupMode: m.oneOf([void 0, "classic", "modern"]),
|
|
676
|
+
isMultiColumn: m.bool,
|
|
677
|
+
suggest: m.bool,
|
|
678
|
+
placeholder: m.string,
|
|
679
|
+
title: m.string,
|
|
680
|
+
allowCustom: m.bool,
|
|
681
|
+
clearButton: m.bool,
|
|
682
|
+
iconClassName: m.string,
|
|
683
|
+
svgIcon: et,
|
|
684
|
+
validationMessage: m.string,
|
|
685
|
+
required: m.bool,
|
|
686
|
+
id: m.string,
|
|
687
|
+
ariaLabelledBy: m.string,
|
|
688
|
+
ariaLabel: m.string,
|
|
689
|
+
ariaDescribedBy: m.string,
|
|
690
|
+
list: m.any,
|
|
691
|
+
valueRender: m.func,
|
|
692
|
+
skipDisabledItems: m.bool,
|
|
693
|
+
inputAttributes: m.object
|
|
694
|
+
}, M.defaultProps = {
|
|
695
|
+
..._.defaultProps,
|
|
732
696
|
size: "medium",
|
|
733
697
|
rounded: "medium",
|
|
734
698
|
fillMode: "solid",
|
|
@@ -741,18 +705,18 @@ F.displayName = "ComboBox", F.propTypes = {
|
|
|
741
705
|
prefix: void 0,
|
|
742
706
|
suffix: void 0
|
|
743
707
|
};
|
|
744
|
-
let P =
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
708
|
+
let P = M;
|
|
709
|
+
const St = ot(), kt = at(
|
|
710
|
+
nt(
|
|
711
|
+
St,
|
|
712
|
+
lt(
|
|
713
|
+
rt(P)
|
|
750
714
|
)
|
|
751
715
|
)
|
|
752
716
|
);
|
|
753
|
-
|
|
717
|
+
kt.displayName = "KendoReactComboBox";
|
|
754
718
|
export {
|
|
755
|
-
|
|
756
|
-
|
|
719
|
+
kt as ComboBox,
|
|
720
|
+
St as ComboBoxPropsContext,
|
|
757
721
|
P as ComboBoxWithoutContext
|
|
758
722
|
};
|