@mittwald/flow-react-components 1.5.0-next.47 → 1.5.0-next.49

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 (136) hide show
  1. package/AGENTS.md +37 -0
  2. package/dist/assets/component-index.json +1 -1
  3. package/dist/assets/doc-properties.json +1 -1
  4. package/dist/js/node_modules/.pnpm/@lezer_lr@1.4.10/node_modules/@lezer/lr/dist/index.mjs.map +1 -1
  5. package/dist/js/packages/components/src/components/Action/models/ActionState.mjs +8 -70
  6. package/dist/js/packages/components/src/components/Action/models/ActionState.mjs.map +1 -1
  7. package/dist/js/packages/components/src/components/Calendar/components/RangeCalendar/helpers/useCalendarDateRangePresets.mjs +1 -1
  8. package/dist/js/packages/components/src/components/List/components/Header/components/ActiveFilters/ActiveFilters.mjs +1 -1
  9. package/dist/js/packages/components/src/components/List/components/Header/components/ActiveFilters/ActiveFilters.mjs.map +1 -1
  10. package/dist/js/packages/components/src/components/List/model/List.mjs +15 -4
  11. package/dist/js/packages/components/src/components/List/model/List.mjs.map +1 -1
  12. package/dist/js/packages/components/src/components/List/model/ListSettingsStore.mjs.map +1 -1
  13. package/dist/js/packages/components/src/components/List/model/ListViewMode.mjs +35 -23
  14. package/dist/js/packages/components/src/components/List/model/ListViewMode.mjs.map +1 -1
  15. package/dist/js/packages/components/src/components/List/model/ReactTable.mjs +16 -10
  16. package/dist/js/packages/components/src/components/List/model/ReactTable.mjs.map +1 -1
  17. package/dist/js/packages/components/src/components/List/model/filter/DateRangeFilter.mjs +25 -13
  18. package/dist/js/packages/components/src/components/List/model/filter/DateRangeFilter.mjs.map +1 -1
  19. package/dist/js/packages/components/src/components/List/model/filter/Filter.mjs +20 -181
  20. package/dist/js/packages/components/src/components/List/model/filter/Filter.mjs.map +1 -1
  21. package/dist/js/packages/components/src/components/List/model/item/ItemCollection.mjs +11 -7
  22. package/dist/js/packages/components/src/components/List/model/item/ItemCollection.mjs.map +1 -1
  23. package/dist/js/packages/components/src/components/List/model/loading/IncrementalLoader.mjs +10 -13
  24. package/dist/js/packages/components/src/components/List/model/loading/IncrementalLoader.mjs.map +1 -1
  25. package/dist/js/packages/components/src/components/List/model/loading/IncrementalLoaderState.mjs +13 -61
  26. package/dist/js/packages/components/src/components/List/model/loading/IncrementalLoaderState.mjs.map +1 -1
  27. package/dist/js/packages/components/src/components/List/model/search/Search.mjs +19 -47
  28. package/dist/js/packages/components/src/components/List/model/search/Search.mjs.map +1 -1
  29. package/dist/js/packages/components/src/components/List/model/sorting/Sorting.mjs +15 -54
  30. package/dist/js/packages/components/src/components/List/model/sorting/Sorting.mjs.map +1 -1
  31. package/dist/js/packages/components/src/components/List/model/sorting/SortingFunctions.mjs.map +1 -1
  32. package/dist/js/packages/components/src/lib/remote/eventHandlerContext.mjs +3 -1
  33. package/dist/js/packages/components/src/lib/remote/eventHandlerContext.mjs.map +1 -1
  34. package/dist/js/packages/components-base/src/action/ActionState.mjs +87 -0
  35. package/dist/js/packages/components-base/src/action/ActionState.mjs.map +1 -0
  36. package/dist/js/packages/components-base/src/index.mjs +18 -0
  37. package/dist/js/packages/components-base/src/lib/array.mjs +9 -0
  38. package/dist/js/packages/components-base/src/lib/array.mjs.map +1 -0
  39. package/dist/js/packages/components-base/src/list/ListModelContext.mjs +19 -0
  40. package/dist/js/packages/components-base/src/list/ListModelContext.mjs.map +1 -0
  41. package/dist/js/packages/components-base/src/list/filter/ListDateRangeFilter.mjs +29 -0
  42. package/dist/js/packages/components-base/src/list/filter/ListDateRangeFilter.mjs.map +1 -0
  43. package/dist/js/packages/components-base/src/list/filter/ListFilter.mjs +229 -0
  44. package/dist/js/packages/components-base/src/list/filter/ListFilter.mjs.map +1 -0
  45. package/dist/js/packages/components-base/src/list/filter/ListFilterValue.mjs +51 -0
  46. package/dist/js/packages/components-base/src/list/filter/ListFilterValue.mjs.map +1 -0
  47. package/dist/js/packages/components-base/src/list/filter/dateRange.mjs +51 -0
  48. package/dist/js/packages/components-base/src/list/filter/dateRange.mjs.map +1 -0
  49. package/dist/js/packages/components-base/src/list/item/ListItem.mjs +21 -0
  50. package/dist/js/packages/components-base/src/list/item/ListItem.mjs.map +1 -0
  51. package/dist/js/packages/components-base/src/list/item/ListItemCollection.mjs +24 -0
  52. package/dist/js/packages/components-base/src/list/item/ListItemCollection.mjs.map +1 -0
  53. package/dist/js/packages/components-base/src/list/loading/ListLoaderState.mjs +86 -0
  54. package/dist/js/packages/components-base/src/list/loading/ListLoaderState.mjs.map +1 -0
  55. package/dist/js/packages/components-base/src/list/loading/types.mjs +29 -0
  56. package/dist/js/packages/components-base/src/list/loading/types.mjs.map +1 -0
  57. package/dist/js/packages/components-base/src/list/pagination/ListBatchesController.mjs +64 -0
  58. package/dist/js/packages/components-base/src/list/pagination/ListBatchesController.mjs.map +1 -0
  59. package/dist/js/packages/components-base/src/list/search/ListSearch.mjs +62 -0
  60. package/dist/js/packages/components-base/src/list/search/ListSearch.mjs.map +1 -0
  61. package/dist/js/packages/components-base/src/list/sorting/ListSorting.mjs +81 -0
  62. package/dist/js/packages/components-base/src/list/sorting/ListSorting.mjs.map +1 -0
  63. package/dist/js/packages/components-base/src/list/table/ListTable.mjs +80 -0
  64. package/dist/js/packages/components-base/src/list/table/ListTable.mjs.map +1 -0
  65. package/dist/js/packages/components-base/src/list/viewMode/ListViewMode.mjs +53 -0
  66. package/dist/js/packages/components-base/src/list/viewMode/ListViewMode.mjs.map +1 -0
  67. package/dist/types/_bundled/flow-components-base/action/ActionState.d.ts +36 -0
  68. package/dist/types/_bundled/flow-components-base/index.d.ts +23 -0
  69. package/dist/types/_bundled/flow-components-base/lib/array.d.ts +4 -0
  70. package/dist/types/_bundled/flow-components-base/list/ListModelContext.d.ts +30 -0
  71. package/dist/types/_bundled/flow-components-base/list/filter/ListDateRangeFilter.d.ts +18 -0
  72. package/dist/types/_bundled/flow-components-base/list/filter/ListFilter.d.ts +104 -0
  73. package/dist/types/_bundled/flow-components-base/list/filter/ListFilterValue.d.ts +21 -0
  74. package/dist/types/_bundled/flow-components-base/list/filter/dateRange.d.ts +23 -0
  75. package/dist/types/_bundled/flow-components-base/list/filter/types.d.ts +18 -0
  76. package/dist/types/_bundled/flow-components-base/list/item/ListItem.d.ts +10 -0
  77. package/dist/types/_bundled/flow-components-base/list/item/ListItemCollection.d.ts +14 -0
  78. package/dist/types/_bundled/flow-components-base/list/loading/ListLoaderState.d.ts +44 -0
  79. package/dist/types/_bundled/flow-components-base/list/loading/types.d.ts +69 -0
  80. package/dist/types/_bundled/flow-components-base/list/pagination/ListBatchesController.d.ts +32 -0
  81. package/dist/types/_bundled/flow-components-base/list/pagination/types.d.ts +17 -0
  82. package/dist/types/_bundled/flow-components-base/list/search/ListSearch.d.ts +27 -0
  83. package/dist/types/_bundled/flow-components-base/list/search/types.d.ts +5 -0
  84. package/dist/types/_bundled/flow-components-base/list/settings/types.d.ts +52 -0
  85. package/dist/types/_bundled/flow-components-base/list/sorting/ListSorting.d.ts +40 -0
  86. package/dist/types/_bundled/flow-components-base/list/sorting/types.d.ts +14 -0
  87. package/dist/types/_bundled/flow-components-base/list/table/ListTable.d.ts +34 -0
  88. package/dist/types/_bundled/flow-components-base/list/types.d.ts +18 -0
  89. package/dist/types/_bundled/flow-components-base/list/viewMode/ListViewMode.d.ts +25 -0
  90. package/dist/types/_bundled/flow-components-base/list/viewMode/types.d.ts +10 -0
  91. package/dist/types/components/Action/models/ActionState.d.ts +8 -21
  92. package/dist/types/components/List/components/Header/lib.d.ts +1 -2
  93. package/dist/types/components/List/model/List.d.ts +6 -1
  94. package/dist/types/components/List/model/ListSettingsStore.d.ts +2 -4
  95. package/dist/types/components/List/model/ListViewMode.d.ts +17 -10
  96. package/dist/types/components/List/model/ReactTable.d.ts +1 -1
  97. package/dist/types/components/List/model/filter/DateRangeFilter.d.ts +21 -9
  98. package/dist/types/components/List/model/filter/Filter.d.ts +18 -52
  99. package/dist/types/components/List/model/filter/FilterValue.d.ts +10 -11
  100. package/dist/types/components/List/model/filter/types.d.ts +6 -18
  101. package/dist/types/components/List/model/item/Item.d.ts +8 -7
  102. package/dist/types/components/List/model/item/ItemCollection.d.ts +9 -4
  103. package/dist/types/components/List/model/loading/IncrementalLoaderState.d.ts +11 -21
  104. package/dist/types/components/List/model/loading/types.d.ts +5 -26
  105. package/dist/types/components/List/model/pagination/BatchesController.d.ts +1 -15
  106. package/dist/types/components/List/model/pagination/types.d.ts +1 -3
  107. package/dist/types/components/List/model/search/Search.d.ts +16 -19
  108. package/dist/types/components/List/model/search/types.d.ts +6 -8
  109. package/dist/types/components/List/model/sorting/Sorting.d.ts +14 -22
  110. package/dist/types/components/List/model/sorting/SortingFunctions.d.ts +1 -1
  111. package/dist/types/components/List/model/sorting/types.d.ts +1 -13
  112. package/dist/types/components/List/model/types.d.ts +7 -24
  113. package/dist/types/components/List/typedList.d.ts +2 -2
  114. package/dist/types/lib/remote/eventHandlerContext.d.ts +2 -1
  115. package/package.json +11 -10
  116. package/dist/js/packages/components/src/components/List/model/filter/FilterValue.mjs +0 -43
  117. package/dist/js/packages/components/src/components/List/model/filter/FilterValue.mjs.map +0 -1
  118. package/dist/js/packages/components/src/components/List/model/filter/dateRangeFilterFn.mjs +0 -23
  119. package/dist/js/packages/components/src/components/List/model/filter/dateRangeFilterFn.mjs.map +0 -1
  120. package/dist/js/packages/components/src/components/List/model/item/Item.mjs +0 -20
  121. package/dist/js/packages/components/src/components/List/model/item/Item.mjs.map +0 -1
  122. package/dist/js/packages/components/src/components/List/model/pagination/BatchesController.mjs +0 -58
  123. package/dist/js/packages/components/src/components/List/model/pagination/BatchesController.mjs.map +0 -1
  124. package/dist/js/packages/components/src/lib/array/toArray.mjs +0 -8
  125. package/dist/js/packages/components/src/lib/array/toArray.mjs.map +0 -1
  126. package/dist/js/packages/components/src/lib/date/transformDateValueToDateTime.mjs +0 -15
  127. package/dist/js/packages/components/src/lib/date/transformDateValueToDateTime.mjs.map +0 -1
  128. package/dist/js/packages/components/src/lib/promises/sleep.mjs +0 -8
  129. package/dist/js/packages/components/src/lib/promises/sleep.mjs.map +0 -1
  130. package/dist/types/components/CartesianChart/typedCartesianChart.test-types.d.ts +0 -1
  131. package/dist/types/components/List/model/filter/dateRangeFilterFn.d.ts +0 -6
  132. package/dist/types/components/List/typedList.test-types.d.ts +0 -1
  133. package/dist/types/integrations/@mittwald/password-tools-js/passwordCreationFieldExport.test-types.d.ts +0 -1
  134. package/dist/types/lib/array/toArray.d.ts +0 -1
  135. package/dist/types/lib/types/array.d.ts +0 -1
  136. package/dist/types/lib/types/props.test-types.d.ts +0 -1
