(core) Adding confirmation before remove last widget for a table

Summary:
When last widget for a table is removed, user is informed
about that and can decide between removing the widget and removing
both table and widget

Test Plan: Updated

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4295
This commit is contained in:
Jarosław Sadziński
2024-07-24 13:33:53 +02:00
parent f2141851be
commit 61942f6f4b
8 changed files with 249 additions and 30 deletions

View File

@@ -39,6 +39,7 @@ export interface TableRec extends IRowModel<"_grist_Tables"> {
// If user can select this table in various places.
// Note: Some hidden tables can still be visible on RawData view.
isHidden: ko.Computed<boolean>;
isSummary: ko.Computed<boolean>;
tableColor: string;
disableAddRemoveRows: ko.Computed<boolean>;
@@ -68,6 +69,8 @@ export function createTableRec(this: TableRec, docModel: DocModel): void {
this.primaryTableId = ko.pureComputed(() =>
this.summarySourceTable() ? this.summarySource().tableId() : this.tableId());
this.isSummary = this.autoDispose(ko.pureComputed(() => Boolean(this.summarySourceTable())));
this.groupByColumns = ko.pureComputed(() => this.columns().all().filter(c => c.summarySourceCol()));
this.groupDesc = ko.pureComputed(() => {

View File

@@ -93,9 +93,12 @@ export interface ViewSectionRec extends IRowModel<"_grist_Views_section">, RuleO
// in which case the UI prevents various things like hiding columns or changing the widget type.
isRaw: ko.Computed<boolean>;
tableRecordCard: ko.Computed<ViewSectionRec>
/** Is this table card viewsection (the one available after pressing spacebar) */
isRecordCard: ko.Computed<boolean>;
/** Card record viewSection for associated table (might be the same section) */
tableRecordCard: ko.Computed<ViewSectionRec>;
/** True if this section is disabled. Currently only used by Record Card sections. */
disabled: modelUtil.KoSaveableObservable<boolean>;