simple-table-core 0.8.33 → 0.8.35

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.
Files changed (37) hide show
  1. package/dist/components/date-picker/DatePicker.d.ts +2 -3
  2. package/dist/components/dropdown/Dropdown.d.ts +3 -1
  3. package/dist/components/filters/BooleanFilter.d.ts +11 -0
  4. package/dist/components/filters/DateFilter.d.ts +11 -0
  5. package/dist/components/filters/EnumFilter.d.ts +11 -0
  6. package/dist/components/filters/FilterBar.d.ts +2 -0
  7. package/dist/components/filters/FilterDropdown.d.ts +11 -0
  8. package/dist/components/filters/NumberFilter.d.ts +11 -0
  9. package/dist/components/filters/StringFilter.d.ts +11 -0
  10. package/dist/components/filters/shared/CustomSelect.d.ts +14 -0
  11. package/dist/components/filters/shared/FilterActions.d.ts +9 -0
  12. package/dist/components/filters/shared/FilterContainer.d.ts +6 -0
  13. package/dist/components/filters/shared/FilterInput.d.ts +11 -0
  14. package/dist/components/filters/shared/FilterSection.d.ts +7 -0
  15. package/dist/components/filters/shared/FilterSelect.d.ts +11 -0
  16. package/dist/components/filters/shared/OperatorSelector.d.ts +8 -0
  17. package/dist/components/simple-table/editable-cells/DateDropdownEdit.d.ts +3 -3
  18. package/dist/components/simple-table/editable-cells/EditableCell.d.ts +2 -1
  19. package/dist/components/simple-table/editable-cells/EnumDropdownEdit.d.ts +3 -3
  20. package/dist/context/TableContext.d.ts +5 -0
  21. package/dist/hooks/useContentHeight.d.ts +6 -0
  22. package/dist/hooks/useHandleOutsideClick.d.ts +8 -0
  23. package/dist/hooks/useTableFilters.d.ts +14 -0
  24. package/dist/hooks/useWindowResize.d.ts +7 -0
  25. package/dist/icons/CheckIcon.d.ts +6 -0
  26. package/dist/icons/FilterIcon.d.ts +6 -0
  27. package/dist/icons/SelectIcon.d.ts +2 -0
  28. package/dist/index.d.ts +2 -1
  29. package/dist/index.es.js +1 -1
  30. package/dist/index.js +1 -1
  31. package/dist/styles.css +1 -1
  32. package/dist/types/EnumOption.d.ts +5 -0
  33. package/dist/types/FilterTypes.d.ts +21 -0
  34. package/dist/types/HeaderObject.d.ts +3 -1
  35. package/dist/utils/filterUtils.d.ts +5 -0
  36. package/package.json +1 -1
  37. package/dist/components/Animate.d.ts +0 -10
@@ -1,8 +1,7 @@
1
- import React from "react";
2
1
  interface DatePickerProps {
3
- value: Date;
4
2
  onChange: (date: Date) => void;
5
3
  onClose?: () => void;
4
+ value: Date;
6
5
  }
7
- declare const DatePicker: React.FC<DatePickerProps>;
6
+ declare const DatePicker: ({ onChange, onClose, value }: DatePickerProps) => import("react/jsx-runtime").JSX.Element;
8
7
  export default DatePicker;
@@ -1,11 +1,13 @@
1
1
  import React, { ReactNode } from "react";
2
2
  export interface DropdownProps {
3
3
  children: ReactNode;
4
+ containerRef?: React.RefObject<HTMLElement>;
4
5
  onClose: () => void;
5
6
  open?: boolean;
7
+ overflow?: "auto" | "visible";
6
8
  setOpen: (open: boolean) => void;
7
9
  width?: number;
8
- containerRef?: React.RefObject<HTMLElement>;
10
+ positioning?: "fixed" | "absolute";
9
11
  }
10
12
  declare const Dropdown: React.FC<DropdownProps>;
11
13
  export default Dropdown;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import HeaderObject from "../../types/HeaderObject";
