@progress/kendo-react-grid 11.0.0-develop.19 → 11.0.0-develop.20

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 (42) hide show
  1. package/GridClientWrapper.js +1 -1
  2. package/GridClientWrapper.mjs +46 -37
  3. package/GridComponent.js +1 -1
  4. package/GridComponent.mjs +18 -18
  5. package/GridToolbar.js +1 -1
  6. package/GridToolbar.mjs +15 -20
  7. package/columnMenu/GridColumnMenuCheckboxFilter.js +1 -1
  8. package/columnMenu/GridColumnMenuCheckboxFilter.mjs +2 -1
  9. package/columnMenu/GridColumnMenuFilterCell.js +1 -1
  10. package/columnMenu/GridColumnMenuFilterCell.mjs +35 -28
  11. package/columnMenu/GridColumnMenuWrapper.js +1 -1
  12. package/columnMenu/GridColumnMenuWrapper.mjs +62 -49
  13. package/columnMenu/adaptiveContent/GridAdaptiveColumnMenu.js +1 -1
  14. package/columnMenu/adaptiveContent/GridAdaptiveColumnMenu.mjs +1 -1
  15. package/dist/cdn/js/kendo-react-grid.js +1 -1
  16. package/index.d.mts +244 -18
  17. package/index.d.ts +244 -18
  18. package/index.js +1 -1
  19. package/index.mjs +80 -72
  20. package/messages/index.js +1 -1
  21. package/messages/index.mjs +92 -76
  22. package/package-metadata.js +1 -1
  23. package/package-metadata.mjs +2 -2
  24. package/package.json +16 -16
  25. package/toolbar-tools/GridToolbarCheckboxFilter.js +8 -0
  26. package/toolbar-tools/GridToolbarCheckboxFilter.mjs +312 -0
  27. package/toolbar-tools/GridToolbarColumnsChooser.js +8 -0
  28. package/toolbar-tools/GridToolbarColumnsChooser.mjs +178 -0
  29. package/toolbar-tools/GridToolbarFilter.js +8 -0
  30. package/toolbar-tools/GridToolbarFilter.mjs +281 -0
  31. package/toolbar-tools/GridToolbarSort.js +8 -0
  32. package/toolbar-tools/GridToolbarSort.mjs +146 -0
  33. package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarCheckboxFilter.js +9 -0
  34. package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarCheckboxFilter.mjs +114 -0
  35. package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarColumnChooser.js +9 -0
  36. package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarColumnChooser.mjs +89 -0
  37. package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarFilter.js +9 -0
  38. package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarFilter.mjs +98 -0
  39. package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarSort.js +9 -0
  40. package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarSort.mjs +68 -0
  41. package/toolbar-tools/adaptiveContext/GridToolbarAdaptiveContext.js +9 -0
  42. package/toolbar-tools/adaptiveContext/GridToolbarAdaptiveContext.mjs +17 -0
