core/panel/ui/TableControls.tsx
Untone 82111ed0f6
All checks were successful
Deploy on push / deploy (push) Successful in 7s
Squashed new RBAC
2025-07-02 22:30:21 +03:00

59 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { JSX, Show } from 'solid-js'
import styles from '../styles/Table.module.css'
export interface TableControlsProps {
onRefresh?: () => void
isLoading?: boolean
children?: JSX.Element
actions?: JSX.Element
searchValue?: string
onSearchChange?: (value: string) => void
onSearch?: () => void
searchPlaceholder?: string
}
/**
* Компонент для унифицированного управления таблицами
* Содержит элементы управления сортировкой, фильтрацией и действиями
*/
const TableControls = (props: TableControlsProps) => {
return (
<div class={styles.tableControls}>
<div class={styles.controlsContainer}>
{/* Поиск и действия в одной строке */}
<Show when={props.onSearchChange}>
<div class={styles.searchContainer}>
<input
type="text"
placeholder={props.searchPlaceholder}
value={props.searchValue || ''}
onInput={(e) => props.onSearchChange?.(e.currentTarget.value)}
onKeyDown={(e) => {
if (e.key === 'Enter' && props.onSearch) {
props.onSearch()
}
}}
class={styles.searchInput}
/>
<Show when={props.onSearch}>
<button class={styles.searchButton} onClick={props.onSearch}>
Поиск
</button>
</Show>
</div>
</Show>
{/* Действия справа от поиска */}
<Show when={props.actions}>
<div class={styles.controlsRight}>{props.actions}</div>
</Show>
{/* Дополнительные элементы управления */}
{props.children}
</div>
</div>
)
}
export default TableControls