@homebound/beam 2.121.1 → 2.122.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/dist/components/Modal/TestModalContent.js +1 -1
- package/dist/components/Table/GridTable.d.ts +2 -1
- package/dist/components/Table/GridTable.js +2 -7
- package/dist/components/Table/columns.js +2 -2
- package/dist/components/Table/index.d.ts +2 -2
- package/dist/components/Table/index.js +1 -2
- package/dist/components/Table/simpleHelpers.d.ts +4 -12
- package/dist/components/Table/simpleHelpers.js +3 -8
- package/package.json +1 -1
|
@@ -42,7 +42,7 @@ const users = [
|
|
|
42
42
|
{ id: "9", name: "Captain Marvel", role: "Does it all" },
|
|
43
43
|
{ id: "10", name: "Doctor Strange", role: "Doctor" },
|
|
44
44
|
];
|
|
45
|
-
const rows = [Table_1.simpleHeader, ...users.map((u) => ({ kind: "data",
|
|
45
|
+
const rows = [Table_1.simpleHeader, ...users.map((u) => ({ kind: "data", id: u.id, data: u }))];
|
|
46
46
|
const columns = [
|
|
47
47
|
{ header: () => "Name", data: ({ name }) => name },
|
|
48
48
|
{ header: () => "Role", data: ({ role }) => role },
|
|
@@ -232,7 +232,7 @@ declare type GridRowKind<R extends Kinded, P extends R["kind"]> = DiscriminateUn
|
|
|
232
232
|
export declare type GridColumn<R extends Kinded, S = {}> = {
|
|
233
233
|
[K in R["kind"]]: string | GridCellContent | (DiscriminateUnion<R, "kind", K> extends {
|
|
234
234
|
data: infer D;
|
|
235
|
-
} ? (data: D, row: GridRowKind<R, K>, api: GridTableApi<R>) => ReactNode | GridCellContent : (row: GridRowKind<R, K>, api: GridTableApi<R>) => ReactNode | GridCellContent);
|
|
235
|
+
} ? (data: D, row: GridRowKind<R, K>, api: GridTableApi<R>) => ReactNode | GridCellContent : (data: undefined, row: GridRowKind<R, K>, api: GridTableApi<R>) => ReactNode | GridCellContent);
|
|
236
236
|
} & {
|
|
237
237
|
/**
|
|
238
238
|
* The column's width.
|
|
@@ -313,6 +313,7 @@ export declare type GridDataRow<R extends Kinded> = {
|
|
|
313
313
|
children?: GridDataRow<R>[];
|
|
314
314
|
/** Whether to pin this sort to the first/last of its parent's children. */
|
|
315
315
|
pin?: "first" | "last";
|
|
316
|
+
data: unknown;
|
|
316
317
|
} & IfAny<R, {}, DiscriminateUnion<R, "kind", R["kind"]>>;
|
|
317
318
|
declare type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
|
|
318
319
|
/** Return the content for a given column def applied to a given row. */
|
|
@@ -641,13 +641,8 @@ function applyRowFn(column, row, api) {
|
|
|
641
641
|
// Usually this is a function to apply against the row, but sometimes it's a hard-coded value, i.e. for headers
|
|
642
642
|
const maybeContent = column[row.kind];
|
|
643
643
|
if (typeof maybeContent === "function") {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
return maybeContent(row["data"], row["id"], api);
|
|
647
|
-
}
|
|
648
|
-
else {
|
|
649
|
-
return maybeContent(row, api);
|
|
650
|
-
}
|
|
644
|
+
// Auto-destructure data
|
|
645
|
+
return maybeContent(row["data"], row, api);
|
|
651
646
|
}
|
|
652
647
|
else {
|
|
653
648
|
return maybeContent;
|
|
@@ -46,7 +46,7 @@ function selectColumn(columnDef) {
|
|
|
46
46
|
...columnDef,
|
|
47
47
|
};
|
|
48
48
|
return (0, index_1.newMethodMissingProxy)(base, (key) => {
|
|
49
|
-
return (row) => ({ content: (0, jsx_runtime_1.jsx)(SelectToggle_1.SelectToggle, { id: row.id }, void 0) });
|
|
49
|
+
return (data, row) => ({ content: (0, jsx_runtime_1.jsx)(SelectToggle_1.SelectToggle, { id: row.id }, void 0) });
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
exports.selectColumn = selectColumn;
|
|
@@ -68,7 +68,7 @@ function collapseColumn(columnDef) {
|
|
|
68
68
|
...columnDef,
|
|
69
69
|
};
|
|
70
70
|
return (0, index_1.newMethodMissingProxy)(base, (key) => {
|
|
71
|
-
return (row) => ({ content: (0, jsx_runtime_1.jsx)(CollapseToggle_1.CollapseToggle, { row: row }, void 0) });
|
|
71
|
+
return (data, row) => ({ content: (0, jsx_runtime_1.jsx)(CollapseToggle_1.CollapseToggle, { row: row }, void 0) });
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
exports.collapseColumn = collapseColumn;
|
|
@@ -8,7 +8,7 @@ export { useGridTableApi } from "./GridTableApi";
|
|
|
8
8
|
export type { GridTableApi } from "./GridTableApi";
|
|
9
9
|
export { RowState, RowStateContext } from "./RowState";
|
|
10
10
|
export * from "./SelectToggle";
|
|
11
|
-
export { simpleDataRows, simpleHeader
|
|
12
|
-
export type {
|
|
11
|
+
export { simpleDataRows, simpleHeader } from "./simpleHelpers";
|
|
12
|
+
export type { SimpleHeaderAndData } from "./simpleHelpers";
|
|
13
13
|
export { SortHeader } from "./SortHeader";
|
|
14
14
|
export { beamFixedStyle, beamFlexibleStyle, beamNestedFixedStyle, beamNestedFlexibleStyle, beamTotalsFixedStyle, beamTotalsFlexibleStyle, cardStyle, condensedStyle, defaultStyle, } from "./styles";
|
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.defaultStyle = exports.condensedStyle = exports.cardStyle = exports.beamTotalsFlexibleStyle = exports.beamTotalsFixedStyle = exports.beamNestedFlexibleStyle = exports.beamNestedFixedStyle = exports.beamFlexibleStyle = exports.beamFixedStyle = exports.SortHeader = exports.
|
|
13
|
+
exports.defaultStyle = exports.condensedStyle = exports.cardStyle = exports.beamTotalsFlexibleStyle = exports.beamTotalsFixedStyle = exports.beamNestedFlexibleStyle = exports.beamNestedFixedStyle = exports.beamFlexibleStyle = exports.beamFixedStyle = exports.SortHeader = exports.simpleHeader = exports.simpleDataRows = exports.RowStateContext = exports.RowState = exports.useGridTableApi = exports.setGridTableDefaults = exports.setDefaultStyle = exports.GridTable = exports.DESC = exports.ASC = exports.GridSortContext = void 0;
|
|
14
14
|
__exportStar(require("./CollapseToggle"), exports);
|
|
15
15
|
__exportStar(require("./columns"), exports);
|
|
16
16
|
var GridSortContext_1 = require("./GridSortContext");
|
|
@@ -30,7 +30,6 @@ __exportStar(require("./SelectToggle"), exports);
|
|
|
30
30
|
var simpleHelpers_1 = require("./simpleHelpers");
|
|
31
31
|
Object.defineProperty(exports, "simpleDataRows", { enumerable: true, get: function () { return simpleHelpers_1.simpleDataRows; } });
|
|
32
32
|
Object.defineProperty(exports, "simpleHeader", { enumerable: true, get: function () { return simpleHelpers_1.simpleHeader; } });
|
|
33
|
-
Object.defineProperty(exports, "simpleRows", { enumerable: true, get: function () { return simpleHelpers_1.simpleRows; } });
|
|
34
33
|
var SortHeader_1 = require("./SortHeader");
|
|
35
34
|
Object.defineProperty(exports, "SortHeader", { enumerable: true, get: function () { return SortHeader_1.SortHeader; } });
|
|
36
35
|
var styles_1 = require("./styles");
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { GridDataRow } from "./GridTable";
|
|
2
|
-
/** A helper for making `Row` type aliases of simple/flat tables that are just header + data. */
|
|
3
|
-
export declare type SimpleHeaderAndDataOf<T> = {
|
|
4
|
-
kind: "header";
|
|
5
|
-
} | ({
|
|
6
|
-
kind: "data";
|
|
7
|
-
} & T);
|
|
8
2
|
/**
|
|
9
3
|
* A helper for making `Row` type aliases of simple/flat tables that are just header + data.
|
|
10
4
|
*
|
|
@@ -12,7 +6,7 @@ export declare type SimpleHeaderAndDataOf<T> = {
|
|
|
12
6
|
* when rows are mobx proxies and we need proxy accesses to happen within the column
|
|
13
7
|
* rendering.
|
|
14
8
|
*/
|
|
15
|
-
export declare type
|
|
9
|
+
export declare type SimpleHeaderAndData<T> = {
|
|
16
10
|
kind: "header";
|
|
17
11
|
} | {
|
|
18
12
|
kind: "data";
|
|
@@ -23,11 +17,9 @@ export declare type SimpleHeaderAndDataWith<T> = {
|
|
|
23
17
|
export declare const simpleHeader: {
|
|
24
18
|
kind: "header";
|
|
25
19
|
id: string;
|
|
20
|
+
data: {};
|
|
26
21
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}> | undefined): GridDataRow<R>[];
|
|
30
|
-
/** Like `simpleRows` but for `SimpleHeaderAndDataWith`. */
|
|
31
|
-
export declare function simpleDataRows<R extends SimpleHeaderAndDataWith<D>, D>(data?: Array<D & {
|
|
22
|
+
/** Like `simpleRows` but for `SimpleHeaderAndData`. */
|
|
23
|
+
export declare function simpleDataRows<R extends SimpleHeaderAndData<D>, D>(data?: Array<D & {
|
|
32
24
|
id: string;
|
|
33
25
|
}> | undefined): GridDataRow<R>[];
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.simpleDataRows = exports.
|
|
3
|
+
exports.simpleDataRows = exports.simpleHeader = void 0;
|
|
4
4
|
/** A const for a marker header row. */
|
|
5
|
-
exports.simpleHeader = { kind: "header", id: "header" };
|
|
6
|
-
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
return [exports.simpleHeader, ...data.map((c) => ({ kind: "data", ...c }))];
|
|
9
|
-
}
|
|
10
|
-
exports.simpleRows = simpleRows;
|
|
11
|
-
/** Like `simpleRows` but for `SimpleHeaderAndDataWith`. */
|
|
5
|
+
exports.simpleHeader = { kind: "header", id: "header", data: {} };
|
|
6
|
+
/** Like `simpleRows` but for `SimpleHeaderAndData`. */
|
|
12
7
|
function simpleDataRows(data = []) {
|
|
13
8
|
// @ts-ignore Not sure why this doesn't type-check, something esoteric with the DiscriminateUnion type
|
|
14
9
|
return [exports.simpleHeader, ...data.map((data) => ({ kind: "data", data, id: data.id }))];
|