@ostack.tech/ui 0.15.4 → 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/dist/ostack-ui.js +110 -93
- package/dist/ostack-ui.js.map +1 -1
- package/package.json +1 -1
- package/types/components/DataTable/DataTableColumn.d.ts +11 -2
- package/types/components/DataTable/DataTableContext.d.ts +1 -0
- package/types/components/DataTable/processRows.d.ts +6 -6
- package/types/utils/filtering.d.ts +1 -1
- package/types/utils/sorting.d.ts +2 -2
package/package.json
CHANGED
|
@@ -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
|
|
18
|
-
*
|
|
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">;
|
|
@@ -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;
|
|
@@ -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
|
|
14
|
+
export declare function matchAgainstFilter(value: string, filter: string, locale?: Intl.LocalesArgument): MatchAgainstFilter | null;
|
package/types/utils/sorting.d.ts
CHANGED
|
@@ -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
|
|
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;
|