Merge branch 'master' into swg-randomness

This commit is contained in:
Andrew Henry 2020-03-09 13:11:31 -07:00 committed by GitHub
commit ddfa611c44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 67 additions and 15 deletions

View File

@ -143,7 +143,7 @@ define([
let strategy; let strategy;
if (this.model.interpolate !== 'none') { if (this.model.interpolate !== 'none') {
strategy = 'minMax'; strategy = 'minmax';
} }
options = _.extend({}, { size: 1000, strategy, filters: this.filters }, options || {}); options = _.extend({}, { size: 1000, strategy, filters: this.filters }, options || {});

View File

@ -28,7 +28,7 @@
<button <button
v-if="allowExport" v-if="allowExport"
class="c-button icon-download labeled" class="c-button icon-download labeled"
title="Export This View's Data" title="Export this view's data"
@click="exportAllDataAsCSV()" @click="exportAllDataAsCSV()"
> >
<span class="c-button__label">Export Table Data</span> <span class="c-button__label">Export Table Data</span>
@ -37,7 +37,7 @@
v-if="allowExport" v-if="allowExport"
v-show="markedRows.length" v-show="markedRows.length"
class="c-button icon-download labeled" class="c-button icon-download labeled"
title="Export Marked Rows As CSV" title="Export marked rows as CSV"
@click="exportMarkedDataAsCSV()" @click="exportMarkedDataAsCSV()"
> >
<span class="c-button__label">Export Marked Rows</span> <span class="c-button__label">Export Marked Rows</span>
@ -45,7 +45,7 @@
<button <button
v-show="markedRows.length" v-show="markedRows.length"
class="c-button icon-x labeled" class="c-button icon-x labeled"
title="Unmark All Rows" title="Unmark all rows"
@click="unmarkAllRows()" @click="unmarkAllRows()"
> >
<span class="c-button__label">Unmark All Rows</span> <span class="c-button__label">Unmark All Rows</span>
@ -58,7 +58,7 @@
v-if="marking.enable" v-if="marking.enable"
class="c-button icon-pause pause-play labeled" class="c-button icon-pause pause-play labeled"
:class=" paused ? 'icon-play is-paused' : 'icon-pause'" :class=" paused ? 'icon-play is-paused' : 'icon-pause'"
:title="paused ? 'Continue Data Flow' : 'Pause Data Flow'" :title="paused ? 'Continue real-time data flow' : 'Pause real-time data flow'"
@click="togglePauseByButton()" @click="togglePauseByButton()"
> >
<span class="c-button__label"> <span class="c-button__label">
@ -66,6 +66,29 @@
</span> </span>
</button> </button>
<template v-if="!isEditing">
<div
class="c-separator"
>
</div>
<button
v-if="isAutosizeEnabled"
class="c-button icon-arrows-right-left labeled"
title="Increase column widths to fit currently available data."
@click="recalculateColumnWidths"
>
<span class="c-button__label">Expand Columns</span>
</button>
<button
v-else
class="c-button icon-expand labeled"
title="Automatically size columns to fit the table into the available space."
@click="autosizeColumns"
>
<span class="c-button__label">Autosize Columns</span>
</button>
</template>
<slot name="buttons"></slot> <slot name="buttons"></slot>
</div> </div>
<!-- main controlbar end --> <!-- main controlbar end -->
@ -461,17 +484,20 @@ export default {
this.scrollW = (this.scrollable.offsetWidth - this.scrollable.clientWidth) + 1; this.scrollW = (this.scrollable.offsetWidth - this.scrollable.clientWidth) + 1;
}, },
calculateColumnWidths() { calculateColumnWidths() {
let columnWidths = {}; let columnWidths = {},
let totalWidth = 0; totalWidth = 0,
let sizingRowEl = this.sizingTable.children[0]; headerKeys = Object.keys(this.headers),
let sizingCells = Array.from(sizingRowEl.children); sizingTableRow = this.sizingTable.children[0],
let headerKeys = Object.keys(this.headers); sizingCells = sizingTableRow.children;
headerKeys.forEach((headerKey, headerIndex)=>{ headerKeys.forEach((headerKey, headerIndex, array)=>{
if (this.isAutosizeEnabled) {
columnWidths[headerKey] = this.sizingTable.clientWidth / array.length;
} else {
let cell = sizingCells[headerIndex]; let cell = sizingCells[headerIndex];
let columnWidth = cell.offsetWidth; columnWidths[headerKey] = cell.offsetWidth;
columnWidths[headerKey] = columnWidth; }
totalWidth += columnWidth; totalWidth += columnWidths[headerKey];
}); });
this.columnWidths = columnWidths; this.columnWidths = columnWidths;
@ -818,6 +844,31 @@ export default {
this.setHeight(); this.setHeight();
this.scrollable.scrollTop = this.userScroll; this.scrollable.scrollTop = this.userScroll;
} }
},
updateWidthsAndClearSizingTable() {
this.calculateColumnWidths();
this.configuredColumnWidths = this.columnWidths;
this.visibleRows.forEach((row, i) => {
this.$set(this.sizingRows, i, undefined);
delete this.sizingRows[i];
});
},
recalculateColumnWidths() {
this.visibleRows.forEach((row,i) => {
this.$set(this.sizingRows, i, row);
});
this.configuredColumnWidths = {};
this.isAutosizeEnabled = false;
this.$nextTick()
.then(this.updateWidthsAndClearSizingTable);
},
autosizeColumns() {
this.isAutosizeEnabled = true;
this.$nextTick().then(this.calculateColumnWidths);
} }
} }
} }

View File

@ -619,6 +619,7 @@ select {
.c-separator { .c-separator {
@include cToolbarSeparator(); @include cToolbarSeparator();
height: 100%;
} }
.c-toolbar { .c-toolbar {