@ostack.tech/ui 0.15.3 → 0.15.5

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ostack.tech/ui",
3
3
  "description": "ostack/UI component library.",
4
- "version": "0.15.3",
4
+ "version": "0.15.5",
5
5
  "homepage": "https://ui.ostack.tech/",
6
6
  "author": {
7
7
  "name": "Opensoft",
@@ -44,9 +44,9 @@
44
44
  "dependencies": {
45
45
  "@daypicker/react": "^10.0.1",
46
46
  "@fortawesome/react-fontawesome": "^3.3.1",
47
- "@tanstack/react-virtual": "^3.14.2",
47
+ "@tanstack/react-virtual": "^3.14.3",
48
48
  "from-exponential": "^1.1.1",
49
- "radix-ui": "^1.4.3",
49
+ "radix-ui": "^1.6.0",
50
50
  "react-error-boundary": "^6.1.2",
51
51
  "react-number-format": "^5.4.5",
52
52
  "react-to-print": "^3.3.0",
@@ -14,8 +14,8 @@ export interface DataTableColumn<T = unknown, TValue = any> extends Omit<Compone
14
14
  /**
15
15
  * Locale of the formatted value.
16
16
  *
17
- * Used to perform locale-specific transformations (`toLocaleLowerCase`) on
18
- * the formatted value when filtering.
17
+ * Used when sorting and filtering when a custom `compare`/`match` is not
18
+ * provided.
19
19
  */
20
20
  locale?: string;
21
21
  /** Sub columns of this column. */
@@ -42,6 +42,13 @@ export interface DataTableColumn<T = unknown, TValue = any> extends Omit<Compone
42
42
  * objects, their string representation is used in the comparison.
43
43
  */
44
44
  compare?: (value1: TValue, value2: TValue) => number;
45
+ /**
46
+ * Match function used when filtering values of this column. Should return
47
+ * `null` if the value does not match.
48
+ */
49
+ match?: (value: string, filter: string) => MatchAgainstFilter | null;
50
+ /** Options used when sorting when a custom `compare` is not provided. */
51
+ sortOptions?: DataTableColumnSortOptions;
45
52
  /** Optional footer content to be rendered in the table foot. */
46
53
  footer?: ReactNode | ((footerData: DataTableColumnFooterData<T>) => ReactNode);
47
54
  /** Properties to pass to the column table foot cell. */
@@ -79,3 +86,5 @@ export interface DataTableColumnFooterData<T> {
79
86
  /** Total number of rows. */
80
87
  totalCount?: number;
81
88
  }
89
+ /** Options used when sorting when a custom `compare` is not provided. */
90
+ export type DataTableColumnSortOptions = Omit<Intl.CollatorOptions, "usage">;
@@ -55,6 +55,7 @@ export interface DataTableState<T = any> {
55
55
  scrolledRangeEnd: number;
56
56
  tableHeadHeight?: number;
57
57
  tableFootHeight?: number;
58
+ locale: string;
58
59
  actions: DataTableActions<T>;
59
60
  }
60
61
  /** Actions of the data table. */
@@ -1,10 +1,10 @@
1
1
  import { type SortDirection } from "../../utils/sorting.ts";
2
2
  import type { DataTableColumns } from "./DataTableColumn.tsx";
3
3
  /** Filters the provided rows. */
4
- export declare function filterRows<T>(leafColumns: DataTableColumns<T>, rows: T[], filter: string): T[];
5
- export declare function filterRows<T>(leafColumns: DataTableColumns<T>, rows: undefined, filter: string): undefined;
6
- export declare function filterRows<T>(leafColumns: DataTableColumns<T>, rows: T[] | undefined, filter: string): T[] | undefined;
4
+ export declare function filterRows<T>(leafColumns: DataTableColumns<T>, rows: T[], filter: string, locale?: Intl.LocalesArgument): T[];
5
+ export declare function filterRows<T>(leafColumns: DataTableColumns<T>, rows: undefined, filter: string, locale?: Intl.LocalesArgument): undefined;
6
+ export declare function filterRows<T>(leafColumns: DataTableColumns<T>, rows: T[] | undefined, filter: string, locale?: Intl.LocalesArgument): T[] | undefined;
7
7
  /** Sorts the provided rows. */
8
- export declare function sortRows<T>(leafColumns: DataTableColumns<T>, rows: T[], sortBy: string | null, sortDirection: SortDirection | null): T[];
9
- export declare function sortRows<T>(leafColumns: DataTableColumns<T>, rows: undefined, sortBy: string | null, sortDirection: SortDirection | null): undefined;
10
- export declare function sortRows<T>(leafColumns: DataTableColumns<T>, rows: T[] | undefined, sortBy: string | null, sortDirection: SortDirection | null): T[] | undefined;
8
+ export declare function sortRows<T>(leafColumns: DataTableColumns<T>, rows: T[], sortBy: string | null, sortDirection: SortDirection | null, locale?: Intl.LocalesArgument): T[];
9
+ export declare function sortRows<T>(leafColumns: DataTableColumns<T>, rows: undefined, sortBy: string | null, sortDirection: SortDirection | null, locale?: Intl.LocalesArgument): undefined;
10
+ export declare function sortRows<T>(leafColumns: DataTableColumns<T>, rows: T[] | undefined, sortBy: string | null, sortDirection: SortDirection | null, locale?: Intl.LocalesArgument): T[] | undefined;
@@ -1,7 +1,8 @@
1
- import { Slot as SlotPrimitive } from "radix-ui";
2
1
  /**
3
2
  * Component that merges its props onto its immediate child.
4
3
  *
5
4
  * Used to support components with an `asChild` property.
6
5
  */
7
- export declare const Slot: import("react").ForwardRefExoticComponent<SlotPrimitive.SlotProps & import("react").RefAttributes<HTMLElement>>;
6
+ export declare const Slot: import("react").ForwardRefExoticComponent<import("react").HTMLAttributes<HTMLElement> & {
7
+ children?: React.ReactNode;
8
+ } & import("react").RefAttributes<HTMLElement>>;
@@ -11,4 +11,4 @@ export interface MatchAgainstFilter {
11
11
  * Matches a string value against a filter and returns the match or `null` when
12
12
  * the value doesn't match.
13
13
  */
14
- export declare function matchAgainstFilter(value: string, filter: string, locale: string): MatchAgainstFilter | null;
14
+ export declare function matchAgainstFilter(value: string, filter: string, locale?: Intl.LocalesArgument): MatchAgainstFilter | null;
@@ -1,9 +1,9 @@
1
1
  /** Sort direction (ascending or descending). */
2
2
  export type SortDirection = "asc" | "desc";
3
3
  /** Stable sort implementation. */
4
- export declare function stableSort<T>(array: T[], comparator?: (v1: T, v2: T, i1: number, i2: number) => number, sortDirection?: SortDirection): T[];
4
+ export declare function stableSort<T>(array: T[], comparator: (v1: T, v2: T, i1: number, i2: number) => number, sortDirection?: SortDirection): T[];
5
5
  /**
6
6
  * Comparison function allowing comparison of values of multiple types,
7
7
  * including all primitive types, as well as dates.
8
8
  */
9
- export declare function compare<T>(v1: T, v2: T): number;
9
+ export declare function compare<T>(v1: T, v2: T, locale?: Intl.LocalesArgument, options?: Intl.CollatorOptions): number;