@progress/kendo-react-data-tools
Version:
Includes React Pager & React Filter component, an intuitive interface to create complex filter descriptions. KendoReact Data Tools package
64 lines (63 loc) • 1.8 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
"use client";
import * as n from "react";
import e from "prop-types";
import { DropDownList as d } from "@progress/kendo-react-dropdowns";
import { provideLocalizationService as f, registerForLocalization as h } from "@progress/kendo-react-intl";
import { filterEnumFilterDropdownAriaLabel as s, messages as l } from "../../messages/index.mjs";
const o = class o extends n.Component {
constructor() {
super(...arguments), this.onChange = (a) => {
this.props.onFilterChange.call(void 0, {
nextFilter: { ...this.props.filter, value: a.value.value }
});
};
}
/**
* @hidden
*/
render() {
const a = f(this), {
filter: p,
data: c = [],
defaultItem: u,
ariaLabel: g = a.toLanguageString(
s,
l[s]
)
} = this.props, i = c.map((t) => ({
...t,
text: a.toLanguageString(t.text, l[t.text] || t.text)
}));
return /* @__PURE__ */ n.createElement(
d,
{
value: i.find((t) => t.value === p.value) || null,
onChange: this.onChange,
defaultItem: u,
data: i,
textField: "text",
ariaLabel: g,
tabIndex: -1
}
);
}
};
o.propTypes = {
filter: e.object.isRequired,
onFilterChange: e.func.isRequired,
data: e.arrayOf(e.shape({ text: e.string, value: e.any })),
defaultItem: e.any,
ariaLabel: e.string
};
let r = o;
h(r);
export {
r as EnumFilter
};