chore: use a specific panel class for table view

This commit is contained in:
Yohan Boniface 2024-03-15 11:34:09 +01:00
parent 0b175d1a56
commit 849b194d4f
6 changed files with 42 additions and 18 deletions

View file

@ -3,7 +3,7 @@
/* as being out of the visible viewport is not enough */ /* as being out of the visible viewport is not enough */
visibility: hidden; visibility: hidden;
position: absolute; position: absolute;
bottom: 20px; bottom: 10px;
overflow-x: auto; overflow-x: auto;
z-index: 1010; z-index: 1010;
background-color: #fff; background-color: #fff;
@ -17,12 +17,15 @@
background-color: var(--color-darkGray); background-color: var(--color-darkGray);
color: #efefef; color: #efefef;
} }
.panel.fullwidth { .panel.full {
width: 100%; width: initial;
right: -100%; right: -100%;
z-index: 10000; z-index: 10000;
padding-left: 0; }
padding-right: 0; .panel.full.on {
visibility: visible;
right: 10px;
left: 10px;
} }
.umap-caption-bar-enabled .panel { .umap-caption-bar-enabled .panel {
bottom: 46px; bottom: 46px;
@ -43,6 +46,7 @@
clear: both; clear: both;
height: calc(100% - 32px); /* Minus size of toolbox */ height: calc(100% - 32px); /* Minus size of toolbox */
padding: 10px; padding: 10px;
padding-top: 32px;
} }
.panel .toolbox { .panel .toolbox {
padding: 5px 10px; padding: 5px 10px;
@ -53,10 +57,14 @@
justify-content: flex-start; justify-content: flex-start;
gap: 5px; gap: 5px;
line-height: 2.2em; line-height: 2.2em;
background-color: #fff;
position: fixed;
} }
.panel.dark .toolbox { .panel.dark .toolbox {
background-color: var(--color-darkGray); background-color: var(--color-darkGray);
border-bottom: 1px solid #232729; }
.panel.full .toolbox {
width: calc(100% - 112px);
} }
.panel .toolbox li { .panel .toolbox li {
cursor: pointer; cursor: pointer;
@ -80,7 +88,11 @@
.panel { .panel {
top: 0; top: 0;
margin-top: 10px; margin-top: 10px;
width: 390px; width: 400px;
}
.panel .toolbox {
/* It overflows otherwise, dunno why */
width: 398px;
} }
.panel.condensed { .panel.condensed {
max-height: 500px; max-height: 500px;
@ -113,8 +125,15 @@
bottom: 0; bottom: 0;
right: -100%; right: -100%;
} }
.panel.left {
left: -100%;
}
.panel .toolbox {
width: 100%;
}
.panel.on { .panel.on {
right: 0; right: 0;
left: 0;
visibility: visible; visibility: visible;
} }
} }

View file

@ -1,6 +1,6 @@
import URLs from './urls.js' import URLs from './urls.js'
import Browser from './browser.js' import Browser from './browser.js'
import { Panel, EditPanel } from './panel.js' import { Panel, EditPanel, FullPanel } from './panel.js'
import * as Utils from './utils.js' import * as Utils from './utils.js'
import { SCHEMA } from './schema.js' import { SCHEMA } from './schema.js'
import { Request, ServerRequest, RequestError, HTTPError, NOKError } from './request.js' import { Request, ServerRequest, RequestError, HTTPError, NOKError } from './request.js'
@ -19,6 +19,7 @@ window.U = {
Browser, Browser,
Panel, Panel,
EditPanel, EditPanel,
FullPanel,
Utils, Utils,
SCHEMA, SCHEMA,
Orderable, Orderable,

View file

@ -79,3 +79,8 @@ export class Panel {
export class EditPanel extends Panel { export class EditPanel extends Panel {
CLASSNAME = 'right dark' CLASSNAME = 'right dark'
} }
export class FullPanel extends Panel {
CLASSNAME = 'full dark'
MODE = 'expanded'
}

View file

@ -57,7 +57,10 @@ U.Map = L.Map.extend({
this.urls = new U.URLs(this.options.urls) this.urls = new U.URLs(this.options.urls)
this.panel = new U.Panel(this._container) this.panel = new U.Panel(this._container)
if (this.hasEditMode()) this.editPanel = new U.EditPanel(this._container) if (this.hasEditMode()) {
this.editPanel = new U.EditPanel(this._container)
this.fullPanel = new U.FullPanel(this._container)
}
this.ui = new U.UI(this._container) this.ui = new U.UI(this._container)
this.ui.on('dataloading', (e) => this.fire('dataloading', e)) this.ui.on('dataloading', (e) => this.fire('dataloading', e))
this.ui.on('dataload', (e) => this.fire('dataload', e)) this.ui.on('dataload', (e) => this.fire('dataload', e))

View file

@ -94,7 +94,6 @@ U.TableEditor = L.Class.extend({
edit: function () { edit: function () {
const id = 'tableeditor:edit' const id = 'tableeditor:edit'
this.datalayer.map.fire('dataloading', { id: id })
this.compileProperties() this.compileProperties()
this.renderHeaders() this.renderHeaders()
this.body.innerHTML = '' this.body.innerHTML = ''
@ -110,11 +109,10 @@ U.TableEditor = L.Class.extend({
this.edit() this.edit()
} }
L.DomEvent.on(addButton, 'click', addProperty, this) L.DomEvent.on(addButton, 'click', addProperty, this)
this.datalayer.map.ui.openPanel({ this.datalayer.map.fullPanel.open({
data: { html: this.table }, data: { html: this.table },
className: 'umap-table-editor fullwidth dark', className: 'umap-table-editor',
actions: [addButton, U.Browser.backButton(this.datalayer.map)], actions: [addButton, U.Browser.backButton(this.datalayer.map)],
}) })
this.datalayer.map.fire('dataload', { id: id })
}, },
}) })

View file

@ -911,7 +911,9 @@ a.umap-control-caption,
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
background-color: var(--color-lightGray); background-color: var(--color-lightGray);
color: #666; }
.umap-browser .off h5 {
color: #b3b3b3;
} }
.umap-browser.dark h5 { .umap-browser.dark h5 {
background-color: #232729; background-color: #232729;
@ -984,10 +986,6 @@ a.umap-control-caption,
/* ********************************* */ /* ********************************* */
/* Table Editor */ /* Table Editor */
/* ********************************* */ /* ********************************* */
#umap-panel.umap-table-editor {
padding-left: 0;
padding-right: 0;
}
.umap-table-editor .table { .umap-table-editor .table {
display: table; display: table;