@progress/kendo-react-grid 14.3.0-develop.1 → 14.3.0-develop.2
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/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.js +1 -1
- package/index.mjs +8 -10
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +1 -1
- package/package.json +17 -17
- package/toolbar-tools/smartbox/SmartBox.js +1 -1
- package/toolbar-tools/smartbox/SmartBox.mjs +102 -94
- package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.d.ts +12 -3
- package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.js +1 -1
- package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.mjs +42 -41
- package/toolbar-tools/smartbox/index.d.ts +0 -1
- package/toolbar-tools/smartbox/interfaces/index.d.ts +0 -1
- package/toolbar-tools/smartbox/SegmentedControl.d.ts +0 -13
- package/toolbar-tools/smartbox/SegmentedControl.js +0 -8
- package/toolbar-tools/smartbox/SegmentedControl.mjs +0 -109
- package/toolbar-tools/smartbox/interfaces/SegmentedControlTypes.d.ts +0 -66
|
@@ -6,17 +6,16 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
import * as e from "react";
|
|
9
|
-
import {
|
|
10
|
-
import { SpeechToTextButton as tt, Button as nt } from "@progress/kendo-react-buttons";
|
|
9
|
+
import { SpeechToTextButton as et, Button as tt, SegmentedControl as nt } from "@progress/kendo-react-buttons";
|
|
11
10
|
import { xIcon as rt, stopSmIcon as st, arrowUpOutlineIcon as at } from "@progress/kendo-svg-icons";
|
|
12
11
|
import { guid as ot, kendoThemeMaps as it, classNames as B, IconWrap as ce } from "@progress/kendo-react-common";
|
|
13
12
|
import { useLocalization as lt } from "@progress/kendo-react-intl";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
13
|
+
import { List as $ } from "@progress/kendo-react-dropdowns";
|
|
14
|
+
import { Popup as ct } from "@progress/kendo-react-popup";
|
|
15
|
+
import { createListItemRender as ut, searchModeItemRender as pt, listGroupHeaderRender as ue, NoDataRender as mt } from "./listItemRenders.mjs";
|
|
16
|
+
import { smartBoxClearTitle as pe, messages as k, smartBoxSpeechToTextButton as P, smartBoxSubmitPromptButton as L } from "../../messages/index.mjs";
|
|
17
|
+
import { useGridAIRequest as dt } from "../../hooks/useGridAIRequest.mjs";
|
|
18
|
+
import { GridContext as ft } from "../../utils/GridContext.mjs";
|
|
20
19
|
import { useSmartBoxModes as ht } from "./hooks/useSmartBoxModes.mjs";
|
|
21
20
|
import { useSmartBoxHistory as gt } from "./hooks/useSmartBoxHistory.mjs";
|
|
22
21
|
import { useSmartBoxPopup as St } from "./hooks/useSmartBoxPopup.mjs";
|
|
@@ -25,8 +24,8 @@ import { useSmartBoxLabels as Ct } from "./hooks/useSmartBoxLabels.mjs";
|
|
|
25
24
|
import { useSmartBoxListData as bt } from "./hooks/useSmartBoxListData.mjs";
|
|
26
25
|
import { useSmartBoxSegmentedControl as xt } from "./hooks/useSmartBoxSegmentedControl.mjs";
|
|
27
26
|
import { useSmartBoxSearch as Rt } from "./hooks/useSmartBoxSearch.mjs";
|
|
28
|
-
import { useDebounce as
|
|
29
|
-
const
|
|
27
|
+
import { useDebounce as vt } from "./hooks/useDebounce.mjs";
|
|
28
|
+
const It = e.forwardRef((me, de) => {
|
|
30
29
|
var ie;
|
|
31
30
|
const {
|
|
32
31
|
searchConfig: fe,
|
|
@@ -34,32 +33,32 @@ const vt = e.forwardRef((me, de) => {
|
|
|
34
33
|
aiAssistantConfig: ge,
|
|
35
34
|
activeMode: Se,
|
|
36
35
|
dir: ke = "ltr",
|
|
37
|
-
size:
|
|
36
|
+
size: K = "medium",
|
|
38
37
|
placeholder: Ce,
|
|
39
38
|
history: be,
|
|
40
39
|
loading: xe = !1,
|
|
41
|
-
promptSuggestionRender:
|
|
42
|
-
historyItemRender:
|
|
40
|
+
promptSuggestionRender: j,
|
|
41
|
+
historyItemRender: J,
|
|
43
42
|
onOpen: Re,
|
|
44
|
-
onClose:
|
|
43
|
+
onClose: ve,
|
|
45
44
|
onFocus: C,
|
|
46
45
|
onBlur: b,
|
|
47
|
-
onSearch:
|
|
46
|
+
onSearch: Ie,
|
|
48
47
|
onSemanticSearch: we,
|
|
49
|
-
onAIPromptRequest:
|
|
50
|
-
onAIResponseSuccess:
|
|
51
|
-
onAIResponseError:
|
|
48
|
+
onAIPromptRequest: F,
|
|
49
|
+
onAIResponseSuccess: H,
|
|
50
|
+
onAIResponseError: z,
|
|
52
51
|
onAICancelRequest: x
|
|
53
|
-
} = me, h = lt(), g = e.useContext(
|
|
52
|
+
} = me, h = lt(), g = e.useContext(ft), Ee = e.useRef(`k-${ot()}`), d = e.useRef(null), S = e.useRef(null), M = e.useRef(null), [o, p] = e.useState(""), [De, R] = e.useState(!1), [ye, Q] = e.useState(void 0), [Be, X] = e.useState(null), {
|
|
54
53
|
searchMode: i,
|
|
55
54
|
semanticSearchMode: c,
|
|
56
55
|
aiAssistantMode: s,
|
|
57
56
|
selectedView: n,
|
|
58
|
-
setSelectedViewState:
|
|
57
|
+
setSelectedViewState: N,
|
|
59
58
|
lastSearchMode: Pe,
|
|
60
59
|
searchHistorySettings: Y,
|
|
61
60
|
semanticSearchHistorySettings: Z,
|
|
62
|
-
aiAssistantHistorySettings:
|
|
61
|
+
aiAssistantHistorySettings: T,
|
|
63
62
|
speechToTextButtonSettings: _,
|
|
64
63
|
currentSearchDelay: Le
|
|
65
64
|
} = ht({
|
|
@@ -68,12 +67,12 @@ const vt = e.forwardRef((me, de) => {
|
|
|
68
67
|
aiAssistantConfigProp: ge,
|
|
69
68
|
activeModeProp: Se,
|
|
70
69
|
sharedHistory: be
|
|
71
|
-
}), { currentHistory:
|
|
70
|
+
}), { currentHistory: v, currentHistorySettings: Fe, addToHistory: q } = gt({
|
|
72
71
|
selectedView: n,
|
|
73
72
|
searchHistorySettings: Y,
|
|
74
73
|
semanticSearchHistorySettings: Z,
|
|
75
|
-
aiAssistantHistorySettings:
|
|
76
|
-
}), { isOpen:
|
|
74
|
+
aiAssistantHistorySettings: T
|
|
75
|
+
}), { isOpen: O, togglePopup: a } = St({ onOpen: Re, onClose: ve }), { columns: A, gridState: He, gridRef: ze, handleStateChange: Ne } = kt(g), V = e.useMemo(
|
|
77
76
|
() => (s == null ? void 0 : s.promptSuggestions) || [],
|
|
78
77
|
[s == null ? void 0 : s.promptSuggestions]
|
|
79
78
|
), { inputPlaceholder: Te, prefixIcon: qe } = Ct({
|
|
@@ -82,20 +81,20 @@ const vt = e.forwardRef((me, de) => {
|
|
|
82
81
|
semanticSearchMode: c,
|
|
83
82
|
aiAssistantMode: s,
|
|
84
83
|
sharedPlaceholder: Ce
|
|
85
|
-
}), { searchListData: f, aiAssistantListData:
|
|
84
|
+
}), { searchListData: f, aiAssistantListData: I, searchHistoryListData: w } = bt({
|
|
86
85
|
selectedView: n,
|
|
87
86
|
searchModeEnabled: i == null ? void 0 : i.enabled,
|
|
88
87
|
semanticSearchModeEnabled: c == null ? void 0 : c.enabled,
|
|
89
|
-
promptSuggestions:
|
|
90
|
-
currentHistory:
|
|
88
|
+
promptSuggestions: V,
|
|
89
|
+
currentHistory: v,
|
|
91
90
|
currentHistorySettings: Fe
|
|
92
|
-
}),
|
|
91
|
+
}), E = xt({
|
|
93
92
|
searchMode: i,
|
|
94
93
|
semanticSearchMode: c,
|
|
95
94
|
aiAssistantMode: s,
|
|
96
95
|
selectedView: n,
|
|
97
96
|
lastSearchMode: Pe,
|
|
98
|
-
setSelectedViewState:
|
|
97
|
+
setSelectedViewState: N,
|
|
99
98
|
setInputValue: p
|
|
100
99
|
});
|
|
101
100
|
e.useEffect(() => {
|
|
@@ -110,30 +109,30 @@ const vt = e.forwardRef((me, de) => {
|
|
|
110
109
|
r.disconnect();
|
|
111
110
|
};
|
|
112
111
|
}, []);
|
|
113
|
-
const m = xe || De,
|
|
112
|
+
const m = xe || De, W = !n, Oe = !(i != null && i.enabled) && !(c != null && c.enabled) && !(s != null && s.enabled), Ve = it.sizeMap[K] || "md", { emitSearchEvent: u } = Rt({
|
|
114
113
|
selectedView: n,
|
|
115
114
|
searchMode: i,
|
|
116
115
|
columns: A,
|
|
117
116
|
gridContext: g,
|
|
118
117
|
searchHistorySettings: Y,
|
|
119
118
|
semanticSearchHistorySettings: Z,
|
|
120
|
-
addToHistory:
|
|
121
|
-
onSearch:
|
|
119
|
+
addToHistory: q,
|
|
120
|
+
onSearch: Ie,
|
|
122
121
|
onSemanticSearch: we
|
|
123
|
-
}), { sendRequest: ee, cancelRequest: te } =
|
|
122
|
+
}), { sendRequest: ee, cancelRequest: te } = dt({
|
|
124
123
|
requestUrl: s == null ? void 0 : s.requestUrl,
|
|
125
124
|
requestOptions: s == null ? void 0 : s.requestOptions,
|
|
126
125
|
columns: A,
|
|
127
126
|
gridState: He,
|
|
128
127
|
gridRef: ze,
|
|
129
128
|
onPromptRequest: (t) => {
|
|
130
|
-
|
|
129
|
+
F == null || F({ requestData: t });
|
|
131
130
|
},
|
|
132
131
|
onResponseSuccess: (t) => {
|
|
133
|
-
R(!1),
|
|
132
|
+
R(!1), H == null || H({ response: t });
|
|
134
133
|
},
|
|
135
134
|
onResponseError: (t) => {
|
|
136
|
-
R(!1),
|
|
135
|
+
R(!1), z == null || z({ error: t });
|
|
137
136
|
},
|
|
138
137
|
onStateChange: Ne,
|
|
139
138
|
onExportPdf: () => g == null ? void 0 : g.exportAsPdf()
|
|
@@ -146,10 +145,10 @@ const vt = e.forwardRef((me, de) => {
|
|
|
146
145
|
}),
|
|
147
146
|
[a]
|
|
148
147
|
);
|
|
149
|
-
const
|
|
148
|
+
const G = vt(Be, Le), ne = e.useRef(u);
|
|
150
149
|
ne.current = u, e.useEffect(() => {
|
|
151
|
-
|
|
152
|
-
}, [
|
|
150
|
+
G !== null && ne.current(G);
|
|
151
|
+
}, [G]);
|
|
153
152
|
const We = e.useCallback(
|
|
154
153
|
(t) => {
|
|
155
154
|
const r = t.target.value;
|
|
@@ -161,37 +160,37 @@ const vt = e.forwardRef((me, de) => {
|
|
|
161
160
|
}, [C, a, o]), Ue = e.useCallback(
|
|
162
161
|
(t) => {
|
|
163
162
|
var le;
|
|
164
|
-
const r = d.current, l = (le =
|
|
165
|
-
!
|
|
163
|
+
const r = d.current, l = (le = M.current) == null ? void 0 : le.element, y = t.relatedTarget, _e = y && (r == null ? void 0 : r.contains(y)), Ae = y && (l == null ? void 0 : l.contains(y));
|
|
164
|
+
!_e && !Ae && (b == null || b(), a(!1));
|
|
166
165
|
},
|
|
167
166
|
[b, a]
|
|
168
167
|
), $e = e.useCallback(() => {
|
|
169
168
|
o || a(!0);
|
|
170
|
-
}, [a, o]), re = !!((ie = s == null ? void 0 : s.requestOptions) != null && ie.url || s != null && s.requestUrl),
|
|
169
|
+
}, [a, o]), re = !!((ie = s == null ? void 0 : s.requestOptions) != null && ie.url || s != null && s.requestUrl), U = e.useCallback(() => {
|
|
171
170
|
if (m) {
|
|
172
171
|
x == null || x(), te(), R(!1);
|
|
173
172
|
return;
|
|
174
173
|
}
|
|
175
|
-
o.trim() && (re && R(!0),
|
|
174
|
+
o.trim() && (re && R(!0), q("aiAssistant", o, T), a(!1), ee(o.trim()), p(""));
|
|
176
175
|
}, [
|
|
177
176
|
m,
|
|
178
177
|
o,
|
|
179
|
-
N,
|
|
180
|
-
a,
|
|
181
178
|
T,
|
|
179
|
+
a,
|
|
180
|
+
q,
|
|
182
181
|
ee,
|
|
183
182
|
te,
|
|
184
183
|
re,
|
|
185
184
|
x
|
|
186
185
|
]), Ke = e.useCallback(
|
|
187
186
|
(t) => {
|
|
188
|
-
t.key === "Enter" && (n === "aiAssistant" ?
|
|
187
|
+
t.key === "Enter" && (n === "aiAssistant" ? U() : n === "semanticSearch" && u(o));
|
|
189
188
|
},
|
|
190
|
-
[n, o, u,
|
|
189
|
+
[n, o, u, U]
|
|
191
190
|
), je = e.useCallback(() => {
|
|
192
191
|
var t;
|
|
193
|
-
a(!
|
|
194
|
-
}, [
|
|
192
|
+
a(!O), (t = S.current) == null || t.focus();
|
|
193
|
+
}, [O, a]), Je = e.useCallback(
|
|
195
194
|
(t) => {
|
|
196
195
|
var r;
|
|
197
196
|
t.stopPropagation(), t.preventDefault(), p(""), (r = S.current) == null || r.focus(), a(!0), u("");
|
|
@@ -200,54 +199,63 @@ const vt = e.forwardRef((me, de) => {
|
|
|
200
199
|
), se = e.useCallback(
|
|
201
200
|
(t) => {
|
|
202
201
|
var r;
|
|
203
|
-
|
|
202
|
+
N(t), p(""), X(null), (r = S.current) == null || r.focus();
|
|
204
203
|
},
|
|
205
|
-
[
|
|
206
|
-
),
|
|
204
|
+
[N]
|
|
205
|
+
), D = e.useCallback(
|
|
207
206
|
(t) => {
|
|
208
207
|
var r;
|
|
209
208
|
p(t), a(!1), (r = S.current) == null || r.focus(), n !== "aiAssistant" && u(t);
|
|
210
209
|
},
|
|
211
210
|
[n, a, u]
|
|
212
|
-
),
|
|
211
|
+
), Me = e.useCallback((t) => {
|
|
213
212
|
if (t.isFinal && t.alternatives.length > 0) {
|
|
214
213
|
const r = t.alternatives[0].transcript;
|
|
215
214
|
p((l) => l ? `${l} ${r}` : r);
|
|
216
215
|
}
|
|
217
|
-
}, []),
|
|
216
|
+
}, []), Qe = e.useMemo(() => n === "aiAssistant" ? v.length === 0 && V.length === 0 : n === "search" || n === "semanticSearch" ? v.length === 0 && f.length === 0 : !1, [n, v.length, V.length, f.length]), ae = e.useCallback(
|
|
218
217
|
(t) => {
|
|
219
|
-
const l = (n === "aiAssistant" ?
|
|
220
|
-
l &&
|
|
218
|
+
const l = (n === "aiAssistant" ? I : w)[t];
|
|
219
|
+
l && D(l.text);
|
|
221
220
|
},
|
|
222
|
-
[n,
|
|
223
|
-
),
|
|
221
|
+
[n, I, w, D]
|
|
222
|
+
), Xe = e.useCallback(
|
|
224
223
|
(t) => {
|
|
225
224
|
const r = f[t];
|
|
226
225
|
r && se(r.mode);
|
|
227
226
|
},
|
|
228
227
|
[f, se]
|
|
229
228
|
), oe = e.useMemo(
|
|
230
|
-
() =>
|
|
231
|
-
historyItemRender:
|
|
232
|
-
promptSuggestionRender:
|
|
233
|
-
handleListItemClick:
|
|
229
|
+
() => ut({
|
|
230
|
+
historyItemRender: J,
|
|
231
|
+
promptSuggestionRender: j,
|
|
232
|
+
handleListItemClick: D
|
|
234
233
|
}),
|
|
235
|
-
[
|
|
236
|
-
),
|
|
237
|
-
|
|
234
|
+
[J, j, D]
|
|
235
|
+
), Ye = O && !Oe, Ze = () => /* @__PURE__ */ e.createElement(e.Fragment, null, E.items.length > 0 && /* @__PURE__ */ e.createElement(
|
|
236
|
+
nt,
|
|
237
|
+
{
|
|
238
|
+
items: E.items,
|
|
239
|
+
value: E.value,
|
|
240
|
+
onChange: E.onChange,
|
|
241
|
+
size: K,
|
|
242
|
+
layoutMode: "stretch"
|
|
243
|
+
}
|
|
244
|
+
), (n === "search" || n === "semanticSearch") && f.length > 0 && /* @__PURE__ */ e.createElement(
|
|
245
|
+
$,
|
|
238
246
|
{
|
|
239
247
|
data: f,
|
|
240
248
|
textField: "text",
|
|
241
249
|
descriptionField: "description",
|
|
242
|
-
onClick:
|
|
243
|
-
itemRender:
|
|
250
|
+
onClick: Xe,
|
|
251
|
+
itemRender: pt,
|
|
244
252
|
show: !0,
|
|
245
253
|
wrapperCssClass: "k-list k-list-md"
|
|
246
254
|
}
|
|
247
|
-
), n === "aiAssistant" &&
|
|
248
|
-
|
|
255
|
+
), n === "aiAssistant" && I.length > 0 && /* @__PURE__ */ e.createElement(
|
|
256
|
+
$,
|
|
249
257
|
{
|
|
250
|
-
data:
|
|
258
|
+
data: I,
|
|
251
259
|
textField: "text",
|
|
252
260
|
groupField: "group",
|
|
253
261
|
svgIconField: "groupSvgIcon",
|
|
@@ -260,7 +268,7 @@ const vt = e.forwardRef((me, de) => {
|
|
|
260
268
|
wrapperCssClass: "k-list k-list-md"
|
|
261
269
|
}
|
|
262
270
|
), (n === "search" || n === "semanticSearch") && w.length > 0 && /* @__PURE__ */ e.createElement(
|
|
263
|
-
|
|
271
|
+
$,
|
|
264
272
|
{
|
|
265
273
|
data: w,
|
|
266
274
|
textField: "text",
|
|
@@ -274,7 +282,7 @@ const vt = e.forwardRef((me, de) => {
|
|
|
274
282
|
show: !0,
|
|
275
283
|
wrapperCssClass: "k-list k-list-md"
|
|
276
284
|
}
|
|
277
|
-
),
|
|
285
|
+
), Qe && /* @__PURE__ */ e.createElement(mt, { selectedView: n }));
|
|
278
286
|
return /* @__PURE__ */ e.createElement("div", { ref: d, className: "k-smart-box-wrapper", dir: ke, onBlur: Ue }, /* @__PURE__ */ e.createElement(
|
|
279
287
|
"span",
|
|
280
288
|
{
|
|
@@ -282,7 +290,7 @@ const vt = e.forwardRef((me, de) => {
|
|
|
282
290
|
"k-loading": m
|
|
283
291
|
})
|
|
284
292
|
},
|
|
285
|
-
!
|
|
293
|
+
!W && /* @__PURE__ */ e.createElement("span", { className: "k-input-prefix k-input-prefix-horizontal" }, /* @__PURE__ */ e.createElement(
|
|
286
294
|
ce,
|
|
287
295
|
{
|
|
288
296
|
className: B("k-icon", {
|
|
@@ -300,11 +308,11 @@ const vt = e.forwardRef((me, de) => {
|
|
|
300
308
|
{
|
|
301
309
|
ref: S,
|
|
302
310
|
type: "text",
|
|
303
|
-
className: B("k-input-inner", { "k-disabled":
|
|
311
|
+
className: B("k-input-inner", { "k-disabled": W }),
|
|
304
312
|
id: Ee.current,
|
|
305
313
|
placeholder: Te,
|
|
306
314
|
value: o,
|
|
307
|
-
disabled:
|
|
315
|
+
disabled: W,
|
|
308
316
|
onChange: We,
|
|
309
317
|
onFocus: Ge,
|
|
310
318
|
onClick: $e,
|
|
@@ -327,21 +335,21 @@ const vt = e.forwardRef((me, de) => {
|
|
|
327
335
|
/* @__PURE__ */ e.createElement(ce, { className: "k-icon", icon: rt })
|
|
328
336
|
),
|
|
329
337
|
n === "aiAssistant" && /* @__PURE__ */ e.createElement("span", { className: "k-input-suffix k-input-suffix-horizontal" }, _ && /* @__PURE__ */ e.createElement(
|
|
330
|
-
|
|
338
|
+
et,
|
|
331
339
|
{
|
|
332
340
|
..._,
|
|
333
341
|
"aria-label": h.toLanguageString(
|
|
334
|
-
|
|
335
|
-
k[
|
|
342
|
+
P,
|
|
343
|
+
k[P]
|
|
336
344
|
),
|
|
337
345
|
title: h.toLanguageString(
|
|
338
|
-
|
|
339
|
-
k[
|
|
346
|
+
P,
|
|
347
|
+
k[P]
|
|
340
348
|
),
|
|
341
|
-
onResult:
|
|
349
|
+
onResult: Me
|
|
342
350
|
}
|
|
343
351
|
), /* @__PURE__ */ e.createElement(
|
|
344
|
-
|
|
352
|
+
tt,
|
|
345
353
|
{
|
|
346
354
|
className: B("k-smart-box-send", {
|
|
347
355
|
"k-processing": m,
|
|
@@ -351,27 +359,27 @@ const vt = e.forwardRef((me, de) => {
|
|
|
351
359
|
rounded: "full",
|
|
352
360
|
size: "small",
|
|
353
361
|
title: h.toLanguageString(
|
|
354
|
-
|
|
355
|
-
k[
|
|
362
|
+
L,
|
|
363
|
+
k[L]
|
|
356
364
|
),
|
|
357
365
|
"aria-label": h.toLanguageString(
|
|
358
|
-
|
|
359
|
-
k[
|
|
366
|
+
L,
|
|
367
|
+
k[L]
|
|
360
368
|
),
|
|
361
369
|
"aria-disabled": o.length === 0,
|
|
362
370
|
svgIcon: m ? st : at,
|
|
363
371
|
disabled: o.length === 0 && !m,
|
|
364
|
-
onClick:
|
|
372
|
+
onClick: U
|
|
365
373
|
}
|
|
366
374
|
))
|
|
367
375
|
), /* @__PURE__ */ e.createElement(
|
|
368
|
-
|
|
376
|
+
ct,
|
|
369
377
|
{
|
|
370
|
-
ref:
|
|
378
|
+
ref: M,
|
|
371
379
|
anchor: d.current,
|
|
372
|
-
show:
|
|
380
|
+
show: Ye,
|
|
373
381
|
popupClass: "k-smart-box-popup",
|
|
374
|
-
style: { width:
|
|
382
|
+
style: { width: ye },
|
|
375
383
|
anchorAlign: { horizontal: "left", vertical: "bottom" },
|
|
376
384
|
popupAlign: { horizontal: "left", vertical: "top" },
|
|
377
385
|
margin: { horizontal: 0, vertical: 2 },
|
|
@@ -380,10 +388,10 @@ const vt = e.forwardRef((me, de) => {
|
|
|
380
388
|
d.current && !d.current.contains(r) && a(!1);
|
|
381
389
|
}
|
|
382
390
|
},
|
|
383
|
-
|
|
391
|
+
Ze()
|
|
384
392
|
));
|
|
385
393
|
});
|
|
386
|
-
|
|
394
|
+
It.displayName = "KendoReactSmartBox";
|
|
387
395
|
export {
|
|
388
|
-
|
|
396
|
+
It as SmartBox
|
|
389
397
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
import { SmartBoxMode
|
|
8
|
+
import { SmartBoxMode } from '../interfaces/index.js';
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
/**
|
|
11
11
|
* Represents a minimal mode configuration for the segmented control.
|
|
@@ -63,8 +63,17 @@ export interface UseSmartBoxSegmentedControlProps {
|
|
|
63
63
|
* appropriate icon based on the last selected search mode.
|
|
64
64
|
*
|
|
65
65
|
* @param props - The hook properties.
|
|
66
|
-
* @returns An
|
|
66
|
+
* @returns An object containing the button array and handler function for the SegmentedControl onChange event.
|
|
67
67
|
*
|
|
68
68
|
* @hidden
|
|
69
69
|
*/
|
|
70
|
-
export declare function useSmartBoxSegmentedControl({ searchMode, semanticSearchMode, aiAssistantMode, selectedView, lastSearchMode, setSelectedViewState, setInputValue }: UseSmartBoxSegmentedControlProps):
|
|
70
|
+
export declare function useSmartBoxSegmentedControl({ searchMode, semanticSearchMode, aiAssistantMode, selectedView, lastSearchMode, setSelectedViewState, setInputValue }: UseSmartBoxSegmentedControlProps): {
|
|
71
|
+
items: {
|
|
72
|
+
value: string;
|
|
73
|
+
text: string;
|
|
74
|
+
svgIcon?: any;
|
|
75
|
+
iconClassName?: string | undefined;
|
|
76
|
+
}[];
|
|
77
|
+
value: string | undefined;
|
|
78
|
+
onChange: (value: string) => void;
|
|
79
|
+
};
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
9
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),g=require("@progress/kendo-svg-icons");function O(n){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const l in n)if(l!=="default"){const u=Object.getOwnPropertyDescriptor(n,l);Object.defineProperty(t,l,u.get?u:{enumerable:!0,get:()=>n[l]})}}return t.default=n,Object.freeze(t)}const o=O(p);function a({searchMode:n,semanticSearchMode:t,aiAssistantMode:l,selectedView:u,lastSearchMode:r,setSelectedViewState:f,setInputValue:i}){const v=o.useMemo(()=>{const b=(n==null?void 0:n.enabled)||(t==null?void 0:t.enabled),k=l==null?void 0:l.enabled;if(!b||!k)return[];const s=u==="semanticSearch"||u==="aiAssistant"&&r==="semanticSearch";return[{value:"search",text:"Search",svgIcon:s?g.zoomSparkleIcon:g.searchIcon,iconClassName:s?"k-accent-icon":void 0},{value:"aiAssistant",text:"AI Assistant",svgIcon:g.sparklesIcon,iconClassName:"k-accent-icon"}]},[n,t,l,u,r]),C=o.useCallback(()=>{if(u==="search"||u==="semanticSearch")return"search";if(u==="aiAssistant")return"aiAssistant"},[u]),I=o.useCallback(b=>{b==="search"?r&&(r==="search"?n!=null&&n.enabled:t!=null&&t.enabled)?f(r):n!=null&&n.enabled?f("search"):t!=null&&t.enabled&&f("semanticSearch"):b==="aiAssistant"&&f("aiAssistant"),i("")},[n,t,r,f,i]);return{items:v,value:C(),onChange:I}}exports.useSmartBoxSegmentedControl=a;
|
|
@@ -6,52 +6,53 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import { zoomSparkleIcon as
|
|
11
|
-
function
|
|
9
|
+
import * as g from "react";
|
|
10
|
+
import { zoomSparkleIcon as t, searchIcon as N, sparklesIcon as i } from "@progress/kendo-svg-icons";
|
|
11
|
+
function z({
|
|
12
12
|
searchMode: n,
|
|
13
|
-
semanticSearchMode:
|
|
14
|
-
aiAssistantMode:
|
|
15
|
-
selectedView:
|
|
16
|
-
lastSearchMode:
|
|
17
|
-
setSelectedViewState:
|
|
13
|
+
semanticSearchMode: u,
|
|
14
|
+
aiAssistantMode: C,
|
|
15
|
+
selectedView: f,
|
|
16
|
+
lastSearchMode: b,
|
|
17
|
+
setSelectedViewState: l,
|
|
18
18
|
setInputValue: k
|
|
19
19
|
}) {
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const p = g.useMemo(() => {
|
|
21
|
+
const I = (n == null ? void 0 : n.enabled) || (u == null ? void 0 : u.enabled), B = C == null ? void 0 : C.enabled;
|
|
22
|
+
if (!I || !B)
|
|
23
|
+
return [];
|
|
24
|
+
const v = f === "semanticSearch" || f === "aiAssistant" && b === "semanticSearch";
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
value: "search",
|
|
26
28
|
text: "Search",
|
|
27
|
-
svgIcon:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
}), l.push({
|
|
34
|
-
buttonId: 2,
|
|
29
|
+
svgIcon: v ? t : N,
|
|
30
|
+
iconClassName: v ? "k-accent-icon" : void 0
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
value: "aiAssistant",
|
|
35
34
|
text: "AI Assistant",
|
|
36
|
-
svgIcon:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
u,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
svgIcon: i,
|
|
36
|
+
iconClassName: "k-accent-icon"
|
|
37
|
+
}
|
|
38
|
+
];
|
|
39
|
+
}, [n, u, C, f, b]), x = g.useCallback(() => {
|
|
40
|
+
if (f === "search" || f === "semanticSearch")
|
|
41
|
+
return "search";
|
|
42
|
+
if (f === "aiAssistant")
|
|
43
|
+
return "aiAssistant";
|
|
44
|
+
}, [f]), A = g.useCallback(
|
|
45
|
+
(I) => {
|
|
46
|
+
I === "search" ? b && (b === "search" ? n != null && n.enabled : u != null && u.enabled) ? l(b) : n != null && n.enabled ? l("search") : u != null && u.enabled && l("semanticSearch") : I === "aiAssistant" && l("aiAssistant"), k("");
|
|
47
|
+
},
|
|
48
|
+
[n, u, b, l, k]
|
|
49
|
+
);
|
|
50
|
+
return {
|
|
51
|
+
items: p,
|
|
52
|
+
value: x(),
|
|
53
|
+
onChange: A
|
|
54
|
+
};
|
|
54
55
|
}
|
|
55
56
|
export {
|
|
56
|
-
|
|
57
|
+
z as useSmartBoxSegmentedControl
|
|
57
58
|
};
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
export * from './SegmentedControlTypes.js';
|
|
9
8
|
export * from './SearchTypes.js';
|
|
10
9
|
export * from './SmartBoxTypes.js';
|
|
11
10
|
export * from './utilTypes.js';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
*-------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
-
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
-
*-------------------------------------------------------------------------------------------
|
|
7
|
-
*/
|
|
8
|
-
import { SegmentedControlHandle, SegmentedControlProps } from './interfaces/index.js';
|
|
9
|
-
import * as React from 'react';
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
export declare const SegmentedControl: React.ForwardRefExoticComponent<SegmentedControlProps & React.RefAttributes<SegmentedControlHandle>>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
*-------------------------------------------------------------------------------------------
|
|
4
|
-
* Copyright © 2026 Progress Software Corporation. All rights reserved.
|
|
5
|
-
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
|
-
*-------------------------------------------------------------------------------------------
|
|
7
|
-
*/
|
|
8
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),i=require("@progress/kendo-react-common");function W(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const r in s)if(r!=="default"){const l=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(a,r,l.get?l:{enumerable:!0,get:()=>s[r]})}}return a.default=s,Object.freeze(a)}const e=W(T),P=void 0,I=e.forwardRef((s,a)=>{const{buttons:r=[],size:l=P,stretched:z}=s,N=l?i.kendoThemeMaps.sizeMap[l]:void 0,f=e.useRef(null),R=e.useRef(null),[O,u]=e.useState({}),d=e.useCallback(()=>{const t=f.current,n=R.current;if(!t||!n)return;const m=t.querySelector(".k-segmented-control-button.k-selected");if(!m)return;const g=t.offsetWidth,p=m.offsetWidth,b=m.offsetLeft;n.style.left=`${b}px`,n.style.right=`${g-b-p}px`},[]);return e.useLayoutEffect(()=>{d()},[r,d]),e.useEffect(()=>{const t=f.current;if(!t)return;const n=new ResizeObserver(()=>{d()});return n.observe(t),()=>{n.disconnect()}},[d]),e.useImperativeHandle(a,()=>({element:f.current}),[]),e.createElement("div",{ref:f,className:i.classNames("k-segmented-control",N&&`k-segmented-control-${N}`,{"k-segmented-control-stretched":z})},e.createElement("div",{className:"k-segmented-control-thumb",ref:R,"aria-hidden":"true"}),r.map(({buttonId:t,disabled:n,text:m,svgIcon:g,selected:p,accentIcon:b,type:E="button",onClick:h,onMouseEnter:k,onMouseLeave:v,onFocus:S,onBlur:y,...j})=>e.createElement("button",{key:t,type:E,className:i.classNames("k-segmented-control-button",{"k-selected":p,"k-hover":O.hoveredId===t&&!n,"k-focus":O.focusedId===t&&!n,"k-disabled":n}),disabled:n,onClick:c=>{h==null||h(c),d()},onMouseEnter:c=>{u(o=>({...o,hoveredId:t})),k==null||k(c)},onMouseLeave:c=>{u(o=>({...o,hoveredId:void 0})),v==null||v(c)},onFocus:c=>{u(o=>({...o,focusedId:t})),S==null||S(c)},onBlur:c=>{u(o=>({...o,focusedId:void 0})),y==null||y(c)},...j},g&&e.createElement(i.IconWrap,{className:i.classNames("k-segmented-control-button-icon",{"k-accent-icon":p&&b}),icon:g}),e.createElement("span",{className:"k-segmented-control-button-text"},m))))});I.displayName="KendoReactSegmentedControl";exports.SegmentedControl=I;
|