[UI] Nested bom (#12952)

* [UI] Replace BOM subassembly table

- Do not render as a separate table
- Dynamically load and insert subassembly data
- Retains single table layout
- Observe same column setup

* Adjust alignment of icons

* Hide certain icons for nested rows

* Display subassembly quantity chain

* Display full multiplication chain

* Add nested pricing multipliers

* Display the multiplied "can-build" quantity

* Updated BOM docs

* Playwright tests

* Handle case where can_build is zero

* Refresh nested BOM when underlying records change

* Remove trunc for display

* fix playwright test
This commit is contained in:
Oliver authored and GitHub committed 2026-10-13 22:59:51 +11:00
1 parent 445fa3e125
commit 99893f3453
9 files changed
+710 -179

No files matched your search

+23
View File
@@ -192,9 +192,11 @@ export type RowViewProps = RowAction & RowModelProps & RowViewBehaviorProps;
* @param onRowClick : (record: any, index: number, event: any) => void - Callback function when a row is clicked
* @param onCellClick : (event: any, record: any, index: number, column: any, columnIndex: number) => void - Callback function when a cell is clicked
* @param modelType: ModelType - The model type for the table
* @param rowStyle: (record: any, index: number) => MantineStyleProp - Callback function to apply custom styling to each row
* @param height: string | number - Height of the table (default = 'auto')
* @param minHeight: number - Minimum height of the table (default 300px)
* @param noHeader: boolean - Hide the table header
* @param nestedRows: InvenTreeTableNestedRowProps - Configuration for displaying nested (child) rows within the table
*/
export type InvenTreeTableProps<T = any> = {
params?: any;
@@ -232,6 +234,27 @@ export type InvenTreeTableProps<T = any> = {
height?: string | number;
minHeight?: number;
noHeader?: boolean;
nestedRows?: InvenTreeTableNestedRowProps<T>;
};
/**
* Configuration for displaying nested (child) rows within a table.
*
* Child rows are fetched on demand from the same API endpoint as the table,
* and inserted directly below their parent row - sharing the same columns.
* Child rows are discarded whenever the top-level table data is reloaded,
* or when this configuration object changes - so it should be memoized.
*
* @param accessor - Column accessor used to display the expansion icon and indentation (defaults to the first column)
* @param expandable - Callback to determine if a given record can be expanded
* @param childParams - Callback which returns the query parameters used to fetch child rows for a given record
* @param transformChild - Optional callback to modify each child row (e.g. based on values from the parent row)
*/
export type InvenTreeTableNestedRowProps<T = any> = {
accessor?: string;
expandable: (record: T) => boolean;
childParams: (record: T) => Record<string, any>;
transformChild?: (child: T, parent: T) => T;
};
export type InvenTreeTableRenderProps<T extends Record<string, any>> = {