2020-10-02 15:10:00 +00:00
|
|
|
/**
|
|
|
|
* Builds the structure of the right-side panel containing configuration and assorted tools.
|
|
|
|
* It includes the regular tabs, to configure the Page (including several sub-tabs), and Field;
|
|
|
|
* and allows other tools, such as Activity Feed, to be rendered temporarily in its place.
|
|
|
|
*
|
|
|
|
* A single RightPanel object is created in AppUI for a document page, and attached to PagePanels.
|
|
|
|
* GristDoc registers callbacks with it to create various standard tabs. These are created as
|
|
|
|
* needed, and destroyed when hidden.
|
|
|
|
*
|
|
|
|
* In addition, tools such as "Activity Feed" may use openTool() to replace the panel header and
|
|
|
|
* content. The user may dismiss this panel.
|
|
|
|
*
|
|
|
|
* All methods above return an object which may be disposed to close and dispose that specific
|
|
|
|
* tab from the outside (e.g. when GristDoc is disposed).
|
|
|
|
*/
|
|
|
|
|
|
|
|
import * as commands from 'app/client/components/commands';
|
|
|
|
import {GristDoc, IExtraTool, TabContent} from 'app/client/components/GristDoc';
|
2022-07-07 10:44:27 +00:00
|
|
|
import {RefSelect} from 'app/client/components/RefSelect';
|
2022-07-04 14:14:55 +00:00
|
|
|
import ViewConfigTab from 'app/client/components/ViewConfigTab';
|
2021-03-17 03:45:44 +00:00
|
|
|
import {domAsync} from 'app/client/lib/domAsync';
|
2020-10-02 15:10:00 +00:00
|
|
|
import * as imports from 'app/client/lib/imports';
|
2022-10-28 16:11:08 +00:00
|
|
|
import {makeT} from 'app/client/lib/localization';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {createSessionObs} from 'app/client/lib/sessionObs';
|
|
|
|
import {reportError} from 'app/client/models/AppModel';
|
2021-11-30 08:59:04 +00:00
|
|
|
import {ColumnRec, ViewSectionRec} from 'app/client/models/DocModel';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {GridOptions} from 'app/client/ui/GridOptions';
|
|
|
|
import {attachPageWidgetPicker, IPageWidget, toPageWidget} from 'app/client/ui/PageWidgetPicker';
|
2022-07-18 11:39:58 +00:00
|
|
|
import {linkId, selectBy} from 'app/client/ui/selectBy';
|
2022-02-08 15:23:14 +00:00
|
|
|
import {CustomSectionConfig} from 'app/client/ui/CustomSectionConfig';
|
2023-03-01 15:21:19 +00:00
|
|
|
import {buildDescriptionConfig} from 'app/client/ui/DescriptionConfig';
|
2022-11-17 20:17:51 +00:00
|
|
|
import {cssLabel} from 'app/client/ui/RightPanelStyles';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {VisibleFieldsConfig} from 'app/client/ui/VisibleFieldsConfig';
|
|
|
|
import {IWidgetType, widgetTypes} from 'app/client/ui/widgetTypes';
|
|
|
|
import {basicButton, primaryButton} from 'app/client/ui2018/buttons';
|
2022-09-06 01:51:57 +00:00
|
|
|
import {testId, theme, vars} from 'app/client/ui2018/cssVars';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {textInput} from 'app/client/ui2018/editableLabel';
|
|
|
|
import {IconName} from 'app/client/ui2018/IconList';
|
|
|
|
import {icon} from 'app/client/ui2018/icons';
|
|
|
|
import {select} from 'app/client/ui2018/menus';
|
2021-03-17 03:45:44 +00:00
|
|
|
import {FieldBuilder} from 'app/client/widgets/FieldBuilder';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {StringUnion} from 'app/common/StringUnion';
|
2021-03-17 03:45:44 +00:00
|
|
|
import {bundleChanges, Computed, Disposable, dom, domComputed, DomContents,
|
2020-10-02 15:10:00 +00:00
|
|
|
DomElementArg, DomElementMethod, IDomComponent} from 'grainjs';
|
|
|
|
import {MultiHolder, Observable, styled, subscribe} from 'grainjs';
|
|
|
|
import * as ko from 'knockout';
|
|
|
|
|
2022-10-28 16:11:08 +00:00
|
|
|
const t = makeT('RightPanel');
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
// Represents a top tab of the right side-pane.
|
|
|
|
const TopTab = StringUnion("pageWidget", "field");
|
|
|
|
|
|
|
|
// Represents a subtab of pageWidget in the right side-pane.
|
|
|
|
const PageSubTab = StringUnion("widget", "sortAndFilter", "data");
|
|
|
|
|
|
|
|
// Returns the icon and label of a type, default to those associate to 'record' type.
|
|
|
|
export function getFieldType(widgetType: IWidgetType|null) {
|
2022-10-28 16:11:08 +00:00
|
|
|
// A map of widget type to the icon and label to use for a field of that widget.
|
|
|
|
const fieldTypes = new Map<IWidgetType, {label: string, icon: IconName, pluralLabel: string}>([
|
2022-12-06 16:43:35 +00:00
|
|
|
['record', {label: t('Columns', { count: 1 }), icon: 'TypeCell', pluralLabel: t('Columns', { count: 2 })}],
|
|
|
|
['detail', {label: t('Fields', { count: 1 }), icon: 'TypeCell', pluralLabel: t('Fields', { count: 2 })}],
|
|
|
|
['single', {label: t('Fields', { count: 1 }), icon: 'TypeCell', pluralLabel: t('Fields', { count: 2 })}],
|
2022-10-28 16:11:08 +00:00
|
|
|
['chart', {label: t('Series', { count: 1 }), icon: 'ChartLine', pluralLabel: t('Series', { count: 2 })}],
|
2022-12-06 16:43:35 +00:00
|
|
|
['custom', {label: t('Columns', { count: 1 }), icon: 'TypeCell', pluralLabel: t('Columns', { count: 2 })}],
|
2022-10-28 16:11:08 +00:00
|
|
|
]);
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
return fieldTypes.get(widgetType || 'record') || fieldTypes.get('record')!;
|
|
|
|
}
|
|
|
|
|
|
|
|
export class RightPanel extends Disposable {
|
|
|
|
public readonly header: DomContents;
|
|
|
|
public readonly content: DomContents;
|
|
|
|
|
|
|
|
// If the panel is showing a tool, such as Action Log, instead of the usual section/field
|
|
|
|
// configuration, this will be set to the tool's header and content.
|
|
|
|
private _extraTool: Observable<IExtraTool|null>;
|
|
|
|
|
|
|
|
// Which of the two standard top tabs (page widget or field) is selected, or was last selected.
|
|
|
|
private _topTab = createSessionObs(this, "rightTopTab", "pageWidget", TopTab.guard);
|
|
|
|
|
|
|
|
// Which subtab is open for configuring page widget.
|
|
|
|
private _subTab = createSessionObs(this, "rightPageSubTab", "widget", PageSubTab.guard);
|
|
|
|
|
|
|
|
// Which type of page widget is active, e.g. "record" or "chart". This affects the names and
|
|
|
|
// icons in the top tab.
|
|
|
|
private _pageWidgetType = Computed.create<IWidgetType|null>(this, (use) => {
|
|
|
|
const section: ViewSectionRec = use(this._gristDoc.viewModel.activeSection);
|
|
|
|
return (use(section.parentKey) || null) as IWidgetType;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Returns the active section if it's valid, null otherwise.
|
|
|
|
private _validSection = Computed.create(this, (use) => {
|
|
|
|
const sec = use(this._gristDoc.viewModel.activeSection);
|
|
|
|
return sec.getRowId() ? sec : null;
|
|
|
|
});
|
|
|
|
|
|
|
|
constructor(private _gristDoc: GristDoc, private _isOpen: Observable<boolean>) {
|
|
|
|
super();
|
|
|
|
this._extraTool = _gristDoc.rightPanelTool;
|
|
|
|
this.autoDispose(subscribe(this._extraTool, (_use, tool) => tool && _isOpen.set(true)));
|
|
|
|
this.header = this._buildHeaderDom();
|
|
|
|
this.content = this._buildContentDom();
|
|
|
|
|
|
|
|
this.autoDispose(commands.createGroup({
|
|
|
|
fieldTabOpen: () => this._openFieldTab(),
|
|
|
|
viewTabOpen: () => this._openViewTab(),
|
2023-04-14 10:09:50 +00:00
|
|
|
viewTabFocus: () => this._viewTabFocus(),
|
2020-10-02 15:10:00 +00:00
|
|
|
sortFilterTabOpen: () => this._openSortFilter(),
|
|
|
|
dataSelectionTabOpen: () => this._openDataSelection()
|
|
|
|
}, this, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
private _openFieldTab() {
|
|
|
|
this._open('field');
|
|
|
|
}
|
|
|
|
|
|
|
|
private _openViewTab() {
|
|
|
|
this._open('pageWidget', 'widget');
|
|
|
|
}
|
|
|
|
|
2023-04-14 10:09:50 +00:00
|
|
|
private _viewTabFocus() {
|
|
|
|
// If the view tab is already open, focus on the first input.
|
|
|
|
this._focus('pageWidget');
|
|
|
|
}
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
private _openSortFilter() {
|
|
|
|
this._open('pageWidget', 'sortAndFilter');
|
|
|
|
}
|
|
|
|
|
|
|
|
private _openDataSelection() {
|
|
|
|
this._open('pageWidget', 'data');
|
|
|
|
}
|
|
|
|
|
|
|
|
private _open(topTab: typeof TopTab.type, subTab?: typeof PageSubTab.type) {
|
|
|
|
bundleChanges(() => {
|
|
|
|
this._isOpen.set(true);
|
|
|
|
this._topTab.set(topTab);
|
|
|
|
if (subTab) {
|
|
|
|
this._subTab.set(subTab);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-04-14 10:09:50 +00:00
|
|
|
private _focus(topTab: typeof TopTab.type) {
|
|
|
|
bundleChanges(() => {
|
|
|
|
if (!this._isOpen.get()) { return; }
|
|
|
|
this._isOpen.set(true);
|
|
|
|
this._topTab.set(topTab);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
private _buildHeaderDom() {
|
|
|
|
return dom.domComputed((use) => {
|
|
|
|
if (!use(this._isOpen)) { return null; }
|
|
|
|
const tool = use(this._extraTool);
|
|
|
|
return tool ? this._buildToolHeader(tool) : this._buildStandardHeader();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private _buildToolHeader(tool: IExtraTool) {
|
|
|
|
return cssTopBarItem(cssTopBarIcon(tool.icon), tool.label,
|
|
|
|
cssHoverCircle(cssHoverIcon("CrossBig"),
|
|
|
|
dom.on('click', () => this._gristDoc.showTool('none')),
|
|
|
|
testId('right-tool-close'),
|
|
|
|
),
|
|
|
|
cssTopBarItem.cls('-selected', true)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
private _buildStandardHeader() {
|
|
|
|
return dom.maybe(this._pageWidgetType, (type) => {
|
|
|
|
const widgetInfo = widgetTypes.get(type) || {label: 'Table', icon: 'TypeTable'};
|
|
|
|
const fieldInfo = getFieldType(type);
|
|
|
|
return [
|
|
|
|
cssTopBarItem(cssTopBarIcon(widgetInfo.icon), widgetInfo.label,
|
|
|
|
cssTopBarItem.cls('-selected', (use) => use(this._topTab) === 'pageWidget'),
|
|
|
|
dom.on('click', () => this._topTab.set("pageWidget")),
|
|
|
|
testId('right-tab-pagewidget')),
|
|
|
|
cssTopBarItem(cssTopBarIcon(fieldInfo.icon), fieldInfo.label,
|
|
|
|
cssTopBarItem.cls('-selected', (use) => use(this._topTab) === 'field'),
|
|
|
|
dom.on('click', () => this._topTab.set("field")),
|
|
|
|
testId('right-tab-field')),
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private _buildContentDom() {
|
|
|
|
return dom.domComputed((use) => {
|
|
|
|
if (!use(this._isOpen)) { return null; }
|
|
|
|
const tool = use(this._extraTool);
|
|
|
|
if (tool) { return tabContentToDom(tool.content); }
|
|
|
|
|
|
|
|
const topTab = use(this._topTab);
|
|
|
|
if (topTab === 'field') {
|
|
|
|
return dom.create(this._buildFieldContent.bind(this));
|
|
|
|
}
|
|
|
|
if (topTab === 'pageWidget' && use(this._pageWidgetType)) {
|
|
|
|
return dom.create(this._buildPageWidgetContent.bind(this));
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private _buildFieldContent(owner: MultiHolder) {
|
2021-03-17 03:45:44 +00:00
|
|
|
const fieldBuilder = owner.autoDispose(ko.computed(() => {
|
2021-07-30 15:16:33 +00:00
|
|
|
const vsi = this._gristDoc.viewModel.activeSection?.().viewInstance();
|
2020-10-02 15:10:00 +00:00
|
|
|
return vsi && vsi.activeFieldBuilder();
|
|
|
|
}));
|
2021-03-17 03:45:44 +00:00
|
|
|
|
2022-10-14 10:07:19 +00:00
|
|
|
const selectedColumns = owner.autoDispose(ko.computed(() => {
|
|
|
|
const vsi = this._gristDoc.viewModel.activeSection?.().viewInstance();
|
2022-11-14 11:30:50 +00:00
|
|
|
if (vsi && vsi.selectedColumns) {
|
|
|
|
return vsi.selectedColumns();
|
|
|
|
}
|
|
|
|
const field = fieldBuilder()?.field;
|
|
|
|
return field ? [field] : [];
|
2022-10-14 10:07:19 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
const isMultiSelect = owner.autoDispose(ko.pureComputed(() => {
|
|
|
|
const list = selectedColumns();
|
|
|
|
return Boolean(list && list.length > 1);
|
|
|
|
}));
|
|
|
|
|
|
|
|
owner.autoDispose(selectedColumns.subscribe(cols => {
|
2022-10-24 10:06:24 +00:00
|
|
|
if (owner.isDisposed() || this._gristDoc.isDisposed() || this._gristDoc.viewModel.isDisposed()) { return; }
|
|
|
|
const section = this._gristDoc.viewModel.activeSection();
|
|
|
|
if (!section || section.isDisposed()) { return; }
|
|
|
|
section.selectedFields(cols || []);
|
2022-10-14 10:07:19 +00:00
|
|
|
}));
|
|
|
|
this._gristDoc.viewModel.activeSection()?.selectedFields(selectedColumns.peek() || []);
|
|
|
|
|
2021-03-17 03:45:44 +00:00
|
|
|
const docModel = this._gristDoc.docModel;
|
|
|
|
const origColRef = owner.autoDispose(ko.computed(() => fieldBuilder()?.origColumn.origColRef() || 0));
|
|
|
|
const origColumn = owner.autoDispose(docModel.columns.createFloatingRowModel(origColRef));
|
|
|
|
const isColumnValid = owner.autoDispose(ko.computed(() => Boolean(origColRef())));
|
|
|
|
|
|
|
|
// Builder for the reference display column multiselect.
|
2022-07-07 10:44:27 +00:00
|
|
|
const refSelect = RefSelect.create(owner, {docModel, origColumn, fieldBuilder});
|
2021-03-17 03:45:44 +00:00
|
|
|
|
2021-06-08 07:07:20 +00:00
|
|
|
// build cursor position observable
|
|
|
|
const cursor = owner.autoDispose(ko.computed(() => {
|
2021-07-30 15:16:33 +00:00
|
|
|
const vsi = this._gristDoc.viewModel.activeSection?.().viewInstance();
|
2021-06-08 07:07:20 +00:00
|
|
|
return vsi?.cursor.currentPosition() ?? {};
|
|
|
|
}));
|
|
|
|
|
2021-03-17 03:45:44 +00:00
|
|
|
return domAsync(imports.loadViewPane().then(ViewPane => {
|
|
|
|
const {buildNameConfig, buildFormulaConfig} = ViewPane.FieldConfig;
|
|
|
|
return dom.maybe(isColumnValid, () =>
|
|
|
|
buildConfigContainer(
|
2022-10-14 10:07:19 +00:00
|
|
|
cssSection(
|
|
|
|
dom.create(buildNameConfig, origColumn, cursor, isMultiSelect),
|
|
|
|
),
|
2023-01-17 10:39:23 +00:00
|
|
|
cssSection(
|
2023-01-19 11:37:31 +00:00
|
|
|
dom.create(buildDescriptionConfig, origColumn, cursor),
|
2023-01-17 10:39:23 +00:00
|
|
|
),
|
2021-03-17 03:45:44 +00:00
|
|
|
cssSeparator(),
|
2022-10-14 10:07:19 +00:00
|
|
|
cssSection(
|
|
|
|
dom.create(buildFormulaConfig,
|
|
|
|
origColumn, this._gristDoc, this._activateFormulaEditor.bind(this)),
|
|
|
|
),
|
2021-03-17 03:45:44 +00:00
|
|
|
cssSeparator(),
|
|
|
|
dom.maybe<FieldBuilder|null>(fieldBuilder, builder => [
|
2022-12-06 13:57:29 +00:00
|
|
|
cssLabel(t("COLUMN TYPE")),
|
2022-10-14 10:07:19 +00:00
|
|
|
cssSection(
|
|
|
|
builder.buildSelectTypeDom(),
|
|
|
|
),
|
|
|
|
cssSection(
|
|
|
|
builder.buildSelectWidgetDom(),
|
|
|
|
),
|
|
|
|
cssSection(
|
|
|
|
builder.buildConfigDom(),
|
|
|
|
),
|
|
|
|
builder.buildColorConfigDom(),
|
|
|
|
cssSection(
|
|
|
|
builder.buildSettingOptions(),
|
|
|
|
dom.maybe(isMultiSelect, () => disabledSection())
|
|
|
|
),
|
2021-03-17 03:45:44 +00:00
|
|
|
]),
|
|
|
|
cssSeparator(),
|
2022-10-14 10:07:19 +00:00
|
|
|
cssSection(
|
|
|
|
dom.maybe(refSelect.isForeignRefCol, () => [
|
2023-04-26 13:33:12 +00:00
|
|
|
cssLabel(t('Add referenced columns')),
|
2022-10-14 10:07:19 +00:00
|
|
|
cssRow(refSelect.buildDom()),
|
|
|
|
cssSeparator()
|
|
|
|
]),
|
2022-12-06 13:57:29 +00:00
|
|
|
cssLabel(t("TRANSFORM")),
|
2022-10-14 10:07:19 +00:00
|
|
|
dom.maybe<FieldBuilder|null>(fieldBuilder, builder => builder.buildTransformDom()),
|
|
|
|
dom.maybe(isMultiSelect, () => disabledSection()),
|
|
|
|
testId('panel-transform'),
|
|
|
|
),
|
2021-03-17 03:45:44 +00:00
|
|
|
this._disableIfReadonly(),
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Helper to activate the side-pane formula editor over the given HTML element.
|
2021-11-05 10:25:05 +00:00
|
|
|
private _activateFormulaEditor(
|
|
|
|
// Element to attach to.
|
|
|
|
refElem: Element,
|
|
|
|
// Simulate user typing on the cell - open editor with an initial value.
|
|
|
|
editValue?: string,
|
|
|
|
// Custom save handler.
|
2021-11-30 08:59:04 +00:00
|
|
|
onSave?: (column: ColumnRec, formula: string) => Promise<void>,
|
2021-11-05 10:25:05 +00:00
|
|
|
// Custom cancel handler.
|
2022-10-14 10:07:19 +00:00
|
|
|
onCancel?: () => void) {
|
2021-03-17 03:45:44 +00:00
|
|
|
const vsi = this._gristDoc.viewModel.activeSection().viewInstance();
|
|
|
|
if (!vsi) { return; }
|
|
|
|
const editRowModel = vsi.moveEditRowToCursor();
|
2021-11-05 10:25:05 +00:00
|
|
|
return vsi.activeFieldBuilder.peek().openSideFormulaEditor(editRowModel, refElem, editValue, onSave, onCancel);
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private _buildPageWidgetContent(_owner: MultiHolder) {
|
|
|
|
return [
|
|
|
|
cssSubTabContainer(
|
2022-12-06 13:57:29 +00:00
|
|
|
cssSubTab(t("Widget"),
|
2020-10-02 15:10:00 +00:00
|
|
|
cssSubTab.cls('-selected', (use) => use(this._subTab) === 'widget'),
|
|
|
|
dom.on('click', () => this._subTab.set("widget")),
|
|
|
|
testId('config-widget')),
|
2022-12-06 13:57:29 +00:00
|
|
|
cssSubTab(t("Sort & Filter"),
|
2020-10-02 15:10:00 +00:00
|
|
|
cssSubTab.cls('-selected', (use) => use(this._subTab) === 'sortAndFilter'),
|
|
|
|
dom.on('click', () => this._subTab.set("sortAndFilter")),
|
|
|
|
testId('config-sortAndFilter')),
|
2022-12-06 13:57:29 +00:00
|
|
|
cssSubTab(t("Data"),
|
2020-10-02 15:10:00 +00:00
|
|
|
cssSubTab.cls('-selected', (use) => use(this._subTab) === 'data'),
|
|
|
|
dom.on('click', () => this._subTab.set("data")),
|
|
|
|
testId('config-data')),
|
|
|
|
),
|
|
|
|
dom.domComputed(this._subTab, (subTab) => (
|
|
|
|
dom.maybe(this._validSection, (activeSection) => (
|
|
|
|
buildConfigContainer(
|
|
|
|
subTab === 'widget' ? dom.create(this._buildPageWidgetConfig.bind(this), activeSection) :
|
|
|
|
subTab === 'sortAndFilter' ? dom.create(this._buildPageSortFilterConfig.bind(this)) :
|
|
|
|
subTab === 'data' ? dom.create(this._buildPageDataConfig.bind(this), activeSection) :
|
|
|
|
null
|
|
|
|
)
|
|
|
|
))
|
|
|
|
))
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
private _createViewConfigTab(owner: MultiHolder): Observable<null|ViewConfigTab> {
|
|
|
|
const viewConfigTab = Observable.create<null|ViewConfigTab>(owner, null);
|
|
|
|
const gristDoc = this._gristDoc;
|
|
|
|
imports.loadViewPane()
|
|
|
|
.then(ViewPane => {
|
|
|
|
if (owner.isDisposed()) { return; }
|
|
|
|
viewConfigTab.set(owner.autoDispose(
|
2022-02-03 17:23:53 +00:00
|
|
|
ViewPane.ViewConfigTab.create({gristDoc, viewModel: gristDoc.viewModel})));
|
2020-10-02 15:10:00 +00:00
|
|
|
})
|
|
|
|
.catch(reportError);
|
|
|
|
return viewConfigTab;
|
|
|
|
}
|
|
|
|
|
|
|
|
private _buildPageWidgetConfig(owner: MultiHolder, activeSection: ViewSectionRec) {
|
|
|
|
// TODO: This uses private methods from ViewConfigTab. These methods are likely to get
|
|
|
|
// refactored, but if not, should be made public.
|
|
|
|
const viewConfigTab = this._createViewConfigTab(owner);
|
2022-02-08 15:23:14 +00:00
|
|
|
const hasCustomMapping = Computed.create(owner, use => {
|
|
|
|
const isCustom = use(this._pageWidgetType) === 'custom';
|
|
|
|
const hasColumnMapping = use(activeSection.columnsToMap);
|
|
|
|
return Boolean(isCustom && hasColumnMapping);
|
|
|
|
});
|
2020-10-02 15:10:00 +00:00
|
|
|
return dom.maybe(viewConfigTab, (vct) => [
|
|
|
|
this._disableIfReadonly(),
|
2022-12-06 13:57:29 +00:00
|
|
|
cssLabel(dom.text(use => use(activeSection.isRaw) ? t("DATA TABLE NAME") : t("WIDGET TITLE")),
|
2022-07-06 07:41:09 +00:00
|
|
|
dom.style('margin-bottom', '14px'),
|
|
|
|
),
|
2020-10-02 15:10:00 +00:00
|
|
|
cssRow(cssTextInput(
|
|
|
|
Computed.create(owner, (use) => use(activeSection.titleDef)),
|
|
|
|
val => activeSection.titleDef.saveOnly(val),
|
2022-07-06 07:41:09 +00:00
|
|
|
dom.boolAttr('disabled', use => {
|
|
|
|
const isRawTable = use(activeSection.isRaw);
|
|
|
|
const isSummaryTable = use(use(activeSection.table).summarySourceTable) !== 0;
|
|
|
|
return isRawTable && isSummaryTable;
|
|
|
|
}),
|
2020-10-02 15:10:00 +00:00
|
|
|
testId('right-widget-title')
|
|
|
|
)),
|
|
|
|
|
2022-02-07 14:02:26 +00:00
|
|
|
dom.maybe(
|
|
|
|
(use) => !use(activeSection.isRaw),
|
|
|
|
() => cssRow(
|
2022-12-06 13:57:29 +00:00
|
|
|
primaryButton(t("Change Widget"), this._createPageWidgetPicker()),
|
2022-02-07 14:02:26 +00:00
|
|
|
cssRow.cls('-top-space')
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
cssSeparator(),
|
|
|
|
|
|
|
|
dom.maybe((use) => ['detail', 'single'].includes(use(this._pageWidgetType)!), () => [
|
2022-12-06 13:57:29 +00:00
|
|
|
cssLabel(t("Theme")),
|
2020-10-02 15:10:00 +00:00
|
|
|
dom('div',
|
|
|
|
vct._buildThemeDom(),
|
|
|
|
vct._buildLayoutDom())
|
|
|
|
]),
|
|
|
|
|
|
|
|
domComputed((use) => {
|
|
|
|
if (use(this._pageWidgetType) !== 'record') { return null; }
|
|
|
|
return dom.create(GridOptions, activeSection);
|
|
|
|
}),
|
|
|
|
|
2022-08-08 13:32:50 +00:00
|
|
|
domComputed((use) => {
|
|
|
|
if (use(this._pageWidgetType) !== 'record') { return null; }
|
|
|
|
return [
|
|
|
|
cssSeparator(),
|
2022-12-06 13:57:29 +00:00
|
|
|
cssLabel(t("ROW STYLE")),
|
2022-08-08 13:32:50 +00:00
|
|
|
domAsync(imports.loadViewPane().then(ViewPane =>
|
2022-12-06 13:57:29 +00:00
|
|
|
dom.create(ViewPane.ConditionalStyle, t("Row Style"), activeSection, this._gristDoc)
|
2022-08-08 13:32:50 +00:00
|
|
|
))
|
|
|
|
];
|
|
|
|
}),
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
dom.maybe((use) => use(this._pageWidgetType) === 'chart', () => [
|
2022-12-06 13:57:29 +00:00
|
|
|
cssLabel(t("CHART TYPE")),
|
2020-10-02 15:10:00 +00:00
|
|
|
vct._buildChartConfigDom(),
|
|
|
|
]),
|
|
|
|
|
2021-12-05 05:14:38 +00:00
|
|
|
dom.maybe((use) => use(this._pageWidgetType) === 'custom', () => {
|
|
|
|
const parts = vct._buildCustomTypeItems() as any[];
|
|
|
|
return [
|
2022-12-06 13:57:29 +00:00
|
|
|
cssLabel(t("CUSTOM")),
|
2021-12-05 05:14:38 +00:00
|
|
|
// If 'customViewPlugin' feature is on, show the toggle that allows switching to
|
|
|
|
// plugin mode. Note that the default mode for a new 'custom' view is 'url', so that's
|
|
|
|
// the only one that will be shown without the feature flag.
|
|
|
|
dom.maybe((use) => use(this._gristDoc.app.features).customViewPlugin,
|
|
|
|
() => dom('div', parts[0].buildDom())),
|
|
|
|
dom.maybe(use => use(activeSection.customDef.mode) === 'plugin',
|
|
|
|
() => dom('div', parts[2].buildDom())),
|
|
|
|
// In the default url mode, allow picking a url and granting/forbidding
|
|
|
|
// access to data.
|
|
|
|
dom.maybe(use => use(activeSection.customDef.mode) === 'url',
|
2022-01-12 13:30:51 +00:00
|
|
|
() => dom.create(CustomSectionConfig, activeSection, this._gristDoc)),
|
2021-12-05 05:14:38 +00:00
|
|
|
];
|
|
|
|
}),
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2022-02-07 14:02:26 +00:00
|
|
|
dom.maybe(
|
|
|
|
(use) => !(
|
|
|
|
use(hasCustomMapping) ||
|
|
|
|
use(this._pageWidgetType) === 'chart' ||
|
|
|
|
use(activeSection.isRaw)
|
|
|
|
),
|
|
|
|
() => [
|
|
|
|
cssSeparator(),
|
|
|
|
dom.create(VisibleFieldsConfig, this._gristDoc, activeSection),
|
|
|
|
]),
|
2020-10-02 15:10:00 +00:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
private _buildPageSortFilterConfig(owner: MultiHolder) {
|
|
|
|
const viewConfigTab = this._createViewConfigTab(owner);
|
2022-11-17 20:17:51 +00:00
|
|
|
return dom.maybe(viewConfigTab, (vct) => vct.buildSortFilterDom());
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private _buildPageDataConfig(owner: MultiHolder, activeSection: ViewSectionRec) {
|
|
|
|
const viewConfigTab = this._createViewConfigTab(owner);
|
|
|
|
const viewModel = this._gristDoc.viewModel;
|
|
|
|
const table = activeSection.table;
|
|
|
|
const groupedBy = Computed.create(owner, (use) => use(use(table).groupByColumns));
|
|
|
|
const link = Computed.create(owner, (use) => {
|
|
|
|
return linkId({
|
|
|
|
srcSectionRef: use(activeSection.linkSrcSectionRef),
|
|
|
|
srcColRef: use(activeSection.linkSrcColRef),
|
|
|
|
targetColRef: use(activeSection.linkTargetColRef)
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-07-21 14:46:26 +00:00
|
|
|
// This computed is not enough to make sure that the linkOptions are up to date. Indeed
|
2020-10-02 15:10:00 +00:00
|
|
|
// the selectBy function depends on a much greater number of observables. Creating that many
|
2022-07-21 14:46:26 +00:00
|
|
|
// dependencies does not seem a better approach. Instead, we refresh the list of
|
|
|
|
// linkOptions only when the user clicks on the dropdown. Such behavior is not supported by the
|
|
|
|
// weasel select function as of writing and would require a custom implementation, so we will simulate
|
|
|
|
// this behavior by using temporary observable that will be changed when the user clicks on the dropdown.
|
|
|
|
const refreshTrigger = Observable.create(owner, false);
|
|
|
|
const linkOptions = Computed.create(owner, (use) => {
|
|
|
|
void use(refreshTrigger);
|
|
|
|
return selectBy(
|
2020-10-02 15:10:00 +00:00
|
|
|
this._gristDoc.docModel,
|
2022-07-21 14:46:26 +00:00
|
|
|
viewModel.viewSections().all(),
|
2020-10-02 15:10:00 +00:00
|
|
|
activeSection,
|
2022-07-21 14:46:26 +00:00
|
|
|
);
|
|
|
|
});
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2022-07-18 11:39:58 +00:00
|
|
|
link.onWrite((val) => this._gristDoc.saveLink(val));
|
2020-10-02 15:10:00 +00:00
|
|
|
return [
|
|
|
|
this._disableIfReadonly(),
|
2022-12-06 13:57:29 +00:00
|
|
|
cssLabel(t("DATA TABLE")),
|
2020-10-02 15:10:00 +00:00
|
|
|
cssRow(
|
2022-12-06 13:57:29 +00:00
|
|
|
cssIcon('TypeTable'), cssDataLabel(t("SOURCE DATA")),
|
2020-10-02 15:10:00 +00:00
|
|
|
cssContent(dom.text((use) => use(use(table).primaryTableId)),
|
|
|
|
testId('pwc-table'))
|
|
|
|
),
|
|
|
|
dom(
|
|
|
|
'div',
|
2022-12-06 13:57:29 +00:00
|
|
|
cssRow(cssIcon('Pivot'), cssDataLabel(t("GROUPED BY"))),
|
2020-10-02 15:10:00 +00:00
|
|
|
cssRow(domComputed(groupedBy, (cols) => cssList(cols.map((c) => (
|
|
|
|
cssListItem(dom.text(c.label),
|
|
|
|
testId('pwc-groupedBy-col'))
|
|
|
|
))))),
|
|
|
|
|
|
|
|
testId('pwc-groupedBy'),
|
|
|
|
// hide if not a summary table
|
|
|
|
dom.hide((use) => !use(use(table).summarySourceTable)),
|
|
|
|
),
|
|
|
|
|
2022-02-07 14:02:26 +00:00
|
|
|
dom.maybe((use) => !use(activeSection.isRaw), () =>
|
2022-12-06 13:57:29 +00:00
|
|
|
cssButtonRow(primaryButton(t("Edit Data Selection"), this._createPageWidgetPicker(),
|
2022-02-07 14:02:26 +00:00
|
|
|
testId('pwc-editDataSelection')),
|
|
|
|
dom.maybe(
|
|
|
|
use => Boolean(use(use(activeSection.table).summarySourceTable)),
|
|
|
|
() => basicButton(
|
2022-12-06 13:57:29 +00:00
|
|
|
t("Detach"),
|
2022-02-07 14:02:26 +00:00
|
|
|
dom.on('click', () => this._gristDoc.docData.sendAction(
|
|
|
|
["DetachSummaryViewSection", activeSection.getRowId()])),
|
|
|
|
testId('detach-button'),
|
|
|
|
)),
|
|
|
|
cssRow.cls('-top-space'),
|
|
|
|
)),
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
// TODO: "Advanced settings" is for "on-demand" marking of tables. This should only be shown
|
|
|
|
// for raw data tables (once that's supported), should have updated UI, and should possibly
|
|
|
|
// be hidden for free plans.
|
|
|
|
dom.maybe(viewConfigTab, (vct) => cssRow(
|
|
|
|
dom('div', vct._buildAdvancedSettingsDom()),
|
|
|
|
)),
|
|
|
|
cssSeparator(),
|
|
|
|
|
2022-02-07 14:02:26 +00:00
|
|
|
dom.maybe((use) => !use(activeSection.isRaw), () => [
|
2022-12-06 13:57:29 +00:00
|
|
|
cssLabel(t("SELECT BY")),
|
2022-02-07 14:02:26 +00:00
|
|
|
cssRow(
|
2022-07-21 14:46:26 +00:00
|
|
|
dom.update(
|
2022-12-06 13:57:29 +00:00
|
|
|
select(link, linkOptions, {defaultLabel: t("Select Widget")}),
|
2022-07-21 14:46:26 +00:00
|
|
|
dom.on('click', () => {
|
|
|
|
refreshTrigger.set(!refreshTrigger.get());
|
|
|
|
})
|
|
|
|
),
|
2022-02-07 14:02:26 +00:00
|
|
|
testId('right-select-by')
|
|
|
|
),
|
|
|
|
]),
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
domComputed((use) => {
|
|
|
|
const activeSectionRef = activeSection.getRowId();
|
|
|
|
const allViewSections = use(use(viewModel.viewSections).getObservable());
|
|
|
|
const selectorFor = allViewSections.filter((sec) => use(sec.linkSrcSectionRef) === activeSectionRef);
|
|
|
|
// TODO: sections should be listed following the order of appearance in the view layout (ie:
|
|
|
|
// left/right - top/bottom);
|
|
|
|
return selectorFor.length ? [
|
2022-12-06 13:57:29 +00:00
|
|
|
cssLabel(t("SELECTOR FOR"), testId('selector-for')),
|
2020-10-02 15:10:00 +00:00
|
|
|
cssRow(cssList(selectorFor.map((sec) => this._buildSectionItem(sec))))
|
|
|
|
] : null;
|
|
|
|
}),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
private _createPageWidgetPicker(): DomElementMethod {
|
|
|
|
const gristDoc = this._gristDoc;
|
|
|
|
const section = gristDoc.viewModel.activeSection;
|
|
|
|
const onSave = (val: IPageWidget) => gristDoc.saveViewSection(section.peek(), val);
|
2022-12-20 02:06:39 +00:00
|
|
|
return (elem) => { attachPageWidgetPicker(elem, gristDoc, onSave, {
|
2022-12-06 13:57:29 +00:00
|
|
|
buttonLabel: t("Save"),
|
2020-10-02 15:10:00 +00:00
|
|
|
value: () => toPageWidget(section.peek()),
|
|
|
|
selectBy: (val) => gristDoc.selectBy(val),
|
|
|
|
}); };
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns dom for a section item.
|
|
|
|
private _buildSectionItem(sec: ViewSectionRec) {
|
|
|
|
return cssListItem(
|
|
|
|
dom.text(sec.titleDef),
|
|
|
|
testId('selector-for-entry')
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns a DomArg that disables the content of the panel by adding a transparent overlay on top
|
|
|
|
// of it.
|
|
|
|
private _disableIfReadonly() {
|
|
|
|
if (this._gristDoc.docPageModel) {
|
|
|
|
return dom.maybe(this._gristDoc.docPageModel.isReadonly, () => (
|
|
|
|
cssOverlay(
|
|
|
|
testId('disable-overlay'),
|
2022-12-06 13:57:29 +00:00
|
|
|
cssBottomText(t("You do not have edit access to this document")),
|
2020-10-02 15:10:00 +00:00
|
|
|
)
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-14 10:07:19 +00:00
|
|
|
function disabledSection() {
|
|
|
|
return cssOverlay(
|
|
|
|
testId('panel-disabled-section'),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-03-17 03:45:44 +00:00
|
|
|
export function buildConfigContainer(...args: DomElementArg[]): HTMLElement {
|
2020-10-02 15:10:00 +00:00
|
|
|
return cssConfigContainer(
|
|
|
|
// The `position: relative;` style is needed for the overlay for the readonly mode. Note that
|
|
|
|
// we cannot set it on the cssConfigContainer directly because it conflicts with how overflow
|
|
|
|
// works. `padding-top: 1px;` prevents collapsing the top margins for the container and the
|
|
|
|
// first child.
|
|
|
|
dom('div', {style: 'position: relative; padding-top: 1px;'}, ...args),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// This logic is copied from SidePane.js for building DOM from TabContent.
|
|
|
|
// TODO It may not be needed after new-ui refactoring of the side-pane content.
|
|
|
|
function tabContentToDom(content: Observable<TabContent[]>|TabContent[]|IDomComponent) {
|
|
|
|
function buildItemDom(item: any) {
|
|
|
|
return dom('div.config_item',
|
|
|
|
dom.show(item.showObs || true),
|
|
|
|
item.buildDom()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ("buildDom" in content) {
|
|
|
|
return content.buildDom();
|
|
|
|
}
|
|
|
|
|
|
|
|
return cssTabContents(
|
|
|
|
dom.forEach(content, itemOrHeader => {
|
|
|
|
if (itemOrHeader.header) {
|
|
|
|
return dom('div.config_group',
|
|
|
|
dom.show(itemOrHeader.showObs || true),
|
|
|
|
itemOrHeader.label ? dom('div.config_header', itemOrHeader.label) : null,
|
|
|
|
dom.forEach(itemOrHeader.items, item => buildItemDom(item)),
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return buildItemDom(itemOrHeader);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const cssOverlay = styled('div', `
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.rightPanelDisabledOverlay};
|
2020-10-02 15:10:00 +00:00
|
|
|
opacity: 0.8;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
z-index: 100;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssBottomText = styled('span', `
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.text};
|
2020-10-02 15:10:00 +00:00
|
|
|
position: absolute;
|
|
|
|
bottom: -40px;
|
|
|
|
padding: 4px 16px;
|
|
|
|
`);
|
|
|
|
|
2022-08-08 13:32:50 +00:00
|
|
|
const cssRow = styled('div', `
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.text};
|
2020-10-02 15:10:00 +00:00
|
|
|
display: flex;
|
|
|
|
margin: 8px 16px;
|
|
|
|
align-items: center;
|
|
|
|
&-top-space {
|
|
|
|
margin-top: 24px;
|
|
|
|
}
|
2021-11-22 08:45:48 +00:00
|
|
|
&-disabled {
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.disabledText};
|
2021-11-22 08:45:48 +00:00
|
|
|
}
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
2022-01-25 09:38:21 +00:00
|
|
|
|
2022-08-08 13:32:50 +00:00
|
|
|
const cssButtonRow = styled(cssRow, `
|
2020-10-02 15:10:00 +00:00
|
|
|
margin-left: 0;
|
|
|
|
margin-right: 0;
|
|
|
|
& > button {
|
|
|
|
margin-left: 16px;
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
2022-08-08 13:32:50 +00:00
|
|
|
const cssIcon = styled(icon, `
|
2020-10-02 15:10:00 +00:00
|
|
|
flex: 0 0 auto;
|
2022-09-06 01:51:57 +00:00
|
|
|
--icon-color: ${theme.lightText};
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssTopBarItem = styled('div', `
|
|
|
|
flex: 1 1 0px;
|
|
|
|
height: 100%;
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.rightPanelTabBg};
|
2020-10-02 15:10:00 +00:00
|
|
|
font-weight: ${vars.headerControlTextWeight};
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.rightPanelTabFg};
|
|
|
|
--icon-color: ${theme.rightPanelTabIcon};
|
2020-10-02 15:10:00 +00:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
cursor: default;
|
|
|
|
|
|
|
|
&-selected {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.rightPanelTabSelectedBg};
|
2020-10-02 15:10:00 +00:00
|
|
|
font-weight: initial;
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.rightPanelTabSelectedFg};
|
|
|
|
--icon-color: ${theme.rightPanelTabSelectedFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
&:not(&-selected):hover {
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.rightPanelTabHoverBg};
|
|
|
|
--icon-color: ${theme.rightPanelTabIconHover};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssTopBarIcon = styled(icon, `
|
|
|
|
flex: none;
|
|
|
|
margin: 16px;
|
|
|
|
height: 16px;
|
|
|
|
width: 16px;
|
2022-10-25 03:10:15 +00:00
|
|
|
background-color: var(--icon-color);
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
|
|
|
const cssHoverCircle = styled('div', `
|
|
|
|
margin-left: auto;
|
|
|
|
margin-right: 8px;
|
|
|
|
width: 32px;
|
|
|
|
height: 32px;
|
|
|
|
background: none;
|
|
|
|
border-radius: 16px;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
&:hover {
|
2022-10-25 03:10:15 +00:00
|
|
|
background-color: ${theme.rightPanelTabButtonHoverBg};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssHoverIcon = styled(icon, `
|
|
|
|
height: 16px;
|
|
|
|
width: 16px;
|
2022-10-25 03:10:15 +00:00
|
|
|
background-color: var(--icon-color);
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
2022-08-08 13:32:50 +00:00
|
|
|
const cssSubTabContainer = styled('div', `
|
2020-10-02 15:10:00 +00:00
|
|
|
height: 48px;
|
|
|
|
flex: none;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: space-between;
|
|
|
|
`);
|
|
|
|
|
2022-08-08 13:32:50 +00:00
|
|
|
const cssSubTab = styled('div', `
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.rightPanelSubtabFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
flex: auto;
|
|
|
|
height: 100%;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: flex-end;
|
|
|
|
text-align: center;
|
|
|
|
padding-bottom: 8px;
|
2022-09-06 01:51:57 +00:00
|
|
|
border-bottom: 1px solid ${theme.pagePanelsBorder};
|
2020-10-02 15:10:00 +00:00
|
|
|
cursor: default;
|
|
|
|
|
|
|
|
&-selected {
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.rightPanelSubtabSelectedFg};
|
|
|
|
border-bottom: 1px solid ${theme.rightPanelSubtabSelectedUnderline};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
&:not(&-selected):hover {
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.rightPanelSubtabHoverFg};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
&:hover {
|
2022-09-06 01:51:57 +00:00
|
|
|
border-bottom: 1px solid ${theme.rightPanelSubtabHoverUnderline};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
.${cssSubTabContainer.className}:hover > &-selected:not(:hover) {
|
2022-09-06 01:51:57 +00:00
|
|
|
border-bottom: 1px solid ${theme.pagePanelsBorder};
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssTabContents = styled('div', `
|
|
|
|
padding: 16px 8px;
|
|
|
|
overflow: auto;
|
|
|
|
`);
|
|
|
|
|
2022-08-08 13:32:50 +00:00
|
|
|
const cssSeparator = styled('div', `
|
2022-09-06 01:51:57 +00:00
|
|
|
border-bottom: 1px solid ${theme.pagePanelsBorder};
|
2021-03-17 03:45:44 +00:00
|
|
|
margin-top: 16px;
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
|
|
|
|
2023-03-28 16:11:40 +00:00
|
|
|
const cssConfigContainer = styled('div.test-config-container', `
|
2020-10-02 15:10:00 +00:00
|
|
|
overflow: auto;
|
|
|
|
--color-list-item: none;
|
|
|
|
--color-list-item-hover: none;
|
|
|
|
|
|
|
|
&:after {
|
|
|
|
content: "";
|
|
|
|
display: block;
|
|
|
|
height: 40px;
|
|
|
|
}
|
|
|
|
& .fieldbuilder_settings {
|
|
|
|
margin: 16px 0 0 0;
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssDataLabel = styled('div', `
|
|
|
|
flex: 0 0 81px;
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.lightText};
|
2020-10-02 15:10:00 +00:00
|
|
|
font-size: ${vars.xsmallFontSize};
|
|
|
|
margin-left: 4px;
|
|
|
|
margin-top: 2px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssContent = styled('div', `
|
|
|
|
flex: 0 1 auto;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
min-width: 1em;
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssList = styled('div', `
|
|
|
|
list-style: none;
|
|
|
|
width: 100%;
|
|
|
|
`);
|
|
|
|
|
|
|
|
|
|
|
|
const cssListItem = styled('li', `
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.hover};
|
2020-10-02 15:10:00 +00:00
|
|
|
border-radius: 2px;
|
|
|
|
margin-bottom: 4px;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
width: 100%;
|
|
|
|
padding: 4px 8px;
|
|
|
|
`);
|
|
|
|
|
2022-08-08 13:32:50 +00:00
|
|
|
const cssTextInput = styled(textInput, `
|
2020-10-02 15:10:00 +00:00
|
|
|
flex: 1 0 auto;
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.inputFg};
|
|
|
|
background-color: ${theme.inputBg};
|
2022-07-06 07:41:09 +00:00
|
|
|
|
|
|
|
&:disabled {
|
2022-09-06 01:51:57 +00:00
|
|
|
color: ${theme.inputDisabledFg};
|
|
|
|
background-color: ${theme.inputDisabledBg};
|
2022-07-06 07:41:09 +00:00
|
|
|
pointer-events: none;
|
|
|
|
}
|
2020-10-02 15:10:00 +00:00
|
|
|
`);
|
2022-10-14 10:07:19 +00:00
|
|
|
|
|
|
|
const cssSection = styled('div', `
|
|
|
|
position: relative;
|
|
|
|
`);
|