@@ -0,0 +1,40 @@
1
+ import { type ListModelContext } from "../ListModelContext";
2
+ import type { PropertyName } from "../types";
3
+ import type { ListSortingShape, SortingDefaultMode, SortingFn } from "./types";
4
+ import type { Column, ColumnDef, ColumnSort, SortDirection } from "@tanstack/table-core";
5
+ /**
6
+ * One way a list can be sorted — a property, a direction, and whether it is on.
7
+ *
8
+ * Framework-free: the state lives in the TanStack table and the preference in
9
+ * the settings store, and this only translates between them. Which is why it
10
+ * could move here whole, unlike the loader, which had to leave its fetching
11
+ * behind.
12
+ */
13
+ export declare class ListSorting<T> {
14
+ readonly context: ListModelContext<T>;
15
+ readonly property: PropertyName<T>;
16
+ readonly name?: string;
17
+ readonly directionName?: string;
18
+ readonly direction: SortDirection;
19
+ readonly initialEnabled: SortingDefaultMode;
20
+ readonly customSortingFn?: SortingFn<T>;
21
+ readonly autosave: boolean;
22
+ constructor(context: ListModelContext<T>, shape: ListSortingShape<T>);
23
+ private getInitialEnabled;
24
+ updateTableColumnDef(def: ColumnDef<T>): void;
25
+ getReactTableColumnSort(): ColumnSort;
26
+ isSorted(): boolean;
27
+ getTableColumn(): Column<T>;
28
+ enable(): void;
29
+ clear(): void;
30
+ get id(): string;
31
+ }
32
+ export default ListSorting;
33
+ /**
34
+ * The next sorting state, with every hidden sorting still in it.
35
+ *
36
+ * A hidden sorting is not a user choice — it is how the list is ordered when
37
+ * nothing else says otherwise, so a click on a visible sorting must not drop
38
+ * it. The table's own updater knows nothing about that distinction.
39
+ */
40
+ export declare const mergeHiddenSorting: <T>(sortings: ListSorting<T>[], next: ColumnSort[]) => ColumnSort[];
@@ -0,0 +1,14 @@
1
+ import type { PropertyName } from "../types";
2
+ import type { SortDirection, SortingFn as TableSortingFn } from "@tanstack/table-core";
3
+ /** `"hidden"` keeps a sorting out of the UI but leaves it usable in code. */
4
+ export type SortingDefaultMode = boolean | "hidden";
5
+ export type SortingFn<T> = TableSortingFn<T>;
6
+ export interface ListSortingShape<T> {
7
+ property: PropertyName<T>;
8
+ name?: string;
9
+ directionName?: string;
10
+ direction?: SortDirection;
11
+ defaultEnabled?: SortingDefaultMode;
12
+ customSortingFn?: SortingFn<T>;
13
+ autosave?: boolean;
14
+ }
@@ -0,0 +1,34 @@
1
+ import type { RowData, Table, TableOptions, TableState, Updater } from "@tanstack/table-core";
2
+ /**
3
+ * A TanStack table whose state is MobX.
4
+ *
5
+ * `useReactTable` is `createTable` plus a `useState` for the table's own state
6
+ * and a `setOptions` on every render that folds that state back in. Only the
7
+ * `useState` is React, and `@tanstack/vue-table` reimplements the same twenty
8
+ * lines against Vue's reactivity — so the state lives here instead and each
9
+ * binding brings its subscription.
10
+ *
11
+ * Options still arrive from the binding on every render, because that is where
12
+ * they come from: the loaded data, the column definitions the list's filters
13
+ * and sortings produce, a controlled piece of state. `setOptions` is therefore
14
+ * called by the binding, and re-applied here whenever the state changes.
15
+ */
16
+ export declare class ListTable<T extends RowData> {
17
+ readonly table: Table<T>;
18
+ state: TableState;
19
+ /**
20
+ * Bumped whenever the state _or_ the options changed.
21
+ *
22
+ * The row models are derived from both, and the options are plain data that
23
+ * arrives from the binding — so a binding observing only `state` keeps
24
+ * rendering the previous rows after new data was handed in. It is the one
25
+ * signal that says "ask the table again".
26
+ */
27
+ revision: number;
28
+ private options;
29
+ constructor(options: TableOptions<T>);
30
+ setState(updater: Updater<TableState>): void;
31
+ /** Called by the binding on every render, with that render's options. */
32
+ setOptions(options: TableOptions<T>): void;
33
+ private applyOptions;
34
+ }
@@ -0,0 +1,18 @@
1
+ import type { ItemType } from "../lib/array";
2
+ import type { DeepKeys, DeepValue } from "@tanstack/table-core";
3
+ export declare const customPropertyPrefix: "$";
4
+ /**
5
+ * A column that is not a property of the item — a computed one, or one a filter
6
+ * invents. Prefixed so it cannot collide with a real key.
7
+ */
8
+ export type CustomPropertyName = `${typeof customPropertyPrefix}${string}`;
9
+ export type PropertyName<T> = DeepKeys<T> | CustomPropertyName;
10
+ export type PropertyValue<T, TProp> = TProp extends CustomPropertyName ? T : DeepValue<T, TProp>;
11
+ /**
12
+ * How a filter turns one of its values into something to show.
13
+ *
14
+ * The return type is the binding's: React's `Filter` narrows it to `ReactNode`,
15
+ * which is why the class carries it as a type parameter instead of deciding it
16
+ * here.
17
+ */
18
+ export type PropertyValueRenderMethod<TMatcherValue, TRendered = unknown> = (prop: NonNullable<ItemType<TMatcherValue>>) => TRendered;
@@ -0,0 +1,25 @@
1
+ import type { ListViewModeOptions, ListViewModeValue } from "./types";
2
+ /**
3
+ * Which layout the list is in, and its persistence.
4
+ *
5
+ * The value is a MobX observable rather than a binding's own state, so that the
6
+ * rule it obeys — a stored mode wins over the default, and a change is written
7
+ * back — is one implementation. A binding brings the subscription:
8
+ * `useSelector` in React, `watchMobxValue` in Vue.
9
+ */
10
+ export declare class ListViewMode {
11
+ value: ListViewModeValue;
12
+ private storage;
13
+ constructor(options?: ListViewModeOptions);
14
+ get autosave(): boolean;
15
+ /**
16
+ * Where a change is written, for a binding whose list can change it without a
17
+ * new model — React rebuilds the list every render, the view mode lives on.
18
+ * The value itself is read only once, at construction.
19
+ */
20
+ updateStorage(storage: Pick<ListViewModeOptions, "autosave" | "settings">): void;
21
+ get isTiles(): boolean;
22
+ get isTable(): boolean;
23
+ get isList(): boolean;
24
+ set(viewMode: ListViewModeValue): void;
25
+ }
@@ -0,0 +1,10 @@
1
+ import type { ListSettingsPort } from "../settings/types";
2
+ /** How the list lays its items out. */
3
+ export type ListViewModeValue = "table" | "list" | "tiles";
4
+ export interface ListViewModeOptions {
5
+ /** The mode to start in. A persisted mode takes precedence. */
6
+ defaultValue?: ListViewModeValue;
7
+ /** @default true */
8
+ autosave?: boolean;
9
+ settings?: ListSettingsPort;
10
+ }
@@ -1,29 +1,16 @@
1
- export type ActionStateValue = "isIdle" | "isSucceeded" | "isPending" | "isExecuting" | "isFailed";
1
+ import { ActionState as ActionStateBase } from '../../../_bundled/flow-components-base/index';
2
+ export type { ActionStateValue } from '../../../_bundled/flow-components-base/index';
2
3
  export declare const duration: {
3
4
  pending: number;
4
5
  succeeded: number;
5
6
  failed: number;
6
7
  };
