@progress/kendo-react-grid 11.2.0 → 11.3.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.
@@ -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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../utils/index.js"),r=require("../../constants/index.js"),c=require("@progress/kendo-react-common"),m=e=>{var d,i;let t=null,a=null;const n=e.unstyled,o=n&&n.uGrid?n.uGrid:c.uGrid;if(e.rowType==="groupFooter")t={className:e.className};else if(e.rowType!=="groupHeader"){if(e.field!==void 0){const l=s.getNestedValue(e.field,e.dataItem);l!=null&&(a=e.intl&&e.format?e.intl.format(e.format,l):l.toString())}const u=c.classNames(o.td({selected:e.isSelected,sorted:e.isSorted,alt:e.isAlt}),e.className);t={rowSpan:(i=(d=e._rowSpan)==null?void 0:d.count)!=null?i:void 0,colSpan:e.colSpan,style:e.style,className:u,role:"gridcell","aria-colindex":e.ariaColumnIndex,"aria-selected":e.isSelected,[r.GRID_COL_INDEX_ATTRIBUTE]:e.columnIndex}}return{tdProps:t,content:a}},g=e=>{var t;return(t=e.cells)==null?void 0:t[e.rowType||"data"]};exports.getCellTdProps=m;exports.getCustomCell=g;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../utils/index.js"),r=require("../../constants/index.js"),c=require("@progress/kendo-react-common"),g=e=>{var n,a;let t=null,d=null;const i=e.unstyled,o=i&&i.uGrid?i.uGrid:c.uGrid;if(e.rowType==="groupFooter")t={className:e.className};else if(e.rowType!=="groupHeader"){if(e.field!==void 0){const l=s.getNestedValue(e.field,e.dataItem);l!=null&&(d=e.intl&&e.format?e.intl.format(e.format,l):l.toString())}const u=c.classNames(o.td({selected:e.isSelected,highlighted:e.isHighlighted,sorted:e.isSorted,alt:e.isAlt}),e.className);t={rowSpan:(a=(n=e._rowSpan)==null?void 0:n.count)!=null?a:void 0,colSpan:e.colSpan,style:e.style,className:u,role:"gridcell","aria-colindex":e.ariaColumnIndex,"aria-selected":e.isSelected,[r.GRID_COL_INDEX_ATTRIBUTE]:e.columnIndex}}return{tdProps:t,content:d}},m=e=>{var t;return(t=e.cells)==null?void 0:t[e.rowType||"data"]};exports.getCellTdProps=g;exports.getCustomCell=m;
@@ -7,11 +7,11 @@
7
7
  */
8
8
  import { getNestedValue as m } from "../../utils/index.mjs";
9
9
  import { GRID_COL_INDEX_ATTRIBUTE as u } from "../../constants/index.mjs";
