mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Remove code related to newui
Summary: Change code that conditionally depended on #newui in the URL to assume that everything is always in the new UI now. Test Plan: this Reviewers: dsagal Reviewed By: dsagal Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D3246
This commit is contained in:
@@ -17,7 +17,7 @@ import {BaseAPI} from 'app/common/BaseAPI';
|
||||
import {DisposableWithEvents} from 'app/common/DisposableWithEvents';
|
||||
import {fetchFromHome} from 'app/common/urlUtils';
|
||||
import {ISupportedFeatures} from 'app/common/UserConfig';
|
||||
import {dom, DomElementMethod} from 'grainjs';
|
||||
import {dom} from 'grainjs';
|
||||
import * as ko from 'knockout';
|
||||
|
||||
// tslint:disable:no-console
|
||||
@@ -31,9 +31,6 @@ export class App extends DisposableWithEvents {
|
||||
// Used by #newui code to avoid a dependency on commands.js, and by tests to issue commands.
|
||||
public allCommands = commands.allCommands;
|
||||
|
||||
// Whether new UI should be produced by code that can do either old or new.
|
||||
public readonly useNewUI: true = true;
|
||||
|
||||
public comm = this.autoDispose(Comm.create());
|
||||
public clientScope: ClientScope;
|
||||
public features: ko.Computed<ISupportedFeatures>;
|
||||
@@ -182,14 +179,6 @@ export class App extends DisposableWithEvents {
|
||||
this.topAppModel.reload();
|
||||
}
|
||||
|
||||
// When called as a dom method, adds the "newui" class when ?newui=1 is set. For example
|
||||
// dom('div.some-old-class', this.app.addNewUIClass(), ...)
|
||||
// Then you may override newui styles in CSS by using selectors like:
|
||||
// .some-old-class.newui { ... }
|
||||
public addNewUIClass(): DomElementMethod {
|
||||
return (elem) => { if (this.useNewUI) { elem.classList.add('newui'); } };
|
||||
}
|
||||
|
||||
// Intended to be used by tests to enable specific features.
|
||||
public enableFeature(featureName: keyof ISupportedFeatures, onOff: boolean) {
|
||||
const features = this.features();
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#doc_window {
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#doc_pane {
|
||||
overflow: hidden;
|
||||
z-index: 7;
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
|
||||
#doc_pane.newui {
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#view_pane {
|
||||
position: relative;
|
||||
min-width: 240px;
|
||||
|
||||
background-color: #f4f4f4;
|
||||
margin: 3px;
|
||||
}
|
||||
|
||||
#doc_pane.newui > #view_pane {
|
||||
background-color: white;
|
||||
margin: 0px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
#view_content {
|
||||
position: relative;
|
||||
}
|
||||
@@ -343,7 +343,7 @@ export class RightPanel extends Disposable {
|
||||
|
||||
dom.maybe((use) => use(this._pageWidgetType) !== 'chart', () => [
|
||||
cssSeparator(),
|
||||
dom.create(VisibleFieldsConfig, this._gristDoc, activeSection, true),
|
||||
dom.create(VisibleFieldsConfig, this._gristDoc, activeSection),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -77,8 +77,7 @@ export class VisibleFieldsConfig extends Disposable {
|
||||
private _hiddenFieldsSelection = new Set<number>();
|
||||
|
||||
constructor(private _gristDoc: GristDoc,
|
||||
private _section: ViewSectionRec,
|
||||
private _useNewUI: boolean = false) {
|
||||
private _section: ViewSectionRec) {
|
||||
super();
|
||||
|
||||
// Unselects visible fields that are hidden.
|
||||
@@ -98,7 +97,6 @@ export class VisibleFieldsConfig extends Disposable {
|
||||
* Build the draggable list components to show the visible fields of a section.
|
||||
*/
|
||||
public buildVisibleFieldsConfigHelper(options: DraggableFieldsOption) {
|
||||
const itemClass = this._useNewUI ? cssDragRow.className : 'view_config_draggable_field';
|
||||
let fields = this._section.viewFields.peek();
|
||||
|
||||
if (options.skipFirst || options.filterFunc) {
|
||||
@@ -131,7 +129,7 @@ export class VisibleFieldsConfig extends Disposable {
|
||||
fields,
|
||||
options.itemCreateFunc,
|
||||
{
|
||||
itemClass,
|
||||
itemClass: cssDragRow.className,
|
||||
reorder: this.changeFieldPosition.bind(this),
|
||||
remove: this.removeField.bind(this),
|
||||
receive: this.addField.bind(this),
|
||||
@@ -145,8 +143,8 @@ export class VisibleFieldsConfig extends Disposable {
|
||||
* section. Each draggable list can be parametrized using both `options.visibleFields` and
|
||||
* `options.hiddenFields` options.
|
||||
*
|
||||
* @param {DraggableFieldOption} options.hiddenFields options for the list of hidden fields.
|
||||
* @param {DraggableFieldOption} options.visibleFields options for the list of visible fields.
|
||||
* @param {DraggableFieldsOption} options.hiddenFields options for the list of hidden fields.
|
||||
* @param {DraggableFieldsOption} options.visibleFields options for the list of visible fields.
|
||||
* @return {[Element, Element]} the two draggable elements (ie: koForm.draggableList) showing
|
||||
* respectivelly the list of visible fields and the list of hidden
|
||||
* fields of section.
|
||||
@@ -157,13 +155,12 @@ export class VisibleFieldsConfig extends Disposable {
|
||||
hiddenFields: DraggableFieldsOption,
|
||||
}): [HTMLElement, HTMLElement] {
|
||||
|
||||
const itemClass = this._useNewUI ? cssDragRow.className : 'view_config_draggable_field';
|
||||
const fieldsDraggable = this.buildVisibleFieldsConfigHelper(options.visibleFields);
|
||||
const hiddenFieldsDraggable = kf.draggableList(
|
||||
this._hiddenFields,
|
||||
options.hiddenFields.itemCreateFunc,
|
||||
{
|
||||
itemClass,
|
||||
itemClass: cssDragRow.className,
|
||||
reorder() { throw new Error('Hidden Fields cannot be reordered'); },
|
||||
receive() { throw new Error('Cannot drop items into Hidden Fields'); },
|
||||
remove(item: ColumnRec) {
|
||||
|
||||
Reference in New Issue
Block a user