@progress/kendo-react-grid 14.0.0-develop.1 → 14.0.0-develop.3

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.
Files changed (72) hide show
  1. package/columnMenu/GridColumnMenuFilter.mjs +2 -2
  2. package/components/noRecords/GridNoRecordsContainer.mjs +1 -1
  3. package/constants/index.mjs +2 -2
  4. package/dist/cdn/js/kendo-react-grid.js +1 -1
  5. package/hooks/index.d.ts +8 -0
  6. package/hooks/useGridAIRequest.d.ts +150 -0
  7. package/hooks/useGridAIRequest.js +8 -0
  8. package/hooks/useGridAIRequest.mjs +93 -0
  9. package/index.d.mts +3 -1
  10. package/index.d.ts +3 -1
  11. package/index.js +1 -1
  12. package/index.mjs +56 -50
  13. package/messages/index.d.ts +75 -0
  14. package/messages/index.js +2 -2
  15. package/messages/index.mjs +108 -78
  16. package/package-metadata.js +1 -1
  17. package/package-metadata.mjs +1 -1
  18. package/package.json +19 -19
  19. package/toolbar-tools/GridToolbarAIAssistant.d.ts +2 -34
  20. package/toolbar-tools/GridToolbarAIAssistant.js +2 -2
  21. package/toolbar-tools/GridToolbarAIAssistant.mjs +167 -164
  22. package/toolbar-tools/GridToolbarFilter.mjs +5 -5
  23. package/toolbar-tools/smartbox/SegmentedControl.d.ts +13 -0
  24. package/toolbar-tools/smartbox/SegmentedControl.js +8 -0
  25. package/toolbar-tools/smartbox/SegmentedControl.mjs +109 -0
  26. package/toolbar-tools/smartbox/SmartBox.d.ts +20 -0
  27. package/toolbar-tools/smartbox/SmartBox.js +8 -0
  28. package/toolbar-tools/smartbox/SmartBox.mjs +380 -0
  29. package/toolbar-tools/smartbox/defaultConfigs.d.ts +30 -0
  30. package/toolbar-tools/smartbox/defaultConfigs.js +8 -0
  31. package/toolbar-tools/smartbox/defaultConfigs.mjs +36 -0
  32. package/toolbar-tools/smartbox/hooks/index.d.ts +17 -0
  33. package/toolbar-tools/smartbox/hooks/useDebounce.d.ts +11 -0
  34. package/toolbar-tools/smartbox/hooks/useDebounce.js +9 -0
  35. package/toolbar-tools/smartbox/hooks/useDebounce.mjs +21 -0
  36. package/toolbar-tools/smartbox/hooks/useSmartBoxGridState.d.ts +251 -0
  37. package/toolbar-tools/smartbox/hooks/useSmartBoxGridState.js +9 -0
  38. package/toolbar-tools/smartbox/hooks/useSmartBoxGridState.mjs +68 -0
  39. package/toolbar-tools/smartbox/hooks/useSmartBoxHistory.d.ts +80 -0
  40. package/toolbar-tools/smartbox/hooks/useSmartBoxHistory.js +9 -0
  41. package/toolbar-tools/smartbox/hooks/useSmartBoxHistory.mjs +66 -0
  42. package/toolbar-tools/smartbox/hooks/useSmartBoxInput.d.ts +96 -0
  43. package/toolbar-tools/smartbox/hooks/useSmartBoxLabels.d.ts +93 -0
  44. package/toolbar-tools/smartbox/hooks/useSmartBoxLabels.js +9 -0
  45. package/toolbar-tools/smartbox/hooks/useSmartBoxLabels.mjs +61 -0
  46. package/toolbar-tools/smartbox/hooks/useSmartBoxListData.d.ts +163 -0
  47. package/toolbar-tools/smartbox/hooks/useSmartBoxListData.js +9 -0
  48. package/toolbar-tools/smartbox/hooks/useSmartBoxListData.mjs +102 -0
  49. package/toolbar-tools/smartbox/hooks/useSmartBoxModes.d.ts +115 -0
  50. package/toolbar-tools/smartbox/hooks/useSmartBoxModes.js +9 -0
  51. package/toolbar-tools/smartbox/hooks/useSmartBoxModes.mjs +65 -0
  52. package/toolbar-tools/smartbox/hooks/useSmartBoxPopup.d.ts +56 -0
  53. package/toolbar-tools/smartbox/hooks/useSmartBoxPopup.js +9 -0
  54. package/toolbar-tools/smartbox/hooks/useSmartBoxPopup.mjs +25 -0
  55. package/toolbar-tools/smartbox/hooks/useSmartBoxSearch.d.ts +82 -0
  56. package/toolbar-tools/smartbox/hooks/useSmartBoxSearch.js +9 -0
  57. package/toolbar-tools/smartbox/hooks/useSmartBoxSearch.mjs +67 -0
  58. package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.d.ts +70 -0
  59. package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.js +9 -0
  60. package/toolbar-tools/smartbox/hooks/useSmartBoxSegmentedControl.mjs +57 -0
  61. package/toolbar-tools/smartbox/index.d.ts +10 -0
  62. package/toolbar-tools/smartbox/interfaces/SearchTypes.d.ts +45 -0
  63. package/toolbar-tools/smartbox/interfaces/SegmentedControlTypes.d.ts +66 -0
  64. package/toolbar-tools/smartbox/interfaces/SmartBoxTypes.d.ts +461 -0
  65. package/toolbar-tools/smartbox/interfaces/index.d.ts +11 -0
  66. package/toolbar-tools/smartbox/interfaces/utilTypes.d.ts +25 -0
  67. package/toolbar-tools/smartbox/listItemRenders.d.ts +165 -0
  68. package/toolbar-tools/smartbox/listItemRenders.js +8 -0
  69. package/toolbar-tools/smartbox/listItemRenders.mjs +68 -0
  70. package/toolbar-tools/smartbox/utils.d.ts +14 -0
  71. package/toolbar-tools/smartbox/utils.js +8 -0
  72. package/toolbar-tools/smartbox/utils.mjs +14 -0
