@progress/kendo-react-grid 8.3.0-develop.9 → 8.4.0-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 +245 -249
- package/StatusBar.js +1 -1
- package/StatusBar.mjs +3 -1
- package/cells/GridFilterCell.js +1 -1
- package/cells/GridFilterCell.mjs +67 -52
- package/columnMenu/GridColumnMenuColumnsList.mjs +24 -10
- package/columnMenu/GridColumnMenuWrapper.js +1 -1
- package/columnMenu/GridColumnMenuWrapper.mjs +52 -49
- package/dist/cdn/js/kendo-react-grid.js +1 -1
- package/index.d.mts +4 -0
- package/index.d.ts +4 -0
- package/package-metadata.mjs +1 -1
- package/package.json +10 -10
package/StatusBar.js
CHANGED
|
@@ -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 E=require("react"),h=require("@progress/kendo-react-common");function O(r){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(s,o,n.get?n:{enumerable:!0,get:()=>r[o]})}}return s.default=r,Object.freeze(s)}const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react"),h=require("@progress/kendo-react-common");function O(r){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const o in r)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(r,o);Object.defineProperty(s,o,n.get?n:{enumerable:!0,get:()=>r[o]})}}return s.default=r,Object.freeze(s)}const l=O(E),b=r=>{const{data:s=[]}=r;return l.createElement("div",{className:"k-selection-aggregates k-grid-selection-aggregates"},s.map((o,n)=>l.createElement("div",{key:n},l.createElement("span",{className:"k-selection-aggregates-item-text"},o.type,": "),l.createElement("span",{className:"k-selection-aggregates-item-value"},o.formattedValue))))};b.displayName="KendoReactGridStatusBar";const p=r=>{var o;const s=r.slice();for(let n=0;n<s.length;n++)for(;s[n]&&((o=s[n].children)!=null&&o.length);)s.splice(n,1,...s[n].children);return s},j=r=>{const{dataItems:s,target:o,selectedField:n}=r,y=p(o.columns).map(e=>e.field).filter(e=>e&&typeof e=="string").map(e=>h.getter(e)),S=h.getter(n),t={dates:[],numbers:[],booleans:[],others:[]},D=e=>{typeof e=="number"?t.numbers.push(e):typeof e=="boolean"?t.booleans.push(e):e instanceof Date?t.dates.push(e):t.others.push(e)};s.forEach(e=>{const a=S(e);a&&a.forEach(c=>{D(y[c](e))})});const u=t.dates.map(e=>e.getTime()),g=t.booleans.filter(e=>e).length,m=t.booleans.filter(e=>!e).length,i=t.numbers.length?t.numbers.reduce((e,a)=>e+=a,0):void 0,d={sum:i,average:typeof i=="number"?i/t.numbers.length:void 0,min:t.numbers.length?Math.min(...t.numbers):void 0,max:t.numbers.length?Math.max(...t.numbers):void 0,count:t.numbers.length+t.booleans.length+t.dates.length+t.others.length,isTrue:g>0?g:void 0,isFalse:m>0?m:void 0,earliest:t.dates.length?new Date(Math.min(...u)):void 0,latest:t.dates.length?new Date(Math.max(...u)):void 0},v=(e,a)=>(a==="sum"||a==="average")&&typeof e=="number"?e.toFixed(2):(a==="earliest"||a==="latest")&&e instanceof Date?e.toLocaleDateString():String(e),f=[];return Object.keys(d).forEach(e=>{const a=e,c=d[a];c!==void 0&&f.push({type:a,value:c,formattedValue:v(c,a)})}),f};exports.StatusBar=b;exports.getStatusData=j;exports.leafColumns=p;
|
package/StatusBar.mjs
CHANGED
|
@@ -21,7 +21,9 @@ const D = (r) => {
|
|
|
21
21
|
n.splice(a, 1, ...n[a].children);
|
|
22
22
|
return n;
|
|
23
23
|
}, N = (r) => {
|
|
24
|
-
const { dataItems: n, target: o, selectedField: a } = r, p = D(o.columns).map((e) => e.field).filter((e) => e && typeof e == "string").map(
|
|
24
|
+
const { dataItems: n, target: o, selectedField: a } = r, p = D(o.columns).map((e) => e.field).filter((e) => e && typeof e == "string").map(
|
|
25
|
+
(e) => f(e)
|
|
26
|
+
), b = f(a), t = { dates: [], numbers: [], booleans: [], others: [] }, y = (e) => {
|
|
25
27
|
typeof e == "number" ? t.numbers.push(e) : typeof e == "boolean" ? t.booleans.push(e) : e instanceof Date ? t.dates.push(e) : t.others.push(e);
|
|
26
28
|
};
|
|
27
29
|
n.forEach((e) => {
|
package/cells/GridFilterCell.js
CHANGED
|
@@ -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 g=require("react"),f=require("@progress/kendo-react-buttons"),l=require("@progress/kendo-react-dropdowns"),c=require("@progress/kendo-react-inputs"),C=require("@progress/kendo-react-dateinputs"),a=require("../messages/index.js"),u=require("@progress/kendo-react-intl"),h=require("@progress/kendo-svg-icons"),p=require("../filterCommon.js"),m=require("@progress/kendo-react-common");function b(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const i=b(g);class d extends i.Component{constructor(e){super(e),this._inputRef=i.createRef(),this.renderOperatorEditor=t=>{if(this.props.filterType==="boolean")return;let s;const r=this.props.operators.find(o=>o.operator===this.props.operator)||null;return i.createElement(l.DropDownList,{ref:o=>s=o,size:this.props.size,value:r,onChange:this.operatorChange,className:"k-dropdown-operator",iconClassName:"k-i-filter k-icon",svgIcon:h.filterIcon,data:this.props.operators,textField:"text",title:t.toLanguageString(a.filterChooseOperator,a.messages[a.filterChooseOperator]),popupSettings:{width:"",onMouseDownOutside:function(o){!o.isAnchorClicked&&o.state&&o.state.props.show&&s&&s.togglePopup()}}})},this.inputChange=this.inputChange.bind(this),this.clear=this.clear.bind(this),this.operatorChange=this.operatorChange.bind(this),this.boolDropdownChange=this.boolDropdownChange.bind(this)}render(){const e=u.provideLocalizationService(this),t=i.createElement("div",{className:"k-filtercell"},i.createElement("div",{className:"k-filtercell-wrapper"},this.filterComponent(this.props.filterType,this.props.value,this.props.booleanValues),i.createElement("div",{className:"k-filtercell-operator"},this.renderOperatorEditor(e)," ",i.createElement(f.Button,{size:this.props.size,icon:"filter-clear",svgIcon:h.filterClearIcon,className:m.classNames({"k-clear-button-visible":!!(!(this.props.value===null||this.props.value==="")||this.props.operator)}),title:e.toLanguageString(a.filterClearButton,a.messages[a.filterClearButton]),type:"button",onClick:this.clear,disabled:!(!(this.props.value===null||this.props.value==="")||this.props.operator)}))));return this.props.render?this.props.render.call(void 0,t,this.props):t}inputChange(e,t){p.cellInputChange(e,t,this.props)}operatorChange(e){p.cellOperatorChange(e,this.props.value,this.props.onChange)}boolDropdownChange(e){p.cellBoolDropdownChange(e,this.props.onChange)}clear(e){e.preventDefault(),this.props.onChange({value:"",operator:"",syntheticEvent:e}),this._inputRef.current&&(this._inputRef.current.element.value="",setTimeout(()=>{this._inputRef.current.element.focus()},0))}filterComponent(e,t,s){switch(e){case"numeric":return i.createElement(c.NumericTextBox,{ref:this._inputRef,size:this.props.size,value:t,onChange:r=>{this.inputChange(r.value,r.syntheticEvent)},title:this.props.title,ariaLabel:this.props.ariaLabel});case"date":return i.createElement(C.DatePicker,{ref:this._inputRef,size:this.props.size,value:t,onChange:r=>{this.inputChange(r.value,r.syntheticEvent)},title:this.props.title,ariaLabel:this.props.ariaLabel,popupSettings:{onMouseDownOutside:r=>{!r.isAnchorClicked&&r.state&&r.state.props.show&&this._inputRef&&this._inputRef.current.togglePopup()}}});case"boolean":{const r=o=>o==null;return i.createElement(l.DropDownList,{ref:this._inputRef,size:this.props.size,onChange:this.boolDropdownChange,value:s.find(o=>o.operator===(r(t)?"":t)),data:s,textField:"text",title:this.props.title,ariaLabel:this.props.ariaLabel,popupSettings:{onMouseDownOutside:o=>{!o.isAnchorClicked&&o.state&&o.state.props.show&&this._inputRef&&this._inputRef.current.togglePopup()}}})}default:return i.createElement(c.TextBox,{ref:this._inputRef,size:this.props.size,value:t||"",onChange:r=>{this.inputChange(r.target.value,r.syntheticEvent)},title:this.props.title,"aria-label":this.props.ariaLabel})}}}u.registerForLocalization(d);exports.GridFilterCell=d;
|
package/cells/GridFilterCell.mjs
CHANGED
|
@@ -6,36 +6,41 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as o from "react";
|
|
10
10
|
import { Button as h } from "@progress/kendo-react-buttons";
|
|
11
|
-
import { DropDownList as
|
|
11
|
+
import { DropDownList as p } from "@progress/kendo-react-dropdowns";
|
|
12
12
|
import { TextBox as c, NumericTextBox as u } from "@progress/kendo-react-inputs";
|
|
13
|
-
import { DatePicker as
|
|
14
|
-
import { filterChooseOperator as n, messages as
|
|
15
|
-
import { provideLocalizationService as
|
|
16
|
-
import { filterIcon as
|
|
17
|
-
import { cellInputChange as
|
|
13
|
+
import { DatePicker as f } from "@progress/kendo-react-dateinputs";
|
|
14
|
+
import { filterChooseOperator as n, messages as a, filterClearButton as l } from "../messages/index.mjs";
|
|
15
|
+
import { provideLocalizationService as d, registerForLocalization as g } from "@progress/kendo-react-intl";
|
|
16
|
+
import { filterIcon as m, filterClearIcon as C } from "@progress/kendo-svg-icons";
|
|
17
|
+
import { cellInputChange as b, cellOperatorChange as v, cellBoolDropdownChange as w } from "../filterCommon.mjs";
|
|
18
18
|
import { classNames as E } from "@progress/kendo-react-common";
|
|
19
|
-
class
|
|
20
|
-
constructor(
|
|
21
|
-
super(
|
|
19
|
+
class R extends o.Component {
|
|
20
|
+
constructor(r) {
|
|
21
|
+
super(r), this._inputRef = o.createRef(), this.renderOperatorEditor = (i) => {
|
|
22
22
|
if (this.props.filterType === "boolean")
|
|
23
23
|
return;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
let s;
|
|
25
|
+
const e = this.props.operators.find((t) => t.operator === this.props.operator) || null;
|
|
26
|
+
return /* @__PURE__ */ o.createElement(
|
|
27
|
+
p,
|
|
27
28
|
{
|
|
29
|
+
ref: (t) => s = t,
|
|
28
30
|
size: this.props.size,
|
|
29
|
-
value:
|
|
31
|
+
value: e,
|
|
30
32
|
onChange: this.operatorChange,
|
|
31
33
|
className: "k-dropdown-operator",
|
|
32
34
|
iconClassName: "k-i-filter k-icon",
|
|
33
|
-
svgIcon:
|
|
35
|
+
svgIcon: m,
|
|
34
36
|
data: this.props.operators,
|
|
35
37
|
textField: "text",
|
|
36
|
-
title:
|
|
38
|
+
title: i.toLanguageString(n, a[n]),
|
|
37
39
|
popupSettings: {
|
|
38
|
-
width: ""
|
|
40
|
+
width: "",
|
|
41
|
+
onMouseDownOutside: function(t) {
|
|
42
|
+
!t.isAnchorClicked && t.state && t.state.props.show && s && s.togglePopup();
|
|
43
|
+
}
|
|
39
44
|
}
|
|
40
45
|
}
|
|
41
46
|
);
|
|
@@ -45,7 +50,7 @@ class L extends i.Component {
|
|
|
45
50
|
* @hidden
|
|
46
51
|
*/
|
|
47
52
|
render() {
|
|
48
|
-
const
|
|
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(
|
|
49
54
|
h,
|
|
50
55
|
{
|
|
51
56
|
size: this.props.size,
|
|
@@ -54,83 +59,93 @@ class L extends i.Component {
|
|
|
54
59
|
className: E({
|
|
55
60
|
"k-clear-button-visible": !!(!(this.props.value === null || this.props.value === "") || this.props.operator)
|
|
56
61
|
}),
|
|
57
|
-
title:
|
|
62
|
+
title: r.toLanguageString(l, a[l]),
|
|
58
63
|
type: "button",
|
|
59
64
|
onClick: this.clear,
|
|
60
65
|
disabled: !(!(this.props.value === null || this.props.value === "") || this.props.operator)
|
|
61
66
|
}
|
|
62
67
|
))));
|
|
63
|
-
return this.props.render ? this.props.render.call(void 0,
|
|
68
|
+
return this.props.render ? this.props.render.call(void 0, i, this.props) : i;
|
|
64
69
|
}
|
|
65
|
-
inputChange(
|
|
66
|
-
|
|
70
|
+
inputChange(r, i) {
|
|
71
|
+
b(r, i, this.props);
|
|
67
72
|
}
|
|
68
|
-
operatorChange(
|
|
69
|
-
|
|
73
|
+
operatorChange(r) {
|
|
74
|
+
v(r, this.props.value, this.props.onChange);
|
|
70
75
|
}
|
|
71
|
-
boolDropdownChange(
|
|
72
|
-
|
|
76
|
+
boolDropdownChange(r) {
|
|
77
|
+
w(r, this.props.onChange);
|
|
73
78
|
}
|
|
74
|
-
clear(
|
|
75
|
-
|
|
79
|
+
clear(r) {
|
|
80
|
+
r.preventDefault(), this.props.onChange({ value: "", operator: "", syntheticEvent: r }), this._inputRef.current && (this._inputRef.current.element.value = "", setTimeout(() => {
|
|
76
81
|
this._inputRef.current.element.focus();
|
|
77
82
|
}, 0));
|
|
78
83
|
}
|
|
79
|
-
filterComponent(
|
|
80
|
-
switch (
|
|
84
|
+
filterComponent(r, i, s) {
|
|
85
|
+
switch (r) {
|
|
81
86
|
case "numeric":
|
|
82
|
-
return /* @__PURE__ */
|
|
87
|
+
return /* @__PURE__ */ o.createElement(
|
|
83
88
|
u,
|
|
84
89
|
{
|
|
85
90
|
ref: this._inputRef,
|
|
86
91
|
size: this.props.size,
|
|
87
|
-
value:
|
|
88
|
-
onChange: (
|
|
89
|
-
this.inputChange(
|
|
92
|
+
value: i,
|
|
93
|
+
onChange: (e) => {
|
|
94
|
+
this.inputChange(e.value, e.syntheticEvent);
|
|
90
95
|
},
|
|
91
96
|
title: this.props.title,
|
|
92
97
|
ariaLabel: this.props.ariaLabel
|
|
93
98
|
}
|
|
94
99
|
);
|
|
95
100
|
case "date":
|
|
96
|
-
return /* @__PURE__ */
|
|
97
|
-
|
|
101
|
+
return /* @__PURE__ */ o.createElement(
|
|
102
|
+
f,
|
|
98
103
|
{
|
|
99
104
|
ref: this._inputRef,
|
|
100
105
|
size: this.props.size,
|
|
101
|
-
value:
|
|
102
|
-
onChange: (
|
|
103
|
-
this.inputChange(
|
|
106
|
+
value: i,
|
|
107
|
+
onChange: (e) => {
|
|
108
|
+
this.inputChange(e.value, e.syntheticEvent);
|
|
104
109
|
},
|
|
105
110
|
title: this.props.title,
|
|
106
|
-
ariaLabel: this.props.ariaLabel
|
|
111
|
+
ariaLabel: this.props.ariaLabel,
|
|
112
|
+
popupSettings: {
|
|
113
|
+
onMouseDownOutside: (e) => {
|
|
114
|
+
!e.isAnchorClicked && e.state && e.state.props.show && this._inputRef && this._inputRef.current.togglePopup();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
107
117
|
}
|
|
108
118
|
);
|
|
109
119
|
case "boolean": {
|
|
110
|
-
const
|
|
111
|
-
return /* @__PURE__ */
|
|
112
|
-
|
|
120
|
+
const e = (t) => t == null;
|
|
121
|
+
return /* @__PURE__ */ o.createElement(
|
|
122
|
+
p,
|
|
113
123
|
{
|
|
114
124
|
ref: this._inputRef,
|
|
115
125
|
size: this.props.size,
|
|
116
126
|
onChange: this.boolDropdownChange,
|
|
117
|
-
value:
|
|
118
|
-
data:
|
|
127
|
+
value: s.find((t) => t.operator === (e(i) ? "" : i)),
|
|
128
|
+
data: s,
|
|
119
129
|
textField: "text",
|
|
120
130
|
title: this.props.title,
|
|
121
|
-
ariaLabel: this.props.ariaLabel
|
|
131
|
+
ariaLabel: this.props.ariaLabel,
|
|
132
|
+
popupSettings: {
|
|
133
|
+
onMouseDownOutside: (t) => {
|
|
134
|
+
!t.isAnchorClicked && t.state && t.state.props.show && this._inputRef && this._inputRef.current.togglePopup();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
122
137
|
}
|
|
123
138
|
);
|
|
124
139
|
}
|
|
125
140
|
default:
|
|
126
|
-
return /* @__PURE__ */
|
|
141
|
+
return /* @__PURE__ */ o.createElement(
|
|
127
142
|
c,
|
|
128
143
|
{
|
|
129
144
|
ref: this._inputRef,
|
|
130
145
|
size: this.props.size,
|
|
131
|
-
value:
|
|
132
|
-
onChange: (
|
|
133
|
-
this.inputChange(
|
|
146
|
+
value: i || "",
|
|
147
|
+
onChange: (e) => {
|
|
148
|
+
this.inputChange(e.target.value, e.syntheticEvent);
|
|
134
149
|
},
|
|
135
150
|
title: this.props.title,
|
|
136
151
|
"aria-label": this.props.ariaLabel
|
|
@@ -139,7 +154,7 @@ class L extends i.Component {
|
|
|
139
154
|
}
|
|
140
155
|
}
|
|
141
156
|
}
|
|
142
|
-
|
|
157
|
+
g(R);
|
|
143
158
|
export {
|
|
144
|
-
|
|
159
|
+
R as GridFilterCell
|
|
145
160
|
};
|
|
@@ -14,21 +14,35 @@ import { Button as f } from "@progress/kendo-react-buttons";
|
|
|
14
14
|
import { useLocalization as I } from "@progress/kendo-react-intl";
|
|
15
15
|
import { filterSelectAll as h, messages as u, filterApplyButton as g, filterResetButton as E } from "../messages/index.mjs";
|
|
16
16
|
const R = (l) => {
|
|
17
|
-
const [a, S] = t.useState(""), d = l.columns.reduce(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const [a, S] = t.useState(""), d = l.columns.reduce(
|
|
18
|
+
(e, n) => ({ ...e, [n.id || ""]: !!l.columnsState.find((o) => o.id === n.id) }),
|
|
19
|
+
{}
|
|
20
|
+
), [c, m] = t.useState(d), b = t.useMemo(
|
|
21
|
+
() => l.columns.filter((e) => {
|
|
22
|
+
var n;
|
|
23
|
+
return (n = e.title || e.field) == null ? void 0 : n.toLowerCase().includes(a.toLowerCase());
|
|
24
|
+
}),
|
|
25
|
+
[l.columns, a]
|
|
26
|
+
), r = I(), N = t.useCallback(() => {
|
|
21
27
|
const e = l.columns.filter((n) => c[n.id || ""]);
|
|
22
28
|
l.onColumnsChange.call(void 0, e), l.onCloseMenu.call(void 0);
|
|
23
29
|
}, [c, l.columns, l.onColumnsChange, l.onCloseMenu]), x = () => {
|
|
24
30
|
m(d);
|
|
25
|
-
}, s = t.useMemo(
|
|
31
|
+
}, s = t.useMemo(
|
|
32
|
+
() => Object.values(c).filter((e) => e).length,
|
|
33
|
+
[c]
|
|
34
|
+
), i = t.useMemo(() => s === l.columns.length, [l.columns, s]), y = t.useCallback(() => {
|
|
26
35
|
const e = { ...c };
|
|
27
|
-
Object.keys(e).forEach(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
Object.keys(e).forEach(
|
|
37
|
+
(n, o) => e[n] = i && o === 0 ? !0 : !i
|
|
38
|
+
), m(e);
|
|
39
|
+
}, [c, i]), L = t.useCallback(
|
|
40
|
+
(e, n) => {
|
|
41
|
+
const o = { ...c };
|
|
42
|
+
o[n || ""] = e, m(o);
|
|
43
|
+
},
|
|
44
|
+
[c]
|
|
45
|
+
), v = (e) => {
|
|
32
46
|
S(String(e.target.value));
|
|
33
47
|
};
|
|
34
48
|
return /* @__PURE__ */ t.createElement("form", { className: "k-filter-menu" }, /* @__PURE__ */ t.createElement("div", { className: "k-filter-menu-container" }, /* @__PURE__ */ t.createElement(
|
|
@@ -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 W=require("react"),_=require("@progress/kendo-react-popup"),a=require("@progress/kendo-react-common"),j=require("@progress/kendo-svg-icons"),E=require("../messages/index.js"),z=require("@progress/kendo-react-intl");function A(n){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const u in n)if(u!=="default"){const l=Object.getOwnPropertyDescriptor(n,u);Object.defineProperty(r,u,l.get?l:{enumerable:!0,get:()=>n[u]})}}return r.default=n,Object.freeze(r)}const o=A(W),$=[".k-columnmenu-item-content",".k-filter-menu-container"].map(n=>a.TABBABLE_ELEMENTS.map(r=>`${n} ${r}`)),x=[[".k-tabstrip-items"],[".k-columnmenu-item"],...$],F=n=>{const[r,u]=o.useState(!1),l=o.useRef(null),i=o.useRef(null),s=o.useRef(null),m=o.useRef(0),{columnMenu:M,...v}=n,{column:k,columnMenuIcon:f,navigatable:w}=n,p=z.useLocalization(),b=k.title||k.field,y=b?`${b} `:"",C="#",D=e=>{const t=a.getActiveElement(document);clearTimeout(m.current),m.current=window.setTimeout(()=>{t&&e.relatedTarget!==l.current&&i.current&&!i.current.contains(t)&&d()})},S=()=>{clearTimeout(m.current)},T=e=>{e.preventDefault(),r&&n.onCloseMenu&&n.onCloseMenu(),u(!r)},d=()=>{n.onCloseMenu&&n.onCloseMenu(),u(!1),!n.navigatable&&l.current&&l.current.focus()},I=e=>{var t;if(e.keyCode===a.Keys.tab){const c=e.target,h=c&&((t=c.closest(".k-grid"))==null?void 0:t.getElementsByClassName("k-grid-content")[0]);h&&h.scrollWidth>h.clientWidth&&c.scrollIntoView({inline:"center"})}},g=o.useMemo(()=>n.show!==void 0?n.show:r,[n.show,r]),R=e=>{var t;(t=s.current)==null||t.triggerKeyboardEvent(e)},O=e=>{var t;(t=s.current)==null||t.triggerMouseEvent(e)},K=(e,t,c)=>{c.preventDefault(),c.shiftKey?t.focusPrevious(e):t.focusNext(e)},P=(e,t,c)=>{e&&e.click()},q=(e,t,c)=>{c.preventDefault(),d()},B=(e,t,c)=>{c.preventDefault(),t.focusElement(e)},N=e=>{!e.isAnchorClicked&&u(!1)};return o.useEffect(()=>(g&&i.current&&(s.current=new a.Navigation({tabIndex:0,root:i,selectors:x,keyboardEvents:{keydown:{Tab:K,Enter:P,Escape:q}},mouseEvents:{mousedown:B}}),s.current.focusElement(s.current.first,null)),()=>{s.current&&(s.current=null)}),[g]),o.createElement(o.Fragment,null,o.createElement("a",{className:"k-grid-header-menu k-grid-column-menu",ref:l,onClick:T,onKeyDown:I,href:C,tabIndex:w?-1:void 0,"aria-label":`${w?"":y}${p.toLanguageString(E.columnMenu,E.messages[E.columnMenu])}`},f?o.createElement(a.IconWrap,{name:f.name,icon:f}):o.createElement(a.IconWrap,{name:"more-vertical",icon:j.moreVerticalIcon})),o.createElement(_.Popup,{anchor:l.current,show:g,popupClass:"k-column-menu k-column-menu-popup k-grid-columnmenu-popup",onMouseDownOutside:N},o.createElement("div",{ref:i,onBlur:D,onFocus:S,onMouseDown:O,onKeyDown:R,style:{outline:"none"}},M&&o.createElement(M,{...v,onCloseMenu:d}))))};exports.GridColumnMenuWrapper=F;
|
|
@@ -6,109 +6,112 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import * as
|
|
9
|
+
import * as o from "react";
|
|
10
10
|
import { Popup as z } from "@progress/kendo-react-popup";
|
|
11
|
-
import { TABBABLE_ELEMENTS as
|
|
11
|
+
import { TABBABLE_ELEMENTS as F, Navigation as L, IconWrap as v, getActiveElement as W, Keys as P } from "@progress/kendo-react-common";
|
|
12
12
|
import { moreVerticalIcon as V } from "@progress/kendo-svg-icons";
|
|
13
13
|
import { columnMenu as k, messages as _ } from "../messages/index.mjs";
|
|
14
14
|
import { useLocalization as H } from "@progress/kendo-react-intl";
|
|
15
|
-
const
|
|
15
|
+
const O = [
|
|
16
16
|
".k-columnmenu-item-content",
|
|
17
17
|
".k-filter-menu-container"
|
|
18
|
-
].map((
|
|
19
|
-
(u) => `${
|
|
18
|
+
].map((t) => F.map(
|
|
19
|
+
(u) => `${t} ${u}`
|
|
20
20
|
)), G = [
|
|
21
21
|
[".k-tabstrip-items"],
|
|
22
22
|
[".k-columnmenu-item"],
|
|
23
|
-
...
|
|
24
|
-
],
|
|
25
|
-
const [u,
|
|
26
|
-
const n =
|
|
27
|
-
clearTimeout(
|
|
28
|
-
n && e.relatedTarget !== l.current && s.current && !s.current.contains(n) &&
|
|
23
|
+
...O
|
|
24
|
+
], Y = (t) => {
|
|
25
|
+
const [u, a] = o.useState(!1), l = o.useRef(null), s = o.useRef(null), r = o.useRef(null), i = o.useRef(0), { columnMenu: E, ...p } = t, { column: g, columnMenuIcon: m, navigatable: w } = t, b = H(), M = g.title || g.field, C = M ? `${M} ` : "", D = "#", y = (e) => {
|
|
26
|
+
const n = W(document);
|
|
27
|
+
clearTimeout(i.current), i.current = window.setTimeout(() => {
|
|
28
|
+
n && e.relatedTarget !== l.current && s.current && !s.current.contains(n) && f();
|
|
29
29
|
});
|
|
30
30
|
}, T = () => {
|
|
31
|
-
clearTimeout(
|
|
31
|
+
clearTimeout(i.current);
|
|
32
32
|
}, S = (e) => {
|
|
33
|
-
e.preventDefault(), u &&
|
|
34
|
-
},
|
|
35
|
-
|
|
33
|
+
e.preventDefault(), u && t.onCloseMenu && t.onCloseMenu(), a(!u);
|
|
34
|
+
}, f = () => {
|
|
35
|
+
t.onCloseMenu && t.onCloseMenu(), a(!1), !t.navigatable && l.current && l.current.focus();
|
|
36
36
|
}, K = (e) => {
|
|
37
37
|
var n;
|
|
38
|
-
if (e.keyCode ===
|
|
39
|
-
const
|
|
40
|
-
|
|
38
|
+
if (e.keyCode === P.tab) {
|
|
39
|
+
const c = e.target, h = c && ((n = c.closest(".k-grid")) == null ? void 0 : n.getElementsByClassName("k-grid-content")[0]);
|
|
40
|
+
h && h.scrollWidth > h.clientWidth && c.scrollIntoView({ inline: "center" });
|
|
41
41
|
}
|
|
42
|
-
},
|
|
42
|
+
}, d = o.useMemo(() => t.show !== void 0 ? t.show : u, [t.show, u]), B = (e) => {
|
|
43
43
|
var n;
|
|
44
|
-
(n =
|
|
44
|
+
(n = r.current) == null || n.triggerKeyboardEvent(e);
|
|
45
45
|
}, I = (e) => {
|
|
46
46
|
var n;
|
|
47
|
-
(n =
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
},
|
|
47
|
+
(n = r.current) == null || n.triggerMouseEvent(e);
|
|
48
|
+
}, A = (e, n, c) => {
|
|
49
|
+
c.preventDefault(), c.shiftKey ? n.focusPrevious(e) : n.focusNext(e);
|
|
50
|
+
}, N = (e, n, c) => {
|
|
51
51
|
e && e.click();
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
},
|
|
55
|
-
|
|
52
|
+
}, R = (e, n, c) => {
|
|
53
|
+
c.preventDefault(), f();
|
|
54
|
+
}, $ = (e, n, c) => {
|
|
55
|
+
c.preventDefault(), n.focusElement(e);
|
|
56
|
+
}, x = (e) => {
|
|
57
|
+
!e.isAnchorClicked && a(!1);
|
|
56
58
|
};
|
|
57
|
-
return
|
|
59
|
+
return o.useEffect(() => (d && s.current && (r.current = new L({
|
|
58
60
|
tabIndex: 0,
|
|
59
61
|
root: s,
|
|
60
62
|
selectors: G,
|
|
61
63
|
keyboardEvents: {
|
|
62
64
|
keydown: {
|
|
63
|
-
Tab:
|
|
64
|
-
Enter:
|
|
65
|
-
Escape:
|
|
65
|
+
Tab: A,
|
|
66
|
+
Enter: N,
|
|
67
|
+
Escape: R
|
|
66
68
|
}
|
|
67
69
|
},
|
|
68
70
|
mouseEvents: {
|
|
69
|
-
mousedown:
|
|
71
|
+
mousedown: $
|
|
70
72
|
}
|
|
71
|
-
}),
|
|
72
|
-
|
|
73
|
-
}), [
|
|
73
|
+
}), r.current.focusElement(r.current.first, null)), () => {
|
|
74
|
+
r.current && (r.current = null);
|
|
75
|
+
}), [d]), /* @__PURE__ */ o.createElement(o.Fragment, null, /* @__PURE__ */ o.createElement(
|
|
74
76
|
"a",
|
|
75
77
|
{
|
|
76
78
|
className: "k-grid-header-menu k-grid-column-menu",
|
|
77
79
|
ref: l,
|
|
78
80
|
onClick: S,
|
|
79
81
|
onKeyDown: K,
|
|
80
|
-
href:
|
|
82
|
+
href: D,
|
|
81
83
|
tabIndex: w ? -1 : void 0,
|
|
82
|
-
"aria-label": `${w ? "" :
|
|
84
|
+
"aria-label": `${w ? "" : C}${b.toLanguageString(k, _[k])}`
|
|
83
85
|
},
|
|
84
|
-
|
|
85
|
-
), /* @__PURE__ */
|
|
86
|
+
m ? /* @__PURE__ */ o.createElement(v, { name: m.name, icon: m }) : /* @__PURE__ */ o.createElement(v, { name: "more-vertical", icon: V })
|
|
87
|
+
), /* @__PURE__ */ o.createElement(
|
|
86
88
|
z,
|
|
87
89
|
{
|
|
88
90
|
anchor: l.current,
|
|
89
|
-
show:
|
|
90
|
-
popupClass: "k-column-menu k-column-menu-popup k-grid-columnmenu-popup"
|
|
91
|
+
show: d,
|
|
92
|
+
popupClass: "k-column-menu k-column-menu-popup k-grid-columnmenu-popup",
|
|
93
|
+
onMouseDownOutside: x
|
|
91
94
|
},
|
|
92
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ o.createElement(
|
|
93
96
|
"div",
|
|
94
97
|
{
|
|
95
98
|
ref: s,
|
|
96
|
-
onBlur:
|
|
99
|
+
onBlur: y,
|
|
97
100
|
onFocus: T,
|
|
98
101
|
onMouseDown: I,
|
|
99
102
|
onKeyDown: B,
|
|
100
103
|
style: { outline: "none" }
|
|
101
104
|
},
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
E && /* @__PURE__ */ o.createElement(
|
|
106
|
+
E,
|
|
104
107
|
{
|
|
105
|
-
...
|
|
106
|
-
onCloseMenu:
|
|
108
|
+
...p,
|
|
109
|
+
onCloseMenu: f
|
|
107
110
|
}
|
|
108
111
|
)
|
|
109
112
|
)
|
|
110
113
|
));
|
|
111
114
|
};
|
|
112
115
|
export {
|
|
113
|
-
|
|
116
|
+
Y as GridColumnMenuWrapper
|
|
114
117
|
};
|