From ecbeacf9f91114c0981a4a6c530f39236739e558 Mon Sep 17 00:00:00 2001 From: Samuel Gratzl Date: Mon, 3 Dec 2018 12:42:42 +0100 Subject: [PATCH 1/4] prepare next dev version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cdd0cc995..be94b1495 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "tdp_core", "description": "Target discovery platform for exploring rankings of genes, disease models, and other entities.", "homepage": "https://phovea.caleydo.org", - "version": "5.0.3", + "version": "5.0.4-SNAPSHOT", "author": { "name": "datavisyn", "email": "contact@caleydo.org", From 85c8fac8addffce0b3a960641550e809b74ddc7b Mon Sep 17 00:00:00 2001 From: Samuel Gratzl Date: Mon, 3 Dec 2018 17:50:54 +0100 Subject: [PATCH 2/4] add option to show side panel in the collapsed version in the top row instead of side --- src/lineup/ARankingView.ts | 13 +- src/lineup/internal/LineUpPanelActions.ts | 43 ++-- src/styles/_view_lineup.scss | 236 +++++++++++++--------- 3 files changed, 171 insertions(+), 121 deletions(-) diff --git a/src/lineup/ARankingView.ts b/src/lineup/ARankingView.ts index 90ed1e381..9341c9b7a 100644 --- a/src/lineup/ARankingView.ts +++ b/src/lineup/ARankingView.ts @@ -63,7 +63,7 @@ export interface IARankingViewOptions { */ enableZoom: boolean; - enableSidePanel: boolean | 'collapsed'; + enableSidePanel: boolean | 'collapsed' | 'top'; enableAddingColumns: boolean; @@ -233,7 +233,9 @@ export abstract class ARankingView extends AView { if (this.options.enableSidePanel) { this.node.appendChild(this.panel.node); - this.taggle.pushUpdateAble((ctx) => this.panel.panel.update(ctx)); + if (this.options.enableSidePanel !== 'top') { + this.taggle.pushUpdateAble((ctx) => this.panel.panel.update(ctx)); + } } this.selectionHelper = new LineUpSelectionHelper(this.provider, () => this.itemIDType); @@ -248,7 +250,12 @@ export abstract class ARankingView extends AView { // inject stats const base = params.querySelector('form') || params; base.insertAdjacentHTML('beforeend', `
`); - base.lastElementChild!.appendChild(this.stats); + const container = base.lastElementChild!; + container.appendChild(this.stats); + + if (this.options.enableSidePanel === 'top') { + container.insertAdjacentElement('afterbegin', this.panel.node); + } }); } diff --git a/src/lineup/internal/LineUpPanelActions.ts b/src/lineup/internal/LineUpPanelActions.ts index 458939211..1f8d60553 100644 --- a/src/lineup/internal/LineUpPanelActions.ts +++ b/src/lineup/internal/LineUpPanelActions.ts @@ -59,7 +59,8 @@ export default class LineUpPanelActions extends EventHandler { private readonly search: SearchBox | null; - readonly panel: SidePanel; + readonly panel: SidePanel | null; + readonly node: HTMLElement; private overview: HTMLElement; private wasCollapsed = false; @@ -76,13 +77,17 @@ export default class LineUpPanelActions extends EventHandler { }); } - this.panel = new SidePanel(ctx, doc, { - chooser: false - }); - - if (options.enableSidePanel === 'collapsed') { - this.collapse = true; + if (this.options.enableSidePanel !== 'top') { + this.panel = new SidePanel(ctx, doc, { + chooser: false + }); + this.node = this.panel.node; + } else { + this.node = doc.createElement('div'); + this.node.classList.add('lu-side-panel', 'lu-side-panel-top'); } + this.node.classList.add('tdp-view-lineup'); + this.collapse = options.enableSidePanel === 'top' || options.enableSidePanel === 'collapsed'; this.init(); } @@ -118,26 +123,28 @@ export default class LineUpPanelActions extends EventHandler { this.node.style.display = 'flex'; } - get wasHidden() { - return this.node.style.display === 'none'; + private get isTopMode() { + return this.options.enableSidePanel === 'top'; } - get node() { - return this.panel.node; + get wasHidden() { + return this.node.style.display === 'none'; } private init() { this.node.insertAdjacentHTML('afterbegin', ` -
${this.search ? '' : ''}
`); - this.node.querySelector('a')!.addEventListener('click', (evt) => { - evt.preventDefault(); - evt.stopPropagation(); - this.collapse = !this.collapse; - }); + if (!this.isTopMode) { // top mode doesn't need collapse feature + this.node.insertAdjacentHTML('afterbegin', ``); + this.node.querySelector('a')!.addEventListener('click', (evt) => { + evt.preventDefault(); + evt.stopPropagation(); + this.collapse = !this.collapse; + }); + } const buttons = this.node.querySelector('section'); this.appendExtraButtons().forEach((b) => buttons.appendChild(b)); @@ -211,7 +218,7 @@ export default class LineUpPanelActions extends EventHandler { node.innerHTML = ` -