@gtkx/components 2.0.0-beta.5 → 2.0.0-beta.7

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/src/list-view.tsx CHANGED
@@ -8,6 +8,7 @@ import { useCollection } from "./internal/use-collection.js";
8
8
  const LIST_VIEW_PROPS = [
9
9
  "items",
10
10
  "sections",
11
+ "isFlat",
11
12
  "renderItem",
12
13
  "renderHeader",
13
14
  "selectedIds",
package/src/types.ts CHANGED
@@ -90,6 +90,16 @@ type ItemSizeProps = {
90
90
  estimatedItemWidth?: number | undefined;
91
91
  };
92
92
 
93
+ /** The flat-collection hint shared by {@link ListView} and {@link ColumnView}. */
94
+ type FlatnessProps = {
95
+ /**
96
+ * Declares every item a leaf, so the view skips tree discovery when synchronising a large collection
97
+ * instead of scanning each item for `children`. Must not be set when any item has children: those
98
+ * items would render as plain rows that never expand.
99
+ */
100
+ isFlat?: boolean | undefined;
101
+ };
102
+
93
103
  /** Controlled selection shared by the multi-item collection views. */
94
104
  type SelectionProps = {
95
105
  /**
@@ -172,6 +182,7 @@ type ColumnViewOwnProps<T, S> = SelectionProps &
172
182
  ExpansionProps &
173
183
  SortProps &
174
184
  SourceProps<T, S> &
185
+ FlatnessProps &
175
186
  Omit<ItemSizeProps, "estimatedItemWidth"> & {
176
187
  /** Columns to render, in order; each carries its own cell renderer. */
177
188
  columns: ColumnViewColumn<T>[];
@@ -242,7 +253,8 @@ type GridViewProps<T = unknown> = Omit<GtkGridViewProps, "model" | "factory" | k
242
253
  type ListViewOwnProps<T, S> = ItemSizeProps &
243
254
  SelectionProps &
244
255
  ExpansionProps &
245
- SourceProps<T, S> & {
256
+ SourceProps<T, S> &
257
+ FlatnessProps & {
246
258
  /** Renders the contents of one row. */
247
259
  renderItem: ListItemRenderer<T>;
248
260
  /** Renders the header shown above each section. */