7
- export declare class ActionState {
8
- private showFeedback?;
9
- state: ActionStateValue;
10
- private setPendingTimeout;
11
- error: unknown;
12
- private isAsync;
13
- constructor();
8
+ /**
9
+ * The state machine is `@mittwald/flow-components-base`'s, shared with every
10
+ * remote binding; this adds the hooks.
11
+ */
12
+ export declare class ActionState extends ActionStateBase {
14
13
  static useNew(): ActionState;
15
- updateState(newState: ActionStateValue): void;
16
- useValue(): ActionStateValue;
14
+ useValue(): ActionStateBase["state"];
17
15
  useIsBusy(): boolean;
18
- get isBusy(): boolean;
19
- onAsyncStart(): void;
20
- onSucceeded(): Promise<void>;
21
- onFailed(error?: unknown): Promise<void>;
22
- withFeedback(feedback?: boolean): ActionState;
23
- private startFailedFeedback;
24
- private startSucceededFeedback;
25
- private resetAfterDone;
26
- private clearPendingTimeout;
27
- private onDone;
28
- private startPending;
29
16
  }
@@ -1,2 +1 @@
1
- import { ListViewMode } from '../../model/types';
2
- export declare const useAvailableViewModes: () => ListViewMode[];
1
+ export declare const useAvailableViewModes: () => import('../../../../_bundled/flow-components-base/index').ListViewModeValue[];
@@ -12,7 +12,9 @@ import { ReactNode } from 'react';
12
12
  import { ListSettingsStore } from './ListSettingsStore';
13
13
  import { ListViewMode } from './ListViewMode';
14
14
  import { DateRangeFilter } from './filter/DateRangeFilter';
15
- export declare class List<T = unknown, TMeta = unknown> {
15
+ import { ListModelContext, ListSettingsPort } from '../../../_bundled/flow-components-base/index';
16
+ import { Table as ReactTableInstance } from '@tanstack/table-core';
17
+ export declare class List<T = unknown, TMeta = unknown> implements ListModelContext<T> {
16
18
  readonly filters: (Filter<T, never, never> | DateRangeFilter<T, never>)[];
17
19
  readonly itemView?: ItemView<T>;
18
20
  readonly table?: Table<T>;
@@ -35,6 +37,9 @@ export declare class List<T = unknown, TMeta = unknown> {
35
37
  readonly emptySearchResultView?: ReactNode;
36
38
  readonly settingsStorageDefaults?: ListSettingsStorageDefaults;
37
39
  constructor(shape: ListShape<T, TMeta>);
40
+ get dataTable(): ReactTableInstance<T>;
41
+ get settings(): ListSettingsPort | undefined;
42
+ get settingsDefaults(): ListSettingsStorageDefaults | undefined;
38
43
  getEmptyViewType(): EmptyViewType;
39
44
  get hasActiveFilters(): boolean;
40
45
  get visibleSorting(): Sorting<T>[];
@@ -1,11 +1,9 @@
1
+ import { ListSettingsOperationOptions } from '../../../_bundled/flow-components-base/index';
1
2
  import { SettingsStore } from '../../SettingsProvider/models/SettingsStore';
2
3
  import { ListSettingsStorageShape } from './types';
3
4
  import { default as List } from './List';
4
5
  import { default as z } from 'zod';
5
- export interface ListSettingsStoreOperationOptions {
6
- autosave?: boolean;
7
- manualSave?: boolean;
8
- }
6
+ export type ListSettingsStoreOperationOptions = ListSettingsOperationOptions;
9
7
  declare const supportedSettings: {
10
8
  readonly activeFilters: {
11
9
  readonly supports: {
@@ -1,18 +1,25 @@
1
+ import { ListViewMode as ListViewModeState } from '../../../_bundled/flow-components-base/index';
1
2
  import { ListViewMode as RawListViewMode } from './types';
2
3
  import { List } from './List';
3
4
  interface Options {
4
5
  defaultViewMode?: RawListViewMode;
5
6
  autosave?: boolean;
6
7
  }
7
- export declare class ListViewMode<T = unknown> {
8
- readonly list: List<T>;
9
- readonly autosave: boolean;
10
- private readonly state;
11
- constructor(list: List<T>, options?: Options);
12
- get value(): RawListViewMode;
13
- get isTiles(): boolean;
14
- get isTable(): boolean;
15
- get isList(): boolean;
16
- set(viewMode: RawListViewMode): void;
8
+ /**
9
+ * React's view of the list's layout mode.
10
+ *
11
+ * The mode itself — the stored value winning over the default, the write-back —
12
+ * is `ListViewMode` in `@mittwald/flow-components-base`. What is left here is
13
+ * the subscription, and the fact that the model outlives a render: a view mode
14
+ * rebuilt every render would forget what the user picked. The list, its
15
+ * settings store and `autosave` are taken from the current render, as they were
16
+ * when this class was rebuilt with the list.
17
+ */
18
+ export declare class ListViewMode<T = unknown> extends ListViewModeState {
19
+ private currentList;
20
+ private constructor();
21
+ get list(): List<T>;
22
+ private static storageOf;
23
+ static useNew<T>(list: List<T>, options?: Options): ListViewMode<T>;
17
24
  }
18
25
  export {};
@@ -1,4 +1,4 @@
1
- import { Column, ColumnSort, Table, TableOptions } from '@tanstack/react-table';
1
+ import { Column, ColumnSort, Table, TableOptions } from '@tanstack/table-core';
2
2
  import { default as List } from './List';
3
3
  import { OnListChanged, PropertyName } from './types';
4
4
  import { SearchValue } from './search/types';
@@ -1,15 +1,27 @@
1
- import { ColumnDef } from '@tanstack/react-table';
2
- import { default as List } from '../List';
3
- import { Filter } from './Filter';
1
+ import { ListDateRangeFilter, ListModelContext } from '../../../../_bundled/flow-components-base/index';
4
2
  import { FilterShape } from './types';
5
3
  import { PropertyName } from '../types';
6
- import { DateRange, RangeValue } from 'react-aria-components';
7
- import { DateValue } from '@internationalized/date';
8
4
  import { RangeCalendarProps } from '../../../Calendar';
9
- export declare class DateRangeFilter<T = never, TProp extends PropertyName<T> = never> extends Filter<T, TProp> {
5
+ import { DateValue } from '@internationalized/date';
6
+ import { DateRange, RangeValue } from 'react-aria-components';
7
+ import { ReactNode } from 'react';
8
+ import { List } from '../List';
9
+ import { FilterValue } from './FilterValue';
10
+ /**
11
+ * React's date-range filter.
12
+ *
13
+ * The column, the comparison and the stored value are `ListDateRangeFilter` in
14
+ * `@mittwald/flow-components-base`, so the Vue binding filters the same dates
15
+ * the same way. What is left here is the calendar's own options, which are
16
+ * Flow's `RangeCalendar` props.
17
+ */
18
+ export declare class DateRangeFilter<T = never, TProp extends PropertyName<T> = never> extends ListDateRangeFilter<T, TProp, ReactNode> {
10
19
  readonly dateRangeOptions?: RangeCalendarProps;
11
- constructor(list: List<T>, shape: FilterShape<T, TProp, never>);
12
- updateTableColumnDef(def: ColumnDef<T>): void;
20
+ constructor(context: ListModelContext<T>, shape: FilterShape<T, TProp, never>);
13
21
  getValue(): DateRange | null;
14
- setValue(range: RangeValue<DateValue>): void;
22
+ setValue(range: RangeValue<DateValue> | null): void;
23
+ /** The list this filter belongs to — `context`, typed as React's `List`. */
24
+ get list(): List<T>;
25
+ get values(): FilterValue[];
26
+ getArrayValue(): FilterValue[];
15
27
  }
@@ -1,56 +1,22 @@
1
- import { ColumnDef, ColumnFilter, InitialTableState } from '@tanstack/react-table';
2
- import { default as List } from '../List';
3
- import { FilterMatcher, FilterMode, FilterShape } from './types';
4
- import { PropertyName, PropertyValueRenderMethod } from '../types';
1
+ import { FilterShape } from './types';
2
+ import { PropertyName } from '../types';
3
+ import { ListModelContext, ListFilter } from '../../../../_bundled/flow-components-base/index';
4
+ import { ReactNode } from 'react';
5
+ import { List } from '../List';
5
6
  import { FilterValue } from './FilterValue';
6
- import { ListSettingsStoreOperationOptions } from '../ListSettingsStore';
7
- export declare class Filter<T = never, TProp extends PropertyName<T> = never, TMatchValue = never> {
8
- private _values?;
9
- private _valuesFromTableState?;
10
- readonly list: List<T>;
11
- readonly property: TProp;
12
- readonly mode: FilterMode;
13
- readonly matcher: FilterMatcher<T, never, never>;
14
- readonly renderItem: PropertyValueRenderMethod<TMatchValue>;
15
- readonly name?: string;
16
- readonly autosave: boolean;
17
- readonly manualSave: boolean;
18
- private onFilterChangeCallbacks;
19
- private readonly defaultSelectedValues?;
20
- readonly priority: "primary" | "secondary";
21
- readonly storageKey: string;
22
- constructor(list: List<T>, shape: FilterShape<T, TProp, TMatchValue>);
23
- updateInitialState(initialState: InitialTableState): void;
24
- private getInitialSelectedIds;
25
- private getStoredSelectedIds;
26
- private getStoredSelectedValues;
27
- static storeFilters<T>(list: List<T>, options: ListSettingsStoreOperationOptions): void;
28
- updateTableColumnDef(def: ColumnDef<T>): void;
29
- private getReactTableFilterFn;
30
- private checkFilterMatches;
31
- protected getTableColumnFilter(): ColumnFilter | undefined;
32
- private getTableColumn;
33
- getValue(): unknown;
34
- private getValuesFromTableState;
35
- private checkIfValueIsUnknown;
36
- deleteUnknownFilterValues(): void;
7
+ /**
8
+ * React's filter: the shared one, with `renderItem` narrowed.
9
+ *
10
+ * Everything a filter does — values, selection, persistence, the predicate the
11
+ * table runs — is `ListFilter` in `@mittwald/flow-components-base`. The one
12
+ * thing that is not shareable is what a filter value _looks_ like, so the core
13
+ * carries the rendered type as a parameter and this fills it with `ReactNode`.
14
+ */
15
+ export declare class Filter<T = never, TProp extends PropertyName<T> = never, TMatchValue = never> extends ListFilter<T, TProp, TMatchValue, ReactNode> {
16
+ constructor(context: ListModelContext<T>, shape: FilterShape<T, TProp, TMatchValue>);
17
+ /** The list this filter belongs to — `context`, typed as React's `List`. */
18
+ get list(): List<T>;
37
19
  get values(): FilterValue[];
38
- private get valuesFromTableState();
39
20
  getArrayValue(): FilterValue[];
40
- isValueActive(value: FilterValue): boolean;
41
- isActive(): boolean;
42
- deactivateValue(value: FilterValue): void;
43
- private callOnChangedHandlers;
44
- hasChanges(): boolean;
45
- isStoringAvailable(): boolean;
46
- resetValues(): void;
47
- clear(): void;
48
- toggleValue(newValue: FilterValue): void;
49
- get isSelectAllAvailable(): boolean;
50
- isEveryValueActive(): boolean;
51
- selectAll(): void;
52
- setActiveValueIds(ids: Iterable<unknown>): void;
53
- deselectAll(): void;
54
- private setArrayValue;
55
- onFilterUpdated(cb: () => unknown): void;
56
21
  }
22
+ export default Filter;
@@ -1,13 +1,12 @@
1
1
  import { Filter } from './Filter';
2
- export declare class FilterValue {
2
+ import { ListFilterValue } from '../../../../_bundled/flow-components-base/index';
3
+ import { ReactNode } from 'react';
4
+ /**
5
+ * Framework-free apart from what it renders to, which the core takes as a type
6
+ * parameter — so React's is that class with `ReactNode` filled in, and its
7
+ * filter typed as React's, the one that carries `list`.
8
+ */
9
+ export type FilterValue = ListFilterValue<ReactNode> & {
3
10
  readonly filter: Filter<unknown, string, unknown>;
4
- readonly value: unknown;
5
- readonly id: string;
6
- private constructor();
7
- static create(filter: Filter<any, any, any>, value: unknown): FilterValue;
8
- equals(otherValue: FilterValue): boolean;
9
- get isActive(): boolean;
10
- render(): import('react').ReactNode;
11
- toggle(): void;
12
- deactivate(): void;
13
- }
11
+ };
12
+ export declare const FilterValue: typeof ListFilterValue;
@@ -1,22 +1,10 @@
1
- import { PropertyName, PropertyValue, PropertyValueRenderMethod } from '../types';
2
- import { ItemType } from '../../../../lib/types/array';
3
- import { RangeCalendarProps } from '../../../Calendar';
4
1
  import { DateRangeFilter } from './DateRangeFilter';
5
- export type FilterMode = "all" | "some" | "one" | "dateRange";
6
- export type FilterMatcher<T, P, TMatcherValue> = (filterBy: NonNullable<ItemType<TMatcherValue>>, filterFrom: PropertyValue<T, P>) => boolean;
7
- export interface FilterShape<T, TProp extends PropertyName<T>, TMatcherValue> {
8
- property: TProp;
9
- renderItem?: PropertyValueRenderMethod<TMatcherValue>;
10
- mode?: FilterMode;
11
- matcher?: FilterMatcher<T, TProp, TMatcherValue>;
12
- values?: readonly TMatcherValue[];
13
- name?: string;
14
- defaultSelected?: readonly NonNullable<TMatcherValue>[];
15
- onChange?: FilterUpdatedCallback;
16
- priority?: "primary" | "secondary";
17
- autosave?: boolean;
18
- manualSave?: boolean;
2
+ import { PropertyName } from '../types';
3
+ import { RangeCalendarProps } from '../../../Calendar';
4
+ import { ListFilterShape } from '../../../../_bundled/flow-components-base/index';
5
+ import { ReactNode } from 'react';
6
+ export type { FilterMatcher, FilterMode, FilterUpdatedCallback, } from '../../../../_bundled/flow-components-base/index';
7
+ export interface FilterShape<T, TProp extends PropertyName<T>, TMatcherValue> extends ListFilterShape<T, TProp, TMatcherValue, ReactNode> {
19
8
  dateRangeOptions?: RangeCalendarProps;
20
9
  }
21
- export type FilterUpdatedCallback = (values: unknown[]) => unknown;
22
10
  export type AnyDateRangeFilter = DateRangeFilter | DateRangeFilter<any, any>;
@@ -1,9 +1,10 @@
1
+ import { ListItem } from '../../../../_bundled/flow-components-base/index';
1
2
  import { ItemCollection } from './ItemCollection';
2
- import { Row } from '@tanstack/react-table';
3
- export declare class Item<T> {
4
- readonly id: string;
5
- readonly data: T;
3
+ /**
4
+ * `ListItem` from `@mittwald/flow-components-base`, with its collection typed
5
+ * as React's — the one that carries `list`.
6
+ */
7
+ export type Item<T> = ListItem<T> & {
6
8
  readonly collection: ItemCollection<T>;
7
- constructor(collection: ItemCollection<T>, id: string, data: T);
8
- static fromRow<T>(collection: ItemCollection<T>, row: Row<T>): Item<T>;
9
- }
9
+ };
10
+ export declare const Item: typeof ListItem;
@@ -1,7 +1,12 @@
1
- import { default as List } from '../List';
1
+ import { ListItemCollection } from '../../../../_bundled/flow-components-base/index';
2
2
  import { Item } from './Item';
3
- export declare class ItemCollection<T> {
4
- readonly list: List<T>;
5
- constructor(list: List<T>);
3
+ import { List } from '../List';
4
+ /**
5
+ * React's item collection: `ListItemCollection` from
6
+ * `@mittwald/flow-components-base`, plus `list` — see `Sorting` for why.
7
+ */
8
+ export declare class ItemCollection<T> extends ListItemCollection<T> {
9
+ get list(): List<T>;
6
10
  get entries(): Item<T>[];
7
11
  }
12
+ export default ItemCollection;
@@ -1,30 +1,20 @@
1
- import { ListData } from './types';
2
- import { AsyncResource } from '@mittwald/react-use-promise';
3
1
  import { default as List } from '../List';
4
- type AsyncResourceLoadingState = AsyncResource["state"]["value"];
5
- type DataBatches<T> = ListData<T>[];
6
- type BatchesLoadingState = AsyncResourceLoadingState[];
7
- export declare class IncrementalLoaderState<T> {
8
- dataBatches: DataBatches<T>;
9
- prevDataBatches: DataBatches<T>;
10
- batchLoadingStates: BatchesLoadingState;
11
- metadata?: unknown;
2
+ import { ListLoaderState } from '../../../../_bundled/flow-components-base/index';
3
+ /**
4
+ * React's view of the list's loading state.
5
+ *
6
+ * Everything the state _is_ — the batches, the deduplication, what counts as
7
+ * loading — lives in `ListLoaderState` in `@mittwald/flow-components-base`, so
8
+ * the Vue binding runs the same rules rather than a second implementation of
9
+ * them. What is left here is the subscription: MobX is framework-agnostic,
10
+ * reading it in a component is not.
11
+ */
12
+ export declare class IncrementalLoaderState<T> extends ListLoaderState<T> {
12
13
  readonly list: List<T>;
13
- isInitiallyLoading: boolean;
14
14
  private constructor();
15
15
  static useNew<T>(list: List<T>): IncrementalLoaderState<T>;
16
- reset(): void;
17
- setDataBatch(index: number, data: ListData<T>): void;
18
- setBatchLoadingState(index: number, state: AsyncResourceLoadingState): void;
19
- setMetadata(metadata?: unknown): void;
20
- setIsInitiallyLoading(isInitiallyLoading: boolean): void;
21
- get mergedData(): T[];
22
16
  useMergedData(): T[];
23
- get isLoading(): boolean;
24
17
  useIsLoading(): boolean;
25
- get isLoadingMore(): boolean;
26
18
  useIsLoadingMore(): boolean;
27
19
  useIsInitiallyLoading(): boolean;
28
- isBatchLoaded(batchIndex: number): boolean;
29
20
  }
30
- export {};
@@ -1,31 +1,11 @@
1
- import { PropertyRecord } from '../types';
2
- import { FilterMode } from '../filter/types';
1
+ import { ListAsyncDataLoader, ListData, ListDataLoaderOptions, ListDataLoaderResult } from '../../../../_bundled/flow-components-base/index';
3
2
  import { AsyncResource } from '@mittwald/react-use-promise';
4
- import { SearchValue } from '../search/types';
5
3
  import { DependencyList } from 'react';
6
- type DataLoaderSortOptions<T> = PropertyRecord<T, "asc" | "desc">;
7
- type DataLoaderFilterOptions<T> = PropertyRecord<T, {
8
- mode: FilterMode;
9
- values: unknown[];
10
- }>;
11
- interface DataLoaderPaginationOptions {
12
- offset: number;
13
- limit: number;
14
- }
15
- export interface DataLoaderOptions<T> {
16
- sorting?: DataLoaderSortOptions<T>;
17
- filtering?: DataLoaderFilterOptions<T>;
18
- searchString?: SearchValue;
19
- pagination?: DataLoaderPaginationOptions;
20
- }
21
- export type ListData<T> = readonly T[];
22
- export interface DataLoaderResult<T> {
23
- data: ListData<T>;
24
- itemTotalCount?: number;
25
- metadata?: unknown;
26
- }
4
+ export type DataLoaderOptions<T> = ListDataLoaderOptions<T>;
5
+ export type DataLoaderResult<T> = ListDataLoaderResult<T>;
6
+ export type { ListData };
27
7
  export type HooksDataLoader<T> = (options: DataLoaderOptions<T>) => DataLoaderResult<T>;
28
- export type AsyncDataLoader<T> = (options: DataLoaderOptions<T>) => Promise<DataLoaderResult<T>>;
8
+ export type AsyncDataLoader<T> = ListAsyncDataLoader<T>;
29
9
  export type AsyncResourceFactory<T> = (options?: DataLoaderOptions<T>) => AsyncResource<DataLoaderResult<T>>;
30
10
  interface DynamicLoaderShape {
31
11
  manualSorting?: boolean;
@@ -64,4 +44,3 @@ export interface LoaderInvocationHook {
64
44
  useLoadBatch: () => void;
65
45
  useRenderSuspense: () => void;
66
46
  }
67
- export {};
@@ -1,15 +1 @@
1
- import { default as List } from '../List';
2
- import { BatchesControllerShape } from './types';
3
- export declare class BatchesController<T> {
4
- readonly batchSize: number;
5
- private readonly list;
6
- constructor(list: List<T>, shape?: BatchesControllerShape);
7
- private get reactTable();
8
- getBatchIndex(): number;
9
- hasNextBatch(): boolean;
10
- getTotalItemsCount(): number;
11
- getVisibleItemsCount(): number;
12
- updateItemTotalCount(value: number): void;
13
- reset(): void;
14
- nextBatch(): void;
15
- }
1
+ export { ListBatchesController as BatchesController } from '../../../../_bundled/flow-components-base/index';
@@ -1,3 +1 @@
1
- export interface BatchesControllerShape {
2
- batchSize?: number;
3
- }
1
+ export type { ListBatchesControllerShape as BatchesControllerShape } from '../../../../_bundled/flow-components-base/index';
@@ -1,21 +1,18 @@
1
- import { default as List } from '../List';
2
- import { SearchFieldRenderComponent, SearchShape, SearchValue } from './types';
3
- import { InitialTableState } from '@tanstack/react-table';
4
- export declare class Search<T> {
5
- readonly list: List<T>;
6
- readonly render?: SearchFieldRenderComponent;
1
+ import { SearchShape } from './types';
2
+ import { ListModelContext, ListSearch } from '../../../../_bundled/flow-components-base/index';
3
+ import { List } from '../List';
4
+ /**
5
+ * React's search: the shared one plus how the field is rendered.
6
+ *
7
+ * The term, its initial value and its persistence are `ListSearch` in
8
+ * `@mittwald/flow-components-base`. `render` and `textFieldProps` stay here — a
9
+ * component type and Flow's `SearchField` props are React, and a binding brings
10
+ * its own.
11
+ */
12
+ export declare class Search<T> extends ListSearch<T> {
13
+ readonly render?: SearchShape<T>["render"];
7
14
  readonly textFieldProps: SearchShape<T>["textFieldProps"];
8
- private onUpdateCallbacks;
9
- private readonly initialValue?;
10
- private readonly defaultValue?;
11
- private readonly autosave;
12
- constructor(list: List<T>, searchShape: SearchShape<T>);
13
- get value(): SearchValue;
14
- get isSet(): boolean;
15
- private callOnUpdateCallbacks;
16
- private getInitialValue;
17
- updateInitialState(initialState: InitialTableState): void;
18
- setValue(value: SearchValue): void;
19
- clear(): void;
20
- onUpdated(cb: () => unknown): void;
15
+ constructor(context: ListModelContext<T>, shape: SearchShape<T>);
16
+ /** The list this search belongs to — `context`, typed as React's `List`. */
17
+ get list(): List<T>;
21
18
  }