/* eslint-disable @typescript-eslint/no-explicit-any */ import FactoryRenderer from "../../../../Renderer"; export type GlobalSearchViewProps = { disabled: boolean; value: string | undefined; onSearchChange: (searchKey: string | undefined) => void; onClearSearch: () => void; onSearch: () => void; }; /* * `InputSeparator` and `InputClearValue` (@progress/kendo-react-inputs) are * plain elements with a fixed class - there is no widget equivalent and * none should exist. They are inlined below so this file carries no Kendo * import, with the exact classes the Kendo components emit: * * InputSeparator -> classNames("k-input-separator", className, * `k-input-separator-${orientation}`) * with orientation defaulting to "vertical" * => "k-input-separator k-input-separator-vertical" * * InputClearValue -> classNames(uInput.clearButton({ c }), className) where * uInput.clearButton resolves to * `${base.prefix}-${base.clear}-${base.value}` * = "k" + "-" + "clear" + "-" + "value" * => "k-clear-value" * (evaluated against the installed * @progress/kendo-react-common/unstyled/inputs.js) */ const INPUT_SEPARATOR_CLASS = "k-input-separator k-input-separator-vertical"; const INPUT_CLEAR_VALUE_CLASS = "k-clear-value"; const GlobalSearchView = (props: GlobalSearchViewProps) => { return ( ; the class is repeated on the inner `.k-input` wrapper * (widgetStyle) so the field's own rules — height, inset, type — land on * the element Kendo draws the box on. The type is `$font-size-sm`, from * `.tmpl-grid-toolbar-container .tmpl-global-search` in the SCSS. It used * to be an inline `fontSize: "12px"` here, beside a `qo-font-md` (13px) * class that Kendo's `.k-input` out-ordered — the class said one size and * the inline style drew another, and neither could be restyled. */ rootStyle={{ className: "tmpl-global-search" }} widgetStyle={{ className: "tmpl-global-search tmpl-input" }} onKeyUp={(_callBack: any, _screenDataField: any, event: any) => { if (event?.key === "Enter" || event?.code === "Enter") { props.onSearch(); } }} onChange={(_callBack: any, _screenDataField: any, value: any) => { props.onSearchChange(value as string); }} suffix={() => props.value ? ( <> ) : ( <> ) } prefix={() => ( <> )} /> ); }; export default GlobalSearchView;