@progress/kendo-react-grid 9.0.0-develop.9 → 9.0.1-develop.1
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/Grid.js +1 -1
- package/Grid.mjs +927 -1042
- package/GridNoRecords.js +1 -1
- package/GridNoRecords.mjs +7 -14
- package/GridToolbar.js +1 -1
- package/GridToolbar.mjs +23 -28
- package/VirtualScroll.js +1 -1
- package/VirtualScroll.mjs +53 -51
- package/VirtualScrollFixed.js +1 -1
- package/VirtualScrollFixed.mjs +16 -14
- package/cells/GridFilterCell.js +1 -1
- package/cells/GridFilterCell.mjs +99 -113
- package/columnMenu/GridColumnMenuCheckboxFilter.js +1 -1
- package/columnMenu/GridColumnMenuCheckboxFilter.mjs +132 -178
- package/columnMenu/GridColumnMenuFilter.js +1 -1
- package/columnMenu/GridColumnMenuFilter.mjs +123 -156
- package/columnMenu/GridColumnMenuFilterCell.js +1 -1
- package/columnMenu/GridColumnMenuFilterCell.mjs +42 -53
- package/columnMenu/GridColumnMenuFilterUI.js +1 -1
- package/columnMenu/GridColumnMenuFilterUI.mjs +15 -17
- package/columnMenu/GridColumnMenuGroup.js +1 -1
- package/columnMenu/GridColumnMenuGroup.mjs +29 -40
- package/columnMenu/GridColumnMenuItemContent.js +1 -1
- package/columnMenu/GridColumnMenuItemContent.mjs +7 -20
- package/columnMenu/GridColumnMenuItemGroup.js +1 -1
- package/columnMenu/GridColumnMenuItemGroup.mjs +7 -20
- package/columnMenu/GridColumnMenuSort.js +1 -1
- package/columnMenu/GridColumnMenuSort.mjs +42 -53
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/drag/ColumnDraggable.js +1 -1
- package/drag/ColumnDraggable.mjs +34 -45
- package/drag/GroupingIndicator.js +1 -1
- package/drag/GroupingIndicator.mjs +51 -69
- package/footer/Footer.js +1 -1
- package/footer/Footer.mjs +40 -57
- package/header/FilterRow.js +1 -1
- package/header/FilterRow.mjs +70 -78
- package/header/GridHeaderSelectionCell.js +1 -1
- package/header/GridHeaderSelectionCell.mjs +28 -37
- package/header/GroupPanel.js +1 -1
- package/header/GroupPanel.mjs +43 -49
- package/header/Header.js +1 -1
- package/header/Header.mjs +70 -89
- package/index.d.mts +261 -725
- package/index.d.ts +261 -725
- package/index.js +1 -1
- package/index.mjs +78 -80
- package/package-metadata.mjs +1 -1
- package/package.json +11 -11
- package/rows/GridDetailRow.js +1 -1
- package/rows/GridDetailRow.mjs +2 -10
package/cells/GridFilterCell.mjs
CHANGED
|
@@ -7,131 +7,103 @@
|
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
9
|
import * as o from "react";
|
|
10
|
-
import { Button as
|
|
11
|
-
import { DropDownList as
|
|
12
|
-
import { TextBox as
|
|
13
|
-
import { DatePicker as
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { classNames as
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
!t.isAnchorClicked && t.state && t.state.props.show && s && s.togglePopup();
|
|
43
|
-
}
|
|
10
|
+
import { Button as z } from "@progress/kendo-react-buttons";
|
|
11
|
+
import { DropDownList as m } from "@progress/kendo-react-dropdowns";
|
|
12
|
+
import { TextBox as w, NumericTextBox as k } from "@progress/kendo-react-inputs";
|
|
13
|
+
import { DatePicker as L } from "@progress/kendo-react-dateinputs";
|
|
14
|
+
import { filterClearButton as f, messages as d, filterChooseOperator as g } from "../messages/index.mjs";
|
|
15
|
+
import { useLocalization as x } from "@progress/kendo-react-intl";
|
|
16
|
+
import { filterClearIcon as D, filterIcon as N } from "@progress/kendo-svg-icons";
|
|
17
|
+
import { cellOperatorChange as y, cellInputChange as B, cellBoolDropdownChange as O } from "../filterCommon.mjs";
|
|
18
|
+
import { classNames as S } from "@progress/kendo-react-common";
|
|
19
|
+
const j = (e) => {
|
|
20
|
+
const n = o.useRef(), u = x(), h = () => {
|
|
21
|
+
if (e.filterType === "boolean")
|
|
22
|
+
return;
|
|
23
|
+
let t;
|
|
24
|
+
const r = e.operators.find((l) => l.operator === e.operator) || null;
|
|
25
|
+
return /* @__PURE__ */ o.createElement(
|
|
26
|
+
m,
|
|
27
|
+
{
|
|
28
|
+
ref: (l) => t = l,
|
|
29
|
+
size: e.size,
|
|
30
|
+
value: r,
|
|
31
|
+
onChange: C,
|
|
32
|
+
className: "k-dropdown-operator",
|
|
33
|
+
iconClassName: "k-i-filter k-icon",
|
|
34
|
+
svgIcon: N,
|
|
35
|
+
data: e.operators,
|
|
36
|
+
textField: "text",
|
|
37
|
+
title: u.toLanguageString(g, d[g]),
|
|
38
|
+
popupSettings: {
|
|
39
|
+
width: "",
|
|
40
|
+
onMouseDownOutside: function(l) {
|
|
41
|
+
!l.isAnchorClicked && l.state && l.state.props.show && t && t.togglePopup();
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
|
-
);
|
|
47
|
-
}, this.inputChange = this.inputChange.bind(this), this.clear = this.clear.bind(this), this.operatorChange = this.operatorChange.bind(this), this.boolDropdownChange = this.boolDropdownChange.bind(this);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* @hidden
|
|
51
|
-
*/
|
|
52
|
-
render() {
|
|
53
|
-
const r = d(this), i = /* @__PURE__ */ o.createElement("div", { className: "k-filtercell" }, /* @__PURE__ */ o.createElement("div", { className: "k-filtercell-wrapper" }, this.filterComponent(this.props.filterType, this.props.value, this.props.booleanValues), /* @__PURE__ */ o.createElement("div", { className: "k-filtercell-operator" }, this.renderOperatorEditor(r), " ", /* @__PURE__ */ o.createElement(
|
|
54
|
-
h,
|
|
55
|
-
{
|
|
56
|
-
size: this.props.size,
|
|
57
|
-
icon: "filter-clear",
|
|
58
|
-
svgIcon: C,
|
|
59
|
-
className: E({
|
|
60
|
-
"k-clear-button-visible": !!(!(this.props.value === null || this.props.value === "") || this.props.operator)
|
|
61
|
-
}),
|
|
62
|
-
title: r.toLanguageString(l, a[l]),
|
|
63
|
-
type: "button",
|
|
64
|
-
onClick: this.clear,
|
|
65
|
-
disabled: !(!(this.props.value === null || this.props.value === "") || this.props.operator)
|
|
66
44
|
}
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
w(r, this.props.onChange);
|
|
78
|
-
}
|
|
79
|
-
clear(r) {
|
|
80
|
-
r.preventDefault(), this.props.onChange({ value: "", operator: "", syntheticEvent: r }), this._inputRef.current && (this._inputRef.current.element.value = "", setTimeout(() => {
|
|
81
|
-
this._inputRef.current.element.focus();
|
|
45
|
+
);
|
|
46
|
+
}, c = (t, r) => {
|
|
47
|
+
B(t, r, e);
|
|
48
|
+
}, C = (t) => {
|
|
49
|
+
y(t, e.value, e.onChange);
|
|
50
|
+
}, v = (t) => {
|
|
51
|
+
O(t, e.onChange);
|
|
52
|
+
}, b = (t) => {
|
|
53
|
+
t.preventDefault(), e.onChange({ value: "", operator: "", syntheticEvent: t }), n.current && (n.current.element.value = "", setTimeout(() => {
|
|
54
|
+
n.current.element.focus();
|
|
82
55
|
}, 0));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
switch (r) {
|
|
56
|
+
}, E = (t, r, l) => {
|
|
57
|
+
switch (t) {
|
|
86
58
|
case "numeric":
|
|
87
59
|
return /* @__PURE__ */ o.createElement(
|
|
88
|
-
|
|
60
|
+
k,
|
|
89
61
|
{
|
|
90
|
-
ref:
|
|
91
|
-
size:
|
|
92
|
-
value:
|
|
93
|
-
onChange: (
|
|
94
|
-
|
|
62
|
+
ref: n,
|
|
63
|
+
size: e.size,
|
|
64
|
+
value: r,
|
|
65
|
+
onChange: (a) => {
|
|
66
|
+
c(a.value, a.syntheticEvent);
|
|
95
67
|
},
|
|
96
|
-
title:
|
|
97
|
-
ariaLabel:
|
|
68
|
+
title: e.title,
|
|
69
|
+
ariaLabel: e.ariaLabel
|
|
98
70
|
}
|
|
99
71
|
);
|
|
100
72
|
case "date":
|
|
101
73
|
return /* @__PURE__ */ o.createElement(
|
|
102
|
-
|
|
74
|
+
L,
|
|
103
75
|
{
|
|
104
|
-
ref:
|
|
105
|
-
size:
|
|
106
|
-
value:
|
|
107
|
-
onChange: (
|
|
108
|
-
|
|
76
|
+
ref: n,
|
|
77
|
+
size: e.size,
|
|
78
|
+
value: r,
|
|
79
|
+
onChange: (a) => {
|
|
80
|
+
c(a.value, a.syntheticEvent);
|
|
109
81
|
},
|
|
110
|
-
title:
|
|
111
|
-
ariaLabel:
|
|
82
|
+
title: e.title,
|
|
83
|
+
ariaLabel: e.ariaLabel,
|
|
112
84
|
popupSettings: {
|
|
113
|
-
onMouseDownOutside: (
|
|
114
|
-
!
|
|
85
|
+
onMouseDownOutside: (a) => {
|
|
86
|
+
!a.isAnchorClicked && a.state && a.state.props.show && n && n.current.togglePopup();
|
|
115
87
|
}
|
|
116
88
|
}
|
|
117
89
|
}
|
|
118
90
|
);
|
|
119
91
|
case "boolean": {
|
|
120
|
-
const
|
|
92
|
+
const a = (i) => i == null;
|
|
121
93
|
return /* @__PURE__ */ o.createElement(
|
|
122
|
-
|
|
94
|
+
m,
|
|
123
95
|
{
|
|
124
|
-
ref:
|
|
125
|
-
size:
|
|
126
|
-
onChange:
|
|
127
|
-
value:
|
|
128
|
-
data:
|
|
96
|
+
ref: n,
|
|
97
|
+
size: e.size,
|
|
98
|
+
onChange: v,
|
|
99
|
+
value: l.find((i) => i.operator === (a(r) ? "" : r)),
|
|
100
|
+
data: l,
|
|
129
101
|
textField: "text",
|
|
130
|
-
title:
|
|
131
|
-
ariaLabel:
|
|
102
|
+
title: e.title,
|
|
103
|
+
ariaLabel: e.ariaLabel,
|
|
132
104
|
popupSettings: {
|
|
133
|
-
onMouseDownOutside: (
|
|
134
|
-
!
|
|
105
|
+
onMouseDownOutside: (i) => {
|
|
106
|
+
!i.isAnchorClicked && i.state && i.state.props.show && n && n.current.togglePopup();
|
|
135
107
|
}
|
|
136
108
|
}
|
|
137
109
|
}
|
|
@@ -139,22 +111,36 @@ class R extends o.Component {
|
|
|
139
111
|
}
|
|
140
112
|
default:
|
|
141
113
|
return /* @__PURE__ */ o.createElement(
|
|
142
|
-
|
|
114
|
+
w,
|
|
143
115
|
{
|
|
144
|
-
ref:
|
|
145
|
-
size:
|
|
146
|
-
value:
|
|
147
|
-
onChange: (
|
|
148
|
-
|
|
116
|
+
ref: n,
|
|
117
|
+
size: e.size,
|
|
118
|
+
value: r || "",
|
|
119
|
+
onChange: (a) => {
|
|
120
|
+
c(a.target.value, a.syntheticEvent);
|
|
149
121
|
},
|
|
150
|
-
title:
|
|
151
|
-
"aria-label":
|
|
122
|
+
title: e.title,
|
|
123
|
+
"aria-label": e.ariaLabel
|
|
152
124
|
}
|
|
153
125
|
);
|
|
154
126
|
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
127
|
+
}, s = /* @__PURE__ */ o.createElement("div", { className: "k-filtercell" }, /* @__PURE__ */ o.createElement("div", { className: "k-filtercell-wrapper" }, E(e.filterType, e.value, e.booleanValues), /* @__PURE__ */ o.createElement("div", { className: "k-filtercell-operator" }, h(), " ", /* @__PURE__ */ o.createElement(
|
|
128
|
+
z,
|
|
129
|
+
{
|
|
130
|
+
size: e.size,
|
|
131
|
+
icon: "filter-clear",
|
|
132
|
+
svgIcon: D,
|
|
133
|
+
className: S({
|
|
134
|
+
"k-clear-button-visible": !!(!(e.value === null || e.value === "") || e.operator)
|
|
135
|
+
}),
|
|
136
|
+
title: u.toLanguageString(f, d[f]),
|
|
137
|
+
type: "button",
|
|
138
|
+
onClick: b,
|
|
139
|
+
disabled: !(!(e.value === null || e.value === "") || e.operator)
|
|
140
|
+
}
|
|
141
|
+
))));
|
|
142
|
+
return e.render ? e.render.call(void 0, s, e) : s;
|
|
143
|
+
};
|
|
158
144
|
export {
|
|
159
|
-
|
|
145
|
+
j as GridFilterCell
|
|
160
146
|
};
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("react"),J=require("./GridColumnMenuItem.js"),K=require("./GridColumnMenuItemGroup.js"),U=require("./GridColumnMenuItemContent.js"),v=require("@progress/kendo-react-inputs"),X=require("@progress/kendo-react-intl"),r=require("../messages/index.js"),D=require("@progress/kendo-data-query"),G=require("@progress/kendo-react-common"),F=require("@progress/kendo-react-buttons"),P=require("../utils/index.js"),S=require("@progress/kendo-svg-icons");function Y(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const m in e)if(m!=="default"){const f=Object.getOwnPropertyDescriptor(e,m);Object.defineProperty(s,m,f.get?f:{enumerable:!0,get:()=>e[m]})}}return s.default=e,Object.freeze(s)}const l=Y(H),Z=(e,s)=>e.length!==s.length?!1:e.every((m,f)=>m===s[f]),p={uniqueData:!0},ee=e=>{const{uniqueData:s=p.uniqueData}=e,m=()=>{const t=e.column.field;return b().filters.findIndex(i=>i.filters&&i.filters.length>0&&i.filters[0].field===t)},f=(t,n)=>{const c=e.column.field||"",i=t.map(o=>P.getNestedValue(c,o));return n?i.filter((o,u)=>i.indexOf(o)===u):i},b=()=>e.filter?G.clone(e.filter):{filters:[],logic:"and"},a=l.useRef(m()),[I,R]=l.useState(e.expanded||!1),[q,B]=l.useState(""),[h,C]=l.useState(f(e.data,s)||[]),[w,L]=l.useState(f(e.data,!1)||[]),[d,V]=l.useState(b());l.useEffect(()=>{const t=e.column.field||"",n=e.data.map(c=>P.getNestedValue(t,c));Z(n,w)||(C(n),L(n))},[e.column,e.data]);const y=()=>e.expanded!==void 0,j=()=>{const t=y(),n=!(t?e.expanded:I);e.onExpandChange&&e.onExpandChange(n),t||R(n)},N=t=>{const n=e.searchBoxFilterOperator?e.searchBoxFilterOperator:"startswith",c={logic:"and",filters:[{field:e.column.field,operator:n,value:t.target.value,ignoreCase:!0}]};B(t.target.value),C(f(D.filterBy(e.data||[],c),s))},T=()=>{const t=e.searchBoxFilterOperator?e.searchBoxFilterOperator:"startswith",n={logic:"and",filters:[{field:e.column.field,operator:t,value:"",ignoreCase:!0}]};B(""),C(f(D.filterBy(e.data||[],n),s))},z=t=>{if(t.preventDefault(),!e.onFilterChange)return;const n=d||null;n!==null&&n.filters.length>0?(a.current>=0&&n.filters.splice(a.current,1),e.onFilterChange(n,t)):e.onFilterChange(null,t),e.onCloseMenu&&e.onCloseMenu()},A=t=>{if(t.preventDefault(),!e.onFilterChange)return;const n=d||null;e.onFilterChange(n,t),e.onCloseMenu&&e.onCloseMenu()},M=(t,n)=>{const c=e.column.field||"",i={...d},o=[...d.filters];let u=[];if(a.current!==-1&&i.filters[a.current].filters&&n!=="all"&&(u=i.filters[a.current].filters),t.value&&n==="all")h.forEach(E=>{u.push({field:c,operator:"eq",value:E})});else if(t.value)u.push({field:c,operator:"eq",value:n});else if(d){const E=u.findIndex($=>$.value===n);u.splice(E,1)}i.logic="and",a.current!==-1?o[a.current]={logic:"or",filters:u}:o.push({logic:"or",filters:u}),(!t.value&&n==="all"||u.length===0)&&o.splice(a.current,1),i.filters=o,V(i)},_=()=>{let t=!1;if(d){const n=[...d.filters];return a.current===-1?!1:(t=h.every(c=>a.current!==-1&&n[a.current].filters?n[a.current].filters.findIndex(o=>o.value===c)>=0:!1),t)}return t},g=X.useLocalization(),{column:x}=e;if(!x||!x.field)return l.createElement("div",null);const Q=y()?e.expanded:I,k=[];if(d){const t=[...d.filters];a.current=t.findIndex(n=>n.filters&&n.filters.length>0?n.filters[0].field===x.field:!1),a.current!==-1&&t[a.current].filters.length>0&&t[a.current].filters.forEach(n=>{n.field===e.column.field&&k.push(n.value)})}const W=e.searchBox?l.createElement(e.searchBox,{value:q,onChange:N}):l.createElement("div",{className:"k-searchbox k-textbox k-input k-input-md k-input-solid"},l.createElement(G.IconWrap,{className:"k-input-icon",name:"search",icon:S.searchIcon}),l.createElement(v.Input,{className:"k-input-inner",type:"text",placeholder:g.toLanguageString(r.searchPlaceholder,r.messages[r.searchPlaceholder]),value:q,onChange:t=>N(t.nativeEvent)}),l.createElement(F.Button,{type:"button",rounded:null,className:"k-input-button",onClick:T,icon:"x",svgIcon:S.xIcon})),O=k.filter((t,n)=>k.indexOf(t)===n);return l.createElement(K.GridColumnMenuItemGroup,null,l.createElement(J.GridColumnMenuItem,{title:g.toLanguageString(r.filterTitle,r.messages[r.filterTitle]),iconClass:"k-i-filter",svgIcon:S.filterIcon,onClick:j}),l.createElement(U.GridColumnMenuItemContent,{show:!!Q},l.createElement("form",{className:"k-filter-menu",onSubmit:A,onReset:z},l.createElement("div",{className:"k-filter-menu-container"},W,l.createElement("ul",{className:"k-reset k-multicheck-wrap"},l.createElement("li",{className:"k-item k-check-all-wrap"},l.createElement(v.Checkbox,{label:g.toLanguageString(r.filterCheckAll,r.messages[r.filterCheckAll]),onChange:t=>M(t,"all"),checked:_()})),h.map((t,n)=>l.createElement("li",{className:"k-item",key:n},l.createElement(v.Checkbox,{label:String(t),onChange:c=>M(c,t),checked:O.includes(t)})))),l.createElement("div",{className:"k-filter-selected-items"},O.length+" "+g.toLanguageString(r.filterSelectedItems,r.messages[r.filterSelectedItems])),l.createElement("div",{className:"k-actions k-hstack k-justify-content-stretch"},l.createElement(F.Button,{themeColor:"primary",type:"submit"},g.toLanguageString(r.filterSubmitButton,r.messages[r.filterSubmitButton])),l.createElement(F.Button,{className:"k-button",type:"reset"},g.toLanguageString(r.filterClearButton,r.messages[r.filterClearButton])))))))};exports.GridColumnMenuCheckboxFilter=ee;
|
|
@@ -6,188 +6,142 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
10
|
-
import { GridColumnMenuItem as
|
|
11
|
-
import { GridColumnMenuItemGroup as
|
|
12
|
-
import { GridColumnMenuItemContent as
|
|
13
|
-
import { Input as
|
|
14
|
-
import {
|
|
15
|
-
import { searchPlaceholder as
|
|
16
|
-
import { filterBy as
|
|
17
|
-
import {
|
|
18
|
-
import { Button as
|
|
19
|
-
import { getNestedValue as
|
|
20
|
-
import { searchIcon as
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
value: e.target.value,
|
|
45
|
-
data: this.parseData(v(this.props.data || [], n), this.props.uniqueData)
|
|
46
|
-
});
|
|
47
|
-
}, this.handleClear = () => {
|
|
48
|
-
const e = this.props.searchBoxFilterOperator ? this.props.searchBoxFilterOperator : "startswith", t = {
|
|
49
|
-
logic: "and",
|
|
50
|
-
filters: [{ field: this.props.column.field, operator: e, value: "", ignoreCase: !0 }]
|
|
51
|
-
};
|
|
52
|
-
this.setState({
|
|
53
|
-
value: "",
|
|
54
|
-
data: this.parseData(v(this.props.data || [], t), this.props.uniqueData)
|
|
55
|
-
});
|
|
56
|
-
}, this.clear = (e) => {
|
|
57
|
-
if (e.preventDefault(), !this.props.onFilterChange)
|
|
58
|
-
return;
|
|
59
|
-
const t = this.state.currentFilter || null;
|
|
60
|
-
t !== null && t.filters.length > 0 ? (this.compositeFilterIndex >= 0 && t.filters.splice(this.compositeFilterIndex, 1), this.props.onFilterChange(t, e)) : this.props.onFilterChange(null, e), this.props.onCloseMenu && this.props.onCloseMenu();
|
|
61
|
-
}, this.submit = (e) => {
|
|
62
|
-
if (e.preventDefault(), !this.props.onFilterChange)
|
|
63
|
-
return;
|
|
64
|
-
const t = this.state.currentFilter || null;
|
|
65
|
-
this.props.onFilterChange(t, e), this.props.onCloseMenu && this.props.onCloseMenu();
|
|
66
|
-
}, this.handleCheckBoxChange = (e, t) => {
|
|
67
|
-
const n = this.props.column.field || "", r = { ...this.state.currentFilter }, a = [...this.state.currentFilter.filters];
|
|
68
|
-
let i = [];
|
|
69
|
-
if (this.compositeFilterIndex !== -1 && r.filters[this.compositeFilterIndex].filters && t !== "all" && (i = r.filters[this.compositeFilterIndex].filters), e.value && t === "all")
|
|
70
|
-
this.state.data.forEach((l) => {
|
|
71
|
-
i.push({ field: n, operator: "eq", value: l });
|
|
72
|
-
});
|
|
73
|
-
else if (e.value)
|
|
74
|
-
i.push({ field: n, operator: "eq", value: t });
|
|
75
|
-
else if (this.state.currentFilter) {
|
|
76
|
-
const l = i.findIndex((c) => c.value === t);
|
|
77
|
-
i.splice(l, 1);
|
|
78
|
-
}
|
|
79
|
-
r.logic = "and", this.compositeFilterIndex !== -1 ? a[this.compositeFilterIndex] = {
|
|
80
|
-
logic: "or",
|
|
81
|
-
filters: i
|
|
82
|
-
} : a.push({
|
|
83
|
-
logic: "or",
|
|
84
|
-
filters: i
|
|
85
|
-
}), (!e.value && t === "all" || i.length === 0) && a.splice(this.compositeFilterIndex, 1), r.filters = a, this.setState({ currentFilter: r });
|
|
86
|
-
}, this.isAllSelected = () => {
|
|
87
|
-
let e = !1;
|
|
88
|
-
if (this.state.currentFilter) {
|
|
89
|
-
const t = [...this.state.currentFilter.filters];
|
|
90
|
-
return this.compositeFilterIndex === -1 ? !1 : (e = this.state.data.every((n) => this.compositeFilterIndex !== -1 && t[this.compositeFilterIndex].filters ? t[this.compositeFilterIndex].filters.findIndex(
|
|
91
|
-
(a) => a.value === n
|
|
92
|
-
) >= 0 : !1), e);
|
|
93
|
-
}
|
|
94
|
-
return e;
|
|
95
|
-
}, this.compositeFilterIndex = this.getFilterIndex(), this.state = {
|
|
96
|
-
expanded: o.expanded || !1,
|
|
97
|
-
value: "",
|
|
98
|
-
data: this.parseData(this.props.data, this.props.uniqueData) || [],
|
|
99
|
-
dataFromProps: this.parseData(this.props.data, !1) || [],
|
|
100
|
-
currentFilter: this.defaultFilter()
|
|
9
|
+
import * as l from "react";
|
|
10
|
+
import { GridColumnMenuItem as Z } from "./GridColumnMenuItem.mjs";
|
|
11
|
+
import { GridColumnMenuItemGroup as _ } from "./GridColumnMenuItemGroup.mjs";
|
|
12
|
+
import { GridColumnMenuItemContent as $ } from "./GridColumnMenuItemContent.mjs";
|
|
13
|
+
import { Input as p, Checkbox as M } from "@progress/kendo-react-inputs";
|
|
14
|
+
import { useLocalization as ee } from "@progress/kendo-react-intl";
|
|
15
|
+
import { searchPlaceholder as O, messages as m, filterTitle as q, filterCheckAll as L, filterSelectedItems as w, filterSubmitButton as V, filterClearButton as G } from "../messages/index.mjs";
|
|
16
|
+
import { filterBy as P } from "@progress/kendo-data-query";
|
|
17
|
+
import { IconWrap as te, clone as ne } from "@progress/kendo-react-common";
|
|
18
|
+
import { Button as F } from "@progress/kendo-react-buttons";
|
|
19
|
+
import { getNestedValue as R } from "../utils/index.mjs";
|
|
20
|
+
import { searchIcon as le, xIcon as re, filterIcon as ae } from "@progress/kendo-svg-icons";
|
|
21
|
+
const ie = (e, u) => e.length !== u.length ? !1 : e.every((h, f) => h === u[f]), ce = {
|
|
22
|
+
uniqueData: !0
|
|
23
|
+
}, Ee = (e) => {
|
|
24
|
+
const { uniqueData: u = ce.uniqueData } = e, h = () => {
|
|
25
|
+
const t = e.column.field;
|
|
26
|
+
return v().filters.findIndex(
|
|
27
|
+
(a) => a.filters && a.filters.length > 0 && a.filters[0].field === t
|
|
28
|
+
);
|
|
29
|
+
}, f = (t, n) => {
|
|
30
|
+
const i = e.column.field || "", a = t.map((c) => R(i, c));
|
|
31
|
+
return n ? a.filter((c, o) => a.indexOf(c) === o) : a;
|
|
32
|
+
}, v = () => e.filter ? ne(e.filter) : { filters: [], logic: "and" }, r = l.useRef(h()), [S, z] = l.useState(e.expanded || !1), [I, b] = l.useState(""), [g, x] = l.useState(f(e.data, u) || []), [A, j] = l.useState(f(e.data, !1) || []), [s, T] = l.useState(v());
|
|
33
|
+
l.useEffect(() => {
|
|
34
|
+
const t = e.column.field || "", n = e.data.map((i) => R(t, i));
|
|
35
|
+
ie(n, A) || (x(n), j(n));
|
|
36
|
+
}, [e.column, e.data]);
|
|
37
|
+
const N = () => e.expanded !== void 0, W = () => {
|
|
38
|
+
const t = N(), n = !(t ? e.expanded : S);
|
|
39
|
+
e.onExpandChange && e.onExpandChange(n), t || z(n);
|
|
40
|
+
}, B = (t) => {
|
|
41
|
+
const n = e.searchBoxFilterOperator ? e.searchBoxFilterOperator : "startswith", i = {
|
|
42
|
+
logic: "and",
|
|
43
|
+
filters: [{ field: e.column.field, operator: n, value: t.target.value, ignoreCase: !0 }]
|
|
101
44
|
};
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
P(e,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
45
|
+
b(t.target.value), x(f(P(e.data || [], i), u));
|
|
46
|
+
}, H = () => {
|
|
47
|
+
const t = e.searchBoxFilterOperator ? e.searchBoxFilterOperator : "startswith", n = {
|
|
48
|
+
logic: "and",
|
|
49
|
+
filters: [{ field: e.column.field, operator: t, value: "", ignoreCase: !0 }]
|
|
50
|
+
};
|
|
51
|
+
b(""), x(f(P(e.data || [], n), u));
|
|
52
|
+
}, J = (t) => {
|
|
53
|
+
if (t.preventDefault(), !e.onFilterChange)
|
|
54
|
+
return;
|
|
55
|
+
const n = s || null;
|
|
56
|
+
n !== null && n.filters.length > 0 ? (r.current >= 0 && n.filters.splice(r.current, 1), e.onFilterChange(n, t)) : e.onFilterChange(null, t), e.onCloseMenu && e.onCloseMenu();
|
|
57
|
+
}, K = (t) => {
|
|
58
|
+
if (t.preventDefault(), !e.onFilterChange)
|
|
59
|
+
return;
|
|
60
|
+
const n = s || null;
|
|
61
|
+
e.onFilterChange(n, t), e.onCloseMenu && e.onCloseMenu();
|
|
62
|
+
}, D = (t, n) => {
|
|
63
|
+
const i = e.column.field || "", a = { ...s }, c = [...s.filters];
|
|
64
|
+
let o = [];
|
|
65
|
+
if (r.current !== -1 && a.filters[r.current].filters && n !== "all" && (o = a.filters[r.current].filters), t.value && n === "all")
|
|
66
|
+
g.forEach((E) => {
|
|
67
|
+
o.push({ field: i, operator: "eq", value: E });
|
|
125
68
|
});
|
|
69
|
+
else if (t.value)
|
|
70
|
+
o.push({ field: i, operator: "eq", value: n });
|
|
71
|
+
else if (s) {
|
|
72
|
+
const E = o.findIndex((Y) => Y.value === n);
|
|
73
|
+
o.splice(E, 1);
|
|
126
74
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
title: e.toLanguageString(g, h[g]),
|
|
153
|
-
iconClass: "k-i-filter",
|
|
154
|
-
svgIcon: M,
|
|
155
|
-
onClick: this.onFilterExpand
|
|
156
|
-
}
|
|
157
|
-
), /* @__PURE__ */ s.createElement(N, { show: !!t }, /* @__PURE__ */ s.createElement("form", { className: "k-filter-menu", onSubmit: this.submit, onReset: this.clear }, /* @__PURE__ */ s.createElement("div", { className: "k-filter-menu-container" }, r, /* @__PURE__ */ s.createElement("ul", { className: "k-reset k-multicheck-wrap" }, /* @__PURE__ */ s.createElement("li", { className: "k-item k-check-all-wrap" }, /* @__PURE__ */ s.createElement(
|
|
158
|
-
m,
|
|
159
|
-
{
|
|
160
|
-
label: e.toLanguageString(
|
|
161
|
-
F,
|
|
162
|
-
h[F]
|
|
163
|
-
),
|
|
164
|
-
onChange: (i) => this.handleCheckBoxChange(i, "all"),
|
|
165
|
-
checked: this.isAllSelected()
|
|
166
|
-
}
|
|
167
|
-
)), this.state.data.map((i, l) => /* @__PURE__ */ s.createElement("li", { className: "k-item", key: l }, /* @__PURE__ */ s.createElement(
|
|
168
|
-
m,
|
|
169
|
-
{
|
|
170
|
-
label: String(i),
|
|
171
|
-
onChange: (c) => this.handleCheckBoxChange(c, i),
|
|
172
|
-
checked: a.includes(i)
|
|
173
|
-
}
|
|
174
|
-
)))), /* @__PURE__ */ s.createElement("div", { className: "k-filter-selected-items" }, a.length + " " + e.toLanguageString(
|
|
175
|
-
C,
|
|
176
|
-
h[C]
|
|
177
|
-
)), /* @__PURE__ */ s.createElement("div", { className: "k-actions k-hstack k-justify-content-stretch" }, /* @__PURE__ */ s.createElement(p, { themeColor: "primary", type: "submit" }, e.toLanguageString(
|
|
178
|
-
I,
|
|
179
|
-
h[I]
|
|
180
|
-
)), /* @__PURE__ */ s.createElement(p, { className: "k-button", type: "reset" }, e.toLanguageString(
|
|
181
|
-
k,
|
|
182
|
-
h[k]
|
|
183
|
-
)))))));
|
|
75
|
+
a.logic = "and", r.current !== -1 ? c[r.current] = {
|
|
76
|
+
logic: "or",
|
|
77
|
+
filters: o
|
|
78
|
+
} : c.push({
|
|
79
|
+
logic: "or",
|
|
80
|
+
filters: o
|
|
81
|
+
}), (!t.value && n === "all" || o.length === 0) && c.splice(r.current, 1), a.filters = c, T(a);
|
|
82
|
+
}, Q = () => {
|
|
83
|
+
let t = !1;
|
|
84
|
+
if (s) {
|
|
85
|
+
const n = [...s.filters];
|
|
86
|
+
return r.current === -1 ? !1 : (t = g.every((i) => r.current !== -1 && n[r.current].filters ? n[r.current].filters.findIndex(
|
|
87
|
+
(c) => c.value === i
|
|
88
|
+
) >= 0 : !1), t);
|
|
89
|
+
}
|
|
90
|
+
return t;
|
|
91
|
+
}, d = ee(), { column: C } = e;
|
|
92
|
+
if (!C || !C.field)
|
|
93
|
+
return /* @__PURE__ */ l.createElement("div", null);
|
|
94
|
+
const U = N() ? e.expanded : S, k = [];
|
|
95
|
+
if (s) {
|
|
96
|
+
const t = [...s.filters];
|
|
97
|
+
r.current = t.findIndex((n) => n.filters && n.filters.length > 0 ? n.filters[0].field === C.field : !1), r.current !== -1 && t[r.current].filters.length > 0 && t[r.current].filters.forEach((n) => {
|
|
98
|
+
n.field === e.column.field && k.push(n.value);
|
|
99
|
+
});
|
|
184
100
|
}
|
|
101
|
+
const X = e.searchBox ? /* @__PURE__ */ l.createElement(e.searchBox, { value: I, onChange: B }) : /* @__PURE__ */ l.createElement("div", { className: "k-searchbox k-textbox k-input k-input-md k-input-solid" }, /* @__PURE__ */ l.createElement(te, { className: "k-input-icon", name: "search", icon: le }), /* @__PURE__ */ l.createElement(
|
|
102
|
+
p,
|
|
103
|
+
{
|
|
104
|
+
className: "k-input-inner",
|
|
105
|
+
type: "text",
|
|
106
|
+
placeholder: d.toLanguageString(O, m[O]),
|
|
107
|
+
value: I,
|
|
108
|
+
onChange: (t) => B(t.nativeEvent)
|
|
109
|
+
}
|
|
110
|
+
), /* @__PURE__ */ l.createElement(
|
|
111
|
+
F,
|
|
112
|
+
{
|
|
113
|
+
type: "button",
|
|
114
|
+
rounded: null,
|
|
115
|
+
className: "k-input-button",
|
|
116
|
+
onClick: H,
|
|
117
|
+
icon: "x",
|
|
118
|
+
svgIcon: re
|
|
119
|
+
}
|
|
120
|
+
)), y = k.filter((t, n) => k.indexOf(t) === n);
|
|
121
|
+
return /* @__PURE__ */ l.createElement(_, null, /* @__PURE__ */ l.createElement(
|
|
122
|
+
Z,
|
|
123
|
+
{
|
|
124
|
+
title: d.toLanguageString(q, m[q]),
|
|
125
|
+
iconClass: "k-i-filter",
|
|
126
|
+
svgIcon: ae,
|
|
127
|
+
onClick: W
|
|
128
|
+
}
|
|
129
|
+
), /* @__PURE__ */ l.createElement($, { show: !!U }, /* @__PURE__ */ l.createElement("form", { className: "k-filter-menu", onSubmit: K, onReset: J }, /* @__PURE__ */ l.createElement("div", { className: "k-filter-menu-container" }, X, /* @__PURE__ */ l.createElement("ul", { className: "k-reset k-multicheck-wrap" }, /* @__PURE__ */ l.createElement("li", { className: "k-item k-check-all-wrap" }, /* @__PURE__ */ l.createElement(
|
|
130
|
+
M,
|
|
131
|
+
{
|
|
132
|
+
label: d.toLanguageString(L, m[L]),
|
|
133
|
+
onChange: (t) => D(t, "all"),
|
|
134
|
+
checked: Q()
|
|
135
|
+
}
|
|
136
|
+
)), g.map((t, n) => /* @__PURE__ */ l.createElement("li", { className: "k-item", key: n }, /* @__PURE__ */ l.createElement(
|
|
137
|
+
M,
|
|
138
|
+
{
|
|
139
|
+
label: String(t),
|
|
140
|
+
onChange: (i) => D(i, t),
|
|
141
|
+
checked: y.includes(t)
|
|
142
|
+
}
|
|
143
|
+
)))), /* @__PURE__ */ l.createElement("div", { className: "k-filter-selected-items" }, y.length + " " + d.toLanguageString(w, m[w])), /* @__PURE__ */ l.createElement("div", { className: "k-actions k-hstack k-justify-content-stretch" }, /* @__PURE__ */ l.createElement(F, { themeColor: "primary", type: "submit" }, d.toLanguageString(V, m[V])), /* @__PURE__ */ l.createElement(F, { className: "k-button", type: "reset" }, d.toLanguageString(G, m[G])))))));
|
|
185
144
|
};
|
|
186
|
-
u.defaultProps = {
|
|
187
|
-
uniqueData: !0
|
|
188
|
-
};
|
|
189
|
-
let d = u;
|
|
190
|
-
y(d);
|
|
191
145
|
export {
|
|
192
|
-
|
|
146
|
+
Ee as GridColumnMenuCheckboxFilter
|
|
193
147
|
};
|