@progress/kendo-react-grid 11.0.0-develop.9 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BasePDFExport.js +8 -0
- package/BasePDFExport.mjs +52 -0
- package/Grid.js +1 -1
- package/Grid.mjs +13 -18
- package/GridClientWrapper.js +1 -1
- package/GridClientWrapper.mjs +300 -288
- package/GridComponent.js +1 -1
- package/GridComponent.mjs +387 -429
- package/GridPdfExportButton.js +8 -0
- package/GridPdfExportButton.mjs +35 -0
- package/GridSearchBox.js +1 -1
- package/GridSearchBox.mjs +1 -1
- package/GridToolbar.js +1 -1
- package/GridToolbar.mjs +15 -20
- package/StatusBar.js +1 -1
- package/StatusBar.mjs +23 -23
- package/cells/GridFilterCell.js +1 -1
- package/cells/GridFilterCell.mjs +46 -46
- package/cells/datacell/GridCell.js +1 -1
- package/cells/datacell/GridCell.mjs +9 -15
- package/cells/datacell/GridCellServerContainer.js +1 -1
- package/cells/datacell/GridCellServerContainer.mjs +1 -1
- package/cells/datacell/useCellClientTdProps.js +1 -1
- package/cells/datacell/useCellClientTdProps.mjs +1 -1
- package/cells/editcell/GridEditCell.js +1 -1
- package/cells/editcell/GridEditCell.mjs +7 -13
- package/cells/editcell/GridEditCellEditor.js +1 -1
- package/cells/editcell/GridEditCellEditor.mjs +1 -1
- package/cells/editcell/GridEditCellServerContainer.js +1 -1
- package/cells/editcell/GridEditCellServerContainer.mjs +1 -1
- package/cells/groupcell/GridGroupCell.js +1 -1
- package/cells/groupcell/GridGroupCell.mjs +8 -10
- package/cells/groupcell/GridGroupCellServerContainer.js +1 -1
- package/cells/groupcell/GridGroupCellServerContainer.mjs +1 -1
- package/cells/groupcell/GridGroupCellToggle.js +1 -1
- package/cells/groupcell/GridGroupCellToggle.mjs +1 -1
- package/cells/groupcell/useGroupCellClientTdProps.js +1 -1
- package/cells/groupcell/useGroupCellClientTdProps.mjs +1 -1
- package/cells/hierarchycell/GridHierarchyCell.js +1 -1
- package/cells/hierarchycell/GridHierarchyCell.mjs +8 -14
- package/cells/hierarchycell/GridHierarchyCellServerContainer.js +1 -1
- package/cells/hierarchycell/GridHierarchyCellServerContainer.mjs +1 -1
- package/cells/hierarchycell/GridHierarchyCellToggle.js +1 -1
- package/cells/hierarchycell/GridHierarchyCellToggle.mjs +1 -1
- package/cells/hierarchycell/useHierarchyCellClientTdProps.js +1 -1
- package/cells/hierarchycell/useHierarchyCellClientTdProps.mjs +15 -18
- package/cells/hooks.js +1 -1
- package/cells/hooks.mjs +1 -1
- package/cells/rowreordercell/useRowReorderCellClientTdProps.js +1 -1
- package/cells/rowreordercell/useRowReorderCellClientTdProps.mjs +1 -1
- package/cells/selectioncell/GridSelectionCell.js +1 -1
- package/cells/selectioncell/GridSelectionCell.mjs +7 -13
- package/cells/selectioncell/GridSelectionCellInput.js +1 -1
- package/cells/selectioncell/GridSelectionCellInput.mjs +1 -1
- package/cells/selectioncell/GridSelectionCellServerContainer.js +1 -1
- package/cells/selectioncell/GridSelectionCellServerContainer.mjs +1 -1
- package/codemods/v11/cell-render.js +9 -0
- package/codemods/v11/column-cell.js +9 -0
- package/codemods/v11/column-filter-cell.js +9 -0
- package/codemods/v11/column-footer-cell.js +9 -0
- package/codemods/v11/column-header-cell.js +9 -0
- package/codemods/v11/detail-expand-state.js +9 -0
- package/codemods/v11/edit-state.js +9 -0
- package/codemods/v11/filter-cell-render.js +9 -0
- package/codemods/v11/group-expand-state.js +9 -0
- package/codemods/v11/header-cell-render.js +9 -0
- package/codemods/v11/index.js +9 -0
- package/codemods/v11/row-render.js +9 -0
- package/codemods/v11/selection-state.js +9 -0
- package/codemods/v11/utils.js +9 -0
- package/columnMenu/GridColumnMenuCheckboxFilter.js +1 -1
- package/columnMenu/GridColumnMenuCheckboxFilter.mjs +3 -2
- package/columnMenu/GridColumnMenuColumnsChooser.js +1 -1
- package/columnMenu/GridColumnMenuColumnsChooser.mjs +1 -1
- package/columnMenu/GridColumnMenuFilter.js +1 -1
- package/columnMenu/GridColumnMenuFilter.mjs +1 -1
- package/columnMenu/GridColumnMenuFilterCell.js +1 -1
- package/columnMenu/GridColumnMenuFilterCell.mjs +35 -28
- package/columnMenu/GridColumnMenuFilterUI.js +1 -1
- package/columnMenu/GridColumnMenuFilterUI.mjs +1 -1
- package/columnMenu/GridColumnMenuItem.js +1 -1
- package/columnMenu/GridColumnMenuItem.mjs +1 -1
- package/columnMenu/GridColumnMenuWrapper.js +1 -1
- package/columnMenu/GridColumnMenuWrapper.mjs +62 -49
- package/columnMenu/adaptiveContent/GridAdaptiveCheckboxFilter.js +1 -1
- package/columnMenu/adaptiveContent/GridAdaptiveCheckboxFilter.mjs +1 -1
- package/columnMenu/adaptiveContent/GridAdaptiveColumnChooser.js +1 -1
- package/columnMenu/adaptiveContent/GridAdaptiveColumnChooser.mjs +1 -1
- package/columnMenu/adaptiveContent/GridAdaptiveColumnMenu.js +1 -1
- package/columnMenu/adaptiveContent/GridAdaptiveColumnMenu.mjs +2 -2
- package/columnMenu/adaptiveContent/GridAdaptiveFilterMenu.js +1 -1
- package/columnMenu/adaptiveContent/GridAdaptiveFilterMenu.mjs +1 -1
- package/components/GridContainerElementContainer.js +1 -1
- package/components/GridContainerElementContainer.mjs +1 -1
- package/components/GridDragClue.js +1 -1
- package/components/GridDragClue.mjs +1 -1
- package/components/GridDraggableRowsContainer.js +1 -1
- package/components/GridDraggableRowsContainer.mjs +1 -1
- package/components/GridDropClue.js +1 -1
- package/components/GridDropClue.mjs +1 -1
- package/components/GridEditDialog.js +1 -1
- package/components/GridEditDialog.mjs +1 -1
- package/components/GridElementContainer.js +1 -1
- package/components/GridElementContainer.mjs +1 -1
- package/components/PagerContainer.js +1 -1
- package/components/PagerContainer.mjs +1 -1
- package/components/VirtualScrollHeightContainer.js +1 -1
- package/components/VirtualScrollHeightContainer.mjs +1 -1
- package/components/colGroup/GridColGroup.js +1 -1
- package/components/colGroup/GridColGroup.mjs +1 -1
- package/components/noRecords/GridNoRecordsContainer.js +1 -1
- package/components/noRecords/GridNoRecordsContainer.mjs +1 -1
- package/components/table/GridTable.js +1 -1
- package/components/table/GridTable.mjs +1 -1
- package/components/table/GridTableBody.js +1 -1
- package/components/table/GridTableBody.mjs +1 -1
- package/components/table/GridTableScrollable.js +1 -1
- package/components/table/GridTableScrollable.mjs +1 -1
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/footer/Footer.js +1 -1
- package/footer/Footer.mjs +1 -1
- package/footer/FooterCell.js +1 -1
- package/footer/FooterCell.mjs +14 -14
- package/footer/client/FooterCellContainer.js +1 -1
- package/footer/client/FooterCellContainer.mjs +1 -1
- package/header/FilterRow.js +1 -1
- package/header/FilterRow.mjs +42 -46
- package/header/GridHeaderCell.js +1 -1
- package/header/GridHeaderCell.mjs +11 -11
- package/header/GridHeaderSelectionCell.js +1 -1
- package/header/GridHeaderSelectionCell.mjs +14 -14
- package/header/GroupPanel.js +1 -1
- package/header/GroupPanel.mjs +1 -1
- package/header/Header.js +1 -1
- package/header/Header.mjs +1 -1
- package/header/HeaderRow.js +1 -1
- package/header/HeaderRow.mjs +19 -20
- package/header/client/GridFilterCellContainer.js +1 -1
- package/header/client/GridFilterCellContainer.mjs +11 -12
- package/header/client/GridFilterCellElementContainer.js +1 -1
- package/header/client/GridFilterCellElementContainer.mjs +1 -1
- package/header/client/GridHeaderCellContainer.js +1 -1
- package/header/client/GridHeaderCellContainer.mjs +7 -8
- package/header/client/GridHeaderCellElementContainer.js +1 -1
- package/header/client/GridHeaderCellElementContainer.mjs +1 -1
- package/header/client/GridHeaderRowContainer.js +1 -1
- package/header/client/GridHeaderRowContainer.mjs +1 -1
- package/header/client/HeaderCellResizer.js +1 -1
- package/header/client/HeaderCellResizer.mjs +1 -1
- package/header/client/HeaderRowDraggable.js +1 -1
- package/header/client/HeaderRowDraggable.mjs +1 -1
- package/index.d.mts +293 -186
- package/index.d.ts +293 -186
- package/index.js +1 -1
- package/index.mjs +81 -71
- package/messages/index.js +1 -1
- package/messages/index.mjs +94 -76
- package/package-metadata.js +1 -1
- package/package-metadata.mjs +2 -2
- package/package.json +77 -21
- package/rows/GridRow.js +1 -1
- package/rows/GridRow.mjs +32 -33
- package/toolbar-tools/GridToolbarCheckboxFilter.js +8 -0
- package/toolbar-tools/GridToolbarCheckboxFilter.mjs +312 -0
- package/toolbar-tools/GridToolbarColumnsChooser.js +8 -0
- package/toolbar-tools/GridToolbarColumnsChooser.mjs +178 -0
- package/toolbar-tools/GridToolbarFilter.js +8 -0
- package/toolbar-tools/GridToolbarFilter.mjs +281 -0
- package/toolbar-tools/GridToolbarSort.js +8 -0
- package/toolbar-tools/GridToolbarSort.mjs +146 -0
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarCheckboxFilter.js +9 -0
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarCheckboxFilter.mjs +114 -0
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarColumnChooser.js +9 -0
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarColumnChooser.mjs +89 -0
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarFilter.js +9 -0
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarFilter.mjs +98 -0
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarSort.js +9 -0
- package/toolbar-tools/adaptiveContent/GridAdaptiveToolbarSort.mjs +68 -0
- package/toolbar-tools/adaptiveContext/GridToolbarAdaptiveContext.js +9 -0
- package/toolbar-tools/adaptiveContext/GridToolbarAdaptiveContext.mjs +17 -0
- package/utils/GridContext.js +9 -0
- package/{codemods/index.js → utils/GridContext.mjs} +6 -1
- package/utils/index.js +1 -1
- package/utils/index.mjs +145 -148
- package/utils/premium.js +1 -1
- package/utils/premium.mjs +26 -25
- package/utils/virtualColumns.js +1 -1
- package/utils/virtualColumns.mjs +13 -7
- package/components/GridCustomCellClientContainer.js +0 -9
- package/components/GridCustomCellClientContainer.mjs +0 -34
package/rows/GridRow.mjs
CHANGED
|
@@ -6,62 +6,61 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import { useUnstyled as
|
|
9
|
+
import * as a from "react";
|
|
10
|
+
import { useUnstyled as b, uGrid as h, classNames as C, useDroppable as T } from "@progress/kendo-react-common";
|
|
11
11
|
import { GRID_ROW_INDEX_ATTRIBUTE as k } from "../constants/index.mjs";
|
|
12
|
-
import { GridContext as
|
|
13
|
-
const
|
|
14
|
-
var
|
|
15
|
-
const
|
|
16
|
-
reorderRowDropTargetRef:
|
|
12
|
+
import { GridContext as v } from "../utils/GridContext.mjs";
|
|
13
|
+
const F = (e) => {
|
|
14
|
+
var u;
|
|
15
|
+
const n = a.useContext(v), {
|
|
16
|
+
reorderRowDropTargetRef: w,
|
|
17
17
|
reorderRowDragTargetRef: r,
|
|
18
|
-
activeDragRowDataItemRef:
|
|
19
|
-
} =
|
|
20
|
-
|
|
21
|
-
selected:
|
|
18
|
+
activeDragRowDataItemRef: R
|
|
19
|
+
} = n, { rowType: o, isAltRow: g, isInEdit: m, isSelected: D } = e, i = b(), f = i && i.uGrid ? i.uGrid : h, I = C(
|
|
20
|
+
f.tr({
|
|
21
|
+
selected: D,
|
|
22
22
|
isHeader: o === "groupHeader",
|
|
23
23
|
isFooter: o === "groupFooter",
|
|
24
24
|
isMaster: o !== "groupHeader" && o !== "groupFooter",
|
|
25
|
-
isAltRow:
|
|
26
|
-
isInEdit:
|
|
25
|
+
isAltRow: g,
|
|
26
|
+
isInEdit: m
|
|
27
27
|
})
|
|
28
|
-
),
|
|
29
|
-
T(
|
|
28
|
+
), c = a.useRef(null);
|
|
29
|
+
T(c, {
|
|
30
30
|
onDragOver: (t) => {
|
|
31
|
-
if (e.isRowReorderable &&
|
|
32
|
-
const
|
|
33
|
-
|
|
31
|
+
if (e.isRowReorderable && R.current) {
|
|
32
|
+
const y = t.originalEvent.target;
|
|
33
|
+
w.current = y.closest(".k-table-row");
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
onDrop: () => {
|
|
37
37
|
r.current && e.isRowReorderable && (r.current.style.userSelect = "");
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
-
const
|
|
41
|
-
onClick: (t) =>
|
|
42
|
-
onDoubleClick: (t) =>
|
|
43
|
-
},
|
|
44
|
-
ref:
|
|
40
|
+
const x = {
|
|
41
|
+
onClick: (t) => n.rowClick(t, e.dataItem),
|
|
42
|
+
onDoubleClick: (t) => n.rowDblClick(t, e.dataItem)
|
|
43
|
+
}, l = {
|
|
44
|
+
ref: c,
|
|
45
45
|
id: e.id,
|
|
46
|
-
...
|
|
47
|
-
className:
|
|
46
|
+
...x,
|
|
47
|
+
className: I,
|
|
48
48
|
style: {
|
|
49
49
|
height: e.rowHeight ? e.rowHeight + "px" : "",
|
|
50
50
|
visibility: e.isHidden ? "hidden" : "",
|
|
51
|
-
userSelect: (
|
|
51
|
+
userSelect: (u = r == null ? void 0 : r.current) == null ? void 0 : u.style.userSelect
|
|
52
52
|
},
|
|
53
53
|
role: "row",
|
|
54
54
|
"aria-rowindex": e.ariaRowIndex,
|
|
55
55
|
"absolute-row-index": e.absoluteRowIndex,
|
|
56
56
|
[k]: e.rowType === "data" ? e.dataIndex : void 0
|
|
57
|
-
},
|
|
58
|
-
if (d && d[
|
|
59
|
-
const t = d[
|
|
60
|
-
return /* @__PURE__ */
|
|
57
|
+
}, s = e.rowType || "data", d = e.rows;
|
|
58
|
+
if (d && d[s]) {
|
|
59
|
+
const t = d[s];
|
|
60
|
+
return /* @__PURE__ */ a.createElement(t, { key: e.absoluteRowIndex, ...e, trProps: l }, e.children);
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
return e.render ? e.render.call(void 0, w, { ...e, ...c }) : w;
|
|
62
|
+
return /* @__PURE__ */ a.createElement("tr", { key: e.absoluteRowIndex, ...l }, e.children);
|
|
64
63
|
};
|
|
65
64
|
export {
|
|
66
|
-
|
|
65
|
+
F as GridRow
|
|
67
66
|
};
|
|
@@ -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"),ye=require("react-dom"),E=require("@progress/kendo-react-common"),De=require("../columnMenu/GridColumnMenuItem.js"),we=require("../columnMenu/GridColumnMenuItemContent.js"),Ne=require("../columnMenu/GridColumnMenuItemGroup.js"),Ae=require("../utils/GridContext.js"),F=require("@progress/kendo-svg-icons"),ce=require("@progress/kendo-data-query"),B=require("@progress/kendo-react-buttons"),V=require("@progress/kendo-react-inputs"),o=require("../messages/index.js"),Ge=require("@progress/kendo-react-intl"),se=require("../utils/index.js"),Oe=require("../columnMenu/GridColumnMenuCheckboxFilter.js"),Te=require("./adaptiveContent/GridAdaptiveToolbarCheckboxFilter.js"),Pe=require("@progress/kendo-react-popup"),ue=require("@progress/kendo-react-indicators"),Le=require("./adaptiveContext/GridToolbarAdaptiveContext.js");function Ve(l){const m=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const k in l)if(k!=="default"){const v=Object.getOwnPropertyDescriptor(l,k);Object.defineProperty(m,k,v.get?v:{enumerable:!0,get:()=>l[k]})}}return m.default=l,Object.freeze(m)}const n=Ve(qe),je={uniqueData:!0},de=l=>{var oe,ie;const{uniqueData:m=je.uniqueData,svgIcon:k,icon:v}=l,c=n.useContext(Ae.GridContext),C=c.columnsRef,M=c.defaultFilter,[D,I]=n.useState(!1),x=n.useRef(null),w=n.useRef(null),j=n.useRef(null),N=n.useRef(0),g=Ge.useLocalization(),i=n.useRef(null),fe=E.useDocument(x),A=()=>M?E.clone(M):{filters:[],logic:"and"},me=()=>{var r;const e=(r=i==null?void 0:i.current)==null?void 0:r.field;return A().filters.findIndex(u=>u.filters&&u.filters.length>0&&u.filters[0].field===e)},b=(e,t)=>{var u;const a=((u=i==null?void 0:i.current)==null?void 0:u.field)||"",r=e.map(d=>se.getNestedValue(a,d));return t?r.filter((d,y)=>r.indexOf(d)===y):r},s=n.useRef(me()),[ge,S]=n.useState(!1),[h,z]=n.useState((C==null?void 0:C.map(e=>({column:e,expanded:!1})))||[]),[K,_]=n.useState(""),[q,p]=n.useState(b(l.data,m)||[]),[R,$]=n.useState(b(l.data,!1)||[]),[f,H]=n.useState(A()),[he,Q]=n.useState(!1),ke=g.toLanguageString(o.filterClearButton,o.messages[o.filterClearButton]),W=n.useMemo(()=>(C==null?void 0:C.filter(e=>{var t;return(t=e.title||e.field)==null?void 0:t.toLowerCase()}))||[],[C]);n.useEffect(()=>{M&&S(!0)},[M]),n.useEffect(()=>{var a;const e=((a=i==null?void 0:i.current)==null?void 0:a.field)||"",t=l.data.map(r=>se.getNestedValue(e,r));Oe.isArrayEqual(t,R)||(p(t),$(t))},[R,l.data]),n.useEffect(()=>{h.find(e=>e.expanded)&&p(b(l.data,m)||[])},[h,l.data,m]);const J=n.useCallback(e=>{const t=f.filters.some(a=>a.field===e.field);return n.createElement(n.Fragment,null,e.title||e.field,t&&n.createElement("span",{className:"k-columnmenu-indicators"},n.createElement(E.SvgIcon,{key:1,icon:F.filterIcon})))},[f]),U=n.useCallback((e,t)=>{z(a=>(i.current=t,a.map(r=>r.column.field===t.field?{...r,expanded:!r.expanded}:{...r,expanded:!1}))),p(b(l.data,m)||[]),$(b(l.data,m)||[]),Q(!he)},[]),X=e=>{var r;const t=l.searchBoxFilterOperator?l.searchBoxFilterOperator:"startswith",a={logic:"and",filters:[{field:(r=i==null?void 0:i.current)==null?void 0:r.field,operator:t,value:e.target.value,ignoreCase:!0}]};_(e.target.value),p(b(ce.filterBy(l.data||[],a),m))},Ce=()=>{var a;const e=l.searchBoxFilterOperator?l.searchBoxFilterOperator:"startswith",t={logic:"and",filters:[{field:(a=i==null?void 0:i.current)==null?void 0:a.field,operator:e,value:"",ignoreCase:!0}]};_(""),p(b(ce.filterBy(l.data||[],t),m))},Y=()=>{let e=!1;if(f){const t=[...f.filters];return s.current===-1?!1:(e=q.every(a=>s.current!==-1&&t[s.current].filters?t[s.current].filters.findIndex(u=>u.value===a)>=0:!1),e)}return e},G=(e,t)=>{var y;const a=((y=i==null?void 0:i.current)==null?void 0:y.field)||"",r={...f},u=[...f.filters];let d=[];if(s.current!==-1&&r.filters[s.current].filters&&t!=="all"&&(d=r.filters[s.current].filters),e.value&&t==="all")q.forEach(L=>{d.push({field:a,operator:"eq",value:L})});else if(e.value)d.push({field:a,operator:"eq",value:t});else if(f){const L=d.findIndex(Se=>Se.value===t);d.splice(L,1)}r.logic="and",s.current!==-1?u[s.current]={logic:"or",filters:d}:u.push({logic:"or",filters:d}),(!e.value&&t==="all"||d.length===0)&&u.splice(s.current,1),r.filters=u,H(r)},O=[];if(f){const e=[...f.filters];s.current=e.findIndex(t=>{var a;return t.filters&&t.filters.length>0?t.filters[0].field===((a=i==null?void 0:i.current)==null?void 0:a.field):!1}),s.current!==-1&&e[s.current].filters.length>0&&e[s.current].filters.forEach(t=>{var a;t.field===((a=i==null?void 0:i.current)==null?void 0:a.field)&&O.push(t.value)})}const T=O.filter((e,t)=>O.indexOf(e)===t),Z=e=>{if(e.preventDefault(),!c.filterChange)return;const t=f||null;t!==null&&t.filters.length>0?(s.current>=0&&t.filters.splice(s.current,1),c.filterChange(t,e)):c.filterChange(null,e),l.onCloseMenu&&l.onCloseMenu(),S(!1)},ee=e=>{if(e.preventDefault(),!c.filterChange)return;const t=f||null;c.filterChange(t,e),l.onCloseMenu&&l.onCloseMenu(),S(!0),I(!1)},te=l.searchBox?n.createElement(l.searchBox,{value:K,onChange:X}):n.createElement("div",{className:`k-searchbox k-textbox k-input k-input-solid ${c!=null&&c.mobileMode?"k-input-lg":"k-input-md"}`},n.createElement(E.IconWrap,{className:"k-input-icon",name:"search",icon:F.searchIcon}),n.createElement(V.Input,{className:"k-input-inner",type:"text",placeholder:g.toLanguageString(o.searchPlaceholder,o.messages[o.searchPlaceholder]),value:K,onChange:e=>X(e.nativeEvent)}),n.createElement(B.Button,{type:"button",rounded:null,className:"k-input-button",onClick:Ce,icon:"x","aria-label":ke,svgIcon:F.xIcon})),be=()=>{Q(!1)},Ee=e=>{e.preventDefault(),I(!D)},xe=e=>{!e.isAnchorClicked&&I(!1)},P=n.useMemo(()=>l.show!==void 0?l.show:D,[l.show,D]),ve=e=>{const t=E.getActiveElement(document);clearTimeout(N.current),N.current=window.setTimeout(()=>{!c.mobileMode&&t&&e.relatedTarget!==x.current&&w.current&&!w.current.contains(t)&&ne()})},ne=()=>{var e;l.onCloseMenu&&l.onCloseMenu(),I(!1),x.current&&((e=x.current.element)==null||e.focus())},pe=()=>{clearTimeout(N.current)},{onFocus:Fe,onBlur:Be}=E.useAsyncFocusBlur({onFocus:e=>pe(),onBlur:e=>ve(e)}),Me=e=>{var t;(t=j.current)==null||t.triggerMouseEvent(e)},Ie=e=>{var t;(t=j.current)==null||t.triggerKeyboardEvent(e)},re=e=>{if(e.preventDefault(),!c.filterChange)return;const t=f||null;t!==null&&t.filters.length>0?(t.filters=[],c.filterChange(t,e)):c.filterChange(null,e),H(A()),S(!1),z(a=>a.map(r=>({...r,expanded:!1})))},le=n.createElement(B.Button,{ref:x,togglable:!0,selected:P,svgIcon:k||(v?void 0:F.filterIcon),icon:v,size:c.mobileMode?"large":"medium",className:E.classNames("k-toolbar-button",{"k-icon-button":c.mobileMode}),title:g.toLanguageString(o.toolbarCheckboxFilter,o.messages[o.toolbarCheckboxFilter]),onClick:Ee},!c.mobileMode&&g.toLanguageString(o.toolbarCheckboxFilter,o.messages[o.toolbarCheckboxFilter])),ae=n.createElement(n.Fragment,null,W.map(e=>{var t,a;return e.filterable&&n.createElement(Ne.GridColumnMenuItemGroup,{key:e.id},n.createElement("div",{className:"k-expander"},n.createElement(De.GridColumnMenuItem,{title:J(e),expandable:!0,expanded:!!((t=h==null?void 0:h.find(r=>r.column.field===e.field))!=null&&t.expanded),onClick:r=>U(r,e)})),n.createElement(we.GridColumnMenuItemContent,{show:!!((a=h==null?void 0:h.find(r=>r.column.field===e.field))!=null&&a.expanded)},n.createElement("form",{className:"k-filter-menu",onSubmit:ee,onReset:Z},n.createElement("div",{className:"k-filter-menu-container"},te,n.createElement("ul",{className:"k-multicheck-wrap"},n.createElement("li",{className:"k-item k-check-all-wrap"},n.createElement(V.Checkbox,{label:g.toLanguageString(o.filterCheckAll,o.messages[o.filterCheckAll]),onChange:r=>G(r,"all"),checked:Y()})),q.map((r,u)=>n.createElement("li",{className:"k-item",key:u},n.createElement(V.Checkbox,{label:String(r),onChange:d=>G(d,r),checked:T.includes(r)})))),n.createElement("div",{className:"k-filter-selected-items"},T.length+" "+g.toLanguageString(o.filterSelectedItems,o.messages[o.filterSelectedItems])),n.createElement("div",{className:"k-actions k-hstack k-justify-content-stretch"},n.createElement(B.Button,{themeColor:"primary",type:"submit"},g.toLanguageString(o.filterSubmitButton,o.messages[o.filterSubmitButton])),n.createElement(B.Button,{className:"k-button",type:"reset"},g.toLanguageString(o.filterClearButton,o.messages[o.filterClearButton])))))))}),n.createElement("div",{className:"k-actions k-actions-stretched k-actions-horizontal k-column-menu-footer"},n.createElement(B.Button,{svgIcon:F.filterClearIcon,onClick:re},g.toLanguageString(o.filterClearAllButton,o.messages[o.filterClearAllButton]))));return n.createElement(n.Fragment,null,ge?n.createElement(ue.BadgeContainer,null,le,n.createElement(ue.Badge,{themeColor:"primary"})):le,c.mobileMode?n.createElement(Le.GridToolbarAdaptiveProvider,null,ye.createPortal(n.createElement(Te.GridAdaptiveToolbarCheckboxFilter,{filtered:W,computedShow:P,expandState:h,currentData:q,uniqueFilterValues:T,searchBox:te,renderTitle:J,onBackView:be,isAllSelected:Y,handleCheckBoxChange:G,clear:Z,submit:ee,onClose:ne,onFilterExpand:U,handleClearAllFilters:re},ae),(oe=fe())==null?void 0:oe.body)):n.createElement(Pe.Popup,{anchor:(ie=x.current)==null?void 0:ie.element,show:P,popupClass:"k-grid-columnmenu-popup",onMouseDownOutside:xe},n.createElement("div",{ref:w,onBlur:Be,onFocus:Fe,onMouseDown:Me,onKeyDown:Ie,className:"k-column-menu k-column-menu-md"},ae)))};de.displayName="KendoReactGridToolbarCheckboxFilter";exports.GridToolbarCheckboxFilter=de;
|
|
@@ -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
|
+
};
|