@progress/kendo-react-data-tools 14.5.0-develop.9 → 15.0.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.
@@ -7,15 +7,15 @@
7
7
  */
8
8
  "use client";
9
9
  import * as n from "react";
10
- import s from "prop-types";
11
- import { Toolbar as b, ToolbarItem as m, Button as C } from "@progress/kendo-react-buttons";
10
+ import p from "prop-types";
11
+ import { Toolbar as C, ToolbarItem as g, Button as L } from "@progress/kendo-react-buttons";
12
12
  import { DropDownList as d } from "@progress/kendo-react-dropdowns";
13
- import { provideLocalizationService as L, registerForLocalization as y } from "@progress/kendo-react-intl";
14
- import { xIcon as O } from "@progress/kendo-svg-icons";
15
- import { unaryOperator as g, stringOperator as R } from "./operators.mjs";
16
- import { filterExpressionAriaLabel as v, messages as p, filterExpressionDropdownAriaLabel as u, filterExpressionOperatorDropdownAriaLabel as x, filterClose as F } from "../messages/index.mjs";
17
- const E = (c) => {
18
- c.value === void 0 && !g(c.operator) && (c.value = R(c.operator) ? "" : null);
13
+ import { provideLocalizationService as y, registerForLocalization as O } from "@progress/kendo-react-intl";
14
+ import { xIcon as R } from "@progress/kendo-svg-icons";
15
+ import { unaryOperator as m, stringOperator as I } from "./operators.mjs";
16
+ import { filterExpressionAriaLabel as v, messages as s, filterExpressionDropdownAriaLabel as u, filterExpressionOperatorDropdownAriaLabel as x, filterExpressionClose as F, filterClose as E } from "../messages/index.mjs";
17
+ const b = (c) => {
18
+ c.value === void 0 && !m(c.operator) && (c.value = I(c.operator) ? "" : null);
19
19
  }, h = class h extends n.Component {
20
20
  constructor() {
21
21
  super(...arguments), this.onFieldChange = (t) => {
@@ -23,20 +23,20 @@ const E = (c) => {
23
23
  field: r,
24
24
  operator: i
25
25
  };
26
- E(l), this.triggerOnFilterChange(o, l, t);
26
+ b(l), this.triggerOnFilterChange(o, l, t);
27
27
  }, this.onOperatorChange = (t) => {
28
28
  const r = t.value.operator, e = this.props.filter;
29
29
  let o;
30
- if (g(r)) {
30
+ if (m(r)) {
31
31
  const { value: i, ...l } = e;
32
32
  o = { ...l, operator: r };
33
33
  } else
34
34
  o = { ...e, operator: r };
35
- E(o), this.triggerOnFilterChange(e, o, t);
35
+ b(o), this.triggerOnFilterChange(e, o, t);
36
36
  }, this.onInputChange = (t) => {
37
37
  const r = this.props.filter;
38
38
  let e = t.nextFilter;
39
- if (g(e.operator)) {
39
+ if (m(e.operator)) {
40
40
  const o = this.props.fields.find((i) => i.name === e.field);
41
41
  e = { ...e, operator: o && o.operators[0].operator || e.operator };
42
42
  }
@@ -61,15 +61,15 @@ const E = (c) => {
61
61
  };
62
62
  }
63
63
  render() {
64
- const t = L(this), {
64
+ const t = y(this), {
65
65
  fields: r,
66
66
  filter: e,
67
- ariaLabel: o = t.toLanguageString(v, p[v])
67
+ ariaLabel: o = t.toLanguageString(v, s[v])
68
68
  } = this.props, i = r.find((a) => a.name === e.field), l = (i && i.operators || []).map((a) => ({
69
69
  ...a,
70
- text: t.toLanguageString(a.text, p[a.text] || a.text)
70
+ text: t.toLanguageString(a.text, s[a.text] || a.text)
71
71
  }));
72
- return /* @__PURE__ */ n.createElement("div", { className: "k-filter-toolbar" }, /* @__PURE__ */ n.createElement(b, { keyboardNavigation: !1, role: "toolbar", ariaLabel: o }, /* @__PURE__ */ n.createElement(m, { className: "k-filter-field" }, /* @__PURE__ */ n.createElement(
72
+ return /* @__PURE__ */ n.createElement("div", { className: "k-filter-toolbar" }, /* @__PURE__ */ n.createElement(C, { keyboardNavigation: !1, role: "toolbar", ariaLabel: o }, /* @__PURE__ */ n.createElement(g, { className: "k-filter-field" }, /* @__PURE__ */ n.createElement(
73
73
  d,
74
74
  {
75
75
  tabIndex: -1,
@@ -79,10 +79,10 @@ const E = (c) => {
79
79
  onChange: this.onFieldChange,
80
80
  ariaLabel: t.toLanguageString(
81
81
  u,
82
- p[u]
82
+ s[u]
83
83
  )
84
84
  }
85
- )), /* @__PURE__ */ n.createElement(m, { className: "k-filter-operator" }, /* @__PURE__ */ n.createElement(
85
+ )), /* @__PURE__ */ n.createElement(g, { className: "k-filter-operator" }, /* @__PURE__ */ n.createElement(
86
86
  d,
87
87
  {
88
88
  tabIndex: -1,
@@ -92,10 +92,10 @@ const E = (c) => {
92
92
  onChange: this.onOperatorChange,
93
93
  ariaLabel: t.toLanguageString(
94
94
  x,
95
- p[x]
95
+ s[x]
96
96
  )
97
97
  }
98
- )), /* @__PURE__ */ n.createElement(m, { className: "k-filter-value" }, i && /* @__PURE__ */ n.createElement(
98
+ )), /* @__PURE__ */ n.createElement(g, { className: "k-filter-value" }, i && /* @__PURE__ */ n.createElement(
99
99
  i.filter,
100
100
  {
101
101
  filter: e,
@@ -104,12 +104,13 @@ const E = (c) => {
104
104
  max: i.max
105
105
  }
106
106
  )), /* @__PURE__ */ n.createElement(
107
- C,
107
+ L,
108
108
  {
109
109
  className: "k-toolbar-button",
110
- title: t.toLanguageString(F, p[F]),
110
+ title: t.toLanguageString(E, s[E]),
111
+ "aria-label": t.toLanguageString(F, s[F]),
111
112
  icon: "x",
112
- svgIcon: O,
113
+ svgIcon: R,
113
114
  fillMode: "flat",
114
115
  type: "button",
115
116
  onClick: this.onFilterRemove
@@ -118,14 +119,14 @@ const E = (c) => {
118
119
  }
119
120
  };
120
121
  h.propTypes = {
121
- filter: s.object.isRequired,
122
- fields: s.array.isRequired,
123
- ariaLabel: s.string,
124
- onChange: s.func.isRequired,
125
- onRemove: s.func.isRequired
122
+ filter: p.object.isRequired,
123
+ fields: p.array.isRequired,
124
+ ariaLabel: p.string,
125
+ onChange: p.func.isRequired,
126
+ onRemove: p.func.isRequired
126
127
  };
127
128
  let f = h;
128
- y(f);
129
+ O(f);
129
130
  export {
130
131
  f as Expression
131
132
  };
package/filter/Filter.js CHANGED
@@ -6,4 +6,4 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react"),b=require("prop-types"),l=require("@progress/kendo-react-common"),F=require("./Group.js"),E=require("../package-metadata.js");function x(d){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const i in d)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(d,i);Object.defineProperty(r,i,o.get?o:{enumerable:!0,get:()=>d[i]})}}return r.default=d,Object.freeze(r)}const g=x(R),s={filterFieldWrapper:".k-filter-field",filterOperatorWrapper:".k-filter-operator",filterValueWrapper:".k-filter-value",filterToolbar:".k-filter-toolbar",toolbarElement:".k-toolbar",groupToolbar:".k-filter-group-main > .k-filter-toolbar > .k-toolbar",subGroupToolbar:".k-filter-lines .k-filter-toolbar > .k-toolbar"},k=class k extends g.Component{constructor(r){super(r),this.wrapperRef=g.createRef(),this.showLicenseWatermark=!1,this.onFilterChange=i=>{const o={filter:i.nextFilter,syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,target:this};this.props.onChange.call(void 0,o)},this.onGroupRemove=i=>{const o={filter:{...this.props.value,filters:[]},syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,target:this};this.props.onChange.call(void 0,o)},this.navigateVertical=(i,o,e)=>{if(!e)return;const t=e.classList.contains("k-filter-field")||e.classList.contains("k-filter-operator")||e.classList.contains("k-filter-value"),a=e.closest(s.toolbarElement),n=Array.from(o.getElementsByClassName("k-toolbar")),c=n.findIndex(h=>h===a),f=i==="up"?c-1:c+1,p=n[f];if(!o.getElementsByClassName("k-filter-lines")[0]||!p)return;a&&t&&l.disableNavigatableContainer(a,[s.filterFieldWrapper,s.filterOperatorWrapper,s.filterValueWrapper]),p.querySelectorAll(`${s.filterFieldWrapper}, ${s.filterOperatorWrapper}, ${s.filterValueWrapper}`).forEach((h,m)=>{h.tabIndex=m===0?0:-1});const v=p.querySelector(`${s.filterFieldWrapper}, ${s.filterOperatorWrapper}, ${s.filterValueWrapper}`);v?v.focus():l.focusFirstFocusableChild(p)},this.onKeyDown=i=>{var o;(o=this.navigation)==null||o.triggerKeyboardEvent(i)},this.showLicenseWatermark=!l.validatePackage(E.packageMetadata,{component:"Filter"}),this.licenseMessage=l.getLicenseMessage(E.packageMetadata)}componentDidMount(){this.wrapperRef&&(this.navigation=new l.Navigation({tabIndex:0,root:this.wrapperRef,selectors:[".k-filter"],keyboardEvents:{keydown:{Tab:(r,i,o)=>{const e=r.getElementsByClassName("k-filter-lines")[0];e&&l.disableNavigatableContainer(e)},Escape:(r,i,o)=>{const e=l.getActiveElement(document)||null,t=e==null?void 0:e.closest(s.toolbarElement),a=r.querySelector(s.groupToolbar),n=t==null?void 0:t.querySelector(".k-toolbar-button-group"),c=t===a||!!n,{isTextInput:f,isCombobox:p}=this.classifyActive(e);if(!c&&t&&e!==t)if(o.preventDefault(),l.disableNavigatableContainer(t,[s.filterFieldWrapper,s.filterOperatorWrapper,s.filterValueWrapper]),f||p){const u=e==null?void 0:e.closest(`${s.filterFieldWrapper}, ${s.filterOperatorWrapper}, ${s.filterValueWrapper}`);u&&u.focus()}else l.focusFirstFocusableChild(t)},ArrowUp:(r,i,o)=>{const e=l.getActiveElement(document)||null;if(!e)return;const{isPopup:t,isTextInput:a,isCombobox:n,isWrapper:c}=this.classifyActive(e);(t||a||n)&&!c||(o.preventDefault(),this.navigateVertical("up",r,e))},ArrowDown:(r,i,o)=>{const e=l.getActiveElement(document)||null;if(!e)return;const{isPopup:t,isTextInput:a,isCombobox:n,isWrapper:c}=this.classifyActive(e);(t||a||n)&&!c||(o.preventDefault(),this.navigateVertical("down",r,e))},ArrowRight:(r,i,o)=>{const e=l.getActiveElement(document)||null;if(!e)return;const{isTextInput:t}=this.classifyActive(e);if(t)return;o.preventDefault();const a=e==null?void 0:e.nextElementSibling,n=e==null?void 0:e.closest(s.toolbarElement),c=r.querySelector(s.groupToolbar),f=n==null?void 0:n.querySelector(".k-toolbar-button-group");e&&a&&!(n===c||!!f)&&a.focus()},ArrowLeft:(r,i,o)=>{const e=l.getActiveElement(document)||null;if(!e)return;const{isTextInput:t}=this.classifyActive(e);if(t)return;o.preventDefault();const a=e==null?void 0:e.previousElementSibling,n=e==null?void 0:e.closest(s.toolbarElement),c=r.querySelector(s.groupToolbar),f=n==null?void 0:n.querySelector(".k-toolbar-button-group");e&&a&&!(n===c||!!f)&&a.focus()},Enter:(r,i,o)=>{var p;o.preventDefault();const e=l.getActiveElement(document)||null;if(!e)return;const t=e==null?void 0:e.closest(s.toolbarElement),a=r.getElementsByClassName("k-toolbar"),n=r.querySelector(s.groupToolbar),c=t==null?void 0:t.querySelector(".k-toolbar-button-group");if(t===n||!!c){const u=t==null?void 0:t.lastElementChild;u&&e===u&&u.click();return}if(t&&e){const u=e.classList.contains("k-filter-field")||e.classList.contains("k-filter-operator")||e.classList.contains("k-filter-value"),w=t.querySelector('button[title="Remove"]');if(e===w){const h=Array.from(a).findIndex(W=>W===t)-1,m=(p=a[h])==null?void 0:p.lastElementChild;e.click(),m&&m.focus()}else u&&(l.enableNavigatableContainer(t,[s.filterFieldWrapper,s.filterOperatorWrapper,s.filterValueWrapper]),l.focusFirstFocusableChild(e))}}}}}))}render(){return g.createElement("div",{className:l.classNames("k-filter",this.props.className),style:this.props.style,ref:this.wrapperRef,onKeyDown:this.onKeyDown},g.createElement("ul",{role:"tree",className:"k-filter-container","aria-label":this.props.ariaLabel},g.createElement("li",{role:"treeitem","aria-selected":!1,className:"k-filter-group-main"},g.createElement(F.Group,{filter:this.props.value,fields:this.props.fields,ariaLabel:this.props.ariaLabelGroup,ariaLabelExpression:this.props.ariaLabelExpression,onChange:this.onFilterChange,onRemove:this.onGroupRemove,defaultGroupFilter:this.props.defaultGroupFilter||{logic:"and",filters:[]}}))),this.showLicenseWatermark&&g.createElement(l.WatermarkOverlay,{message:this.licenseMessage}))}classifyActive(r){var n,c;if(!r)return{isTextInput:!1,isCombobox:!1,isWrapper:!1,isPopup:!1};const i=r.tagName==="INPUT"||r.tagName==="TEXTAREA",o=((n=r.getAttribute)==null?void 0:n.call(r,"role"))==="combobox",e=r.classList,t=!!e&&(e.contains("k-filter-field")||e.contains("k-filter-operator")||e.contains("k-filter-value")),a=!!((c=r.closest)!=null&&c.call(r,".k-animation-container, .k-popup"));return{isTextInput:i,isCombobox:o,isWrapper:t,isPopup:a}}};k.propTypes={className:b.string,style:b.object,fields:function(r,i){const o=r[i];if(o===void 0)return new Error(`Property '${i}' is missing.`);if(Array.isArray(o)){if(Object.keys(o.reduce((e,t)=>({...e,[t.name]:1}),{})).length!==o.length)return new Error(`Property '${i}' needs to contain objects with unique 'name' field.`)}else return new Error(`Property '${i}' needs to be Array<FieldSettings>.`);return null},ariaLabelGroup:b.string,ariaLabelExpression:b.string,value:b.object.isRequired,onChange:b.func.isRequired};let y=k;exports.Filter=y;exports.selectors=s;
9
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),b=require("prop-types"),l=require("@progress/kendo-react-common"),A=require("./Group.js"),W=require("@progress/kendo-react-intl"),k=require("../messages/index.js"),R=require("../package-metadata.js");function C(d){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(d){for(const i in d)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(d,i);Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>d[i]})}}return t.default=d,Object.freeze(t)}const g=C(x),s={filterFieldWrapper:".k-filter-field",filterOperatorWrapper:".k-filter-operator",filterValueWrapper:".k-filter-value",filterToolbar:".k-filter-toolbar",toolbarElement:".k-toolbar",groupToolbar:".k-filter-group-main > .k-filter-toolbar > .k-toolbar",subGroupToolbar:".k-filter-lines .k-filter-toolbar > .k-toolbar"},w=class w extends g.Component{constructor(t){super(t),this.wrapperRef=g.createRef(),this.showLicenseWatermark=!1,this.onFilterChange=i=>{const o={filter:i.nextFilter,syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,target:this};this.props.onChange.call(void 0,o)},this.onGroupRemove=i=>{const o={filter:{...this.props.value,filters:[]},syntheticEvent:i.syntheticEvent,nativeEvent:i.nativeEvent,target:this};this.props.onChange.call(void 0,o)},this.navigateVertical=(i,o,e)=>{if(!e)return;const r=e.classList.contains("k-filter-field")||e.classList.contains("k-filter-operator")||e.classList.contains("k-filter-value"),a=e.closest(s.toolbarElement),n=Array.from(o.getElementsByClassName("k-toolbar")),c=n.findIndex(h=>h===a),f=i==="up"?c-1:c+1,p=n[f];if(!o.getElementsByClassName("k-filter-lines")[0]||!p)return;a&&r&&l.disableNavigatableContainer(a,[s.filterFieldWrapper,s.filterOperatorWrapper,s.filterValueWrapper]),p.querySelectorAll(`${s.filterFieldWrapper}, ${s.filterOperatorWrapper}, ${s.filterValueWrapper}`).forEach((h,m)=>{h.tabIndex=m===0?0:-1});const y=p.querySelector(`${s.filterFieldWrapper}, ${s.filterOperatorWrapper}, ${s.filterValueWrapper}`);y?y.focus():l.focusFirstFocusableChild(p)},this.onKeyDown=i=>{var o;(o=this.navigation)==null||o.triggerKeyboardEvent(i)},this.showLicenseWatermark=!l.validatePackage(R.packageMetadata,{component:"Filter"}),this.licenseMessage=l.getLicenseMessage(R.packageMetadata)}componentDidMount(){this.wrapperRef&&(this.navigation=new l.Navigation({tabIndex:0,root:this.wrapperRef,selectors:[".k-filter"],keyboardEvents:{keydown:{Tab:(t,i,o)=>{const e=t.getElementsByClassName("k-filter-lines")[0];e&&l.disableNavigatableContainer(e)},Escape:(t,i,o)=>{const e=l.getActiveElement(document)||null,r=e==null?void 0:e.closest(s.toolbarElement),a=t.querySelector(s.groupToolbar),n=r==null?void 0:r.querySelector(".k-toolbar-button-group"),c=r===a||!!n,{isTextInput:f,isCombobox:p}=this.classifyActive(e);if(!c&&r&&e!==r)if(o.preventDefault(),l.disableNavigatableContainer(r,[s.filterFieldWrapper,s.filterOperatorWrapper,s.filterValueWrapper]),f||p){const u=e==null?void 0:e.closest(`${s.filterFieldWrapper}, ${s.filterOperatorWrapper}, ${s.filterValueWrapper}`);u&&u.focus()}else l.focusFirstFocusableChild(r)},ArrowUp:(t,i,o)=>{const e=l.getActiveElement(document)||null;if(!e)return;const{isPopup:r,isTextInput:a,isCombobox:n,isWrapper:c}=this.classifyActive(e);(r||a||n)&&!c||(o.preventDefault(),this.navigateVertical("up",t,e))},ArrowDown:(t,i,o)=>{const e=l.getActiveElement(document)||null;if(!e)return;const{isPopup:r,isTextInput:a,isCombobox:n,isWrapper:c}=this.classifyActive(e);(r||a||n)&&!c||(o.preventDefault(),this.navigateVertical("down",t,e))},ArrowRight:(t,i,o)=>{const e=l.getActiveElement(document)||null;if(!e)return;const{isTextInput:r}=this.classifyActive(e);if(r)return;o.preventDefault();const a=e==null?void 0:e.nextElementSibling,n=e==null?void 0:e.closest(s.toolbarElement),c=t.querySelector(s.groupToolbar),f=n==null?void 0:n.querySelector(".k-toolbar-button-group");e&&a&&!(n===c||!!f)&&a.focus()},ArrowLeft:(t,i,o)=>{const e=l.getActiveElement(document)||null;if(!e)return;const{isTextInput:r}=this.classifyActive(e);if(r)return;o.preventDefault();const a=e==null?void 0:e.previousElementSibling,n=e==null?void 0:e.closest(s.toolbarElement),c=t.querySelector(s.groupToolbar),f=n==null?void 0:n.querySelector(".k-toolbar-button-group");e&&a&&!(n===c||!!f)&&a.focus()},Enter:(t,i,o)=>{var p;o.preventDefault();const e=l.getActiveElement(document)||null;if(!e)return;const r=e==null?void 0:e.closest(s.toolbarElement),a=t.getElementsByClassName("k-toolbar"),n=t.querySelector(s.groupToolbar),c=r==null?void 0:r.querySelector(".k-toolbar-button-group");if(r===n||!!c){const u=r==null?void 0:r.lastElementChild;u&&e===u&&u.click();return}if(r&&e){const u=e.classList.contains("k-filter-field")||e.classList.contains("k-filter-operator")||e.classList.contains("k-filter-value"),E=r.querySelector('button[title="Remove"]');if(e===E){const h=Array.from(a).findIndex(F=>F===r)-1,m=(p=a[h])==null?void 0:p.lastElementChild;e.click(),m&&m.focus()}else u&&(l.enableNavigatableContainer(r,[s.filterFieldWrapper,s.filterOperatorWrapper,s.filterValueWrapper]),l.focusFirstFocusableChild(e))}}}}}))}render(){const t=W.provideLocalizationService(this);return g.createElement("div",{className:l.classNames("k-filter",this.props.className),style:this.props.style,ref:this.wrapperRef,onKeyDown:this.onKeyDown},g.createElement("ul",{role:"tree",className:"k-filter-container","aria-label":this.props.ariaLabel||t.toLanguageString(k.filterAriaLabel,k.messages[k.filterAriaLabel])},g.createElement("li",{role:"treeitem",className:"k-filter-group-main"},g.createElement(A.Group,{filter:this.props.value,fields:this.props.fields,ariaLabel:this.props.ariaLabelGroup,ariaLabelExpression:this.props.ariaLabelExpression,onChange:this.onFilterChange,onRemove:this.onGroupRemove,defaultGroupFilter:this.props.defaultGroupFilter||{logic:"and",filters:[]}}))),this.showLicenseWatermark&&g.createElement(l.WatermarkOverlay,{message:this.licenseMessage}))}classifyActive(t){var n,c;if(!t)return{isTextInput:!1,isCombobox:!1,isWrapper:!1,isPopup:!1};const i=t.tagName==="INPUT"||t.tagName==="TEXTAREA",o=((n=t.getAttribute)==null?void 0:n.call(t,"role"))==="combobox",e=t.classList,r=!!e&&(e.contains("k-filter-field")||e.contains("k-filter-operator")||e.contains("k-filter-value")),a=!!((c=t.closest)!=null&&c.call(t,".k-animation-container, .k-popup"));return{isTextInput:i,isCombobox:o,isWrapper:r,isPopup:a}}};w.propTypes={className:b.string,style:b.object,fields:function(t,i){const o=t[i];if(o===void 0)return new Error(`Property '${i}' is missing.`);if(Array.isArray(o)){if(Object.keys(o.reduce((e,r)=>({...e,[r.name]:1}),{})).length!==o.length)return new Error(`Property '${i}' needs to contain objects with unique 'name' field.`)}else return new Error(`Property '${i}' needs to be Array<FieldSettings>.`);return null},ariaLabelGroup:b.string,ariaLabelExpression:b.string,value:b.object.isRequired,onChange:b.func.isRequired};let v=w;W.registerForLocalization(v);exports.Filter=v;exports.selectors=s;
package/filter/Filter.mjs CHANGED
@@ -8,10 +8,12 @@
8
8
  "use client";
9
9
  import * as f from "react";
10
10
  import g from "prop-types";
11
- import { disableNavigatableContainer as v, focusFirstFocusableChild as y, validatePackage as x, getLicenseMessage as F, Navigation as C, getActiveElement as b, enableNavigatableContainer as A, classNames as T, WatermarkOverlay as G } from "@progress/kendo-react-common";
12
- import { Group as L } from "./Group.mjs";
13
- import { packageMetadata as W } from "../package-metadata.mjs";
14
- const s = {
11
+ import { disableNavigatableContainer as v, focusFirstFocusableChild as y, validatePackage as F, getLicenseMessage as L, Navigation as A, getActiveElement as b, enableNavigatableContainer as C, classNames as T, WatermarkOverlay as G } from "@progress/kendo-react-common";
12
+ import { Group as S } from "./Group.mjs";
13
+ import { provideLocalizationService as I, registerForLocalization as q } from "@progress/kendo-react-intl";
14
+ import { filterAriaLabel as E, messages as N } from "../messages/index.mjs";
15
+ import { packageMetadata as R } from "../package-metadata.mjs";
16
+ const i = {
15
17
  // Wrapper elements for filter field/operator/value (used in Expression rows)
16
18
  filterFieldWrapper: ".k-filter-field",
17
19
  filterOperatorWrapper: ".k-filter-operator",
@@ -21,94 +23,94 @@ const s = {
21
23
  toolbarElement: ".k-toolbar",
22
24
  groupToolbar: ".k-filter-group-main > .k-filter-toolbar > .k-toolbar",
23
25
  subGroupToolbar: ".k-filter-lines .k-filter-toolbar > .k-toolbar"
24
- }, k = class k extends f.Component {
26
+ }, w = class w extends f.Component {
25
27
  constructor(r) {
26
- super(r), this.wrapperRef = f.createRef(), this.showLicenseWatermark = !1, this.onFilterChange = (i) => {
28
+ super(r), this.wrapperRef = f.createRef(), this.showLicenseWatermark = !1, this.onFilterChange = (s) => {
27
29
  const o = {
28
- filter: i.nextFilter,
29
- syntheticEvent: i.syntheticEvent,
30
- nativeEvent: i.nativeEvent,
30
+ filter: s.nextFilter,
31
+ syntheticEvent: s.syntheticEvent,
32
+ nativeEvent: s.nativeEvent,
31
33
  target: this
32
34
  };
33
35
  this.props.onChange.call(void 0, o);
34
- }, this.onGroupRemove = (i) => {
36
+ }, this.onGroupRemove = (s) => {
35
37
  const o = {
36
38
  filter: { ...this.props.value, filters: [] },
37
- syntheticEvent: i.syntheticEvent,
38
- nativeEvent: i.nativeEvent,
39
+ syntheticEvent: s.syntheticEvent,
40
+ nativeEvent: s.nativeEvent,
39
41
  target: this
40
42
  };
41
43
  this.props.onChange.call(void 0, o);
42
- }, this.navigateVertical = (i, o, e) => {
44
+ }, this.navigateVertical = (s, o, e) => {
43
45
  if (!e)
44
46
  return;
45
- const t = e.classList.contains("k-filter-field") || e.classList.contains("k-filter-operator") || e.classList.contains("k-filter-value"), a = e.closest(s.toolbarElement), n = Array.from(o.getElementsByClassName("k-toolbar")), l = n.findIndex((h) => h === a), u = i === "up" ? l - 1 : l + 1, p = n[u];
47
+ const t = e.classList.contains("k-filter-field") || e.classList.contains("k-filter-operator") || e.classList.contains("k-filter-value"), a = e.closest(i.toolbarElement), n = Array.from(o.getElementsByClassName("k-toolbar")), l = n.findIndex((m) => m === a), u = s === "up" ? l - 1 : l + 1, p = n[u];
46
48
  if (!o.getElementsByClassName("k-filter-lines")[0] || !p)
47
49
  return;
48
50
  a && t && v(a, [
49
- s.filterFieldWrapper,
50
- s.filterOperatorWrapper,
51
- s.filterValueWrapper
51
+ i.filterFieldWrapper,
52
+ i.filterOperatorWrapper,
53
+ i.filterValueWrapper
52
54
  ]), p.querySelectorAll(
53
- `${s.filterFieldWrapper}, ${s.filterOperatorWrapper}, ${s.filterValueWrapper}`
54
- ).forEach((h, m) => {
55
- h.tabIndex = m === 0 ? 0 : -1;
55
+ `${i.filterFieldWrapper}, ${i.filterOperatorWrapper}, ${i.filterValueWrapper}`
56
+ ).forEach((m, h) => {
57
+ m.tabIndex = h === 0 ? 0 : -1;
56
58
  });
57
59
  const d = p.querySelector(
58
- `${s.filterFieldWrapper}, ${s.filterOperatorWrapper}, ${s.filterValueWrapper}`
60
+ `${i.filterFieldWrapper}, ${i.filterOperatorWrapper}, ${i.filterValueWrapper}`
59
61
  );
60
62
  d ? d.focus() : y(p);
61
- }, this.onKeyDown = (i) => {
63
+ }, this.onKeyDown = (s) => {
62
64
  var o;
63
- (o = this.navigation) == null || o.triggerKeyboardEvent(i);
64
- }, this.showLicenseWatermark = !x(W, { component: "Filter" }), this.licenseMessage = F(W);
65
+ (o = this.navigation) == null || o.triggerKeyboardEvent(s);
66
+ }, this.showLicenseWatermark = !F(R, { component: "Filter" }), this.licenseMessage = L(R);
65
67
  }
66
68
  /**
67
69
  * @hidden
68
70
  */
69
71
  componentDidMount() {
70
- this.wrapperRef && (this.navigation = new C({
72
+ this.wrapperRef && (this.navigation = new A({
71
73
  tabIndex: 0,
72
74
  root: this.wrapperRef,
73
75
  selectors: [".k-filter"],
74
76
  keyboardEvents: {
75
77
  keydown: {
76
- Tab: (r, i, o) => {
78
+ Tab: (r, s, o) => {
77
79
  const e = r.getElementsByClassName(
78
80
  "k-filter-lines"
79
81
  )[0];
80
82
  e && v(e);
81
83
  },
82
- Escape: (r, i, o) => {
83
- const e = b(document) || null, t = e == null ? void 0 : e.closest(s.toolbarElement), a = r.querySelector(s.groupToolbar), n = t == null ? void 0 : t.querySelector(".k-toolbar-button-group"), l = t === a || !!n, { isTextInput: u, isCombobox: p } = this.classifyActive(e);
84
+ Escape: (r, s, o) => {
85
+ const e = b(document) || null, t = e == null ? void 0 : e.closest(i.toolbarElement), a = r.querySelector(i.groupToolbar), n = t == null ? void 0 : t.querySelector(".k-toolbar-button-group"), l = t === a || !!n, { isTextInput: u, isCombobox: p } = this.classifyActive(e);
84
86
  if (!l && t && e !== t)
85
87
  if (o.preventDefault(), v(t, [
86
- s.filterFieldWrapper,
87
- s.filterOperatorWrapper,
88
- s.filterValueWrapper
88
+ i.filterFieldWrapper,
89
+ i.filterOperatorWrapper,
90
+ i.filterValueWrapper
89
91
  ]), u || p) {
90
92
  const c = e == null ? void 0 : e.closest(
91
- `${s.filterFieldWrapper}, ${s.filterOperatorWrapper}, ${s.filterValueWrapper}`
93
+ `${i.filterFieldWrapper}, ${i.filterOperatorWrapper}, ${i.filterValueWrapper}`
92
94
  );
93
95
  c && c.focus();
94
96
  } else
95
97
  y(t);
96
98
  },
97
- ArrowUp: (r, i, o) => {
99
+ ArrowUp: (r, s, o) => {
98
100
  const e = b(document) || null;
99
101
  if (!e)
100
102
  return;
101
103
  const { isPopup: t, isTextInput: a, isCombobox: n, isWrapper: l } = this.classifyActive(e);
102
104
  (t || a || n) && !l || (o.preventDefault(), this.navigateVertical("up", r, e));
103
105
  },
104
- ArrowDown: (r, i, o) => {
106
+ ArrowDown: (r, s, o) => {
105
107
  const e = b(document) || null;
106
108
  if (!e)
107
109
  return;
108
110
  const { isPopup: t, isTextInput: a, isCombobox: n, isWrapper: l } = this.classifyActive(e);
109
111
  (t || a || n) && !l || (o.preventDefault(), this.navigateVertical("down", r, e));
110
112
  },
111
- ArrowRight: (r, i, o) => {
113
+ ArrowRight: (r, s, o) => {
112
114
  const e = b(document) || null;
113
115
  if (!e)
114
116
  return;
@@ -116,10 +118,10 @@ const s = {
116
118
  if (t)
117
119
  return;
118
120
  o.preventDefault();
119
- const a = e == null ? void 0 : e.nextElementSibling, n = e == null ? void 0 : e.closest(s.toolbarElement), l = r.querySelector(s.groupToolbar), u = n == null ? void 0 : n.querySelector(".k-toolbar-button-group");
121
+ const a = e == null ? void 0 : e.nextElementSibling, n = e == null ? void 0 : e.closest(i.toolbarElement), l = r.querySelector(i.groupToolbar), u = n == null ? void 0 : n.querySelector(".k-toolbar-button-group");
120
122
  e && a && !(n === l || !!u) && a.focus();
121
123
  },
122
- ArrowLeft: (r, i, o) => {
124
+ ArrowLeft: (r, s, o) => {
123
125
  const e = b(document) || null;
124
126
  if (!e)
125
127
  return;
@@ -127,16 +129,16 @@ const s = {
127
129
  if (t)
128
130
  return;
129
131
  o.preventDefault();
130
- const a = e == null ? void 0 : e.previousElementSibling, n = e == null ? void 0 : e.closest(s.toolbarElement), l = r.querySelector(s.groupToolbar), u = n == null ? void 0 : n.querySelector(".k-toolbar-button-group");
132
+ const a = e == null ? void 0 : e.previousElementSibling, n = e == null ? void 0 : e.closest(i.toolbarElement), l = r.querySelector(i.groupToolbar), u = n == null ? void 0 : n.querySelector(".k-toolbar-button-group");
131
133
  e && a && !(n === l || !!u) && a.focus();
132
134
  },
133
- Enter: (r, i, o) => {
135
+ Enter: (r, s, o) => {
134
136
  var p;
135
137
  o.preventDefault();
136
138
  const e = b(document) || null;
137
139
  if (!e)
138
140
  return;
139
- const t = e == null ? void 0 : e.closest(s.toolbarElement), a = r.getElementsByClassName("k-toolbar"), n = r.querySelector(s.groupToolbar), l = t == null ? void 0 : t.querySelector(
141
+ const t = e == null ? void 0 : e.closest(i.toolbarElement), a = r.getElementsByClassName("k-toolbar"), n = r.querySelector(i.groupToolbar), l = t == null ? void 0 : t.querySelector(
140
142
  ".k-toolbar-button-group"
141
143
  );
142
144
  if (t === n || !!l) {
@@ -145,14 +147,14 @@ const s = {
145
147
  return;
146
148
  }
147
149
  if (t && e) {
148
- const c = e.classList.contains("k-filter-field") || e.classList.contains("k-filter-operator") || e.classList.contains("k-filter-value"), w = t.querySelector('button[title="Remove"]');
149
- if (e === w) {
150
- const h = Array.from(a).findIndex((R) => R === t) - 1, m = (p = a[h]) == null ? void 0 : p.lastElementChild;
151
- e.click(), m && m.focus();
152
- } else c && (A(t, [
153
- s.filterFieldWrapper,
154
- s.filterOperatorWrapper,
155
- s.filterValueWrapper
150
+ const c = e.classList.contains("k-filter-field") || e.classList.contains("k-filter-operator") || e.classList.contains("k-filter-value"), W = t.querySelector('button[title="Remove"]');
151
+ if (e === W) {
152
+ const m = Array.from(a).findIndex((x) => x === t) - 1, h = (p = a[m]) == null ? void 0 : p.lastElementChild;
153
+ e.click(), h && h.focus();
154
+ } else c && (C(t, [
155
+ i.filterFieldWrapper,
156
+ i.filterOperatorWrapper,
157
+ i.filterValueWrapper
156
158
  ]), y(e));
157
159
  }
158
160
  }
@@ -164,6 +166,7 @@ const s = {
164
166
  * @hidden
165
167
  */
166
168
  render() {
169
+ const r = I(this);
167
170
  return /* @__PURE__ */ f.createElement(
168
171
  "div",
169
172
  {
@@ -172,18 +175,26 @@ const s = {
172
175
  ref: this.wrapperRef,
173
176
  onKeyDown: this.onKeyDown
174
177
  },
175
- /* @__PURE__ */ f.createElement("ul", { role: "tree", className: "k-filter-container", "aria-label": this.props.ariaLabel }, /* @__PURE__ */ f.createElement("li", { role: "treeitem", "aria-selected": !1, className: "k-filter-group-main" }, /* @__PURE__ */ f.createElement(
176
- L,
178
+ /* @__PURE__ */ f.createElement(
179
+ "ul",
177
180
  {
178
- filter: this.props.value,
179
- fields: this.props.fields,
180
- ariaLabel: this.props.ariaLabelGroup,
181
- ariaLabelExpression: this.props.ariaLabelExpression,
182
- onChange: this.onFilterChange,
183
- onRemove: this.onGroupRemove,
184
- defaultGroupFilter: this.props.defaultGroupFilter || { logic: "and", filters: [] }
185
- }
186
- ))),
181
+ role: "tree",
182
+ className: "k-filter-container",
183
+ "aria-label": this.props.ariaLabel || r.toLanguageString(E, N[E])
184
+ },
185
+ /* @__PURE__ */ f.createElement("li", { role: "treeitem", className: "k-filter-group-main" }, /* @__PURE__ */ f.createElement(
186
+ S,
187
+ {
188
+ filter: this.props.value,
189
+ fields: this.props.fields,
190
+ ariaLabel: this.props.ariaLabelGroup,
191
+ ariaLabelExpression: this.props.ariaLabelExpression,
192
+ onChange: this.onFilterChange,
193
+ onRemove: this.onGroupRemove,
194
+ defaultGroupFilter: this.props.defaultGroupFilter || { logic: "and", filters: [] }
195
+ }
196
+ ))
197
+ ),
187
198
  this.showLicenseWatermark && /* @__PURE__ */ f.createElement(G, { message: this.licenseMessage })
188
199
  );
189
200
  }
@@ -194,21 +205,21 @@ const s = {
194
205
  var n, l;
195
206
  if (!r)
196
207
  return { isTextInput: !1, isCombobox: !1, isWrapper: !1, isPopup: !1 };
197
- const i = r.tagName === "INPUT" || r.tagName === "TEXTAREA", o = ((n = r.getAttribute) == null ? void 0 : n.call(r, "role")) === "combobox", e = r.classList, t = !!e && (e.contains("k-filter-field") || e.contains("k-filter-operator") || e.contains("k-filter-value")), a = !!((l = r.closest) != null && l.call(r, ".k-animation-container, .k-popup"));
198
- return { isTextInput: i, isCombobox: o, isWrapper: t, isPopup: a };
208
+ const s = r.tagName === "INPUT" || r.tagName === "TEXTAREA", o = ((n = r.getAttribute) == null ? void 0 : n.call(r, "role")) === "combobox", e = r.classList, t = !!e && (e.contains("k-filter-field") || e.contains("k-filter-operator") || e.contains("k-filter-value")), a = !!((l = r.closest) != null && l.call(r, ".k-animation-container, .k-popup"));
209
+ return { isTextInput: s, isCombobox: o, isWrapper: t, isPopup: a };
199
210
  }
200
211
  };
201
- k.propTypes = {
212
+ w.propTypes = {
202
213
  className: g.string,
203
214
  style: g.object,
204
- fields: function(r, i) {
205
- const o = r[i];
215
+ fields: function(r, s) {
216
+ const o = r[s];
206
217
  if (o === void 0)
207
- return new Error(`Property '${i}' is missing.`);
218
+ return new Error(`Property '${s}' is missing.`);
208
219
  if (Array.isArray(o)) {
209
220
  if (Object.keys(o.reduce((e, t) => ({ ...e, [t.name]: 1 }), {})).length !== o.length)
210
- return new Error(`Property '${i}' needs to contain objects with unique 'name' field.`);
211
- } else return new Error(`Property '${i}' needs to be Array<FieldSettings>.`);
221
+ return new Error(`Property '${s}' needs to contain objects with unique 'name' field.`);
222
+ } else return new Error(`Property '${s}' needs to be Array<FieldSettings>.`);
212
223
  return null;
213
224
  },
214
225
  ariaLabelGroup: g.string,
@@ -216,8 +227,9 @@ k.propTypes = {
216
227
  value: g.object.isRequired,
217
228
  onChange: g.func.isRequired
218
229
  };
219
- let E = k;
230
+ let k = w;
231
+ q(k);
220
232
  export {
221
- E as Filter,
222
- s as selectors
233
+ k as Filter,
234
+ i as selectors
223
235
  };
package/filter/Group.js CHANGED
@@ -6,4 +6,4 @@
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
8
  "use client";
9
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react"),l=require("prop-types"),h=require("@progress/kendo-data-query"),c=require("@progress/kendo-react-buttons"),f=require("@progress/kendo-react-intl"),d=require("@progress/kendo-svg-icons"),m=require("./Expression.js"),E=require("./operators.js"),i=require("../messages/index.js");function b(p){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const t in p)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(p,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>p[t]})}}return e.default=p,Object.freeze(e)}const o=b(v),s=class s extends o.Component{constructor(){super(...arguments),this.getFilterKey=(e,t)=>{let r=s.filterIdMap.get(e);return r||(h.isCompositeFilterDescriptor(e)?r=`group-${e.logic}-${t}-${s.filterIdCounter++}`:r=`expr-${e.field}-${e.operator}-${t}-${s.filterIdCounter++}`,s.filterIdMap.set(e,r)),r},this.onGroupRemove=e=>{const t={filter:this.props.filter,target:this,syntheticEvent:e,nativeEvent:e.nativeEvent};this.props.onRemove.call(void 0,t)},this.onAddExpression=e=>{const t=this.props.filter,r=this.props.fields[0],n={field:r.name,operator:r.operators[0].operator};n.value=E.stringOperator(n.operator)?"":null;const a={nextFilter:{...t,filters:[...t.filters,n]},prevFilter:t,target:this,syntheticEvent:e,nativeEvent:e.nativeEvent};this.props.onChange.call(void 0,a)},this.onAddGroup=e=>{const t=this.props.filter,r={...this.props.defaultGroupFilter},n={nextFilter:{...t,filters:[...t.filters,r]},prevFilter:t,target:this,syntheticEvent:e,nativeEvent:e.nativeEvent};this.props.onChange.call(void 0,n)},this.onLogicAnd=e=>this.changeLogic("and",e),this.onLogicOr=e=>this.changeLogic("or",e),this.changeLogic=(e,t)=>{const r=this.props.filter;if(r.logic!==e){const n={nextFilter:{...r,logic:e},prevFilter:r,target:this,syntheticEvent:t,nativeEvent:t.nativeEvent};this.props.onChange.call(void 0,n)}},this.replaceFilter=(e,t)=>{const r=this.props.filter,n=r.filters.map(a=>{if(a===e){const g=s.filterIdMap.get(e);return g&&s.filterIdMap.set(t,g),t}return a});return{...r,filters:n}},this.onChange=e=>{const r={nextFilter:this.replaceFilter(e.prevFilter,e.nextFilter),prevFilter:this.props.filter,syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:this};this.props.onChange.call(void 0,r)},this.onRemove=e=>{const t=this.props.filter,r=t.filters.filter(a=>a!==e.filter),n={nextFilter:{...t,filters:r},prevFilter:t,syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:this};this.props.onChange.call(void 0,n)}}render(){const e=f.provideLocalizationService(this),{fields:t,filter:r,ariaLabel:n=e.toLanguageString(i.filterGroupAriaLabel,i.messages[i.filterGroupAriaLabel])}=this.props;return o.createElement(o.Fragment,null,o.createElement("div",{className:"k-filter-toolbar"},o.createElement(c.Toolbar,{role:"toolbar",ariaLabel:n},o.createElement(c.ButtonGroup,{className:"k-toolbar-button-group"},o.createElement(c.Button,{togglable:!0,onClick:this.onLogicAnd,selected:r.logic==="and",type:"button"},e.toLanguageString(i.filterAndLogic,i.messages[i.filterAndLogic])),o.createElement(c.Button,{togglable:!0,onClick:this.onLogicOr,selected:r.logic==="or",type:"button"},e.toLanguageString(i.filterOrLogic,i.messages[i.filterOrLogic]))),o.createElement(c.Button,{className:"k-toolbar-button",title:e.toLanguageString(i.filterAddExpression,i.messages[i.filterAddExpression]),icon:"filter-add-expression",svgIcon:d.filterAddExpressionIcon,type:"button",onClick:this.onAddExpression},e.toLanguageString(i.filterAddExpression,i.messages[i.filterAddExpression])),o.createElement(c.Button,{className:"k-toolbar-button",title:e.toLanguageString(i.filterAddGroup,i.messages[i.filterAddGroup]),icon:"filter-add-group",svgIcon:d.filterAddGroupIcon,type:"button",onClick:this.onAddGroup},e.toLanguageString(i.filterAddGroup,i.messages[i.filterAddGroup])),o.createElement(c.Button,{className:"k-toolbar-button",title:e.toLanguageString(i.filterClose,i.messages[i.filterClose]),icon:"x",svgIcon:d.xIcon,fillMode:"flat",type:"button",onClick:this.onGroupRemove}))),r.filters.length>0&&o.createElement("ul",{role:"group",className:"k-filter-lines"},r.filters.map((a,g)=>o.createElement("li",{role:"treeitem","aria-selected":!1,key:this.getFilterKey(a,g),className:"k-filter-item"},h.isCompositeFilterDescriptor(a)?o.createElement(s,{filter:a,fields:t,onChange:this.onChange,onRemove:this.onRemove,defaultGroupFilter:this.props.defaultGroupFilter,ariaLabel:this.props.ariaLabel,ariaLabelExpression:this.props.ariaLabelExpression}):o.createElement(m.Expression,{filter:a,fields:t,ariaLabel:this.props.ariaLabelExpression,onChange:this.onChange,onRemove:this.onRemove})))))}};s.propTypes={filter:l.object.isRequired,fields:l.array.isRequired,ariaLabel:l.string,ariaLabelExpression:l.string,onChange:l.func.isRequired,onRemove:l.func.isRequired,defaultGroupFilter:l.object.isRequired},s.filterIdCounter=0,s.filterIdMap=new WeakMap;let u=s;f.registerForLocalization(u);exports.Group=u;
9
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react"),l=require("prop-types"),f=require("@progress/kendo-data-query"),c=require("@progress/kendo-react-buttons"),h=require("@progress/kendo-react-intl"),d=require("@progress/kendo-svg-icons"),m=require("./Expression.js"),E=require("./operators.js"),i=require("../messages/index.js");function b(p){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const t in p)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(p,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>p[t]})}}return e.default=p,Object.freeze(e)}const o=b(v),s=class s extends o.Component{constructor(){super(...arguments),this.getFilterKey=(e,t)=>{let r=s.filterIdMap.get(e);return r||(f.isCompositeFilterDescriptor(e)?r=`group-${e.logic}-${t}-${s.filterIdCounter++}`:r=`expr-${e.field}-${e.operator}-${t}-${s.filterIdCounter++}`,s.filterIdMap.set(e,r)),r},this.onGroupRemove=e=>{const t={filter:this.props.filter,target:this,syntheticEvent:e,nativeEvent:e.nativeEvent};this.props.onRemove.call(void 0,t)},this.onAddExpression=e=>{const t=this.props.filter,r=this.props.fields[0],n={field:r.name,operator:r.operators[0].operator};n.value=E.stringOperator(n.operator)?"":null;const a={nextFilter:{...t,filters:[...t.filters,n]},prevFilter:t,target:this,syntheticEvent:e,nativeEvent:e.nativeEvent};this.props.onChange.call(void 0,a)},this.onAddGroup=e=>{const t=this.props.filter,r={...this.props.defaultGroupFilter},n={nextFilter:{...t,filters:[...t.filters,r]},prevFilter:t,target:this,syntheticEvent:e,nativeEvent:e.nativeEvent};this.props.onChange.call(void 0,n)},this.onLogicAnd=e=>this.changeLogic("and",e),this.onLogicOr=e=>this.changeLogic("or",e),this.changeLogic=(e,t)=>{const r=this.props.filter;if(r.logic!==e){const n={nextFilter:{...r,logic:e},prevFilter:r,target:this,syntheticEvent:t,nativeEvent:t.nativeEvent};this.props.onChange.call(void 0,n)}},this.replaceFilter=(e,t)=>{const r=this.props.filter,n=r.filters.map(a=>{if(a===e){const g=s.filterIdMap.get(e);return g&&s.filterIdMap.set(t,g),t}return a});return{...r,filters:n}},this.onChange=e=>{const r={nextFilter:this.replaceFilter(e.prevFilter,e.nextFilter),prevFilter:this.props.filter,syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:this};this.props.onChange.call(void 0,r)},this.onRemove=e=>{const t=this.props.filter,r=t.filters.filter(a=>a!==e.filter),n={nextFilter:{...t,filters:r},prevFilter:t,syntheticEvent:e.syntheticEvent,nativeEvent:e.nativeEvent,target:this};this.props.onChange.call(void 0,n)}}render(){const e=h.provideLocalizationService(this),{fields:t,filter:r,ariaLabel:n=e.toLanguageString(i.filterGroupAriaLabel,i.messages[i.filterGroupAriaLabel])}=this.props;return o.createElement(o.Fragment,null,o.createElement("div",{className:"k-filter-toolbar"},o.createElement(c.Toolbar,{role:"toolbar",ariaLabel:n},o.createElement(c.ButtonGroup,{className:"k-toolbar-button-group"},o.createElement(c.Button,{togglable:!0,onClick:this.onLogicAnd,selected:r.logic==="and",type:"button"},e.toLanguageString(i.filterAndLogic,i.messages[i.filterAndLogic])),o.createElement(c.Button,{togglable:!0,onClick:this.onLogicOr,selected:r.logic==="or",type:"button"},e.toLanguageString(i.filterOrLogic,i.messages[i.filterOrLogic]))),o.createElement(c.Button,{className:"k-toolbar-button",title:e.toLanguageString(i.filterAddExpression,i.messages[i.filterAddExpression]),icon:"filter-add-expression",svgIcon:d.filterAddExpressionIcon,type:"button",onClick:this.onAddExpression},e.toLanguageString(i.filterAddExpression,i.messages[i.filterAddExpression])),o.createElement(c.Button,{className:"k-toolbar-button",title:e.toLanguageString(i.filterAddGroup,i.messages[i.filterAddGroup]),icon:"filter-add-group",svgIcon:d.filterAddGroupIcon,type:"button",onClick:this.onAddGroup},e.toLanguageString(i.filterAddGroup,i.messages[i.filterAddGroup])),o.createElement(c.Button,{className:"k-toolbar-button",title:e.toLanguageString(i.filterClose,i.messages[i.filterClose]),"aria-label":e.toLanguageString(i.filterGroupClose,i.messages[i.filterGroupClose]),icon:"x",svgIcon:d.xIcon,fillMode:"flat",type:"button",onClick:this.onGroupRemove}))),r.filters.length>0&&o.createElement("ul",{role:"group",className:"k-filter-lines"},r.filters.map((a,g)=>o.createElement("li",{role:"treeitem",key:this.getFilterKey(a,g),className:"k-filter-item"},f.isCompositeFilterDescriptor(a)?o.createElement(s,{filter:a,fields:t,onChange:this.onChange,onRemove:this.onRemove,defaultGroupFilter:this.props.defaultGroupFilter,ariaLabel:this.props.ariaLabel,ariaLabelExpression:this.props.ariaLabelExpression}):o.createElement(m.Expression,{filter:a,fields:t,ariaLabel:this.props.ariaLabelExpression,onChange:this.onChange,onRemove:this.onRemove})))))}};s.propTypes={filter:l.object.isRequired,fields:l.array.isRequired,ariaLabel:l.string,ariaLabelExpression:l.string,onChange:l.func.isRequired,onRemove:l.func.isRequired,defaultGroupFilter:l.object.isRequired},s.filterIdCounter=0,s.filterIdMap=new WeakMap;let u=s;h.registerForLocalization(u);exports.Group=u;
package/filter/Group.mjs CHANGED
@@ -9,12 +9,12 @@
9
9
  import * as r from "react";
10
10
  import l from "prop-types";
11
11
  import { isCompositeFilterDescriptor as d } from "@progress/kendo-data-query";
12
- import { Toolbar as b, ButtonGroup as L, Button as p } from "@progress/kendo-react-buttons";
13
- import { provideLocalizationService as F, registerForLocalization as C } from "@progress/kendo-react-intl";
14
- import { filterAddExpressionIcon as x, filterAddGroupIcon as y, xIcon as I } from "@progress/kendo-svg-icons";
15
- import { Expression as R } from "./Expression.mjs";
16
- import { stringOperator as k } from "./operators.mjs";
17
- import { filterGroupAriaLabel as u, messages as a, filterAndLogic as m, filterOrLogic as v, filterAddExpression as g, filterAddGroup as h, filterClose as E } from "../messages/index.mjs";
12
+ import { Toolbar as L, ButtonGroup as C, Button as p } from "@progress/kendo-react-buttons";
13
+ import { provideLocalizationService as F, registerForLocalization as x } from "@progress/kendo-react-intl";
14
+ import { filterAddExpressionIcon as y, filterAddGroupIcon as I, xIcon as R } from "@progress/kendo-svg-icons";
15
+ import { Expression as k } from "./Expression.mjs";
16
+ import { stringOperator as A } from "./operators.mjs";
17
+ import { filterGroupAriaLabel as u, messages as a, filterAndLogic as m, filterOrLogic as v, filterAddExpression as g, filterAddGroup as h, filterGroupClose as E, filterClose as b } from "../messages/index.mjs";
18
18
  const n = class n extends r.Component {
19
19
  constructor() {
20
20
  super(...arguments), this.getFilterKey = (t, e) => {
@@ -30,7 +30,7 @@ const n = class n extends r.Component {
30
30
  this.props.onRemove.call(void 0, e);
31
31
  }, this.onAddExpression = (t) => {
32
32
  const e = this.props.filter, i = this.props.fields[0], o = { field: i.name, operator: i.operators[0].operator };
33
- o.value = k(o.operator) ? "" : null;
33
+ o.value = A(o.operator) ? "" : null;
34
34
  const s = {
35
35
  nextFilter: {
36
36
  ...e,
@@ -98,7 +98,7 @@ const n = class n extends r.Component {
98
98
  filter: i,
99
99
  ariaLabel: o = t.toLanguageString(u, a[u])
100
100
  } = this.props;
101
- return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("div", { className: "k-filter-toolbar" }, /* @__PURE__ */ r.createElement(b, { role: "toolbar", ariaLabel: o }, /* @__PURE__ */ r.createElement(L, { className: "k-toolbar-button-group" }, /* @__PURE__ */ r.createElement(
101
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("div", { className: "k-filter-toolbar" }, /* @__PURE__ */ r.createElement(L, { role: "toolbar", ariaLabel: o }, /* @__PURE__ */ r.createElement(C, { className: "k-toolbar-button-group" }, /* @__PURE__ */ r.createElement(
102
102
  p,
103
103
  {
104
104
  togglable: !0,
@@ -122,7 +122,7 @@ const n = class n extends r.Component {
122
122
  className: "k-toolbar-button",
123
123
  title: t.toLanguageString(g, a[g]),
124
124
  icon: "filter-add-expression",
125
- svgIcon: x,
125
+ svgIcon: y,
126
126
  type: "button",
127
127
  onClick: this.onAddExpression
128
128
  },
@@ -133,7 +133,7 @@ const n = class n extends r.Component {
133
133
  className: "k-toolbar-button",
134
134
  title: t.toLanguageString(h, a[h]),
135
135
  icon: "filter-add-group",
136
- svgIcon: y,
136
+ svgIcon: I,
137
137
  type: "button",
138
138
  onClick: this.onAddGroup
139
139
  },
@@ -142,9 +142,10 @@ const n = class n extends r.Component {
142
142
  p,
143
143
  {
144
144
  className: "k-toolbar-button",
145
- title: t.toLanguageString(E, a[E]),
145
+ title: t.toLanguageString(b, a[b]),
146
+ "aria-label": t.toLanguageString(E, a[E]),
146
147
  icon: "x",
147
- svgIcon: I,
148
+ svgIcon: R,
148
149
  fillMode: "flat",
149
150
  type: "button",
150
151
  onClick: this.onGroupRemove
@@ -153,7 +154,6 @@ const n = class n extends r.Component {
153
154
  "li",
154
155
  {
155
156
  role: "treeitem",
156
- "aria-selected": !1,
157
157
  key: this.getFilterKey(s, c),
158
158
  className: "k-filter-item"
159
159
  },
@@ -169,7 +169,7 @@ const n = class n extends r.Component {
169
169
  ariaLabelExpression: this.props.ariaLabelExpression
170
170
  }
171
171
  ) : /* @__PURE__ */ r.createElement(
172
- R,
172
+ k,
173
173
  {
174
174
  filter: s,
175
175
  fields: e,
@@ -191,7 +191,7 @@ n.propTypes = {
191
191
  defaultGroupFilter: l.object.isRequired
192
192
  }, n.filterIdCounter = 0, n.filterIdMap = /* @__PURE__ */ new WeakMap();
193
193
  let f = n;
194
- C(f);
194
+ x(f);
195
195
  export {
196
196
  f as Group
197
197
  };
@@ -42,6 +42,13 @@ export interface HeaderThElementProps extends React.ThHTMLAttributes<HTMLTableCe
42
42
  * This property is related to accessibility.
43
43
  */
44
44
  ariaDescription?: string;
45
+ /**
46
+ * Indicates the type of popup triggered by the element.
47
+ *
48
+ * @remarks
49
+ * This property is related to accessibility.
50
+ */
51
+ ariaHasPopup?: 'dialog' | 'menu' | 'listbox' | 'tree' | 'grid' | boolean;
45
52
  /** Number of columns the cell spans */
46
53
  colSpan?: number;
47
54
  /** Number of rows the cell spans */
@@ -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"),g=require("../navigation/hooks.js"),p=require("@progress/kendo-react-common");function S(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const i=S(m),c=e=>{const{ariaSort:a,colSpan:t,rowSpan:r,columnId:l,navigatable:n,ariaColumnIndex:s,ariaLabel:u,ariaSelected:d,ariaDescription:h,...b}=e,f=g.useTableKeyboardNavigation(l,n),o=i.useRef(null);return i.useEffect(()=>{o.current&&n&&p.disableNavigatableContainer(o.current)},[n]),i.createElement("th",{ref:o,"aria-sort":a,"aria-label":u,"aria-colindex":s,"aria-selected":d,colSpan:t,rowSpan:r,...f,...b},e.children)};c.displayName="KendoReactHeaderThElement";exports.HeaderThElement=c;
9
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react"),g=require("../navigation/hooks.js"),h=require("@progress/kendo-react-common");function S(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(a,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return a.default=e,Object.freeze(a)}const i=S(p),c=e=>{const{ariaSort:a,colSpan:t,rowSpan:r,columnId:l,navigatable:n,ariaColumnIndex:s,ariaLabel:u,ariaSelected:d,ariaDescription:v,ariaHasPopup:b,...f}=e,m=g.useTableKeyboardNavigation(l,n),o=i.useRef(null);return i.useEffect(()=>{o.current&&n&&h.disableNavigatableContainer(o.current)},[n]),i.createElement("th",{ref:o,"aria-sort":a,"aria-label":u,"aria-colindex":s,"aria-selected":d,"aria-haspopup":b||void 0,colSpan:t,rowSpan:r,...m,...f},e.children)};c.displayName="KendoReactHeaderThElement";exports.HeaderThElement=c;