@@ -6,200 +6,203 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  import * as o from "react";
9
- import { GridContext as de } from "../utils/GridContext.mjs";
10
- import { Button as pe } from "@progress/kendo-react-buttons";
11
- import { sparklesIcon as me } from "@progress/kendo-svg-icons";
12
- import v from "axios";
13
- import { useLocalization as fe } from "@progress/kendo-react-intl";
14
- import { toolbarAI as S, messages as k, aIResponseData as B, generatedWithAI as D } from "../messages/index.mjs";
15
- import { useCustomComponent as ge, classNames as he } from "@progress/kendo-react-common";
16
- import { Window as Ce } from "@progress/kendo-react-dialogs";
17
- import { GridAIPrompt as Se } from "./ai-tool/GridAIPrompt.mjs";
18
- import { handleAIResponse as ke } from "../utils/handleAIResponse.mjs";
19
- const M = 768, we = (u, w) => u.map((l) => {
20
- let c = l;
21
- return w.forEach((i) => {
22
- i.field && c.includes(i.field) && (c = c.replace(new RegExp(i.field, "g"), i.title || i.field));
23
- }), c;
24
- }), Ie = () => null, Ae = o.forwardRef(
25
- (u, w) => {
26
- const e = o.useContext(de), l = fe(), {
27
- requestUrl: c,
28
- requestOptions: i,
29
- onPromptRequest: y,
30
- onResponseSuccess: P,
31
- onResponseError: I,
32
- role: j = "user",
33
- gridAIPrompt: z = Se,
34
- icon: E,
35
- svgIcon: G,
36
- onCloseWindow: A,
37
- promptPlaceHolder: N,
38
- suggestionsList: q,
39
- streaming: H,
40
- loading: K,
41
- outputs: F,
42
- enableSpeechToText: U
43
- } = u, [R, L] = o.useState([]), X = o.useMemo(() => e && Array.isArray(e.columnsRef) && Array.isArray(e.hiddenColumnsRef) ? [...e.columnsRef, ...e.hiddenColumnsRef].map((t) => {
44
- var n;
9
+ import { GridContext as at } from "../utils/GridContext.mjs";
10
+ import { Button as ut } from "@progress/kendo-react-buttons";
11
+ import { sparklesIcon as ct } from "@progress/kendo-svg-icons";
12
+ import { useLocalization as dt } from "@progress/kendo-react-intl";
13
+ import { aIResponseData as x, messages as m, generatedWithAI as y, toolbarAI as g } from "../messages/index.mjs";
14
+ import { useCustomComponent as mt, classNames as gt } from "@progress/kendo-react-common";
15
+ import { Window as pt } from "@progress/kendo-react-dialogs";
16
+ import { GridAIPrompt as ft } from "./ai-tool/GridAIPrompt.mjs";
17
+ import { useGridAIRequest as ht } from "../hooks/useGridAIRequest.mjs";
18
+ const E = 768, Ct = (a, p) => a.map((i) => {
19
+ let l = i;
20
+ return p.forEach((n) => {
21
+ n.field && l.includes(n.field) && (l = l.replace(new RegExp(n.field, "g"), n.title || n.field));
22
+ }), l;
23
+ }), kt = () => null, It = o.forwardRef(
24
+ (a, p) => {
25
+ const t = o.useContext(at), i = dt(), {
26
+ requestUrl: l,
27
+ requestOptions: n,
28
+ onPromptRequest: v,
29
+ onResponseSuccess: T,
30
+ onResponseError: W,
31
+ role: L = "user",
32
+ gridAIPrompt: B = ft,
33
+ icon: I,
34
+ svgIcon: M,
35
+ onCloseWindow: f,
36
+ promptPlaceHolder: q,
37
+ suggestionsList: O,
38
+ streaming: z,
39
+ loading: D,
40
+ outputs: G,
41
+ enableSpeechToText: N
42
+ } = a, [S, R] = o.useState([]), H = o.useMemo(() => t && Array.isArray(t.columnsRef) && Array.isArray(t.hiddenColumnsRef) ? [...t.columnsRef, ...t.hiddenColumnsRef].map((e) => {
43
+ var s;
45
44
  return {
46
- id: t.id,
47
- field: t.field,
48
- values: (n = t.values) != null ? n : []
45
+ id: e.id,
46
+ field: e.field,
47
+ values: (s = e.values) != null ? s : []
49
48
  };
50
- }) : [], [e]), [Y, p] = o.useState(!1), [_, m] = o.useState(!1), [T, b] = o.useState(!1), [$, J] = o.useState(), [Q, V] = o.useState(), [W, Z] = o.useState(() => {
51
- const t = window.innerWidth;
52
- return t < M ? t * 0.8 : 560;
53
- }), d = o.useRef(null), x = o.useRef(null), ee = (t) => {
54
- t.preventDefault(), b(!T);
55
- }, f = o.useMemo(() => {
56
- var t;
57
- return (t = u.show) != null ? t : T;
58
- }, [u.show, T]), g = o.useCallback(() => {
59
- var t;
60
- A && A(), L([]), b(!1), d.current && ((t = d.current.element) == null || t.focus());
61
- }, [A]), te = (t, n, r) => {
62
- const a = [l.toLanguageString(B, k[B])], s = we([t], e.columnsRef).join(`
63
- `);
64
- L([
65
- {
66
- id: R.length + 1,
67
- title: l.toLanguageString(D, k[D]),
68
- subTitle: n,
69
- prompt: n,
70
- responseContent: a.concat(s).join(""),
71
- isRetry: r
72
- },
73
- ...R
74
- ]);
75
- }, se = (t, n, r) => {
76
- var h, C;
77
- p(!1), m(!1);
78
- const a = {
79
- getTotal: () => e.getTotal(),
80
- getLeafDataItems: () => e.getLeafDataItems(),
81
- exportAsPdf: () => e.exportAsPdf(),
49
+ }) : [], [t]), K = o.useMemo(
50
+ () => ({
51
+ sort: t.sort,
52
+ filter: t.filter,
53
+ group: t.group,
54
+ highlight: t.highlight,
55
+ select: t.select,
56
+ columnsState: t.columnsState,
57
+ skip: t.skip,
58
+ take: t.take
59
+ }),
60
+ [t]
61
+ ), j = o.useMemo(
62
+ () => ({
63
+ getTotal: () => t.getTotal(),
64
+ getLeafDataItems: () => t.getLeafDataItems(),
65
+ exportAsPdf: () => t.exportAsPdf(),
82
66
  props: {
83
- dataItemKey: e.dataItemKey
84
- }
85
- }, s = ke(t, e, a);
86
- s.state.sort !== e.sort && e.sortChange(s.state.sort, t), s.state.filter !== e.filter && e.filterChange(s.state.filter, t), s.state.group !== e.group && e.groupChange(s.state.group, t), s.state.highlight !== e.highlight && e.applyHighlightDescriptor(s.state.highlight), s.state.select !== e.select && e.applySelectionDescriptor(s.state.select), s.state.columnsState !== e.columnsState && e.onColumnsStateChange(s.state.columnsState), (s.state.skip !== e.skip || s.state.take !== e.take) && e.pagerPageChange({
87
- skip: (h = s.state.skip) != null ? h : 0,
88
- take: (C = s.state.take) != null ? C : 0,
89
- syntheticEvent: t
90
- }), s.shouldExportPdf && e.exportAsPdf(), s.messages.length > 0 && s.messages.forEach((ue) => {
91
- te(ue, n, r);
92
- }), P && P(t, n, r);
93
- }, oe = (t) => {
94
- I == null || I(t), p(!1), m(!1);
95
- }, ne = (t, n) => {
96
- const r = v.CancelToken.source(), a = {
97
- role: j || "user",
98
- columns: X || [],
99
- headers: {
100
- Accept: "*/*",
101
- "Content-Type": "application/json"
102
- },
103
- promptMessage: t,
104
- requestOptions: {
105
- url: c,
106
- method: "POST",
107
- withCredentials: !1,
108
- responseType: "json",
109
- cancelToken: r.token,
110
- ...i
67
+ dataItemKey: t.dataItemKey
111
68
  }
112
- };
113
- if (y && y(a, n), a.requestOptions.url !== void 0) {
114
- p(!0), m(!0);
115
- const { url: s, ...h } = a.requestOptions;
116
- s && (v(s, {
117
- ...h,
118
- headers: a.headers,
119
- data: {
120
- columns: a.columns,
121
- contents: [{ text: a.promptMessage }]
122
- },
123
- responseType: "json"
124
- // Ensure correct type
125
- }).then((C) => se(C, a.promptMessage, n)).catch(oe), x.current = r);
126
- }
127
- }, ae = o.useCallback(() => {
128
- x.current && x.current.cancel("Request cancelled by user."), p(!1), m(!1);
129
- }, []), [re, O] = ge(
130
- z
131
- ), ie = Object.keys(O).length > 0 ? O : {}, le = /* @__PURE__ */ o.createElement(
132
- re,
69
+ }),
70
+ [t]
71
+ ), [h, C] = o.useState(!1), [F, U] = o.useState(), [X, Y] = o.useState(), [A, _] = o.useState(() => {
72
+ const e = window.innerWidth;
73
+ return e < E ? e * 0.8 : 560;
74
+ }), u = o.useRef(null), $ = o.useCallback(
75
+ (e) => {
76
+ var s, r;
77
+ e.sort !== void 0 && e.sort !== t.sort && t.sortChange(e.sort, {}), e.filter !== t.filter && t.filterChange(e.filter, {}), e.group !== void 0 && e.group !== t.group && t.groupChange(e.group, {}), e.highlight !== void 0 && e.highlight !== t.highlight && t.applyHighlightDescriptor(e.highlight), e.select !== void 0 && e.select !== t.select && t.applySelectionDescriptor(e.select), e.columnsState !== void 0 && e.columnsState !== t.columnsState && t.onColumnsStateChange(e.columnsState), (e.skip !== void 0 && e.skip !== t.skip || e.take !== void 0 && e.take !== t.take) && t.pagerPageChange({
78
+ skip: (s = e.skip) != null ? s : 0,
79
+ take: (r = e.take) != null ? r : 0,
80
+ syntheticEvent: {}
81
+ });
82
+ },
83
+ [t]
84
+ ), w = o.useCallback(
85
+ (e, s, r) => {
86
+ const k = [i.toLanguageString(x, m[x])];
87
+ e.forEach((rt) => {
88
+ const lt = Ct([rt], t.columnsRef).join(`
89
+ `);
90
+ R((P) => [
91
+ {
92
+ id: P.length + 1,
93
+ title: i.toLanguageString(y, m[y]),
94
+ subTitle: s,
95
+ prompt: s,
96
+ responseContent: k.concat(lt).join(""),
97
+ isRetry: r
98
+ },
99
+ ...P
100
+ ]);
101
+ });
102
+ },
103
+ [i, t.columnsRef]
104
+ ), J = o.useCallback(() => {
105
+ t.exportAsPdf();
106
+ }, [t]), {
107
+ loading: Q,
108
+ streaming: V,
109
+ sendRequest: Z,
110
+ cancelRequest: tt
111
+ } = ht({
112
+ requestUrl: l,
113
+ requestOptions: n,
114
+ role: L,
115
+ columns: H,
116
+ gridState: K,
117
+ gridRef: j,
118
+ onPromptRequest: v,
119
+ onResponseSuccess: T,
120
+ onResponseError: W,
121
+ onStateChange: $,
122
+ onMessages: w,
123
+ onExportPdf: J
124
+ }), et = (e) => {
125
+ e.preventDefault(), C(!h);
126
+ }, c = o.useMemo(() => {
127
+ var e;
128
+ return (e = a.show) != null ? e : h;
129
+ }, [a.show, h]), d = o.useCallback(() => {
130
+ var e;
131
+ f && f(), R([]), C(!1), u.current && ((e = u.current.element) == null || e.focus());
132
+ }, [f]), [ot, b] = mt(
133
+ B
134
+ ), st = Object.keys(b).length > 0 ? b : {}, it = /* @__PURE__ */ o.createElement(
135
+ ot,
133
136
  {
134
- onPromptRequest: ne,
135
- onCancel: ae,
136
- onClose: g,
137
- streaming: H || Y,
138
- loading: K || _,
139
- outputs: F || R,
140
- promptPlaceHolder: N,
141
- suggestionsList: q,
142
- enableSpeechToText: U,
143
- ...ie
137
+ onPromptRequest: Z,
138
+ onCancel: tt,
139
+ onClose: d,
140
+ streaming: z || V,
141
+ loading: D || Q,
142
+ outputs: G || S,
143
+ promptPlaceHolder: q,
144
+ suggestionsList: O,
145
+ enableSpeechToText: N,
146
+ ...st
144
147
  }
145
- ), ce = /* @__PURE__ */ o.createElement(
146
- pe,
148
+ ), nt = /* @__PURE__ */ o.createElement(
149
+ ut,
147
150
  {
148
- ref: d,
151
+ ref: u,
149
152
  togglable: !0,
150
153
  themeColor: "primary",
151
154
  rounded: "full",
152
- selected: f,
153
- svgIcon: G || (E ? void 0 : me),
154
- icon: E,
155
- size: e.mobileMode ? "large" : "medium",
156
- className: he("k-toolbar-button", { "k-icon-button": e.mobileMode }),
157
- title: l.toLanguageString(S, k[S]),
158
- onClick: ee
155
+ selected: c,
156
+ svgIcon: M || (I ? void 0 : ct),
157
+ icon: I,
158
+ size: t.mobileMode ? "large" : "medium",
159
+ className: gt("k-toolbar-button", { "k-icon-button": t.mobileMode }),
160
+ title: i.toLanguageString(g, m[g]),
161
+ onClick: et
159
162
  }
160
163
  );
161
164
  return o.useEffect(() => {
162
- var t;
163
- if (d.current && f) {
164
- const n = (t = d.current.element) == null ? void 0 : t.getBoundingClientRect();
165
- if (n) {
166
- J(n.top + window.scrollY + n.height), V(n.left + window.scrollX + n.width);
167
- const r = window.innerWidth, a = r < M ? r * 0.75 : 560;
168
- Z(a);
165
+ var e;
166
+ if (u.current && c) {
167
+ const s = (e = u.current.element) == null ? void 0 : e.getBoundingClientRect();
168
+ if (s) {
169
+ U(s.top + window.scrollY + s.height), Y(s.left + window.scrollX + s.width);
170
+ const r = window.innerWidth, k = r < E ? r * 0.75 : 560;
171
+ _(k);
169
172
  }
170
173
  }
171
- }, [f]), o.useImperativeHandle(
172
- w,
174
+ }, [c]), o.useImperativeHandle(
175
+ p,
173
176
  () => ({
174
- show: () => b(!0),
175
- hide: () => g()
177
+ show: () => C(!0),
178
+ hide: () => d()
176
179
  }),
177
- [g]
178
- ), /* @__PURE__ */ o.createElement(o.Fragment, null, ce, f && /* @__PURE__ */ o.createElement(
179
- Ce,
180
+ [d]
181
+ ), /* @__PURE__ */ o.createElement(o.Fragment, null, nt, c && /* @__PURE__ */ o.createElement(
182
+ pt,
180
183
  {
181
- key: W,
184
+ key: A,
182
185
  autoFocus: !1,
183
- title: l.toLanguageString(S, k[S]),
184
- initialTop: $,
185
- initialLeft: Q,
186
- initialWidth: W,
186
+ title: i.toLanguageString(g, m[g]),
187
+ initialTop: F,
188
+ initialLeft: X,
189
+ initialWidth: A,
187
190
  style: {
188
191
  height: "auto",
189
192
  minWidth: "90px",
190
193
  minHeight: "50px"
191
194
  },
192
- onClose: g,
195
+ onClose: d,
193
196
  resizable: !0,
194
197
  draggable: !0,
195
198
  className: "k-grid-assistant-window",
196
- maximizeButton: Ie
199
+ maximizeButton: kt
197
200
  },
198
- le
201
+ it
199
202
  ));
200
203
  }
201
204
  );
202
- Ae.displayName = "KendoReactGridToolbarAIAssistant";
205
+ It.displayName = "KendoReactGridToolbarAIAssistant";
203
206
  export {
204
- Ae as GridToolbarAIAssistant
207
+ It as GridToolbarAIAssistant
205
208
  };
@@ -13,7 +13,7 @@ import { GridColumnMenuItemContent as je } from "../columnMenu/GridColumnMenuIte
13
13
  import { GridColumnMenuItemGroup as qe } from "../columnMenu/GridColumnMenuItemGroup.mjs";
14
14
  import { GridContext as Je } from "../utils/GridContext.mjs";
15
15
  import { filterIcon as me, filterClearIcon as Qe } from "@progress/kendo-svg-icons";
16
- import { getFilterType as de, operatorMap as V, booleanFilterValues as We, filterLogicList as Xe, defaultHideSecondFilter as Ye, IsUnaryFilter as b, getDefaultOperator as Ze } from "../filterCommon.mjs";
16
+ import { getFilterType as de, operatorMap as V, defaultHideSecondFilter as We, IsUnaryFilter as b, getDefaultOperator as Xe, filterLogicList as Ye, booleanFilterValues as Ze } from "../filterCommon.mjs";
17
17
  import { Button as k } from "@progress/kendo-react-buttons";
18
18
  import { GridColumnMenuFilterUI as $e } from "../columnMenu/GridColumnMenuFilterUI.mjs";
19
19
  import { toolbarFilter as M, messages as F, filterSubmitButton as ge, filterClearButton as pe, filterClearAllButton as he } from "../messages/index.mjs";
@@ -49,7 +49,7 @@ const nt = (c) => {
49
49
  var o, i, l, s, ce, ue;
50
50
  let e;
51
51
  if (r != null && r.current && ((o = r == null ? void 0 : r.current) != null && o.field)) {
52
- const Ge = de((i = r == null ? void 0 : r.current) == null ? void 0 : i.filter), v = Ze(n.filterOperators, Ge);
52
+ const Ge = de((i = r == null ? void 0 : r.current) == null ? void 0 : i.filter), v = Xe(n.filterOperators, Ge);
53
53
  e = Re((l = r == null ? void 0 : r.current) == null ? void 0 : l.field, n.filter), e = e ? {
54
54
  ...e,
55
55
  filters: e.filters.map((O) => ({ ...O }))
@@ -90,7 +90,7 @@ const nt = (c) => {
90
90
  ...u,
91
91
  filters: i
92
92
  });
93
- }, [u, B] = t.useState(q()), a = u == null ? void 0 : u.filters, C = de((re = r == null ? void 0 : r.current) == null ? void 0 : re.filter), A = V(n.filterOperators[C], f), Q = V(We, f), ke = {
93
+ }, [u, B] = t.useState(q()), a = u == null ? void 0 : u.filters, C = de((re = r == null ? void 0 : r.current) == null ? void 0 : re.filter), A = V(n.filterOperators[C], f), Q = V(Ze, f), ke = {
94
94
  field: (oe = r == null ? void 0 : r.current) == null ? void 0 : oe.field,
95
95
  value: a == null ? void 0 : a[0].value,
96
96
  operator: a == null ? void 0 : a[0].operator,
@@ -109,11 +109,11 @@ const nt = (c) => {
109
109
  }, we = (e) => {
110
110
  let o = e.target.value;
111
111
  e.target.tagName === "SPAN" && (o = e.target.parentElement.value), B({ ...u, logic: o });
112
- }, W = u == null ? void 0 : u.logic, X = V(Xe, f), T = {
112
+ }, W = u == null ? void 0 : u.logic, X = V(Ye, f), T = {
113
113
  value: X.find((e) => e.operator === (W === null ? "" : W)),
114
114
  onChange: we,
115
115
  data: X
116
- }, Se = c.hideSecondFilter !== void 0 ? c.hideSecondFilter : Ye[C], N = c.filterUI, L = {
116
+ }, Se = c.hideSecondFilter !== void 0 ? c.hideSecondFilter : We[C], N = c.filterUI, L = {
117
117
  firstFilterProps: ke,
118
118
  secondFilterProps: Me,
119
119
  logicData: T.data,
@@ -0,0 +1,13 @@
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>>;
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,109 @@
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 * as e from "react";
9
+ import { kendoThemeMaps as x, classNames as g, IconWrap as T } from "@progress/kendo-react-common";
10
+ const $ = void 0, w = e.forwardRef((S, y) => {
11
+ const { buttons: v = [], size: b = $, stretched: E } = S, R = b ? x.sizeMap[b] : void 0, a = e.useRef(null), I = e.useRef(null), [N, m] = e.useState({}), r = e.useCallback(() => {
12
+ const t = a.current, s = I.current;
13
+ if (!t || !s)
14
+ return;
15
+ const o = t.querySelector(".k-segmented-control-button.k-selected");
16
+ if (!o)
17
+ return;
18
+ const d = t.offsetWidth, l = o.offsetWidth, i = o.offsetLeft;
19
+ s.style.left = `${i}px`, s.style.right = `${d - i - l}px`;
20
+ }, []);
21
+ return e.useLayoutEffect(() => {
22
+ r();
23
+ }, [v, r]), e.useEffect(() => {
24
+ const t = a.current;
25
+ if (!t)
26
+ return;
27
+ const s = new ResizeObserver(() => {
28
+ r();
29
+ });
30
+ return s.observe(t), () => {
31
+ s.disconnect();
32
+ };
33
+ }, [r]), e.useImperativeHandle(
34
+ y,
35
+ () => ({
36
+ element: a.current
37
+ }),
38
+ []
39
+ ), /* @__PURE__ */ e.createElement(
40
+ "div",
41
+ {
42
+ ref: a,
43
+ className: g("k-segmented-control", R && `k-segmented-control-${R}`, {
44
+ "k-segmented-control-stretched": E
45
+ })
46
+ },
47
+ /* @__PURE__ */ e.createElement("div", { className: "k-segmented-control-thumb", ref: I, "aria-hidden": "true" }),
48
+ v.map(
49
+ ({
50
+ buttonId: t,
51
+ disabled: s,
52
+ text: o,
53
+ svgIcon: d,
54
+ selected: l,
55
+ accentIcon: i,
56
+ type: z = "button",
57
+ onClick: f,
58
+ onMouseEnter: u,
59
+ onMouseLeave: h,
60
+ onFocus: k,
61
+ onBlur: p,
62
+ ...W
63
+ }) => /* @__PURE__ */ e.createElement(
64
+ "button",
65
+ {
66
+ key: t,
67
+ type: z,
68
+ className: g("k-segmented-control-button", {
69
+ "k-selected": l,
70
+ "k-hover": N.hoveredId === t && !s,
71
+ "k-focus": N.focusedId === t && !s,
72
+ "k-disabled": s
73
+ }),
74
+ disabled: s,
75
+ onClick: (n) => {
76
+ f == null || f(n), r();
77
+ },
78
+ onMouseEnter: (n) => {
79
+ m((c) => ({ ...c, hoveredId: t })), u == null || u(n);
80
+ },
81
+ onMouseLeave: (n) => {
82
+ m((c) => ({ ...c, hoveredId: void 0 })), h == null || h(n);
83
+ },
84
+ onFocus: (n) => {
85
+ m((c) => ({ ...c, focusedId: t })), k == null || k(n);
86
+ },
87
+ onBlur: (n) => {
88
+ m((c) => ({ ...c, focusedId: void 0 })), p == null || p(n);
89
+ },
90
+ ...W
91
+ },
92
+ d && /* @__PURE__ */ e.createElement(
93
+ T,
94
+ {
95
+ className: g("k-segmented-control-button-icon", {
96
+ "k-accent-icon": l && i
97
+ }),
98
+ icon: d
99
+ }
100
+ ),
101
+ /* @__PURE__ */ e.createElement("span", { className: "k-segmented-control-button-text" }, o)
102
+ )
103
+ )
104
+ );
105
+ });
106
+ w.displayName = "KendoReactSegmentedControl";
107
+ export {
108
+ w as SegmentedControl
109
+ };
@@ -0,0 +1,20 @@
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 { GridSmartBoxAIAssistantProps } from './interfaces/index.js';
9
+ import * as React from 'react';
10
+ export interface SmartBoxPopupHandle {
11
+ /**
12
+ * Shows the SmartBox popup.
13
+ */
14
+ show: () => void;
15
+ /**
16
+ * Hides the SmartBox popup.
17
+ */
18
+ hide: () => void;
19
+ }
20
+ export declare const SmartBox: React.ForwardRefExoticComponent<GridSmartBoxAIAssistantProps & React.RefAttributes<SmartBoxPopupHandle>>;
@@ -0,0 +1,8 @@
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 Ze=require("react"),et=require("./SegmentedControl.js"),de=require("@progress/kendo-react-buttons"),K=require("@progress/kendo-svg-icons"),d=require("@progress/kendo-react-common"),tt=require("@progress/kendo-react-intl"),nt=require("../../hooks/useGridAIRequest.js"),st=require("../../utils/GridContext.js"),_=require("@progress/kendo-react-dropdowns"),rt=require("@progress/kendo-react-popup"),I=require("./listItemRenders.js"),o=require("../../messages/index.js"),at=require("./hooks/useSmartBoxModes.js"),ot=require("./hooks/useSmartBoxHistory.js"),ct=require("./hooks/useSmartBoxPopup.js"),it=require("./hooks/useSmartBoxGridState.js"),lt=require("./hooks/useSmartBoxLabels.js"),ut=require("./hooks/useSmartBoxListData.js"),pt=require("./hooks/useSmartBoxSegmentedControl.js"),dt=require("./hooks/useSmartBoxSearch.js"),mt=require("./hooks/useDebounce.js");function gt(m){const x=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(m){for(const S in m)if(S!=="default"){const q=Object.getOwnPropertyDescriptor(m,S);Object.defineProperty(x,S,q.get?q:{enumerable:!0,get:()=>m[S]})}}return x.default=m,Object.freeze(x)}const e=gt(Ze),me=e.forwardRef((m,x)=>{var ue;const{searchConfig:S,semanticSearchConfig:q,aiAssistantConfig:ge,activeMode:he,dir:fe="ltr",size:M="medium",placeholder:Se,history:ke,loading:xe=!1,promptSuggestionRender:A,historyItemRender:J,onOpen:be,onClose:Ce,onFocus:v,onBlur:P,onSearch:Be,onSemanticSearch:Re,onAIPromptRequest:N,onAIResponseSuccess:F,onAIResponseError:O,onAICancelRequest:D}=m,b=tt.useLocalization(),C=e.useContext(st.GridContext),Ie=e.useRef(`k-${d.guid()}`),g=e.useRef(null),B=e.useRef(null),Q=e.useRef(null),[c,h]=e.useState(""),[qe,w]=e.useState(!1),[ve,Pe]=e.useState(void 0),[De,X]=e.useState(null),{searchMode:i,semanticSearchMode:u,aiAssistantMode:r,selectedView:n,setSelectedViewState:z,lastSearchMode:we,searchHistorySettings:Y,semanticSearchHistorySettings:Z,aiAssistantHistorySettings:G,speechToTextButtonSettings:ee,currentSearchDelay:ye}=at.useSmartBoxModes({searchConfigProp:S,semanticSearchConfigProp:q,aiAssistantConfigProp:ge,activeModeProp:he,sharedHistory:ke}),{currentHistory:y,currentHistorySettings:Ee,addToHistory:V}=ot.useSmartBoxHistory({selectedView:n,searchHistorySettings:Y,semanticSearchHistorySettings:Z,aiAssistantHistorySettings:G}),{isOpen:R,togglePopup:a}=ct.useSmartBoxPopup({onOpen:be,onClose:Ce}),{columns:te,gridState:Le,gridRef:Te,handleStateChange:He}=it.useSmartBoxGridState(C),W=e.useMemo(()=>(r==null?void 0:r.promptSuggestions)||[],[r==null?void 0:r.promptSuggestions]),{inputPlaceholder:Ne,prefixIcon:Fe}=lt.useSmartBoxLabels({selectedView:n,searchMode:i,semanticSearchMode:u,aiAssistantMode:r,sharedPlaceholder:Se}),{searchListData:k,aiAssistantListData:E,searchHistoryListData:L}=ut.useSmartBoxListData({selectedView:n,searchModeEnabled:i==null?void 0:i.enabled,semanticSearchModeEnabled:u==null?void 0:u.enabled,promptSuggestions:W,currentHistory:y,currentHistorySettings:Ee}),ne=pt.useSmartBoxSegmentedControl({searchMode:i,semanticSearchMode:u,aiAssistantMode:r,selectedView:n,lastSearchMode:we,setSelectedViewState:z,setInputValue:h});e.useEffect(()=>{R&&g.current&&Pe(g.current.offsetWidth)},[R]);const f=xe||qe,j=!n,Oe=!(i!=null&&i.enabled)&&!(u!=null&&u.enabled)&&!(r!=null&&r.enabled),ze=d.kendoThemeMaps.sizeMap[M]||"md",{emitSearchEvent:p}=dt.useSmartBoxSearch({selectedView:n,searchMode:i,columns:te,gridContext:C,searchHistorySettings:Y,semanticSearchHistorySettings:Z,addToHistory:V,onSearch:Be,onSemanticSearch:Re}),{sendRequest:se,cancelRequest:re}=nt.useGridAIRequest({requestUrl:r==null?void 0:r.requestUrl,requestOptions:r==null?void 0:r.requestOptions,columns:te,gridState:Le,gridRef:Te,onPromptRequest:t=>{N==null||N({requestData:t})},onResponseSuccess:t=>{w(!1),F==null||F({response:t})},onResponseError:t=>{w(!1),O==null||O({error:t})},onStateChange:He,onExportPdf:()=>C==null?void 0:C.exportAsPdf()});e.useImperativeHandle(x,()=>({show:()=>a(!0),hide:()=>a(!1)}),[a]);const U=mt.useDebounce(De,ye),ae=e.useRef(p);ae.current=p,e.useEffect(()=>{U!==null&&ae.current(U)},[U]);const Ge=e.useCallback(t=>{const s=t.target.value;h(s),a(!s),(n==="search"||n==="semanticSearch")&&X(s)},[a,n]),Ve=e.useCallback(()=>{v==null||v(),c||a(!0)},[v,a,c]),We=e.useCallback(t=>{var pe;const s=g.current,l=(pe=Q.current)==null?void 0:pe.element,H=t.relatedTarget,Xe=H&&(s==null?void 0:s.contains(H)),Ye=H&&(l==null?void 0:l.contains(H));!Xe&&!Ye&&(P==null||P(),a(!1))},[P,a]),je=e.useCallback(()=>{c||a(!0)},[a,c]),oe=!!((ue=r==null?void 0:r.requestOptions)!=null&&ue.url||r!=null&&r.requestUrl),$=e.useCallback(()=>{if(f){D==null||D(),re(),w(!1);return}c.trim()&&(oe&&w(!0),V("aiAssistant",c,G),a(!1),se(c.trim()),h(""))},[f,c,G,a,V,se,re,oe,D]),Ue=e.useCallback(t=>{t.key==="Enter"&&(n==="aiAssistant"?$():n==="semanticSearch"&&p(c))},[n,c,p,$]),$e=e.useCallback(()=>{var t;a(!R),(t=B.current)==null||t.focus()},[R,a]),Ke=e.useCallback(t=>{var s;t.stopPropagation(),t.preventDefault(),h(""),(s=B.current)==null||s.focus(),a(!0),p("")},[a,p]),ce=e.useCallback(t=>{var s;z(t),h(""),X(null),(s=B.current)==null||s.focus()},[z]),T=e.useCallback(t=>{var s;h(t),a(!1),(s=B.current)==null||s.focus(),n!=="aiAssistant"&&p(t)},[n,a,p]),_e=e.useCallback(t=>{if(t.isFinal&&t.alternatives.length>0){const s=t.alternatives[0].transcript;h(l=>l?`${l} ${s}`:s)}},[]),Me=e.useMemo(()=>n==="aiAssistant"?y.length===0&&W.length===0:n==="search"||n==="semanticSearch"?y.length===0&&k.length===0:!1,[n,y.length,W.length,k.length]),ie=e.useCallback(t=>{const l=(n==="aiAssistant"?E:L)[t];l&&T(l.text)},[n,E,L,T]),Ae=e.useCallback(t=>{const s=k[t];s&&ce(s.mode)},[k,ce]),le=e.useMemo(()=>I.createListItemRender({historyItemRender:J,promptSuggestionRender:A,handleListItemClick:T}),[J,A,T]),Je=R&&!Oe,Qe=()=>e.createElement(e.Fragment,null,ne.length>0&&e.createElement(et.SegmentedControl,{buttons:ne,size:M,stretched:!0}),(n==="search"||n==="semanticSearch")&&k.length>0&&e.createElement(_.List,{data:k,textField:"text",descriptionField:"description",onClick:Ae,itemRender:I.searchModeItemRender,show:!0,wrapperCssClass:"k-list k-list-md"}),n==="aiAssistant"&&E.length>0&&e.createElement(_.List,{data:E,textField:"text",groupField:"group",svgIconField:"groupSvgIcon",descriptionField:"description",onClick:ie,itemRender:le,groupHeaderItemRender:I.listGroupHeaderRender,showFirstGroupHeader:!0,show:!0,wrapperCssClass:"k-list k-list-md"}),(n==="search"||n==="semanticSearch")&&L.length>0&&e.createElement(_.List,{data:L,textField:"text",groupField:"group",svgIconField:"groupSvgIcon",descriptionField:"description",onClick:ie,itemRender:le,groupHeaderItemRender:I.listGroupHeaderRender,showFirstGroupHeader:!0,show:!0,wrapperCssClass:"k-list k-list-md"}),Me&&e.createElement(I.NoDataRender,{selectedView:n}));return e.createElement("div",{ref:g,className:"k-smart-box-wrapper",dir:fe,onBlur:We},e.createElement("span",{className:d.classNames("k-smart-box","k-input",`k-input-${ze}`,{"k-loading":f})},!j&&e.createElement("span",{className:"k-input-prefix k-input-prefix-horizontal"},e.createElement(d.IconWrap,{className:d.classNames("k-icon",{"k-accent-icon":n==="aiAssistant"||n==="semanticSearch"}),icon:Fe.svgIcon,onClick:$e,onMouseDown:t=>{"preventDefault"in t&&t.preventDefault()}})),e.createElement("input",{ref:B,type:"text",className:d.classNames("k-input-inner",{"k-disabled":j}),id:Ie.current,placeholder:Ne,value:c,disabled:j,onChange:Ge,onFocus:Ve,onClick:je,onKeyDown:Ue}),c.length>0&&(n==="search"||n==="semanticSearch")&&e.createElement("span",{className:"k-clear-value",title:b.toLanguageString(o.smartBoxClearTitle,o.messages[o.smartBoxClearTitle]),role:"button",tabIndex:-1,onClick:Ke,onMouseDown:t=>t.preventDefault()},e.createElement(d.IconWrap,{className:"k-icon",icon:K.xIcon})),n==="aiAssistant"&&e.createElement("span",{className:"k-input-suffix k-input-suffix-horizontal"},ee&&e.createElement(de.SpeechToTextButton,{...ee,"aria-label":b.toLanguageString(o.smartBoxSpeechToTextButton,o.messages[o.smartBoxSpeechToTextButton]),title:b.toLanguageString(o.smartBoxSpeechToTextButton,o.messages[o.smartBoxSpeechToTextButton]),onResult:_e}),e.createElement(de.Button,{className:d.classNames("k-smart-box-send",{"k-processing":f,"k-active":f}),type:"button",rounded:"full",size:"small",title:b.toLanguageString(o.smartBoxSubmitPromptButton,o.messages[o.smartBoxSubmitPromptButton]),"aria-label":b.toLanguageString(o.smartBoxSubmitPromptButton,o.messages[o.smartBoxSubmitPromptButton]),"aria-disabled":c.length===0,svgIcon:f?K.stopSmIcon:K.arrowUpOutlineIcon,disabled:c.length===0&&!f,onClick:$}))),e.createElement(rt.Popup,{ref:Q,anchor:g.current,show:Je,popupClass:"k-smart-box-popup",style:{width:ve},anchorAlign:{horizontal:"left",vertical:"bottom"},popupAlign:{horizontal:"left",vertical:"top"},margin:{horizontal:0,vertical:2},onMouseDownOutside:t=>{const s=t.event.target;g.current&&!g.current.contains(s)&&a(!1)}},Qe()))});me.displayName="KendoReactSmartBox";exports.SmartBox=me;