handsontable 0.0.0-next-5b14d3c-20241107 → 0.0.0-next-6129043-20241108
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/calculator/index.js +1 -2
- package/3rdparty/walkontable/src/calculator/index.mjs +2 -2
- package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -3
- package/3rdparty/walkontable/src/core/_base.js +3 -0
- package/3rdparty/walkontable/src/core/_base.mjs +3 -0
- package/3rdparty/walkontable/src/core/clone.js +1 -0
- package/3rdparty/walkontable/src/core/clone.mjs +1 -0
- package/3rdparty/walkontable/src/core/core.js +2 -0
- package/3rdparty/walkontable/src/core/core.mjs +2 -0
- package/3rdparty/walkontable/src/facade/core.js +3 -0
- package/3rdparty/walkontable/src/facade/core.mjs +3 -0
- package/3rdparty/walkontable/src/index.js +0 -1
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +3 -1
- package/3rdparty/walkontable/src/overlay/_base.mjs +3 -1
- package/3rdparty/walkontable/src/overlay/bottom.js +2 -2
- package/3rdparty/walkontable/src/overlay/bottom.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/top.js +1 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/index.js +4 -2
- package/3rdparty/walkontable/src/renderer/index.mjs +4 -2
- package/3rdparty/walkontable/src/renderer/table.js +12 -3
- package/3rdparty/walkontable/src/renderer/table.mjs +12 -3
- package/3rdparty/walkontable/src/settings.js +0 -2
- package/3rdparty/walkontable/src/settings.mjs +0 -2
- package/3rdparty/walkontable/src/table.js +15 -9
- package/3rdparty/walkontable/src/table.mjs +15 -9
- package/3rdparty/walkontable/src/types.js +1 -0
- package/3rdparty/walkontable/src/types.mjs +1 -0
- package/3rdparty/walkontable/src/utils/column.js +1 -1
- package/3rdparty/walkontable/src/utils/column.mjs +1 -1
- package/3rdparty/walkontable/src/utils/stylesHandler.js +271 -0
- package/3rdparty/walkontable/src/utils/stylesHandler.mjs +267 -0
- package/3rdparty/walkontable/src/viewport.js +1 -0
- package/3rdparty/walkontable/src/viewport.mjs +1 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +2 -0
- package/core.js +46 -0
- package/core.mjs +46 -0
- package/dataMap/metaManager/metaSchema.js +23 -3
- package/dataMap/metaManager/metaSchema.mjs +23 -3
- package/dist/handsontable.css +17 -9
- package/dist/handsontable.full.css +249 -240
- package/dist/handsontable.full.js +4119 -3840
- package/dist/handsontable.full.min.css +11 -9
- package/dist/handsontable.full.min.js +26 -26
- package/dist/handsontable.js +3826 -3541
- package/dist/handsontable.min.css +5 -4
- package/dist/handsontable.min.js +24 -24
- package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
- package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
- package/editors/baseEditor/baseEditor.js +1 -1
- package/editors/baseEditor/baseEditor.mjs +1 -1
- package/editors/dateEditor/dateEditor.js +2 -0
- package/editors/dateEditor/dateEditor.mjs +2 -0
- package/editors/handsontableEditor/handsontableEditor.js +2 -1
- package/editors/handsontableEditor/handsontableEditor.mjs +2 -1
- package/editors/selectEditor/selectEditor.js +20 -9
- package/editors/selectEditor/selectEditor.mjs +20 -9
- package/editors/textEditor/textEditor.js +4 -11
- package/editors/textEditor/textEditor.mjs +4 -11
- package/helpers/dom/element.js +31 -0
- package/helpers/dom/element.mjs +30 -0
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/themes.js +17 -0
- package/helpers/themes.mjs +13 -0
- package/package.json +10 -3
- package/plugins/comments/commentEditor.js +9 -0
- package/plugins/comments/commentEditor.mjs +9 -0
- package/plugins/comments/comments.js +8 -0
- package/plugins/comments/comments.mjs +8 -0
- package/plugins/contextMenu/menu/menu.js +3 -4
- package/plugins/contextMenu/menu/menu.mjs +3 -4
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/manualRowResize/manualRowResize.js +1 -2
- package/plugins/manualRowResize/manualRowResize.mjs +2 -3
- package/plugins/mergeCells/mergeCells.js +1 -1
- package/plugins/mergeCells/mergeCells.mjs +1 -1
- package/plugins/nestedRows/ui/headers.js +7 -1
- package/plugins/nestedRows/ui/headers.mjs +7 -1
- package/plugins/stretchColumns/calculator.js +2 -1
- package/plugins/stretchColumns/calculator.mjs +3 -2
- package/settings.d.ts +1 -0
- package/styles/handsontable.css +2053 -0
- package/styles/handsontable.min.css +30 -0
- package/styles/ht-theme-horizon.css +571 -0
- package/styles/ht-theme-horizon.min.css +30 -0
- package/styles/ht-theme-main.css +575 -0
- package/styles/ht-theme-main.min.css +30 -0
- package/tableView.js +46 -0
- package/tableView.mjs +47 -1
- package/utils/autoResize.js +4 -1
- package/utils/autoResize.mjs +4 -1
- package/utils/ghostTable.js +5 -3
- package/utils/ghostTable.mjs +5 -3
@@ -21,5 +21,4 @@ var _viewportColumns = require("./viewportColumns");
|
|
21
21
|
exports.ViewportColumnsCalculator = _viewportColumns.ViewportColumnsCalculator;
|
22
22
|
exports.DEFAULT_COLUMN_WIDTH = _viewportColumns.DEFAULT_WIDTH;
|
23
23
|
var _viewportRows = require("./viewportRows");
|
24
|
-
exports.ViewportRowsCalculator = _viewportRows.ViewportRowsCalculator;
|
25
|
-
exports.DEFAULT_ROW_HEIGHT = _viewportRows.DEFAULT_HEIGHT;
|
24
|
+
exports.ViewportRowsCalculator = _viewportRows.ViewportRowsCalculator;
|
@@ -7,5 +7,5 @@ import { RenderedAllRowsCalculationType } from "./calculationType/renderedAllRow
|
|
7
7
|
import { RenderedColumnsCalculationType } from "./calculationType/renderedColumns.mjs";
|
8
8
|
import { RenderedRowsCalculationType } from "./calculationType/renderedRows.mjs";
|
9
9
|
import { ViewportColumnsCalculator, DEFAULT_WIDTH } from "./viewportColumns.mjs";
|
10
|
-
import { ViewportRowsCalculator
|
11
|
-
export {
|
10
|
+
import { ViewportRowsCalculator } from "./viewportRows.mjs";
|
11
|
+
export { DEFAULT_WIDTH as DEFAULT_COLUMN_WIDTH, FullyVisibleColumnsCalculationType, FullyVisibleRowsCalculationType, PartiallyVisibleColumnsCalculationType, PartiallyVisibleRowsCalculationType, RenderedAllColumnsCalculationType, RenderedAllRowsCalculationType, RenderedColumnsCalculationType, RenderedRowsCalculationType, ViewportColumnsCalculator, ViewportRowsCalculator };
|
@@ -7,8 +7,6 @@ var _viewportBase = require("./viewportBase");
|
|
7
7
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
9
9
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
10
|
-
const DEFAULT_HEIGHT = exports.DEFAULT_HEIGHT = 23;
|
11
|
-
|
12
10
|
/**
|
13
11
|
* @typedef {object} ViewportRowsCalculatorOptions
|
14
12
|
* @property {Map<string, ViewportBaseCalculator>} calculationTypes The calculation types to be performed.
|
@@ -34,6 +32,7 @@ class ViewportRowsCalculator extends _viewportBase.ViewportBaseCalculator {
|
|
34
32
|
viewportHeight,
|
35
33
|
scrollOffset,
|
36
34
|
totalRows,
|
35
|
+
defaultRowHeight,
|
37
36
|
rowHeightFn,
|
38
37
|
overrideFn,
|
39
38
|
horizontalScrollbarHeight
|
@@ -51,6 +50,7 @@ class ViewportRowsCalculator extends _viewportBase.ViewportBaseCalculator {
|
|
51
50
|
_defineProperty(this, "totalCalculatedHeight", 0);
|
52
51
|
_defineProperty(this, "startPositions", []);
|
53
52
|
_defineProperty(this, "needReverse", true);
|
53
|
+
this.defaultHeight = defaultRowHeight;
|
54
54
|
this.viewportHeight = viewportHeight;
|
55
55
|
this.scrollOffset = scrollOffset;
|
56
56
|
this.zeroBasedScrollOffset = Math.max(scrollOffset, 0);
|
@@ -89,7 +89,7 @@ class ViewportRowsCalculator extends _viewportBase.ViewportBaseCalculator {
|
|
89
89
|
getRowHeight(row) {
|
90
90
|
const rowHeight = this.rowHeightFn(row);
|
91
91
|
if (isNaN(rowHeight)) {
|
92
|
-
return
|
92
|
+
return this.defaultHeight;
|
93
93
|
}
|
94
94
|
return rowHeight;
|
95
95
|
}
|
@@ -4,8 +4,6 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
6
6
|
import { ViewportBaseCalculator } from "./viewportBase.mjs";
|
7
|
-
export const DEFAULT_HEIGHT = 23;
|
8
|
-
|
9
7
|
/**
|
10
8
|
* @typedef {object} ViewportRowsCalculatorOptions
|
11
9
|
* @property {Map<string, ViewportBaseCalculator>} calculationTypes The calculation types to be performed.
|
@@ -31,6 +29,7 @@ export class ViewportRowsCalculator extends ViewportBaseCalculator {
|
|
31
29
|
viewportHeight,
|
32
30
|
scrollOffset,
|
33
31
|
totalRows,
|
32
|
+
defaultRowHeight,
|
34
33
|
rowHeightFn,
|
35
34
|
overrideFn,
|
36
35
|
horizontalScrollbarHeight
|
@@ -48,6 +47,7 @@ export class ViewportRowsCalculator extends ViewportBaseCalculator {
|
|
48
47
|
_defineProperty(this, "totalCalculatedHeight", 0);
|
49
48
|
_defineProperty(this, "startPositions", []);
|
50
49
|
_defineProperty(this, "needReverse", true);
|
50
|
+
this.defaultHeight = defaultRowHeight;
|
51
51
|
this.viewportHeight = viewportHeight;
|
52
52
|
this.scrollOffset = scrollOffset;
|
53
53
|
this.zeroBasedScrollOffset = Math.max(scrollOffset, 0);
|
@@ -86,7 +86,7 @@ export class ViewportRowsCalculator extends ViewportBaseCalculator {
|
|
86
86
|
getRowHeight(row) {
|
87
87
|
const rowHeight = this.rowHeightFn(row);
|
88
88
|
if (isNaN(rowHeight)) {
|
89
|
-
return
|
89
|
+
return this.defaultHeight;
|
90
90
|
}
|
91
91
|
return rowHeight;
|
92
92
|
}
|
@@ -305,6 +305,9 @@ export default class CoreAbstract {
|
|
305
305
|
get selectionManager() {
|
306
306
|
return wot.selectionManager; // TODO refactoring: move outside dao, use IOC
|
307
307
|
},
|
308
|
+
get stylesHandler() {
|
309
|
+
return wot.stylesHandler;
|
310
|
+
},
|
308
311
|
get drawn() {
|
309
312
|
return wot.drawn;
|
310
313
|
},
|
@@ -30,6 +30,7 @@ class Clone extends _base.default {
|
|
30
30
|
const facadeGetter = this.wtSettings.getSetting('facade', this);
|
31
31
|
this.cloneSource = clone.source;
|
32
32
|
this.cloneOverlay = clone.overlay;
|
33
|
+
this.stylesHandler = clone.stylesHandler;
|
33
34
|
this.wtTable = this.cloneOverlay.createTable(this.getTableDao(), facadeGetter, this.domBindings, this.wtSettings);
|
34
35
|
this.wtViewport = clone.viewport;
|
35
36
|
this.selectionManager = clone.selectionManager;
|
@@ -26,6 +26,7 @@ export default class Clone extends CoreAbstract {
|
|
26
26
|
const facadeGetter = this.wtSettings.getSetting('facade', this);
|
27
27
|
this.cloneSource = clone.source;
|
28
28
|
this.cloneOverlay = clone.overlay;
|
29
|
+
this.stylesHandler = clone.stylesHandler;
|
29
30
|
this.wtTable = this.cloneOverlay.createTable(this.getTableDao(), facadeGetter, this.domBindings, this.wtSettings);
|
30
31
|
this.wtViewport = clone.viewport;
|
31
32
|
this.selectionManager = clone.selectionManager;
|
@@ -12,6 +12,7 @@ var _base = _interopRequireDefault(require("./_base"));
|
|
12
12
|
var _manager = require("../selection/manager");
|
13
13
|
var _object = require("../../../../helpers/object");
|
14
14
|
var _element = require("../../../../helpers/dom/element");
|
15
|
+
var _stylesHandler = require("../utils/stylesHandler");
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
16
17
|
/**
|
17
18
|
* @class Walkontable
|
@@ -23,6 +24,7 @@ class Walkontable extends _base.default {
|
|
23
24
|
*/
|
24
25
|
constructor(table, settings) {
|
25
26
|
super(table, new _settings.default(settings));
|
27
|
+
this.stylesHandler = new _stylesHandler.StylesHandler(this.domBindings);
|
26
28
|
const facadeGetter = this.wtSettings.getSetting('facade', this); // todo rethink. I would like to have no access to facade from the internal scope.
|
27
29
|
|
28
30
|
this.wtTable = new _master.default(this.getTableDao(), facadeGetter, this.domBindings, this.wtSettings);
|
@@ -9,6 +9,7 @@ import CoreAbstract from "./_base.mjs";
|
|
9
9
|
import { SelectionManager } from "../selection/manager.mjs";
|
10
10
|
import { objectEach } from "../../../../helpers/object.mjs";
|
11
11
|
import { addClass, removeClass } from "../../../../helpers/dom/element.mjs";
|
12
|
+
import { StylesHandler } from "../utils/stylesHandler.mjs";
|
12
13
|
/**
|
13
14
|
* @class Walkontable
|
14
15
|
*/
|
@@ -19,6 +20,7 @@ export default class Walkontable extends CoreAbstract {
|
|
19
20
|
*/
|
20
21
|
constructor(table, settings) {
|
21
22
|
super(table, new Settings(settings));
|
23
|
+
this.stylesHandler = new StylesHandler(this.domBindings);
|
22
24
|
const facadeGetter = this.wtSettings.getSetting('facade', this); // todo rethink. I would like to have no access to facade from the internal scope.
|
23
25
|
|
24
26
|
this.wtTable = new MasterTable(this.getTableDao(), facadeGetter, this.domBindings, this.wtSettings);
|
@@ -110,6 +110,9 @@ class WalkontableFacade {
|
|
110
110
|
get eventManager() {
|
111
111
|
return this._wot.eventManager;
|
112
112
|
}
|
113
|
+
get stylesHandler() {
|
114
|
+
return this._wot.stylesHandler;
|
115
|
+
}
|
113
116
|
createCellCoords(row, column) {
|
114
117
|
return this._wot.createCellCoords(row, column);
|
115
118
|
}
|
@@ -106,6 +106,9 @@ export default class WalkontableFacade {
|
|
106
106
|
get eventManager() {
|
107
107
|
return this._wot.eventManager;
|
108
108
|
}
|
109
|
+
get stylesHandler() {
|
110
|
+
return this._wot.stylesHandler;
|
111
|
+
}
|
109
112
|
createCellCoords(row, column) {
|
110
113
|
return this._wot.createCellCoords(row, column);
|
111
114
|
}
|
@@ -4,7 +4,6 @@ exports.__esModule = true;
|
|
4
4
|
var _calculator = require("./calculator");
|
5
5
|
exports.ViewportColumnsCalculator = _calculator.ViewportColumnsCalculator;
|
6
6
|
exports.ViewportRowsCalculator = _calculator.ViewportRowsCalculator;
|
7
|
-
exports.DEFAULT_ROW_HEIGHT = _calculator.DEFAULT_ROW_HEIGHT;
|
8
7
|
exports.DEFAULT_COLUMN_WIDTH = _calculator.DEFAULT_COLUMN_WIDTH;
|
9
8
|
var _coords = _interopRequireDefault(require("./cell/coords"));
|
10
9
|
exports.CellCoords = _coords.default;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ViewportColumnsCalculator, ViewportRowsCalculator,
|
1
|
+
import { ViewportColumnsCalculator, ViewportRowsCalculator, DEFAULT_COLUMN_WIDTH } from "./calculator/index.mjs";
|
2
2
|
import CellCoords from "./cell/coords.mjs";
|
3
3
|
import CellRange from "./cell/range.mjs";
|
4
4
|
import Walkontable from "./facade/core.mjs";
|
@@ -6,4 +6,4 @@ import { Selection, ACTIVE_HEADER_TYPE, AREA_TYPE, FOCUS_TYPE, FILL_TYPE, HEADER
|
|
6
6
|
import * as Renderer from "./renderer/index.mjs";
|
7
7
|
import { OrderView, SharedOrderView } from "./utils/orderView/index.mjs";
|
8
8
|
import { getListenersCounter } from "../../../eventManager.mjs";
|
9
|
-
export {
|
9
|
+
export { DEFAULT_COLUMN_WIDTH, ViewportColumnsCalculator, ViewportRowsCalculator, CellCoords, CellRange, Walkontable as default, Walkontable as Core, Selection, ACTIVE_HEADER_TYPE as HIGHLIGHT_ACTIVE_HEADER_TYPE, AREA_TYPE as HIGHLIGHT_AREA_TYPE, FOCUS_TYPE as HIGHLIGHT_FOCUS_TYPE, FILL_TYPE as HIGHLIGHT_FILL_TYPE, HEADER_TYPE as HIGHLIGHT_HEADER_TYPE, ROW_TYPE as HIGHLIGHT_ROW_TYPE, COLUMN_TYPE as HIGHLIGHT_COLUMN_TYPE, CUSTOM_SELECTION_TYPE as HIGHLIGHT_CUSTOM_SELECTION_TYPE, Renderer, OrderView, SharedOrderView, getListenersCounter };
|
@@ -302,7 +302,9 @@ class Overlay {
|
|
302
302
|
// todo ioc , or factor func if used only here
|
303
303
|
event: this.wot.wtEvent,
|
304
304
|
// todo ioc , or factory func if used only here
|
305
|
-
selectionManager: this.wot.selectionManager
|
305
|
+
selectionManager: this.wot.selectionManager,
|
306
|
+
// todo ioc , or factory func if used only here
|
307
|
+
stylesHandler: this.wot.stylesHandler
|
306
308
|
});
|
307
309
|
}
|
308
310
|
|
@@ -298,7 +298,9 @@ export class Overlay {
|
|
298
298
|
// todo ioc , or factor func if used only here
|
299
299
|
event: this.wot.wtEvent,
|
300
300
|
// todo ioc , or factory func if used only here
|
301
|
-
selectionManager: this.wot.selectionManager
|
301
|
+
selectionManager: this.wot.selectionManager,
|
302
|
+
// todo ioc , or factory func if used only here
|
303
|
+
stylesHandler: this.wot.stylesHandler
|
302
304
|
});
|
303
305
|
}
|
304
306
|
|
@@ -144,9 +144,9 @@ class BottomOverlay extends _base.Overlay {
|
|
144
144
|
sumCellSizes(from, to) {
|
145
145
|
const {
|
146
146
|
wtTable,
|
147
|
-
|
147
|
+
stylesHandler
|
148
148
|
} = this.wot;
|
149
|
-
const defaultRowHeight =
|
149
|
+
const defaultRowHeight = stylesHandler.getDefaultRowHeight();
|
150
150
|
let row = from;
|
151
151
|
let sum = 0;
|
152
152
|
while (row < to) {
|
@@ -140,9 +140,9 @@ export class BottomOverlay extends Overlay {
|
|
140
140
|
sumCellSizes(from, to) {
|
141
141
|
const {
|
142
142
|
wtTable,
|
143
|
-
|
143
|
+
stylesHandler
|
144
144
|
} = this.wot;
|
145
|
-
const defaultRowHeight =
|
145
|
+
const defaultRowHeight = stylesHandler.getDefaultRowHeight();
|
146
146
|
let row = from;
|
147
147
|
let sum = 0;
|
148
148
|
while (row < to) {
|
@@ -138,7 +138,7 @@ class TopOverlay extends _base.Overlay {
|
|
138
138
|
* @returns {number} Height sum.
|
139
139
|
*/
|
140
140
|
sumCellSizes(from, to) {
|
141
|
-
const defaultRowHeight = this.
|
141
|
+
const defaultRowHeight = this.wot.stylesHandler.getDefaultRowHeight();
|
142
142
|
let row = from;
|
143
143
|
let sum = 0;
|
144
144
|
while (row < to) {
|
@@ -134,7 +134,7 @@ export class TopOverlay extends Overlay {
|
|
134
134
|
* @returns {number} Height sum.
|
135
135
|
*/
|
136
136
|
sumCellSizes(from, to) {
|
137
|
-
const defaultRowHeight = this.
|
137
|
+
const defaultRowHeight = this.wot.stylesHandler.getDefaultRowHeight();
|
138
138
|
let row = from;
|
139
139
|
let sum = 0;
|
140
140
|
while (row < to) {
|
@@ -28,7 +28,8 @@ class Renderer {
|
|
28
28
|
TBODY,
|
29
29
|
rowUtils,
|
30
30
|
columnUtils,
|
31
|
-
cellRenderer
|
31
|
+
cellRenderer,
|
32
|
+
stylesHandler
|
32
33
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
33
34
|
/**
|
34
35
|
* General renderer class used to render Walkontable content on screen.
|
@@ -36,7 +37,8 @@ class Renderer {
|
|
36
37
|
* @type {TableRenderer}
|
37
38
|
*/
|
38
39
|
this.renderer = new _table.default(TABLE, {
|
39
|
-
cellRenderer
|
40
|
+
cellRenderer,
|
41
|
+
stylesHandler
|
40
42
|
});
|
41
43
|
this.renderer.setRenderers({
|
42
44
|
rowHeaders: new _rowHeaders.default(),
|
@@ -18,7 +18,8 @@ class Renderer {
|
|
18
18
|
TBODY,
|
19
19
|
rowUtils,
|
20
20
|
columnUtils,
|
21
|
-
cellRenderer
|
21
|
+
cellRenderer,
|
22
|
+
stylesHandler
|
22
23
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
23
24
|
/**
|
24
25
|
* General renderer class used to render Walkontable content on screen.
|
@@ -26,7 +27,8 @@ class Renderer {
|
|
26
27
|
* @type {TableRenderer}
|
27
28
|
*/
|
28
29
|
this.renderer = new TableRenderer(TABLE, {
|
29
|
-
cellRenderer
|
30
|
+
cellRenderer,
|
31
|
+
stylesHandler
|
30
32
|
});
|
31
33
|
this.renderer.setRenderers({
|
32
34
|
rowHeaders: new RowHeadersRenderer(),
|
@@ -52,7 +52,8 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
52
52
|
class TableRenderer {
|
53
53
|
constructor(rootNode) {
|
54
54
|
let {
|
55
|
-
cellRenderer
|
55
|
+
cellRenderer,
|
56
|
+
stylesHandler
|
56
57
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
57
58
|
/**
|
58
59
|
* Table element which will be used to render the children element.
|
@@ -168,9 +169,14 @@ class TableRenderer {
|
|
168
169
|
* @type {'inline_start'|'top'|'top_inline_start_corner'|'bottom'|'bottom_inline_start_corner'|'master'}
|
169
170
|
*/
|
170
171
|
_defineProperty(this, "activeOverlayName", void 0);
|
172
|
+
/**
|
173
|
+
* Styles handler instance.
|
174
|
+
*/
|
175
|
+
_defineProperty(this, "stylesHandler", void 0);
|
171
176
|
this.rootNode = rootNode;
|
172
177
|
this.rootDocument = this.rootNode.ownerDocument;
|
173
178
|
this.cellRenderer = cellRenderer;
|
179
|
+
this.stylesHandler = stylesHandler;
|
174
180
|
}
|
175
181
|
|
176
182
|
/**
|
@@ -313,12 +319,15 @@ class TableRenderer {
|
|
313
319
|
// Fix for multi-line content and for supporting `rowHeights` option.
|
314
320
|
for (let visibleRowIndex = 0; visibleRowIndex < rowsToRender; visibleRowIndex++) {
|
315
321
|
const TR = rows.getRenderedNode(visibleRowIndex);
|
322
|
+
const rowUtils = this.rowUtils;
|
316
323
|
if (TR.firstChild) {
|
317
324
|
const sourceRowIndex = this.renderedRowToSource(visibleRowIndex);
|
318
|
-
const rowHeight =
|
325
|
+
const rowHeight = rowUtils.getHeightByOverlayName(sourceRowIndex, this.activeOverlayName);
|
326
|
+
const isBorderBoxSizing = this.stylesHandler.areCellsBorderBox();
|
327
|
+
const borderCompensation = isBorderBoxSizing ? 0 : 1;
|
319
328
|
if (rowHeight) {
|
320
329
|
// Decrease height. 1 pixel will be "replaced" by 1px border top
|
321
|
-
TR.firstChild.style.height = `${rowHeight -
|
330
|
+
TR.firstChild.style.height = `${rowHeight - borderCompensation}px`;
|
322
331
|
} else {
|
323
332
|
TR.firstChild.style.height = '';
|
324
333
|
}
|
@@ -49,7 +49,8 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
49
49
|
export default class TableRenderer {
|
50
50
|
constructor(rootNode) {
|
51
51
|
let {
|
52
|
-
cellRenderer
|
52
|
+
cellRenderer,
|
53
|
+
stylesHandler
|
53
54
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
54
55
|
/**
|
55
56
|
* Table element which will be used to render the children element.
|
@@ -165,9 +166,14 @@ export default class TableRenderer {
|
|
165
166
|
* @type {'inline_start'|'top'|'top_inline_start_corner'|'bottom'|'bottom_inline_start_corner'|'master'}
|
166
167
|
*/
|
167
168
|
_defineProperty(this, "activeOverlayName", void 0);
|
169
|
+
/**
|
170
|
+
* Styles handler instance.
|
171
|
+
*/
|
172
|
+
_defineProperty(this, "stylesHandler", void 0);
|
168
173
|
this.rootNode = rootNode;
|
169
174
|
this.rootDocument = this.rootNode.ownerDocument;
|
170
175
|
this.cellRenderer = cellRenderer;
|
176
|
+
this.stylesHandler = stylesHandler;
|
171
177
|
}
|
172
178
|
|
173
179
|
/**
|
@@ -310,12 +316,15 @@ export default class TableRenderer {
|
|
310
316
|
// Fix for multi-line content and for supporting `rowHeights` option.
|
311
317
|
for (let visibleRowIndex = 0; visibleRowIndex < rowsToRender; visibleRowIndex++) {
|
312
318
|
const TR = rows.getRenderedNode(visibleRowIndex);
|
319
|
+
const rowUtils = this.rowUtils;
|
313
320
|
if (TR.firstChild) {
|
314
321
|
const sourceRowIndex = this.renderedRowToSource(visibleRowIndex);
|
315
|
-
const rowHeight =
|
322
|
+
const rowHeight = rowUtils.getHeightByOverlayName(sourceRowIndex, this.activeOverlayName);
|
323
|
+
const isBorderBoxSizing = this.stylesHandler.areCellsBorderBox();
|
324
|
+
const borderCompensation = isBorderBoxSizing ? 0 : 1;
|
316
325
|
if (rowHeight) {
|
317
326
|
// Decrease height. 1 pixel will be "replaced" by 1px border top
|
318
|
-
TR.firstChild.style.height = `${rowHeight -
|
327
|
+
TR.firstChild.style.height = `${rowHeight - borderCompensation}px`;
|
319
328
|
} else {
|
320
329
|
TR.firstChild.style.height = '';
|
321
330
|
}
|
@@ -19,7 +19,6 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
19
19
|
* @property {Option} currentRowClassName Option `currentRowClassName`.
|
20
20
|
* @property {Option} data Option `data`.
|
21
21
|
* @property {Option} defaultColumnWidth Option `defaultColumnWidth`.
|
22
|
-
* @property {Option} defaultRowHeight Option `defaultRowHeight`.
|
23
22
|
* @property {Option} externalRowCalculator Option `externalRowCalculator`.
|
24
23
|
* @property {Option} fixedColumnsStart Option `fixedColumnsStart`.
|
25
24
|
* @property {Option} fixedRowsBottom Option `fixedRowsBottom`.
|
@@ -185,7 +184,6 @@ class Settings {
|
|
185
184
|
rowHeightByOverlayName() {
|
186
185
|
// return undefined means use default size for the rendered cell content
|
187
186
|
},
|
188
|
-
defaultRowHeight: 23,
|
189
187
|
defaultColumnWidth: 50,
|
190
188
|
selections: null,
|
191
189
|
hideBorderOnMouseDownOver: false,
|
@@ -16,7 +16,6 @@ import { objectEach } from "../../../helpers/object.mjs";
|
|
16
16
|
* @property {Option} currentRowClassName Option `currentRowClassName`.
|
17
17
|
* @property {Option} data Option `data`.
|
18
18
|
* @property {Option} defaultColumnWidth Option `defaultColumnWidth`.
|
19
|
-
* @property {Option} defaultRowHeight Option `defaultRowHeight`.
|
20
19
|
* @property {Option} externalRowCalculator Option `externalRowCalculator`.
|
21
20
|
* @property {Option} fixedColumnsStart Option `fixedColumnsStart`.
|
22
21
|
* @property {Option} fixedRowsBottom Option `fixedRowsBottom`.
|
@@ -180,7 +179,6 @@ export default class Settings {
|
|
180
179
|
rowHeightByOverlayName() {
|
181
180
|
// return undefined means use default size for the rendered cell content
|
182
181
|
},
|
183
|
-
defaultRowHeight: 23,
|
184
182
|
defaultColumnWidth: 50,
|
185
183
|
selections: null,
|
186
184
|
hideBorderOnMouseDownOver: false,
|
@@ -115,7 +115,8 @@ class Table {
|
|
115
115
|
TBODY: this.TBODY,
|
116
116
|
rowUtils: this.rowUtils,
|
117
117
|
columnUtils: this.columnUtils,
|
118
|
-
cellRenderer: this.wtSettings.getSettingPure('cellRenderer')
|
118
|
+
cellRenderer: this.wtSettings.getSettingPure('cellRenderer'),
|
119
|
+
stylesHandler: this.dataAccessObject.stylesHandler
|
119
120
|
});
|
120
121
|
}
|
121
122
|
|
@@ -351,7 +352,7 @@ class Table {
|
|
351
352
|
markIfOversizedColumnHeader(col) {
|
352
353
|
const sourceColIndex = this.columnFilter.renderedToSource(col);
|
353
354
|
let level = this.wtSettings.getSetting('columnHeaders').length;
|
354
|
-
const defaultRowHeight = this.
|
355
|
+
const defaultRowHeight = this.dataAccessObject.stylesHandler.getDefaultRowHeight();
|
355
356
|
let previousColHeaderHeight;
|
356
357
|
let currentHeader;
|
357
358
|
let currentHeaderHeight;
|
@@ -629,10 +630,13 @@ class Table {
|
|
629
630
|
return;
|
630
631
|
}
|
631
632
|
let rowCount = this.TBODY.childNodes.length;
|
632
|
-
const expectedTableHeight = rowCount * this.
|
633
|
+
const expectedTableHeight = rowCount * this.dataAccessObject.stylesHandler.getDefaultRowHeight();
|
633
634
|
const actualTableHeight = (0, _element.innerHeight)(this.TBODY) - 1;
|
635
|
+
const borderBoxSizing = this.wot.stylesHandler.areCellsBorderBox();
|
636
|
+
const rowHeightFn = borderBoxSizing ? _element.outerHeight : _element.innerHeight;
|
637
|
+
const borderCompensation = borderBoxSizing ? 0 : 1;
|
634
638
|
let previousRowHeight;
|
635
|
-
let
|
639
|
+
let rowCurrentHeight;
|
636
640
|
let sourceRowIndex;
|
637
641
|
let currentTr;
|
638
642
|
let rowHeader;
|
@@ -647,13 +651,15 @@ class Table {
|
|
647
651
|
currentTr = this.getTrForRow(sourceRowIndex);
|
648
652
|
rowHeader = currentTr.querySelector('th');
|
649
653
|
if (rowHeader) {
|
650
|
-
|
654
|
+
rowCurrentHeight = rowHeightFn(rowHeader);
|
651
655
|
} else {
|
652
|
-
|
656
|
+
rowCurrentHeight = rowHeightFn(currentTr) - borderCompensation;
|
653
657
|
}
|
654
|
-
if (!previousRowHeight && this.
|
655
|
-
|
656
|
-
|
658
|
+
if (!previousRowHeight && this.dataAccessObject.stylesHandler.getDefaultRowHeight() < rowCurrentHeight || previousRowHeight < rowCurrentHeight) {
|
659
|
+
if (!borderBoxSizing) {
|
660
|
+
rowCurrentHeight += 1;
|
661
|
+
}
|
662
|
+
this.dataAccessObject.wtViewport.oversizedRows[sourceRowIndex] = rowCurrentHeight;
|
657
663
|
}
|
658
664
|
}
|
659
665
|
}
|
@@ -111,7 +111,8 @@ class Table {
|
|
111
111
|
TBODY: this.TBODY,
|
112
112
|
rowUtils: this.rowUtils,
|
113
113
|
columnUtils: this.columnUtils,
|
114
|
-
cellRenderer: this.wtSettings.getSettingPure('cellRenderer')
|
114
|
+
cellRenderer: this.wtSettings.getSettingPure('cellRenderer'),
|
115
|
+
stylesHandler: this.dataAccessObject.stylesHandler
|
115
116
|
});
|
116
117
|
}
|
117
118
|
|
@@ -347,7 +348,7 @@ class Table {
|
|
347
348
|
markIfOversizedColumnHeader(col) {
|
348
349
|
const sourceColIndex = this.columnFilter.renderedToSource(col);
|
349
350
|
let level = this.wtSettings.getSetting('columnHeaders').length;
|
350
|
-
const defaultRowHeight = this.
|
351
|
+
const defaultRowHeight = this.dataAccessObject.stylesHandler.getDefaultRowHeight();
|
351
352
|
let previousColHeaderHeight;
|
352
353
|
let currentHeader;
|
353
354
|
let currentHeaderHeight;
|
@@ -625,10 +626,13 @@ class Table {
|
|
625
626
|
return;
|
626
627
|
}
|
627
628
|
let rowCount = this.TBODY.childNodes.length;
|
628
|
-
const expectedTableHeight = rowCount * this.
|
629
|
+
const expectedTableHeight = rowCount * this.dataAccessObject.stylesHandler.getDefaultRowHeight();
|
629
630
|
const actualTableHeight = innerHeight(this.TBODY) - 1;
|
631
|
+
const borderBoxSizing = this.wot.stylesHandler.areCellsBorderBox();
|
632
|
+
const rowHeightFn = borderBoxSizing ? outerHeight : innerHeight;
|
633
|
+
const borderCompensation = borderBoxSizing ? 0 : 1;
|
630
634
|
let previousRowHeight;
|
631
|
-
let
|
635
|
+
let rowCurrentHeight;
|
632
636
|
let sourceRowIndex;
|
633
637
|
let currentTr;
|
634
638
|
let rowHeader;
|
@@ -643,13 +647,15 @@ class Table {
|
|
643
647
|
currentTr = this.getTrForRow(sourceRowIndex);
|
644
648
|
rowHeader = currentTr.querySelector('th');
|
645
649
|
if (rowHeader) {
|
646
|
-
|
650
|
+
rowCurrentHeight = rowHeightFn(rowHeader);
|
647
651
|
} else {
|
648
|
-
|
652
|
+
rowCurrentHeight = rowHeightFn(currentTr) - borderCompensation;
|
649
653
|
}
|
650
|
-
if (!previousRowHeight && this.
|
651
|
-
|
652
|
-
|
654
|
+
if (!previousRowHeight && this.dataAccessObject.stylesHandler.getDefaultRowHeight() < rowCurrentHeight || previousRowHeight < rowCurrentHeight) {
|
655
|
+
if (!borderBoxSizing) {
|
656
|
+
rowCurrentHeight += 1;
|
657
|
+
}
|
658
|
+
this.dataAccessObject.wtViewport.oversizedRows[sourceRowIndex] = rowCurrentHeight;
|
653
659
|
}
|
654
660
|
}
|
655
661
|
}
|
@@ -66,6 +66,7 @@
|
|
66
66
|
* @property {Walkontable} cloneSource CloneSource.
|
67
67
|
* @property {Walkontable} wot Wot.
|
68
68
|
* @property {number} parentTableOffset ParentTableOffset.
|
69
|
+
* @property {StylesHandler} stylesHandler StylesHandler.
|
69
70
|
* @property {number|null} startColumnRendered StartColumnRendered.
|
70
71
|
* @property {number|null} startColumnVisible StartColumnVisible.
|
71
72
|
* @property {number|null} endColumnRendered EndColumnRendered.
|
@@ -66,6 +66,7 @@
|
|
66
66
|
* @property {Walkontable} cloneSource CloneSource.
|
67
67
|
* @property {Walkontable} wot Wot.
|
68
68
|
* @property {number} parentTableOffset ParentTableOffset.
|
69
|
+
* @property {StylesHandler} stylesHandler StylesHandler.
|
69
70
|
* @property {number|null} startColumnRendered StartColumnRendered.
|
70
71
|
* @property {number|null} startColumnVisible StartColumnVisible.
|
71
72
|
* @property {number|null} endColumnRendered EndColumnRendered.
|
@@ -50,7 +50,7 @@ class ColumnUtils {
|
|
50
50
|
* @returns {number}
|
51
51
|
*/
|
52
52
|
getHeaderHeight(level) {
|
53
|
-
let height = this.
|
53
|
+
let height = this.dataAccessObject.stylesHandler.getDefaultRowHeight();
|
54
54
|
const oversizedHeight = this.dataAccessObject.wtViewport.oversizedColumnHeaders[level];
|
55
55
|
if (oversizedHeight !== undefined) {
|
56
56
|
height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
|
@@ -47,7 +47,7 @@ export default class ColumnUtils {
|
|
47
47
|
* @returns {number}
|
48
48
|
*/
|
49
49
|
getHeaderHeight(level) {
|
50
|
-
let height = this.
|
50
|
+
let height = this.dataAccessObject.stylesHandler.getDefaultRowHeight();
|
51
51
|
const oversizedHeight = this.dataAccessObject.wtViewport.oversizedColumnHeaders[level];
|
52
52
|
if (oversizedHeight !== undefined) {
|
53
53
|
height = height ? Math.max(height, oversizedHeight) : oversizedHeight;
|