2022-07-04 14:14:55 +00:00
|
|
|
import BaseView from 'app/client/components/BaseView';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {ChartView} from 'app/client/components/ChartView';
|
|
|
|
import * as commands from 'app/client/components/commands';
|
|
|
|
import {CustomView} from 'app/client/components/CustomView';
|
|
|
|
import * as DetailView from 'app/client/components/DetailView';
|
|
|
|
import * as GridView from 'app/client/components/GridView';
|
|
|
|
import {GristDoc} from 'app/client/components/GristDoc';
|
|
|
|
import {Layout} from 'app/client/components/Layout';
|
|
|
|
import {LayoutEditor} from 'app/client/components/LayoutEditor';
|
2020-10-09 21:39:13 +00:00
|
|
|
import {printViewSection} from 'app/client/components/Printing';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {Delay} from 'app/client/lib/Delay';
|
|
|
|
import {createObsArray} from 'app/client/lib/koArrayWrap';
|
|
|
|
import {ViewRec, ViewSectionRec} from 'app/client/models/DocModel';
|
|
|
|
import {reportError} from 'app/client/models/errors';
|
2021-04-14 15:17:45 +00:00
|
|
|
import {filterBar} from 'app/client/ui/FilterBar';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {viewSectionMenu} from 'app/client/ui/ViewSectionMenu';
|
2022-04-27 17:46:24 +00:00
|
|
|
import {buildWidgetTitle} from 'app/client/ui/WidgetTitle';
|
2022-09-29 16:32:54 +00:00
|
|
|
import {isNarrowScreenObs, mediaSmall, testId, theme} from 'app/client/ui2018/cssVars';
|
2022-04-27 17:46:24 +00:00
|
|
|
import {icon} from 'app/client/ui2018/icons';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {DisposableWithEvents} from 'app/common/DisposableWithEvents';
|
|
|
|
import {mod} from 'app/common/gutil';
|
2021-03-05 03:35:53 +00:00
|
|
|
import {Observable} from 'grainjs';
|
2020-10-02 15:10:00 +00:00
|
|
|
import * as ko from 'knockout';
|
|
|
|
import * as _ from 'underscore';
|
2022-04-27 17:46:24 +00:00
|
|
|
import {computedArray, Disposable, dom, fromKo, Holder, IDomComponent, styled, subscribe} from 'grainjs';
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
// tslint:disable:no-console
|
|
|
|
|
|
|
|
const viewSectionTypes: {[key: string]: any} = {
|
|
|
|
record: GridView,
|
|
|
|
detail: DetailView,
|
|
|
|
chart: ChartView,
|
|
|
|
single: DetailView,
|
|
|
|
custom: CustomView,
|
|
|
|
};
|
|
|
|
|
|
|
|
function getInstanceConstructor(parentKey: string) {
|
|
|
|
const Cons = viewSectionTypes[parentKey];
|
|
|
|
if (!Cons) {
|
|
|
|
console.error('ViewLayout error: requested an unsupported section type:', parentKey);
|
|
|
|
}
|
|
|
|
// Default to GridView if no valid constructor
|
|
|
|
return Cons || viewSectionTypes.record;
|
|
|
|
}
|
|
|
|
|
2022-02-07 14:02:26 +00:00
|
|
|
export class ViewSectionHelper extends Disposable {
|
2020-10-02 15:10:00 +00:00
|
|
|
private _instance = Holder.create<BaseView>(this);
|
|
|
|
|
|
|
|
constructor(gristDoc: GristDoc, vs: ViewSectionRec) {
|
|
|
|
super();
|
|
|
|
this.onDispose(() => vs.viewInstance(null));
|
|
|
|
|
|
|
|
this.autoDispose(subscribe((use) => {
|
|
|
|
// Rebuild the section when its type changes or its underlying table.
|
|
|
|
const table = use(vs.table);
|
|
|
|
const Cons = getInstanceConstructor(use(vs.parentKey));
|
|
|
|
this._instance.clear();
|
|
|
|
if (table.getRowId()) {
|
|
|
|
this._instance.autoDispose(Cons.create(gristDoc, vs));
|
|
|
|
}
|
|
|
|
vs.viewInstance(this._instance.get());
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ViewLayout - Handles layout for a single page.
|
|
|
|
*/
|
|
|
|
export class ViewLayout extends DisposableWithEvents implements IDomComponent {
|
|
|
|
public docModel = this.gristDoc.docModel;
|
|
|
|
public viewModel: ViewRec;
|
|
|
|
public layoutSpec: ko.Computed<object>;
|
|
|
|
|
|
|
|
private _freeze = false;
|
|
|
|
private _layout: any;
|
|
|
|
private _sectionIds: number[];
|
2021-03-05 03:35:53 +00:00
|
|
|
private _isResizing = Observable.create(this, false);
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
constructor(public readonly gristDoc: GristDoc, viewId: number) {
|
|
|
|
super();
|
|
|
|
this.viewModel = this.docModel.views.getRowModel(viewId);
|
|
|
|
|
|
|
|
// A Map from viewSection RowModels to corresponding View class instances.
|
|
|
|
// TODO add a test that creating / deleting a section creates/destroys one instance, and
|
|
|
|
// switching pages destroys all instances.
|
|
|
|
const viewSectionObs = createObsArray(this, this.viewModel.viewSections());
|
|
|
|
this.autoDispose(computedArray(viewSectionObs, (vs, i, compArr) =>
|
|
|
|
ViewSectionHelper.create(compArr, gristDoc, vs)));
|
|
|
|
|
|
|
|
// Update the stored layoutSpecObj with any missing fields that are present in viewFields.
|
|
|
|
this.layoutSpec = this.autoDispose(ko.computed(
|
|
|
|
() => this._updateLayoutSpecWithSections(this.viewModel.layoutSpecObj()))
|
|
|
|
.extend({rateLimit: 0}));
|
|
|
|
|
|
|
|
this._layout = this.autoDispose(Layout.create(this.layoutSpec(),
|
|
|
|
this._buildLeafContent.bind(this), true));
|
|
|
|
this._sectionIds = this._layout.getAllLeafIds();
|
|
|
|
|
|
|
|
// When the layoutSpec changes by some means other than the layout editor, rebuild.
|
|
|
|
// This includes adding/removing sections and undo/redo.
|
|
|
|
this.autoDispose(this.layoutSpec.subscribe((spec) => this._freeze || this._rebuildLayout(spec)));
|
|
|
|
|
|
|
|
const layoutSaveDelay = this.autoDispose(new Delay());
|
|
|
|
|
|
|
|
this.listenTo(this._layout, 'layoutUserEditStop', () => {
|
2021-03-05 03:35:53 +00:00
|
|
|
this._isResizing.set(false);
|
2020-10-02 15:10:00 +00:00
|
|
|
layoutSaveDelay.schedule(1000, () => {
|
|
|
|
if (!this._layout) { return; }
|
2021-12-05 21:43:47 +00:00
|
|
|
|
|
|
|
// Only save layout changes when the document isn't read-only.
|
|
|
|
if (!this.gristDoc.isReadonly.get()) {
|
|
|
|
(this.viewModel.layoutSpecObj as any).setAndSave(this._layout.getLayoutSpec());
|
|
|
|
}
|
2020-10-02 15:10:00 +00:00
|
|
|
this._onResize();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Do not save if the user has started editing again.
|
2021-03-05 03:35:53 +00:00
|
|
|
this.listenTo(this._layout, 'layoutUserEditStart', () => {
|
|
|
|
layoutSaveDelay.cancel();
|
|
|
|
this._isResizing.set(true);
|
|
|
|
});
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
this.autoDispose(LayoutEditor.create(this._layout));
|
|
|
|
|
|
|
|
// Add disposal of this._layout after layoutEditor, so that it gets disposed first, and
|
|
|
|
// layoutEditor doesn't attempt to update it in its own disposal logic.
|
|
|
|
this.onDispose(() => this._layout.dispose());
|
|
|
|
|
|
|
|
this.autoDispose(this.gristDoc.resizeEmitter.addListener(this._onResize, this));
|
|
|
|
|
|
|
|
// It's hard to detect a click or mousedown on a third-party iframe
|
|
|
|
// (See https://stackoverflow.com/questions/2381336/detect-click-into-iframe-using-javascript).
|
|
|
|
this.listenTo(this.gristDoc.app, 'clipboard_blur', this._maybeFocusInSection);
|
|
|
|
|
2021-02-09 04:40:04 +00:00
|
|
|
const classActive = cssLayoutBox.className + '-active';
|
|
|
|
const classInactive = cssLayoutBox.className + '-inactive';
|
2021-02-09 23:38:05 +00:00
|
|
|
this.autoDispose(subscribe(fromKo(this.viewModel.activeSection), (use, section) => {
|
|
|
|
const id = section.getRowId();
|
2021-02-09 04:40:04 +00:00
|
|
|
this._layout.forEachBox((box: {dom: Element}) => {
|
|
|
|
box.dom.classList.add(classInactive);
|
|
|
|
box.dom.classList.remove(classActive);
|
|
|
|
});
|
|
|
|
let elem: Element|null = this._layout.getLeafBox(id)?.dom;
|
|
|
|
while (elem?.matches('.layout_box')) {
|
|
|
|
elem.classList.remove(classInactive);
|
|
|
|
elem.classList.add(classActive);
|
|
|
|
elem = elem.parentElement;
|
|
|
|
}
|
2021-02-09 23:38:05 +00:00
|
|
|
section.viewInstance.peek()?.onResize();
|
2021-02-09 04:40:04 +00:00
|
|
|
}));
|
|
|
|
|
2020-10-02 15:10:00 +00:00
|
|
|
const commandGroup = {
|
|
|
|
deleteSection: () => { this._removeViewSection(this.viewModel.activeSectionId()); },
|
|
|
|
nextSection: () => { this._otherSection(+1); },
|
|
|
|
prevSection: () => { this._otherSection(-1); },
|
2020-10-09 21:39:13 +00:00
|
|
|
printSection: () => { printViewSection(this._layout, this.viewModel.activeSection()).catch(reportError); },
|
2020-10-02 15:10:00 +00:00
|
|
|
};
|
|
|
|
this.autoDispose(commands.createGroup(commandGroup, this, true));
|
|
|
|
}
|
|
|
|
|
|
|
|
public buildDom() {
|
|
|
|
return this._layout.rootElem;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Freezes the layout until the passed in promise resolves. This is useful to achieve a single
|
|
|
|
// layout rebuild when multiple user actions needs to apply, simply pass in a promise that resolves
|
|
|
|
// when all user actions have resolved.
|
2022-04-07 10:10:58 +00:00
|
|
|
public async freezeUntil<T>(promise: Promise<T>): Promise<T> {
|
2020-10-02 15:10:00 +00:00
|
|
|
this._freeze = true;
|
|
|
|
try {
|
2022-04-07 10:10:58 +00:00
|
|
|
return await promise;
|
2020-10-02 15:10:00 +00:00
|
|
|
} finally {
|
|
|
|
this._freeze = false;
|
|
|
|
this._rebuildLayout(this.layoutSpec.peek());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Removes a view section from the current view. Should only be called if there is
|
|
|
|
// more than one viewsection in the view.
|
|
|
|
private _removeViewSection(viewSectionRowId: number) {
|
|
|
|
this.gristDoc.docData.sendAction(['RemoveViewSection', viewSectionRowId]).catch(reportError);
|
|
|
|
}
|
|
|
|
|
|
|
|
private _buildLeafContent(sectionRowId: number) {
|
2022-03-11 10:48:36 +00:00
|
|
|
return buildViewSectionDom({
|
|
|
|
gristDoc: this.gristDoc,
|
|
|
|
sectionRowId,
|
|
|
|
isResizing: this._isResizing,
|
|
|
|
viewModel: this.viewModel
|
|
|
|
});
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If there is no layout saved, we can create a default layout just from the list of fields for
|
|
|
|
* this view section. By default we just arrange them into a list of rows, two fields per row.
|
|
|
|
*/
|
|
|
|
private _updateLayoutSpecWithSections(spec: object) {
|
|
|
|
// We use tmpLayout as a way to manipulate the layout before we get a final spec from it.
|
|
|
|
const tmpLayout = Layout.create(spec, (leafId: number) => dom('div'), true);
|
|
|
|
|
|
|
|
const specFieldIds = tmpLayout.getAllLeafIds();
|
|
|
|
const viewSectionIds = this.viewModel.viewSections().all().map(function(f) { return f.getRowId(); });
|
|
|
|
|
|
|
|
function addToSpec(leafId: number) {
|
|
|
|
const newBox = tmpLayout.buildLayoutBox({ leaf: leafId });
|
|
|
|
const rows = tmpLayout.rootBox().childBoxes.peek();
|
|
|
|
const lastRow = rows[rows.length - 1];
|
|
|
|
if (rows.length >= 1 && lastRow.isLeaf()) {
|
|
|
|
// Add a new child to the last row.
|
|
|
|
lastRow.addChild(newBox, true);
|
|
|
|
} else {
|
|
|
|
// Add a new row.
|
|
|
|
tmpLayout.rootBox().addChild(newBox, true);
|
|
|
|
}
|
|
|
|
return newBox;
|
|
|
|
}
|
|
|
|
|
|
|
|
// For any stale fields (no longer among viewFields), remove them from tmpLayout.
|
|
|
|
_.difference(specFieldIds, viewSectionIds).forEach(function(leafId) {
|
|
|
|
tmpLayout.getLeafBox(leafId).dispose();
|
|
|
|
});
|
|
|
|
|
|
|
|
// For all fields that should be in the spec but aren't, add them to tmpLayout. We maintain a
|
|
|
|
// two-column layout, so add a new row, or a second box to the last row if it's a leaf.
|
|
|
|
_.difference(viewSectionIds, specFieldIds).forEach(function(leafId) {
|
|
|
|
// Only add the builder box if it hasn`t already been created
|
|
|
|
addToSpec(leafId);
|
|
|
|
});
|
|
|
|
|
|
|
|
spec = tmpLayout.getLayoutSpec();
|
|
|
|
tmpLayout.dispose();
|
|
|
|
return spec;
|
|
|
|
}
|
|
|
|
|
|
|
|
private _rebuildLayout(layoutSpec: object) {
|
|
|
|
this._layout.buildLayout(layoutSpec, true);
|
|
|
|
this._onResize();
|
|
|
|
this._sectionIds = this._layout.getAllLeafIds();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Resizes the scrolly windows of all viewSection classes with a 'scrolly' property.
|
|
|
|
private _onResize() {
|
|
|
|
this.viewModel.viewSections().all().forEach(vs => {
|
|
|
|
const inst = vs.viewInstance.peek();
|
|
|
|
if (inst) {
|
|
|
|
inst.onResize();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
// Select another section in cyclic ordering of sections. Order is counter-clockwise if given a
|
|
|
|
// positive `delta`, clockwise otherwise.
|
|
|
|
private _otherSection(delta: number) {
|
|
|
|
const sectionId = this.viewModel.activeSectionId.peek();
|
|
|
|
const currentIndex = this._sectionIds.indexOf(sectionId);
|
|
|
|
const index = mod(currentIndex + delta, this._sectionIds.length);
|
|
|
|
|
|
|
|
// update the active section id
|
|
|
|
this.viewModel.activeSectionId(this._sectionIds[index]);
|
|
|
|
}
|
|
|
|
|
|
|
|
private _maybeFocusInSection() {
|
|
|
|
// If the focused element is inside a view section, make that section active.
|
|
|
|
const layoutBox = this._layout.getContainingBox(document.activeElement);
|
|
|
|
if (layoutBox && layoutBox.leafId) {
|
|
|
|
this.gristDoc.viewModel.activeSectionId(layoutBox.leafId.peek());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-02-09 04:40:04 +00:00
|
|
|
|
2022-03-11 10:48:36 +00:00
|
|
|
export function buildViewSectionDom(options: {
|
|
|
|
gristDoc: GristDoc,
|
|
|
|
sectionRowId: number,
|
|
|
|
isResizing?: Observable<boolean>
|
|
|
|
viewModel?: ViewRec,
|
|
|
|
// Should show drag anchor.
|
2022-04-27 17:46:24 +00:00
|
|
|
draggable?: boolean, /* defaults to true */
|
2022-03-11 10:48:36 +00:00
|
|
|
// Should show green bar on the left (but preserves active-section class).
|
2022-04-27 17:46:24 +00:00
|
|
|
focusable?: boolean, /* defaults to true */
|
|
|
|
tableNameHidden?: boolean,
|
|
|
|
widgetNameHidden?: boolean,
|
2022-03-11 10:48:36 +00:00
|
|
|
}) {
|
|
|
|
const isResizing = options.isResizing ?? Observable.create(null, false);
|
|
|
|
const {gristDoc, sectionRowId, viewModel, draggable = true, focusable = true} = options;
|
|
|
|
|
|
|
|
// Creating normal section dom
|
|
|
|
const vs: ViewSectionRec = gristDoc.docModel.viewSections.getRowModel(sectionRowId);
|
|
|
|
return dom('div.view_leaf.viewsection_content.flexvbox.flexauto',
|
|
|
|
testId(`viewlayout-section-${sectionRowId}`),
|
|
|
|
!options.isResizing ? dom.autoDispose(isResizing) : null,
|
|
|
|
cssViewLeaf.cls(''),
|
|
|
|
cssViewLeafInactive.cls('', (use) => !vs.isDisposed() && !use(vs.hasFocus)),
|
|
|
|
dom.cls('active_section', vs.hasFocus),
|
|
|
|
dom.cls('active_section--no-indicator', !focusable),
|
|
|
|
dom.maybe<BaseView|null>((use) => use(vs.viewInstance), (viewInstance) => dom('div.viewsection_title.flexhbox',
|
|
|
|
dom('span.viewsection_drag_indicator.glyphicon.glyphicon-option-vertical',
|
|
|
|
// Makes element grabbable only if grist is not readonly.
|
|
|
|
dom.cls('layout_grabbable', (use) => !use(gristDoc.isReadonlyKo)),
|
|
|
|
!draggable ? dom.style("visibility", "hidden") : null
|
|
|
|
),
|
|
|
|
dom.maybe((use) => use(use(viewInstance.viewSection.table).summarySourceTable), () =>
|
|
|
|
cssSigmaIcon('Pivot', testId('sigma'))),
|
2022-04-27 17:46:24 +00:00
|
|
|
buildWidgetTitle(vs, options, testId('viewsection-title'), cssTestClick(testId("viewsection-blank"))),
|
2022-03-11 10:48:36 +00:00
|
|
|
viewInstance.buildTitleControls(),
|
|
|
|
dom('span.viewsection_buttons',
|
|
|
|
dom.create(viewSectionMenu, gristDoc.docModel, vs, gristDoc.isReadonly)
|
|
|
|
)
|
|
|
|
)),
|
|
|
|
dom.maybe((use) => use(vs.activeFilterBar) || use(vs.isRaw) && use(vs.activeFilters).length,
|
|
|
|
() => dom.create(filterBar, vs)),
|
2022-09-29 16:32:54 +00:00
|
|
|
dom.maybe<BaseView|null>(vs.viewInstance, (viewInstance) => [
|
2022-03-11 10:48:36 +00:00
|
|
|
dom('div.view_data_pane_container.flexvbox',
|
|
|
|
cssResizing.cls('', isResizing),
|
|
|
|
dom.maybe(viewInstance.disableEditing, () =>
|
|
|
|
dom('div.disable_viewpane.flexvbox', 'No data')
|
|
|
|
),
|
|
|
|
dom.maybe(viewInstance.isTruncated, () =>
|
|
|
|
dom('div.viewsection_truncated', 'Not all data is shown')
|
|
|
|
),
|
|
|
|
dom.cls((use) => 'viewsection_type_' + use(vs.parentKey)),
|
2022-09-29 16:32:54 +00:00
|
|
|
viewInstance.viewPane,
|
|
|
|
),
|
|
|
|
dom.maybe(use => !use(isNarrowScreenObs()), () => viewInstance.selectionSummary?.buildDom()),
|
|
|
|
]),
|
2022-03-11 10:48:36 +00:00
|
|
|
dom.on('mousedown', () => { viewModel?.activeSectionId(sectionRowId); }),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-04-27 17:46:24 +00:00
|
|
|
// With new widgetPopup it is hard to click on viewSection without a activating it, hence we
|
|
|
|
// add a little blank space to use in test.
|
|
|
|
const cssTestClick = styled(`div`, `
|
2022-04-27 11:59:19 +00:00
|
|
|
min-width: 2px;
|
2022-04-27 17:46:24 +00:00
|
|
|
`);
|
2022-03-11 10:48:36 +00:00
|
|
|
|
2021-07-08 18:52:51 +00:00
|
|
|
const cssSigmaIcon = styled(icon, `
|
|
|
|
bottom: 1px;
|
|
|
|
margin-right: 5px;
|
2022-09-06 01:51:57 +00:00
|
|
|
background-color: ${theme.lightText}
|
2021-07-08 18:52:51 +00:00
|
|
|
`);
|
|
|
|
|
2021-02-09 04:40:04 +00:00
|
|
|
const cssViewLeaf = styled('div', `
|
|
|
|
@media ${mediaSmall} {
|
|
|
|
& {
|
|
|
|
margin: 4px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssViewLeafInactive = styled('div', `
|
2021-02-10 22:00:41 +00:00
|
|
|
@media screen and ${mediaSmall} {
|
2021-02-09 04:40:04 +00:00
|
|
|
& {
|
|
|
|
overflow: hidden;
|
|
|
|
background: repeating-linear-gradient(
|
|
|
|
-45deg,
|
2022-09-06 01:51:57 +00:00
|
|
|
${theme.widgetInactiveStripesDark},
|
|
|
|
${theme.widgetInactiveStripesDark} 10px,
|
|
|
|
${theme.widgetInactiveStripesLight} 10px,
|
|
|
|
${theme.widgetInactiveStripesLight} 20px
|
2021-02-09 04:40:04 +00:00
|
|
|
);
|
2022-09-06 01:51:57 +00:00
|
|
|
border: 1px solid ${theme.widgetBorder};
|
2021-02-09 04:40:04 +00:00
|
|
|
border-radius: 4px;
|
|
|
|
padding: 0 2px;
|
|
|
|
}
|
|
|
|
&::after {
|
|
|
|
content: '';
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
}
|
|
|
|
&.layout_vbox {
|
|
|
|
max-width: 32px;
|
|
|
|
}
|
|
|
|
&.layout_hbox {
|
|
|
|
max-height: 32px;
|
|
|
|
}
|
|
|
|
& > .viewsection_title.flexhbox {
|
|
|
|
position: absolute;
|
|
|
|
}
|
|
|
|
& > .view_data_pane_container,
|
|
|
|
& .viewsection_buttons,
|
2021-08-03 16:01:12 +00:00
|
|
|
& .grist-single-record__menu,
|
|
|
|
& > .filter_bar {
|
2021-02-09 04:40:04 +00:00
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssLayoutBox = styled('div', `
|
2021-02-10 22:00:41 +00:00
|
|
|
@media screen and ${mediaSmall} {
|
2021-02-09 04:40:04 +00:00
|
|
|
&-active, &-inactive {
|
|
|
|
transition: flex-grow 0.4s;
|
|
|
|
}
|
|
|
|
&-active > &-inactive,
|
|
|
|
&-active > &-inactive.layout_hbox .layout_hbox,
|
|
|
|
&-active > &-inactive.layout_vbox .layout_vbox {
|
|
|
|
flex: none !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-active > &-inactive.layout_hbox.layout_leaf,
|
|
|
|
&-active > &-inactive.layout_hbox .layout_hbox.layout_leaf {
|
|
|
|
height: 40px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-active > &-inactive.layout_vbox.layout_leaf,
|
|
|
|
&-active > &-inactive.layout_vbox .layout_vbox.layout_leaf {
|
|
|
|
width: 40px;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-inactive.layout_leaf {
|
|
|
|
min-height: 40px;
|
|
|
|
min-width: 40px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`);
|
2021-03-05 03:35:53 +00:00
|
|
|
|
|
|
|
// This class is added while sections are being resized (or otherwise edited), to ensure that the
|
|
|
|
// content of the section (such as an iframe) doesn't interfere with mouse drag-related events.
|
|
|
|
// (It assumes that contained elements do not set pointer-events to another value; if that were
|
|
|
|
// important then we'd need to use an overlay element during dragging.)
|
|
|
|
const cssResizing = styled('div', `
|
|
|
|
pointer-events: none;
|
|
|
|
`);
|