(core) Reference and ReferenceList should trigger RightMenu to show up on Column tab and display reference toolitp, if it wasn't dismissed yet

Summary:
few things is going here:
1. Added comand that can be called with intent to show behavioral popup somewhere else. I've added it to trigger showing reference popup from new colum menu, despite popup existing in FieldBuilder
2. Command for showing right panel get an argument to switch for choosen tab right after showing.

Test Plan: two test added - one to check if right side menu is shown after chosing ref or refList, and second to check if popup is shown.

Reviewers: georgegevoian

Reviewed By: georgegevoian

Differential Revision: https://phab.getgrist.com/D4138
This commit is contained in:
Jakub Serafin
2024-02-13 13:05:47 +01:00
parent 94eec5e906
commit 7f9e2817d1
8 changed files with 352 additions and 141 deletions

View File

@@ -40,6 +40,7 @@ import { bundleChanges, Computed, Disposable, fromKo,
import isEqual from 'lodash/isEqual';
import * as ko from 'knockout';
import * as _ from 'underscore';
import * as commands from "../components/commands";
const testId = makeTestId('test-fbuilder-');
const t = makeT('FieldBuilder');
@@ -110,6 +111,8 @@ export class FieldBuilder extends Disposable {
private readonly _showRefConfigPopup: ko.Observable<boolean>;
private readonly _isEditorActive = Observable.create(this, false);
public constructor(public readonly gristDoc: GristDoc, public readonly field: ViewFieldRec,
private _cursor: Cursor, private _options: { isPreview?: boolean } = {}) {
super();
@@ -205,6 +208,14 @@ export class FieldBuilder extends Disposable {
this.diffImpl = this.autoDispose(DiffBox.create(this.field));
this._showRefConfigPopup = ko.observable(false);
this.autoDispose(commands.createGroup({
showPopup: (args: any) => {
if(args.popup==='referenceColumnsConfig'){
this._showRefConfigPopup(true);
}
}
}, this, true));
}
public buildSelectWidgetDom() {
@@ -400,14 +411,17 @@ export class FieldBuilder extends Disposable {
});
return [
cssLabel(t('DATA FROM TABLE'),
!this._showRefConfigPopup.peek() ? null : this.gristDoc.behavioralPromptsManager.attachTip(
'referenceColumnsConfig',
{
onDispose: () => this._showRefConfigPopup(false),
popupOptions: {
placement: 'left-start',
},
}
kd.maybe(this._showRefConfigPopup, () => {
return dom('div', this.gristDoc.behavioralPromptsManager.attachTip(
'referenceColumnsConfig',
{
onDispose: () => this._showRefConfigPopup(false),
popupOptions: {
placement: 'left-start',
},
}
));
},
),
),
cssRow(