handsontable 14.0.0 → 14.1.0-next-ba8c2b0-20240110
Sign up to get free protection for your applications and to get access to all the features.
- package/3rdparty/walkontable/src/calculator/index.js +11 -6
- package/3rdparty/walkontable/src/calculator/index.mjs +5 -3
- package/3rdparty/walkontable/src/calculator/renderAllColumns.js +50 -0
- package/3rdparty/walkontable/src/calculator/renderAllColumns.mjs +46 -0
- package/3rdparty/walkontable/src/calculator/renderAllRows.js +50 -0
- package/3rdparty/walkontable/src/calculator/renderAllRows.mjs +46 -0
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +3 -124
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +4 -126
- package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +4 -5
- package/3rdparty/walkontable/src/cell/coords.d.ts +5 -5
- package/3rdparty/walkontable/src/cell/coords.js +2 -2
- package/3rdparty/walkontable/src/cell/coords.mjs +2 -2
- package/3rdparty/walkontable/src/cell/range.d.ts +5 -5
- package/3rdparty/walkontable/src/cell/range.js +16 -41
- package/3rdparty/walkontable/src/cell/range.mjs +16 -41
- package/3rdparty/walkontable/src/core/_base.js +2 -14
- package/3rdparty/walkontable/src/core/_base.mjs +2 -14
- package/3rdparty/walkontable/src/core/clone.js +2 -2
- package/3rdparty/walkontable/src/core/clone.mjs +2 -2
- package/3rdparty/walkontable/src/core/core.js +0 -2
- package/3rdparty/walkontable/src/core/core.mjs +0 -2
- package/3rdparty/walkontable/src/facade/core.js +0 -9
- package/3rdparty/walkontable/src/facade/core.mjs +0 -9
- package/3rdparty/walkontable/src/filter/column.js +2 -2
- package/3rdparty/walkontable/src/filter/column.mjs +2 -2
- package/3rdparty/walkontable/src/filter/row.js +2 -2
- package/3rdparty/walkontable/src/filter/row.mjs +2 -2
- package/3rdparty/walkontable/src/index.js +3 -4
- package/3rdparty/walkontable/src/index.mjs +1 -2
- package/3rdparty/walkontable/src/overlay/_base.js +2 -2
- package/3rdparty/walkontable/src/overlay/_base.mjs +2 -2
- 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 +2 -2
- package/3rdparty/walkontable/src/overlay/top.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +2 -2
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +2 -2
- package/3rdparty/walkontable/src/overlays.js +2 -5
- package/3rdparty/walkontable/src/overlays.mjs +2 -6
- package/3rdparty/walkontable/src/renderer/_base.js +2 -2
- package/3rdparty/walkontable/src/renderer/_base.mjs +2 -2
- package/3rdparty/walkontable/src/renderer/cells.js +2 -2
- package/3rdparty/walkontable/src/renderer/cells.mjs +2 -2
- package/3rdparty/walkontable/src/renderer/colGroup.js +10 -0
- package/3rdparty/walkontable/src/renderer/colGroup.mjs +10 -0
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +2 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +2 -2
- package/3rdparty/walkontable/src/renderer/rows.js +6 -5
- package/3rdparty/walkontable/src/renderer/rows.mjs +6 -5
- package/3rdparty/walkontable/src/renderer/table.js +2 -2
- package/3rdparty/walkontable/src/renderer/table.mjs +2 -2
- package/3rdparty/walkontable/src/scroll.js +4 -60
- package/3rdparty/walkontable/src/scroll.mjs +4 -60
- package/3rdparty/walkontable/src/selection/manager.js +0 -1
- package/3rdparty/walkontable/src/selection/manager.mjs +0 -1
- package/3rdparty/walkontable/src/settings.js +5 -2
- package/3rdparty/walkontable/src/settings.mjs +4 -2
- package/3rdparty/walkontable/src/table.js +2 -3
- package/3rdparty/walkontable/src/table.mjs +2 -3
- package/3rdparty/walkontable/src/utils/column.js +29 -14
- package/3rdparty/walkontable/src/utils/column.mjs +29 -14
- package/3rdparty/walkontable/src/utils/columnStretching.js +219 -0
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +215 -0
- package/3rdparty/walkontable/src/utils/nodesPool.js +2 -2
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +2 -2
- package/3rdparty/walkontable/src/utils/orderView/view.js +2 -2
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +2 -2
- package/3rdparty/walkontable/src/utils/orderView/viewSize.js +2 -2
- package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +2 -2
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +2 -2
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +2 -2
- package/3rdparty/walkontable/src/utils/row.js +2 -2
- package/3rdparty/walkontable/src/utils/row.mjs +2 -2
- package/3rdparty/walkontable/src/viewport.js +22 -17
- package/3rdparty/walkontable/src/viewport.mjs +23 -18
- package/CHANGELOG.md +36 -0
- package/base.js +4 -2
- package/base.mjs +2 -2
- package/cellTypes/dropdownType/dropdownType.d.ts +6 -6
- package/cellTypes/dropdownType/dropdownType.js +4 -4
- package/cellTypes/dropdownType/dropdownType.mjs +4 -4
- package/core/focusCatcher/index.js +44 -6
- package/core/focusCatcher/index.mjs +44 -6
- package/core.d.ts +19 -19
- package/core.js +7 -12
- package/core.mjs +7 -12
- package/dataMap/dataMap.js +3 -2
- package/dataMap/dataMap.mjs +2 -2
- package/dataMap/dataSource.js +2 -2
- package/dataMap/dataSource.mjs +2 -2
- package/dataMap/metaManager/lazyFactoryMap.js +2 -2
- package/dataMap/metaManager/lazyFactoryMap.mjs +2 -2
- package/dataMap/metaManager/metaLayers/cellMeta.js +2 -2
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +2 -2
- package/dataMap/metaManager/metaLayers/columnMeta.js +2 -2
- package/dataMap/metaManager/metaLayers/columnMeta.mjs +2 -2
- package/dataMap/metaManager/metaLayers/globalMeta.js +2 -2
- package/dataMap/metaManager/metaLayers/globalMeta.mjs +2 -2
- package/dataMap/metaManager/metaLayers/tableMeta.js +2 -2
- package/dataMap/metaManager/metaLayers/tableMeta.mjs +2 -2
- package/dataMap/metaManager/metaSchema.js +40 -25
- package/dataMap/metaManager/metaSchema.mjs +40 -25
- package/dataMap/metaManager/mods/dynamicCellMeta.js +2 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +2 -2
- package/dataMap/metaManager/mods/extendMetaProperties.js +14 -2
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +14 -2
- package/dist/handsontable.css +5 -5
- package/dist/handsontable.full.css +6 -6
- package/dist/handsontable.full.js +4835 -4508
- package/dist/handsontable.full.min.css +4 -4
- package/dist/handsontable.full.min.js +156 -154
- package/dist/handsontable.js +3441 -2825
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +18 -15
- package/editorManager.js +5 -6
- package/editorManager.mjs +5 -6
- package/editors/autocompleteEditor/autocompleteEditor.js +2 -4
- package/editors/autocompleteEditor/autocompleteEditor.mjs +2 -4
- package/editors/baseEditor/baseEditor.d.ts +1 -1
- package/editors/baseEditor/baseEditor.js +2 -2
- package/editors/baseEditor/baseEditor.mjs +2 -2
- package/editors/dateEditor/dateEditor.d.ts +1 -1
- package/editors/dateEditor/dateEditor.js +29 -33
- package/editors/dateEditor/dateEditor.mjs +29 -33
- package/editors/handsontableEditor/handsontableEditor.js +0 -1
- package/editors/handsontableEditor/handsontableEditor.mjs +0 -1
- package/editors/selectEditor/selectEditor.js +8 -2
- package/editors/selectEditor/selectEditor.mjs +8 -2
- package/editors/textEditor/textEditor.js +2 -6
- package/editors/textEditor/textEditor.mjs +2 -6
- package/eventManager.js +4 -3
- package/eventManager.mjs +4 -3
- package/helpers/browser.js +5 -2
- package/helpers/browser.mjs +5 -2
- package/helpers/feature.js +10 -0
- package/helpers/feature.mjs +9 -0
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/index.d.ts +12 -0
- package/package.json +13 -4
- package/pluginHooks.d.ts +10 -9
- package/pluginHooks.js +10 -8
- package/pluginHooks.mjs +7 -7
- package/plugins/autoColumnSize/autoColumnSize.d.ts +2 -2
- package/plugins/autoColumnSize/autoColumnSize.js +2 -2
- package/plugins/autoColumnSize/autoColumnSize.mjs +2 -2
- package/plugins/autoRowSize/autoRowSize.d.ts +3 -3
- package/plugins/autoRowSize/autoRowSize.js +2 -2
- package/plugins/autoRowSize/autoRowSize.mjs +2 -2
- package/plugins/autofill/autofill.js +2 -2
- package/plugins/autofill/autofill.mjs +2 -2
- package/plugins/base/base.js +2 -2
- package/plugins/base/base.mjs +2 -2
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.d.ts +1 -1
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +2 -2
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +2 -2
- package/plugins/collapsibleColumns/collapsibleColumns.js +2 -2
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +2 -2
- package/plugins/columnSorting/columnSorting.js +2 -2
- package/plugins/columnSorting/columnSorting.mjs +2 -2
- package/plugins/columnSorting/columnStatesManager.js +2 -2
- package/plugins/columnSorting/columnStatesManager.mjs +2 -2
- package/plugins/columnSummary/columnSummary.d.ts +11 -11
- package/plugins/columnSummary/columnSummary.js +20 -5
- package/plugins/columnSummary/columnSummary.mjs +20 -5
- package/plugins/columnSummary/endpoints.js +19 -5
- package/plugins/columnSummary/endpoints.mjs +19 -5
- package/plugins/comments/commentEditor.js +2 -2
- package/plugins/comments/commentEditor.mjs +2 -2
- package/plugins/comments/comments.js +2 -2
- package/plugins/comments/comments.mjs +2 -2
- package/plugins/comments/displaySwitch.js +2 -2
- package/plugins/comments/displaySwitch.mjs +2 -2
- package/plugins/contextMenu/commandExecutor.js +2 -2
- package/plugins/contextMenu/commandExecutor.mjs +2 -2
- package/plugins/contextMenu/contextMenu.js +2 -2
- package/plugins/contextMenu/contextMenu.mjs +2 -2
- package/plugins/contextMenu/itemsFactory.js +2 -2
- package/plugins/contextMenu/itemsFactory.mjs +2 -2
- package/plugins/contextMenu/menu/cursor.js +2 -2
- package/plugins/contextMenu/menu/cursor.mjs +2 -2
- package/plugins/contextMenu/menu/menu.js +2 -2
- package/plugins/contextMenu/menu/menu.mjs +2 -2
- package/plugins/copyPaste/copyPaste.js +40 -6
- package/plugins/copyPaste/copyPaste.mjs +40 -6
- package/plugins/customBorders/customBorders.d.ts +17 -8
- package/plugins/customBorders/customBorders.js +2 -7
- package/plugins/customBorders/customBorders.mjs +2 -7
- package/plugins/customBorders/utils.js +0 -1
- package/plugins/customBorders/utils.mjs +0 -1
- package/plugins/dragToScroll/dragToScroll.d.ts +8 -1
- package/plugins/dragToScroll/dragToScroll.js +18 -22
- package/plugins/dragToScroll/dragToScroll.mjs +18 -22
- package/plugins/dropdownMenu/dropdownMenu.js +2 -2
- package/plugins/dropdownMenu/dropdownMenu.mjs +2 -2
- package/plugins/exportFile/dataProvider.js +2 -2
- package/plugins/exportFile/dataProvider.mjs +2 -2
- package/plugins/exportFile/exportFile.d.ts +18 -3
- package/plugins/exportFile/types/_base.js +2 -2
- package/plugins/exportFile/types/_base.mjs +2 -2
- package/plugins/filters/component/_base.js +2 -2
- package/plugins/filters/component/_base.mjs +2 -2
- package/plugins/filters/component/actionBar.js +2 -2
- package/plugins/filters/component/actionBar.mjs +2 -2
- package/plugins/filters/component/condition.js +2 -2
- package/plugins/filters/component/condition.mjs +2 -2
- package/plugins/filters/component/operators.js +2 -2
- package/plugins/filters/component/operators.mjs +2 -2
- package/plugins/filters/component/value.js +2 -2
- package/plugins/filters/component/value.mjs +2 -2
- package/plugins/filters/conditionCollection.js +2 -2
- package/plugins/filters/conditionCollection.mjs +2 -2
- package/plugins/filters/conditionUpdateObserver.js +2 -2
- package/plugins/filters/conditionUpdateObserver.mjs +2 -2
- package/plugins/filters/dataFilter.js +2 -2
- package/plugins/filters/dataFilter.mjs +2 -2
- package/plugins/filters/filters.js +2 -2
- package/plugins/filters/filters.mjs +2 -2
- package/plugins/filters/ui/_base.js +2 -2
- package/plugins/filters/ui/_base.mjs +2 -2
- package/plugins/filters/ui/radioInput.js +1 -1
- package/plugins/filters/ui/radioInput.mjs +1 -1
- package/plugins/formulas/formulas.d.ts +1 -0
- package/plugins/formulas/formulas.js +2 -4
- package/plugins/formulas/formulas.mjs +2 -4
- package/plugins/formulas/indexSyncer/axisSyncer.js +0 -1
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +0 -1
- package/plugins/manualColumnMove/ui/_base.js +2 -2
- package/plugins/manualColumnMove/ui/_base.mjs +2 -2
- package/plugins/manualColumnResize/manualColumnResize.js +6 -2
- package/plugins/manualColumnResize/manualColumnResize.mjs +6 -2
- package/plugins/manualRowMove/ui/_base.js +2 -2
- package/plugins/manualRowMove/ui/_base.mjs +2 -2
- package/plugins/manualRowResize/manualRowResize.js +7 -3
- package/plugins/manualRowResize/manualRowResize.mjs +7 -3
- package/plugins/mergeCells/calculations/autofill.js +2 -2
- package/plugins/mergeCells/calculations/autofill.mjs +2 -2
- package/plugins/mergeCells/calculations/selection.js +2 -2
- package/plugins/mergeCells/calculations/selection.mjs +2 -2
- package/plugins/mergeCells/cellCoords.js +2 -2
- package/plugins/mergeCells/cellCoords.mjs +2 -2
- package/plugins/mergeCells/cellsCollection.js +2 -2
- package/plugins/mergeCells/cellsCollection.mjs +2 -2
- package/plugins/mergeCells/mergeCells.js +2 -4
- package/plugins/mergeCells/mergeCells.mjs +2 -4
- package/plugins/multiColumnSorting/multiColumnSorting.js +2 -2
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +2 -2
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.d.ts +8 -1
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +2 -2
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +2 -2
- package/plugins/nestedHeaders/nestedHeaders.js +2 -3
- package/plugins/nestedHeaders/nestedHeaders.mjs +2 -3
- package/plugins/nestedHeaders/stateManager/headersTree.js +0 -1
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +0 -1
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +1 -1
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +1 -1
- package/plugins/nestedHeaders/utils/ghostTable.js +2 -2
- package/plugins/nestedHeaders/utils/ghostTable.mjs +2 -2
- package/plugins/nestedRows/data/dataManager.js +2 -2
- package/plugins/nestedRows/data/dataManager.mjs +2 -2
- package/plugins/nestedRows/nestedRows.js +2 -2
- package/plugins/nestedRows/nestedRows.mjs +2 -2
- package/plugins/nestedRows/ui/_base.js +2 -2
- package/plugins/nestedRows/ui/_base.mjs +2 -2
- package/plugins/nestedRows/ui/contextMenu.js +2 -2
- package/plugins/nestedRows/ui/contextMenu.mjs +2 -2
- package/plugins/nestedRows/utils/rowMoveController.js +2 -2
- package/plugins/nestedRows/utils/rowMoveController.mjs +2 -2
- package/plugins/persistentState/persistentState.d.ts +5 -2
- package/plugins/persistentState/persistentState.js +2 -2
- package/plugins/persistentState/persistentState.mjs +2 -2
- package/plugins/persistentState/storage.js +2 -2
- package/plugins/persistentState/storage.mjs +2 -2
- package/plugins/search/search.js +2 -2
- package/plugins/search/search.mjs +2 -2
- package/plugins/touchScroll/touchScroll.js +2 -2
- package/plugins/touchScroll/touchScroll.mjs +2 -2
- package/plugins/trimRows/trimRows.js +2 -2
- package/plugins/trimRows/trimRows.mjs +2 -2
- package/plugins/undoRedo/undoRedo.d.ts +3 -0
- package/plugins/undoRedo/undoRedo.js +64 -7
- package/plugins/undoRedo/undoRedo.mjs +64 -7
- package/renderers/autocompleteRenderer/autocompleteRenderer.d.ts +1 -1
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +0 -1
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +0 -1
- package/renderers/baseRenderer/baseRenderer.d.ts +1 -1
- package/renderers/checkboxRenderer/checkboxRenderer.d.ts +1 -1
- package/renderers/checkboxRenderer/checkboxRenderer.js +0 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +0 -2
- package/renderers/dateRenderer/dateRenderer.d.ts +1 -1
- package/renderers/dropdownRenderer/dropdownRenderer.d.ts +5 -0
- package/renderers/dropdownRenderer/dropdownRenderer.js +23 -0
- package/renderers/dropdownRenderer/dropdownRenderer.mjs +19 -0
- package/renderers/dropdownRenderer/index.d.ts +1 -0
- package/renderers/dropdownRenderer/index.js +6 -0
- package/renderers/dropdownRenderer/index.mjs +1 -0
- package/renderers/handsontableRenderer/handsontableRenderer.d.ts +1 -1
- package/renderers/htmlRenderer/htmlRenderer.d.ts +1 -1
- package/renderers/index.d.ts +3 -0
- package/renderers/index.js +12 -0
- package/renderers/index.mjs +7 -1
- package/renderers/numericRenderer/numericRenderer.d.ts +1 -1
- package/renderers/passwordRenderer/passwordRenderer.d.ts +1 -1
- package/renderers/selectRenderer/selectRenderer.d.ts +1 -1
- package/renderers/textRenderer/textRenderer.d.ts +1 -1
- package/renderers/timeRenderer/timeRenderer.d.ts +1 -1
- package/selection/highlight/highlight.js +2 -3
- package/selection/highlight/highlight.mjs +2 -3
- package/selection/highlight/visualSelection.js +2 -2
- package/selection/highlight/visualSelection.mjs +2 -2
- package/selection/range.js +2 -2
- package/selection/range.mjs +2 -2
- package/selection/selection.js +2 -2
- package/selection/selection.mjs +2 -2
- package/settings.d.ts +27 -14
- package/tableView.js +4 -5
- package/tableView.mjs +4 -5
- package/translations/indexMapper.d.ts +1 -1
- package/translations/indexMapper.js +4 -3
- package/translations/indexMapper.mjs +2 -2
- package/translations/mapCollections/aggregatedCollection.js +2 -2
- package/translations/mapCollections/aggregatedCollection.mjs +2 -2
- package/translations/mapCollections/mapCollection.js +2 -2
- package/translations/mapCollections/mapCollection.mjs +2 -2
- package/translations/maps/indexMap.js +2 -2
- package/translations/maps/indexMap.mjs +2 -2
- package/translations/maps/linkedPhysicalIndexToValueMap.js +2 -2
- package/translations/maps/linkedPhysicalIndexToValueMap.mjs +2 -2
- package/utils/dataStructures/linkedList.js +2 -2
- package/utils/dataStructures/linkedList.mjs +2 -2
- package/utils/dataStructures/tree.js +2 -2
- package/utils/dataStructures/tree.mjs +2 -2
- package/utils/ghostTable.js +2 -2
- package/utils/ghostTable.mjs +2 -2
- package/utils/interval.js +2 -2
- package/utils/interval.mjs +2 -2
- package/utils/samplesGenerator.js +2 -2
- package/utils/samplesGenerator.mjs +2 -2
- package/validators/dropdownValidator/dropdownValidator.d.ts +5 -0
- package/validators/dropdownValidator/dropdownValidator.js +18 -0
- package/validators/dropdownValidator/dropdownValidator.mjs +14 -0
- package/validators/dropdownValidator/index.d.ts +1 -0
- package/validators/dropdownValidator/index.js +6 -0
- package/validators/dropdownValidator/index.mjs +1 -0
- package/validators/index.d.ts +2 -0
- package/validators/index.js +4 -0
- package/validators/index.mjs +3 -1
- package/validators/timeValidator/timeValidator.js +0 -1
- package/validators/timeValidator/timeValidator.mjs +0 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
3
|
-
function _toPropertyKey(
|
4
|
-
function _toPrimitive(
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
4
|
+
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); }
|
5
5
|
import { innerHeight, innerWidth, getScrollLeft, getScrollTop, offset } from "../../../helpers/dom/element.mjs";
|
6
6
|
/**
|
7
7
|
* @class Scroll
|
@@ -158,36 +158,7 @@ class Scroll {
|
|
158
158
|
* @returns {number}
|
159
159
|
*/
|
160
160
|
getFirstVisibleRow() {
|
161
|
-
|
162
|
-
topOverlay,
|
163
|
-
wtTable,
|
164
|
-
wtViewport,
|
165
|
-
totalRows,
|
166
|
-
fixedRowsTop,
|
167
|
-
rootWindow
|
168
|
-
} = this.dataAccessObject;
|
169
|
-
let firstVisibleRow = wtTable.getFirstVisibleRow();
|
170
|
-
if (topOverlay.mainTableScrollableElement === rootWindow) {
|
171
|
-
const rootElementOffset = offset(wtTable.wtRootElement);
|
172
|
-
const totalTableHeight = innerHeight(wtTable.hider);
|
173
|
-
const windowHeight = innerHeight(rootWindow);
|
174
|
-
const windowScrollTop = getScrollTop(rootWindow, rootWindow);
|
175
|
-
|
176
|
-
// Only calculate firstVisibleRow when table didn't filled (from up) whole viewport space
|
177
|
-
if (rootElementOffset.top + totalTableHeight - windowHeight <= windowScrollTop) {
|
178
|
-
let rowsHeight = wtViewport.getColumnHeaderHeight();
|
179
|
-
rowsHeight += topOverlay.sumCellSizes(0, fixedRowsTop);
|
180
|
-
for (let row = totalRows; row > 0; row--) {
|
181
|
-
rowsHeight += topOverlay.sumCellSizes(row - 1, row);
|
182
|
-
if (rootElementOffset.top + totalTableHeight - rowsHeight <= windowScrollTop) {
|
183
|
-
// Return physical row + 1
|
184
|
-
firstVisibleRow = row;
|
185
|
-
break;
|
186
|
-
}
|
187
|
-
}
|
188
|
-
}
|
189
|
-
}
|
190
|
-
return firstVisibleRow;
|
161
|
+
return this.dataAccessObject.wtTable.getFirstVisibleRow();
|
191
162
|
}
|
192
163
|
|
193
164
|
/**
|
@@ -231,34 +202,7 @@ class Scroll {
|
|
231
202
|
* @returns {number}
|
232
203
|
*/
|
233
204
|
getFirstVisibleColumn() {
|
234
|
-
|
235
|
-
inlineStartOverlay,
|
236
|
-
wtTable,
|
237
|
-
wtViewport,
|
238
|
-
totalColumns,
|
239
|
-
rootWindow
|
240
|
-
} = this.dataAccessObject;
|
241
|
-
let firstVisibleColumn = wtTable.getFirstVisibleColumn();
|
242
|
-
if (inlineStartOverlay.mainTableScrollableElement === rootWindow) {
|
243
|
-
const rootElementOffset = offset(wtTable.wtRootElement);
|
244
|
-
const totalTableWidth = innerWidth(wtTable.hider);
|
245
|
-
const windowWidth = innerWidth(rootWindow);
|
246
|
-
const windowScrollLeft = Math.abs(getScrollLeft(rootWindow, rootWindow));
|
247
|
-
|
248
|
-
// Only calculate firstVisibleColumn when table didn't filled (from left) whole viewport space
|
249
|
-
if (rootElementOffset.left + totalTableWidth - windowWidth <= windowScrollLeft) {
|
250
|
-
let columnsWidth = wtViewport.getRowHeaderWidth();
|
251
|
-
for (let column = totalColumns; column > 0; column--) {
|
252
|
-
columnsWidth += inlineStartOverlay.sumCellSizes(column - 1, column);
|
253
|
-
if (rootElementOffset.left + totalTableWidth - columnsWidth <= windowScrollLeft) {
|
254
|
-
// Return physical column + 1
|
255
|
-
firstVisibleColumn = column;
|
256
|
-
break;
|
257
|
-
}
|
258
|
-
}
|
259
|
-
}
|
260
|
-
}
|
261
|
-
return firstVisibleColumn;
|
205
|
+
return this.dataAccessObject.wtTable.getFirstVisibleColumn();
|
262
206
|
}
|
263
207
|
|
264
208
|
/**
|
@@ -208,7 +208,6 @@ class SelectionManager {
|
|
208
208
|
borderInstance === null || borderInstance === void 0 || borderInstance.disappear();
|
209
209
|
continue; // eslint-disable-line no-continue
|
210
210
|
}
|
211
|
-
|
212
211
|
if (className) {
|
213
212
|
const elements = _classPrivateFieldGet(this, _scanner).setActiveSelection(selection).scan();
|
214
213
|
elements.forEach(element => {
|
@@ -204,7 +204,6 @@ export class SelectionManager {
|
|
204
204
|
borderInstance === null || borderInstance === void 0 || borderInstance.disappear();
|
205
205
|
continue; // eslint-disable-line no-continue
|
206
206
|
}
|
207
|
-
|
208
207
|
if (className) {
|
209
208
|
const elements = _classPrivateFieldGet(this, _scanner).setActiveSelection(selection).scan();
|
210
209
|
elements.forEach(element => {
|
@@ -5,8 +5,8 @@ require("core-js/modules/es.error.cause.js");
|
|
5
5
|
var _element = require("../../../helpers/dom/element");
|
6
6
|
var _object = require("../../../helpers/object");
|
7
7
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
8
|
-
function _toPropertyKey(
|
9
|
-
function _toPrimitive(
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
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
10
|
/**
|
11
11
|
* @todo Describe options.
|
12
12
|
* @typedef SettingsPure
|
@@ -36,6 +36,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
36
36
|
* @property {Option} onBeforeStretchingColumnWidth Option `onBeforeStretchingColumnWidth`.
|
37
37
|
* @property {Option} preventOverflow Option `preventOverflow`.
|
38
38
|
* @property {Option} preventWheel Option `preventWheel`.
|
39
|
+
* @property {Option} renderAllColumns Option `renderAllColumns`.
|
39
40
|
* @property {Option} renderAllRows Option `renderAllRows`.
|
40
41
|
* @property {Option} rowHeaders Option `rowHeaders`.
|
41
42
|
* @property {Option} rowHeight Option `,`.
|
@@ -80,6 +81,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
80
81
|
* @template TValue.
|
81
82
|
* @typedef { TValue | Array.<TValue> | (function(...*): TValue) } Option
|
82
83
|
*/
|
84
|
+
|
83
85
|
/**
|
84
86
|
* @class Settings
|
85
87
|
*/
|
@@ -218,6 +220,7 @@ class Settings {
|
|
218
220
|
onBeforeHighlightingColumnHeader: sourceCol => sourceCol,
|
219
221
|
onWindowResize: null,
|
220
222
|
onContainerElementResize: null,
|
223
|
+
renderAllColumns: false,
|
221
224
|
renderAllRows: false,
|
222
225
|
groups: false,
|
223
226
|
rowHeaderWidth: null,
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
3
|
-
function _toPropertyKey(
|
4
|
-
function _toPrimitive(
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
4
|
+
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); }
|
5
5
|
import { fastInnerText } from "../../../helpers/dom/element.mjs";
|
6
6
|
import { objectEach } from "../../../helpers/object.mjs";
|
7
7
|
/**
|
@@ -33,6 +33,7 @@ import { objectEach } from "../../../helpers/object.mjs";
|
|
33
33
|
* @property {Option} onBeforeStretchingColumnWidth Option `onBeforeStretchingColumnWidth`.
|
34
34
|
* @property {Option} preventOverflow Option `preventOverflow`.
|
35
35
|
* @property {Option} preventWheel Option `preventWheel`.
|
36
|
+
* @property {Option} renderAllColumns Option `renderAllColumns`.
|
36
37
|
* @property {Option} renderAllRows Option `renderAllRows`.
|
37
38
|
* @property {Option} rowHeaders Option `rowHeaders`.
|
38
39
|
* @property {Option} rowHeight Option `,`.
|
@@ -214,6 +215,7 @@ export default class Settings {
|
|
214
215
|
onBeforeHighlightingColumnHeader: sourceCol => sourceCol,
|
215
216
|
onWindowResize: null,
|
216
217
|
onContainerElementResize: null,
|
218
|
+
renderAllColumns: false,
|
217
219
|
renderAllRows: false,
|
218
220
|
groups: false,
|
219
221
|
rowHeaderWidth: null,
|
@@ -14,8 +14,8 @@ var _overlay = require("./overlay");
|
|
14
14
|
var _a11y = require("../../../helpers/a11y");
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
16
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
17
|
-
function _toPropertyKey(
|
18
|
-
function _toPrimitive(
|
17
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
18
|
+
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); }
|
19
19
|
/**
|
20
20
|
* @todo These mixes are never added to the class Table, however their members are used here.
|
21
21
|
* @todo Continue: Potentially it works only, because some of these mixes are added to every inherited class.
|
@@ -96,7 +96,6 @@ class Table {
|
|
96
96
|
if (this.isMaster) {
|
97
97
|
this.alignOverlaysWithTrimmingContainer(); // todo wow, It calls method from child class (MasterTable).
|
98
98
|
}
|
99
|
-
|
100
99
|
this.fixTableDomTree();
|
101
100
|
this.rowFilter = null; // TODO refactoring, eliminate all (re)creations of this object, then updates state when needed.
|
102
101
|
this.columnFilter = null; // TODO refactoring, eliminate all (re)creations of this object, then updates state when needed.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
import "core-js/modules/es.array.push.js";
|
3
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
4
|
-
function _toPropertyKey(
|
5
|
-
function _toPrimitive(
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
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 { hasClass, index, offset, removeTextNodes, overlayContainsElement, closest, outerHeight, outerWidth, innerHeight, isVisible, setAttribute } from "../../../helpers/dom/element.mjs";
|
7
7
|
import { isFunction } from "../../../helpers/function.mjs";
|
8
8
|
import ColumnFilter from "./filter/column.mjs";
|
@@ -92,7 +92,6 @@ class Table {
|
|
92
92
|
if (this.isMaster) {
|
93
93
|
this.alignOverlaysWithTrimmingContainer(); // todo wow, It calls method from child class (MasterTable).
|
94
94
|
}
|
95
|
-
|
96
95
|
this.fixTableDomTree();
|
97
96
|
this.rowFilter = null; // TODO refactoring, eliminate all (re)creations of this object, then updates state when needed.
|
98
97
|
this.columnFilter = null; // TODO refactoring, eliminate all (re)creations of this object, then updates state when needed.
|
@@ -3,9 +3,10 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
5
|
var _element = require("./../../../../helpers/dom/element");
|
6
|
+
var _columnStretching = require("./columnStretching");
|
6
7
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
7
|
-
function _toPropertyKey(
|
8
|
-
function _toPrimitive(
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
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); }
|
9
10
|
/**
|
10
11
|
* Column utils class contains all necessary information about sizes of the columns.
|
11
12
|
*
|
@@ -29,8 +30,18 @@ class ColumnUtils {
|
|
29
30
|
* @type {Map<number, number>}
|
30
31
|
*/
|
31
32
|
_defineProperty(this, "headerWidths", new Map());
|
33
|
+
/**
|
34
|
+
* @type {ColumnStretching}
|
35
|
+
*/
|
36
|
+
_defineProperty(this, "stretching", void 0);
|
32
37
|
this.dataAccessObject = dataAccessObject;
|
33
38
|
this.wtSettings = wtSettings;
|
39
|
+
this.stretching = new _columnStretching.ColumnStretching({
|
40
|
+
totalColumns: () => this.wtSettings.getSetting('totalColumns'),
|
41
|
+
stretchMode: () => this.wtSettings.getSetting('stretchH'),
|
42
|
+
stretchingColumnWidthFn: (stretchedWidth, column) => this.wtSettings.getSetting('onBeforeStretchingColumnWidth', stretchedWidth, column),
|
43
|
+
columnWidthFn: sourceCol => this.dataAccessObject.wtTable.getColumnWidth(sourceCol)
|
44
|
+
});
|
34
45
|
}
|
35
46
|
|
36
47
|
/**
|
@@ -50,13 +61,10 @@ class ColumnUtils {
|
|
50
61
|
* @returns {number}
|
51
62
|
*/
|
52
63
|
getStretchedColumnWidth(sourceIndex) {
|
53
|
-
const calculator = this.dataAccessObject.wtViewport.columnsRenderCalculator;
|
54
64
|
let width = this.getWidth(sourceIndex);
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
width = stretchedWidth;
|
59
|
-
}
|
65
|
+
const stretchedWidth = this.stretching.getStretchedColumnWidth(sourceIndex, width);
|
66
|
+
if (stretchedWidth) {
|
67
|
+
width = stretchedWidth;
|
60
68
|
}
|
61
69
|
return width;
|
62
70
|
}
|
@@ -87,12 +95,9 @@ class ColumnUtils {
|
|
87
95
|
}
|
88
96
|
|
89
97
|
/**
|
90
|
-
*
|
98
|
+
* Refreshes the stretching column width by recalculating the widths of the columns.
|
91
99
|
*/
|
92
|
-
|
93
|
-
const {
|
94
|
-
wtSettings
|
95
|
-
} = this;
|
100
|
+
refreshStretching() {
|
96
101
|
const {
|
97
102
|
wtTable,
|
98
103
|
wtViewport,
|
@@ -100,8 +105,18 @@ class ColumnUtils {
|
|
100
105
|
} = this.dataAccessObject;
|
101
106
|
const mainHolder = cloneSource ? cloneSource.wtTable.holder : wtTable.holder;
|
102
107
|
const scrollbarCompensation = mainHolder.offsetHeight < mainHolder.scrollHeight ? (0, _element.getScrollbarWidth)() : 0;
|
108
|
+
this.stretching.refreshStretching(wtViewport.getViewportWidth() - scrollbarCompensation);
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Calculates column header widths that can be retrieved from the cache.
|
113
|
+
*/
|
114
|
+
calculateWidths() {
|
115
|
+
const {
|
116
|
+
wtSettings
|
117
|
+
} = this;
|
103
118
|
let rowHeaderWidthSetting = wtSettings.getSetting('rowHeaderWidth');
|
104
|
-
|
119
|
+
this.refreshStretching();
|
105
120
|
rowHeaderWidthSetting = wtSettings.getSetting('onModifyRowHeaderWidth', rowHeaderWidthSetting);
|
106
121
|
if (rowHeaderWidthSetting !== null && rowHeaderWidthSetting !== undefined) {
|
107
122
|
const rowHeadersCount = wtSettings.getSetting('rowHeaders').length;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
3
|
-
function _toPropertyKey(
|
4
|
-
function _toPrimitive(
|
3
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
4
|
+
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); }
|
5
5
|
import { getScrollbarWidth } from "./../../../../helpers/dom/element.mjs";
|
6
|
+
import { ColumnStretching } from "./columnStretching.mjs";
|
6
7
|
/**
|
7
8
|
* Column utils class contains all necessary information about sizes of the columns.
|
8
9
|
*
|
@@ -26,8 +27,18 @@ export default class ColumnUtils {
|
|
26
27
|
* @type {Map<number, number>}
|
27
28
|
*/
|
28
29
|
_defineProperty(this, "headerWidths", new Map());
|
30
|
+
/**
|
31
|
+
* @type {ColumnStretching}
|
32
|
+
*/
|
33
|
+
_defineProperty(this, "stretching", void 0);
|
29
34
|
this.dataAccessObject = dataAccessObject;
|
30
35
|
this.wtSettings = wtSettings;
|
36
|
+
this.stretching = new ColumnStretching({
|
37
|
+
totalColumns: () => this.wtSettings.getSetting('totalColumns'),
|
38
|
+
stretchMode: () => this.wtSettings.getSetting('stretchH'),
|
39
|
+
stretchingColumnWidthFn: (stretchedWidth, column) => this.wtSettings.getSetting('onBeforeStretchingColumnWidth', stretchedWidth, column),
|
40
|
+
columnWidthFn: sourceCol => this.dataAccessObject.wtTable.getColumnWidth(sourceCol)
|
41
|
+
});
|
31
42
|
}
|
32
43
|
|
33
44
|
/**
|
@@ -47,13 +58,10 @@ export default class ColumnUtils {
|
|
47
58
|
* @returns {number}
|
48
59
|
*/
|
49
60
|
getStretchedColumnWidth(sourceIndex) {
|
50
|
-
const calculator = this.dataAccessObject.wtViewport.columnsRenderCalculator;
|
51
61
|
let width = this.getWidth(sourceIndex);
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
width = stretchedWidth;
|
56
|
-
}
|
62
|
+
const stretchedWidth = this.stretching.getStretchedColumnWidth(sourceIndex, width);
|
63
|
+
if (stretchedWidth) {
|
64
|
+
width = stretchedWidth;
|
57
65
|
}
|
58
66
|
return width;
|
59
67
|
}
|
@@ -84,12 +92,9 @@ export default class ColumnUtils {
|
|
84
92
|
}
|
85
93
|
|
86
94
|
/**
|
87
|
-
*
|
95
|
+
* Refreshes the stretching column width by recalculating the widths of the columns.
|
88
96
|
*/
|
89
|
-
|
90
|
-
const {
|
91
|
-
wtSettings
|
92
|
-
} = this;
|
97
|
+
refreshStretching() {
|
93
98
|
const {
|
94
99
|
wtTable,
|
95
100
|
wtViewport,
|
@@ -97,8 +102,18 @@ export default class ColumnUtils {
|
|
97
102
|
} = this.dataAccessObject;
|
98
103
|
const mainHolder = cloneSource ? cloneSource.wtTable.holder : wtTable.holder;
|
99
104
|
const scrollbarCompensation = mainHolder.offsetHeight < mainHolder.scrollHeight ? getScrollbarWidth() : 0;
|
105
|
+
this.stretching.refreshStretching(wtViewport.getViewportWidth() - scrollbarCompensation);
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Calculates column header widths that can be retrieved from the cache.
|
110
|
+
*/
|
111
|
+
calculateWidths() {
|
112
|
+
const {
|
113
|
+
wtSettings
|
114
|
+
} = this;
|
100
115
|
let rowHeaderWidthSetting = wtSettings.getSetting('rowHeaderWidth');
|
101
|
-
|
116
|
+
this.refreshStretching();
|
102
117
|
rowHeaderWidthSetting = wtSettings.getSetting('onModifyRowHeaderWidth', rowHeaderWidthSetting);
|
103
118
|
if (rowHeaderWidthSetting !== null && rowHeaderWidthSetting !== undefined) {
|
104
119
|
const rowHeadersCount = wtSettings.getSetting('rowHeaders').length;
|
@@ -0,0 +1,219 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
5
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
6
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
7
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
8
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
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
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
11
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
12
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
13
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
14
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
15
|
+
var _totalTargetWidth = /*#__PURE__*/new WeakMap();
|
16
|
+
var _totalColumns = /*#__PURE__*/new WeakMap();
|
17
|
+
var _stretchingColumnWidthFn = /*#__PURE__*/new WeakMap();
|
18
|
+
var _columnWidthFn = /*#__PURE__*/new WeakMap();
|
19
|
+
var _stretchMode = /*#__PURE__*/new WeakMap();
|
20
|
+
/**
|
21
|
+
* @typedef {object} ColumnStretchingOptions
|
22
|
+
* @property {number} totalColumns Total number of columns.
|
23
|
+
* @property {Function} columnWidthFn Function that returns the width of the column at a given index (in px).
|
24
|
+
* @property {'all' | 'last' | 'none'} stretchMode Stretch mode 'all', 'last' or 'none'.
|
25
|
+
* @property {Function} stretchingColumnWidthFn Function that returns the new width of the stretched column.
|
26
|
+
*/
|
27
|
+
/**
|
28
|
+
* @class ColumnStretching
|
29
|
+
*/
|
30
|
+
class ColumnStretching {
|
31
|
+
/**
|
32
|
+
* Default column width.
|
33
|
+
*
|
34
|
+
* @type {number}
|
35
|
+
*/
|
36
|
+
static get DEFAULT_WIDTH() {
|
37
|
+
return 50;
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* @type {number}
|
42
|
+
*/
|
43
|
+
|
44
|
+
/**
|
45
|
+
* @param {ColumnStretchingOptions} options Object with all options specified for column viewport calculation.
|
46
|
+
*/
|
47
|
+
constructor(_ref) {
|
48
|
+
let {
|
49
|
+
totalColumns,
|
50
|
+
stretchMode,
|
51
|
+
stretchingColumnWidthFn,
|
52
|
+
columnWidthFn
|
53
|
+
} = _ref;
|
54
|
+
_defineProperty(this, "stretchAllRatio", 0);
|
55
|
+
/**
|
56
|
+
* @type {number}
|
57
|
+
*/
|
58
|
+
_defineProperty(this, "stretchLastWidth", 0);
|
59
|
+
/**
|
60
|
+
* @type {number[]}
|
61
|
+
*/
|
62
|
+
_defineProperty(this, "stretchAllColumnsWidth", []);
|
63
|
+
/**
|
64
|
+
* @type {number}
|
65
|
+
*/
|
66
|
+
_classPrivateFieldInitSpec(this, _totalTargetWidth, {
|
67
|
+
writable: true,
|
68
|
+
value: 0
|
69
|
+
});
|
70
|
+
/**
|
71
|
+
* @type {boolean}
|
72
|
+
*/
|
73
|
+
_defineProperty(this, "needVerifyLastColumnWidth", true);
|
74
|
+
/**
|
75
|
+
* The total number of columns.
|
76
|
+
*
|
77
|
+
* @type {function(): number}
|
78
|
+
*/
|
79
|
+
_classPrivateFieldInitSpec(this, _totalColumns, {
|
80
|
+
writable: true,
|
81
|
+
value: () => 0
|
82
|
+
});
|
83
|
+
/**
|
84
|
+
* Function that returns the width of the stretched column at a given index (in px).
|
85
|
+
*
|
86
|
+
* @type {function(): number}
|
87
|
+
*/
|
88
|
+
_classPrivateFieldInitSpec(this, _stretchingColumnWidthFn, {
|
89
|
+
writable: true,
|
90
|
+
value: width => width
|
91
|
+
});
|
92
|
+
/**
|
93
|
+
* Function that returns the width of the column at a given index (in px).
|
94
|
+
*
|
95
|
+
* @type {function(): number}
|
96
|
+
*/
|
97
|
+
_classPrivateFieldInitSpec(this, _columnWidthFn, {
|
98
|
+
writable: true,
|
99
|
+
value: width => width
|
100
|
+
});
|
101
|
+
/**
|
102
|
+
* Stretch mode.
|
103
|
+
*
|
104
|
+
* @type {function(): 'all' | 'last' | 'none'}
|
105
|
+
*/
|
106
|
+
_classPrivateFieldInitSpec(this, _stretchMode, {
|
107
|
+
writable: true,
|
108
|
+
value: () => 'none'
|
109
|
+
});
|
110
|
+
_classPrivateFieldSet(this, _totalColumns, totalColumns);
|
111
|
+
_classPrivateFieldSet(this, _stretchMode, stretchMode);
|
112
|
+
_classPrivateFieldSet(this, _stretchingColumnWidthFn, stretchingColumnWidthFn !== null && stretchingColumnWidthFn !== void 0 ? stretchingColumnWidthFn : _classPrivateFieldGet(this, _stretchingColumnWidthFn));
|
113
|
+
_classPrivateFieldSet(this, _columnWidthFn, columnWidthFn !== null && columnWidthFn !== void 0 ? columnWidthFn : _classPrivateFieldGet(this, _columnWidthFn));
|
114
|
+
}
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Recalculate columns stretching.
|
118
|
+
*
|
119
|
+
* @param {number} totalWidth The total width of the table.
|
120
|
+
*/
|
121
|
+
refreshStretching(totalWidth) {
|
122
|
+
if (_classPrivateFieldGet(this, _stretchMode).call(this) === 'none') {
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
_classPrivateFieldSet(this, _totalTargetWidth, totalWidth);
|
126
|
+
let sumAll = 0;
|
127
|
+
for (let i = 0; i < _classPrivateFieldGet(this, _totalColumns).call(this); i++) {
|
128
|
+
const columnWidth = this._getColumnWidth(i);
|
129
|
+
const permanentColumnWidth = _classPrivateFieldGet(this, _stretchingColumnWidthFn).call(this, undefined, i);
|
130
|
+
if (typeof permanentColumnWidth === 'number') {
|
131
|
+
totalWidth -= permanentColumnWidth;
|
132
|
+
} else {
|
133
|
+
sumAll += columnWidth;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
const remainingSize = totalWidth - sumAll;
|
137
|
+
if (_classPrivateFieldGet(this, _stretchMode).call(this) === 'all' && remainingSize > 0) {
|
138
|
+
this.stretchAllRatio = totalWidth / sumAll;
|
139
|
+
this.stretchAllColumnsWidth = [];
|
140
|
+
this.needVerifyLastColumnWidth = true;
|
141
|
+
} else if (_classPrivateFieldGet(this, _stretchMode).call(this) === 'last' && totalWidth !== Infinity) {
|
142
|
+
const columnWidth = this._getColumnWidth(_classPrivateFieldGet(this, _totalColumns).call(this) - 1);
|
143
|
+
const lastColumnWidth = remainingSize + columnWidth;
|
144
|
+
this.stretchLastWidth = lastColumnWidth >= 0 ? lastColumnWidth : columnWidth;
|
145
|
+
}
|
146
|
+
}
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Get stretched column width based on stretchH (all or last) setting passed in handsontable instance.
|
150
|
+
*
|
151
|
+
* @param {number} column The visual column index.
|
152
|
+
* @param {number} baseWidth The default column width.
|
153
|
+
* @returns {number|null}
|
154
|
+
*/
|
155
|
+
getStretchedColumnWidth(column, baseWidth) {
|
156
|
+
let result = null;
|
157
|
+
if (_classPrivateFieldGet(this, _stretchMode).call(this) === 'all' && this.stretchAllRatio !== 0) {
|
158
|
+
result = this._getStretchedAllColumnWidth(column, baseWidth);
|
159
|
+
} else if (_classPrivateFieldGet(this, _stretchMode).call(this) === 'last' && this.stretchLastWidth !== 0) {
|
160
|
+
result = this._getStretchedLastColumnWidth(column);
|
161
|
+
}
|
162
|
+
return result;
|
163
|
+
}
|
164
|
+
|
165
|
+
/**
|
166
|
+
* @param {number} column The visual column index.
|
167
|
+
* @param {number} baseWidth The default column width.
|
168
|
+
* @returns {number}
|
169
|
+
* @private
|
170
|
+
*/
|
171
|
+
_getStretchedAllColumnWidth(column, baseWidth) {
|
172
|
+
let sumRatioWidth = 0;
|
173
|
+
if (!this.stretchAllColumnsWidth[column]) {
|
174
|
+
const stretchedWidth = Math.round(baseWidth * this.stretchAllRatio);
|
175
|
+
const newStretchedWidth = _classPrivateFieldGet(this, _stretchingColumnWidthFn).call(this, stretchedWidth, column);
|
176
|
+
if (newStretchedWidth === undefined) {
|
177
|
+
this.stretchAllColumnsWidth[column] = stretchedWidth;
|
178
|
+
} else {
|
179
|
+
this.stretchAllColumnsWidth[column] = isNaN(newStretchedWidth) ? this._getColumnWidth(column) : newStretchedWidth;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
if (this.stretchAllColumnsWidth.length === _classPrivateFieldGet(this, _totalColumns).call(this) && this.needVerifyLastColumnWidth) {
|
183
|
+
this.needVerifyLastColumnWidth = false;
|
184
|
+
for (let i = 0; i < this.stretchAllColumnsWidth.length; i++) {
|
185
|
+
sumRatioWidth += this.stretchAllColumnsWidth[i];
|
186
|
+
}
|
187
|
+
if (sumRatioWidth !== _classPrivateFieldGet(this, _totalTargetWidth)) {
|
188
|
+
this.stretchAllColumnsWidth[this.stretchAllColumnsWidth.length - 1] += _classPrivateFieldGet(this, _totalTargetWidth) - sumRatioWidth;
|
189
|
+
}
|
190
|
+
}
|
191
|
+
return this.stretchAllColumnsWidth[column];
|
192
|
+
}
|
193
|
+
|
194
|
+
/**
|
195
|
+
* @param {number} column The visual column index.
|
196
|
+
* @returns {number|null}
|
197
|
+
* @private
|
198
|
+
*/
|
199
|
+
_getStretchedLastColumnWidth(column) {
|
200
|
+
if (column === _classPrivateFieldGet(this, _totalColumns).call(this) - 1) {
|
201
|
+
return this.stretchLastWidth;
|
202
|
+
}
|
203
|
+
return null;
|
204
|
+
}
|
205
|
+
|
206
|
+
/**
|
207
|
+
* @param {number} column The visual column index.
|
208
|
+
* @returns {number}
|
209
|
+
* @private
|
210
|
+
*/
|
211
|
+
_getColumnWidth(column) {
|
212
|
+
let width = _classPrivateFieldGet(this, _columnWidthFn).call(this, column);
|
213
|
+
if (isNaN(width)) {
|
214
|
+
width = ColumnStretching.DEFAULT_WIDTH;
|
215
|
+
}
|
216
|
+
return width;
|
217
|
+
}
|
218
|
+
}
|
219
|
+
exports.ColumnStretching = ColumnStretching;
|