2022-07-06 07:41:09 +00:00
|
|
|
import {TableData} from 'app/common/TableData';
|
2022-02-04 11:13:03 +00:00
|
|
|
import {UIRowId} from 'app/common/UIRowId';
|
2021-10-04 23:52:20 +00:00
|
|
|
|
|
|
|
/**
|
2022-07-06 07:41:09 +00:00
|
|
|
* Return whether a table (identified by the rowId of its metadata record) should
|
|
|
|
* normally be hidden from the user (e.g. as an option in the page-widget picker).
|
2021-10-04 23:52:20 +00:00
|
|
|
*/
|
2022-02-04 11:13:03 +00:00
|
|
|
export function isHiddenTable(tablesData: TableData, tableRef: UIRowId): boolean {
|
2021-10-04 23:52:20 +00:00
|
|
|
const tableId = tablesData.getValue(tableRef, 'tableId') as string|undefined;
|
2022-07-06 07:41:09 +00:00
|
|
|
return isSummaryTable(tablesData, tableRef) || Boolean(tableId?.startsWith('GristHidden'));
|
2022-04-27 17:46:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2022-07-06 07:41:09 +00:00
|
|
|
* Return whether a table (identified by the rowId of its metadata record) is a
|
|
|
|
* summary table.
|
2022-04-27 17:46:24 +00:00
|
|
|
*/
|
2022-07-06 07:41:09 +00:00
|
|
|
export function isSummaryTable(tablesData: TableData, tableRef: UIRowId): boolean {
|
|
|
|
return tablesData.getValue(tableRef, 'summarySourceTable') !== 0;
|
2021-10-04 23:52:20 +00:00
|
|
|
}
|