@tur-ng/std 0.0.10 → 0.0.11
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/package.json +2 -2
- package/src/index.d.ts +40 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tur-ng/std",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "src/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -16,6 +16,6 @@
|
|
|
16
16
|
"directory": "js/packages/tur-std"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@tur-ng/core": "0.0.
|
|
19
|
+
"@tur-ng/core": "0.0.8"
|
|
20
20
|
}
|
|
21
21
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -422,6 +422,45 @@ declare module "tur:std" {
|
|
|
422
422
|
queryKey?: Val<string[]>;
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
+
/** One `Table.columns` entry. `width` = fixed px; `flex` = share of the
|
|
426
|
+
* leftover width (proportional to the total flex weight). A column with
|
|
427
|
+
* neither defaults to `flex: 1`. `minWidth` clamps the distributed
|
|
428
|
+
* share up (may overflow the available width). */
|
|
429
|
+
export interface TableColumnDef {
|
|
430
|
+
width?: number;
|
|
431
|
+
flex?: number;
|
|
432
|
+
minWidth?: number;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/** A non-scrollable data table with shared column geometry: the header
|
|
436
|
+
* row and every body row lay their cells at the same resolved column
|
|
437
|
+
* widths (CSS `table-layout: fixed` semantics). `rows` is a reactive
|
|
438
|
+
* array — writing a new array value rebuilds the row subtrees (write a
|
|
439
|
+
* fresh array; in-place mutation of the same array object with an
|
|
440
|
+
* unchanged length is not observed). `build` returns one row's cells,
|
|
441
|
+
* positionally mapped to the columns: a `null` entry is an empty cell
|
|
442
|
+
* box (the column advances), entries beyond the column count are
|
|
443
|
+
* ignored. `buildHeader` follows the same mapping and runs ONCE at
|
|
444
|
+
* build — reactive header content flows through `Val` props inside
|
|
445
|
+
* the returned cells. Without an extent, a row's height is the max
|
|
446
|
+
* intrinsic cell height (cells get loose height constraints); with
|
|
447
|
+
* one, cells fill it. Wrap in a `ScrollView` to scroll. */
|
|
448
|
+
export interface TableProps<T> {
|
|
449
|
+
columns: TableColumnDef[];
|
|
450
|
+
rows: Readable<T[]>;
|
|
451
|
+
build: (item: T, index: number) => (Element | null)[];
|
|
452
|
+
buildHeader?: () => (Element | null)[];
|
|
453
|
+
headerExtent?: Val<number>;
|
|
454
|
+
rowExtent?: Val<number>;
|
|
455
|
+
rowSpacing?: Val<number>;
|
|
456
|
+
/** Painted under odd body rows. */
|
|
457
|
+
stripeColor?: Val<Brush | null>;
|
|
458
|
+
/** Horizontal rules between body rows + under the header. */
|
|
459
|
+
dividerColor?: Val<Brush | null>;
|
|
460
|
+
dividerThickness?: Val<number>;
|
|
461
|
+
queryKey?: Val<string[]>;
|
|
462
|
+
}
|
|
463
|
+
|
|
425
464
|
export interface EachProps<T> {
|
|
426
465
|
items: Readable<T[]>;
|
|
427
466
|
build: (item: T, index: number) => Element;
|
|
@@ -664,6 +703,7 @@ declare module "tur:std" {
|
|
|
664
703
|
export function Each<T>(props: EachProps<T>): Element;
|
|
665
704
|
export function LazyList(props: LazyListProps): Element;
|
|
666
705
|
export function Grid(props: GridProps): Element;
|
|
706
|
+
export function Table<T>(props: TableProps<T>): Element;
|
|
667
707
|
export function LazyGrid(props: LazyGridProps): Element;
|
|
668
708
|
export function ScrollView(props: ScrollViewProps): Element;
|
|
669
709
|
export function Scrollbar(props: ScrollbarProps): Element;
|