(core) Polish Record Cards

Summary:
Improvements
 - Widget and column descriptions are now copied when duplicating a table.
 - A Grist Plugin API command to open a Record Card is now available.
 - New Card widgets set initial settings based on those used by their table's
 Record Card.

Fixes
 - Opening a reference in a Record Card from a Raw Data popup now opens
 the correct reference.

Test Plan: Browser and python tests.

Reviewers: jarek

Reviewed By: jarek

Differential Revision: https://phab.getgrist.com/D4164
This commit is contained in:
George Gevoian
2024-01-30 09:49:00 -05:00
parent 11afc08f65
commit b1f7ca353a
19 changed files with 361 additions and 152 deletions

View File

@@ -99,10 +99,7 @@ export interface ViewSectionRec extends IRowModel<"_grist_Views_section">, RuleO
/** True if this section is disabled. Currently only used by Record Card sections. */
disabled: modelUtil.KoSaveableObservable<boolean>;
/**
* True if the Record Card section of this section's table is disabled. Shortcut for
* `this.tableRecordCard().disabled()`.
*/
/** True if the Record Card section of this section's table is disabled. */
isTableRecordCardDisabled: ko.Computed<boolean>;
isVirtual: ko.Computed<boolean>;
@@ -485,7 +482,8 @@ export function createViewSectionRec(this: ViewSectionRec, docModel: DocModel):
this.isRecordCard = this.autoDispose(ko.pureComputed(() =>
this.table().recordCardViewSectionRef() === this.id()));
this.disabled = modelUtil.fieldWithDefault(this.optionsObj.prop('disabled'), false);
this.isTableRecordCardDisabled = ko.pureComputed(() => this.tableRecordCard().disabled());
this.isTableRecordCardDisabled = this.autoDispose(ko.pureComputed(() => this.tableRecordCard().disabled() ||
this.table().summarySourceTable() !== 0));
this.isVirtual = this.autoDispose(ko.pureComputed(() => typeof this.id() === 'string'));