@dloizides/ui-tables 3.0.1 → 3.1.0
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/CHANGELOG.md +46 -0
- package/README.md +15 -0
- package/dist/index.d.mts +122 -4
- package/dist/index.d.ts +122 -4
- package/dist/index.js +381 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +360 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- `ReportFilters`: report filter preset over `Filters` (scope select, date range, multi status, currency) with typed values, URL query helpers (`reportFiltersFromQuery` / `reportFiltersToQuery` / `reportFiltersToSearch`), an inverted-range error that withholds `onChange`, and a compact mode below 768 px: one Filters button opening a `FilterSidePanel`.
|
|
8
|
+
- `ExportCsvAction`: an Export CSV button over `toCsv` from `@dloizides/utils` with a Blob download, the shared `Button` loading state, and `csvFilename` / `runCsvExport` helpers.
|
|
9
|
+
- `Filters`: a `multiSelect` field kind and an `error` on `dateRange` fields.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- `DataTable` / `StatusLedger`: a clickable row (`onRowPress`, no `keyboardNavigation`) renders as a focusable `div` with `role="group"` instead of a native `<button>`, so an Edit or Delete button in a cell is no longer a button inside a button. The row keeps its pointer cursor, hover and pressed tint, focus ring and Enter to open; Space no longer opens it (Space belongs to button roles). Pressing a button inside the row calls only that button. ROW-OPEN-1 "Every list row opens its record".
|
|
14
|
+
|
|
15
|
+
## 3.0.1
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Peer and dev `@dloizides/ui-forms` raised to 1.31.0 (`DateInput`).
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- `Filters`: the date filter renders inside the bar `Field` (control label voice, no extra 16px rhythm), so it lines up with the other fields in the bar. FINREG-DATE-2 "Every FinReg date field uses the shared input".
|
|
24
|
+
|
|
25
|
+
## 3.0.0
|
|
26
|
+
|
|
27
|
+
### Breaking
|
|
28
|
+
|
|
29
|
+
- `StatusLedger` props require `onRowPress` or `rowAction={{ none: '<reason>' }}` (`DataTableRowAction`) and forward it to every inner `DataTable`; `StatusLedgerProps` is now a type alias over `StatusLedgerBaseProps`. ROW-OPEN-1 "Every list row opens its record".
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- `DataTable`: the brand focus ring is drawn on the focused row frame on keyboard focus (it was on the inner pressable of a selectable row).
|
|
34
|
+
|
|
35
|
+
## 2.0.0
|
|
36
|
+
|
|
37
|
+
### Breaking
|
|
38
|
+
|
|
39
|
+
- `DataTableProps` require `onRowPress` or `rowAction={{ none: '<reason>' }}`; a table with neither no longer type-checks. ROW-OPEN-1 "Every list row opens its record".
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
|
|
43
|
+
- Clickable rows get a pointer cursor, a pressed brand tint and a brand focus ring; the hover tint is unchanged.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- The `dateRange` filter renders `DateRangeControl` from `@dloizides/ui-forms` (same testIDs); the local `DateRangeField` is gone. Peer and dev `@dloizides/ui-forms` raised to 1.30.0. FINREG-DATE-2 "Every FinReg date field uses the shared input".
|
|
48
|
+
|
|
3
49
|
## 1.29.1
|
|
4
50
|
|
|
5
51
|
### Changed
|
package/README.md
CHANGED
|
@@ -100,6 +100,21 @@ use `@dloizides/ui-layout`'s responsive `ModalDropdown` (modal on mobile/native)
|
|
|
100
100
|
/>
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
#### Row action (required)
|
|
104
|
+
|
|
105
|
+
Every `DataTable` (and `StatusLedger`) declares what a row does: pass `onRowPress` to open the
|
|
106
|
+
record, or `rowAction={{ none: '<reason>' }}` when a row truly opens nothing. A table with
|
|
107
|
+
neither does not type-check.
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
<DataTable columns={columns} rows={rows} keyExtractor={(r) => r.id} onRowPress={(r) => open(r.id)} />
|
|
111
|
+
<DataTable columns={columns} rows={rows} keyExtractor={(r) => r.id} rowAction={{ none: 'read-only audit log' }} />
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
A clickable row has a pointer cursor, hover and pressed tint, a focus ring, and opens on click
|
|
115
|
+
or Enter. It is a focusable `role="group"` element, not a `<button>`, so buttons in its cells
|
|
116
|
+
(Edit, Delete) are valid and pressing one runs only that button.
|
|
117
|
+
|
|
103
118
|
#### Expandable rows (optional)
|
|
104
119
|
|
|
105
120
|
For surfaces that open a full-width detail panel under a row (e.g. an audit log's
|
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ import { UiTheme } from '@dloizides/ui-feedback';
|
|
|
3
3
|
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
4
4
|
import { DateRangeValue, ControlOption } from '@dloizides/ui-forms';
|
|
5
5
|
export { DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeValue, isUnmatched, suggestOptions } from '@dloizides/ui-forms';
|
|
6
|
+
import { CsvColumn } from '@dloizides/utils';
|
|
6
7
|
|
|
7
8
|
declare const enum StatTone {
|
|
8
9
|
Neutral = "neutral",
|
|
@@ -568,7 +569,7 @@ declare const TABLE_I18N: {
|
|
|
568
569
|
*/
|
|
569
570
|
|
|
570
571
|
/** The kinds of field the declarative bar can render. */
|
|
571
|
-
type FilterFieldKind = 'select' | 'text' | 'number' | 'date' | 'dateRange' | 'typeahead' | 'boolean';
|
|
572
|
+
type FilterFieldKind = 'select' | 'multiSelect' | 'text' | 'number' | 'date' | 'dateRange' | 'typeahead' | 'boolean';
|
|
572
573
|
/**
|
|
573
574
|
* A single choice for a `select` / `typeahead` field. Label is pre-localized.
|
|
574
575
|
*
|
|
@@ -580,7 +581,7 @@ type FilterFieldKind = 'select' | 'text' | 'number' | 'date' | 'dateRange' | 'ty
|
|
|
580
581
|
type FilterOption = ControlOption;
|
|
581
582
|
|
|
582
583
|
/** The runtime value a field holds, by kind. */
|
|
583
|
-
type FilterValue = string | boolean | DateRangeValue;
|
|
584
|
+
type FilterValue = string | boolean | DateRangeValue | readonly string[];
|
|
584
585
|
/** The applied/draft value map, keyed by each field's `key`. */
|
|
585
586
|
type FilterValues = Record<string, FilterValue>;
|
|
586
587
|
interface FilterFieldBase {
|
|
@@ -629,6 +630,11 @@ interface DateRangeFilterField extends FilterFieldBase {
|
|
|
629
630
|
toLabel?: string;
|
|
630
631
|
fromPlaceholder?: string;
|
|
631
632
|
toPlaceholder?: string;
|
|
633
|
+
error?: string;
|
|
634
|
+
}
|
|
635
|
+
interface MultiSelectFilterField extends FilterFieldBase {
|
|
636
|
+
kind: 'multiSelect';
|
|
637
|
+
options: readonly FilterOption[];
|
|
632
638
|
}
|
|
633
639
|
/** A search-as-you-type combobox (the country-picker pattern). */
|
|
634
640
|
interface TypeaheadFilterField extends FilterFieldBase {
|
|
@@ -647,7 +653,7 @@ interface BooleanFilterField extends FilterFieldBase {
|
|
|
647
653
|
kind: 'boolean';
|
|
648
654
|
}
|
|
649
655
|
/** The discriminated union of every declarative filter field. */
|
|
650
|
-
type FilterField = SelectFilterField | TextFilterField | NumberFilterField | DateFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
656
|
+
type FilterField = SelectFilterField | MultiSelectFilterField | TextFilterField | NumberFilterField | DateFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
651
657
|
|
|
652
658
|
/**
|
|
653
659
|
* FilterFieldView — dispatches one {@link FilterField} to its renderer, wired to the value map.
|
|
@@ -1005,4 +1011,116 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
|
|
|
1005
1011
|
/** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
|
|
1006
1012
|
declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
|
|
1007
1013
|
|
|
1008
|
-
|
|
1014
|
+
interface ReportFilterValues {
|
|
1015
|
+
scope: string;
|
|
1016
|
+
range: DateRangeValue;
|
|
1017
|
+
statuses: readonly string[];
|
|
1018
|
+
currency: string;
|
|
1019
|
+
}
|
|
1020
|
+
interface ReportQueryKeys {
|
|
1021
|
+
scope: string;
|
|
1022
|
+
from: string;
|
|
1023
|
+
to: string;
|
|
1024
|
+
statuses: string;
|
|
1025
|
+
currency: string;
|
|
1026
|
+
}
|
|
1027
|
+
type ReportQuerySource = URLSearchParams | Readonly<Record<string, string | readonly string[] | null | undefined>>;
|
|
1028
|
+
interface ReportFilterOptions {
|
|
1029
|
+
scopes: readonly FilterOption[];
|
|
1030
|
+
statuses: readonly FilterOption[];
|
|
1031
|
+
currencies: readonly FilterOption[];
|
|
1032
|
+
}
|
|
1033
|
+
interface ReportFilterLabels {
|
|
1034
|
+
scope: string;
|
|
1035
|
+
range: string;
|
|
1036
|
+
from: string;
|
|
1037
|
+
to: string;
|
|
1038
|
+
statuses: string;
|
|
1039
|
+
currency: string;
|
|
1040
|
+
invalidRange: string;
|
|
1041
|
+
openPanel: string;
|
|
1042
|
+
openPanelHint: string;
|
|
1043
|
+
panelTitle: string;
|
|
1044
|
+
closePanel: string;
|
|
1045
|
+
closePanelHint: string;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
interface ReportFiltersProps {
|
|
1049
|
+
value: ReportFilterValues;
|
|
1050
|
+
onChange: (next: ReportFilterValues) => void;
|
|
1051
|
+
options: ReportFilterOptions;
|
|
1052
|
+
labels: ReportFilterLabels;
|
|
1053
|
+
actions?: React.ReactNode;
|
|
1054
|
+
compact?: boolean;
|
|
1055
|
+
renderSelect?: (args: RenderSelectArgs) => React.ReactNode;
|
|
1056
|
+
testID?: string;
|
|
1057
|
+
}
|
|
1058
|
+
declare function ReportFilters({ value, onChange, options, labels, actions, compact, renderSelect, testID, }: ReportFiltersProps): React.ReactElement;
|
|
1059
|
+
|
|
1060
|
+
interface FilterSidePanelProps {
|
|
1061
|
+
visible: boolean;
|
|
1062
|
+
onClose: () => void;
|
|
1063
|
+
title: string;
|
|
1064
|
+
closeLabel: string;
|
|
1065
|
+
closeHint: string;
|
|
1066
|
+
children: React.ReactNode;
|
|
1067
|
+
testID: string;
|
|
1068
|
+
}
|
|
1069
|
+
declare function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, children, testID }: FilterSidePanelProps): React.ReactElement;
|
|
1070
|
+
|
|
1071
|
+
interface ReportDraft {
|
|
1072
|
+
draft: ReportFilterValues;
|
|
1073
|
+
edit: (next: ReportFilterValues) => void;
|
|
1074
|
+
}
|
|
1075
|
+
declare function useReportDraft(value: ReportFilterValues, onChange: (next: ReportFilterValues) => void): ReportDraft;
|
|
1076
|
+
|
|
1077
|
+
declare function isIsoDate(value: string): boolean;
|
|
1078
|
+
declare function isRangeInverted(range: DateRangeValue): boolean;
|
|
1079
|
+
declare function countActiveReportFilters(values: ReportFilterValues): number;
|
|
1080
|
+
declare function reportFiltersFromQuery(source: ReportQuerySource, keys?: ReportQueryKeys): ReportFilterValues;
|
|
1081
|
+
declare function reportFiltersToQuery(values: ReportFilterValues, keys?: ReportQueryKeys): Record<string, string>;
|
|
1082
|
+
declare function reportFiltersToSearch(values: ReportFilterValues, keys?: ReportQueryKeys): string;
|
|
1083
|
+
|
|
1084
|
+
declare function buildReportFields(options: ReportFilterOptions, labels: ReportFilterLabels, values: ReportFilterValues): FilterField[];
|
|
1085
|
+
declare function toFilterValues(values: ReportFilterValues): FilterValues;
|
|
1086
|
+
declare function fromFilterValues(map: FilterValues): ReportFilterValues;
|
|
1087
|
+
|
|
1088
|
+
declare const REPORT_FILTERS_TEST_ID = "ui-report-filters";
|
|
1089
|
+
declare const REPORT_FIELD_KEYS: {
|
|
1090
|
+
readonly scope: "scope";
|
|
1091
|
+
readonly range: "range";
|
|
1092
|
+
readonly statuses: "statuses";
|
|
1093
|
+
readonly currency: "currency";
|
|
1094
|
+
};
|
|
1095
|
+
declare const DEFAULT_REPORT_QUERY_KEYS: ReportQueryKeys;
|
|
1096
|
+
declare const EMPTY_REPORT_FILTERS: ReportFilterValues;
|
|
1097
|
+
declare const openPanelTestID: (testID: string) => string;
|
|
1098
|
+
declare const panelTestID: (testID: string) => string;
|
|
1099
|
+
declare const panelFiltersTestID: (testID: string) => string;
|
|
1100
|
+
|
|
1101
|
+
declare const enum ExportOutcome {
|
|
1102
|
+
Downloaded = "downloaded",
|
|
1103
|
+
Unsupported = "unsupported",
|
|
1104
|
+
Failed = "failed"
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
type CsvRowsSource<T> = readonly T[] | (() => Promise<readonly T[]>);
|
|
1108
|
+
type CsvDownloader = (csv: string, filename: string) => boolean;
|
|
1109
|
+
declare function csvFilename(base: string, range?: DateRangeValue): string;
|
|
1110
|
+
declare function downloadCsv(csv: string, filename: string): boolean;
|
|
1111
|
+
declare function runCsvExport<T>(rows: CsvRowsSource<T>, columns: ReadonlyArray<CsvColumn<T>>, filename: string, download?: CsvDownloader): Promise<ExportOutcome>;
|
|
1112
|
+
|
|
1113
|
+
declare const EXPORT_CSV_TEST_ID = "ui-export-csv";
|
|
1114
|
+
interface ExportCsvActionProps<T> {
|
|
1115
|
+
rows: CsvRowsSource<T>;
|
|
1116
|
+
columns: ReadonlyArray<CsvColumn<T>>;
|
|
1117
|
+
filename: string;
|
|
1118
|
+
label: string;
|
|
1119
|
+
hint: string;
|
|
1120
|
+
disabled?: boolean;
|
|
1121
|
+
onDone?: (outcome: ExportOutcome) => void;
|
|
1122
|
+
testID?: string;
|
|
1123
|
+
}
|
|
1124
|
+
declare function ExportCsvAction<T>({ rows, columns, filename, label, hint, disabled, onDone, testID, }: ExportCsvActionProps<T>): React.ReactElement;
|
|
1125
|
+
|
|
1126
|
+
export { type BooleanFilterField, CARD_STACK_BREAKPOINT, type CsvDownloader, type CsvRowsSource, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_REPORT_QUERY_KEYS, DataTable, type DataTableBaseProps, type DataTableColumn, type DataTableProps, type DataTableRowAction, type DataTableStyleOverrides, type DateFilterField, type DateRangeFilterField, EMPTY_REPORT_FILTERS, EXPORT_CSV_TEST_ID, ExportCsvAction, type ExportCsvActionProps, ExportOutcome, FIELD_MIN_WIDTH, FILTERS_I18N, FILTERS_TEST_ID, type FieldStrings, FilterBar, type FilterBarProps, type FilterBarStyleOverrides, type FilterDraft, type FilterField, type FilterFieldKind, type FilterOption, FilterSidePanel, type FilterSidePanelProps, type FilterValue, type FilterValues, Filters, type FiltersProps, type LedgerFilter, LedgerLayout, MONTH_STATUS_GRID_TEST_ID, MonthGridColumns, type MonthStatusCell, MonthStatusGrid, type MonthStatusGridProps, type MultiSelectFilterField, type NumberFilterField, type PagedRows, PagedTableLayout, PagedTableLayoutKind, type PagedTableLayoutProps, Pager, type PagerProps, type PagerStyleOverrides, REPORT_FIELD_KEYS, REPORT_FILTERS_TEST_ID, RelativeTime, type RelativeTimeProps, type RelativeTimeStrings, type RelativeUnitStrings, type RenderSelectArgs, type ReportDraft, type ReportFilterLabels, type ReportFilterOptions, type ReportFilterValues, ReportFilters, type ReportFiltersProps, type ReportQueryKeys, type ReportQuerySource, type RowActionNone, STATUS_LEDGER_TEST_ID, type SelectFilterField, SortDirection, type SortValue, StatCard, type StatCardProps, StatTone, StatusLedger, type StatusLedgerColumn, type StatusLedgerLabels, type StatusLedgerProps, StatusPill, type StatusPillProps, StatusTone, TABLE_I18N, TABLE_TEST_IDS, type TextFilterField, type TimeInput, type ToneColors, type TypeaheadFilterField, type UseFilterDraftOptions, type UsePagedRowsOptions, applyTestID, buildReportFields, clearTestID, countActiveReportFilters, csvFilename, distinctValues, downloadCsv, fieldTestID, filterLedgerRows, fitMonthGridColumns, formatRelativeTime, fromFilterValues, isAttentionTone, isIsoDate, isRangeInverted, ledgerSectionTestID, ledgerSortDirectionTestID, monthCellTestID, openPanelTestID, panelFiltersTestID, panelTestID, reportFiltersFromQuery, reportFiltersToQuery, reportFiltersToSearch, resolveStatToneColor, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, runCsvExport, selectAllTestID, sortLedgerRows, splitNeedsLook, toEpochMs, toFilterValues, useFilterDraft, usePagedRows, useReportDraft };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { UiTheme } from '@dloizides/ui-feedback';
|
|
|
3
3
|
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
4
4
|
import { DateRangeValue, ControlOption } from '@dloizides/ui-forms';
|
|
5
5
|
export { DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeValue, isUnmatched, suggestOptions } from '@dloizides/ui-forms';
|
|
6
|
+
import { CsvColumn } from '@dloizides/utils';
|
|
6
7
|
|
|
7
8
|
declare const enum StatTone {
|
|
8
9
|
Neutral = "neutral",
|
|
@@ -568,7 +569,7 @@ declare const TABLE_I18N: {
|
|
|
568
569
|
*/
|
|
569
570
|
|
|
570
571
|
/** The kinds of field the declarative bar can render. */
|
|
571
|
-
type FilterFieldKind = 'select' | 'text' | 'number' | 'date' | 'dateRange' | 'typeahead' | 'boolean';
|
|
572
|
+
type FilterFieldKind = 'select' | 'multiSelect' | 'text' | 'number' | 'date' | 'dateRange' | 'typeahead' | 'boolean';
|
|
572
573
|
/**
|
|
573
574
|
* A single choice for a `select` / `typeahead` field. Label is pre-localized.
|
|
574
575
|
*
|
|
@@ -580,7 +581,7 @@ type FilterFieldKind = 'select' | 'text' | 'number' | 'date' | 'dateRange' | 'ty
|
|
|
580
581
|
type FilterOption = ControlOption;
|
|
581
582
|
|
|
582
583
|
/** The runtime value a field holds, by kind. */
|
|
583
|
-
type FilterValue = string | boolean | DateRangeValue;
|
|
584
|
+
type FilterValue = string | boolean | DateRangeValue | readonly string[];
|
|
584
585
|
/** The applied/draft value map, keyed by each field's `key`. */
|
|
585
586
|
type FilterValues = Record<string, FilterValue>;
|
|
586
587
|
interface FilterFieldBase {
|
|
@@ -629,6 +630,11 @@ interface DateRangeFilterField extends FilterFieldBase {
|
|
|
629
630
|
toLabel?: string;
|
|
630
631
|
fromPlaceholder?: string;
|
|
631
632
|
toPlaceholder?: string;
|
|
633
|
+
error?: string;
|
|
634
|
+
}
|
|
635
|
+
interface MultiSelectFilterField extends FilterFieldBase {
|
|
636
|
+
kind: 'multiSelect';
|
|
637
|
+
options: readonly FilterOption[];
|
|
632
638
|
}
|
|
633
639
|
/** A search-as-you-type combobox (the country-picker pattern). */
|
|
634
640
|
interface TypeaheadFilterField extends FilterFieldBase {
|
|
@@ -647,7 +653,7 @@ interface BooleanFilterField extends FilterFieldBase {
|
|
|
647
653
|
kind: 'boolean';
|
|
648
654
|
}
|
|
649
655
|
/** The discriminated union of every declarative filter field. */
|
|
650
|
-
type FilterField = SelectFilterField | TextFilterField | NumberFilterField | DateFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
656
|
+
type FilterField = SelectFilterField | MultiSelectFilterField | TextFilterField | NumberFilterField | DateFilterField | DateRangeFilterField | TypeaheadFilterField | BooleanFilterField;
|
|
651
657
|
|
|
652
658
|
/**
|
|
653
659
|
* FilterFieldView — dispatches one {@link FilterField} to its renderer, wired to the value map.
|
|
@@ -1005,4 +1011,116 @@ declare const MonthStatusGrid: ({ cells, onSelect, selectedId, columns, accessib
|
|
|
1005
1011
|
/** The widest allowed column count, up to `requested`, whose cells stay at least 44 px wide. */
|
|
1006
1012
|
declare function fitMonthGridColumns(requested: MonthGridColumns, width: number, gap: number): MonthGridColumns;
|
|
1007
1013
|
|
|
1008
|
-
|
|
1014
|
+
interface ReportFilterValues {
|
|
1015
|
+
scope: string;
|
|
1016
|
+
range: DateRangeValue;
|
|
1017
|
+
statuses: readonly string[];
|
|
1018
|
+
currency: string;
|
|
1019
|
+
}
|
|
1020
|
+
interface ReportQueryKeys {
|
|
1021
|
+
scope: string;
|
|
1022
|
+
from: string;
|
|
1023
|
+
to: string;
|
|
1024
|
+
statuses: string;
|
|
1025
|
+
currency: string;
|
|
1026
|
+
}
|
|
1027
|
+
type ReportQuerySource = URLSearchParams | Readonly<Record<string, string | readonly string[] | null | undefined>>;
|
|
1028
|
+
interface ReportFilterOptions {
|
|
1029
|
+
scopes: readonly FilterOption[];
|
|
1030
|
+
statuses: readonly FilterOption[];
|
|
1031
|
+
currencies: readonly FilterOption[];
|
|
1032
|
+
}
|
|
1033
|
+
interface ReportFilterLabels {
|
|
1034
|
+
scope: string;
|
|
1035
|
+
range: string;
|
|
1036
|
+
from: string;
|
|
1037
|
+
to: string;
|
|
1038
|
+
statuses: string;
|
|
1039
|
+
currency: string;
|
|
1040
|
+
invalidRange: string;
|
|
1041
|
+
openPanel: string;
|
|
1042
|
+
openPanelHint: string;
|
|
1043
|
+
panelTitle: string;
|
|
1044
|
+
closePanel: string;
|
|
1045
|
+
closePanelHint: string;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
interface ReportFiltersProps {
|
|
1049
|
+
value: ReportFilterValues;
|
|
1050
|
+
onChange: (next: ReportFilterValues) => void;
|
|
1051
|
+
options: ReportFilterOptions;
|
|
1052
|
+
labels: ReportFilterLabels;
|
|
1053
|
+
actions?: React.ReactNode;
|
|
1054
|
+
compact?: boolean;
|
|
1055
|
+
renderSelect?: (args: RenderSelectArgs) => React.ReactNode;
|
|
1056
|
+
testID?: string;
|
|
1057
|
+
}
|
|
1058
|
+
declare function ReportFilters({ value, onChange, options, labels, actions, compact, renderSelect, testID, }: ReportFiltersProps): React.ReactElement;
|
|
1059
|
+
|
|
1060
|
+
interface FilterSidePanelProps {
|
|
1061
|
+
visible: boolean;
|
|
1062
|
+
onClose: () => void;
|
|
1063
|
+
title: string;
|
|
1064
|
+
closeLabel: string;
|
|
1065
|
+
closeHint: string;
|
|
1066
|
+
children: React.ReactNode;
|
|
1067
|
+
testID: string;
|
|
1068
|
+
}
|
|
1069
|
+
declare function FilterSidePanel({ visible, onClose, title, closeLabel, closeHint, children, testID }: FilterSidePanelProps): React.ReactElement;
|
|
1070
|
+
|
|
1071
|
+
interface ReportDraft {
|
|
1072
|
+
draft: ReportFilterValues;
|
|
1073
|
+
edit: (next: ReportFilterValues) => void;
|
|
1074
|
+
}
|
|
1075
|
+
declare function useReportDraft(value: ReportFilterValues, onChange: (next: ReportFilterValues) => void): ReportDraft;
|
|
1076
|
+
|
|
1077
|
+
declare function isIsoDate(value: string): boolean;
|
|
1078
|
+
declare function isRangeInverted(range: DateRangeValue): boolean;
|
|
1079
|
+
declare function countActiveReportFilters(values: ReportFilterValues): number;
|
|
1080
|
+
declare function reportFiltersFromQuery(source: ReportQuerySource, keys?: ReportQueryKeys): ReportFilterValues;
|
|
1081
|
+
declare function reportFiltersToQuery(values: ReportFilterValues, keys?: ReportQueryKeys): Record<string, string>;
|
|
1082
|
+
declare function reportFiltersToSearch(values: ReportFilterValues, keys?: ReportQueryKeys): string;
|
|
1083
|
+
|
|
1084
|
+
declare function buildReportFields(options: ReportFilterOptions, labels: ReportFilterLabels, values: ReportFilterValues): FilterField[];
|
|
1085
|
+
declare function toFilterValues(values: ReportFilterValues): FilterValues;
|
|
1086
|
+
declare function fromFilterValues(map: FilterValues): ReportFilterValues;
|
|
1087
|
+
|
|
1088
|
+
declare const REPORT_FILTERS_TEST_ID = "ui-report-filters";
|
|
1089
|
+
declare const REPORT_FIELD_KEYS: {
|
|
1090
|
+
readonly scope: "scope";
|
|
1091
|
+
readonly range: "range";
|
|
1092
|
+
readonly statuses: "statuses";
|
|
1093
|
+
readonly currency: "currency";
|
|
1094
|
+
};
|
|
1095
|
+
declare const DEFAULT_REPORT_QUERY_KEYS: ReportQueryKeys;
|
|
1096
|
+
declare const EMPTY_REPORT_FILTERS: ReportFilterValues;
|
|
1097
|
+
declare const openPanelTestID: (testID: string) => string;
|
|
1098
|
+
declare const panelTestID: (testID: string) => string;
|
|
1099
|
+
declare const panelFiltersTestID: (testID: string) => string;
|
|
1100
|
+
|
|
1101
|
+
declare const enum ExportOutcome {
|
|
1102
|
+
Downloaded = "downloaded",
|
|
1103
|
+
Unsupported = "unsupported",
|
|
1104
|
+
Failed = "failed"
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
type CsvRowsSource<T> = readonly T[] | (() => Promise<readonly T[]>);
|
|
1108
|
+
type CsvDownloader = (csv: string, filename: string) => boolean;
|
|
1109
|
+
declare function csvFilename(base: string, range?: DateRangeValue): string;
|
|
1110
|
+
declare function downloadCsv(csv: string, filename: string): boolean;
|
|
1111
|
+
declare function runCsvExport<T>(rows: CsvRowsSource<T>, columns: ReadonlyArray<CsvColumn<T>>, filename: string, download?: CsvDownloader): Promise<ExportOutcome>;
|
|
1112
|
+
|
|
1113
|
+
declare const EXPORT_CSV_TEST_ID = "ui-export-csv";
|
|
1114
|
+
interface ExportCsvActionProps<T> {
|
|
1115
|
+
rows: CsvRowsSource<T>;
|
|
1116
|
+
columns: ReadonlyArray<CsvColumn<T>>;
|
|
1117
|
+
filename: string;
|
|
1118
|
+
label: string;
|
|
1119
|
+
hint: string;
|
|
1120
|
+
disabled?: boolean;
|
|
1121
|
+
onDone?: (outcome: ExportOutcome) => void;
|
|
1122
|
+
testID?: string;
|
|
1123
|
+
}
|
|
1124
|
+
declare function ExportCsvAction<T>({ rows, columns, filename, label, hint, disabled, onDone, testID, }: ExportCsvActionProps<T>): React.ReactElement;
|
|
1125
|
+
|
|
1126
|
+
export { type BooleanFilterField, CARD_STACK_BREAKPOINT, type CsvDownloader, type CsvRowsSource, DEFAULT_PAGE_SIZE, DEFAULT_PAGE_SIZE_OPTIONS, DEFAULT_REPORT_QUERY_KEYS, DataTable, type DataTableBaseProps, type DataTableColumn, type DataTableProps, type DataTableRowAction, type DataTableStyleOverrides, type DateFilterField, type DateRangeFilterField, EMPTY_REPORT_FILTERS, EXPORT_CSV_TEST_ID, ExportCsvAction, type ExportCsvActionProps, ExportOutcome, FIELD_MIN_WIDTH, FILTERS_I18N, FILTERS_TEST_ID, type FieldStrings, FilterBar, type FilterBarProps, type FilterBarStyleOverrides, type FilterDraft, type FilterField, type FilterFieldKind, type FilterOption, FilterSidePanel, type FilterSidePanelProps, type FilterValue, type FilterValues, Filters, type FiltersProps, type LedgerFilter, LedgerLayout, MONTH_STATUS_GRID_TEST_ID, MonthGridColumns, type MonthStatusCell, MonthStatusGrid, type MonthStatusGridProps, type MultiSelectFilterField, type NumberFilterField, type PagedRows, PagedTableLayout, PagedTableLayoutKind, type PagedTableLayoutProps, Pager, type PagerProps, type PagerStyleOverrides, REPORT_FIELD_KEYS, REPORT_FILTERS_TEST_ID, RelativeTime, type RelativeTimeProps, type RelativeTimeStrings, type RelativeUnitStrings, type RenderSelectArgs, type ReportDraft, type ReportFilterLabels, type ReportFilterOptions, type ReportFilterValues, ReportFilters, type ReportFiltersProps, type ReportQueryKeys, type ReportQuerySource, type RowActionNone, STATUS_LEDGER_TEST_ID, type SelectFilterField, SortDirection, type SortValue, StatCard, type StatCardProps, StatTone, StatusLedger, type StatusLedgerColumn, type StatusLedgerLabels, type StatusLedgerProps, StatusPill, type StatusPillProps, StatusTone, TABLE_I18N, TABLE_TEST_IDS, type TextFilterField, type TimeInput, type ToneColors, type TypeaheadFilterField, type UseFilterDraftOptions, type UsePagedRowsOptions, applyTestID, buildReportFields, clearTestID, countActiveReportFilters, csvFilename, distinctValues, downloadCsv, fieldTestID, filterLedgerRows, fitMonthGridColumns, formatRelativeTime, fromFilterValues, isAttentionTone, isIsoDate, isRangeInverted, ledgerSectionTestID, ledgerSortDirectionTestID, monthCellTestID, openPanelTestID, panelFiltersTestID, panelTestID, reportFiltersFromQuery, reportFiltersToQuery, reportFiltersToSearch, resolveStatToneColor, rowDetailTestID, rowFadeTestID, rowSelectTestID, rowTestID, runCsvExport, selectAllTestID, sortLedgerRows, splitNeedsLook, toEpochMs, toFilterValues, useFilterDraft, usePagedRows, useReportDraft };
|