@progress/kendo-react-grid 13.2.0-develop.7 → 13.2.0-develop.8

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.
@@ -5,340 +5,201 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as l from "react";
9
- import { GridContext as be } from "../utils/GridContext.mjs";
10
- import { Button as Pe } from "@progress/kendo-react-buttons";
11
- import { sparklesIcon as Re } from "@progress/kendo-svg-icons";
12
- import W from "axios";
13
- import { useLocalization as we } from "@progress/kendo-react-intl";
14
- import { toolbarAI as k, messages as m, aIResponseData as B, generatedWithAI as j } from "../messages/index.mjs";
15
- import { useCustomComponent as xe, classNames as ye } from "@progress/kendo-react-common";
16
- import { Window as Te } from "@progress/kendo-react-dialogs";
17
- import { GridAIPrompt as ve } from "./ai-tool/GridAIPrompt.mjs";
18
- import { combineSmartFilters as ze } from "../filterCommon.mjs";
19
- const I = 768;
20
- var Ee = /* @__PURE__ */ ((a) => (a.GridClearFilter = "GridClearFilter", a.GridClearSort = "GridClearSort", a.GridClearGroup = "GridClearGroup", a.GridClearHighlight = "GridClearHighlight", a.GridClearSelect = "GridClearSelect", a.GridSort = "GridSort", a.GridFilter = "GridFilter", a.GridGroup = "GridGroup", a.GridHighlight = "GridHighlight", a.GridSelect = "GridSelect", a.GridExportPDF = "GridExportPDF", a.GridColumnResize = "GridColumnResize", a.GridColumnHide = "GridColumnHide", a.GridColumnShow = "GridColumnShow", a.GridColumnReorder = "GridColumnReorder", a.GridColumnLock = "GridColumnLock", a.GridColumnUnlock = "GridColumnUnlock", a.GridPage = "GridPage", a.GridPageSize = "GridPageSize", a))(Ee || {});
21
- const Le = (a, b) => a.map((p) => {
22
- let g = p;
23
- return b.forEach((d) => {
24
- d.field && g.includes(d.field) && (g = g.replace(new RegExp(d.field, "g"), d.title || d.field));
25
- }), g;
26
- }), Fe = () => null, Me = l.forwardRef(
27
- (a, b) => {
28
- const t = l.useContext(be), p = we(), {
29
- requestUrl: g,
30
- requestOptions: d,
31
- onPromptRequest: v,
32
- onResponseSuccess: z,
33
- onResponseError: P,
34
- role: N = "user",
35
- gridAIPrompt: A = ve,
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,
36
34
  icon: E,
37
- svgIcon: U,
38
- onCloseWindow: R,
39
- promptPlaceHolder: K,
40
- suggestionsList: V,
41
- streaming: X,
42
- loading: Y,
43
- outputs: _,
44
- enableSpeechToText: $
45
- } = a, [w, L] = l.useState([]), J = l.useMemo(() => t && Array.isArray(t.columnsRef) && Array.isArray(t.hiddenColumnsRef) ? [...t.columnsRef, ...t.hiddenColumnsRef].map((e) => {
46
- var r;
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;
47
45
  return {
48
- id: e.id,
49
- field: e.field,
50
- values: (r = e.values) != null ? r : []
46
+ id: t.id,
47
+ field: t.field,
48
+ values: (n = t.values) != null ? n : []
51
49
  };
52
- }) : [], [t]), [Q, h] = l.useState(!1), [Z, C] = l.useState(!1), [x, y] = l.useState(!1), [q, ee] = l.useState(), [te, re] = l.useState(), [F, oe] = l.useState(() => {
53
- const e = window.innerWidth;
54
- return e < I ? e * 0.8 : 560;
55
- }), f = l.useRef(null), T = l.useRef(null), ne = (e) => {
56
- e.preventDefault(), y(!x);
57
- }, S = l.useMemo(() => {
58
- var e;
59
- return (e = a.show) != null ? e : x;
60
- }, [a.show, x]), G = l.useCallback(() => {
61
- var e;
62
- R && R(), L([]), y(!1), f.current && ((e = f.current.element) == null || e.focus());
63
- }, [R]), ie = (e, r) => {
64
- var i;
65
- if (t.sortable && e) {
66
- const o = Array.isArray(e) ? e : [e];
67
- if (o.length === 0)
68
- t.sortChange([], r);
69
- else {
70
- const u = ((i = t.sort) != null ? i : []).filter(
71
- (n) => !o.some((c) => c.field === n.field)
72
- );
73
- u.push(...o), t.sortChange(u, r);
74
- }
75
- }
76
- }, se = (e, r) => {
77
- if (!e)
78
- return;
79
- const i = ze(
80
- {
81
- logic: e.logic ? e.logic : "and",
82
- filters: e.filters
83
- },
84
- t.filter
85
- );
86
- t.filterChange(i, r);
87
- }, ae = (e, r) => {
88
- var o;
89
- if (!e)
90
- return;
91
- const i = Array.isArray(e) ? e : [e];
92
- if (i.length === 0)
93
- t.groupChange([], r);
94
- else {
95
- const u = ((o = t.group) != null ? o : []).filter(
96
- (n) => !i.some((c) => c.field === n.field)
97
- );
98
- u.push(...i), t.groupChange(u, r);
99
- }
100
- }, le = (e, r, i) => {
101
- const o = [p.toLanguageString(B, m[B])], s = Le([e], t.columnsRef).join(`
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(`
102
63
  `);
103
64
  L([
104
65
  {
105
- id: w.length + 1,
106
- title: p.toLanguageString(j, m[j]),
107
- subTitle: r,
108
- prompt: r,
109
- responseContent: o.concat(s).join(""),
110
- isRetry: i
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
111
72
  },
112
- ...w
73
+ ...R
113
74
  ]);
114
- }, ue = (e, r, i) => {
115
- const o = t.columnsRef.findIndex((s) => s.id === e);
116
- t.reorderable && t.columnReorder(o, r, i);
117
- }, M = (e, r) => {
118
- const i = t.columnsState.findIndex((s) => s.id === e), o = t.columnsState.map(
119
- (s) => s.id === e ? { ...s, hidden: r } : s
120
- );
121
- i !== -1 && t.onColumnsStateChange(o);
122
- }, H = (e, r) => {
123
- const i = t.columnsRef.findIndex((s) => s.id === e), o = t.columnsState.map(
124
- (s) => s.id === e ? { ...s, locked: r } : s
125
- );
126
- i !== -1 && t.onColumnsStateChange(o);
127
- }, ce = (e, r, i) => {
128
- const o = t.columnsRef.findIndex((n) => n.id === e), s = t.columnsState[o], u = t.columnsState.map(
129
- (n) => n.id === e ? { ...n, width: parseFloat(r) } : n
130
- );
131
- o !== -1 && t.onResize(
132
- o,
133
- // index: number
134
- parseFloat(r),
135
- // newWidth: 200
136
- parseFloat(s.width) || 0,
137
- // oldWidth: current width
138
- i,
139
- // nativeEvent: mock event
140
- !0,
141
- // end: true (resize is complete)
142
- u,
143
- // colState: current columns state
144
- e
145
- // targetId: column ID
146
- );
147
- }, de = (e, r) => {
148
- var c, O;
149
- if (!t.pageable)
150
- return;
151
- const i = t.getLeafDataItems().length, o = Math.max(1, Math.floor(e)), s = t.getTotal(), u = Math.floor((O = (c = t.take) != null ? c : t.pageSize) != null ? O : i), n = Math.floor((o - 1) * u);
152
- n < s && t.pagerPageChange({
153
- skip: n,
154
- take: u,
155
- syntheticEvent: r
156
- });
157
- }, pe = (e, r) => {
158
- var c;
159
- if (!t.pageable)
160
- return;
161
- const i = Math.max(1, Math.floor(e)), o = t.skip || 0, s = (c = t.take) != null ? c : 0, u = Math.floor(o / s);
162
- let n = 0;
163
- s > 0 && (n = Math.max(0, u * i)), t.pagerPageChange({
164
- skip: n,
165
- take: i,
166
- syntheticEvent: r
167
- });
168
- }, ge = (e, r, i) => {
169
- var o, s, u;
170
- h(!1), C(!1), (o = e == null ? void 0 : e.data) == null || o.commands.forEach((n) => {
171
- switch (n.type) {
172
- case "GridSort":
173
- ie(n.sort, e);
174
- break;
175
- case "GridFilter":
176
- se(n.filter, e);
177
- break;
178
- case "GridHighlight":
179
- t.applyHighlightDescriptor([n.highlight]);
180
- break;
181
- case "GridGroup":
182
- ae(n.group, e);
183
- break;
184
- case "GridClearFilter":
185
- t.filterChange(void 0);
186
- break;
187
- case "GridClearGroup":
188
- t.groupChange([], e);
189
- break;
190
- case "GridClearHighlight":
191
- t.applyHighlightDescriptor([]);
192
- break;
193
- case "GridClearSort":
194
- t.sortChange(void 0);
195
- break;
196
- case "GridSelect":
197
- t.applySelectionDescriptor([n.select]);
198
- break;
199
- case "GridClearSelect":
200
- t.applySelectionDescriptor([]);
201
- break;
202
- case "GridExportPDF":
203
- t.exportAsPdf();
204
- break;
205
- case "GridColumnResize":
206
- ce(n.id, n.size, e);
207
- break;
208
- case "GridColumnHide":
209
- M(n.id, !0);
210
- break;
211
- case "GridColumnShow":
212
- M(n.id, !1);
213
- break;
214
- case "GridColumnReorder":
215
- ue(n.id, n.position, e);
216
- break;
217
- case "GridColumnLock":
218
- H(n.id, !0);
219
- break;
220
- case "GridColumnUnlock":
221
- H(n.id, !1);
222
- break;
223
- case "GridPage":
224
- de(n.page, e);
225
- break;
226
- case "GridPageSize":
227
- pe(n.pageSize, e);
228
- break;
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(),
82
+ props: {
83
+ dataItemKey: e.dataItemKey
229
84
  }
230
- }), (u = (s = e == null ? void 0 : e.data) == null ? void 0 : s.commands) != null && u.length || le(e.data.message, r, i), z && z(e, r, i);
231
- }, fe = (e) => {
232
- P == null || P(e), h(!1), C(!1);
233
- }, he = (e, r) => {
234
- const i = W.CancelToken.source(), o = {
235
- role: N || "user",
236
- columns: J || [],
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 || [],
237
99
  headers: {
238
100
  Accept: "*/*",
239
101
  "Content-Type": "application/json"
240
102
  },
241
- promptMessage: e,
103
+ promptMessage: t,
242
104
  requestOptions: {
243
- url: g,
105
+ url: c,
244
106
  method: "POST",
245
107
  withCredentials: !1,
246
108
  responseType: "json",
247
- cancelToken: i.token,
248
- ...d
109
+ cancelToken: r.token,
110
+ ...i
249
111
  }
250
112
  };
251
- if (v && v(o, r), o.requestOptions.url !== void 0) {
252
- h(!0), C(!0);
253
- const { url: s, ...u } = o.requestOptions;
254
- W(s, {
255
- ...u,
256
- headers: o.headers,
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,
257
119
  data: {
258
- columns: o.columns,
259
- contents: [{ text: o.promptMessage }]
120
+ columns: a.columns,
121
+ contents: [{ text: a.promptMessage }]
260
122
  },
261
123
  responseType: "json"
262
124
  // Ensure correct type
263
- }).then((n) => ge(n, o.promptMessage, r)).catch(fe), T.current = i;
125
+ }).then((C) => se(C, a.promptMessage, n)).catch(oe), x.current = r);
264
126
  }
265
- }, Ce = l.useCallback(() => {
266
- T.current && T.current.cancel("Request cancelled by user."), h(!1), C(!1);
267
- }, []), [Se, D] = xe(
268
- A
269
- ), Ge = Object.keys(D).length > 0 ? D : {}, ke = /* @__PURE__ */ l.createElement(
270
- Se,
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,
271
133
  {
272
- onPromptRequest: he,
273
- onCancel: Ce,
274
- onClose: G,
275
- streaming: X || Q,
276
- loading: Y || Z,
277
- outputs: _ || w,
278
- promptPlaceHolder: K,
279
- suggestionsList: V,
280
- enableSpeechToText: $,
281
- ...Ge
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
282
144
  }
283
- ), me = /* @__PURE__ */ l.createElement(
284
- Pe,
145
+ ), ce = /* @__PURE__ */ o.createElement(
146
+ pe,
285
147
  {
286
- ref: f,
148
+ ref: d,
287
149
  togglable: !0,
288
150
  themeColor: "primary",
289
151
  rounded: "full",
290
- selected: S,
291
- svgIcon: U || (E ? void 0 : Re),
152
+ selected: f,
153
+ svgIcon: G || (E ? void 0 : me),
292
154
  icon: E,
293
- size: t.mobileMode ? "large" : "medium",
294
- className: ye("k-toolbar-button", { "k-icon-button": t.mobileMode }),
295
- title: p.toLanguageString(k, m[k]),
296
- onClick: ne
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
297
159
  }
298
160
  );
299
- return l.useEffect(() => {
300
- var e;
301
- if (f.current && S) {
302
- const r = (e = f.current.element) == null ? void 0 : e.getBoundingClientRect();
303
- if (r) {
304
- ee(r.top + window.scrollY + r.height), re(r.left + window.scrollX + r.width);
305
- const i = window.innerWidth, o = i < I ? i * 0.75 : 560;
306
- oe(o);
161
+ 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);
307
169
  }
308
170
  }
309
- }, [S]), l.useImperativeHandle(
310
- b,
171
+ }, [f]), o.useImperativeHandle(
172
+ w,
311
173
  () => ({
312
- show: () => y(!0),
313
- hide: () => G()
174
+ show: () => b(!0),
175
+ hide: () => g()
314
176
  }),
315
- [G]
316
- ), /* @__PURE__ */ l.createElement(l.Fragment, null, me, S && /* @__PURE__ */ l.createElement(
317
- Te,
177
+ [g]
178
+ ), /* @__PURE__ */ o.createElement(o.Fragment, null, ce, f && /* @__PURE__ */ o.createElement(
179
+ Ce,
318
180
  {
319
- key: F,
181
+ key: W,
320
182
  autoFocus: !1,
321
- title: p.toLanguageString(k, m[k]),
322
- initialTop: q,
323
- initialLeft: te,
324
- initialWidth: F,
183
+ title: l.toLanguageString(S, k[S]),
184
+ initialTop: $,
185
+ initialLeft: Q,
186
+ initialWidth: W,
325
187
  style: {
326
188
  height: "auto",
327
189
  minWidth: "90px",
328
190
  minHeight: "50px"
329
191
  },
330
- onClose: G,
192
+ onClose: g,
331
193
  resizable: !0,
332
194
  draggable: !0,
333
195
  className: "k-grid-assistant-window",
334
- maximizeButton: Fe
196
+ maximizeButton: Ie
335
197
  },
336
- ke
198
+ le
337
199
  ));
338
200
  }
339
201
  );
340
- Me.displayName = "KendoReactGridToolbarAIAssistant";
202
+ Ae.displayName = "KendoReactGridToolbarAIAssistant";
341
203
  export {
342
- Ee as GridAICommands,
343
- Me as GridToolbarAIAssistant
204
+ Ae as GridToolbarAIAssistant
344
205
  };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ *-------------------------------------------------------------------------------------------
4
+ * Copyright © 2025 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 P=require("../filterCommon.js"),g=require("../interfaces/GridAICommands.js");function S(a,e,t){var h,o,r,p;const i={...e},l=[];let f=!1;return(h=a==null?void 0:a.data)!=null&&h.commands&&a.data.commands.forEach(s=>{switch(s.type){case g.GridAICommands.GridSort:s.sort&&(i.sort=n(s.sort,e.sort)),s.message&&l.push(s.message);break;case g.GridAICommands.GridClearSort:i.sort=[],s.message&&l.push(s.message);break;case g.GridAICommands.GridFilter:s.filter&&(i.filter=G(s.filter,e.filter)),s.message&&l.push(s.message);break;case g.GridAICommands.GridClearFilter:i.filter=void 0,s.message&&l.push(s.message);break;case g.GridAICommands.GridGroup:s.group&&(i.group=k(s.group,e.group)),s.message&&l.push(s.message);break;case g.GridAICommands.GridClearGroup:i.group=[],s.message&&l.push(s.message);break;case g.GridAICommands.GridHighlight:s.highlight&&t&&(i.highlight=[s.highlight]),s.message&&l.push(s.message);break;case g.GridAICommands.GridClearHighlight:i.highlight=[],s.message&&l.push(s.message);break;case g.GridAICommands.GridSelect:s.select&&t&&(i.select=[s.select]),s.message&&l.push(s.message);break;case g.GridAICommands.GridClearSelect:i.select=[],s.message&&l.push(s.message);break;case g.GridAICommands.GridColumnHide:s.id&&e.columnsState&&(i.columnsState=C(s.id,!0,e.columnsState)),s.message&&l.push(s.message);break;case g.GridAICommands.GridColumnShow:s.id&&e.columnsState&&(i.columnsState=C(s.id,!1,e.columnsState)),s.message&&l.push(s.message);break;case g.GridAICommands.GridColumnResize:s.id&&s.size&&e.columnsState&&(i.columnsState=A(s.id,s.size,e.columnsState)),s.message&&l.push(s.message);break;case g.GridAICommands.GridColumnReorder:s.id&&s.position!==void 0&&e.columnsState&&(i.columnsState=I(s.id,s.position,e.columnsState)),s.message&&l.push(s.message);break;case g.GridAICommands.GridColumnLock:s.id&&e.columnsState&&(i.columnsState=u(s.id,!0,e.columnsState)),s.message&&l.push(s.message);break;case g.GridAICommands.GridColumnUnlock:s.id&&e.columnsState&&(i.columnsState=u(s.id,!1,e.columnsState)),s.message&&l.push(s.message);break;case g.GridAICommands.GridPage:if(s.page!==void 0&&t){const d=b(t,s.page,e.skip,e.take);i.skip=d.skip,i.take=d.take}s.message&&l.push(s.message);break;case g.GridAICommands.GridPageSize:if(s.pageSize!==void 0&&t){const d=v(s.pageSize,e.skip,e.take);i.skip=d.skip,i.take=d.take}s.message&&l.push(s.message);break;case g.GridAICommands.GridExportPDF:f=!0,s.message&&l.push(s.message);break}}),!((r=(o=a==null?void 0:a.data)==null?void 0:o.commands)!=null&&r.length)&&((p=a==null?void 0:a.data)!=null&&p.message)&&l.push(a.data.message),{state:i,messages:l,shouldExportPdf:f}}const n=(a,e)=>{const t=Array.isArray(a)?a:[a];if(t.length===0)return[];const l=(e!=null?e:[]).filter(f=>!t.some(h=>h.field===f.field));return l.push(...t),l},G=(a,e)=>a?P.combineSmartFilters({logic:a.logic?a.logic:"and",filters:a.filters},e)||void 0:e,k=(a,e)=>{if(!a)return e!=null?e:[];const t=Array.isArray(a)?a:[a];if(t.length===0)return[];const l=(e!=null?e:[]).filter(f=>!t.some(h=>h.field===f.field));return l.push(...t),l},C=(a,e,t)=>t.map(i=>i.id===a?{...i,hidden:e}:i),A=(a,e,t)=>t.map(i=>i.id===a?{...i,width:parseFloat(e)}:i),I=(a,e,t)=>{if(!t.find(o=>o.id===a))return t;const l=[...t],f=l.findIndex(o=>o.id===a),[h]=l.splice(f,1);return l.splice(e,0,h),l.map((o,r)=>({...o,orderIndex:r}))},u=(a,e,t)=>t.map(i=>i.id===a?{...i,locked:e}:i),b=(a,e,t=0,i=10)=>{const l=a.getLeafDataItems().length,f=Math.max(1,Math.floor(e)),h=a.getTotal(),o=Math.floor(i!=null?i:l),r=Math.floor((f-1)*o);return r<h?{skip:r,take:o}:{skip:t,take:o}},v=(a,e=0,t=10)=>{const i=Math.max(1,Math.floor(a)),l=t!=null?t:0,f=Math.floor(e/l);let h=0;return l>0&&(h=Math.max(0,f*i)),{skip:h,take:i}};exports.handleAIResponse=S;exports.handleColumnLock=u;exports.handleColumnReorder=I;exports.handleColumnResize=A;exports.handleColumnVisibility=C;exports.handleFilterCommand=G;exports.handleGroupCommand=k;exports.handlePageChange=b;exports.handlePageSizeChange=v;exports.handleSortCommand=n;