minor fixes
- edit cell orange border - eslint fixes - remove default left align
This commit is contained in:
parent
4bb4002300
commit
5ff72dfcee
@ -1,8 +1,6 @@
|
||||
import $ from './dom';
|
||||
import Clusterize from 'clusterize.js';
|
||||
import {
|
||||
nextTick
|
||||
} from './utils';
|
||||
import $ from './dom';
|
||||
import { nextTick } from './utils';
|
||||
|
||||
export default class BodyRenderer {
|
||||
constructor(instance) {
|
||||
@ -60,9 +58,7 @@ export default class BodyRenderer {
|
||||
scrollElem: this.bodyScrollable,
|
||||
contentElem: $('tbody', this.bodyScrollable),
|
||||
callbacks: {
|
||||
clusterChanged: () => {
|
||||
this.restoreState();
|
||||
}
|
||||
clusterChanged: () => this.restoreState()
|
||||
},
|
||||
/* eslint-disable */
|
||||
show_no_data_row: false,
|
||||
@ -99,7 +95,7 @@ export default class BodyRenderer {
|
||||
}
|
||||
|
||||
getDataForClusterize(rows) {
|
||||
return rows.map((row) => this.rowmanager.getRowHTML(row, row.meta));
|
||||
return rows.map(row => this.rowmanager.getRowHTML(row, row.meta));
|
||||
}
|
||||
|
||||
getBodyHTML(rows) {
|
||||
@ -109,4 +105,4 @@ export default class BodyRenderer {
|
||||
</tbody>
|
||||
`;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -5,9 +5,7 @@ import {
|
||||
linkProperties
|
||||
} from './utils';
|
||||
import $ from './dom';
|
||||
import {
|
||||
getDropdownHTML
|
||||
} from './columnmanager';
|
||||
import { getDropdownHTML } from './columnmanager';
|
||||
|
||||
export default class CellManager {
|
||||
constructor(instance) {
|
||||
@ -46,7 +44,7 @@ export default class CellManager {
|
||||
this.activateEditing(cell);
|
||||
});
|
||||
|
||||
this.keyboard.on('enter', (e) => {
|
||||
this.keyboard.on('enter', () => {
|
||||
if (this.$focusedCell && !this.$editingCell) {
|
||||
// enter keypress on focused cell
|
||||
this.activateEditing(this.$focusedCell);
|
||||
@ -105,13 +103,11 @@ export default class CellManager {
|
||||
return true;
|
||||
};
|
||||
|
||||
['left', 'right', 'up', 'down', 'tab', 'shift+tab'].map(
|
||||
direction => this.keyboard.on(direction, () => focusCell(direction))
|
||||
);
|
||||
['left', 'right', 'up', 'down', 'tab', 'shift+tab']
|
||||
.map(direction => this.keyboard.on(direction, () => focusCell(direction)));
|
||||
|
||||
['left', 'right', 'up', 'down'].map(
|
||||
direction => this.keyboard.on('ctrl+' + direction, () => focusLastCell(direction))
|
||||
);
|
||||
['left', 'right', 'up', 'down']
|
||||
.map(direction => this.keyboard.on(`ctrl+${direction}`, () => focusLastCell(direction)));
|
||||
|
||||
this.keyboard.on('esc', () => {
|
||||
this.deactivateEditing();
|
||||
@ -120,9 +116,7 @@ export default class CellManager {
|
||||
if (this.options.inlineFilters) {
|
||||
this.keyboard.on('ctrl+f', (e) => {
|
||||
const $cell = $.closest('.data-table-cell', e.target);
|
||||
let {
|
||||
colIndex
|
||||
} = $.data($cell);
|
||||
const { colIndex } = $.data($cell);
|
||||
|
||||
this.activateFilter(colIndex);
|
||||
return true;
|
||||
@ -147,10 +141,9 @@ export default class CellManager {
|
||||
return $selectionCursor;
|
||||
};
|
||||
|
||||
['left', 'right', 'up', 'down'].map(
|
||||
direction => this.keyboard.on('shift+' + direction,
|
||||
() => this.selectArea(getNextSelectionCursor(direction)))
|
||||
);
|
||||
['left', 'right', 'up', 'down']
|
||||
.map(direction =>
|
||||
this.keyboard.on(`shift+${direction}`, () => this.selectArea(getNextSelectionCursor(direction))));
|
||||
}
|
||||
|
||||
bindCopyCellContents() {
|
||||
@ -298,7 +291,7 @@ export default class CellManager {
|
||||
// valid selection
|
||||
this.$selectionCursor = $selectionCursor;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
_selectArea($cell1, $cell2) {
|
||||
if ($cell1 === $cell2) return false;
|
||||
@ -318,7 +311,6 @@ export default class CellManager {
|
||||
[colIndex1, rowIndex1, colIndex2, rowIndex2] = arguments;
|
||||
} else
|
||||
if (typeof $cell1 === 'object') {
|
||||
|
||||
if (!($cell1 && $cell2)) {
|
||||
return false;
|
||||
}
|
||||
@ -344,17 +336,17 @@ export default class CellManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
let cells = [];
|
||||
const cells = [];
|
||||
let colIndex = colIndex1;
|
||||
let rowIndex = rowIndex1;
|
||||
let rowIndices = [];
|
||||
const rowIndices = [];
|
||||
|
||||
while (rowIndex <= rowIndex2) {
|
||||
rowIndices.push(rowIndex);
|
||||
rowIndex++;
|
||||
rowIndex += 1;
|
||||
}
|
||||
|
||||
rowIndices.map(rowIndex => {
|
||||
rowIndices.map((rowIndex) => {
|
||||
while (colIndex <= colIndex2) {
|
||||
cells.push([colIndex, rowIndex]);
|
||||
colIndex++;
|
||||
|
||||
@ -113,7 +113,6 @@ export default class DataManager {
|
||||
prepareCell(content, i) {
|
||||
const cell = {
|
||||
content: '',
|
||||
align: 'left',
|
||||
sortOrder: 'none',
|
||||
colIndex: i,
|
||||
column: this.columns[i]
|
||||
|
||||
@ -7,7 +7,6 @@ import BodyRenderer from './body-renderer';
|
||||
import Style from './style';
|
||||
import Keyboard from './keyboard';
|
||||
import DEFAULT_OPTIONS from './defaults';
|
||||
import './style.css';
|
||||
|
||||
class DataTable {
|
||||
constructor(wrapper, options) {
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
--primary-color: rgb(82, 146, 247);
|
||||
--light-bg: #f5f7fa;
|
||||
--light-red: #FD8B8B;
|
||||
--orange: rgb(255, 160, 10);
|
||||
--text-color: #000000;
|
||||
--text-light: #dfe2e5;
|
||||
|
||||
@ -213,7 +214,7 @@
|
||||
.edit-cell {
|
||||
display: none;
|
||||
padding: var(--spacer-2);
|
||||
background: #fff;
|
||||
background-color: #fff;
|
||||
z-index: 1;
|
||||
height: 100%;
|
||||
}
|
||||
@ -228,7 +229,7 @@
|
||||
}
|
||||
|
||||
.edit-cell {
|
||||
border: 2px solid var(--primary-color);
|
||||
border: 2px solid var(--orange);
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user