@@ -0,0 +1,312 @@
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
+ import * as r from "react";
9
+ import Ae from "react-dom";
10
+ import { useDocument as Le, SvgIcon as Oe, IconWrap as Te, useAsyncFocusBlur as Ge, classNames as Pe, clone as Ve, getActiveElement as qe } from "@progress/kendo-react-common";
11
+ import { GridColumnMenuItem as ze } from "../columnMenu/GridColumnMenuItem.mjs";
12
+ import { GridColumnMenuItemContent as Ke } from "../columnMenu/GridColumnMenuItemContent.mjs";
13
+ import { GridColumnMenuItemGroup as je } from "../columnMenu/GridColumnMenuItemGroup.mjs";
14
+ import { GridContext as He } from "../utils/GridContext.mjs";
15
+ import { filterIcon as ie, searchIcon as We, xIcon as _e, filterClearIcon as $e } from "@progress/kendo-svg-icons";
16
+ import { filterBy as ce } from "@progress/kendo-data-query";
17
+ import { Button as b } from "@progress/kendo-react-buttons";
18
+ import { Input as Je, Checkbox as se } from "@progress/kendo-react-inputs";
19
+ import { filterClearButton as B, messages as g, searchPlaceholder as ue, toolbarCheckboxFilter as D, filterCheckAll as fe, filterSelectedItems as me, filterSubmitButton as de, filterClearAllButton as ge } from "../messages/index.mjs";
20
+ import { useLocalization as Qe } from "@progress/kendo-react-intl";
21
+ import { getNestedValue as he } from "../utils/index.mjs";
22
+ import { isArrayEqual as Ue } from "../columnMenu/GridColumnMenuCheckboxFilter.mjs";
23
+ import { GridAdaptiveToolbarCheckboxFilter as Xe } from "./adaptiveContent/GridAdaptiveToolbarCheckboxFilter.mjs";
24
+ import { Popup as Ye } from "@progress/kendo-react-popup";
25
+ import { BadgeContainer as Ze, Badge as Re } from "@progress/kendo-react-indicators";
26
+ import { GridToolbarAdaptiveProvider as et } from "./adaptiveContext/GridToolbarAdaptiveContext.mjs";
27
+ const tt = {
28
+ uniqueData: !0
29
+ }, rt = (a) => {
30
+ var ae, oe;
31
+ const { uniqueData: h = tt.uniqueData, svgIcon: P, icon: V } = a, i = r.useContext(He), k = i.columnsRef, v = i.defaultFilter, [S, x] = r.useState(!1), p = r.useRef(null), I = r.useRef(null), q = r.useRef(null), N = r.useRef(0), m = Qe(), o = r.useRef(null), ke = Le(p), y = () => v ? Ve(v) : { filters: [], logic: "and" }, Ee = () => {
32
+ var n;
33
+ const e = (n = o == null ? void 0 : o.current) == null ? void 0 : n.field;
34
+ return y().filters.findIndex(
35
+ (s) => s.filters && s.filters.length > 0 && s.filters[0].field === e
36
+ );
37
+ }, E = (e, t) => {
38
+ var s;
39
+ const l = ((s = o == null ? void 0 : o.current) == null ? void 0 : s.field) || "", n = e.map((u) => he(l, u));
40
+ return t ? n.filter((u, w) => n.indexOf(u) === w) : n;
41
+ }, c = r.useRef(Ee()), [pe, F] = r.useState(!1), [d, z] = r.useState(
42
+ (k == null ? void 0 : k.map((e) => ({ column: e, expanded: !1 }))) || []
43
+ ), [K, j] = r.useState(""), [M, C] = r.useState(E(a.data, h) || []), [H, W] = r.useState(E(a.data, !1) || []), [f, _] = r.useState(y()), [Ce, $] = r.useState(!1), be = m.toLanguageString(B, g[B]), J = r.useMemo(
44
+ () => (k == null ? void 0 : k.filter((e) => {
45
+ var t;
46
+ return (t = e.title || e.field) == null ? void 0 : t.toLowerCase();
47
+ })) || [],
48
+ [k]
49
+ );
50
+ r.useEffect(() => {
51
+ v && F(!0);
52
+ }, [v]), r.useEffect(() => {
53
+ var l;
54
+ const e = ((l = o == null ? void 0 : o.current) == null ? void 0 : l.field) || "", t = a.data.map((n) => he(e, n));
55
+ Ue(t, H) || (C(t), W(t));
56
+ }, [H, a.data]), r.useEffect(() => {
57
+ d.find((e) => e.expanded) && C(E(a.data, h) || []);
58
+ }, [d, a.data, h]);
59
+ const Q = r.useCallback(
60
+ (e) => {
61
+ const t = f.filters.some((l) => l.field === e.field);
62
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, e.title || e.field, t && /* @__PURE__ */ r.createElement("span", { className: "k-columnmenu-indicators" }, /* @__PURE__ */ r.createElement(Oe, { key: 1, icon: ie })));
63
+ },
64
+ [f]
65
+ ), U = r.useCallback((e, t) => {
66
+ z((l) => (o.current = t, l.map((n) => n.column.field === t.field ? { ...n, expanded: !n.expanded } : { ...n, expanded: !1 }))), C(E(a.data, h) || []), W(E(a.data, h) || []), $(!Ce);
67
+ }, []), X = (e) => {
68
+ var n;
69
+ const t = a.searchBoxFilterOperator ? a.searchBoxFilterOperator : "startswith", l = {
70
+ logic: "and",
71
+ filters: [
72
+ {
73
+ field: (n = o == null ? void 0 : o.current) == null ? void 0 : n.field,
74
+ operator: t,
75
+ value: e.target.value,
76
+ ignoreCase: !0
77
+ }
78
+ ]
79
+ };
80
+ j(e.target.value), C(E(ce(a.data || [], l), h));
81
+ }, ve = () => {
82
+ var l;
83
+ const e = a.searchBoxFilterOperator ? a.searchBoxFilterOperator : "startswith", t = {
84
+ logic: "and",
85
+ filters: [
86
+ { field: (l = o == null ? void 0 : o.current) == null ? void 0 : l.field, operator: e, value: "", ignoreCase: !0 }
87
+ ]
88
+ };
89
+ j(""), C(E(ce(a.data || [], t), h));
90
+ }, Y = () => {
91
+ let e = !1;
92
+ if (f) {
93
+ const t = [...f.filters];
94
+ return c.current === -1 ? !1 : (e = M.every((l) => c.current !== -1 && t[c.current].filters ? t[c.current].filters.findIndex(
95
+ (s) => s.value === l
96
+ ) >= 0 : !1), e);
97
+ }
98
+ return e;
99
+ }, A = (e, t) => {
100
+ var w;
101
+ const l = ((w = o == null ? void 0 : o.current) == null ? void 0 : w.field) || "", n = { ...f }, s = [...f.filters];
102
+ let u = [];
103
+ if (c.current !== -1 && n.filters[c.current].filters && t !== "all" && (u = n.filters[c.current].filters), e.value && t === "all")
104
+ M.forEach((G) => {
105
+ u.push({ field: l, operator: "eq", value: G });
106
+ });
107
+ else if (e.value)
108
+ u.push({ field: l, operator: "eq", value: t });
109
+ else if (f) {
110
+ const G = u.findIndex((ye) => ye.value === t);
111
+ u.splice(G, 1);
112
+ }
113
+ n.logic = "and", c.current !== -1 ? s[c.current] = {
114
+ logic: "or",
115
+ filters: u
116
+ } : s.push({
117
+ logic: "or",
118
+ filters: u
119
+ }), (!e.value && t === "all" || u.length === 0) && s.splice(c.current, 1), n.filters = s, _(n);
120
+ }, L = [];
121
+ if (f) {
122
+ const e = [...f.filters];
123
+ c.current = e.findIndex((t) => {
124
+ var l;
125
+ return t.filters && t.filters.length > 0 ? t.filters[0].field === ((l = o == null ? void 0 : o.current) == null ? void 0 : l.field) : !1;
126
+ }), c.current !== -1 && e[c.current].filters.length > 0 && e[c.current].filters.forEach((t) => {
127
+ var l;
128
+ t.field === ((l = o == null ? void 0 : o.current) == null ? void 0 : l.field) && L.push(t.value);
129
+ });
130
+ }
131
+ const O = L.filter((e, t) => L.indexOf(e) === t), Z = (e) => {
132
+ if (e.preventDefault(), !i.filterChange)
133
+ return;
134
+ const t = f || null;
135
+ t !== null && t.filters.length > 0 ? (c.current >= 0 && t.filters.splice(c.current, 1), i.filterChange(t, e)) : i.filterChange(null, e), a.onCloseMenu && a.onCloseMenu(), F(!1);
136
+ }, R = (e) => {
137
+ if (e.preventDefault(), !i.filterChange)
138
+ return;
139
+ const t = f || null;
140
+ i.filterChange(t, e), a.onCloseMenu && a.onCloseMenu(), F(!0), x(!1);
141
+ }, ee = a.searchBox ? /* @__PURE__ */ r.createElement(a.searchBox, { value: K, onChange: X }) : /* @__PURE__ */ r.createElement(
142
+ "div",
143
+ {
144
+ className: `k-searchbox k-textbox k-input k-input-solid ${i != null && i.mobileMode ? "k-input-lg" : "k-input-md"}`
145
+ },
146
+ /* @__PURE__ */ r.createElement(Te, { className: "k-input-icon", name: "search", icon: We }),
147
+ /* @__PURE__ */ r.createElement(
148
+ Je,
149
+ {
150
+ className: "k-input-inner",
151
+ type: "text",
152
+ placeholder: m.toLanguageString(ue, g[ue]),
153
+ value: K,
154
+ onChange: (e) => X(e.nativeEvent)
155
+ }
156
+ ),
157
+ /* @__PURE__ */ r.createElement(
158
+ b,
159
+ {
160
+ type: "button",
161
+ rounded: null,
162
+ className: "k-input-button",
163
+ onClick: ve,
164
+ icon: "x",
165
+ "aria-label": be,
166
+ svgIcon: _e
167
+ }
168
+ )
169
+ ), xe = () => {
170
+ $(!1);
171
+ }, Fe = (e) => {
172
+ e.preventDefault(), x(!S);
173
+ }, Me = (e) => {
174
+ !e.isAnchorClicked && x(!1);
175
+ }, T = r.useMemo(() => a.show !== void 0 ? a.show : S, [a.show, S]), we = (e) => {
176
+ const t = qe(document);
177
+ clearTimeout(N.current), N.current = window.setTimeout(() => {
178
+ !i.mobileMode && t && e.relatedTarget !== p.current && I.current && !I.current.contains(t) && te();
179
+ });
180
+ }, te = () => {
181
+ var e;
182
+ a.onCloseMenu && a.onCloseMenu(), x(!1), p.current && ((e = p.current.element) == null || e.focus());
183
+ }, Be = () => {
184
+ clearTimeout(N.current);
185
+ }, { onFocus: De, onBlur: Se } = Ge({
186
+ onFocus: (e) => Be(),
187
+ onBlur: (e) => we(e)
188
+ }), Ie = (e) => {
189
+ var t;
190
+ (t = q.current) == null || t.triggerMouseEvent(e);
191
+ }, Ne = (e) => {
192
+ var t;
193
+ (t = q.current) == null || t.triggerKeyboardEvent(e);
194
+ }, re = (e) => {
195
+ if (e.preventDefault(), !i.filterChange)
196
+ return;
197
+ const t = f || null;
198
+ t !== null && t.filters.length > 0 ? (t.filters = [], i.filterChange(t, e)) : i.filterChange(null, e), _(y()), F(!1), z(
199
+ (l) => l.map((n) => ({
200
+ ...n,
201
+ expanded: !1
202
+ }))
203
+ );
204
+ }, ne = /* @__PURE__ */ r.createElement(
205
+ b,
206
+ {
207
+ ref: p,
208
+ togglable: !0,
209
+ selected: T,
210
+ svgIcon: P || (V ? void 0 : ie),
211
+ icon: V,
212
+ size: i.mobileMode ? "large" : "medium",
213
+ className: Pe("k-toolbar-button", {
214
+ "k-icon-button": i.mobileMode
215
+ }),
216
+ title: m.toLanguageString(D, g[D]),
217
+ onClick: Fe
218
+ },
219
+ !i.mobileMode && m.toLanguageString(D, g[D])
220
+ ), le = /* @__PURE__ */ r.createElement(r.Fragment, null, J.map((e) => {
221
+ var t, l;
222
+ return e.filterable && /* @__PURE__ */ r.createElement(je, { key: e.id }, /* @__PURE__ */ r.createElement("div", { className: "k-expander" }, /* @__PURE__ */ r.createElement(
223
+ ze,
224
+ {
225
+ title: Q(e),
226
+ expandable: !0,
227
+ expanded: !!((t = d == null ? void 0 : d.find((n) => n.column.field === e.field)) != null && t.expanded),
228
+ onClick: (n) => U(n, e)
229
+ }
230
+ )), /* @__PURE__ */ r.createElement(
231
+ Ke,
232
+ {
233
+ show: !!((l = d == null ? void 0 : d.find((n) => n.column.field === e.field)) != null && l.expanded)
234
+ },
235
+ /* @__PURE__ */ r.createElement("form", { className: "k-filter-menu", onSubmit: R, onReset: Z }, /* @__PURE__ */ r.createElement("div", { className: "k-filter-menu-container" }, ee, /* @__PURE__ */ r.createElement("ul", { className: "k-multicheck-wrap" }, /* @__PURE__ */ r.createElement("li", { className: "k-item k-check-all-wrap" }, /* @__PURE__ */ r.createElement(
236
+ se,
237
+ {
238
+ label: m.toLanguageString(
239
+ fe,
240
+ g[fe]
241
+ ),
242
+ onChange: (n) => A(n, "all"),
243
+ checked: Y()
244
+ }
245
+ )), M.map((n, s) => /* @__PURE__ */ r.createElement("li", { className: "k-item", key: s }, /* @__PURE__ */ r.createElement(
246
+ se,
247
+ {
248
+ label: String(n),
249
+ onChange: (u) => A(u, n),
250
+ checked: O.includes(n)
251
+ }
252
+ )))), /* @__PURE__ */ r.createElement("div", { className: "k-filter-selected-items" }, O.length + " " + m.toLanguageString(
253
+ me,
254
+ g[me]
255
+ )), /* @__PURE__ */ r.createElement("div", { className: "k-actions k-hstack k-justify-content-stretch" }, /* @__PURE__ */ r.createElement(b, { themeColor: "primary", type: "submit" }, m.toLanguageString(
256
+ de,
257
+ g[de]
258
+ )), /* @__PURE__ */ r.createElement(b, { className: "k-button", type: "reset" }, m.toLanguageString(
259
+ B,
260
+ g[B]
261
+ )))))
262
+ ));
263
+ }), /* @__PURE__ */ r.createElement("div", { className: "k-actions k-actions-stretched k-actions-horizontal k-column-menu-footer" }, /* @__PURE__ */ r.createElement(b, { svgIcon: $e, onClick: re }, m.toLanguageString(ge, g[ge]))));
264
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, pe ? /* @__PURE__ */ r.createElement(Ze, null, ne, /* @__PURE__ */ r.createElement(Re, { themeColor: "primary" })) : ne, i.mobileMode ? /* @__PURE__ */ r.createElement(et, null, Ae.createPortal(
265
+ /* @__PURE__ */ r.createElement(
266
+ Xe,
267
+ {
268
+ filtered: J,
269
+ computedShow: T,
270
+ expandState: d,
271
+ currentData: M,
272
+ uniqueFilterValues: O,
273
+ searchBox: ee,
274
+ renderTitle: Q,
275
+ onBackView: xe,
276
+ isAllSelected: Y,
277
+ handleCheckBoxChange: A,
278
+ clear: Z,
279
+ submit: R,
280
+ onClose: te,
281
+ onFilterExpand: U,
282
+ handleClearAllFilters: re
283
+ },
284
+ le
285
+ ),
286
+ (ae = ke()) == null ? void 0 : ae.body
287
+ )) : /* @__PURE__ */ r.createElement(
288
+ Ye,
289
+ {
290
+ anchor: (oe = p.current) == null ? void 0 : oe.element,
291
+ show: T,
292
+ popupClass: "k-grid-columnmenu-popup",
293
+ onMouseDownOutside: Me
294
+ },
295
+ /* @__PURE__ */ r.createElement(
296
+ "div",
297
+ {
298
+ ref: I,
299
+ onBlur: Se,
300
+ onFocus: De,
301
+ onMouseDown: Ie,
302
+ onKeyDown: Ne,
303
+ className: "k-column-menu k-column-menu-md"
304
+ },
305
+ le
306
+ )
307
+ ));
308
+ };
309
+ rt.displayName = "KendoReactGridToolbarCheckboxFilter";
310
+ export {
311
+ rt as GridToolbarCheckboxFilter
312
+ };
@@ -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 te=require("react"),oe=require("react-dom"),y=require("@progress/kendo-react-buttons"),h=require("@progress/kendo-react-common"),b=require("@progress/kendo-react-inputs"),F=require("@progress/kendo-svg-icons"),ne=require("../columnMenu/GridColumnMenuItemContent.js"),n=require("../messages/index.js"),le=require("../utils/GridContext.js"),re=require("@progress/kendo-react-intl"),se=require("./adaptiveContent/GridAdaptiveToolbarColumnChooser.js"),ce=require("@progress/kendo-react-popup"),K=require("@progress/kendo-react-indicators"),ae=require("./adaptiveContext/GridToolbarAdaptiveContext.js");function ue(l){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const r in l)if(r!=="default"){const u=Object.getOwnPropertyDescriptor(l,r);Object.defineProperty(s,r,u.get?u:{enumerable:!0,get:()=>l[r]})}}return s.default=l,Object.freeze(s)}const t=ue(te),_=l=>{var L,P;const s=t.useContext(le.GridContext),r=s.columnsState,u=s.onColumnsStateChange,[k,f]=t.useState(!1),[d,V]=t.useState(""),[H,S]=t.useState(!1),B=r.reduce((e,o)=>({...e,[o.id||""]:!o.hidden}),{}),[c,p]=t.useState(B),i=t.useRef(null),v=t.useRef(null),R=t.useRef(null),M=t.useRef(0),m=re.useLocalization(),W=h.useDocument(i),A=t.useMemo(()=>(r==null?void 0:r.filter(e=>{var o;return(o=e.title||e.field)==null?void 0:o.toLowerCase().includes(d.toLowerCase())}))||[],[r,d]),g=t.useMemo(()=>Object.values(c).filter(e=>e).length,[c]),C=t.useMemo(()=>g===(r==null?void 0:r.length),[r,g]),I=t.useCallback(e=>{var z;e.preventDefault();const a=(w=>(w==null?void 0:w.map(j=>({...j,hidden:!c[j.id||""]})))||[])(r);u&&u(a),(z=l.onCloseMenu)==null||z.call(void 0),f(!1)},[r,u,l.onCloseMenu,c]),T=e=>{e.preventDefault(),p(B),S(!1)},q=t.useCallback(()=>{const e={...c};Object.keys(e).forEach((o,a)=>e[o]=C&&a===0?!0:!C),p(e),S(!0)},[c,C]),D=t.useCallback((e,o)=>{const a={...c};a[o||""]=e,p(a),S(!0)},[c]),x=e=>{V(String(e.target.value))},J=e=>{e.preventDefault(),f(!k)},E=t.useMemo(()=>l.show!==void 0?l.show:k,[l.show,k]),N=()=>{var e;l.onCloseMenu&&l.onCloseMenu(),f(!1),i.current&&((e=i.current.element)==null||e.focus())},Q=e=>{const o=h.getActiveElement(document);clearTimeout(M.current),M.current=window.setTimeout(()=>{!s.mobileMode&&o&&e.relatedTarget!==i.current&&v.current&&!v.current.contains(o)&&N()})},U=()=>{clearTimeout(M.current)},{onFocus:X,onBlur:Y}=h.useAsyncFocusBlur({onFocus:e=>U(),onBlur:e=>Q(e)}),Z=e=>{var o;(o=R.current)==null||o.triggerMouseEvent(e)},$=e=>{var o;(o=R.current)==null||o.triggerKeyboardEvent(e)},ee=e=>{!e.isAnchorClicked&&f(!1)},G=t.createElement(ne.GridColumnMenuItemContent,{show:!0},t.createElement("form",{onSubmit:I,onReset:T,className:"k-filter-menu"},t.createElement("div",{className:"k-filter-menu-container"},t.createElement(b.TextBox,{className:"k-searchbox",value:d,onChange:x,size:s.mobileMode?"large":"medium",prefix:()=>t.createElement(b.InputPrefix,null,t.createElement(h.IconWrap,{name:"search",icon:F.searchIcon}))}),t.createElement("ul",{className:"k-reset k-multicheck-wrap"},!d&&t.createElement("li",{className:"k-item k-check-all-wrap"},t.createElement(b.Checkbox,{checked:C,onChange:q,label:m.toLanguageString(n.filterSelectAll,n.messages[n.filterSelectAll]),size:s.mobileMode?"large":"medium"})),A.map(e=>t.createElement("li",{key:e.id,className:"k-item"},t.createElement(b.Checkbox,{disabled:c[e.id||""]&&g===1,checked:c[e.id||""],onChange:o=>{var a;return D(!!((a=o.target.element)!=null&&a.checked),e.id)},label:e.title||e.field,size:s.mobileMode?"large":"medium"})))),t.createElement("div",{className:"k-filter-selected-items"},g," ",m.toLanguageString(n.columnMenuColumnChooserSelectedItems,n.messages[n.columnMenuColumnChooserSelectedItems])),t.createElement("div",{className:"k-actions k-actions-start k-actions-horizontal"},t.createElement(y.Button,{type:"submit",themeColor:"primary"},m.toLanguageString(n.filterApplyButton,n.messages[n.filterApplyButton])),t.createElement(y.Button,{type:"reset"},m.toLanguageString(n.filterResetButton,n.messages[n.filterResetButton])))))),O=t.createElement(y.Button,{ref:i,togglable:!0,selected:E,svgIcon:l.svgIcon?l.svgIcon:l.icon?void 0:F.columnsIcon,icon:l.icon,size:s.mobileMode?"large":"medium",className:h.classNames("k-toolbar-button",{"k-icon-button":s.mobileMode}),title:m.toLanguageString(n.toolbarColumnsChooser,n.messages[n.toolbarColumnsChooser]),onClick:J},!s.mobileMode&&m.toLanguageString(n.toolbarColumnsChooser,n.messages[n.toolbarColumnsChooser]));return t.createElement(t.Fragment,null,H?t.createElement(K.BadgeContainer,null,O,t.createElement(K.Badge,{themeColor:"primary"})):O,s.mobileMode?t.createElement(ae.GridToolbarAdaptiveProvider,null,oe.createPortal(t.createElement(se.GridAdaptiveToolbarColumnChooser,{computedShow:E,filter:d,filtered:A,selectedColumns:c,allSelected:C,checkedCount:g,onClose:N,onApply:I,onReset:T,onFilter:x,onCheckChange:D,onSelectAll:q},G),(L=W())==null?void 0:L.body)):t.createElement(ce.Popup,{anchor:(P=i.current)==null?void 0:P.element,show:E,popupClass:"k-grid-columnmenu-popup",onMouseDownOutside:ee},t.createElement("div",{ref:v,onBlur:Y,onFocus:X,onMouseDown:Z,onKeyDown:$,className:"k-column-menu k-column-menu-md"},G)))};_.displayName="KendoReactGridToolbarColumnsChooser";exports.GridToolbarColumnsChooser=_;
@@ -0,0 +1,178 @@
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
+ import * as t from "react";
9
+ import oe from "react-dom";
10
+ import { Button as w } from "@progress/kendo-react-buttons";
11
+ import { useDocument as ne, useAsyncFocusBlur as le, IconWrap as re, classNames as ae, getActiveElement as ce } from "@progress/kendo-react-common";
12
+ import { TextBox as se, InputPrefix as ie, Checkbox as K } from "@progress/kendo-react-inputs";
13
+ import { searchIcon as ue, columnsIcon as me } from "@progress/kendo-svg-icons";
14
+ import { GridColumnMenuItemContent as de } from "../columnMenu/GridColumnMenuItemContent.mjs";
15
+ import { filterSelectAll as j, messages as u, columnMenuColumnChooserSelectedItems as V, filterApplyButton as H, filterResetButton as W, toolbarColumnsChooser as h } from "../messages/index.mjs";
16
+ import { GridContext as ge } from "../utils/GridContext.mjs";
17
+ import { useLocalization as fe } from "@progress/kendo-react-intl";
18
+ import { GridAdaptiveToolbarColumnChooser as he } from "./adaptiveContent/GridAdaptiveToolbarColumnChooser.mjs";
19
+ import { Popup as Ce } from "@progress/kendo-react-popup";
20
+ import { BadgeContainer as be, Badge as ke } from "@progress/kendo-react-indicators";
21
+ import { GridToolbarAdaptiveProvider as pe } from "./adaptiveContext/GridToolbarAdaptiveContext.mjs";
22
+ const Ee = (n) => {
23
+ var F, G;
24
+ const a = t.useContext(ge), l = a.columnsState, C = a.onColumnsStateChange, [b, f] = t.useState(!1), [m, _] = t.useState(""), [q, k] = t.useState(!1), y = l.reduce((e, o) => ({ ...e, [o.id || ""]: !o.hidden }), {}), [r, p] = t.useState(y), s = t.useRef(null), E = t.useRef(null), B = t.useRef(null), M = t.useRef(0), i = fe(), J = ne(s), D = t.useMemo(
25
+ () => (l == null ? void 0 : l.filter(
26
+ (e) => {
27
+ var o;
28
+ return (o = e.title || e.field) == null ? void 0 : o.toLowerCase().includes(m.toLowerCase());
29
+ }
30
+ )) || [],
31
+ [l, m]
32
+ ), d = t.useMemo(
33
+ () => Object.values(r).filter((e) => e).length,
34
+ [r]
35
+ ), g = t.useMemo(() => d === (l == null ? void 0 : l.length), [l, d]), N = t.useCallback(
36
+ (e) => {
37
+ var O;
38
+ e.preventDefault();
39
+ const c = ((v) => (v == null ? void 0 : v.map((P) => ({
40
+ ...P,
41
+ hidden: !r[P.id || ""]
42
+ }))) || [])(l);
43
+ C && C(c), (O = n.onCloseMenu) == null || O.call(void 0), f(!1);
44
+ },
45
+ [l, C, n.onCloseMenu, r]
46
+ ), A = (e) => {
47
+ e.preventDefault(), p(y), k(!1);
48
+ }, x = t.useCallback(() => {
49
+ const e = { ...r };
50
+ Object.keys(e).forEach(
51
+ (o, c) => e[o] = g && c === 0 ? !0 : !g
52
+ ), p(e), k(!0);
53
+ }, [r, g]), T = t.useCallback(
54
+ (e, o) => {
55
+ const c = { ...r };
56
+ c[o || ""] = e, p(c), k(!0);
57
+ },
58
+ [r]
59
+ ), I = (e) => {
60
+ _(String(e.target.value));
61
+ }, Q = (e) => {
62
+ e.preventDefault(), f(!b);
63
+ }, S = t.useMemo(() => n.show !== void 0 ? n.show : b, [n.show, b]), L = () => {
64
+ var e;
65
+ n.onCloseMenu && n.onCloseMenu(), f(!1), s.current && ((e = s.current.element) == null || e.focus());
66
+ }, U = (e) => {
67
+ const o = ce(document);
68
+ clearTimeout(M.current), M.current = window.setTimeout(() => {
69
+ !a.mobileMode && o && e.relatedTarget !== s.current && E.current && !E.current.contains(o) && L();
70
+ });
71
+ }, X = () => {
72
+ clearTimeout(M.current);
73
+ }, { onFocus: Y, onBlur: Z } = le({
74
+ onFocus: (e) => X(),
75
+ onBlur: (e) => U(e)
76
+ }), $ = (e) => {
77
+ var o;
78
+ (o = B.current) == null || o.triggerMouseEvent(e);
79
+ }, ee = (e) => {
80
+ var o;
81
+ (o = B.current) == null || o.triggerKeyboardEvent(e);
82
+ }, te = (e) => {
83
+ !e.isAnchorClicked && f(!1);
84
+ }, R = /* @__PURE__ */ t.createElement(de, { show: !0 }, /* @__PURE__ */ t.createElement("form", { onSubmit: N, onReset: A, className: "k-filter-menu" }, /* @__PURE__ */ t.createElement("div", { className: "k-filter-menu-container" }, /* @__PURE__ */ t.createElement(
85
+ se,
86
+ {
87
+ className: "k-searchbox",
88
+ value: m,
89
+ onChange: I,
90
+ size: a.mobileMode ? "large" : "medium",
91
+ prefix: () => /* @__PURE__ */ t.createElement(ie, null, /* @__PURE__ */ t.createElement(re, { name: "search", icon: ue }))
92
+ }
93
+ ), /* @__PURE__ */ t.createElement("ul", { className: "k-reset k-multicheck-wrap" }, !m && /* @__PURE__ */ t.createElement("li", { className: "k-item k-check-all-wrap" }, /* @__PURE__ */ t.createElement(
94
+ K,
95
+ {
96
+ checked: g,
97
+ onChange: x,
98
+ label: i.toLanguageString(j, u[j]),
99
+ size: a.mobileMode ? "large" : "medium"
100
+ }
101
+ )), D.map((e) => /* @__PURE__ */ t.createElement("li", { key: e.id, className: "k-item" }, /* @__PURE__ */ t.createElement(
102
+ K,
103
+ {
104
+ disabled: r[e.id || ""] && d === 1,
105
+ checked: r[e.id || ""],
106
+ onChange: (o) => {
107
+ var c;
108
+ return T(!!((c = o.target.element) != null && c.checked), e.id);
109
+ },
110
+ label: e.title || e.field,
111
+ size: a.mobileMode ? "large" : "medium"
112
+ }
113
+ )))), /* @__PURE__ */ t.createElement("div", { className: "k-filter-selected-items" }, d, " ", i.toLanguageString(
114
+ V,
115
+ u[V]
116
+ )), /* @__PURE__ */ t.createElement("div", { className: "k-actions k-actions-start k-actions-horizontal" }, /* @__PURE__ */ t.createElement(w, { type: "submit", themeColor: "primary" }, i.toLanguageString(H, u[H])), /* @__PURE__ */ t.createElement(w, { type: "reset" }, i.toLanguageString(W, u[W])))))), z = /* @__PURE__ */ t.createElement(
117
+ w,
118
+ {
119
+ ref: s,
120
+ togglable: !0,
121
+ selected: S,
122
+ svgIcon: n.svgIcon ? n.svgIcon : n.icon ? void 0 : me,
123
+ icon: n.icon,
124
+ size: a.mobileMode ? "large" : "medium",
125
+ className: ae("k-toolbar-button", {
126
+ "k-icon-button": a.mobileMode
127
+ }),
128
+ title: i.toLanguageString(h, u[h]),
129
+ onClick: Q
130
+ },
131
+ !a.mobileMode && i.toLanguageString(h, u[h])
132
+ );
133
+ return /* @__PURE__ */ t.createElement(t.Fragment, null, q ? /* @__PURE__ */ t.createElement(be, null, z, /* @__PURE__ */ t.createElement(ke, { themeColor: "primary" })) : z, a.mobileMode ? /* @__PURE__ */ t.createElement(pe, null, oe.createPortal(
134
+ /* @__PURE__ */ t.createElement(
135
+ he,
136
+ {
137
+ computedShow: S,
138
+ filter: m,
139
+ filtered: D,
140
+ selectedColumns: r,
141
+ allSelected: g,
142
+ checkedCount: d,
143
+ onClose: L,
144
+ onApply: N,
145
+ onReset: A,
146
+ onFilter: I,
147
+ onCheckChange: T,
148
+ onSelectAll: x
149
+ },
150
+ R
151
+ ),
152
+ (F = J()) == null ? void 0 : F.body
153
+ )) : /* @__PURE__ */ t.createElement(
154
+ Ce,
155
+ {
156
+ anchor: (G = s.current) == null ? void 0 : G.element,
157
+ show: S,
158
+ popupClass: "k-grid-columnmenu-popup",
159
+ onMouseDownOutside: te
160
+ },
161
+ /* @__PURE__ */ t.createElement(
162
+ "div",
163
+ {
164
+ ref: E,
165
+ onBlur: Z,
166
+ onFocus: Y,
167
+ onMouseDown: $,
168
+ onKeyDown: ee,
169
+ className: "k-column-menu k-column-menu-md"
170
+ },
171
+ R
172
+ )
173
+ ));
174
+ };
175
+ Ee.displayName = "KendoReactGridToolbarColumnsChooser";
176
+ export {
177
+ Ee as GridToolbarColumnsChooser
178
+ };
@@ -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 qe=require("react"),Oe=require("react-dom"),b=require("@progress/kendo-react-common"),Ae=require("../columnMenu/GridColumnMenuItem.js"),Pe=require("../columnMenu/GridColumnMenuItemContent.js"),Ne=require("../columnMenu/GridColumnMenuItemGroup.js"),Le=require("../utils/GridContext.js"),L=require("@progress/kendo-svg-icons"),f=require("../filterCommon.js"),I=require("@progress/kendo-react-buttons"),Ue=require("../columnMenu/GridColumnMenuFilterUI.js"),u=require("../messages/index.js"),Ve=require("@progress/kendo-react-intl"),C=require("../columnMenu/GridColumnMenuFilter.js"),_e=require("@progress/kendo-react-popup"),de=require("@progress/kendo-react-indicators"),je=require("./adaptiveContext/GridToolbarAdaptiveContext.js"),ze=require("./adaptiveContent/GridAdaptiveToolbarFilter.js");function Ke(i){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const m in i)if(m!=="default"){const g=Object.getOwnPropertyDescriptor(i,m);Object.defineProperty(l,m,g.get?g:{enumerable:!0,get:()=>i[m]})}}return l.default=i,Object.freeze(l)}const t=Ke(qe),fe=i=>{var te,re,oe,le,ne,ie,ae;const l=t.useContext(Le.GridContext),m=l.columnsRef;l.filterable;const g=l.defaultFilter,[y,S]=t.useState(!1),[me,E]=t.useState(!1),[F,k]=t.useState((m==null?void 0:m.map(e=>({column:e,expanded:!1})))||[]),[ge,U]=t.useState(!1),h=t.useRef(null),D=t.useRef(null),V=t.useRef(null),B=t.useRef(0),r=t.useRef(null),p=Ve.useLocalization(),pe=b.useDocument(h),_=t.useMemo(()=>(m==null?void 0:m.filter(e=>{var o;return(o=e.title||e.field)==null?void 0:o.toLowerCase()}))||[],[m]);t.useEffect(()=>{g&&E(!0)},[g]);const j=t.useCallback(e=>{const o=g&&g.filters.some(a=>a.field===e.field);return t.createElement(t.Fragment,null,e.title||e.field,o&&t.createElement("span",{className:"k-columnmenu-indicators"},t.createElement(b.SvgIcon,{key:1,icon:L.filterIcon})))},[g]),z=(e,o)=>{k(a=>(r.current=o,a.map(n=>n.column.field===o.field?{...n,expanded:!n.expanded}:{...n,expanded:!1}))),w(K()),U(!ge)},K=()=>{var o,a,n,c,se,ce;let e;if(r!=null&&r.current&&((o=r==null?void 0:r.current)!=null&&o.field)){const Te=f.getFilterType((a=r==null?void 0:r.current)==null?void 0:a.filter),v=f.getDefaultOperator(l.filterOperators,Te);e=C.filterGroupByField((n=r==null?void 0:r.current)==null?void 0:n.field,l.filter),e=e?{...e,filters:e.filters.map(N=>({...N}))}:{logic:"and",filters:[{field:(c=r==null?void 0:r.current)==null?void 0:c.field,operator:v,value:f.IsUnaryFilter(v)?null:void 0},{field:(se=r==null?void 0:r.current)==null?void 0:se.field,operator:v,value:f.IsUnaryFilter(v)?null:void 0}]},e.filters.filter(N=>{var ue;return N.field===((ue=r==null?void 0:r.current)==null?void 0:ue.field)}).length===1&&e.filters.splice(1,0,{field:(ce=r==null?void 0:r.current)==null?void 0:ce.field,operator:v})}return e},Fe=e=>{H(0,e)},he=e=>{H(1,e)},H=(e,o)=>{const a=d.filters.map((n,c)=>c===e?{...n,value:o.value||"",operator:o.operator||G[c].operator}:n);w({...d,filters:a})},[d,w]=t.useState(K()),s=d==null?void 0:d.filters,M=f.getFilterType((te=r==null?void 0:r.current)==null?void 0:te.filter),G=f.operatorMap(l.filterOperators[M],p),J=f.operatorMap(f.booleanFilterValues,p),ve={field:(re=r==null?void 0:r.current)==null?void 0:re.field,value:s==null?void 0:s[0].value,operator:s==null?void 0:s[0].operator,operators:G,booleanValues:J,onChange:Fe,filterType:M},be={field:(oe=r==null?void 0:r.current)==null?void 0:oe.field,value:s==null?void 0:s[1].value,operator:s==null?void 0:s[1].operator,operators:G,booleanValues:J,onChange:he,filterType:M},Ce=e=>{let o=e.target.value;e.target.tagName==="SPAN"&&(o=e.target.parentElement.value),w({...d,logic:o})},Q=d==null?void 0:d.logic,W=f.operatorMap(f.filterLogicList,p),T={value:W.find(e=>e.operator===(Q===null?"":Q)),onChange:Ce,data:W},Ee=i.hideSecondFilter!==void 0?i.hideSecondFilter:f.defaultHideSecondFilter[M],q=i.filterUI,O={firstFilterProps:ve,secondFilterProps:be,logicData:T.data,logicValue:T.value,onLogicChange:T.onChange,hideSecondFilter:Ee},X=()=>({...d,filters:d==null?void 0:d.filters.filter(e=>e.value!==void 0&&e.value!==null&&e.value!==""||e.value===null&&e.operator)}),A=((ne=(le=X())==null?void 0:le.filters)==null?void 0:ne.length)!==0||f.IsUnaryFilter(s==null?void 0:s[0].operator)||f.IsUnaryFilter(s==null?void 0:s[1].operator),Y=e=>{if(e.preventDefault(),!l.filterChange)return;const o=C.rootFilterOrDefault(l.filter),a={...o,filters:o.filters.filter(n=>{var c;return n.field!==((c=r==null?void 0:r.current)==null?void 0:c.field)})};A&&a.filters.push(X()),l.filterChange(a,e),E(!0),k(n=>n.map(c=>({...c,expanded:!1})))},Z=e=>{if(e.preventDefault(),!l.filterChange)return;const o=C.rootFilterOrDefault(l.filter),a=o.filters.filter(n=>{var c;return n.field!==((c=r==null?void 0:r.current)==null?void 0:c.field)});a.length===0?l.filterChange(null,e):l.filterChange({...o,filters:a},e),i.onCloseMenu&&i.onCloseMenu(),E(!1),k(n=>n.map(c=>({...c,expanded:!1})))},ke=()=>{U(!1)},Me=e=>{e.preventDefault(),S(!y)},Ie=e=>{!e.isAnchorClicked&&S(!1)},P=t.useMemo(()=>i.show!==void 0?i.show:y,[i.show,y]),ye=e=>{const o=b.getActiveElement(document);clearTimeout(B.current),B.current=window.setTimeout(()=>{!l.mobileMode&&o&&e.relatedTarget!==h.current&&D.current&&!D.current.contains(o)&&$()})},$=()=>{var e;i.onCloseMenu&&i.onCloseMenu(),S(!1),h.current&&((e=h.current.element)==null||e.focus())},Se=()=>{clearTimeout(B.current)},{onFocus:De,onBlur:Be}=b.useAsyncFocusBlur({onFocus:e=>Se(),onBlur:e=>ye(e)}),we=e=>{var o;(o=V.current)==null||o.triggerMouseEvent(e)},Ge=e=>{var o;(o=V.current)==null||o.triggerKeyboardEvent(e)},x=t.useCallback(e=>{if(e.preventDefault(),!l.filterChange)return;const o=C.rootFilterOrDefault(l.filter),a=o.filters.filter(()=>!1);a.length===0?l.filterChange(null,e):l.filterChange({...o,filters:a},e),E(!1),k(n=>n.map(c=>({...c,expanded:!1})))},[l,C.rootFilterOrDefault]),R=t.createElement(I.Button,{ref:h,togglable:!0,selected:P,svgIcon:i.svgIcon?i.svgIcon:i.icon?void 0:L.filterIcon,icon:i.icon,size:l.mobileMode?"large":"medium",className:b.classNames("k-toolbar-button",{"k-icon-button":l.mobileMode}),title:p.toLanguageString(u.toolbarFilter,u.messages[u.toolbarFilter]),onClick:Me},!l.mobileMode&&p.toLanguageString(u.toolbarFilter,u.messages[u.toolbarFilter])),ee=t.createElement(t.Fragment,null,_.map(e=>{var o,a;return e.filterable&&t.createElement(Ne.GridColumnMenuItemGroup,{key:e.id},t.createElement("div",{className:"k-expander"},t.createElement(Ae.GridColumnMenuItem,{title:j(e),expandable:!0,expanded:!!((o=F==null?void 0:F.find(n=>n.column.field===e.field))!=null&&o.expanded),onClick:n=>z(n,e)})),t.createElement(Pe.GridColumnMenuItemContent,{show:!!((a=F==null?void 0:F.find(n=>n.column.field===e.field))!=null&&a.expanded)},t.createElement("form",{className:"k-filter-menu",onSubmit:Y,onReset:Z},t.createElement("div",{className:"k-filter-menu-container"},q?t.createElement(q,{...O}):t.createElement(Ue.GridColumnMenuFilterUI,{...O}),t.createElement("div",{className:"k-actions k-actions-stretched"},t.createElement(I.Button,{themeColor:"primary",disabled:!A},p.toLanguageString(u.filterSubmitButton,u.messages[u.filterSubmitButton])),t.createElement(I.Button,{type:"reset"},p.toLanguageString(u.filterClearButton,u.messages[u.filterClearButton])))))))}),t.createElement("div",{className:"k-actions k-actions-stretched k-actions-horizontal k-column-menu-footer"},t.createElement(I.Button,{svgIcon:L.filterClearIcon,onClick:x},p.toLanguageString(u.filterClearAllButton,u.messages[u.filterClearAllButton]))));return t.createElement(t.Fragment,null,me?t.createElement(de.BadgeContainer,null,R,t.createElement(de.Badge,{themeColor:"primary"})):R,l.mobileMode?t.createElement(je.GridToolbarAdaptiveProvider,null,Oe.createPortal(t.createElement(ze.GridAdaptiveToolbarFilter,{filtered:_,computedShow:P,expandState:F,FilterUI:q,filterUIProps:O,isFilterValid:A,renderTitle:j,onBackView:ke,clear:Z,submit:Y,onClose:$,onFilterExpand:z,handleClearAllFilters:x},ee),(ie=pe())==null?void 0:ie.body)):t.createElement(_e.Popup,{anchor:(ae=h.current)==null?void 0:ae.element,show:P,popupClass:"k-grid-columnmenu-popup",onMouseDownOutside:Ie},t.createElement("div",{ref:D,onBlur:Be,onFocus:De,onMouseDown:we,onKeyDown:Ge,className:"k-column-menu k-column-menu-md"},ee)))};fe.displayName="KendoReactGridToolbarFilter";exports.GridToolbarFilter=fe;