3
+ import { FilterCondition } from "../../types/FilterTypes";
4
+ interface BooleanFilterProps {
5
+ header: HeaderObject;
6
+ currentFilter?: FilterCondition;
7
+ onApplyFilter: (filter: FilterCondition) => void;
8
+ onClearFilter: () => void;
9
+ }
10
+ declare const BooleanFilter: React.FC<BooleanFilterProps>;
11
+ export default BooleanFilter;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import HeaderObject from "../../types/HeaderObject";
3
+ import { FilterCondition } from "../../types/FilterTypes";
4
+ interface DateFilterProps {
5
+ header: HeaderObject;
6
+ currentFilter?: FilterCondition;
7
+ onApplyFilter: (filter: FilterCondition) => void;
8
+ onClearFilter: () => void;
9
+ }
10
+ declare const DateFilter: React.FC<DateFilterProps>;
11
+ export default DateFilter;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import HeaderObject from "../../types/HeaderObject";
3
+ import { FilterCondition } from "../../types/FilterTypes";
4
+ interface EnumFilterProps {
5
+ header: HeaderObject;
6
+ currentFilter?: FilterCondition;
7
+ onApplyFilter: (filter: FilterCondition) => void;
8
+ onClearFilter: () => void;
9
+ }
10
+ declare const EnumFilter: React.FC<EnumFilterProps>;
11
+ export default EnumFilter;
@@ -0,0 +1,2 @@
1
+ declare const FilterBar: () => import("react/jsx-runtime").JSX.Element | null;
2
+ export default FilterBar;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import HeaderObject from "../../types/HeaderObject";
3
+ import { FilterCondition } from "../../types/FilterTypes";
4
+ interface FilterDropdownProps {
5
+ header: HeaderObject;
6
+ currentFilter?: FilterCondition;
7
+ onApplyFilter: (filter: FilterCondition) => void;
8
+ onClearFilter: () => void;
9
+ }
10
+ declare const FilterDropdown: React.FC<FilterDropdownProps>;
11
+ export default FilterDropdown;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import HeaderObject from "../../types/HeaderObject";
3
+ import { FilterCondition } from "../../types/FilterTypes";
4
+ interface NumberFilterProps {
5
+ header: HeaderObject;
6
+ currentFilter?: FilterCondition;
7
+ onApplyFilter: (filter: FilterCondition) => void;
8
+ onClearFilter: () => void;
9
+ }
10
+ declare const NumberFilter: React.FC<NumberFilterProps>;
11
+ export default NumberFilter;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import HeaderObject from "../../types/HeaderObject";
3
+ import { FilterCondition } from "../../types/FilterTypes";
4
+ interface StringFilterProps {
5
+ header: HeaderObject;
6
+ currentFilter?: FilterCondition;
7
+ onApplyFilter: (filter: FilterCondition) => void;
8
+ onClearFilter: () => void;
9
+ }
10
+ declare const StringFilter: React.FC<StringFilterProps>;
11
+ export default StringFilter;
@@ -0,0 +1,14 @@
1
+ export interface CustomSelectOption {
2
+ value: string;
3
+ label: string;
4
+ }
5
+ interface CustomSelectProps {
6
+ value: string;
7
+ onChange: (value: string) => void;
8
+ options: CustomSelectOption[];
9
+ placeholder?: string;
10
+ className?: string;
11
+ disabled?: boolean;
12
+ }
13
+ declare const CustomSelect: ({ value, onChange, options, placeholder, className, disabled, }: CustomSelectProps) => import("react/jsx-runtime").JSX.Element;
14
+ export default CustomSelect;
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ interface FilterActionsProps {
3
+ onApply: () => void;
4
+ onClear?: () => void;
5
+ canApply: boolean;
6
+ showClear: boolean;
7
+ }
8
+ declare const FilterActions: React.FC<FilterActionsProps>;
9
+ export default FilterActions;
@@ -0,0 +1,6 @@
1
+ import React, { ReactNode } from "react";
2
+ interface FilterContainerProps {
3
+ children: ReactNode;
4
+ }
5
+ declare const FilterContainer: React.FC<FilterContainerProps>;
6
+ export default FilterContainer;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ interface FilterInputProps {
3
+ type?: "text" | "number" | "date";
4
+ value: string;
5
+ onChange: (value: string) => void;
6
+ placeholder?: string;
7
+ autoFocus?: boolean;
8
+ className?: string;
9
+ }
10
+ declare const FilterInput: React.FC<FilterInputProps>;
11
+ export default FilterInput;
@@ -0,0 +1,7 @@
1
+ import React, { ReactNode } from "react";
2
+ interface FilterSectionProps {
3
+ children: ReactNode;
4
+ className?: string;
5
+ }
6
+ declare const FilterSection: React.FC<FilterSectionProps>;
7
+ export default FilterSection;
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { CustomSelectOption } from "./CustomSelect";
3
+ interface FilterSelectProps {
4
+ value: string;
5
+ onChange: (value: string) => void;
6
+ options: CustomSelectOption[];
7
+ className?: string;
8
+ placeholder?: string;
9
+ }
10
+ declare const FilterSelect: React.FC<FilterSelectProps>;
11
+ export default FilterSelect;
@@ -0,0 +1,8 @@
1
+ import { FilterOperator } from "../../../types/FilterTypes";
2
+ interface OperatorSelectorProps<T extends FilterOperator> {
3
+ value: T;
4
+ onChange: (operator: T) => void;
5
+ operators: readonly T[];
6
+ }
7
+ declare const OperatorSelector: <T extends FilterOperator>({ value, onChange, operators, }: OperatorSelectorProps<T>) => import("react/jsx-runtime").JSX.Element;
8
+ export default OperatorSelector;
@@ -1,10 +1,10 @@
1
- import React from "react";
1
+ import CellValue from "../../../types/CellValue";
2
2
  interface DateDropdownEditProps {
3
3
  onBlur: () => void;
4
4
  onChange: (value: string) => void;
5
5
  open: boolean;
6
6
  setOpen: (open: boolean) => void;
7
- value: string;
7
+ value: CellValue;
8
8
  }