10
- import { uGrid as r, classNames as s } from "@progress/kendo-react-common";
10
+ import { uGrid as s, classNames as r } from "@progress/kendo-react-common";
11
11
  const y = (e) => {
12
- var i, n;
13
- let t = null, d = null;
14
- const a = e.unstyled, c = a && a.uGrid ? a.uGrid : r;
12
+ var d, n;
13
+ let t = null, i = null;
14
+ const a = e.unstyled, c = a && a.uGrid ? a.uGrid : s;
15
15
  if (e.rowType === "groupFooter")
16
16
  t = {
17
17
  className: e.className
@@ -19,14 +19,14 @@ const y = (e) => {
19
19
  else if (e.rowType !== "groupHeader") {
20
20
  if (e.field !== void 0) {
21
21
  const l = m(e.field, e.dataItem);
22
- l != null && (d = e.intl && e.format ? e.intl.format(e.format, l) : l.toString());
22
+ l != null && (i = e.intl && e.format ? e.intl.format(e.format, l) : l.toString());
23
23
  }
24
- const o = s(
25
- c.td({ selected: e.isSelected, sorted: e.isSorted, alt: e.isAlt }),
24
+ const o = r(
25
+ c.td({ selected: e.isSelected, highlighted: e.isHighlighted, sorted: e.isSorted, alt: e.isAlt }),
26
26
  e.className
27
27
  );
28
28
  t = {
29
- rowSpan: (n = (i = e._rowSpan) == null ? void 0 : i.count) != null ? n : void 0,
29
+ rowSpan: (n = (d = e._rowSpan) == null ? void 0 : d.count) != null ? n : void 0,
30
30
  colSpan: e.colSpan,
31
31
  style: e.style,
32
32
  className: o,
@@ -36,7 +36,7 @@ const y = (e) => {
36
36
  [u]: e.columnIndex
37
37
  };
38
38
  }
39
- return { tdProps: t, content: d };
39
+ return { tdProps: t, content: i };
40
40
  }, N = (e) => {
41
41
  var t;
42
42
  return (t = e.cells) == null ? void 0 : t[e.rowType || "data"];
@@ -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 strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("../../constants/index.js"),t=require("@progress/kendo-react-common"),o=e=>{let d=null;const l=e.unstyled,r=l&&l.uGrid?l.uGrid:t.uGrid,a=t.classNames(r.td({selected:e.isSelected,sorted:e.isSorted,alt:e.isAlt}),e.className,["k-drag-cell",`${e.rowReorderable?"":"k-disabled"}`]);return d={colSpan:e.colSpan,style:e.style,className:a,role:"gridcell","aria-colindex":e.ariaColumnIndex,"aria-selected":e.isSelected,"aria-disabled":!e.rowReorderable,[s.GRID_COL_INDEX_ATTRIBUTE]:e.columnIndex},{tdProps:d}};exports.getRowReorderCellTdProps=o;
8
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../constants/index.js"),t=require("@progress/kendo-react-common"),s=e=>{let d=null;const l=e.unstyled,a=l&&l.uGrid?l.uGrid:t.uGrid,i=t.classNames(a.td({selected:e.isSelected,highlighted:e.isHighlighted,sorted:e.isSorted,alt:e.isAlt}),e.className,["k-drag-cell",`${e.rowReorderable?"":"k-disabled"}`]);return d={colSpan:e.colSpan,style:e.style,className:i,role:"gridcell","aria-colindex":e.ariaColumnIndex,"aria-selected":e.isSelected,"aria-disabled":!e.rowReorderable,[r.GRID_COL_INDEX_ATTRIBUTE]:e.columnIndex},{tdProps:d}};exports.getRowReorderCellTdProps=s;
@@ -5,26 +5,26 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import { GRID_COL_INDEX_ATTRIBUTE as r } from "../../constants/index.mjs";
9
- import { uGrid as s, classNames as i } from "@progress/kendo-react-common";
10
- const n = (e) => {
8
+ import { GRID_COL_INDEX_ATTRIBUTE as i } from "../../constants/index.mjs";
9
+ import { uGrid as r, classNames as s } from "@progress/kendo-react-common";
10
+ const o = (e) => {
11
11
  let d = null;
12
- const l = e.unstyled, a = l && l.uGrid ? l.uGrid : s, t = i(
13
- a.td({ selected: e.isSelected, sorted: e.isSorted, alt: e.isAlt }),
12
+ const l = e.unstyled, t = l && l.uGrid ? l.uGrid : r, a = s(
13
+ t.td({ selected: e.isSelected, highlighted: e.isHighlighted, sorted: e.isSorted, alt: e.isAlt }),
14
14
  e.className,
15
15
  ["k-drag-cell", `${e.rowReorderable ? "" : "k-disabled"}`]
16
16
  );
17
17
  return d = {
18
18
  colSpan: e.colSpan,
19
19
  style: e.style,
20
- className: t,
20
+ className: a,
21
21
  role: "gridcell",
22
22
  "aria-colindex": e.ariaColumnIndex,
23
23
  "aria-selected": e.isSelected,
24
24
  "aria-disabled": !e.rowReorderable,
25
- [r]: e.columnIndex
25
+ [i]: e.columnIndex
26
26
  }, { tdProps: d };
27
27
  };
28
28
  export {
29
- n as getRowReorderCellTdProps
29
+ o as getRowReorderCellTdProps
30
30
  };
@@ -6,4 +6,4 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),C=require("@progress/kendo-react-intl"),G=require("./GridColumnMenuItemGroup.js"),p=require("./GridColumnMenuItem.js"),l=require("../messages/index.js"),a=require("@progress/kendo-svg-icons");function I(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,u.get?u:{enumerable:!0,get:()=>e[n]})}}return o.default=e,Object.freeze(o)}const d=I(m),M=e=>{const o=t=>{if(t.preventDefault(),e.onGroupChange){if(!e.column.field)return;const r=(e.group||[]).slice(),s=r.findIndex(g=>g.field===e.column.field);s>-1?r.splice(s,1):r.push({field:e.column.field}),e.onGroupChange(r,t)}e.onCloseMenu&&e.onCloseMenu()},{group:n,column:u}=e,f=C.useLocalization(),i=!!(n&&u.field&&n.find(t=>t.field===u.field)),c=i?l.ungroupColumn:l.groupColumn;return d.createElement(G.GridColumnMenuItemGroup,null,d.createElement(p.GridColumnMenuItem,{title:f.toLanguageString(c,l.messages[c]),iconClass:i?"k-i-ungroup":"k-i-group",svgIcon:i?a.ungroupIcon:a.groupIcon,onClick:o}))};exports.GridColumnMenuGroup=M;
9
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react"),C=require("@progress/kendo-react-intl"),G=require("./GridColumnMenuItemGroup.js"),p=require("./GridColumnMenuItem.js"),l=require("../messages/index.js"),a=require("@progress/kendo-svg-icons");function I(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const u=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(o,n,u.get?u:{enumerable:!0,get:()=>e[n]})}}return o.default=e,Object.freeze(o)}const d=I(m),M=e=>{const o=r=>{if(r.preventDefault(),e.onGroupChange){if(!e.column.field)return;const i=(e.group||[]).slice(),s=i.findIndex(g=>g.field===e.column.field);s>-1?i.splice(s,1):i.push({field:e.column.field}),e.onGroupChange(i,r)}e.onCloseMenu&&e.onCloseMenu()},{group:n,column:u}=e,f=C.useLocalization(),t=!!(n&&u.field&&n.find(r=>r.field===u.field)),c=t?l.ungroupColumn:l.groupColumn;return d.createElement(G.GridColumnMenuItemGroup,null,d.createElement(p.GridColumnMenuItem,{selected:t,title:f.toLanguageString(c,l.messages[c]),iconClass:t?"k-i-ungroup":"k-i-group",svgIcon:t?a.ungroupIcon:a.groupIcon,onClick:o}))};exports.GridColumnMenuGroup=M;
@@ -7,29 +7,30 @@
7
7
  */
8
8
  "use client";
9
9
  import * as m from "react";
10
- import { useLocalization as g } from "@progress/kendo-react-intl";
11
- import { GridColumnMenuItemGroup as s } from "./GridColumnMenuItemGroup.mjs";
12
- import { GridColumnMenuItem as d } from "./GridColumnMenuItem.mjs";
10
+ import { useLocalization as a } from "@progress/kendo-react-intl";
11
+ import { GridColumnMenuItemGroup as d } from "./GridColumnMenuItemGroup.mjs";
12
+ import { GridColumnMenuItem as g } from "./GridColumnMenuItem.mjs";
13
13
  import { messages as C, groupColumn as p, ungroupColumn as G } from "../messages/index.mjs";
14
14
  import { groupIcon as I, ungroupIcon as M } from "@progress/kendo-svg-icons";
15
15
  const L = (o) => {
16
- const c = (n) => {
17
- if (n.preventDefault(), o.onGroupChange) {
16
+ const c = (e) => {
17
+ if (e.preventDefault(), o.onGroupChange) {
18
18
  if (!o.column.field)
19
19
  return;
20
- const e = (o.group || []).slice(), t = e.findIndex((a) => a.field === o.column.field);
21
- t > -1 ? e.splice(t, 1) : e.push({
20
+ const u = (o.group || []).slice(), t = u.findIndex((s) => s.field === o.column.field);
21
+ t > -1 ? u.splice(t, 1) : u.push({
22
22
  field: o.column.field
23
- }), o.onGroupChange(e, n);
23
+ }), o.onGroupChange(u, e);
24
24
  }
25
25
  o.onCloseMenu && o.onCloseMenu();
26
- }, { group: i, column: l } = o, f = g(), u = !!(i && l.field && i.find((n) => n.field === l.field)), r = u ? G : p;
27
- return /* @__PURE__ */ m.createElement(s, null, /* @__PURE__ */ m.createElement(
28
- d,
26
+ }, { group: i, column: l } = o, f = a(), n = !!(i && l.field && i.find((e) => e.field === l.field)), r = n ? G : p;
27
+ return /* @__PURE__ */ m.createElement(d, null, /* @__PURE__ */ m.createElement(
28
+ g,
29
29
  {
30
+ selected: n,
30
31
  title: f.toLanguageString(r, C[r]),
31
- iconClass: u ? "k-i-ungroup" : "k-i-group",
32
- svgIcon: u ? M : I,
32
+ iconClass: n ? "k-i-ungroup" : "k-i-group",
33
+ svgIcon: n ? M : I,
33
34
  onClick: c
34
35
  }
35
36
  ));
@@ -6,4 +6,4 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react"),_=require("@progress/kendo-react-popup"),s=require("@progress/kendo-react-common"),j=require("@progress/kendo-svg-icons"),h=require("../messages/index.js"),z=require("@progress/kendo-react-intl"),F=require("../utils/GridContext.js"),$=require("./adaptiveContext/GridColumnMenuAdaptiveContext.js"),L=require("./adaptiveContent/GridAdaptiveColumnMenu.js"),V=require("react-dom");function H(t){const u=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const c in t)if(c!=="default"){const a=Object.getOwnPropertyDescriptor(t,c);Object.defineProperty(u,c,a.get?a:{enumerable:!0,get:()=>t[c]})}}return u.default=t,Object.freeze(u)}const n=H(W),J=[".k-columnmenu-item-content",".k-filter-menu-container"].map(t=>s.TABBABLE_ELEMENTS.map(u=>`${t} ${u}`)),Q=[[".k-tabstrip-items"],[".k-columnmenu-item"],...J],U=t=>{var p;const u=n.useContext(F.GridContext),[c,a]=n.useState(!1),i=n.useRef(null),m=n.useRef(null),l=n.useRef(null),M=n.useRef(0),D=s.useDocument(i),{columnMenu:d,...b}=t,{column:C,columnMenuIcon:E,navigatable:k}=t,y=z.useLocalization(),w=C.title||C.field,S=w?`${w} `:"",T="#",q=e=>{const o=s.getActiveElement(document);clearTimeout(M.current),M.current=window.setTimeout(()=>{!u.mobileMode&&o&&e.relatedTarget!==i.current&&m.current&&!m.current.contains(o)&&f()})},R=()=>{clearTimeout(M.current)},x=e=>{e.preventDefault(),c&&t.onCloseMenu&&t.onCloseMenu(),a(!c)},f=()=>{t.onCloseMenu&&t.onCloseMenu(),a(!1),!t.navigatable&&i.current&&i.current.focus()},A=e=>{var o;if(e.keyCode===s.Keys.tab){const r=e.target,v=r&&((o=r.closest(".k-grid"))==null?void 0:o.getElementsByClassName("k-grid-content")[0]);v&&v.scrollWidth>v.clientWidth&&r.scrollIntoView({inline:"center"})}},g=n.useMemo(()=>t.show!==void 0?t.show:c,[t.show,c]),I=e=>{var o;(o=l.current)==null||o.triggerKeyboardEvent(e)},O=e=>{var o;(o=l.current)==null||o.triggerMouseEvent(e)},P=(e,o,r)=>{r.preventDefault(),r.shiftKey?o.focusPrevious(e):o.focusNext(e)},G=(e,o,r)=>{e&&(r.preventDefault(),e.click())},K=(e,o,r)=>{r.preventDefault(),f()},N=(e,o,r)=>{o.focusElement(e)},B=e=>{!e.isAnchorClicked&&a(!1)};return n.useEffect(()=>(g&&m.current&&(l.current=new s.Navigation({tabIndex:0,root:m,selectors:Q,keyboardEvents:{keydown:{Tab:P,Enter:G,Escape:K}},mouseEvents:{mousedown:N}}),l.current.focusElement(l.current.first,null)),()=>{l.current&&(l.current=null)}),[g]),n.createElement(n.Fragment,null,n.createElement("a",{className:"k-grid-header-menu k-grid-column-menu",ref:i,onClick:x,onKeyDown:A,href:T,tabIndex:k?-1:void 0,"aria-label":`${k?"":S}${y.toLanguageString(h.columnMenu,h.messages[h.columnMenu])}`},E?n.createElement(s.IconWrap,{name:E.name,icon:E}):n.createElement(s.IconWrap,{name:"more-vertical",icon:j.moreVerticalIcon})),n.createElement($.GridColumnMenuAdaptiveProvider,null,u.mobileMode?n.createElement(n.Fragment,null,V.createPortal(n.createElement(L.GridAdaptiveColumnMenu,{computedShow:g,ColumnMenu:d,closeMenu:f},d&&n.createElement(d,{...b,onCloseMenu:f})),(p=D())==null?void 0:p.body)):n.createElement(_.Popup,{anchor:i.current,show:g,popupClass:"k-grid-columnmenu-popup",onMouseDownOutside:B},n.createElement("div",{ref:m,onBlur:q,onFocus:R,onMouseDown:O,onKeyDown:I,className:"k-column-menu k-column-menu-md"},d&&n.createElement(d,{...b,onCloseMenu:f})))))};exports.GridColumnMenuWrapper=U;
9
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("react"),L=require("@progress/kendo-react-popup"),s=require("@progress/kendo-react-common"),O=require("@progress/kendo-svg-icons"),k=require("../messages/index.js"),V=require("@progress/kendo-react-intl"),H=require("../utils/GridContext.js"),j=require("./adaptiveContext/GridColumnMenuAdaptiveContext.js"),J=require("./adaptiveContent/GridAdaptiveColumnMenu.js"),Q=require("react-dom");function U(o){const c=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const u in o)if(u!=="default"){const a=Object.getOwnPropertyDescriptor(o,u);Object.defineProperty(c,u,a.get?a:{enumerable:!0,get:()=>o[u]})}}return c.default=o,Object.freeze(c)}const t=U($),X=[".k-columnmenu-item-content",".k-filter-menu-container"].map(o=>s.TABBABLE_ELEMENTS.map(c=>`${o} ${c}`)),Y=[[".k-tabstrip-items"],[".k-columnmenu-item"],...X],Z=o=>{var D;const c=t.useContext(H.GridContext),[u,a]=t.useState(!1),i=t.useRef(null),d=t.useRef(null),l=t.useRef(null),E=t.useRef(0),A=s.useDocument(i),{columnMenu:f,...p}=o,{column:m,columnMenuIcon:v,navigatable:w}=o,S=V.useLocalization(),y=m.title||m.field,T=y?`${y} `:"",q="#",R=n=>{const e=s.getActiveElement(document);clearTimeout(E.current),E.current=window.setTimeout(()=>{!c.mobileMode&&e&&n.relatedTarget!==i.current&&d.current&&!d.current.contains(e)&&g()})},x=()=>{clearTimeout(E.current)},G=n=>{n.preventDefault(),u&&o.onCloseMenu&&o.onCloseMenu(),a(!u)},g=()=>{o.onCloseMenu&&o.onCloseMenu(),a(!1),!o.navigatable&&i.current&&i.current.focus()},I=n=>{var e;if(n.keyCode===s.Keys.tab){const r=n.target,M=r&&((e=r.closest(".k-grid"))==null?void 0:e.getElementsByClassName("k-grid-content")[0]);M&&M.scrollWidth>M.clientWidth&&r.scrollIntoView({inline:"center"})}},C=t.useMemo(()=>o.show!==void 0?o.show:u,[o.show,u]),P=n=>{var e;(e=l.current)==null||e.triggerKeyboardEvent(n)},N=n=>{var e;(e=l.current)==null||e.triggerMouseEvent(n)},K=(n,e,r)=>{r.preventDefault(),r.shiftKey?e.focusPrevious(n):e.focusNext(n)},B=(n,e,r)=>{n&&(r.preventDefault(),n.click())},W=(n,e,r)=>{r.preventDefault(),g()},_=(n,e,r)=>{e.focusElement(n)},z=n=>{!n.isAnchorClicked&&a(!1)},h=t.useCallback((n,e)=>{const r=[];if(!e||typeof e!="object")return!1;if(Array.isArray(e.filters)){for(const M of e.filters)if(h(n,M))return!0}return"field"in e&&typeof e.field=="string"&&r.push(e.field),r.includes(n)},[]),b=t.useCallback((n,e)=>!e||!Array.isArray(e)?!1:e.some(r=>r.field===n),[]),F=t.useMemo(()=>m.field&&(h(m.field,c.filter)||b(m.field,c.group)),[m.field,c.filter,c.group,h,b]);return t.useEffect(()=>(C&&d.current&&(l.current=new s.Navigation({tabIndex:0,root:d,selectors:Y,keyboardEvents:{keydown:{Tab:K,Enter:B,Escape:W}},mouseEvents:{mousedown:_}}),l.current.focusElement(l.current.first,null)),()=>{l.current&&(l.current=null)}),[C]),t.createElement(t.Fragment,null,t.createElement("a",{className:s.classNames("k-grid-header-menu k-grid-column-menu",{"k-active":F}),ref:i,onClick:G,onKeyDown:I,href:q,tabIndex:w?-1:void 0,"aria-label":`${w?"":T}${S.toLanguageString(k.columnMenu,k.messages[k.columnMenu])}`},v?t.createElement(s.IconWrap,{name:v.name,icon:v}):t.createElement(s.IconWrap,{name:"more-vertical",icon:O.moreVerticalIcon})),t.createElement(j.GridColumnMenuAdaptiveProvider,null,c.mobileMode?t.createElement(t.Fragment,null,Q.createPortal(t.createElement(J.GridAdaptiveColumnMenu,{computedShow:C,ColumnMenu:f,closeMenu:g},f&&t.createElement(f,{...p,onCloseMenu:g})),(D=A())==null?void 0:D.body)):t.createElement(L.Popup,{anchor:i.current,show:C,popupClass:"k-grid-columnmenu-popup",onMouseDownOutside:z},t.createElement("div",{ref:d,onBlur:R,onFocus:x,onMouseDown:N,onKeyDown:P,className:"k-column-menu k-column-menu-md"},f&&t.createElement(f,{...p,onCloseMenu:g})))))};exports.GridColumnMenuWrapper=Z;
@@ -6,110 +6,125 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- import * as n from "react";
10
- import { Popup as G } from "@progress/kendo-react-popup";
11
- import { TABBABLE_ELEMENTS as L, useDocument as W, Navigation as O, IconWrap as k, getActiveElement as V, Keys as _ } from "@progress/kendo-react-common";
12
- import { moreVerticalIcon as H } from "@progress/kendo-svg-icons";
13
- import { columnMenu as b, messages as j } from "../messages/index.mjs";
14
- import { useLocalization as q } from "@progress/kendo-react-intl";
15
- import { GridContext as J } from "../utils/GridContext.mjs";
16
- import { GridColumnMenuAdaptiveProvider as Q } from "./adaptiveContext/GridColumnMenuAdaptiveContext.mjs";
17
- import { GridAdaptiveColumnMenu as U } from "./adaptiveContent/GridAdaptiveColumnMenu.mjs";
18
- import X from "react-dom";
19
- const Y = [".k-columnmenu-item-content", ".k-filter-menu-container"].map((o) => L.map((i) => `${o} ${i}`)), Z = [[".k-tabstrip-items"], [".k-columnmenu-item"], ...Y], ie = (o) => {
20
- var C;
21
- const i = n.useContext(J), [m, d] = n.useState(!1), l = n.useRef(null), u = n.useRef(null), c = n.useRef(null), E = n.useRef(0), D = W(l), { columnMenu: s, ...g } = o, { column: v, columnMenuIcon: h, navigatable: w } = o, y = q(), p = v.title || v.field, T = p ? `${p} ` : "", S = "#", x = (e) => {
22
- const t = V(document);
23
- clearTimeout(E.current), E.current = window.setTimeout(() => {
24
- !i.mobileMode && t && e.relatedTarget !== l.current && u.current && !u.current.contains(t) && a();
9
+ import * as t from "react";
10
+ import { Popup as V } from "@progress/kendo-react-popup";
11
+ import { TABBABLE_ELEMENTS as _, useDocument as H, Navigation as q, classNames as J, IconWrap as D, getActiveElement as Q, Keys as U } from "@progress/kendo-react-common";
12
+ import { moreVerticalIcon as X } from "@progress/kendo-svg-icons";
13
+ import { columnMenu as b, messages as Y } from "../messages/index.mjs";
14
+ import { useLocalization as Z } from "@progress/kendo-react-intl";
15
+ import { GridContext as O } from "../utils/GridContext.mjs";
16
+ import { GridColumnMenuAdaptiveProvider as j } from "./adaptiveContext/GridColumnMenuAdaptiveContext.mjs";
17
+ import { GridAdaptiveColumnMenu as ee } from "./adaptiveContent/GridAdaptiveColumnMenu.mjs";
18
+ import ne from "react-dom";
19
+ const te = [".k-columnmenu-item-content", ".k-filter-menu-container"].map((r) => _.map((c) => `${r} ${c}`)), oe = [[".k-tabstrip-items"], [".k-columnmenu-item"], ...te], Ee = (r) => {
20
+ var y;
21
+ const c = t.useContext(O), [d, M] = t.useState(!1), s = t.useRef(null), i = t.useRef(null), l = t.useRef(null), h = t.useRef(0), A = H(s), { columnMenu: a, ...C } = r, { column: u, columnMenuIcon: g, navigatable: p } = r, T = Z(), w = u.title || u.field, S = w ? `${w} ` : "", x = "#", K = (n) => {
22
+ const e = Q(document);
23
+ clearTimeout(h.current), h.current = window.setTimeout(() => {
24
+ !c.mobileMode && e && n.relatedTarget !== s.current && i.current && !i.current.contains(e) && m();
25
25
  });
26
- }, A = () => {
27
- clearTimeout(E.current);
28
- }, K = (e) => {
29
- e.preventDefault(), m && o.onCloseMenu && o.onCloseMenu(), d(!m);
30
- }, a = () => {
31
- o.onCloseMenu && o.onCloseMenu(), d(!1), !o.navigatable && l.current && l.current.focus();
32
- }, B = (e) => {
33
- var t;
34
- if (e.keyCode === _.tab) {
35
- const r = e.target, M = r && ((t = r.closest(".k-grid")) == null ? void 0 : t.getElementsByClassName("k-grid-content")[0]);
36
- M && M.scrollWidth > M.clientWidth && r.scrollIntoView({ inline: "center" });
26
+ }, N = () => {
27
+ clearTimeout(h.current);
28
+ }, B = (n) => {
29
+ n.preventDefault(), d && r.onCloseMenu && r.onCloseMenu(), M(!d);
30
+ }, m = () => {
31
+ r.onCloseMenu && r.onCloseMenu(), M(!1), !r.navigatable && s.current && s.current.focus();
32
+ }, I = (n) => {
33
+ var e;
34
+ if (n.keyCode === U.tab) {
35
+ const o = n.target, f = o && ((e = o.closest(".k-grid")) == null ? void 0 : e.getElementsByClassName("k-grid-content")[0]);
36
+ f && f.scrollWidth > f.clientWidth && o.scrollIntoView({ inline: "center" });
37
37
  }
38
- }, f = n.useMemo(() => o.show !== void 0 ? o.show : m, [o.show, m]), I = (e) => {
39
- var t;
40
- (t = c.current) == null || t.triggerKeyboardEvent(e);
41
- }, N = (e) => {
42
- var t;
43
- (t = c.current) == null || t.triggerMouseEvent(e);
44
- }, R = (e, t, r) => {
45
- r.preventDefault(), r.shiftKey ? t.focusPrevious(e) : t.focusNext(e);
46
- }, F = (e, t, r) => {
47
- e && (r.preventDefault(), e.click());
48
- }, P = (e, t, r) => {
49
- r.preventDefault(), a();
50
- }, $ = (e, t, r) => {
51
- t.focusElement(e);
52
- }, z = (e) => {
53
- !e.isAnchorClicked && d(!1);
54
- };
55
- return n.useEffect(() => (f && u.current && (c.current = new O({
38
+ }, E = t.useMemo(() => r.show !== void 0 ? r.show : d, [r.show, d]), R = (n) => {
39
+ var e;
40
+ (e = l.current) == null || e.triggerKeyboardEvent(n);
41
+ }, F = (n) => {
42
+ var e;
43
+ (e = l.current) == null || e.triggerMouseEvent(n);
44
+ }, G = (n, e, o) => {
45
+ o.preventDefault(), o.shiftKey ? e.focusPrevious(n) : e.focusNext(n);
46
+ }, P = (n, e, o) => {
47
+ n && (o.preventDefault(), n.click());
48
+ }, $ = (n, e, o) => {
49
+ o.preventDefault(), m();
50
+ }, z = (n, e, o) => {
51
+ e.focusElement(n);
52
+ }, L = (n) => {
53
+ !n.isAnchorClicked && M(!1);
54
+ }, v = t.useCallback(
55
+ (n, e) => {
56
+ const o = [];
57
+ if (!e || typeof e != "object")
58
+ return !1;
59
+ if (Array.isArray(e.filters)) {
60
+ for (const f of e.filters)
61
+ if (v(n, f))
62
+ return !0;
63
+ }
64
+ return "field" in e && typeof e.field == "string" && o.push(e.field), o.includes(n);
65
+ },
66
+ []
67
+ ), k = t.useCallback((n, e) => !e || !Array.isArray(e) ? !1 : e.some((o) => o.field === n), []), W = t.useMemo(() => u.field && (v(u.field, c.filter) || k(u.field, c.group)), [u.field, c.filter, c.group, v, k]);
68
+ return t.useEffect(() => (E && i.current && (l.current = new q({
56
69
  tabIndex: 0,
57
- root: u,
58
- selectors: Z,
70
+ root: i,
71
+ selectors: oe,
59
72
  keyboardEvents: {
60
- keydown: { Tab: R, Enter: F, Escape: P }
73
+ keydown: { Tab: G, Enter: P, Escape: $ }
61
74
  },
62
- mouseEvents: { mousedown: $ }
63
- }), c.current.focusElement(c.current.first, null)), () => {
64
- c.current && (c.current = null);
65
- }), [f]), /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement(
75
+ mouseEvents: { mousedown: z }
76
+ }), l.current.focusElement(l.current.first, null)), () => {
77
+ l.current && (l.current = null);
78
+ }), [E]), /* @__PURE__ */ t.createElement(t.Fragment, null, /* @__PURE__ */ t.createElement(
66
79
  "a",
67
80
  {
68
- className: "k-grid-header-menu k-grid-column-menu",
69
- ref: l,
70
- onClick: K,
71
- onKeyDown: B,
72
- href: S,
73
- tabIndex: w ? -1 : void 0,
74
- "aria-label": `${w ? "" : T}${y.toLanguageString(
81
+ className: J("k-grid-header-menu k-grid-column-menu", {
82
+ "k-active": W
83
+ }),
84
+ ref: s,
85
+ onClick: B,
86
+ onKeyDown: I,
87
+ href: x,
88
+ tabIndex: p ? -1 : void 0,
89
+ "aria-label": `${p ? "" : S}${T.toLanguageString(
75
90
  b,
76
- j[b]
91
+ Y[b]
77
92
  )}`
78
93
  },
79
- h ? /* @__PURE__ */ n.createElement(k, { name: h.name, icon: h }) : /* @__PURE__ */ n.createElement(k, { name: "more-vertical", icon: H })
80
- ), /* @__PURE__ */ n.createElement(Q, null, i.mobileMode ? /* @__PURE__ */ n.createElement(n.Fragment, null, X.createPortal(
81
- /* @__PURE__ */ n.createElement(
82
- U,
94
+ g ? /* @__PURE__ */ t.createElement(D, { name: g.name, icon: g }) : /* @__PURE__ */ t.createElement(D, { name: "more-vertical", icon: X })
95
+ ), /* @__PURE__ */ t.createElement(j, null, c.mobileMode ? /* @__PURE__ */ t.createElement(t.Fragment, null, ne.createPortal(
96
+ /* @__PURE__ */ t.createElement(
97
+ ee,
83
98
  {
84
- computedShow: f,
85
- ColumnMenu: s,
86
- closeMenu: a
99
+ computedShow: E,
100
+ ColumnMenu: a,
101
+ closeMenu: m
87
102
  },
88
- s && /* @__PURE__ */ n.createElement(s, { ...g, onCloseMenu: a })
103
+ a && /* @__PURE__ */ t.createElement(a, { ...C, onCloseMenu: m })
89
104
  ),
90
- (C = D()) == null ? void 0 : C.body
91
- )) : /* @__PURE__ */ n.createElement(
92
- G,
105
+ (y = A()) == null ? void 0 : y.body
106
+ )) : /* @__PURE__ */ t.createElement(
107
+ V,
93
108
  {
94
- anchor: l.current,
95
- show: f,
109
+ anchor: s.current,
110
+ show: E,
96
111
  popupClass: "k-grid-columnmenu-popup",
97
- onMouseDownOutside: z
112
+ onMouseDownOutside: L
98
113
  },
99
- /* @__PURE__ */ n.createElement(
114
+ /* @__PURE__ */ t.createElement(
100
115
  "div",
101
116
  {
102
- ref: u,
103
- onBlur: x,
104
- onFocus: A,
105
- onMouseDown: N,
106
- onKeyDown: I,
117
+ ref: i,
118
+ onBlur: K,
119
+ onFocus: N,
120
+ onMouseDown: F,
121
+ onKeyDown: R,
107
122
  className: "k-column-menu k-column-menu-md"
108
123
  },
109
- s && /* @__PURE__ */ n.createElement(s, { ...g, onCloseMenu: a })
124
+ a && /* @__PURE__ */ t.createElement(a, { ...C, onCloseMenu: m })
110
125
  )
111
126
  )));
112
127
  };
113
128
  export {
114
- ie as GridColumnMenuWrapper
129
+ Ee as GridColumnMenuWrapper
115
130
  };