@mittwald/flow-react-components 1.6.0-next.20 → 1.6.0-next.21
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/assets/component-index.json +1 -1
- package/dist/assets/doc-properties.json +1 -1
- package/dist/js/default.mjs +1 -1
- package/dist/js/packages/components/src/components/List/components/Items/Items.mjs +3 -0
- package/dist/js/packages/components/src/components/List/components/Items/Items.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/components/Items/components/Item/Item.mjs +1 -1
- package/dist/js/packages/components/src/components/List/components/Items/components/Item/Item.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/components/Items/components/Item/hooks/useGridItemProps.mjs +1 -2
- package/dist/js/packages/components/src/components/List/components/Items/components/Item/hooks/useGridItemProps.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/components/Table/Table.mjs +8 -12
- package/dist/js/packages/components/src/components/List/components/Table/Table.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/components/Table/components/Row.mjs +31 -0
- package/dist/js/packages/components/src/components/List/components/Table/components/Row.mjs.map +1 -0
- package/dist/js/packages/components/src/components/List/hooks/useLatestOnAction.mjs +21 -0
- package/dist/js/packages/components/src/components/List/hooks/useLatestOnAction.mjs.map +1 -0
- package/dist/js/packages/components/src/components/List/model/List.mjs +1 -0
- package/dist/js/packages/components/src/components/List/model/List.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/model/item/ItemView.mjs +20 -7
- package/dist/js/packages/components/src/components/List/model/item/ItemView.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/model/table/TableCell.mjs +1 -1
- package/dist/js/packages/components/src/components/List/model/table/TableCell.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/model/table/TableRow.mjs +28 -1
- package/dist/js/packages/components/src/components/List/model/table/TableRow.mjs.map +1 -1
- package/dist/types/components/List/components/Items/components/Item/Item.d.ts +2 -0
- package/dist/types/components/List/components/Items/components/Item/hooks/useGridItemProps.d.ts +1 -0
- package/dist/types/components/List/components/Table/components/Row.d.ts +13 -0
- package/dist/types/components/List/hooks/useLatestOnAction.d.ts +7 -0
- package/dist/types/components/List/model/item/ItemView.d.ts +34 -11
- package/dist/types/components/List/model/table/TableRow.d.ts +14 -0
- package/dist/types/components/List/model/table/types.d.ts +17 -1
- package/dist/types/components/List/typedList.d.ts +1 -0
- package/package.json +10 -10
|
@@ -2,7 +2,15 @@ import { DependencyList, HTMLAttributeAnchorTarget, ReactElement, ReactNode } fr
|
|
|
2
2
|
import { RenderItemFn } from './types';
|
|
3
3
|
import { default as List } from '../List';
|
|
4
4
|
export interface ItemViewShape<T> {
|
|
5
|
+
/**
|
|
6
|
+
* Runs on every render of the list to tell whether the item changed, so it
|
|
7
|
+
* should be cheap and pure.
|
|
8
|
+
*/
|
|
5
9
|
textValue?: (data: T) => string;
|
|
10
|
+
/**
|
|
11
|
+
* Runs on every render of the list to tell whether the item changed, so it
|
|
12
|
+
* should be cheap and pure.
|
|
13
|
+
*/
|
|
6
14
|
href?: (data: T) => string;
|
|
7
15
|
target?: HTMLAttributeAnchorTarget;
|
|
8
16
|
defaultExpanded?: (data: T) => boolean;
|
|
@@ -14,14 +22,23 @@ export interface ItemViewShape<T> {
|
|
|
14
22
|
showTiles?: boolean;
|
|
15
23
|
tileMaxWidth?: number;
|
|
16
24
|
/**
|
|
17
|
-
*
|
|
25
|
+
* Everything the render function reads besides the item's data.
|
|
18
26
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* inline in JSX
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
27
|
+
* With `renderDependencies`, an item re-renders only when its data or one of
|
|
28
|
+
* these values changes. The render function's identity no longer counts, so a
|
|
29
|
+
* function written inline in JSX keeps the item from re-rendering on every
|
|
30
|
+
* render of its parent. List every value it reads from outside the item,
|
|
31
|
+
* including state read through the `list` argument — one left out keeps the
|
|
32
|
+
* item on the value it last rendered.
|
|
33
|
+
*
|
|
34
|
+
* Without it, an item re-renders whenever its render function changes
|
|
35
|
+
* identity, which an inline function does on every render of its parent.
|
|
36
|
+
*/
|
|
37
|
+
renderDependencies?: DependencyList;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated Use `renderDependencies` instead. `dependencies` only adds to
|
|
40
|
+
* the render function's identity, so an inline render function still
|
|
41
|
+
* re-renders the item on every render of its parent.
|
|
25
42
|
*/
|
|
26
43
|
dependencies?: DependencyList;
|
|
27
44
|
}
|
|
@@ -35,15 +52,21 @@ export declare class ItemView<T> {
|
|
|
35
52
|
readonly showTiles?: boolean;
|
|
36
53
|
readonly showList?: boolean;
|
|
37
54
|
readonly tileMaxWidth: number;
|
|
55
|
+
readonly renderDependencies?: DependencyList;
|
|
38
56
|
readonly dependencies?: DependencyList;
|
|
39
57
|
private readonly renderFn?;
|
|
58
|
+
private lastComparison?;
|
|
40
59
|
constructor(list: List<T>, shape?: ItemViewShape<T>);
|
|
41
60
|
private static fallbackRenderItemFn;
|
|
42
61
|
/**
|
|
43
|
-
* Whether `other` would render
|
|
44
|
-
*
|
|
45
|
-
* and the dependencies
|
|
62
|
+
* Whether `other` would render the item holding `data` identically. The
|
|
63
|
+
* render function counts by its `renderDependencies` where given, otherwise
|
|
64
|
+
* by its identity and the deprecated `dependencies`. `textValue` and `href`
|
|
65
|
+
* count by what they return for `data`, so inline functions do not re-render
|
|
66
|
+
* the item. `defaultExpanded` is read on mount only, so it does not count at
|
|
67
|
+
* all.
|
|
46
68
|
*/
|
|
47
|
-
|
|
69
|
+
rendersSameFor(other: ItemView<T> | undefined, data: T): boolean;
|
|
70
|
+
private rendersSameContentAs;
|
|
48
71
|
render(data: T): ReactNode;
|
|
49
72
|
}
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import { TableRowShape, TableRowSupportedComponentProps } from './types';
|
|
2
2
|
import { TableCell } from './TableCell';
|
|
3
3
|
import { TableBody } from './TableBody';
|
|
4
|
+
import { DependencyList } from 'react';
|
|
4
5
|
export declare class TableRow<T> {
|
|
5
6
|
readonly tableBody: TableBody<T>;
|
|
6
7
|
readonly cells: TableCell<T>[];
|
|
7
8
|
readonly componentProps: TableRowSupportedComponentProps;
|
|
9
|
+
readonly renderDependencies?: DependencyList;
|
|
10
|
+
private lastComparison?;
|
|
8
11
|
constructor(tableBody: TableBody<T>, shape?: TableRowShape<T>);
|
|
12
|
+
/**
|
|
13
|
+
* Whether `other` would render a row identically. Only rows that declare
|
|
14
|
+
* `renderDependencies` can tell, since the cells' render functions count by
|
|
15
|
+
* those instead of their identity. Rows without them always re-render. Row
|
|
16
|
+
* and cell props count by identity, one by one.
|
|
17
|
+
*
|
|
18
|
+
* Every row of a render shares one model, so the result is cached for the
|
|
19
|
+
* last `other`.
|
|
20
|
+
*/
|
|
21
|
+
rendersSameAs(other?: TableRow<T>): boolean;
|
|
22
|
+
private compareWith;
|
|
9
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren, ReactElement } from 'react';
|
|
1
|
+
import { DependencyList, PropsWithChildren, ReactElement } from 'react';
|
|
2
2
|
import { TableBodyProps, TableCellProps, TableColumnProps, TableHeaderProps, TableProps, TableRowProps } from '../../../Table';
|
|
3
3
|
import { RenderItemFn } from '../..';
|
|
4
4
|
/** Cell */
|
|
@@ -13,6 +13,22 @@ export type TableRowSupportedComponentProps = Omit<TableRowProps, "onAction" | "
|
|
|
13
13
|
};
|
|
14
14
|
export interface TableRowShape<T> extends TableRowSupportedComponentProps, PropsWithChildren {
|
|
15
15
|
cells?: TableCellShape<T>[];
|
|
16
|
+
/**
|
|
17
|
+
* Everything the cells' render functions read besides the row's data.
|
|
18
|
+
*
|
|
19
|
+
* With `renderDependencies`, a row re-renders only when its data, one of
|
|
20
|
+
* these values, or a cell's props change. The render functions' identity does
|
|
21
|
+
* not count, so functions written inline in JSX keep the row from
|
|
22
|
+
* re-rendering on every render of its parent. List every value they read from
|
|
23
|
+
* outside the row, including state read through the `list` argument — one
|
|
24
|
+
* left out keeps the row on the value it last rendered.
|
|
25
|
+
*
|
|
26
|
+
* Row and cell props count by identity, so an inline `style` object or
|
|
27
|
+
* callback on `List.TableRow` or `List.TableCell` re-renders every row.
|
|
28
|
+
*
|
|
29
|
+
* Without it, every row re-renders whenever the list does.
|
|
30
|
+
*/
|
|
31
|
+
renderDependencies?: DependencyList;
|
|
16
32
|
}
|
|
17
33
|
/** Column */
|
|
18
34
|
export type TableColumnSupportedComponentProps = TableColumnProps;
|
|
@@ -127,6 +127,7 @@ export declare const typedList: <T, TMeta = unknown>() => {
|
|
|
127
127
|
columns?: Iterable<never> | undefined;
|
|
128
128
|
disabledBehavior?: import('react-stately').DisabledBehavior | undefined;
|
|
129
129
|
hasChildItems?: boolean | undefined;
|
|
130
|
+
renderDependencies?: import('react').DependencyList | undefined;
|
|
130
131
|
}) => null;
|
|
131
132
|
TableCell: (ignoredProps: Omit<import('./model/table/types').TableCellShape<T>, "renderFn"> & {
|
|
132
133
|
children: import('.').RenderItemFn<T>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "1.6.0-next.
|
|
3
|
+
"version": "1.6.0-next.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://flow.mittwald.de",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
"@internationalized/string-compiler": "^3.4.1",
|
|
85
85
|
"@lezer/common": "^1.5.2",
|
|
86
86
|
"@lezer/highlight": "^1.2.3",
|
|
87
|
-
"@mittwald/flow-icons": "^1.6.0-next.
|
|
87
|
+
"@mittwald/flow-icons": "^1.6.0-next.21",
|
|
88
88
|
"@mittwald/password-tools-js": "^3.0.0",
|
|
89
|
-
"@mittwald/react-tunnel": "^1.6.0-next.
|
|
89
|
+
"@mittwald/react-tunnel": "^1.6.0-next.21",
|
|
90
90
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
91
91
|
"@react-aria/form": "^3.2.1",
|
|
92
92
|
"@react-aria/i18n": "^3.13.1",
|
|
@@ -139,13 +139,13 @@
|
|
|
139
139
|
"@internationalized/date": "^3.12.3",
|
|
140
140
|
"@lezer/generator": "^1.8.0",
|
|
141
141
|
"@lezer/lr": "^1.4.10",
|
|
142
|
-
"@mittwald/flow-components-base": "1.6.0-next.
|
|
143
|
-
"@mittwald/flow-core": "1.6.0-next.
|
|
144
|
-
"@mittwald/flow-design-tokens": "1.6.0-next.
|
|
145
|
-
"@mittwald/flow-icons-base": "1.6.0-next.
|
|
142
|
+
"@mittwald/flow-components-base": "1.6.0-next.21",
|
|
143
|
+
"@mittwald/flow-core": "1.6.0-next.21",
|
|
144
|
+
"@mittwald/flow-design-tokens": "1.6.0-next.21",
|
|
145
|
+
"@mittwald/flow-icons-base": "1.6.0-next.21",
|
|
146
146
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
147
147
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.10",
|
|
148
|
-
"@mittwald/typescript-config": "1.6.0-next.
|
|
148
|
+
"@mittwald/typescript-config": "1.6.0-next.21",
|
|
149
149
|
"@nx/storybook": "^22.7.6",
|
|
150
150
|
"@storybook/addon-a11y": "^10.5.10",
|
|
151
151
|
"@storybook/addon-actions": "^9.0.8",
|
|
@@ -199,7 +199,7 @@
|
|
|
199
199
|
},
|
|
200
200
|
"peerDependencies": {
|
|
201
201
|
"@internationalized/date": "^3.12.2",
|
|
202
|
-
"@mittwald/flow-icons-pro": "1.6.0-next.
|
|
202
|
+
"@mittwald/flow-icons-pro": "1.6.0-next.21",
|
|
203
203
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
204
204
|
"next": "^16.2.3",
|
|
205
205
|
"react": "^19.2.0",
|
|
@@ -223,5 +223,5 @@
|
|
|
223
223
|
"browserslist": [
|
|
224
224
|
"baseline widely available"
|
|
225
225
|
],
|
|
226
|
-
"gitHead": "
|
|
226
|
+
"gitHead": "c75ca489f4a68d285b3a7513fab391ef31978680"
|
|
227
227
|
}
|