9
- declare const DateDropdownEdit: React.FC<DateDropdownEditProps>;
9
+ declare const DateDropdownEdit: ({ onBlur, onChange, open, setOpen, value }: DateDropdownEditProps) => import("react/jsx-runtime").JSX.Element;
10
10
  export default DateDropdownEdit;
@@ -1,6 +1,7 @@
1
1
  import CellValue from "../../../types/CellValue";
2
+ import EnumOption from "../../../types/EnumOption";
2
3
  interface EditableCellProps {
3
- enumOptions?: string[];
4
+ enumOptions?: EnumOption[];
4
5
  onChange: (newValue: CellValue) => void;
5
6
  setIsEditing: (isEditing: boolean) => void;
6
7
  type?: "string" | "number" | "boolean" | "date" | "enum";
@@ -1,11 +1,11 @@
1
- import React from "react";
1
+ import EnumOption from "../../../types/EnumOption";
2
2
  interface EnumDropdownEditProps {
3
3
  onBlur: () => void;
4
4
  onChange: (value: string) => void;
5
5
  open: boolean;
6
- options: string[];
6
+ options: EnumOption[];
7
7
  setOpen: (open: boolean) => void;
8
8
  value: string;
9
9
  }
10
- declare const EnumDropdownEdit: React.FC<EnumDropdownEditProps>;
10
+ declare const EnumDropdownEdit: ({ onBlur, onChange, open, options, setOpen, value, }: EnumDropdownEditProps) => import("react/jsx-runtime").JSX.Element;
11
11
  export default EnumDropdownEdit;
@@ -4,6 +4,7 @@ import OnSortProps from "../types/OnSortProps";
4
4
  import Cell from "../types/Cell";
5
5
  import CellValue from "../types/CellValue";
6
6
  import { Theme } from "..";
7
+ import { TableFilterState, FilterCondition } from "../types/FilterTypes";
7
8
  export interface CellRegistryEntry {
8
9
  updateContent: (newValue: CellValue) => void;
9
10
  }
@@ -17,8 +18,12 @@ interface TableContextType {
17
18
  draggedHeaderRef: RefObject<HeaderObject | null>;
18
19
  editColumns?: boolean;
19
20
  expandIcon?: ReactNode;
21
+ filters: TableFilterState;
20
22
  forceUpdate: () => void;
21
23
  getBorderClass: (cell: Cell) => string;
24
+ handleApplyFilter: (filter: FilterCondition) => void;
25
+ handleClearFilter: (accessor: string) => void;
26
+ handleClearAllFilters: () => void;
22
27
  handleMouseDown: (cell: Cell) => void;
23
28
  handleMouseOver: (cell: Cell) => void;
24
29
  headersRef: RefObject<HeaderObject[]>;
@@ -0,0 +1,6 @@
1
+ interface UseContentHeightProps {
2
+ height?: string;
3
+ rowHeight: number;
4
+ }
5
+ export declare const useContentHeight: ({ height, rowHeight }: UseContentHeightProps) => number;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ declare const useHandleOutsideClick: ({ selectableColumns, selectedCells, selectedColumns, setSelectedCells, setSelectedColumns, }: {
2
+ selectableColumns: boolean;
3
+ selectedCells: Set<string>;
4
+ selectedColumns: Set<number>;
5
+ setSelectedCells: (cells: Set<string>) => void;
6
+ setSelectedColumns: (columns: Set<number>) => void;
7
+ }) => void;
8
+ export default useHandleOutsideClick;
@@ -0,0 +1,14 @@
1
+ import { TableFilterState, FilterCondition } from "../types/FilterTypes";
2
+ import Row from "../types/Row";
3
+ interface UseTableFiltersProps {
4
+ rows: Row[];
5
+ }
6
+ interface UseTableFiltersReturn {
7
+ filters: TableFilterState;
8
+ filteredRows: Row[];
9
+ handleApplyFilter: (filter: FilterCondition) => void;
10
+ handleClearFilter: (accessor: string) => void;
11
+ handleClearAllFilters: () => void;
12
+ }
13
+ export declare const useTableFilters: ({ rows }: UseTableFiltersProps) => UseTableFiltersReturn;
14
+ export {};
@@ -0,0 +1,7 @@
1
+ import { RefObject } from "react";
2
+ declare const useWindowResize: ({ forceUpdate, tableBodyContainerRef, setScrollbarWidth, }: {
3
+ forceUpdate: () => void;
4
+ tableBodyContainerRef: RefObject<HTMLDivElement | null>;
5
+ setScrollbarWidth: (width: number) => void;
6
+ }) => void;
7
+ export default useWindowResize;
@@ -0,0 +1,6 @@
1
+ import { CSSProperties } from "react";
2
+ declare const CheckIcon: ({ className, style }: {
3
+ className?: string | undefined;
4
+ style?: CSSProperties | undefined;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default CheckIcon;
@@ -0,0 +1,6 @@
1
+ import { CSSProperties } from "react";
2
+ declare const FilterIcon: ({ className, style }: {
3
+ className?: string | undefined;
4
+ style?: CSSProperties | undefined;
5
+ }) => import("react/jsx-runtime").JSX.Element;
6
+ export default FilterIcon;
@@ -0,0 +1,2 @@
1
+ declare const SelectIcon: () => import("react/jsx-runtime").JSX.Element;
2
+ export default SelectIcon;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ import type CellChangeProps from "./types/CellChangeProps";
5
5
  import type CellValue from "./types/CellValue";
6
6
  import type ColumnEditorPosition from "./types/ColumnEditorPosition";
7
7
  import type DragHandlerProps from "./types/DragHandlerProps";
8
+ import EnumOption from "./types/EnumOption";
8
9
  import type HeaderObject from "./types/HeaderObject";
9
10
  import type OnSortProps from "./types/OnSortProps";
10
11
  import type Row from "./types/Row";
@@ -17,4 +18,4 @@ import type TableRowProps from "./types/TableRowProps";
17
18
  import type Theme from "./types/Theme";
18
19
  import type UpdateDataProps from "./types/UpdateCellProps";
19
20
  export { SimpleTable };
20
- export type { BoundingBox, Cell, CellChangeProps, CellValue, ColumnEditorPosition, DragHandlerProps, HeaderObject, OnSortProps, Row, SharedTableProps, SortConfig, TableCellProps, TableHeaderProps, TableRefType, TableRowProps, Theme, UpdateDataProps, };
21
+ export type { BoundingBox, Cell, CellChangeProps, CellValue, ColumnEditorPosition, DragHandlerProps, EnumOption, HeaderObject, OnSortProps, Row, SharedTableProps, SortConfig, TableCellProps, TableHeaderProps, TableRefType, TableRowProps, Theme, UpdateDataProps, };