handsontable 12.1.2 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3rdparty/SheetClip/SheetClip.js +3 -32
- package/3rdparty/SheetClip/SheetClip.mjs +3 -23
- package/3rdparty/SheetClip/index.js +0 -2
- package/3rdparty/autoResize/autoResize.js +119 -145
- package/3rdparty/autoResize/autoResize.mjs +119 -143
- package/3rdparty/autoResize/index.js +0 -2
- package/3rdparty/walkontable/src/border.js +72 -174
- package/3rdparty/walkontable/src/border.mjs +74 -161
- package/3rdparty/walkontable/src/calculator/constants.js +0 -3
- package/3rdparty/walkontable/src/calculator/constants.mjs +0 -2
- package/3rdparty/walkontable/src/calculator/index.js +0 -10
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +26 -76
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +26 -69
- package/3rdparty/walkontable/src/calculator/viewportRows.js +20 -48
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +20 -41
- package/3rdparty/walkontable/src/cell/coords.js +13 -43
- package/3rdparty/walkontable/src/cell/coords.mjs +13 -38
- package/3rdparty/walkontable/src/cell/range.js +55 -130
- package/3rdparty/walkontable/src/cell/range.mjs +60 -126
- package/3rdparty/walkontable/src/core/_base.js +16 -74
- package/3rdparty/walkontable/src/core/_base.mjs +19 -70
- package/3rdparty/walkontable/src/core/clone.js +1 -40
- package/3rdparty/walkontable/src/core/clone.mjs +3 -30
- package/3rdparty/walkontable/src/core/core.js +3 -57
- package/3rdparty/walkontable/src/core/core.mjs +5 -41
- package/3rdparty/walkontable/src/event.js +31 -78
- package/3rdparty/walkontable/src/event.mjs +31 -65
- package/3rdparty/walkontable/src/facade/core.js +1 -17
- package/3rdparty/walkontable/src/facade/core.mjs +7 -20
- package/3rdparty/walkontable/src/filter/column.js +9 -18
- package/3rdparty/walkontable/src/filter/column.mjs +9 -17
- package/3rdparty/walkontable/src/filter/row.js +9 -18
- package/3rdparty/walkontable/src/filter/row.mjs +9 -17
- package/3rdparty/walkontable/src/index.js +0 -31
- package/3rdparty/walkontable/src/overlay/_base.js +24 -69
- package/3rdparty/walkontable/src/overlay/_base.mjs +31 -68
- package/3rdparty/walkontable/src/overlay/bottom.js +28 -99
- package/3rdparty/walkontable/src/overlay/bottom.mjs +30 -86
- package/3rdparty/walkontable/src/overlay/bottomInlineStartCorner.js +7 -53
- package/3rdparty/walkontable/src/overlay/bottomInlineStartCorner.mjs +9 -40
- package/3rdparty/walkontable/src/overlay/constants.js +0 -6
- package/3rdparty/walkontable/src/overlay/constants.mjs +0 -1
- package/3rdparty/walkontable/src/overlay/index.js +0 -17
- package/3rdparty/walkontable/src/overlay/inlineStart.js +21 -91
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +23 -78
- package/3rdparty/walkontable/src/overlay/top.js +27 -100
- package/3rdparty/walkontable/src/overlay/top.mjs +29 -87
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +4 -51
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +6 -38
- package/3rdparty/walkontable/src/overlays.js +58 -129
- package/3rdparty/walkontable/src/overlays.mjs +60 -121
- package/3rdparty/walkontable/src/renderer/_base.js +4 -20
- package/3rdparty/walkontable/src/renderer/_base.mjs +8 -22
- package/3rdparty/walkontable/src/renderer/cells.js +10 -54
- package/3rdparty/walkontable/src/renderer/cells.mjs +22 -52
- package/3rdparty/walkontable/src/renderer/colGroup.js +10 -47
- package/3rdparty/walkontable/src/renderer/colGroup.mjs +21 -46
- package/3rdparty/walkontable/src/renderer/columnHeaders.js +8 -50
- package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +19 -49
- package/3rdparty/walkontable/src/renderer/index.js +13 -36
- package/3rdparty/walkontable/src/renderer/index.mjs +17 -27
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +8 -50
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +20 -49
- package/3rdparty/walkontable/src/renderer/rows.js +3 -46
- package/3rdparty/walkontable/src/renderer/rows.mjs +3 -29
- package/3rdparty/walkontable/src/renderer/table.js +22 -49
- package/3rdparty/walkontable/src/renderer/table.mjs +22 -48
- package/3rdparty/walkontable/src/scroll.js +56 -86
- package/3rdparty/walkontable/src/scroll.mjs +58 -86
- package/3rdparty/walkontable/src/selection.js +20 -101
- package/3rdparty/walkontable/src/selection.mjs +22 -85
- package/3rdparty/walkontable/src/settings.js +9 -29
- package/3rdparty/walkontable/src/settings.mjs +9 -27
- package/3rdparty/walkontable/src/table/bottom.js +1 -35
- package/3rdparty/walkontable/src/table/bottom.mjs +6 -25
- package/3rdparty/walkontable/src/table/bottomInlineStartCorner.js +1 -35
- package/3rdparty/walkontable/src/table/bottomInlineStartCorner.mjs +7 -26
- package/3rdparty/walkontable/src/table/inlineStart.js +1 -35
- package/3rdparty/walkontable/src/table/inlineStart.mjs +3 -22
- package/3rdparty/walkontable/src/table/master.js +10 -55
- package/3rdparty/walkontable/src/table/master.mjs +15 -44
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +7 -28
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +7 -26
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +7 -28
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +7 -26
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +7 -22
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +7 -20
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +7 -23
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +7 -21
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +7 -22
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +7 -20
- package/3rdparty/walkontable/src/table/top.js +1 -35
- package/3rdparty/walkontable/src/table/top.mjs +6 -25
- package/3rdparty/walkontable/src/table/topInlineStartCorner.js +1 -35
- package/3rdparty/walkontable/src/table/topInlineStartCorner.mjs +7 -26
- package/3rdparty/walkontable/src/table.js +74 -238
- package/3rdparty/walkontable/src/table.mjs +84 -227
- package/3rdparty/walkontable/src/types.js +0 -5
- package/3rdparty/walkontable/src/types.mjs +0 -5
- package/3rdparty/walkontable/src/utils/column.js +9 -31
- package/3rdparty/walkontable/src/utils/column.mjs +13 -30
- package/3rdparty/walkontable/src/utils/nodesPool.js +3 -12
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +3 -11
- package/3rdparty/walkontable/src/utils/orderView/constants.js +0 -3
- package/3rdparty/walkontable/src/utils/orderView/constants.mjs +0 -2
- package/3rdparty/walkontable/src/utils/orderView/index.js +0 -5
- package/3rdparty/walkontable/src/utils/orderView/sharedView.js +2 -33
- package/3rdparty/walkontable/src/utils/orderView/sharedView.mjs +6 -26
- package/3rdparty/walkontable/src/utils/orderView/view.js +14 -46
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +21 -50
- package/3rdparty/walkontable/src/utils/orderView/viewSize.js +3 -15
- package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +3 -14
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +8 -22
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +23 -34
- package/3rdparty/walkontable/src/utils/row.js +2 -13
- package/3rdparty/walkontable/src/utils/row.mjs +2 -12
- package/3rdparty/walkontable/src/viewport.js +38 -100
- package/3rdparty/walkontable/src/viewport.mjs +40 -99
- package/CHANGELOG.md +103 -5
- package/base.js +6 -17
- package/base.mjs +6 -12
- package/cellTypes/autocompleteType/autocompleteType.js +0 -4
- package/cellTypes/autocompleteType/index.js +0 -2
- package/cellTypes/checkboxType/checkboxType.js +0 -3
- package/cellTypes/checkboxType/index.js +0 -2
- package/cellTypes/dateType/dateType.js +0 -4
- package/cellTypes/dateType/index.js +0 -2
- package/cellTypes/dropdownType/dropdownType.js +0 -4
- package/cellTypes/dropdownType/index.js +0 -2
- package/cellTypes/handsontableType/handsontableType.js +0 -3
- package/cellTypes/handsontableType/index.js +0 -2
- package/cellTypes/index.js +0 -21
- package/cellTypes/index.mjs +3 -5
- package/cellTypes/numericType/index.js +0 -2
- package/cellTypes/numericType/numericType.js +0 -4
- package/cellTypes/passwordType/index.js +0 -2
- package/cellTypes/passwordType/passwordType.js +0 -3
- package/cellTypes/registry.js +10 -25
- package/cellTypes/registry.mjs +10 -20
- package/cellTypes/textType/index.js +0 -2
- package/cellTypes/textType/textType.js +0 -3
- package/cellTypes/timeType/index.js +0 -2
- package/cellTypes/timeType/timeType.js +0 -4
- package/core.d.ts +6 -4
- package/core.js +514 -974
- package/core.mjs +519 -921
- package/dataMap/dataMap.js +127 -212
- package/dataMap/dataMap.mjs +127 -188
- package/{dataSource.js → dataMap/dataSource.js} +18 -66
- package/{dataSource.mjs → dataMap/dataSource.mjs} +20 -60
- package/dataMap/index.js +0 -13
- package/dataMap/metaManager/index.js +21 -46
- package/dataMap/metaManager/index.mjs +47 -64
- package/dataMap/metaManager/lazyFactoryMap.js +23 -55
- package/dataMap/metaManager/lazyFactoryMap.mjs +23 -43
- package/dataMap/metaManager/metaLayers/cellMeta.js +16 -52
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +16 -37
- package/dataMap/metaManager/metaLayers/columnMeta.js +8 -22
- package/dataMap/metaManager/metaLayers/columnMeta.mjs +14 -25
- package/dataMap/metaManager/metaLayers/globalMeta.js +4 -19
- package/dataMap/metaManager/metaLayers/globalMeta.mjs +4 -15
- package/dataMap/metaManager/metaLayers/tableMeta.js +4 -15
- package/dataMap/metaManager/metaLayers/tableMeta.mjs +28 -37
- package/dataMap/metaManager/metaSchema.js +196 -257
- package/dataMap/metaManager/metaSchema.mjs +196 -248
- package/dataMap/metaManager/mods/dynamicCellMeta.js +6 -36
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +20 -39
- package/dataMap/metaManager/mods/extendMetaProperties.js +5 -28
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +4 -18
- package/dataMap/metaManager/utils.js +11 -20
- package/dataMap/metaManager/utils.mjs +21 -23
- package/dataMap/replaceData.js +14 -35
- package/dataMap/replaceData.mjs +35 -45
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +64469 -93042
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +527 -284
- package/dist/handsontable.js +9616 -21414
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +3 -3
- package/dist/languages/all.js +0 -175
- package/dist/languages/ar-AR.js +0 -10
- package/dist/languages/cs-CZ.js +0 -10
- package/dist/languages/de-CH.js +0 -10
- package/dist/languages/de-DE.js +0 -10
- package/dist/languages/en-US.js +0 -10
- package/dist/languages/es-MX.js +0 -10
- package/dist/languages/fr-FR.js +0 -10
- package/dist/languages/it-IT.js +0 -10
- package/dist/languages/ja-JP.js +0 -10
- package/dist/languages/ko-KR.js +0 -10
- package/dist/languages/lv-LV.js +0 -10
- package/dist/languages/nb-NO.js +0 -10
- package/dist/languages/nl-NL.js +0 -10
- package/dist/languages/pl-PL.js +0 -10
- package/dist/languages/pt-BR.js +0 -10
- package/dist/languages/ru-RU.js +0 -10
- package/dist/languages/sr-SP.js +0 -10
- package/dist/languages/zh-CN.js +0 -10
- package/dist/languages/zh-TW.js +0 -10
- package/editorManager.js +89 -124
- package/editorManager.mjs +89 -104
- package/editors/autocompleteEditor/autocompleteEditor.js +26 -133
- package/editors/autocompleteEditor/autocompleteEditor.mjs +26 -104
- package/editors/autocompleteEditor/index.js +0 -2
- package/editors/baseEditor/baseEditor.js +45 -155
- package/editors/baseEditor/baseEditor.mjs +45 -129
- package/editors/baseEditor/index.js +0 -2
- package/editors/checkboxEditor/checkboxEditor.js +2 -33
- package/editors/checkboxEditor/checkboxEditor.mjs +2 -19
- package/editors/checkboxEditor/index.js +0 -2
- package/editors/dateEditor/dateEditor.js +36 -97
- package/editors/dateEditor/dateEditor.mjs +35 -74
- package/editors/dateEditor/index.js +0 -2
- package/editors/dropdownEditor/dropdownEditor.js +1 -41
- package/editors/dropdownEditor/dropdownEditor.mjs +1 -22
- package/editors/dropdownEditor/index.js +0 -2
- package/editors/handsontableEditor/handsontableEditor.js +13 -85
- package/editors/handsontableEditor/handsontableEditor.mjs +13 -66
- package/editors/handsontableEditor/index.js +0 -2
- package/editors/index.js +0 -25
- package/editors/index.mjs +3 -5
- package/editors/numericEditor/index.js +0 -2
- package/editors/numericEditor/numericEditor.js +1 -31
- package/editors/numericEditor/numericEditor.mjs +1 -18
- package/editors/passwordEditor/index.js +0 -2
- package/editors/passwordEditor/passwordEditor.js +1 -38
- package/editors/passwordEditor/passwordEditor.mjs +1 -22
- package/editors/registry.js +10 -36
- package/editors/registry.mjs +10 -28
- package/editors/selectEditor/index.js +0 -2
- package/editors/selectEditor/selectEditor.js +21 -73
- package/editors/selectEditor/selectEditor.mjs +21 -56
- package/editors/textEditor/caretPositioner.js +0 -12
- package/editors/textEditor/caretPositioner.mjs +10 -20
- package/editors/textEditor/index.js +0 -2
- package/editors/textEditor/textEditor.js +38 -137
- package/editors/textEditor/textEditor.mjs +38 -106
- package/editors/timeEditor/index.js +0 -2
- package/editors/timeEditor/timeEditor.js +1 -36
- package/editors/timeEditor/timeEditor.mjs +1 -21
- package/eventManager.js +20 -56
- package/eventManager.mjs +23 -56
- package/helpers/array.js +22 -88
- package/helpers/array.mjs +22 -58
- package/helpers/browser.js +25 -51
- package/helpers/browser.mjs +25 -32
- package/helpers/console.js +3 -13
- package/helpers/console.mjs +8 -16
- package/helpers/data.d.ts +0 -1
- package/helpers/data.js +10 -55
- package/helpers/data.mjs +10 -33
- package/helpers/date.js +2 -3
- package/helpers/date.mjs +2 -2
- package/helpers/dom/element.js +67 -259
- package/helpers/dom/element.mjs +74 -194
- package/helpers/dom/event.js +3 -7
- package/helpers/dom/event.mjs +3 -3
- package/helpers/feature.js +13 -47
- package/helpers/feature.mjs +13 -31
- package/helpers/function.js +14 -59
- package/helpers/function.mjs +20 -52
- package/helpers/mixed.js +9 -66
- package/helpers/mixed.mjs +15 -51
- package/helpers/number.js +4 -46
- package/helpers/number.mjs +4 -23
- package/helpers/object.js +15 -72
- package/helpers/object.mjs +21 -52
- package/helpers/string.js +6 -28
- package/helpers/string.mjs +12 -21
- package/helpers/templateLiteralTag.js +0 -6
- package/helpers/templateLiteralTag.mjs +7 -10
- package/helpers/unicode.js +17 -26
- package/helpers/unicode.mjs +17 -15
- package/helpers/wrappers/jquery.js +4 -14
- package/helpers/wrappers/jquery.mjs +4 -13
- package/i18n/constants.js +1 -3
- package/i18n/constants.mjs +1 -1
- package/i18n/index.js +0 -7
- package/i18n/languages/ar-AR.js +0 -16
- package/i18n/languages/ar-AR.mjs +1 -4
- package/i18n/languages/cs-CZ.js +0 -16
- package/i18n/languages/cs-CZ.mjs +1 -4
- package/i18n/languages/de-CH.js +0 -16
- package/i18n/languages/de-CH.mjs +1 -4
- package/i18n/languages/de-DE.js +0 -16
- package/i18n/languages/de-DE.mjs +1 -4
- package/i18n/languages/en-US.js +0 -16
- package/i18n/languages/en-US.mjs +1 -4
- package/i18n/languages/es-MX.js +0 -16
- package/i18n/languages/es-MX.mjs +1 -4
- package/i18n/languages/fr-FR.js +0 -16
- package/i18n/languages/fr-FR.mjs +1 -4
- package/i18n/languages/index.js +0 -39
- package/i18n/languages/it-IT.js +0 -16
- package/i18n/languages/it-IT.mjs +1 -4
- package/i18n/languages/ja-JP.js +0 -16
- package/i18n/languages/ja-JP.mjs +1 -4
- package/i18n/languages/ko-KR.js +0 -16
- package/i18n/languages/ko-KR.mjs +1 -4
- package/i18n/languages/lv-LV.js +0 -16
- package/i18n/languages/lv-LV.mjs +1 -4
- package/i18n/languages/nb-NO.js +0 -16
- package/i18n/languages/nb-NO.mjs +1 -4
- package/i18n/languages/nl-NL.js +0 -16
- package/i18n/languages/nl-NL.mjs +1 -4
- package/i18n/languages/pl-PL.js +0 -16
- package/i18n/languages/pl-PL.mjs +1 -4
- package/i18n/languages/pt-BR.js +0 -16
- package/i18n/languages/pt-BR.mjs +1 -4
- package/i18n/languages/ru-RU.js +0 -16
- package/i18n/languages/ru-RU.mjs +1 -4
- package/i18n/languages/sr-SP.js +0 -16
- package/i18n/languages/sr-SP.mjs +1 -4
- package/i18n/languages/zh-CN.js +0 -16
- package/i18n/languages/zh-CN.mjs +1 -4
- package/i18n/languages/zh-TW.js +0 -16
- package/i18n/languages/zh-TW.mjs +1 -4
- package/i18n/phraseFormatters/index.js +4 -11
- package/i18n/phraseFormatters/index.mjs +4 -6
- package/i18n/phraseFormatters/pluralize.js +0 -5
- package/i18n/phraseFormatters/pluralize.mjs +0 -3
- package/i18n/phraseFormatters/substituteVariables.js +0 -4
- package/i18n/phraseFormatters/substituteVariables.mjs +8 -11
- package/i18n/registry.js +18 -59
- package/i18n/registry.mjs +18 -30
- package/i18n/utils.js +4 -22
- package/i18n/utils.mjs +13 -21
- package/index.js +19 -56
- package/index.mjs +19 -15
- package/languages/all.js +0 -175
- package/languages/ar-AR.js +0 -10
- package/languages/ar-AR.mjs +1 -4
- package/languages/cs-CZ.js +0 -10
- package/languages/cs-CZ.mjs +1 -4
- package/languages/de-CH.js +0 -10
- package/languages/de-CH.mjs +1 -4
- package/languages/de-DE.js +0 -10
- package/languages/de-DE.mjs +1 -4
- package/languages/en-US.js +0 -10
- package/languages/en-US.mjs +1 -4
- package/languages/es-MX.js +0 -10
- package/languages/es-MX.mjs +1 -4
- package/languages/fr-FR.js +0 -10
- package/languages/fr-FR.mjs +1 -4
- package/languages/index.js +0 -175
- package/languages/it-IT.js +0 -10
- package/languages/it-IT.mjs +1 -4
- package/languages/ja-JP.js +0 -10
- package/languages/ja-JP.mjs +1 -4
- package/languages/ko-KR.js +0 -10
- package/languages/ko-KR.mjs +1 -4
- package/languages/lv-LV.js +0 -10
- package/languages/lv-LV.mjs +1 -4
- package/languages/nb-NO.js +0 -10
- package/languages/nb-NO.mjs +1 -4
- package/languages/nl-NL.js +0 -10
- package/languages/nl-NL.mjs +1 -4
- package/languages/pl-PL.js +0 -10
- package/languages/pl-PL.mjs +1 -4
- package/languages/pt-BR.js +0 -10
- package/languages/pt-BR.mjs +1 -4
- package/languages/ru-RU.js +0 -10
- package/languages/ru-RU.mjs +1 -4
- package/languages/sr-SP.js +0 -10
- package/languages/sr-SP.mjs +1 -4
- package/languages/zh-CN.js +0 -10
- package/languages/zh-CN.mjs +1 -4
- package/languages/zh-TW.js +0 -10
- package/languages/zh-TW.mjs +1 -4
- package/mixins/hooksRefRegisterer.js +4 -18
- package/mixins/hooksRefRegisterer.mjs +4 -15
- package/mixins/localHooks.js +7 -17
- package/mixins/localHooks.mjs +7 -14
- package/package.json +1 -1
- package/pluginHooks.d.ts +3 -4
- package/pluginHooks.js +288 -110
- package/pluginHooks.mjs +287 -97
- package/plugins/autoColumnSize/autoColumnSize.js +74 -172
- package/plugins/autoColumnSize/autoColumnSize.mjs +74 -137
- package/plugins/autoColumnSize/index.js +0 -2
- package/plugins/autoRowSize/autoRowSize.js +73 -153
- package/plugins/autoRowSize/autoRowSize.mjs +73 -124
- package/plugins/autoRowSize/index.js +0 -2
- package/plugins/autofill/autofill.js +46 -163
- package/plugins/autofill/autofill.mjs +46 -131
- package/plugins/autofill/index.js +0 -2
- package/plugins/autofill/utils.js +4 -26
- package/plugins/autofill/utils.mjs +4 -18
- package/plugins/base/base.js +21 -92
- package/plugins/base/base.mjs +21 -63
- package/plugins/base/index.js +0 -2
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +19 -52
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +19 -33
- package/plugins/bindRowsWithHeaders/index.js +0 -2
- package/plugins/bindRowsWithHeaders/maps/looseBindsMap.js +5 -41
- package/plugins/bindRowsWithHeaders/maps/looseBindsMap.mjs +5 -29
- package/plugins/bindRowsWithHeaders/maps/strictBindsMap.js +6 -53
- package/plugins/bindRowsWithHeaders/maps/strictBindsMap.mjs +6 -37
- package/plugins/collapsibleColumns/collapsibleColumns.js +96 -188
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +97 -158
- package/plugins/collapsibleColumns/index.js +0 -2
- package/plugins/columnSorting/columnSorting.js +50 -188
- package/plugins/columnSorting/columnSorting.mjs +50 -143
- package/plugins/columnSorting/columnStatesManager.js +15 -71
- package/plugins/columnSorting/columnStatesManager.mjs +15 -48
- package/plugins/columnSorting/domHelpers.js +2 -18
- package/plugins/columnSorting/domHelpers.mjs +2 -7
- package/plugins/columnSorting/index.js +0 -2
- package/plugins/columnSorting/rootComparator.js +5 -24
- package/plugins/columnSorting/rootComparator.mjs +12 -21
- package/plugins/columnSorting/sortFunction/checkbox.js +8 -16
- package/plugins/columnSorting/sortFunction/checkbox.mjs +16 -21
- package/plugins/columnSorting/sortFunction/date.js +2 -19
- package/plugins/columnSorting/sortFunction/date.mjs +10 -23
- package/plugins/columnSorting/sortFunction/default.js +2 -17
- package/plugins/columnSorting/sortFunction/default.mjs +10 -23
- package/plugins/columnSorting/sortFunction/numeric.js +2 -11
- package/plugins/columnSorting/sortFunction/numeric.mjs +10 -17
- package/plugins/columnSorting/sortService/engine.js +3 -13
- package/plugins/columnSorting/sortService/engine.mjs +3 -5
- package/plugins/columnSorting/sortService/index.js +0 -5
- package/plugins/columnSorting/sortService/registry.js +6 -18
- package/plugins/columnSorting/sortService/registry.mjs +6 -10
- package/plugins/columnSorting/utils.js +9 -34
- package/plugins/columnSorting/utils.mjs +9 -15
- package/plugins/columnSummary/columnSummary.js +66 -126
- package/plugins/columnSummary/columnSummary.mjs +66 -101
- package/plugins/columnSummary/endpoints.js +21 -98
- package/plugins/columnSummary/endpoints.mjs +26 -99
- package/plugins/columnSummary/index.js +0 -2
- package/plugins/columnSummary/utils.js +13 -0
- package/plugins/columnSummary/utils.mjs +9 -0
- package/plugins/comments/commentEditor.js +16 -28
- package/plugins/comments/commentEditor.mjs +21 -32
- package/plugins/comments/comments.js +92 -175
- package/plugins/comments/comments.mjs +92 -149
- package/plugins/comments/displaySwitch.js +6 -23
- package/plugins/comments/displaySwitch.mjs +6 -18
- package/plugins/comments/index.js +0 -2
- package/plugins/contextMenu/commandExecutor.js +9 -40
- package/plugins/contextMenu/commandExecutor.mjs +14 -41
- package/plugins/contextMenu/contextMenu.js +26 -105
- package/plugins/contextMenu/contextMenu.mjs +26 -75
- package/plugins/contextMenu/cursor.js +6 -20
- package/plugins/contextMenu/cursor.mjs +11 -24
- package/plugins/contextMenu/index.js +0 -2
- package/plugins/contextMenu/itemsFactory.js +14 -43
- package/plugins/contextMenu/itemsFactory.mjs +19 -44
- package/plugins/contextMenu/menu.js +61 -177
- package/plugins/contextMenu/menu.mjs +61 -149
- package/plugins/contextMenu/predefinedItems/alignment.js +1 -55
- package/plugins/contextMenu/predefinedItems/alignment.mjs +1 -37
- package/plugins/contextMenu/predefinedItems/clearColumn.js +1 -20
- package/plugins/contextMenu/predefinedItems/clearColumn.mjs +1 -4
- package/plugins/contextMenu/predefinedItems/columnLeft.js +6 -43
- package/plugins/contextMenu/predefinedItems/columnLeft.mjs +6 -26
- package/plugins/contextMenu/predefinedItems/columnRight.js +4 -42
- package/plugins/contextMenu/predefinedItems/columnRight.mjs +4 -25
- package/plugins/contextMenu/predefinedItems/noItems.js +1 -4
- package/plugins/contextMenu/predefinedItems/noItems.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/readOnly.js +1 -25
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +1 -8
- package/plugins/contextMenu/predefinedItems/redo.js +1 -16
- package/plugins/contextMenu/predefinedItems/redo.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/removeColumn.js +3 -38
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +3 -18
- package/plugins/contextMenu/predefinedItems/removeRow.js +3 -37
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +3 -17
- package/plugins/contextMenu/predefinedItems/rowAbove.js +6 -35
- package/plugins/contextMenu/predefinedItems/rowAbove.mjs +6 -19
- package/plugins/contextMenu/predefinedItems/rowBelow.js +4 -42
- package/plugins/contextMenu/predefinedItems/rowBelow.mjs +4 -25
- package/plugins/contextMenu/predefinedItems/separator.js +1 -2
- package/plugins/contextMenu/predefinedItems/separator.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/undo.js +1 -16
- package/plugins/contextMenu/predefinedItems/undo.mjs +1 -1
- package/plugins/contextMenu/predefinedItems.js +2 -48
- package/plugins/contextMenu/predefinedItems.mjs +2 -7
- package/plugins/contextMenu/utils.js +17 -57
- package/plugins/contextMenu/utils.mjs +21 -39
- package/plugins/copyPaste/clipboardData.js +1 -10
- package/plugins/copyPaste/clipboardData.mjs +1 -9
- package/plugins/copyPaste/contextMenuItem/copy.js +2 -17
- package/plugins/copyPaste/contextMenuItem/copy.mjs +6 -9
- package/plugins/copyPaste/contextMenuItem/cut.js +2 -17
- package/plugins/copyPaste/contextMenuItem/cut.mjs +6 -9
- package/plugins/copyPaste/copyPaste.js +53 -185
- package/plugins/copyPaste/copyPaste.mjs +53 -144
- package/plugins/copyPaste/focusableElement.js +12 -56
- package/plugins/copyPaste/focusableElement.mjs +15 -49
- package/plugins/copyPaste/index.js +0 -2
- package/plugins/copyPaste/pasteEvent.js +1 -10
- package/plugins/copyPaste/pasteEvent.mjs +3 -10
- package/plugins/customBorders/contextMenuItem/bottom.js +0 -17
- package/plugins/customBorders/contextMenuItem/bottom.mjs +4 -8
- package/plugins/customBorders/contextMenuItem/index.js +0 -11
- package/plugins/customBorders/contextMenuItem/left.js +0 -17
- package/plugins/customBorders/contextMenuItem/left.mjs +4 -8
- package/plugins/customBorders/contextMenuItem/noBorders.js +0 -15
- package/plugins/customBorders/contextMenuItem/noBorders.mjs +4 -6
- package/plugins/customBorders/contextMenuItem/right.js +0 -17
- package/plugins/customBorders/contextMenuItem/right.mjs +4 -8
- package/plugins/customBorders/contextMenuItem/top.js +0 -17
- package/plugins/customBorders/contextMenuItem/top.mjs +4 -8
- package/plugins/customBorders/customBorders.js +52 -181
- package/plugins/customBorders/customBorders.mjs +52 -147
- package/plugins/customBorders/index.js +0 -2
- package/plugins/customBorders/utils.js +13 -52
- package/plugins/customBorders/utils.mjs +20 -39
- package/plugins/dragToScroll/dragToScroll.js +17 -74
- package/plugins/dragToScroll/dragToScroll.mjs +17 -55
- package/plugins/dragToScroll/index.js +0 -2
- package/plugins/dropdownMenu/dropdownMenu.js +47 -126
- package/plugins/dropdownMenu/dropdownMenu.mjs +47 -95
- package/plugins/dropdownMenu/index.js +0 -2
- package/plugins/exportFile/dataProvider.js +24 -69
- package/plugins/exportFile/dataProvider.mjs +26 -60
- package/plugins/exportFile/exportFile.js +48 -58
- package/plugins/exportFile/exportFile.mjs +48 -36
- package/plugins/exportFile/index.js +0 -2
- package/plugins/exportFile/typeFactory.js +1 -11
- package/plugins/exportFile/typeFactory.mjs +1 -4
- package/plugins/exportFile/types/_base.js +2 -16
- package/plugins/exportFile/types/_base.mjs +4 -16
- package/plugins/exportFile/types/csv.js +2 -50
- package/plugins/exportFile/types/csv.mjs +2 -29
- package/plugins/filters/component/_base.js +12 -32
- package/plugins/filters/component/_base.mjs +15 -30
- package/plugins/filters/component/actionBar.js +6 -55
- package/plugins/filters/component/actionBar.mjs +9 -38
- package/plugins/filters/component/condition.js +25 -122
- package/plugins/filters/component/condition.mjs +24 -88
- package/plugins/filters/component/operators.js +10 -68
- package/plugins/filters/component/operators.mjs +10 -45
- package/plugins/filters/component/value.js +25 -99
- package/plugins/filters/component/value.mjs +28 -72
- package/plugins/filters/condition/beginsWith.js +2 -32
- package/plugins/filters/condition/beginsWith.mjs +2 -10
- package/plugins/filters/condition/between.js +3 -37
- package/plugins/filters/condition/between.mjs +3 -15
- package/plugins/filters/condition/byValue.js +3 -27
- package/plugins/filters/condition/byValue.mjs +3 -12
- package/plugins/filters/condition/contains.js +2 -32
- package/plugins/filters/condition/contains.mjs +2 -10
- package/plugins/filters/condition/date/after.js +2 -34
- package/plugins/filters/condition/date/after.mjs +2 -12
- package/plugins/filters/condition/date/before.js +2 -34
- package/plugins/filters/condition/date/before.mjs +2 -12
- package/plugins/filters/condition/date/today.js +1 -22
- package/plugins/filters/condition/date/today.mjs +1 -3
- package/plugins/filters/condition/date/tomorrow.js +1 -22
- package/plugins/filters/condition/date/tomorrow.mjs +1 -3
- package/plugins/filters/condition/date/yesterday.js +1 -22
- package/plugins/filters/condition/date/yesterday.mjs +1 -3
- package/plugins/filters/condition/empty.js +1 -19
- package/plugins/filters/condition/empty.mjs +1 -1
- package/plugins/filters/condition/endsWith.js +2 -32
- package/plugins/filters/condition/endsWith.mjs +2 -10
- package/plugins/filters/condition/equal.js +2 -31
- package/plugins/filters/condition/equal.mjs +2 -10
- package/plugins/filters/condition/false.js +1 -5
- package/plugins/filters/condition/false.mjs +1 -1
- package/plugins/filters/condition/greaterThan.js +2 -32
- package/plugins/filters/condition/greaterThan.mjs +2 -12
- package/plugins/filters/condition/greaterThanOrEqual.js +2 -32
- package/plugins/filters/condition/greaterThanOrEqual.mjs +2 -12
- package/plugins/filters/condition/lessThan.js +2 -32
- package/plugins/filters/condition/lessThan.mjs +2 -12
- package/plugins/filters/condition/lessThanOrEqual.js +2 -32
- package/plugins/filters/condition/lessThanOrEqual.mjs +2 -12
- package/plugins/filters/condition/none.js +1 -18
- package/plugins/filters/condition/none.mjs +1 -1
- package/plugins/filters/condition/notBetween.js +1 -19
- package/plugins/filters/condition/notBetween.mjs +1 -1
- package/plugins/filters/condition/notContains.js +1 -19
- package/plugins/filters/condition/notContains.mjs +1 -1
- package/plugins/filters/condition/notEmpty.js +1 -19
- package/plugins/filters/condition/notEmpty.mjs +1 -1
- package/plugins/filters/condition/notEqual.js +1 -19
- package/plugins/filters/condition/notEqual.mjs +1 -1
- package/plugins/filters/condition/true.js +1 -5
- package/plugins/filters/condition/true.mjs +1 -1
- package/plugins/filters/conditionCollection.js +21 -80
- package/plugins/filters/conditionCollection.mjs +21 -57
- package/plugins/filters/conditionRegisterer.js +5 -14
- package/plugins/filters/conditionRegisterer.mjs +5 -9
- package/plugins/filters/conditionUpdateObserver.js +17 -57
- package/plugins/filters/conditionUpdateObserver.mjs +25 -53
- package/plugins/filters/constants.js +1 -66
- package/plugins/filters/constants.mjs +1 -8
- package/plugins/filters/dataFilter.js +4 -21
- package/plugins/filters/dataFilter.mjs +7 -23
- package/plugins/filters/filters.d.ts +1 -1
- package/plugins/filters/filters.js +147 -272
- package/plugins/filters/filters.mjs +148 -228
- package/plugins/filters/index.js +0 -2
- package/plugins/filters/logicalOperationRegisterer.js +3 -9
- package/plugins/filters/logicalOperationRegisterer.mjs +3 -4
- package/plugins/filters/logicalOperations/conjunction.js +2 -19
- package/plugins/filters/logicalOperations/conjunction.mjs +2 -2
- package/plugins/filters/logicalOperations/disjunction.js +2 -19
- package/plugins/filters/logicalOperations/disjunction.mjs +2 -2
- package/plugins/filters/logicalOperations/disjunctionWithExtraCondition.js +2 -21
- package/plugins/filters/logicalOperations/disjunctionWithExtraCondition.mjs +2 -3
- package/plugins/filters/ui/_base.js +12 -55
- package/plugins/filters/ui/_base.mjs +12 -35
- package/plugins/filters/ui/input.js +7 -52
- package/plugins/filters/ui/input.mjs +7 -34
- package/plugins/filters/ui/link.js +3 -43
- package/plugins/filters/ui/link.mjs +3 -25
- package/plugins/filters/ui/multipleSelect.js +26 -120
- package/plugins/filters/ui/multipleSelect.mjs +20 -76
- package/plugins/filters/ui/radioInput.js +6 -47
- package/plugins/filters/ui/radioInput.mjs +6 -30
- package/plugins/filters/ui/select.js +14 -76
- package/plugins/filters/ui/select.mjs +14 -52
- package/plugins/filters/utils.js +6 -39
- package/plugins/filters/utils.mjs +6 -23
- package/plugins/formulas/engine/register.js +24 -74
- package/plugins/formulas/engine/register.mjs +29 -51
- package/plugins/formulas/engine/settings.js +4 -24
- package/plugins/formulas/engine/settings.mjs +4 -12
- package/plugins/formulas/formulas.js +103 -295
- package/plugins/formulas/formulas.mjs +104 -248
- package/plugins/formulas/index.js +0 -2
- package/plugins/formulas/utils.js +1 -3
- package/plugins/formulas/utils.mjs +1 -1
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +4 -38
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs +8 -25
- package/plugins/hiddenColumns/contextMenuItem/showColumn.js +17 -45
- package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +21 -29
- package/plugins/hiddenColumns/hiddenColumns.js +72 -153
- package/plugins/hiddenColumns/hiddenColumns.mjs +72 -110
- package/plugins/hiddenColumns/index.js +0 -2
- package/plugins/hiddenRows/contextMenuItem/hideRow.js +4 -38
- package/plugins/hiddenRows/contextMenuItem/hideRow.mjs +8 -25
- package/plugins/hiddenRows/contextMenuItem/showRow.js +17 -45
- package/plugins/hiddenRows/contextMenuItem/showRow.mjs +21 -29
- package/plugins/hiddenRows/hiddenRows.js +70 -152
- package/plugins/hiddenRows/hiddenRows.mjs +70 -109
- package/plugins/hiddenRows/index.js +0 -2
- package/plugins/index.js +0 -71
- package/plugins/index.mjs +3 -5
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -28
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +5 -17
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -28
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +5 -17
- package/plugins/manualColumnFreeze/index.js +0 -2
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +21 -78
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +21 -54
- package/plugins/manualColumnMove/index.js +0 -2
- package/plugins/manualColumnMove/manualColumnMove.js +45 -134
- package/plugins/manualColumnMove/manualColumnMove.mjs +45 -106
- package/plugins/manualColumnMove/ui/_base.js +12 -30
- package/plugins/manualColumnMove/ui/_base.mjs +12 -27
- package/plugins/manualColumnMove/ui/backlight.js +1 -37
- package/plugins/manualColumnMove/ui/backlight.mjs +1 -22
- package/plugins/manualColumnMove/ui/guideline.js +1 -37
- package/plugins/manualColumnMove/ui/guideline.mjs +1 -22
- package/plugins/manualColumnResize/index.js +0 -2
- package/plugins/manualColumnResize/manualColumnResize.js +44 -143
- package/plugins/manualColumnResize/manualColumnResize.mjs +43 -118
- package/plugins/manualRowMove/index.js +0 -2
- package/plugins/manualRowMove/manualRowMove.js +45 -137
- package/plugins/manualRowMove/manualRowMove.mjs +45 -109
- package/plugins/manualRowMove/ui/_base.js +12 -27
- package/plugins/manualRowMove/ui/_base.mjs +12 -26
- package/plugins/manualRowMove/ui/backlight.js +1 -37
- package/plugins/manualRowMove/ui/backlight.mjs +1 -22
- package/plugins/manualRowMove/ui/guideline.js +1 -37
- package/plugins/manualRowMove/ui/guideline.mjs +1 -22
- package/plugins/manualRowResize/index.js +0 -2
- package/plugins/manualRowResize/manualRowResize.js +42 -138
- package/plugins/manualRowResize/manualRowResize.mjs +41 -112
- package/plugins/mergeCells/calculations/autofill.js +39 -130
- package/plugins/mergeCells/calculations/autofill.mjs +44 -122
- package/plugins/mergeCells/calculations/selection.js +9 -40
- package/plugins/mergeCells/calculations/selection.mjs +9 -37
- package/plugins/mergeCells/cellCoords.js +30 -51
- package/plugins/mergeCells/cellCoords.mjs +35 -54
- package/plugins/mergeCells/cellsCollection.js +13 -84
- package/plugins/mergeCells/cellsCollection.mjs +18 -69
- package/plugins/mergeCells/contextMenuItem/toggleMerge.js +0 -22
- package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +4 -11
- package/plugins/mergeCells/index.js +0 -2
- package/plugins/mergeCells/mergeCells.js +130 -333
- package/plugins/mergeCells/mergeCells.mjs +130 -292
- package/plugins/mergeCells/utils.js +0 -3
- package/plugins/mergeCells/utils.mjs +0 -1
- package/plugins/multiColumnSorting/domHelpers.js +3 -15
- package/plugins/multiColumnSorting/domHelpers.mjs +3 -7
- package/plugins/multiColumnSorting/index.js +0 -2
- package/plugins/multiColumnSorting/multiColumnSorting.js +14 -66
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +14 -44
- package/plugins/multiColumnSorting/rootComparator.js +2 -26
- package/plugins/multiColumnSorting/rootComparator.mjs +9 -23
- package/plugins/multiColumnSorting/utils.js +0 -7
- package/plugins/multiColumnSorting/utils.mjs +3 -8
- package/plugins/multipleSelectionHandles/index.js +0 -2
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +6 -109
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +6 -87
- package/plugins/nestedHeaders/index.js +0 -2
- package/plugins/nestedHeaders/nestedHeaders.js +79 -200
- package/plugins/nestedHeaders/nestedHeaders.mjs +80 -173
- package/plugins/nestedHeaders/stateManager/headersTree.js +16 -93
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +16 -73
- package/plugins/nestedHeaders/stateManager/index.js +24 -107
- package/plugins/nestedHeaders/stateManager/index.mjs +51 -115
- package/plugins/nestedHeaders/stateManager/matrixGenerator.js +7 -25
- package/plugins/nestedHeaders/stateManager/matrixGenerator.mjs +38 -51
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.js +12 -27
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs +29 -35
- package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.js +10 -25
- package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.mjs +26 -32
- package/plugins/nestedHeaders/stateManager/nodeModifiers/hideColumn.js +3 -19
- package/plugins/nestedHeaders/stateManager/nodeModifiers/hideColumn.mjs +9 -20
- package/plugins/nestedHeaders/stateManager/nodeModifiers/index.js +2 -12
- package/plugins/nestedHeaders/stateManager/nodeModifiers/index.mjs +2 -5
- package/plugins/nestedHeaders/stateManager/nodeModifiers/showColumn.js +3 -22
- package/plugins/nestedHeaders/stateManager/nodeModifiers/showColumn.mjs +9 -21
- package/plugins/nestedHeaders/stateManager/nodeModifiers/utils/tree.js +3 -10
- package/plugins/nestedHeaders/stateManager/nodeModifiers/utils/tree.mjs +3 -7
- package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +5 -36
- package/plugins/nestedHeaders/stateManager/settingsNormalizer.mjs +44 -61
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +16 -78
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +21 -68
- package/plugins/nestedHeaders/stateManager/utils.js +19 -22
- package/plugins/nestedHeaders/stateManager/utils.mjs +19 -20
- package/plugins/nestedHeaders/utils/ghostTable.js +9 -37
- package/plugins/nestedHeaders/utils/ghostTable.mjs +16 -43
- package/plugins/nestedRows/data/dataManager.js +40 -161
- package/plugins/nestedRows/data/dataManager.mjs +44 -148
- package/plugins/nestedRows/index.js +0 -2
- package/plugins/nestedRows/nestedRows.js +41 -119
- package/plugins/nestedRows/nestedRows.mjs +41 -86
- package/plugins/nestedRows/ui/_base.js +1 -9
- package/plugins/nestedRows/ui/_base.mjs +1 -8
- package/plugins/nestedRows/ui/collapsing.js +28 -134
- package/plugins/nestedRows/ui/collapsing.mjs +34 -118
- package/plugins/nestedRows/ui/contextMenu.js +2 -53
- package/plugins/nestedRows/ui/contextMenu.mjs +2 -32
- package/plugins/nestedRows/ui/headers.js +5 -50
- package/plugins/nestedRows/ui/headers.mjs +11 -41
- package/plugins/nestedRows/utils/rowMoveController.js +28 -78
- package/plugins/nestedRows/utils/rowMoveController.mjs +33 -66
- package/plugins/persistentState/index.js +0 -2
- package/plugins/persistentState/persistentState.js +10 -58
- package/plugins/persistentState/persistentState.mjs +10 -37
- package/plugins/persistentState/storage.js +9 -25
- package/plugins/persistentState/storage.mjs +12 -26
- package/plugins/registry.js +7 -51
- package/plugins/registry.mjs +8 -34
- package/plugins/search/index.js +0 -2
- package/plugins/search/search.js +16 -98
- package/plugins/search/search.mjs +16 -68
- package/plugins/touchScroll/index.js +0 -2
- package/plugins/touchScroll/touchScroll.js +15 -76
- package/plugins/touchScroll/touchScroll.mjs +15 -58
- package/plugins/trimRows/index.js +0 -2
- package/plugins/trimRows/trimRows.js +62 -88
- package/plugins/trimRows/trimRows.mjs +62 -65
- package/plugins/undoRedo/index.js +0 -14
- package/plugins/undoRedo/undoRedo.js +48 -218
- package/plugins/undoRedo/undoRedo.mjs +48 -188
- package/registry.js +0 -11
- package/registry.mjs +2 -4
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +5 -14
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +5 -6
- package/renderers/autocompleteRenderer/index.js +0 -2
- package/renderers/baseRenderer/baseRenderer.js +2 -11
- package/renderers/baseRenderer/baseRenderer.mjs +2 -9
- package/renderers/baseRenderer/index.js +0 -2
- package/renderers/checkboxRenderer/checkboxRenderer.js +22 -103
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +22 -81
- package/renderers/checkboxRenderer/index.js +0 -2
- package/renderers/htmlRenderer/htmlRenderer.js +1 -7
- package/renderers/htmlRenderer/htmlRenderer.mjs +1 -1
- package/renderers/htmlRenderer/index.js +0 -2
- package/renderers/index.js +0 -19
- package/renderers/index.mjs +3 -5
- package/renderers/numericRenderer/index.js +0 -2
- package/renderers/numericRenderer/numericRenderer.js +1 -23
- package/renderers/numericRenderer/numericRenderer.mjs +1 -10
- package/renderers/passwordRenderer/index.js +0 -2
- package/renderers/passwordRenderer/passwordRenderer.js +1 -8
- package/renderers/passwordRenderer/passwordRenderer.mjs +1 -1
- package/renderers/registry.js +7 -16
- package/renderers/registry.mjs +7 -14
- package/renderers/textRenderer/index.js +0 -2
- package/renderers/textRenderer/textRenderer.js +2 -14
- package/renderers/textRenderer/textRenderer.mjs +2 -6
- package/renderers/timeRenderer/index.js +0 -2
- package/renderers/timeRenderer/timeRenderer.js +1 -6
- package/renderers/timeRenderer/timeRenderer.mjs +1 -1
- package/selection/highlight/highlight.js +17 -73
- package/selection/highlight/highlight.mjs +31 -64
- package/selection/highlight/types/activeHeader.js +1 -21
- package/selection/highlight/types/activeHeader.mjs +6 -16
- package/selection/highlight/types/area.js +2 -22
- package/selection/highlight/types/area.mjs +10 -20
- package/selection/highlight/types/cell.js +1 -21
- package/selection/highlight/types/cell.mjs +9 -19
- package/selection/highlight/types/customSelection.js +2 -22
- package/selection/highlight/types/customSelection.mjs +11 -21
- package/selection/highlight/types/fill.js +2 -17
- package/selection/highlight/types/fill.mjs +9 -14
- package/selection/highlight/types/header.js +3 -23
- package/selection/highlight/types/header.mjs +13 -23
- package/selection/highlight/types/index.js +3 -24
- package/selection/highlight/types/index.mjs +3 -10
- package/selection/highlight/visualSelection.js +24 -74
- package/selection/highlight/visualSelection.mjs +24 -62
- package/selection/index.js +0 -14
- package/selection/mouseEventHandler.js +19 -30
- package/selection/mouseEventHandler.mjs +32 -36
- package/selection/range.js +11 -31
- package/selection/range.mjs +11 -22
- package/selection/selection.js +62 -157
- package/selection/selection.mjs +65 -132
- package/selection/transformation.js +10 -40
- package/selection/transformation.mjs +18 -45
- package/selection/utils.js +22 -70
- package/selection/utils.mjs +22 -47
- package/shortcuts/context.js +23 -78
- package/shortcuts/context.mjs +23 -55
- package/shortcuts/index.js +0 -2
- package/shortcuts/keyObserver.js +4 -17
- package/shortcuts/keyObserver.mjs +4 -12
- package/shortcuts/manager.js +16 -36
- package/shortcuts/manager.mjs +16 -33
- package/shortcuts/recorder.js +20 -47
- package/shortcuts/recorder.mjs +20 -39
- package/shortcuts/utils.js +5 -24
- package/shortcuts/utils.mjs +5 -8
- package/tableView.js +100 -270
- package/tableView.mjs +100 -248
- package/translations/changesObservable/observable.js +5 -54
- package/translations/changesObservable/observable.mjs +12 -51
- package/translations/changesObservable/observer.js +4 -32
- package/translations/changesObservable/observer.mjs +9 -29
- package/translations/changesObservable/utils.js +1 -5
- package/translations/changesObservable/utils.mjs +1 -4
- package/translations/index.js +0 -11
- package/translations/indexMapper.js +70 -158
- package/translations/indexMapper.mjs +70 -125
- package/translations/mapCollections/aggregatedCollection.js +9 -51
- package/translations/mapCollections/aggregatedCollection.mjs +12 -41
- package/translations/mapCollections/index.js +0 -7
- package/translations/mapCollections/mapCollection.js +10 -33
- package/translations/mapCollections/mapCollection.mjs +10 -22
- package/translations/maps/hidingMap.js +2 -35
- package/translations/maps/hidingMap.mjs +7 -28
- package/translations/maps/index.js +1 -24
- package/translations/maps/index.mjs +1 -3
- package/translations/maps/indexMap.js +12 -34
- package/translations/maps/indexMap.mjs +16 -32
- package/translations/maps/indexesSequence.js +3 -41
- package/translations/maps/indexesSequence.mjs +9 -32
- package/translations/maps/linkedPhysicalIndexToValueMap.js +9 -78
- package/translations/maps/linkedPhysicalIndexToValueMap.mjs +16 -59
- package/translations/maps/physicalIndexToValueMap.js +2 -39
- package/translations/maps/physicalIndexToValueMap.mjs +8 -31
- package/translations/maps/trimmingMap.js +2 -35
- package/translations/maps/trimmingMap.mjs +7 -28
- package/translations/maps/utils/actionsOnIndexes.js +1 -7
- package/translations/maps/utils/actionsOnIndexes.mjs +9 -12
- package/translations/maps/utils/index.js +0 -13
- package/translations/maps/utils/index.mjs +0 -3
- package/translations/maps/utils/indexesSequence.js +1 -24
- package/translations/maps/utils/indexesSequence.mjs +10 -19
- package/translations/maps/utils/physicallyIndexed.js +1 -27
- package/translations/maps/utils/physicallyIndexed.mjs +11 -21
- package/utils/dataStructures/linkedList.js +15 -56
- package/utils/dataStructures/linkedList.mjs +15 -54
- package/utils/dataStructures/priorityMap.js +8 -46
- package/utils/dataStructures/priorityMap.mjs +8 -29
- package/utils/dataStructures/queue.js +6 -17
- package/utils/dataStructures/queue.mjs +6 -16
- package/utils/dataStructures/stack.js +6 -17
- package/utils/dataStructures/stack.mjs +6 -16
- package/utils/dataStructures/tree.js +11 -75
- package/utils/dataStructures/tree.mjs +11 -54
- package/utils/dataStructures/uniqueMap.js +17 -56
- package/utils/dataStructures/uniqueMap.mjs +17 -42
- package/utils/dataStructures/uniqueSet.js +5 -32
- package/utils/dataStructures/uniqueSet.mjs +5 -19
- package/utils/ghostTable.js +33 -104
- package/utils/ghostTable.mjs +35 -92
- package/utils/interval.js +10 -37
- package/utils/interval.mjs +7 -29
- package/utils/parseTable.js +11 -92
- package/utils/parseTable.mjs +11 -62
- package/utils/rootInstance.js +3 -14
- package/utils/rootInstance.mjs +3 -3
- package/utils/samplesGenerator.js +15 -51
- package/utils/samplesGenerator.mjs +17 -44
- package/utils/staticRegister.js +6 -33
- package/utils/staticRegister.mjs +6 -19
- package/validators/autocompleteValidator/autocompleteValidator.js +2 -10
- package/validators/autocompleteValidator/autocompleteValidator.mjs +2 -8
- package/validators/autocompleteValidator/index.js +0 -2
- package/validators/dateValidator/dateValidator.js +2 -21
- package/validators/dateValidator/dateValidator.mjs +2 -11
- package/validators/dateValidator/index.js +0 -2
- package/validators/index.js +0 -11
- package/validators/index.mjs +3 -5
- package/validators/numericValidator/index.js +0 -2
- package/validators/numericValidator/numericValidator.js +1 -7
- package/validators/numericValidator/numericValidator.mjs +1 -3
- package/validators/registry.js +7 -16
- package/validators/registry.mjs +7 -14
- package/validators/timeValidator/index.js +0 -2
- package/validators/timeValidator/timeValidator.js +6 -18
- package/validators/timeValidator/timeValidator.mjs +8 -13
- package/utils/sortingAlgorithms/mergeSort.js +0 -120
- package/utils/sortingAlgorithms/mergeSort.mjs +0 -110
package/core.mjs
CHANGED
@@ -1,25 +1,26 @@
|
|
1
|
+
import "core-js/modules/es.symbol.js";
|
2
|
+
import "core-js/modules/es.symbol.description.js";
|
3
|
+
import "core-js/modules/es.symbol.iterator.js";
|
4
|
+
import "core-js/modules/es.function.name.js";
|
5
|
+
import "core-js/modules/es.object.freeze.js";
|
6
|
+
var _templateObject, _templateObject2;
|
1
7
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
2
|
-
|
8
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
3
9
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
|
-
|
5
10
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
6
|
-
|
7
11
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
8
|
-
|
9
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
10
|
-
|
11
13
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
12
|
-
|
13
14
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
14
|
-
|
15
15
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
16
|
-
|
17
16
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
18
|
-
|
19
17
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
20
|
-
|
21
18
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
22
|
-
|
19
|
+
import "core-js/modules/es.array.iterator.js";
|
20
|
+
import "core-js/modules/es.object.to-string.js";
|
21
|
+
import "core-js/modules/es.set.js";
|
22
|
+
import "core-js/modules/es.string.iterator.js";
|
23
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
23
24
|
import "core-js/modules/es.array.includes.js";
|
24
25
|
import "core-js/modules/es.array.sort.js";
|
25
26
|
import "core-js/modules/es.array.splice.js";
|
@@ -32,24 +33,18 @@ import "core-js/modules/es.array.map.js";
|
|
32
33
|
import "core-js/modules/es.regexp.exec.js";
|
33
34
|
import "core-js/modules/es.string.replace.js";
|
34
35
|
import "core-js/modules/es.array.from.js";
|
35
|
-
import "core-js/modules/es.string.iterator.js";
|
36
36
|
import "core-js/modules/es.array.index-of.js";
|
37
37
|
import "core-js/modules/es.array.reverse.js";
|
38
|
-
import "core-js/modules/es.object.to-string.js";
|
39
38
|
import "core-js/modules/web.dom-collections.for-each.js";
|
40
39
|
import "core-js/modules/web.timers.js";
|
41
40
|
import "core-js/modules/web.immediate.js";
|
42
|
-
import "core-js/modules/es.array.iterator.js";
|
43
41
|
import "core-js/modules/es.map.js";
|
44
|
-
import "core-js/modules/web.dom-collections.iterator.js";
|
45
|
-
import "core-js/modules/es.symbol.js";
|
46
|
-
import "core-js/modules/es.symbol.description.js";
|
47
|
-
import "core-js/modules/es.symbol.iterator.js";
|
48
|
-
import "core-js/modules/es.function.name.js";
|
49
42
|
import { addClass, empty, removeClass } from "./helpers/dom/element.mjs";
|
50
43
|
import { isFunction } from "./helpers/function.mjs";
|
51
44
|
import { isDefined, isUndefined, isRegExp, _injectProductInfo, isEmpty } from "./helpers/mixed.mjs";
|
52
45
|
import { isMobileBrowser, isIpadOS } from "./helpers/browser.mjs";
|
46
|
+
import { warn } from "./helpers/console.mjs";
|
47
|
+
import { toSingleLine } from "./helpers/templateLiteralTag.mjs";
|
53
48
|
import EditorManager from "./editorManager.mjs";
|
54
49
|
import EventManager from "./eventManager.mjs";
|
55
50
|
import { deepClone, duckSchema, isObjectEqual, isObject, deepObjectSize, hasOwnProperty, createObjectPropListener, objectEach } from "./helpers/object.mjs";
|
@@ -61,7 +56,7 @@ import { getValidator } from "./validators/registry.mjs";
|
|
61
56
|
import { randomString, toUpperCaseFirst } from "./helpers/string.mjs";
|
62
57
|
import { rangeEach, rangeEachReverse, isNumericLike } from "./helpers/number.mjs";
|
63
58
|
import TableView from "./tableView.mjs";
|
64
|
-
import DataSource from "./dataSource.mjs";
|
59
|
+
import DataSource from "./dataMap/dataSource.mjs";
|
65
60
|
import { cellMethodLookupFactory, spreadsheetColumnLabel } from "./helpers/data.mjs";
|
66
61
|
import { IndexMapper } from "./translations/index.mjs";
|
67
62
|
import { registerAsRootInstance, hasValidParameter, isRootInstance } from "./utils/rootInstance.mjs";
|
@@ -75,8 +70,9 @@ import { createUniqueMap } from "./utils/dataStructures/uniqueMap.mjs";
|
|
75
70
|
import { createShortcutManager } from "./shortcuts/index.mjs";
|
76
71
|
var SHORTCUTS_GROUP = 'gridDefault';
|
77
72
|
var activeGuid = null;
|
78
|
-
|
73
|
+
var deprecationWarns = new Set();
|
79
74
|
|
75
|
+
/* eslint-disable jsdoc/require-description-complete-sentence */
|
80
76
|
/**
|
81
77
|
* Handsontable constructor.
|
82
78
|
*
|
@@ -88,23 +84,43 @@ var activeGuid = null;
|
|
88
84
|
*
|
89
85
|
* ## How to call a method
|
90
86
|
*
|
87
|
+
* ::: only-for javascript
|
91
88
|
* ```js
|
92
|
-
* // First, let's
|
89
|
+
* // First, let's construct Handsontable
|
93
90
|
* const hot = new Handsontable(document.getElementById('example'), options);
|
94
91
|
*
|
95
92
|
* // Then, let's use the setDataAtCell method
|
96
93
|
* hot.setDataAtCell(0, 0, 'new value');
|
97
94
|
* ```
|
95
|
+
* :::
|
96
|
+
*
|
97
|
+
* ::: only-for react
|
98
|
+
* ```jsx
|
99
|
+
* const hotRef = useRef(null);
|
100
|
+
*
|
101
|
+
* ...
|
102
|
+
*
|
103
|
+
* // First, let's contruct Handsontable
|
104
|
+
* <HotTable
|
105
|
+
* ref={hotRef}
|
106
|
+
* settings={options}
|
107
|
+
* />
|
108
|
+
*
|
109
|
+
* ...
|
110
|
+
*
|
111
|
+
* const hot = hotRef.current.hotInstance;
|
112
|
+
* // Then, let's use the setDataAtCell method
|
113
|
+
* hot.setDataAtCell(0, 0, 'new value');
|
114
|
+
* ```
|
115
|
+
* :::
|
98
116
|
*
|
99
117
|
* @param {HTMLElement} rootElement The element to which the Handsontable instance is injected.
|
100
118
|
* @param {object} userSettings The user defined options.
|
101
119
|
* @param {boolean} [rootInstanceSymbol=false] Indicates if the instance is root of all later instances created.
|
102
120
|
*/
|
103
|
-
|
104
121
|
export default function Core(rootElement, userSettings) {
|
105
122
|
var _userSettings$layoutD,
|
106
|
-
|
107
|
-
|
123
|
+
_this = this;
|
108
124
|
var rootInstanceSymbol = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
109
125
|
var preventScrollingToCell = false;
|
110
126
|
var instance = this;
|
@@ -114,19 +130,17 @@ export default function Core(rootElement, userSettings) {
|
|
114
130
|
var grid;
|
115
131
|
var editorManager;
|
116
132
|
var firstRun = true;
|
117
|
-
|
118
133
|
if (hasValidParameter(rootInstanceSymbol)) {
|
119
134
|
registerAsRootInstance(this);
|
120
|
-
}
|
135
|
+
}
|
121
136
|
|
137
|
+
// TODO: check if references to DOM elements should be move to UI layer (Walkontable)
|
122
138
|
/**
|
123
139
|
* Reference to the container element.
|
124
140
|
*
|
125
141
|
* @private
|
126
142
|
* @type {HTMLElement}
|
127
143
|
*/
|
128
|
-
|
129
|
-
|
130
144
|
this.rootElement = rootElement;
|
131
145
|
/**
|
132
146
|
* The nearest document over container.
|
@@ -134,7 +148,6 @@ export default function Core(rootElement, userSettings) {
|
|
134
148
|
* @private
|
135
149
|
* @type {Document}
|
136
150
|
*/
|
137
|
-
|
138
151
|
this.rootDocument = rootElement.ownerDocument;
|
139
152
|
/**
|
140
153
|
* Window object over container's document.
|
@@ -142,7 +155,6 @@ export default function Core(rootElement, userSettings) {
|
|
142
155
|
* @private
|
143
156
|
* @type {Window}
|
144
157
|
*/
|
145
|
-
|
146
158
|
this.rootWindow = this.rootDocument.defaultView;
|
147
159
|
/**
|
148
160
|
* A boolean to tell if the Handsontable has been fully destroyed. This is set to `true`
|
@@ -152,7 +164,6 @@ export default function Core(rootElement, userSettings) {
|
|
152
164
|
* @member isDestroyed
|
153
165
|
* @type {boolean}
|
154
166
|
*/
|
155
|
-
|
156
167
|
this.isDestroyed = false;
|
157
168
|
/**
|
158
169
|
* The counter determines how many times the render suspending was called. It allows
|
@@ -163,7 +174,6 @@ export default function Core(rootElement, userSettings) {
|
|
163
174
|
* @private
|
164
175
|
* @type {number}
|
165
176
|
*/
|
166
|
-
|
167
177
|
this.renderSuspendedCounter = 0;
|
168
178
|
/**
|
169
179
|
* The counter determines how many times the execution suspending was called. It allows
|
@@ -174,11 +184,11 @@ export default function Core(rootElement, userSettings) {
|
|
174
184
|
* @private
|
175
185
|
* @type {number}
|
176
186
|
*/
|
177
|
-
|
178
187
|
this.executionSuspendedCounter = 0;
|
179
188
|
var layoutDirection = (_userSettings$layoutD = userSettings === null || userSettings === void 0 ? void 0 : userSettings.layoutDirection) !== null && _userSettings$layoutD !== void 0 ? _userSettings$layoutD : 'inherit';
|
180
189
|
var rootElementDirection = ['rtl', 'ltr'].includes(layoutDirection) ? layoutDirection : this.rootWindow.getComputedStyle(this.rootElement).direction;
|
181
190
|
this.rootElement.setAttribute('dir', rootElementDirection);
|
191
|
+
|
182
192
|
/**
|
183
193
|
* Checks if the grid is rendered using the right-to-left layout direction.
|
184
194
|
*
|
@@ -187,10 +197,10 @@ export default function Core(rootElement, userSettings) {
|
|
187
197
|
* @function isRtl
|
188
198
|
* @returns {boolean} True if RTL.
|
189
199
|
*/
|
190
|
-
|
191
200
|
this.isRtl = function () {
|
192
201
|
return rootElementDirection === 'rtl';
|
193
202
|
};
|
203
|
+
|
194
204
|
/**
|
195
205
|
* Checks if the grid is rendered using the left-to-right layout direction.
|
196
206
|
*
|
@@ -199,11 +209,10 @@ export default function Core(rootElement, userSettings) {
|
|
199
209
|
* @function isLtr
|
200
210
|
* @returns {boolean} True if LTR.
|
201
211
|
*/
|
202
|
-
|
203
|
-
|
204
212
|
this.isLtr = function () {
|
205
213
|
return !instance.isRtl();
|
206
214
|
};
|
215
|
+
|
207
216
|
/**
|
208
217
|
* Returns 1 for LTR; -1 for RTL. Useful for calculations.
|
209
218
|
*
|
@@ -212,12 +221,9 @@ export default function Core(rootElement, userSettings) {
|
|
212
221
|
* @function getDirectionFactor
|
213
222
|
* @returns {number} Returns 1 for LTR; -1 for RTL.
|
214
223
|
*/
|
215
|
-
|
216
|
-
|
217
224
|
this.getDirectionFactor = function () {
|
218
225
|
return instance.isLtr() ? 1 : -1;
|
219
226
|
};
|
220
|
-
|
221
227
|
userSettings.language = getValidLanguageCode(userSettings.language);
|
222
228
|
var metaManager = new MetaManager(instance, userSettings, [DynamicCellMetaMod, ExtendMetaPropertiesMod]);
|
223
229
|
var tableMeta = metaManager.getTableMeta();
|
@@ -226,11 +232,9 @@ export default function Core(rootElement, userSettings) {
|
|
226
232
|
this.container = this.rootDocument.createElement('div');
|
227
233
|
this.renderCall = false;
|
228
234
|
rootElement.insertBefore(this.container, rootElement.firstChild);
|
229
|
-
|
230
235
|
if (isRootInstance(this)) {
|
231
236
|
_injectProductInfo(userSettings.licenseKey, rootElement);
|
232
237
|
}
|
233
|
-
|
234
238
|
this.guid = "ht_".concat(randomString()); // this is the namespace for global events
|
235
239
|
|
236
240
|
/**
|
@@ -240,7 +244,6 @@ export default function Core(rootElement, userSettings) {
|
|
240
244
|
* @member columnIndexMapper
|
241
245
|
* @type {IndexMapper}
|
242
246
|
*/
|
243
|
-
|
244
247
|
this.columnIndexMapper = new IndexMapper();
|
245
248
|
/**
|
246
249
|
* Instance of index mapper which is responsible for managing the row indexes.
|
@@ -249,25 +252,24 @@ export default function Core(rootElement, userSettings) {
|
|
249
252
|
* @member rowIndexMapper
|
250
253
|
* @type {IndexMapper}
|
251
254
|
*/
|
252
|
-
|
253
255
|
this.rowIndexMapper = new IndexMapper();
|
254
256
|
dataSource = new DataSource(instance);
|
255
|
-
|
256
257
|
if (!this.rootElement.id || this.rootElement.id.substring(0, 3) === 'ht_') {
|
257
258
|
this.rootElement.id = this.guid; // if root element does not have an id, assign a random id
|
258
259
|
}
|
259
260
|
|
260
261
|
var visualToRenderableCoords = function visualToRenderableCoords(coords) {
|
261
262
|
var visualRow = coords.row,
|
262
|
-
|
263
|
-
return instance._createCellCoords(
|
263
|
+
visualColumn = coords.col;
|
264
|
+
return instance._createCellCoords(
|
265
|
+
// We just store indexes for rows and columns without headers.
|
264
266
|
visualRow >= 0 ? instance.rowIndexMapper.getRenderableFromVisualIndex(visualRow) : visualRow, visualColumn >= 0 ? instance.columnIndexMapper.getRenderableFromVisualIndex(visualColumn) : visualColumn);
|
265
267
|
};
|
266
|
-
|
267
268
|
var renderableToVisualCoords = function renderableToVisualCoords(coords) {
|
268
269
|
var renderableRow = coords.row,
|
269
|
-
|
270
|
-
return instance._createCellCoords(
|
270
|
+
renderableColumn = coords.col;
|
271
|
+
return instance._createCellCoords(
|
272
|
+
// We just store indexes for rows and columns without headers.
|
271
273
|
renderableRow >= 0 ? instance.rowIndexMapper.getVisualFromRenderableIndex(renderableRow) : renderableRow, renderableColumn >= 0 ? instance.columnIndexMapper.getVisualFromRenderableIndex(renderableColumn) : renderableColumn // eslint-disable-line max-len
|
272
274
|
);
|
273
275
|
};
|
@@ -313,15 +315,12 @@ export default function Core(rootElement, userSettings) {
|
|
313
315
|
}
|
314
316
|
});
|
315
317
|
this.selection = selection;
|
316
|
-
|
317
318
|
var onIndexMapperCacheUpdate = function onIndexMapperCacheUpdate(_ref) {
|
318
319
|
var hiddenIndexesChanged = _ref.hiddenIndexesChanged;
|
319
|
-
|
320
320
|
if (hiddenIndexesChanged) {
|
321
321
|
_this.selection.refresh();
|
322
322
|
}
|
323
323
|
};
|
324
|
-
|
325
324
|
this.columnIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
|
326
325
|
this.rowIndexMapper.addLocalHook('cacheUpdated', onIndexMapperCacheUpdate);
|
327
326
|
this.selection.addLocalHook('beforeSetRangeStart', function (cellCoords) {
|
@@ -332,49 +331,34 @@ export default function Core(rootElement, userSettings) {
|
|
332
331
|
});
|
333
332
|
this.selection.addLocalHook('beforeSetRangeEnd', function (cellCoords) {
|
334
333
|
_this.runHooks('beforeSetRangeEnd', cellCoords);
|
335
|
-
|
336
334
|
if (cellCoords.row < 0) {
|
337
335
|
cellCoords.row = _this.view._wt.wtTable.getFirstVisibleRow();
|
338
336
|
}
|
339
|
-
|
340
337
|
if (cellCoords.col < 0) {
|
341
338
|
cellCoords.col = _this.view._wt.wtTable.getFirstVisibleColumn();
|
342
339
|
}
|
343
340
|
});
|
344
341
|
this.selection.addLocalHook('afterSetRangeEnd', function (cellCoords) {
|
345
342
|
var preventScrolling = createObjectPropListener(false);
|
346
|
-
|
347
343
|
var selectionRange = _this.selection.getSelectedRange();
|
348
|
-
|
349
344
|
var _selectionRange$curre = selectionRange.current(),
|
350
|
-
|
351
|
-
|
352
|
-
|
345
|
+
from = _selectionRange$curre.from,
|
346
|
+
to = _selectionRange$curre.to;
|
353
347
|
var selectionLayerLevel = selectionRange.size() - 1;
|
354
|
-
|
355
348
|
_this.runHooks('afterSelection', from.row, from.col, to.row, to.col, preventScrolling, selectionLayerLevel);
|
356
|
-
|
357
349
|
_this.runHooks('afterSelectionByProp', from.row, instance.colToProp(from.col), to.row, instance.colToProp(to.col), preventScrolling, selectionLayerLevel); // eslint-disable-line max-len
|
358
350
|
|
359
|
-
|
360
351
|
var isSelectedByAnyHeader = _this.selection.isSelectedByAnyHeader();
|
361
|
-
|
362
352
|
var currentSelectedRange = _this.selection.selectedRange.current();
|
363
|
-
|
364
353
|
var scrollToCell = true;
|
365
|
-
|
366
354
|
if (preventScrollingToCell) {
|
367
355
|
scrollToCell = false;
|
368
356
|
}
|
369
|
-
|
370
357
|
if (preventScrolling.isTouched()) {
|
371
358
|
scrollToCell = !preventScrolling.value;
|
372
359
|
}
|
373
|
-
|
374
360
|
var isSelectedByRowHeader = _this.selection.isSelectedByRowHeader();
|
375
|
-
|
376
361
|
var isSelectedByColumnHeader = _this.selection.isSelectedByColumnHeader();
|
377
|
-
|
378
362
|
if (scrollToCell !== false) {
|
379
363
|
if (!isSelectedByAnyHeader) {
|
380
364
|
if (currentSelectedRange && !_this.selection.isMultiple()) {
|
@@ -387,11 +371,11 @@ export default function Core(rootElement, userSettings) {
|
|
387
371
|
} else if (isSelectedByColumnHeader) {
|
388
372
|
_this.view.scrollViewportHorizontally(instance.columnIndexMapper.getRenderableFromVisualIndex(cellCoords.col));
|
389
373
|
}
|
390
|
-
}
|
374
|
+
}
|
375
|
+
|
376
|
+
// @TODO: These CSS classes are no longer needed anymore. They are used only as a indicator of the selected
|
391
377
|
// rows/columns in the MergedCells plugin (via border.js#L520 in the walkontable module). After fixing
|
392
378
|
// the Border class this should be removed.
|
393
|
-
|
394
|
-
|
395
379
|
if (isSelectedByRowHeader && isSelectedByColumnHeader) {
|
396
380
|
addClass(_this.rootElement, ['ht__selection--rows', 'ht__selection--columns']);
|
397
381
|
} else if (isSelectedByRowHeader) {
|
@@ -403,22 +387,18 @@ export default function Core(rootElement, userSettings) {
|
|
403
387
|
} else {
|
404
388
|
removeClass(_this.rootElement, ['ht__selection--rows', 'ht__selection--columns']);
|
405
389
|
}
|
406
|
-
|
407
390
|
_this._refreshBorders(null);
|
408
391
|
});
|
409
392
|
this.selection.addLocalHook('afterSelectionFinished', function (cellRanges) {
|
410
393
|
var selectionLayerLevel = cellRanges.length - 1;
|
411
394
|
var _cellRanges$selection = cellRanges[selectionLayerLevel],
|
412
|
-
|
413
|
-
|
414
|
-
|
395
|
+
from = _cellRanges$selection.from,
|
396
|
+
to = _cellRanges$selection.to;
|
415
397
|
_this.runHooks('afterSelectionEnd', from.row, from.col, to.row, to.col, selectionLayerLevel);
|
416
|
-
|
417
398
|
_this.runHooks('afterSelectionEndByProp', from.row, instance.colToProp(from.col), to.row, instance.colToProp(to.col), selectionLayerLevel);
|
418
399
|
});
|
419
400
|
this.selection.addLocalHook('afterIsMultipleSelection', function (isMultiple) {
|
420
401
|
var changedIsMultiple = _this.runHooks('afterIsMultipleSelection', isMultiple.value);
|
421
|
-
|
422
402
|
if (isMultiple.value) {
|
423
403
|
isMultiple.value = changedIsMultiple;
|
424
404
|
}
|
@@ -437,421 +417,417 @@ export default function Core(rootElement, userSettings) {
|
|
437
417
|
});
|
438
418
|
this.selection.addLocalHook('afterDeselect', function () {
|
439
419
|
editorManager.destroyEditor();
|
440
|
-
|
441
420
|
_this._refreshBorders();
|
442
|
-
|
443
421
|
removeClass(_this.rootElement, ['ht__selection--rows', 'ht__selection--columns']);
|
444
|
-
|
445
422
|
_this.runHooks('afterDeselect');
|
446
423
|
});
|
447
424
|
this.selection.addLocalHook('insertRowRequire', function (totalRows) {
|
448
|
-
_this.alter('
|
425
|
+
_this.alter('insert_row_above', totalRows, 1, 'auto');
|
449
426
|
});
|
450
427
|
this.selection.addLocalHook('insertColRequire', function (totalCols) {
|
451
|
-
_this.alter('
|
428
|
+
_this.alter('insert_col_start', totalCols, 1, 'auto');
|
452
429
|
});
|
453
430
|
grid = {
|
454
431
|
/**
|
455
432
|
* Inserts or removes rows and columns.
|
456
433
|
*
|
457
434
|
* @private
|
458
|
-
* @param {string} action Possible values: "
|
435
|
+
* @param {string} action Possible values: "insert_row_above", "insert_row_below", "insert_col_start", "insert_col_end",
|
436
|
+
* "remove_row", "remove_col".
|
459
437
|
* @param {number|Array} index Row or column visual index which from the alter action will be triggered.
|
460
438
|
* Alter actions such as "remove_row" and "remove_col" support array indexes in the
|
461
439
|
* format `[[index, amount], [index, amount]...]` this can be used to remove
|
462
440
|
* non-consecutive columns or rows in one call.
|
463
|
-
* @param {number} [amount=1]
|
441
|
+
* @param {number} [amount=1] Amount of rows or columns to remove.
|
464
442
|
* @param {string} [source] Optional. Source of hook runner.
|
465
443
|
* @param {boolean} [keepEmptyRows] Optional. Flag for preventing deletion of empty rows.
|
466
|
-
*/
|
467
|
-
|
444
|
+
*/alter: function alter(action, index) {
|
445
|
+
var _index, _index2;
|
468
446
|
var amount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
469
447
|
var source = arguments.length > 3 ? arguments[3] : undefined;
|
470
448
|
var keepEmptyRows = arguments.length > 4 ? arguments[4] : undefined;
|
471
|
-
var delta;
|
472
|
-
|
473
449
|
var normalizeIndexesGroup = function normalizeIndexesGroup(indexes) {
|
474
450
|
if (indexes.length === 0) {
|
475
451
|
return [];
|
476
452
|
}
|
453
|
+
var sortedIndexes = _toConsumableArray(indexes);
|
477
454
|
|
478
|
-
|
479
|
-
|
480
|
-
|
455
|
+
// Sort the indexes in ascending order.
|
481
456
|
sortedIndexes.sort(function (_ref2, _ref3) {
|
482
457
|
var _ref4 = _slicedToArray(_ref2, 1),
|
483
|
-
|
484
|
-
|
458
|
+
indexA = _ref4[0];
|
485
459
|
var _ref5 = _slicedToArray(_ref3, 1),
|
486
|
-
|
487
|
-
|
460
|
+
indexB = _ref5[0];
|
488
461
|
if (indexA === indexB) {
|
489
462
|
return 0;
|
490
463
|
}
|
491
|
-
|
492
464
|
return indexA > indexB ? 1 : -1;
|
493
|
-
});
|
465
|
+
});
|
494
466
|
|
467
|
+
// Normalize the {index, amount} groups into bigger groups.
|
495
468
|
var normalizedIndexes = arrayReduce(sortedIndexes, function (acc, _ref6) {
|
496
469
|
var _ref7 = _slicedToArray(_ref6, 2),
|
497
|
-
|
498
|
-
|
499
|
-
|
470
|
+
groupIndex = _ref7[0],
|
471
|
+
groupAmount = _ref7[1];
|
500
472
|
var previousItem = acc[acc.length - 1];
|
501
|
-
|
502
473
|
var _previousItem = _slicedToArray(previousItem, 2),
|
503
|
-
|
504
|
-
|
505
|
-
|
474
|
+
prevIndex = _previousItem[0],
|
475
|
+
prevAmount = _previousItem[1];
|
506
476
|
var prevLastIndex = prevIndex + prevAmount;
|
507
|
-
|
508
477
|
if (groupIndex <= prevLastIndex) {
|
509
478
|
var amountToAdd = Math.max(groupAmount - (prevLastIndex - groupIndex), 0);
|
510
479
|
previousItem[1] += amountToAdd;
|
511
480
|
} else {
|
512
481
|
acc.push([groupIndex, groupAmount]);
|
513
482
|
}
|
514
|
-
|
515
483
|
return acc;
|
516
484
|
}, [sortedIndexes[0]]);
|
517
485
|
return normalizedIndexes;
|
518
486
|
};
|
519
|
-
/* eslint-disable no-case-declarations */
|
520
|
-
|
521
487
|
|
488
|
+
/* eslint-disable no-case-declarations */
|
522
489
|
switch (action) {
|
523
490
|
case 'insert_row':
|
491
|
+
// backward compatibility
|
492
|
+
if (!deprecationWarns.has(action)) {
|
493
|
+
deprecationWarns.add(action);
|
494
|
+
warn(toSingleLine(_templateObject || (_templateObject = _taggedTemplateLiteral(["The `", "` action of the `alter()` method is deprecated and will be removed \n in the next major release of Handsontable. Use the `insert_row_above` action instead."], ["The \\`", "\\` action of the \\`alter()\\` method is deprecated and will be removed\\x20\n in the next major release of Handsontable. Use the \\`insert_row_above\\` action instead."])), action));
|
495
|
+
}
|
496
|
+
// falls through
|
497
|
+
case 'insert_row_below':
|
498
|
+
case 'insert_row_above':
|
524
499
|
var numberOfSourceRows = instance.countSourceRows();
|
525
|
-
|
526
500
|
if (tableMeta.maxRows === numberOfSourceRows) {
|
527
501
|
return;
|
528
|
-
}
|
529
|
-
|
530
|
-
|
531
|
-
index = isDefined(index) ? index : numberOfSourceRows;
|
532
|
-
delta = datamap.createRow(index, amount, source);
|
502
|
+
}
|
533
503
|
|
534
|
-
|
535
|
-
|
504
|
+
// `above` is the default behavior for creating new rows
|
505
|
+
var insertRowMode = action === 'insert_row_below' ? 'below' : 'above';
|
506
|
+
|
507
|
+
// The line below ensures backward compatibility of the `alter()` method's `insert_row` action.
|
508
|
+
// Calling the `insert_row` action with no arguments adds a new row at the end of the data set.
|
509
|
+
// Calling the `insert_row_above` action adds a new row at the beginning of the data set.
|
510
|
+
// eslint-disable-next-line no-param-reassign
|
511
|
+
index = (_index = index) !== null && _index !== void 0 ? _index : action === 'insert_row' || insertRowMode === 'below' ? numberOfSourceRows : 0;
|
512
|
+
var _datamap$createRow = datamap.createRow(index, amount, {
|
513
|
+
source: source,
|
514
|
+
mode: insertRowMode
|
515
|
+
}),
|
516
|
+
rowDelta = _datamap$createRow.delta,
|
517
|
+
startRowPhysicalIndex = _datamap$createRow.startPhysicalIndex;
|
518
|
+
if (rowDelta) {
|
519
|
+
metaManager.createRow(startRowPhysicalIndex, amount);
|
536
520
|
var currentSelectedRange = selection.selectedRange.current();
|
537
521
|
var currentFromRange = currentSelectedRange === null || currentSelectedRange === void 0 ? void 0 : currentSelectedRange.from;
|
538
|
-
var currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
|
539
|
-
|
540
|
-
|
541
|
-
|
522
|
+
var currentFromRow = currentFromRange === null || currentFromRange === void 0 ? void 0 : currentFromRange.row;
|
523
|
+
var startVisualRowIndex = instance.toVisualRow(startRowPhysicalIndex);
|
524
|
+
if (selection.isSelectedByCorner()) {
|
525
|
+
instance.selectAll();
|
526
|
+
} else if (isDefined(currentFromRow) && currentFromRow >= startVisualRowIndex) {
|
527
|
+
// Moving the selection (if it exists) downward – it should be applied to the "old" row.
|
528
|
+
// TODO: The logic here should be handled by selection module.
|
542
529
|
var _currentSelectedRange = currentSelectedRange.to,
|
543
|
-
|
544
|
-
|
545
|
-
var currentFromColumn = currentFromRange.col;
|
530
|
+
currentToRow = _currentSelectedRange.row,
|
531
|
+
currentToColumn = _currentSelectedRange.col;
|
532
|
+
var currentFromColumn = currentFromRange.col;
|
546
533
|
|
534
|
+
// Workaround: headers are not stored inside selection.
|
547
535
|
if (selection.isSelectedByRowHeader()) {
|
548
536
|
currentFromColumn = -1;
|
549
|
-
}
|
550
|
-
// replaced by new transformed selection.
|
551
|
-
|
552
|
-
|
553
|
-
selection.getSelectedRange().pop(); // I can't use transforms as they don't work in negative indexes.
|
537
|
+
}
|
554
538
|
|
555
|
-
selection
|
556
|
-
|
539
|
+
// Remove from the stack the last added selection as that selection below will be
|
540
|
+
// replaced by new transformed selection.
|
541
|
+
selection.getSelectedRange().pop();
|
542
|
+
// I can't use transforms as they don't work in negative indexes.
|
543
|
+
selection.setRangeStartOnly(instance._createCellCoords(currentFromRow + rowDelta, currentFromColumn), true);
|
544
|
+
selection.setRangeEnd(instance._createCellCoords(currentToRow + rowDelta, currentToColumn)); // will call render() internally
|
557
545
|
} else {
|
558
546
|
instance._refreshBorders(); // it will call render and prepare methods
|
559
|
-
|
560
547
|
}
|
561
548
|
}
|
562
549
|
|
563
550
|
break;
|
564
|
-
|
565
551
|
case 'insert_col':
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
552
|
+
// backward compatibility
|
553
|
+
if (!deprecationWarns.has(action)) {
|
554
|
+
deprecationWarns.add(action);
|
555
|
+
warn(toSingleLine(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["The `", "` action of the `alter()` method is deprecated and will be removed \n in the next major release of Handsontable. Use the `insert_col_start` action instead."], ["The \\`", "\\` action of the \\`alter()\\` method is deprecated and will be removed\\x20\n in the next major release of Handsontable. Use the \\`insert_col_start\\` action instead."])), action));
|
556
|
+
}
|
557
|
+
// falls through
|
558
|
+
case 'insert_col_start':
|
559
|
+
case 'insert_col_end':
|
560
|
+
// "start" is a default behavior for creating new columns
|
561
|
+
var insertColumnMode = action === 'insert_col_end' ? 'end' : 'start';
|
562
|
+
|
563
|
+
// The line below ensures backward compatibility of the `alter()` method's `insert_col` action.
|
564
|
+
// Calling the `insert_col` action with no arguments adds a new column to the right of the data set.
|
565
|
+
// Calling the `insert_col_start` action adds a new column to the left of the data set.
|
566
|
+
// eslint-disable-next-line no-param-reassign
|
567
|
+
index = (_index2 = index) !== null && _index2 !== void 0 ? _index2 : action === 'insert_col' || insertColumnMode === 'end' ? instance.countSourceCols() : 0;
|
568
|
+
var _datamap$createCol = datamap.createCol(index, amount, {
|
569
|
+
source: source,
|
570
|
+
mode: insertColumnMode
|
571
|
+
}),
|
572
|
+
colDelta = _datamap$createCol.delta,
|
573
|
+
startColumnPhysicalIndex = _datamap$createCol.startPhysicalIndex;
|
574
|
+
if (colDelta) {
|
575
|
+
metaManager.createColumn(startColumnPhysicalIndex, amount);
|
571
576
|
if (Array.isArray(tableMeta.colHeaders)) {
|
572
|
-
var spliceArray = [
|
573
|
-
spliceArray.length +=
|
574
|
-
|
577
|
+
var spliceArray = [instance.toVisualColumn(startColumnPhysicalIndex), 0];
|
578
|
+
spliceArray.length += colDelta; // inserts empty (undefined) elements at the end of an array
|
575
579
|
Array.prototype.splice.apply(tableMeta.colHeaders, spliceArray); // inserts empty (undefined) elements into the colHeader array
|
576
580
|
}
|
577
581
|
|
578
582
|
var _currentSelectedRange2 = selection.selectedRange.current();
|
579
|
-
|
580
583
|
var _currentFromRange = _currentSelectedRange2 === null || _currentSelectedRange2 === void 0 ? void 0 : _currentSelectedRange2.from;
|
581
|
-
|
582
|
-
var
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
584
|
+
var _currentFromColumn = _currentFromRange === null || _currentFromRange === void 0 ? void 0 : _currentFromRange.col;
|
585
|
+
var startVisualColumnIndex = instance.toVisualColumn(startColumnPhysicalIndex);
|
586
|
+
if (selection.isSelectedByCorner()) {
|
587
|
+
instance.selectAll();
|
588
|
+
} else if (isDefined(_currentFromColumn) && _currentFromColumn >= startVisualColumnIndex) {
|
589
|
+
// Moving the selection (if it exists) rightward – it should be applied to the "old" column.
|
590
|
+
// TODO: The logic here should be handled by selection module.
|
587
591
|
var _currentSelectedRange3 = _currentSelectedRange2.to,
|
588
|
-
|
589
|
-
|
590
|
-
var _currentFromRow = _currentFromRange.row;
|
592
|
+
_currentToRow = _currentSelectedRange3.row,
|
593
|
+
_currentToColumn = _currentSelectedRange3.col;
|
594
|
+
var _currentFromRow = _currentFromRange.row;
|
591
595
|
|
596
|
+
// Workaround: headers are not stored inside selection.
|
592
597
|
if (selection.isSelectedByColumnHeader()) {
|
593
598
|
_currentFromRow = -1;
|
594
|
-
}
|
595
|
-
// replaced by new transformed selection.
|
596
|
-
|
599
|
+
}
|
597
600
|
|
598
|
-
|
601
|
+
// Remove from the stack the last added selection as that selection below will be
|
602
|
+
// replaced by new transformed selection.
|
603
|
+
selection.getSelectedRange().pop();
|
599
604
|
|
600
|
-
|
601
|
-
selection.
|
605
|
+
// I can't use transforms as they don't work in negative indexes.
|
606
|
+
selection.setRangeStartOnly(instance._createCellCoords(_currentFromRow, _currentFromColumn + colDelta), true);
|
607
|
+
selection.setRangeEnd(instance._createCellCoords(_currentToRow, _currentToColumn + colDelta)); // will call render() internally
|
602
608
|
} else {
|
603
609
|
instance._refreshBorders(); // it will call render and prepare methods
|
604
|
-
|
605
610
|
}
|
606
611
|
}
|
607
612
|
|
608
613
|
break;
|
609
|
-
|
610
614
|
case 'remove_row':
|
611
615
|
var removeRow = function removeRow(indexes) {
|
612
|
-
var offset = 0;
|
616
|
+
var offset = 0;
|
613
617
|
|
618
|
+
// Normalize the {index, amount} groups into bigger groups.
|
614
619
|
arrayEach(indexes, function (_ref8) {
|
615
620
|
var _ref9 = _slicedToArray(_ref8, 2),
|
616
|
-
|
617
|
-
|
621
|
+
groupIndex = _ref9[0],
|
622
|
+
groupAmount = _ref9[1];
|
623
|
+
var calcIndex = isEmpty(groupIndex) ? instance.countRows() - 1 : Math.max(groupIndex - offset, 0);
|
618
624
|
|
619
|
-
|
625
|
+
// If the 'index' is an integer decrease it by 'offset' otherwise pass it through to make the value
|
620
626
|
// compatible with datamap.removeCol method.
|
621
|
-
|
622
627
|
if (Number.isInteger(groupIndex)) {
|
623
628
|
// eslint-disable-next-line no-param-reassign
|
624
629
|
groupIndex = Math.max(groupIndex - offset, 0);
|
625
|
-
}
|
626
|
-
// inside the datamap.removeRow breaks the removing functionality.
|
627
|
-
|
630
|
+
}
|
628
631
|
|
632
|
+
// TODO: for datamap.removeRow index should be passed as it is (with undefined and null values). If not, the logic
|
633
|
+
// inside the datamap.removeRow breaks the removing functionality.
|
629
634
|
var wasRemoved = datamap.removeRow(groupIndex, groupAmount, source);
|
630
|
-
|
631
635
|
if (!wasRemoved) {
|
632
636
|
return;
|
633
637
|
}
|
634
|
-
|
635
638
|
metaManager.removeRow(instance.toPhysicalRow(calcIndex), groupAmount);
|
636
639
|
var totalRows = instance.countRows();
|
637
640
|
var fixedRowsTop = tableMeta.fixedRowsTop;
|
638
|
-
|
639
641
|
if (fixedRowsTop >= calcIndex + 1) {
|
640
642
|
tableMeta.fixedRowsTop -= Math.min(groupAmount, fixedRowsTop - calcIndex);
|
641
643
|
}
|
642
|
-
|
643
644
|
var fixedRowsBottom = tableMeta.fixedRowsBottom;
|
644
|
-
|
645
645
|
if (fixedRowsBottom && calcIndex >= totalRows - fixedRowsBottom) {
|
646
646
|
tableMeta.fixedRowsBottom -= Math.min(groupAmount, fixedRowsBottom);
|
647
647
|
}
|
648
|
-
|
649
648
|
offset += groupAmount;
|
650
649
|
});
|
651
650
|
};
|
652
|
-
|
653
651
|
if (Array.isArray(index)) {
|
654
652
|
removeRow(normalizeIndexesGroup(index));
|
655
653
|
} else {
|
656
654
|
removeRow([[index, amount]]);
|
657
655
|
}
|
658
|
-
|
659
656
|
grid.adjustRowsAndCols();
|
660
|
-
|
661
657
|
instance._refreshBorders(); // it will call render and prepare methods
|
662
|
-
|
663
|
-
|
664
658
|
break;
|
665
|
-
|
666
659
|
case 'remove_col':
|
667
660
|
var removeCol = function removeCol(indexes) {
|
668
|
-
var offset = 0;
|
661
|
+
var offset = 0;
|
669
662
|
|
663
|
+
// Normalize the {index, amount} groups into bigger groups.
|
670
664
|
arrayEach(indexes, function (_ref10) {
|
671
665
|
var _ref11 = _slicedToArray(_ref10, 2),
|
672
|
-
|
673
|
-
|
674
|
-
|
666
|
+
groupIndex = _ref11[0],
|
667
|
+
groupAmount = _ref11[1];
|
675
668
|
var calcIndex = isEmpty(groupIndex) ? instance.countCols() - 1 : Math.max(groupIndex - offset, 0);
|
676
|
-
var physicalColumnIndex = instance.toPhysicalColumn(calcIndex);
|
677
|
-
// compatible with datamap.removeCol method.
|
669
|
+
var physicalColumnIndex = instance.toPhysicalColumn(calcIndex);
|
678
670
|
|
671
|
+
// If the 'index' is an integer decrease it by 'offset' otherwise pass it through to make the value
|
672
|
+
// compatible with datamap.removeCol method.
|
679
673
|
if (Number.isInteger(groupIndex)) {
|
680
674
|
// eslint-disable-next-line no-param-reassign
|
681
675
|
groupIndex = Math.max(groupIndex - offset, 0);
|
682
|
-
}
|
683
|
-
// inside the datamap.removeCol breaks the removing functionality.
|
684
|
-
|
676
|
+
}
|
685
677
|
|
678
|
+
// TODO: for datamap.removeCol index should be passed as it is (with undefined and null values). If not, the logic
|
679
|
+
// inside the datamap.removeCol breaks the removing functionality.
|
686
680
|
var wasRemoved = datamap.removeCol(groupIndex, groupAmount, source);
|
687
|
-
|
688
681
|
if (!wasRemoved) {
|
689
682
|
return;
|
690
683
|
}
|
691
|
-
|
692
684
|
metaManager.removeColumn(physicalColumnIndex, groupAmount);
|
693
685
|
var fixedColumnsStart = tableMeta.fixedColumnsStart;
|
694
|
-
|
695
686
|
if (fixedColumnsStart >= calcIndex + 1) {
|
696
687
|
tableMeta.fixedColumnsStart -= Math.min(groupAmount, fixedColumnsStart - calcIndex);
|
697
688
|
}
|
698
|
-
|
699
689
|
if (Array.isArray(tableMeta.colHeaders)) {
|
700
690
|
if (typeof physicalColumnIndex === 'undefined') {
|
701
691
|
physicalColumnIndex = -1;
|
702
692
|
}
|
703
|
-
|
704
693
|
tableMeta.colHeaders.splice(physicalColumnIndex, groupAmount);
|
705
694
|
}
|
706
|
-
|
707
695
|
offset += groupAmount;
|
708
696
|
});
|
709
697
|
};
|
710
|
-
|
711
698
|
if (Array.isArray(index)) {
|
712
699
|
removeCol(normalizeIndexesGroup(index));
|
713
700
|
} else {
|
714
701
|
removeCol([[index, amount]]);
|
715
702
|
}
|
716
|
-
|
717
703
|
grid.adjustRowsAndCols();
|
718
|
-
|
719
704
|
instance._refreshBorders(); // it will call render and prepare methods
|
720
705
|
|
721
|
-
|
722
706
|
break;
|
723
|
-
|
724
707
|
default:
|
725
708
|
throw new Error("There is no such action \"".concat(action, "\""));
|
726
709
|
}
|
727
|
-
|
728
710
|
if (!keepEmptyRows) {
|
729
711
|
grid.adjustRowsAndCols(); // makes sure that we did not add rows that will be removed in next refresh
|
730
712
|
}
|
731
713
|
},
|
732
|
-
|
733
714
|
/**
|
734
715
|
* Makes sure there are empty rows at the bottom of the table.
|
735
716
|
*
|
736
717
|
* @private
|
737
|
-
*/
|
738
|
-
adjustRowsAndCols: function adjustRowsAndCols() {
|
718
|
+
*/adjustRowsAndCols: function adjustRowsAndCols() {
|
739
719
|
var minRows = tableMeta.minRows;
|
740
720
|
var minSpareRows = tableMeta.minSpareRows;
|
741
721
|
var minCols = tableMeta.minCols;
|
742
722
|
var minSpareCols = tableMeta.minSpareCols;
|
743
|
-
|
723
|
+
if (instance.countRows() === 0 && instance.countCols() === 0) {
|
724
|
+
selection.deselect();
|
725
|
+
}
|
744
726
|
if (minRows) {
|
745
727
|
// should I add empty rows to data source to meet minRows?
|
746
728
|
var nrOfRows = instance.countRows();
|
747
|
-
|
748
729
|
if (nrOfRows < minRows) {
|
749
730
|
// The synchronization with cell meta is not desired here. For `minRows` option,
|
750
731
|
// we don't want to touch/shift cell meta objects.
|
751
|
-
datamap.createRow(nrOfRows, minRows - nrOfRows,
|
732
|
+
datamap.createRow(nrOfRows, minRows - nrOfRows, {
|
733
|
+
source: 'auto'
|
734
|
+
});
|
752
735
|
}
|
753
736
|
}
|
754
|
-
|
755
737
|
if (minSpareRows) {
|
756
|
-
var emptyRows = instance.countEmptyRows(true);
|
738
|
+
var emptyRows = instance.countEmptyRows(true);
|
757
739
|
|
740
|
+
// should I add empty rows to meet minSpareRows?
|
758
741
|
if (emptyRows < minSpareRows) {
|
759
742
|
var emptyRowsMissing = minSpareRows - emptyRows;
|
760
|
-
var rowsToCreate = Math.min(emptyRowsMissing, tableMeta.maxRows - instance.countSourceRows());
|
761
|
-
// we don't want to touch/shift cell meta objects.
|
743
|
+
var rowsToCreate = Math.min(emptyRowsMissing, tableMeta.maxRows - instance.countSourceRows());
|
762
744
|
|
763
|
-
|
745
|
+
// The synchronization with cell meta is not desired here. For `minSpareRows` option,
|
746
|
+
// we don't want to touch/shift cell meta objects.
|
747
|
+
datamap.createRow(instance.countRows(), rowsToCreate, {
|
748
|
+
source: 'auto'
|
749
|
+
});
|
764
750
|
}
|
765
751
|
}
|
766
|
-
|
767
752
|
{
|
768
|
-
var emptyCols;
|
753
|
+
var emptyCols;
|
769
754
|
|
755
|
+
// count currently empty cols
|
770
756
|
if (minCols || minSpareCols) {
|
771
757
|
emptyCols = instance.countEmptyCols(true);
|
772
758
|
}
|
759
|
+
var nrOfColumns = instance.countCols();
|
773
760
|
|
774
|
-
|
775
|
-
|
761
|
+
// should I add empty cols to meet minCols?
|
776
762
|
if (minCols && !tableMeta.columns && nrOfColumns < minCols) {
|
777
763
|
// The synchronization with cell meta is not desired here. For `minSpareRows` option,
|
778
764
|
// we don't want to touch/shift cell meta objects.
|
779
765
|
var colsToCreate = minCols - nrOfColumns;
|
780
766
|
emptyCols += colsToCreate;
|
781
|
-
datamap.createCol(nrOfColumns, colsToCreate,
|
782
|
-
|
783
|
-
|
784
|
-
|
767
|
+
datamap.createCol(nrOfColumns, colsToCreate, {
|
768
|
+
source: 'auto'
|
769
|
+
});
|
770
|
+
}
|
771
|
+
// should I add empty cols to meet minSpareCols?
|
785
772
|
if (minSpareCols && !tableMeta.columns && instance.dataType === 'array' && emptyCols < minSpareCols) {
|
786
773
|
nrOfColumns = instance.countCols();
|
787
774
|
var emptyColsMissing = minSpareCols - emptyCols;
|
775
|
+
var _colsToCreate = Math.min(emptyColsMissing, tableMeta.maxCols - nrOfColumns);
|
788
776
|
|
789
|
-
|
777
|
+
// The synchronization with cell meta is not desired here. For `minSpareRows` option,
|
790
778
|
// we don't want to touch/shift cell meta objects.
|
791
|
-
|
792
|
-
|
793
|
-
|
779
|
+
datamap.createCol(nrOfColumns, _colsToCreate, {
|
780
|
+
source: 'auto'
|
781
|
+
});
|
794
782
|
}
|
795
783
|
}
|
796
|
-
var rowCount = instance.countRows();
|
797
|
-
var colCount = instance.countCols();
|
798
|
-
|
799
|
-
if (rowCount === 0 || colCount === 0) {
|
800
|
-
selection.deselect();
|
801
|
-
}
|
802
|
-
|
803
784
|
if (selection.isSelected()) {
|
785
|
+
var rowCount = instance.countRows();
|
786
|
+
var colCount = instance.countCols();
|
804
787
|
arrayEach(selection.selectedRange, function (range) {
|
805
788
|
var selectionChanged = false;
|
806
789
|
var fromRow = range.from.row;
|
807
790
|
var fromCol = range.from.col;
|
808
791
|
var toRow = range.to.row;
|
809
|
-
var toCol = range.to.col;
|
792
|
+
var toCol = range.to.col;
|
810
793
|
|
794
|
+
// if selection is outside, move selection to last row
|
811
795
|
if (fromRow > rowCount - 1) {
|
812
796
|
fromRow = rowCount - 1;
|
813
797
|
selectionChanged = true;
|
814
|
-
|
815
798
|
if (toRow > fromRow) {
|
816
799
|
toRow = fromRow;
|
817
800
|
}
|
818
801
|
} else if (toRow > rowCount - 1) {
|
819
802
|
toRow = rowCount - 1;
|
820
803
|
selectionChanged = true;
|
821
|
-
|
822
804
|
if (fromRow > toRow) {
|
823
805
|
fromRow = toRow;
|
824
806
|
}
|
825
|
-
}
|
826
|
-
|
827
|
-
|
807
|
+
}
|
808
|
+
// if selection is outside, move selection to last row
|
828
809
|
if (fromCol > colCount - 1) {
|
829
810
|
fromCol = colCount - 1;
|
830
811
|
selectionChanged = true;
|
831
|
-
|
832
812
|
if (toCol > fromCol) {
|
833
813
|
toCol = fromCol;
|
834
814
|
}
|
835
815
|
} else if (toCol > colCount - 1) {
|
836
816
|
toCol = colCount - 1;
|
837
817
|
selectionChanged = true;
|
838
|
-
|
839
818
|
if (fromCol > toCol) {
|
840
819
|
fromCol = toCol;
|
841
820
|
}
|
842
821
|
}
|
843
|
-
|
844
822
|
if (selectionChanged) {
|
845
823
|
instance.selectCell(fromRow, fromCol, toRow, toCol);
|
846
824
|
}
|
847
825
|
});
|
848
826
|
}
|
849
|
-
|
850
827
|
if (instance.view) {
|
851
828
|
instance.view.adjustElementsSize();
|
852
829
|
}
|
853
830
|
},
|
854
|
-
|
855
831
|
/**
|
856
832
|
* Populate the data from the provided 2d array from the given cell coordinates.
|
857
833
|
*
|
@@ -865,8 +841,7 @@ export default function Core(rootElement, userSettings) {
|
|
865
841
|
* @param {Array} deltas The deltas array. A difference between values of adjacent cells.
|
866
842
|
* Useful **only** when the type of handled cells is `numeric`.
|
867
843
|
* @returns {object|undefined} Ending td in pasted area (only if any cell was changed).
|
868
|
-
*/
|
869
|
-
populateFromArray: function populateFromArray(start, input, end, source, method, direction, deltas) {
|
844
|
+
*/populateFromArray: function populateFromArray(start, input, end, source, method, direction, deltas) {
|
870
845
|
// TODO: either remove or implement the `direction` argument. Currently it's not working at all.
|
871
846
|
var r;
|
872
847
|
var rlen;
|
@@ -878,38 +853,34 @@ export default function Core(rootElement, userSettings) {
|
|
878
853
|
var startRow = start.row;
|
879
854
|
var startColumn = start.col;
|
880
855
|
rlen = input.length;
|
881
|
-
|
882
856
|
if (rlen === 0) {
|
883
857
|
return false;
|
884
858
|
}
|
885
|
-
|
886
859
|
var columnsPopulationEnd = 0;
|
887
860
|
var rowsPopulationEnd = 0;
|
888
|
-
|
889
861
|
if (isObject(end)) {
|
890
862
|
columnsPopulationEnd = end.col - startColumn + 1;
|
891
863
|
rowsPopulationEnd = end.row - startRow + 1;
|
892
|
-
}
|
893
|
-
|
864
|
+
}
|
894
865
|
|
866
|
+
// insert data with specified pasteMode method
|
895
867
|
switch (method) {
|
896
868
|
case 'shift_down':
|
897
869
|
// translate data from a list of rows to a list of columns
|
898
870
|
var populatedDataByColumns = pivot(input);
|
899
|
-
var numberOfDataColumns = populatedDataByColumns.length;
|
900
|
-
|
871
|
+
var numberOfDataColumns = populatedDataByColumns.length;
|
872
|
+
// method's argument can extend the range of data population (data would be repeated)
|
901
873
|
var numberOfColumnsToPopulate = Math.max(numberOfDataColumns, columnsPopulationEnd);
|
902
|
-
var pushedDownDataByRows = instance.getData().slice(startRow);
|
874
|
+
var pushedDownDataByRows = instance.getData().slice(startRow);
|
903
875
|
|
876
|
+
// translate data from a list of rows to a list of columns
|
904
877
|
var pushedDownDataByColumns = pivot(pushedDownDataByRows).slice(startColumn, startColumn + numberOfColumnsToPopulate);
|
905
|
-
|
906
878
|
for (c = 0; c < numberOfColumnsToPopulate; c += 1) {
|
907
879
|
if (c < numberOfDataColumns) {
|
908
880
|
for (r = 0, rlen = populatedDataByColumns[c].length; r < rowsPopulationEnd - rlen; r += 1) {
|
909
881
|
// repeating data for rows
|
910
882
|
populatedDataByColumns[c].push(populatedDataByColumns[c][r % rlen]);
|
911
883
|
}
|
912
|
-
|
913
884
|
if (c < pushedDownDataByColumns.length) {
|
914
885
|
newDataByColumns.push(populatedDataByColumns[c].concat(pushedDownDataByColumns[c]));
|
915
886
|
} else {
|
@@ -922,32 +893,27 @@ export default function Core(rootElement, userSettings) {
|
|
922
893
|
newDataByColumns.push(populatedDataByColumns[c % numberOfDataColumns].concat(pushedDownDataByColumns[c]));
|
923
894
|
}
|
924
895
|
}
|
925
|
-
|
926
896
|
instance.populateFromArray(startRow, startColumn, pivot(newDataByColumns));
|
927
897
|
break;
|
928
|
-
|
929
898
|
case 'shift_right':
|
930
|
-
var numberOfDataRows = input.length;
|
931
|
-
|
899
|
+
var numberOfDataRows = input.length;
|
900
|
+
// method's argument can extend the range of data population (data would be repeated)
|
932
901
|
var numberOfRowsToPopulate = Math.max(numberOfDataRows, rowsPopulationEnd);
|
933
902
|
var pushedRightDataByRows = instance.getData().slice(startRow).map(function (rowData) {
|
934
903
|
return rowData.slice(startColumn);
|
935
904
|
});
|
936
|
-
|
937
905
|
for (r = 0; r < numberOfRowsToPopulate; r += 1) {
|
938
906
|
if (r < numberOfDataRows) {
|
939
907
|
for (c = 0, clen = input[r].length; c < columnsPopulationEnd - clen; c += 1) {
|
940
908
|
// repeating data for rows
|
941
909
|
input[r].push(input[r][c % clen]);
|
942
910
|
}
|
943
|
-
|
944
911
|
if (r < pushedRightDataByRows.length) {
|
945
912
|
for (var i = 0; i < pushedRightDataByRows[r].length; i += 1) {
|
946
913
|
input[r].push(pushedRightDataByRows[r][i]);
|
947
914
|
}
|
948
915
|
} else {
|
949
916
|
var _input$r;
|
950
|
-
|
951
917
|
// if before data population, there was no data in the row
|
952
918
|
// we fill the required columns' newly-created cells with `null` values
|
953
919
|
(_input$r = input[r]).push.apply(_input$r, _toConsumableArray(new Array(pushedRightDataByRows[0].length).fill(null)));
|
@@ -957,10 +923,8 @@ export default function Core(rootElement, userSettings) {
|
|
957
923
|
input.push(input[r % rlen].slice(0, numberOfRowsToPopulate).concat(pushedRightDataByRows[r]));
|
958
924
|
}
|
959
925
|
}
|
960
|
-
|
961
926
|
instance.populateFromArray(startRow, startColumn, input);
|
962
927
|
break;
|
963
|
-
|
964
928
|
case 'overwrite':
|
965
929
|
default:
|
966
930
|
// overwrite and other not specified options
|
@@ -975,77 +939,59 @@ export default function Core(rootElement, userSettings) {
|
|
975
939
|
var skippedColumn = 0;
|
976
940
|
var pushData = true;
|
977
941
|
var cellMeta;
|
978
|
-
|
979
942
|
var getInputValue = function getInputValue(row) {
|
980
943
|
var col = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
981
944
|
var rowValue = input[row % input.length];
|
982
|
-
|
983
945
|
if (col !== null) {
|
984
946
|
return rowValue[col % rowValue.length];
|
985
947
|
}
|
986
|
-
|
987
948
|
return rowValue;
|
988
949
|
};
|
989
|
-
|
990
950
|
var rowInputLength = input.length;
|
991
951
|
var rowSelectionLength = end ? end.row - start.row + 1 : 0;
|
992
|
-
|
993
952
|
if (end) {
|
994
953
|
rlen = rowSelectionLength;
|
995
954
|
} else {
|
996
955
|
rlen = Math.max(rowInputLength, rowSelectionLength);
|
997
956
|
}
|
998
|
-
|
999
957
|
for (r = 0; r < rlen; r++) {
|
1000
958
|
if (end && current.row > end.row && rowSelectionLength > rowInputLength || !tableMeta.allowInsertRow && current.row > instance.countRows() - 1 || current.row >= tableMeta.maxRows) {
|
1001
959
|
break;
|
1002
960
|
}
|
1003
|
-
|
1004
961
|
var visualRow = r - skippedRow;
|
1005
962
|
var colInputLength = getInputValue(visualRow).length;
|
1006
963
|
var colSelectionLength = end ? end.col - start.col + 1 : 0;
|
1007
|
-
|
1008
964
|
if (end) {
|
1009
965
|
clen = colSelectionLength;
|
1010
966
|
} else {
|
1011
967
|
clen = Math.max(colInputLength, colSelectionLength);
|
1012
968
|
}
|
1013
|
-
|
1014
969
|
current.col = start.col;
|
1015
970
|
cellMeta = instance.getCellMeta(current.row, current.col);
|
1016
|
-
|
1017
971
|
if ((source === 'CopyPaste.paste' || source === 'Autofill.fill') && cellMeta.skipRowOnPaste) {
|
1018
972
|
skippedRow += 1;
|
1019
973
|
current.row += 1;
|
1020
974
|
rlen += 1;
|
1021
975
|
/* eslint-disable no-continue */
|
1022
|
-
|
1023
976
|
continue;
|
1024
977
|
}
|
1025
|
-
|
1026
978
|
skippedColumn = 0;
|
1027
|
-
|
1028
979
|
for (c = 0; c < clen; c++) {
|
1029
980
|
if (end && current.col > end.col && colSelectionLength > colInputLength || !tableMeta.allowInsertColumn && current.col > instance.countCols() - 1 || current.col >= tableMeta.maxCols) {
|
1030
981
|
break;
|
1031
982
|
}
|
1032
|
-
|
1033
983
|
cellMeta = instance.getCellMeta(current.row, current.col);
|
1034
|
-
|
1035
984
|
if ((source === 'CopyPaste.paste' || source === 'Autofill.fill') && cellMeta.skipColumnOnPaste) {
|
1036
985
|
skippedColumn += 1;
|
1037
986
|
current.col += 1;
|
1038
987
|
clen += 1;
|
1039
988
|
continue;
|
1040
989
|
}
|
1041
|
-
|
1042
990
|
if (cellMeta.readOnly && source !== 'UndoRedo.undo') {
|
1043
991
|
current.col += 1;
|
1044
992
|
/* eslint-disable no-continue */
|
1045
|
-
|
1046
993
|
continue;
|
1047
994
|
}
|
1048
|
-
|
1049
995
|
var visualColumn = c - skippedColumn;
|
1050
996
|
var value = getInputValue(visualRow, visualColumn);
|
1051
997
|
var orgValue = instance.getDataAtCell(current.row, current.col);
|
@@ -1053,28 +999,24 @@ export default function Core(rootElement, userSettings) {
|
|
1053
999
|
row: visualRow,
|
1054
1000
|
col: visualColumn
|
1055
1001
|
};
|
1056
|
-
|
1057
1002
|
if (source === 'Autofill.fill') {
|
1058
1003
|
var result = instance.runHooks('beforeAutofillInsidePopulate', index, direction, input, deltas, {}, selected);
|
1059
|
-
|
1060
1004
|
if (result) {
|
1061
1005
|
value = isUndefined(result.value) ? value : result.value;
|
1062
1006
|
}
|
1063
1007
|
}
|
1064
|
-
|
1065
1008
|
if (value !== null && _typeof(value) === 'object') {
|
1066
1009
|
// when 'value' is array and 'orgValue' is null, set 'orgValue' to
|
1067
1010
|
// an empty array so that the null value can be compared to 'value'
|
1068
1011
|
// as an empty value for the array context
|
1069
1012
|
if (Array.isArray(value) && orgValue === null) orgValue = [];
|
1070
|
-
|
1071
1013
|
if (orgValue === null || _typeof(orgValue) !== 'object') {
|
1072
1014
|
pushData = false;
|
1073
1015
|
} else {
|
1074
1016
|
var orgValueSchema = duckSchema(Array.isArray(orgValue) ? orgValue : orgValue[0] || orgValue);
|
1075
1017
|
var valueSchema = duckSchema(Array.isArray(value) ? value : value[0] || value);
|
1076
|
-
/* eslint-disable max-depth */
|
1077
1018
|
|
1019
|
+
/* eslint-disable max-depth */
|
1078
1020
|
if (isObjectEqual(orgValueSchema, valueSchema)) {
|
1079
1021
|
value = deepClone(value);
|
1080
1022
|
} else {
|
@@ -1084,23 +1026,20 @@ export default function Core(rootElement, userSettings) {
|
|
1084
1026
|
} else if (orgValue !== null && _typeof(orgValue) === 'object') {
|
1085
1027
|
pushData = false;
|
1086
1028
|
}
|
1087
|
-
|
1088
1029
|
if (pushData) {
|
1089
1030
|
setData.push([current.row, current.col, value]);
|
1090
1031
|
}
|
1091
|
-
|
1092
1032
|
pushData = true;
|
1093
1033
|
current.col += 1;
|
1094
1034
|
}
|
1095
|
-
|
1096
1035
|
current.row += 1;
|
1097
1036
|
}
|
1098
|
-
|
1099
1037
|
instance.setDataAtCell(setData, null, null, source || 'populateFromArray');
|
1100
1038
|
break;
|
1101
1039
|
}
|
1102
1040
|
}
|
1103
1041
|
};
|
1042
|
+
|
1104
1043
|
/**
|
1105
1044
|
* Internal function to set `language` key of settings.
|
1106
1045
|
*
|
@@ -1108,10 +1047,8 @@ export default function Core(rootElement, userSettings) {
|
|
1108
1047
|
* @param {string} languageCode Language code for specific language i.e. 'en-US', 'pt-BR', 'de-DE'.
|
1109
1048
|
* @fires Hooks#afterLanguageChange
|
1110
1049
|
*/
|
1111
|
-
|
1112
1050
|
function setLanguage(languageCode) {
|
1113
1051
|
var normalizedLanguageCode = normalizeLanguageCode(languageCode);
|
1114
|
-
|
1115
1052
|
if (hasLanguageDictionary(normalizedLanguageCode)) {
|
1116
1053
|
instance.runHooks('beforeLanguageChange', normalizedLanguageCode);
|
1117
1054
|
globalMeta.language = normalizedLanguageCode;
|
@@ -1120,6 +1057,7 @@ export default function Core(rootElement, userSettings) {
|
|
1120
1057
|
warnUserAboutLanguageRegistration(languageCode);
|
1121
1058
|
}
|
1122
1059
|
}
|
1060
|
+
|
1123
1061
|
/**
|
1124
1062
|
* Internal function to set `className` or `tableClassName`, depending on the key from the settings object.
|
1125
1063
|
*
|
@@ -1127,69 +1065,53 @@ export default function Core(rootElement, userSettings) {
|
|
1127
1065
|
* @param {string} className `className` or `tableClassName` from the key in the settings object.
|
1128
1066
|
* @param {string|string[]} classSettings String or array of strings. Contains class name(s) from settings object.
|
1129
1067
|
*/
|
1130
|
-
|
1131
|
-
|
1132
1068
|
function setClassName(className, classSettings) {
|
1133
1069
|
var element = className === 'className' ? instance.rootElement : instance.table;
|
1134
|
-
|
1135
1070
|
if (firstRun) {
|
1136
1071
|
addClass(element, classSettings);
|
1137
1072
|
} else {
|
1138
1073
|
var globalMetaSettingsArray = [];
|
1139
1074
|
var settingsArray = [];
|
1140
|
-
|
1141
1075
|
if (globalMeta[className]) {
|
1142
1076
|
globalMetaSettingsArray = Array.isArray(globalMeta[className]) ? globalMeta[className] : stringToArray(globalMeta[className]);
|
1143
1077
|
}
|
1144
|
-
|
1145
1078
|
if (classSettings) {
|
1146
1079
|
settingsArray = Array.isArray(classSettings) ? classSettings : stringToArray(classSettings);
|
1147
1080
|
}
|
1148
|
-
|
1149
1081
|
var classNameToRemove = getDifferenceOfArrays(globalMetaSettingsArray, settingsArray);
|
1150
1082
|
var classNameToAdd = getDifferenceOfArrays(settingsArray, globalMetaSettingsArray);
|
1151
|
-
|
1152
1083
|
if (classNameToRemove.length) {
|
1153
1084
|
removeClass(element, classNameToRemove);
|
1154
1085
|
}
|
1155
|
-
|
1156
1086
|
if (classNameToAdd.length) {
|
1157
1087
|
addClass(element, classNameToAdd);
|
1158
1088
|
}
|
1159
1089
|
}
|
1160
|
-
|
1161
1090
|
globalMeta[className] = classSettings;
|
1162
1091
|
}
|
1163
|
-
|
1164
1092
|
this.init = function () {
|
1165
1093
|
dataSource.setData(tableMeta.data);
|
1166
1094
|
instance.runHooks('beforeInit');
|
1167
|
-
|
1168
1095
|
if (isMobileBrowser() || isIpadOS()) {
|
1169
1096
|
addClass(instance.rootElement, 'mobile');
|
1170
1097
|
}
|
1171
|
-
|
1172
1098
|
this.updateSettings(tableMeta, true);
|
1173
1099
|
this.view = new TableView(this);
|
1174
1100
|
editorManager = EditorManager.getInstance(instance, tableMeta, selection);
|
1175
1101
|
instance.runHooks('init');
|
1176
1102
|
this.forceFullRender = true; // used when data was changed
|
1177
|
-
|
1178
1103
|
this.view.render();
|
1179
|
-
|
1180
1104
|
if (_typeof(firstRun) === 'object') {
|
1181
1105
|
instance.runHooks('afterChange', firstRun[0], firstRun[1]);
|
1182
1106
|
firstRun = false;
|
1183
1107
|
}
|
1184
|
-
|
1185
1108
|
instance.runHooks('afterInit');
|
1186
1109
|
};
|
1110
|
+
|
1187
1111
|
/**
|
1188
1112
|
* @ignore
|
1189
1113
|
* @returns {object}
|
1190
1114
|
*/
|
1191
|
-
|
1192
|
-
|
1193
1115
|
function ValidatorsQueue() {
|
1194
1116
|
// moved this one level up so it can be used in any function here. Probably this should be moved to a separate file
|
1195
1117
|
var resolved = false;
|
@@ -1213,6 +1135,7 @@ export default function Core(rootElement, userSettings) {
|
|
1213
1135
|
}
|
1214
1136
|
};
|
1215
1137
|
}
|
1138
|
+
|
1216
1139
|
/**
|
1217
1140
|
* Get parsed number from numeric string.
|
1218
1141
|
*
|
@@ -1220,51 +1143,40 @@ export default function Core(rootElement, userSettings) {
|
|
1220
1143
|
* @param {string} numericData Float (separated by a dot or a comma) or integer.
|
1221
1144
|
* @returns {number} Number if we get data in parsable format, not changed value otherwise.
|
1222
1145
|
*/
|
1223
|
-
|
1224
|
-
|
1225
1146
|
function getParsedNumber(numericData) {
|
1226
1147
|
// Unifying "float like" string. Change from value with comma determiner to value with dot determiner,
|
1227
1148
|
// for example from `450,65` to `450.65`.
|
1228
1149
|
var unifiedNumericData = numericData.replace(',', '.');
|
1229
|
-
|
1230
1150
|
if (isNaN(parseFloat(unifiedNumericData)) === false) {
|
1231
1151
|
return parseFloat(unifiedNumericData);
|
1232
1152
|
}
|
1233
|
-
|
1234
1153
|
return numericData;
|
1235
1154
|
}
|
1155
|
+
|
1236
1156
|
/**
|
1237
1157
|
* @ignore
|
1238
1158
|
* @param {Array} changes The 2D array containing information about each of the edited cells.
|
1239
1159
|
* @param {string} source The string that identifies source of validation.
|
1240
1160
|
* @param {Function} callback The callback function fot async validation.
|
1241
1161
|
*/
|
1242
|
-
|
1243
|
-
|
1244
1162
|
function validateChanges(changes, source, callback) {
|
1245
1163
|
if (!changes.length) {
|
1246
1164
|
return;
|
1247
1165
|
}
|
1248
|
-
|
1249
1166
|
var activeEditor = instance.getActiveEditor();
|
1250
1167
|
var beforeChangeResult = instance.runHooks('beforeChange', changes, source || 'edit');
|
1251
1168
|
var shouldBeCanceled = true;
|
1252
|
-
|
1253
1169
|
if (beforeChangeResult === false) {
|
1254
1170
|
if (activeEditor) {
|
1255
1171
|
activeEditor.cancelChanges();
|
1256
1172
|
}
|
1257
|
-
|
1258
1173
|
return;
|
1259
1174
|
}
|
1260
|
-
|
1261
1175
|
var waitingForValidator = new ValidatorsQueue();
|
1262
|
-
|
1263
1176
|
waitingForValidator.onQueueEmpty = function (isValid) {
|
1264
1177
|
if (activeEditor && shouldBeCanceled) {
|
1265
1178
|
activeEditor.cancelChanges();
|
1266
1179
|
}
|
1267
|
-
|
1268
1180
|
callback(isValid); // called when async validators are resolved and beforeChange was not async
|
1269
1181
|
};
|
1270
1182
|
|
@@ -1273,19 +1185,16 @@ export default function Core(rootElement, userSettings) {
|
|
1273
1185
|
changes.splice(i, 1);
|
1274
1186
|
} else {
|
1275
1187
|
var _changes$i = _slicedToArray(changes[i], 4),
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1188
|
+
row = _changes$i[0],
|
1189
|
+
prop = _changes$i[1],
|
1190
|
+
newValue = _changes$i[3];
|
1280
1191
|
var col = datamap.propToCol(prop);
|
1281
1192
|
var cellProperties = instance.getCellMeta(row, col);
|
1282
|
-
|
1283
1193
|
if (cellProperties.type === 'numeric' && typeof newValue === 'string' && isNumericLike(newValue)) {
|
1284
1194
|
changes[i][3] = getParsedNumber(newValue);
|
1285
1195
|
}
|
1286
|
-
/* eslint-disable no-loop-func */
|
1287
|
-
|
1288
1196
|
|
1197
|
+
/* eslint-disable no-loop-func */
|
1289
1198
|
if (instance.getCellValidator(cellProperties)) {
|
1290
1199
|
waitingForValidator.addValidatorToQueue();
|
1291
1200
|
instance.validateCell(changes[i][3], cellProperties, function (index, cellPropertiesReference) {
|
@@ -1293,19 +1202,16 @@ export default function Core(rootElement, userSettings) {
|
|
1293
1202
|
if (typeof result !== 'boolean') {
|
1294
1203
|
throw new Error('Validation error: result is not boolean');
|
1295
1204
|
}
|
1296
|
-
|
1297
1205
|
if (result === false && cellPropertiesReference.allowInvalid === false) {
|
1298
1206
|
shouldBeCanceled = false;
|
1299
1207
|
changes.splice(index, 1); // cancel the change
|
1300
|
-
|
1301
1208
|
cellPropertiesReference.valid = true; // we cancelled the change, so cell value is still valid
|
1302
1209
|
|
1303
1210
|
var cell = instance.getCell(cellPropertiesReference.visualRow, cellPropertiesReference.visualCol);
|
1304
|
-
|
1305
1211
|
if (cell !== null) {
|
1306
1212
|
removeClass(cell, tableMeta.invalidCellClassName);
|
1307
|
-
}
|
1308
|
-
|
1213
|
+
}
|
1214
|
+
// index -= 1;
|
1309
1215
|
}
|
1310
1216
|
|
1311
1217
|
waitingForValidator.removeValidatorFormQueue();
|
@@ -1314,9 +1220,9 @@ export default function Core(rootElement, userSettings) {
|
|
1314
1220
|
}
|
1315
1221
|
}
|
1316
1222
|
}
|
1317
|
-
|
1318
1223
|
waitingForValidator.checkIfQueueIsEmpty();
|
1319
1224
|
}
|
1225
|
+
|
1320
1226
|
/**
|
1321
1227
|
* Internal function to apply changes. Called after validateChanges.
|
1322
1228
|
*
|
@@ -1326,34 +1232,28 @@ export default function Core(rootElement, userSettings) {
|
|
1326
1232
|
* @fires Hooks#beforeChangeRender
|
1327
1233
|
* @fires Hooks#afterChange
|
1328
1234
|
*/
|
1329
|
-
|
1330
|
-
|
1331
1235
|
function applyChanges(changes, source) {
|
1332
1236
|
var i = changes.length - 1;
|
1333
|
-
|
1334
1237
|
if (i < 0) {
|
1335
1238
|
return;
|
1336
1239
|
}
|
1337
|
-
|
1338
1240
|
for (; i >= 0; i--) {
|
1339
1241
|
var skipThisChange = false;
|
1340
|
-
|
1341
1242
|
if (changes[i] === null) {
|
1342
1243
|
changes.splice(i, 1);
|
1343
1244
|
/* eslint-disable no-continue */
|
1344
|
-
|
1345
1245
|
continue;
|
1346
1246
|
}
|
1347
|
-
|
1348
1247
|
if ((changes[i][2] === null || changes[i][2] === void 0) && (changes[i][3] === null || changes[i][3] === void 0)) {
|
1349
1248
|
/* eslint-disable no-continue */
|
1350
1249
|
continue;
|
1351
1250
|
}
|
1352
|
-
|
1353
1251
|
if (tableMeta.allowInsertRow) {
|
1354
1252
|
while (changes[i][0] > instance.countRows() - 1) {
|
1355
|
-
var
|
1356
|
-
|
1253
|
+
var _datamap$createRow2 = datamap.createRow(void 0, void 0, {
|
1254
|
+
source: source
|
1255
|
+
}),
|
1256
|
+
numberOfCreatedRows = _datamap$createRow2.delta;
|
1357
1257
|
if (numberOfCreatedRows >= 1) {
|
1358
1258
|
metaManager.createRow(null, numberOfCreatedRows);
|
1359
1259
|
} else {
|
@@ -1362,11 +1262,12 @@ export default function Core(rootElement, userSettings) {
|
|
1362
1262
|
}
|
1363
1263
|
}
|
1364
1264
|
}
|
1365
|
-
|
1366
1265
|
if (instance.dataType === 'array' && (!tableMeta.columns || tableMeta.columns.length === 0) && tableMeta.allowInsertColumn) {
|
1367
1266
|
while (datamap.propToCol(changes[i][1]) > instance.countCols() - 1) {
|
1368
|
-
var
|
1369
|
-
|
1267
|
+
var _datamap$createCol2 = datamap.createCol(void 0, void 0, {
|
1268
|
+
source: source
|
1269
|
+
}),
|
1270
|
+
numberOfCreatedColumns = _datamap$createCol2.delta;
|
1370
1271
|
if (numberOfCreatedColumns >= 1) {
|
1371
1272
|
metaManager.createColumn(null, numberOfCreatedColumns);
|
1372
1273
|
} else {
|
@@ -1375,32 +1276,26 @@ export default function Core(rootElement, userSettings) {
|
|
1375
1276
|
}
|
1376
1277
|
}
|
1377
1278
|
}
|
1378
|
-
|
1379
1279
|
if (skipThisChange) {
|
1380
1280
|
/* eslint-disable no-continue */
|
1381
1281
|
continue;
|
1382
1282
|
}
|
1383
|
-
|
1384
1283
|
datamap.set(changes[i][0], changes[i][1], changes[i][3]);
|
1385
1284
|
}
|
1386
|
-
|
1387
1285
|
instance.forceFullRender = true; // used when data was changed
|
1388
|
-
|
1389
1286
|
grid.adjustRowsAndCols();
|
1390
1287
|
instance.runHooks('beforeChangeRender', changes, source);
|
1391
1288
|
editorManager.lockEditor();
|
1392
|
-
|
1393
1289
|
instance._refreshBorders(null);
|
1394
|
-
|
1395
1290
|
editorManager.unlockEditor();
|
1396
1291
|
instance.view.adjustElementsSize();
|
1397
1292
|
instance.runHooks('afterChange', changes, source || 'edit');
|
1398
1293
|
var activeEditor = instance.getActiveEditor();
|
1399
|
-
|
1400
1294
|
if (activeEditor && isDefined(activeEditor.refreshValue)) {
|
1401
1295
|
activeEditor.refreshValue();
|
1402
1296
|
}
|
1403
1297
|
}
|
1298
|
+
|
1404
1299
|
/**
|
1405
1300
|
* Creates and returns the CellCoords object.
|
1406
1301
|
*
|
@@ -1411,11 +1306,10 @@ export default function Core(rootElement, userSettings) {
|
|
1411
1306
|
* @param {number} column The column index.
|
1412
1307
|
* @returns {CellCoords}
|
1413
1308
|
*/
|
1414
|
-
|
1415
|
-
|
1416
1309
|
this._createCellCoords = function (row, column) {
|
1417
1310
|
return instance.view._wt.createCellCoords(row, column);
|
1418
1311
|
};
|
1312
|
+
|
1419
1313
|
/**
|
1420
1314
|
* Creates and returns the CellRange object.
|
1421
1315
|
*
|
@@ -1428,11 +1322,10 @@ export default function Core(rootElement, userSettings) {
|
|
1428
1322
|
* @param {CellCoords} to Final coordinates.
|
1429
1323
|
* @returns {CellRange}
|
1430
1324
|
*/
|
1431
|
-
|
1432
|
-
|
1433
1325
|
this._createCellRange = function (highlight, from, to) {
|
1434
1326
|
return instance.view._wt.createCellRange(highlight, from, to);
|
1435
1327
|
};
|
1328
|
+
|
1436
1329
|
/**
|
1437
1330
|
* Validate a single cell.
|
1438
1331
|
*
|
@@ -1443,41 +1336,33 @@ export default function Core(rootElement, userSettings) {
|
|
1443
1336
|
* @param {Function} callback The callback function.
|
1444
1337
|
* @param {string} source The string that identifies source of the validation.
|
1445
1338
|
*/
|
1446
|
-
|
1447
|
-
|
1448
1339
|
this.validateCell = function (value, cellProperties, callback, source) {
|
1449
|
-
var validator = instance.getCellValidator(cellProperties);
|
1340
|
+
var validator = instance.getCellValidator(cellProperties);
|
1450
1341
|
|
1342
|
+
// the `canBeValidated = false` argument suggests, that the cell passes validation by default.
|
1451
1343
|
/**
|
1452
1344
|
* @private
|
1453
1345
|
* @function done
|
1454
1346
|
* @param {boolean} valid Indicates if the validation was successful.
|
1455
1347
|
* @param {boolean} [canBeValidated=true] Flag which controls the validation process.
|
1456
1348
|
*/
|
1457
|
-
|
1458
1349
|
function done(valid) {
|
1459
1350
|
var canBeValidated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
1460
|
-
|
1461
1351
|
// Fixes GH#3903
|
1462
1352
|
if (!canBeValidated || cellProperties.hidden === true) {
|
1463
1353
|
callback(valid);
|
1464
1354
|
return;
|
1465
1355
|
}
|
1466
|
-
|
1467
1356
|
var col = cellProperties.visualCol;
|
1468
1357
|
var row = cellProperties.visualRow;
|
1469
1358
|
var td = instance.getCell(row, col, true);
|
1470
|
-
|
1471
1359
|
if (td && td.nodeName !== 'TH') {
|
1472
1360
|
var renderableRow = instance.rowIndexMapper.getRenderableFromVisualIndex(row);
|
1473
1361
|
var renderableColumn = instance.columnIndexMapper.getRenderableFromVisualIndex(col);
|
1474
|
-
|
1475
1362
|
instance.view._wt.getSetting('cellRenderer', renderableRow, renderableColumn, td);
|
1476
1363
|
}
|
1477
|
-
|
1478
1364
|
callback(valid);
|
1479
1365
|
}
|
1480
|
-
|
1481
1366
|
if (isRegExp(validator)) {
|
1482
1367
|
validator = function (expression) {
|
1483
1368
|
return function (cellValue, validatorCallback) {
|
@@ -1485,18 +1370,17 @@ export default function Core(rootElement, userSettings) {
|
|
1485
1370
|
};
|
1486
1371
|
}(validator);
|
1487
1372
|
}
|
1488
|
-
|
1489
1373
|
if (isFunction(validator)) {
|
1490
1374
|
// eslint-disable-next-line no-param-reassign
|
1491
|
-
value = instance.runHooks('beforeValidate', value, cellProperties.visualRow, cellProperties.prop, source);
|
1375
|
+
value = instance.runHooks('beforeValidate', value, cellProperties.visualRow, cellProperties.prop, source);
|
1492
1376
|
|
1377
|
+
// To provide consistent behaviour, validation should be always asynchronous
|
1493
1378
|
instance._registerImmediate(function () {
|
1494
1379
|
validator.call(cellProperties, value, function (valid) {
|
1495
1380
|
if (!instance) {
|
1496
1381
|
return;
|
1497
|
-
}
|
1498
|
-
|
1499
|
-
|
1382
|
+
}
|
1383
|
+
// eslint-disable-next-line no-param-reassign
|
1500
1384
|
valid = instance.runHooks('afterValidate', valid, value, cellProperties.visualRow, cellProperties.prop, source);
|
1501
1385
|
cellProperties.valid = valid;
|
1502
1386
|
done(valid);
|
@@ -1511,6 +1395,7 @@ export default function Core(rootElement, userSettings) {
|
|
1511
1395
|
});
|
1512
1396
|
}
|
1513
1397
|
};
|
1398
|
+
|
1514
1399
|
/**
|
1515
1400
|
* @ignore
|
1516
1401
|
* @param {number} row The visual row index.
|
@@ -1518,16 +1403,14 @@ export default function Core(rootElement, userSettings) {
|
|
1518
1403
|
* @param {*} value The cell value.
|
1519
1404
|
* @returns {Array}
|
1520
1405
|
*/
|
1521
|
-
|
1522
|
-
|
1523
1406
|
function setDataInputToArray(row, propOrCol, value) {
|
1524
1407
|
if (Array.isArray(row)) {
|
1525
1408
|
// it's an array of changes
|
1526
1409
|
return row;
|
1527
1410
|
}
|
1528
|
-
|
1529
1411
|
return [[row, propOrCol, value]];
|
1530
1412
|
}
|
1413
|
+
|
1531
1414
|
/**
|
1532
1415
|
* @description
|
1533
1416
|
* Set new value to a cell. To change many cells at once (recommended way), pass an array of `changes` in format
|
@@ -1540,8 +1423,6 @@ export default function Core(rootElement, userSettings) {
|
|
1540
1423
|
* @param {string} [value] New value.
|
1541
1424
|
* @param {string} [source] String that identifies how this change will be described in the changes array (useful in afterChange or beforeChange callback). Set to 'edit' if left empty.
|
1542
1425
|
*/
|
1543
|
-
|
1544
|
-
|
1545
1426
|
this.setDataAtCell = function (row, column, value, source) {
|
1546
1427
|
var input = setDataInputToArray(row, column, value);
|
1547
1428
|
var changes = [];
|
@@ -1549,12 +1430,10 @@ export default function Core(rootElement, userSettings) {
|
|
1549
1430
|
var i;
|
1550
1431
|
var ilen;
|
1551
1432
|
var prop;
|
1552
|
-
|
1553
1433
|
for (i = 0, ilen = input.length; i < ilen; i++) {
|
1554
1434
|
if (_typeof(input[i]) !== 'object') {
|
1555
1435
|
throw new Error('Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter');
|
1556
1436
|
}
|
1557
|
-
|
1558
1437
|
if (typeof input[i][1] !== 'number') {
|
1559
1438
|
throw new Error('Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`'); // eslint-disable-line max-len
|
1560
1439
|
}
|
@@ -1564,19 +1443,17 @@ export default function Core(rootElement, userSettings) {
|
|
1564
1443
|
} else {
|
1565
1444
|
prop = datamap.colToProp(input[i][1]);
|
1566
1445
|
}
|
1567
|
-
|
1568
1446
|
changes.push([input[i][0], prop, dataSource.getAtCell(this.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]);
|
1569
1447
|
}
|
1570
|
-
|
1571
1448
|
if (!changeSource && _typeof(row) === 'object') {
|
1572
1449
|
changeSource = column;
|
1573
1450
|
}
|
1574
|
-
|
1575
1451
|
instance.runHooks('afterSetDataAtCell', changes, changeSource);
|
1576
1452
|
validateChanges(changes, changeSource, function () {
|
1577
1453
|
applyChanges(changes, changeSource);
|
1578
1454
|
});
|
1579
1455
|
};
|
1456
|
+
|
1580
1457
|
/**
|
1581
1458
|
* @description
|
1582
1459
|
* Set new value to a cell. To change many cells at once (recommended way), pass an array of `changes` in format
|
@@ -1589,28 +1466,24 @@ export default function Core(rootElement, userSettings) {
|
|
1589
1466
|
* @param {string} value Value to be set.
|
1590
1467
|
* @param {string} [source] String that identifies how this change will be described in changes array (useful in onChange callback).
|
1591
1468
|
*/
|
1592
|
-
|
1593
|
-
|
1594
1469
|
this.setDataAtRowProp = function (row, prop, value, source) {
|
1595
1470
|
var input = setDataInputToArray(row, prop, value);
|
1596
1471
|
var changes = [];
|
1597
1472
|
var changeSource = source;
|
1598
1473
|
var i;
|
1599
1474
|
var ilen;
|
1600
|
-
|
1601
1475
|
for (i = 0, ilen = input.length; i < ilen; i++) {
|
1602
1476
|
changes.push([input[i][0], input[i][1], dataSource.getAtCell(this.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]);
|
1603
1477
|
}
|
1604
|
-
|
1605
1478
|
if (!changeSource && _typeof(row) === 'object') {
|
1606
1479
|
changeSource = prop;
|
1607
1480
|
}
|
1608
|
-
|
1609
1481
|
instance.runHooks('afterSetDataAtRowProp', changes, changeSource);
|
1610
1482
|
validateChanges(changes, changeSource, function () {
|
1611
1483
|
applyChanges(changes, changeSource);
|
1612
1484
|
});
|
1613
1485
|
};
|
1486
|
+
|
1614
1487
|
/**
|
1615
1488
|
* Listen to the keyboard input on document body. This allows Handsontable to capture keyboard events and respond
|
1616
1489
|
* in the right way.
|
@@ -1619,14 +1492,13 @@ export default function Core(rootElement, userSettings) {
|
|
1619
1492
|
* @function listen
|
1620
1493
|
* @fires Hooks#afterListen
|
1621
1494
|
*/
|
1622
|
-
|
1623
|
-
|
1624
1495
|
this.listen = function () {
|
1625
1496
|
if (instance && !instance.isListening()) {
|
1626
1497
|
activeGuid = instance.guid;
|
1627
1498
|
instance.runHooks('afterListen');
|
1628
1499
|
}
|
1629
1500
|
};
|
1501
|
+
|
1630
1502
|
/**
|
1631
1503
|
* Stop listening to keyboard input on the document body. Calling this method makes the Handsontable inactive for
|
1632
1504
|
* any keyboard events.
|
@@ -1634,14 +1506,13 @@ export default function Core(rootElement, userSettings) {
|
|
1634
1506
|
* @memberof Core#
|
1635
1507
|
* @function unlisten
|
1636
1508
|
*/
|
1637
|
-
|
1638
|
-
|
1639
1509
|
this.unlisten = function () {
|
1640
1510
|
if (this.isListening()) {
|
1641
1511
|
activeGuid = null;
|
1642
1512
|
instance.runHooks('afterUnlisten');
|
1643
1513
|
}
|
1644
1514
|
};
|
1515
|
+
|
1645
1516
|
/**
|
1646
1517
|
* Returns `true` if the current Handsontable instance is listening to keyboard input on document body.
|
1647
1518
|
*
|
@@ -1649,11 +1520,10 @@ export default function Core(rootElement, userSettings) {
|
|
1649
1520
|
* @function isListening
|
1650
1521
|
* @returns {boolean} `true` if the instance is listening, `false` otherwise.
|
1651
1522
|
*/
|
1652
|
-
|
1653
|
-
|
1654
1523
|
this.isListening = function () {
|
1655
1524
|
return activeGuid === instance.guid;
|
1656
1525
|
};
|
1526
|
+
|
1657
1527
|
/**
|
1658
1528
|
* Destroys the current editor, render the table and prepares the editor of the newly selected cell.
|
1659
1529
|
*
|
@@ -1662,18 +1532,18 @@ export default function Core(rootElement, userSettings) {
|
|
1662
1532
|
* @param {boolean} [revertOriginal=false] If `true`, the previous value will be restored. Otherwise, the edited value will be saved.
|
1663
1533
|
* @param {boolean} [prepareEditorIfNeeded=true] If `true` the editor under the selected cell will be prepared to open.
|
1664
1534
|
*/
|
1665
|
-
|
1666
|
-
|
1667
1535
|
this.destroyEditor = function () {
|
1668
1536
|
var revertOriginal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
1669
1537
|
var prepareEditorIfNeeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
1670
|
-
|
1671
1538
|
instance._refreshBorders(revertOriginal, prepareEditorIfNeeded);
|
1672
1539
|
};
|
1540
|
+
|
1673
1541
|
/**
|
1674
|
-
*
|
1542
|
+
* Populates cells at position with 2D input array (e.g. `[[1, 2], [3, 4]]`). Use `endRow`, `endCol` when you
|
1675
1543
|
* want to cut input when a certain row is reached.
|
1676
1544
|
*
|
1545
|
+
* The `populateFromArray()` method can't change [`readOnly`](@/api/options.md#readonly) cells.
|
1546
|
+
*
|
1677
1547
|
* Optional `method` argument has the same effect as pasteMode option (see {@link Options#pasteMode}).
|
1678
1548
|
*
|
1679
1549
|
* @memberof Core#
|
@@ -1690,8 +1560,6 @@ export default function Core(rootElement, userSettings) {
|
|
1690
1560
|
* Useful **only** when the type of handled cells is `numeric`.
|
1691
1561
|
* @returns {object|undefined} Ending td in pasted area (only if any cell was changed).
|
1692
1562
|
*/
|
1693
|
-
|
1694
|
-
|
1695
1563
|
this.populateFromArray = function (row, column, input, endRow, endCol, source, method, direction, deltas) {
|
1696
1564
|
if (!(_typeof(input) === 'object' && _typeof(input[0]) === 'object')) {
|
1697
1565
|
throw new Error('populateFromArray parameter `input` must be an array of arrays'); // API changed in 0.9-beta2, let's check if you use it correctly
|
@@ -1700,6 +1568,7 @@ export default function Core(rootElement, userSettings) {
|
|
1700
1568
|
var c = typeof endRow === 'number' ? instance._createCellCoords(endRow, endCol) : null;
|
1701
1569
|
return grid.populateFromArray(instance._createCellCoords(row, column), input, c, source, method, direction, deltas);
|
1702
1570
|
};
|
1571
|
+
|
1703
1572
|
/**
|
1704
1573
|
* Adds/removes data from the column. This method works the same as Array.splice for arrays.
|
1705
1574
|
*
|
@@ -1711,17 +1580,14 @@ export default function Core(rootElement, userSettings) {
|
|
1711
1580
|
* @param {...number} [elements] The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array.
|
1712
1581
|
* @returns {Array} Returns removed portion of columns.
|
1713
1582
|
*/
|
1714
|
-
|
1715
|
-
|
1716
1583
|
this.spliceCol = function (column, index, amount) {
|
1717
1584
|
var _datamap;
|
1718
|
-
|
1719
1585
|
for (var _len = arguments.length, elements = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
1720
1586
|
elements[_key - 3] = arguments[_key];
|
1721
1587
|
}
|
1722
|
-
|
1723
1588
|
return (_datamap = datamap).spliceCol.apply(_datamap, [column, index, amount].concat(elements));
|
1724
1589
|
};
|
1590
|
+
|
1725
1591
|
/**
|
1726
1592
|
* Adds/removes data from the row. This method works the same as Array.splice for arrays.
|
1727
1593
|
*
|
@@ -1733,17 +1599,14 @@ export default function Core(rootElement, userSettings) {
|
|
1733
1599
|
* @param {...number} [elements] The elements to add to the array. If you don't specify any elements, spliceCol simply removes elements from the array.
|
1734
1600
|
* @returns {Array} Returns removed portion of rows.
|
1735
1601
|
*/
|
1736
|
-
|
1737
|
-
|
1738
1602
|
this.spliceRow = function (row, index, amount) {
|
1739
1603
|
var _datamap2;
|
1740
|
-
|
1741
1604
|
for (var _len2 = arguments.length, elements = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
|
1742
1605
|
elements[_key2 - 3] = arguments[_key2];
|
1743
1606
|
}
|
1744
|
-
|
1745
1607
|
return (_datamap2 = datamap).spliceRow.apply(_datamap2, [row, index, amount].concat(elements));
|
1746
1608
|
};
|
1609
|
+
|
1747
1610
|
/**
|
1748
1611
|
* Returns indexes of the currently selected cells as an array of arrays `[[startRow, startCol, endRow, endCol],...]`.
|
1749
1612
|
*
|
@@ -1757,18 +1620,17 @@ export default function Core(rootElement, userSettings) {
|
|
1757
1620
|
* @function getSelected
|
1758
1621
|
* @returns {Array[]|undefined} An array of arrays of the selection's coordinates.
|
1759
1622
|
*/
|
1760
|
-
|
1761
|
-
|
1762
1623
|
this.getSelected = function () {
|
1763
1624
|
// https://github.com/handsontable/handsontable/issues/44 //cjl
|
1764
1625
|
if (selection.isSelected()) {
|
1765
1626
|
return arrayMap(selection.getSelectedRange(), function (_ref12) {
|
1766
1627
|
var from = _ref12.from,
|
1767
|
-
|
1628
|
+
to = _ref12.to;
|
1768
1629
|
return [from.row, from.col, to.row, to.col];
|
1769
1630
|
});
|
1770
1631
|
}
|
1771
1632
|
};
|
1633
|
+
|
1772
1634
|
/**
|
1773
1635
|
* Returns the last coordinates applied to the table as a an array `[startRow, startCol, endRow, endCol]`.
|
1774
1636
|
*
|
@@ -1777,18 +1639,15 @@ export default function Core(rootElement, userSettings) {
|
|
1777
1639
|
* @function getSelectedLast
|
1778
1640
|
* @returns {Array|undefined} An array of the selection's coordinates.
|
1779
1641
|
*/
|
1780
|
-
|
1781
|
-
|
1782
1642
|
this.getSelectedLast = function () {
|
1783
1643
|
var selected = this.getSelected();
|
1784
1644
|
var result;
|
1785
|
-
|
1786
1645
|
if (selected && selected.length > 0) {
|
1787
1646
|
result = selected[selected.length - 1];
|
1788
1647
|
}
|
1789
|
-
|
1790
1648
|
return result;
|
1791
1649
|
};
|
1650
|
+
|
1792
1651
|
/**
|
1793
1652
|
* Returns the current selection as an array of CellRange objects.
|
1794
1653
|
*
|
@@ -1800,14 +1659,13 @@ export default function Core(rootElement, userSettings) {
|
|
1800
1659
|
* @function getSelectedRange
|
1801
1660
|
* @returns {CellRange[]|undefined} Selected range object or undefined if there is no selection.
|
1802
1661
|
*/
|
1803
|
-
|
1804
|
-
|
1805
1662
|
this.getSelectedRange = function () {
|
1806
1663
|
// https://github.com/handsontable/handsontable/issues/44 //cjl
|
1807
1664
|
if (selection.isSelected()) {
|
1808
1665
|
return Array.from(selection.getSelectedRange());
|
1809
1666
|
}
|
1810
1667
|
};
|
1668
|
+
|
1811
1669
|
/**
|
1812
1670
|
* Returns the last coordinates applied to the table as a CellRange object.
|
1813
1671
|
*
|
@@ -1816,18 +1674,15 @@ export default function Core(rootElement, userSettings) {
|
|
1816
1674
|
* @since 0.36.0
|
1817
1675
|
* @returns {CellRange|undefined} Selected range object or undefined` if there is no selection.
|
1818
1676
|
*/
|
1819
|
-
|
1820
|
-
|
1821
1677
|
this.getSelectedRangeLast = function () {
|
1822
1678
|
var selectedRange = this.getSelectedRange();
|
1823
1679
|
var result;
|
1824
|
-
|
1825
1680
|
if (selectedRange && selectedRange.length > 0) {
|
1826
1681
|
result = selectedRange[selectedRange.length - 1];
|
1827
1682
|
}
|
1828
|
-
|
1829
1683
|
return result;
|
1830
1684
|
};
|
1685
|
+
|
1831
1686
|
/**
|
1832
1687
|
* Erases content from cells that have been selected in the table.
|
1833
1688
|
*
|
@@ -1836,15 +1691,11 @@ export default function Core(rootElement, userSettings) {
|
|
1836
1691
|
* @param {string} [source] String that identifies how this change will be described in the changes array (useful in afterChange or beforeChange callback). Set to 'edit' if left empty.
|
1837
1692
|
* @since 0.36.0
|
1838
1693
|
*/
|
1839
|
-
|
1840
|
-
|
1841
1694
|
this.emptySelectedCells = function (source) {
|
1842
1695
|
var _this2 = this;
|
1843
|
-
|
1844
1696
|
if (!selection.isSelected() || this.countRows() === 0 || this.countCols() === 0) {
|
1845
1697
|
return;
|
1846
1698
|
}
|
1847
|
-
|
1848
1699
|
var changes = [];
|
1849
1700
|
arrayEach(selection.getSelectedRange(), function (cellRange) {
|
1850
1701
|
var topStart = cellRange.getTopStartCorner();
|
@@ -1857,11 +1708,11 @@ export default function Core(rootElement, userSettings) {
|
|
1857
1708
|
});
|
1858
1709
|
});
|
1859
1710
|
});
|
1860
|
-
|
1861
1711
|
if (changes.length > 0) {
|
1862
1712
|
this.setDataAtCell(changes, source);
|
1863
1713
|
}
|
1864
1714
|
};
|
1715
|
+
|
1865
1716
|
/**
|
1866
1717
|
* Checks if the table rendering process was suspended. See explanation in {@link Core#suspendRender}.
|
1867
1718
|
*
|
@@ -1870,11 +1721,10 @@ export default function Core(rootElement, userSettings) {
|
|
1870
1721
|
* @since 8.3.0
|
1871
1722
|
* @returns {boolean}
|
1872
1723
|
*/
|
1873
|
-
|
1874
|
-
|
1875
1724
|
this.isRenderSuspended = function () {
|
1876
1725
|
return this.renderSuspendedCounter > 0;
|
1877
1726
|
};
|
1727
|
+
|
1878
1728
|
/**
|
1879
1729
|
* Suspends the rendering process. It's helpful to wrap the table render
|
1880
1730
|
* cycles triggered by API calls or UI actions (or both) and call the "render"
|
@@ -1889,14 +1739,17 @@ export default function Core(rootElement, userSettings) {
|
|
1889
1739
|
* The method is intended to be used by advanced users. Suspending the rendering
|
1890
1740
|
* process could cause visual glitches when wrongly implemented.
|
1891
1741
|
*
|
1742
|
+
* Every [`suspendRender()`](@/api/core.md#suspendrender) call needs to correspond with one [`resumeRender()`](@/api/core.md#resumerender) call.
|
1743
|
+
* For example, if you call [`suspendRender()`](@/api/core.md#suspendrender) 5 times, you need to call [`resumeRender()`](@/api/core.md#resumerender) 5 times as well.
|
1744
|
+
*
|
1892
1745
|
* @memberof Core#
|
1893
1746
|
* @function suspendRender
|
1894
1747
|
* @since 8.3.0
|
1895
1748
|
* @example
|
1896
1749
|
* ```js
|
1897
1750
|
* hot.suspendRender();
|
1898
|
-
* hot.alter('
|
1899
|
-
* hot.alter('
|
1751
|
+
* hot.alter('insert_row_above', 5, 45);
|
1752
|
+
* hot.alter('insert_col_start', 10, 40);
|
1900
1753
|
* hot.setDataAtCell(1, 1, 'John');
|
1901
1754
|
* hot.setDataAtCell(2, 2, 'Mark');
|
1902
1755
|
* hot.setDataAtCell(3, 3, 'Ann');
|
@@ -1906,11 +1759,10 @@ export default function Core(rootElement, userSettings) {
|
|
1906
1759
|
* hot.resumeRender(); // It re-renders the table internally
|
1907
1760
|
* ```
|
1908
1761
|
*/
|
1909
|
-
|
1910
|
-
|
1911
1762
|
this.suspendRender = function () {
|
1912
1763
|
this.renderSuspendedCounter += 1;
|
1913
1764
|
};
|
1765
|
+
|
1914
1766
|
/**
|
1915
1767
|
* Resumes the rendering process. In combination with the {@link Core#suspendRender}
|
1916
1768
|
* method it allows aggregating the table render cycles triggered by API calls or UI
|
@@ -1921,14 +1773,17 @@ export default function Core(rootElement, userSettings) {
|
|
1921
1773
|
* The method is intended to be used by advanced users. Suspending the rendering
|
1922
1774
|
* process could cause visual glitches when wrongly implemented.
|
1923
1775
|
*
|
1776
|
+
* Every [`suspendRender()`](@/api/core.md#suspendrender) call needs to correspond with one [`resumeRender()`](@/api/core.md#resumerender) call.
|
1777
|
+
* For example, if you call [`suspendRender()`](@/api/core.md#suspendrender) 5 times, you need to call [`resumeRender()`](@/api/core.md#resumerender) 5 times as well.
|
1778
|
+
*
|
1924
1779
|
* @memberof Core#
|
1925
1780
|
* @function resumeRender
|
1926
1781
|
* @since 8.3.0
|
1927
1782
|
* @example
|
1928
1783
|
* ```js
|
1929
1784
|
* hot.suspendRender();
|
1930
|
-
* hot.alter('
|
1931
|
-
* hot.alter('
|
1785
|
+
* hot.alter('insert_row_above', 5, 45);
|
1786
|
+
* hot.alter('insert_col_start', 10, 40);
|
1932
1787
|
* hot.setDataAtCell(1, 1, 'John');
|
1933
1788
|
* hot.setDataAtCell(2, 2, 'Mark');
|
1934
1789
|
* hot.setDataAtCell(3, 3, 'Ann');
|
@@ -1938,12 +1793,9 @@ export default function Core(rootElement, userSettings) {
|
|
1938
1793
|
* hot.resumeRender(); // It re-renders the table internally
|
1939
1794
|
* ```
|
1940
1795
|
*/
|
1941
|
-
|
1942
|
-
|
1943
1796
|
this.resumeRender = function () {
|
1944
1797
|
var nextValue = this.renderSuspendedCounter - 1;
|
1945
1798
|
this.renderSuspendedCounter = Math.max(nextValue, 0);
|
1946
|
-
|
1947
1799
|
if (!this.isRenderSuspended() && nextValue === this.renderSuspendedCounter) {
|
1948
1800
|
if (this.renderCall) {
|
1949
1801
|
this.render();
|
@@ -1952,6 +1804,7 @@ export default function Core(rootElement, userSettings) {
|
|
1952
1804
|
}
|
1953
1805
|
}
|
1954
1806
|
};
|
1807
|
+
|
1955
1808
|
/**
|
1956
1809
|
* Rerender the table. Calling this method starts the process of recalculating, redrawing and applying the changes
|
1957
1810
|
* to the DOM. While rendering the table all cell renderers are recalled.
|
@@ -1962,8 +1815,6 @@ export default function Core(rootElement, userSettings) {
|
|
1962
1815
|
* @memberof Core#
|
1963
1816
|
* @function render
|
1964
1817
|
*/
|
1965
|
-
|
1966
|
-
|
1967
1818
|
this.render = function () {
|
1968
1819
|
if (this.view) {
|
1969
1820
|
this.renderCall = true;
|
@@ -1971,13 +1822,12 @@ export default function Core(rootElement, userSettings) {
|
|
1971
1822
|
|
1972
1823
|
if (!this.isRenderSuspended()) {
|
1973
1824
|
editorManager.lockEditor();
|
1974
|
-
|
1975
1825
|
this._refreshBorders(null);
|
1976
|
-
|
1977
1826
|
editorManager.unlockEditor();
|
1978
1827
|
}
|
1979
1828
|
}
|
1980
1829
|
};
|
1830
|
+
|
1981
1831
|
/**
|
1982
1832
|
* The method aggregates multi-line API calls into a callback and postpones the
|
1983
1833
|
* table rendering process. After the execution of the operations, the table is
|
@@ -1992,8 +1842,8 @@ export default function Core(rootElement, userSettings) {
|
|
1992
1842
|
* @example
|
1993
1843
|
* ```js
|
1994
1844
|
* hot.batchRender(() => {
|
1995
|
-
* hot.alter('
|
1996
|
-
* hot.alter('
|
1845
|
+
* hot.alter('insert_row_above', 5, 45);
|
1846
|
+
* hot.alter('insert_col_start', 10, 40);
|
1997
1847
|
* hot.setDataAtCell(1, 1, 'John');
|
1998
1848
|
* hot.setDataAtCell(2, 2, 'Mark');
|
1999
1849
|
* hot.setDataAtCell(3, 3, 'Ann');
|
@@ -2004,14 +1854,13 @@ export default function Core(rootElement, userSettings) {
|
|
2004
1854
|
* });
|
2005
1855
|
* ```
|
2006
1856
|
*/
|
2007
|
-
|
2008
|
-
|
2009
1857
|
this.batchRender = function (wrappedOperations) {
|
2010
1858
|
this.suspendRender();
|
2011
1859
|
var result = wrappedOperations();
|
2012
1860
|
this.resumeRender();
|
2013
1861
|
return result;
|
2014
1862
|
};
|
1863
|
+
|
2015
1864
|
/**
|
2016
1865
|
* Checks if the table indexes recalculation process was suspended. See explanation
|
2017
1866
|
* in {@link Core#suspendExecution}.
|
@@ -2021,11 +1870,10 @@ export default function Core(rootElement, userSettings) {
|
|
2021
1870
|
* @since 8.3.0
|
2022
1871
|
* @returns {boolean}
|
2023
1872
|
*/
|
2024
|
-
|
2025
|
-
|
2026
1873
|
this.isExecutionSuspended = function () {
|
2027
1874
|
return this.executionSuspendedCounter > 0;
|
2028
1875
|
};
|
1876
|
+
|
2029
1877
|
/**
|
2030
1878
|
* Suspends the execution process. It's helpful to wrap the table logic changes
|
2031
1879
|
* such as index changes into one call after which the cache is updated. As a result,
|
@@ -2048,13 +1896,12 @@ export default function Core(rootElement, userSettings) {
|
|
2048
1896
|
* hot.resumeExecution(); // It updates the cache internally
|
2049
1897
|
* ```
|
2050
1898
|
*/
|
2051
|
-
|
2052
|
-
|
2053
1899
|
this.suspendExecution = function () {
|
2054
1900
|
this.executionSuspendedCounter += 1;
|
2055
1901
|
this.columnIndexMapper.suspendOperations();
|
2056
1902
|
this.rowIndexMapper.suspendOperations();
|
2057
1903
|
};
|
1904
|
+
|
2058
1905
|
/**
|
2059
1906
|
* Resumes the execution process. In combination with the {@link Core#suspendExecution}
|
2060
1907
|
* method it allows aggregating the table logic changes after which the cache is
|
@@ -2081,18 +1928,16 @@ export default function Core(rootElement, userSettings) {
|
|
2081
1928
|
* hot.resumeExecution(); // It updates the cache internally
|
2082
1929
|
* ```
|
2083
1930
|
*/
|
2084
|
-
|
2085
|
-
|
2086
1931
|
this.resumeExecution = function () {
|
2087
1932
|
var forceFlushChanges = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
2088
1933
|
var nextValue = this.executionSuspendedCounter - 1;
|
2089
1934
|
this.executionSuspendedCounter = Math.max(nextValue, 0);
|
2090
|
-
|
2091
1935
|
if (!this.isExecutionSuspended() && nextValue === this.executionSuspendedCounter || forceFlushChanges) {
|
2092
1936
|
this.columnIndexMapper.resumeOperations();
|
2093
1937
|
this.rowIndexMapper.resumeOperations();
|
2094
1938
|
}
|
2095
1939
|
};
|
1940
|
+
|
2096
1941
|
/**
|
2097
1942
|
* The method aggregates multi-line API calls into a callback and postpones the
|
2098
1943
|
* table execution process. After the execution of the operations, the internal table
|
@@ -2119,8 +1964,6 @@ export default function Core(rootElement, userSettings) {
|
|
2119
1964
|
* });
|
2120
1965
|
* ```
|
2121
1966
|
*/
|
2122
|
-
|
2123
|
-
|
2124
1967
|
this.batchExecution = function (wrappedOperations) {
|
2125
1968
|
var forceFlushChanges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
2126
1969
|
this.suspendExecution();
|
@@ -2128,6 +1971,7 @@ export default function Core(rootElement, userSettings) {
|
|
2128
1971
|
this.resumeExecution(forceFlushChanges);
|
2129
1972
|
return result;
|
2130
1973
|
};
|
1974
|
+
|
2131
1975
|
/**
|
2132
1976
|
* It batches the rendering process and index recalculations. The method aggregates
|
2133
1977
|
* multi-line API calls into a callback and postpones the table rendering process
|
@@ -2144,8 +1988,8 @@ export default function Core(rootElement, userSettings) {
|
|
2144
1988
|
* @example
|
2145
1989
|
* ```js
|
2146
1990
|
* hot.batch(() => {
|
2147
|
-
* hot.alter('
|
2148
|
-
* hot.alter('
|
1991
|
+
* hot.alter('insert_row_above', 5, 45);
|
1992
|
+
* hot.alter('insert_col_start', 10, 40);
|
2149
1993
|
* hot.setDataAtCell(1, 1, 'x');
|
2150
1994
|
* hot.setDataAtCell(2, 2, 'c');
|
2151
1995
|
* hot.setDataAtCell(3, 3, 'v');
|
@@ -2162,8 +2006,6 @@ export default function Core(rootElement, userSettings) {
|
|
2162
2006
|
* });
|
2163
2007
|
* ```
|
2164
2008
|
*/
|
2165
|
-
|
2166
|
-
|
2167
2009
|
this.batch = function (wrappedOperations) {
|
2168
2010
|
this.suspendRender();
|
2169
2011
|
this.suspendExecution();
|
@@ -2172,6 +2014,7 @@ export default function Core(rootElement, userSettings) {
|
|
2172
2014
|
this.resumeRender();
|
2173
2015
|
return result;
|
2174
2016
|
};
|
2017
|
+
|
2175
2018
|
/**
|
2176
2019
|
* Updates dimensions of the table. The method compares previous dimensions with the current ones and updates accordingly.
|
2177
2020
|
*
|
@@ -2180,21 +2023,16 @@ export default function Core(rootElement, userSettings) {
|
|
2180
2023
|
* @fires Hooks#beforeRefreshDimensions
|
2181
2024
|
* @fires Hooks#afterRefreshDimensions
|
2182
2025
|
*/
|
2183
|
-
|
2184
|
-
|
2185
2026
|
this.refreshDimensions = function () {
|
2186
2027
|
if (!instance.view) {
|
2187
2028
|
return;
|
2188
2029
|
}
|
2189
|
-
|
2190
2030
|
var _instance$view$getLas = instance.view.getLastSize(),
|
2191
|
-
|
2192
|
-
|
2193
|
-
|
2031
|
+
lastWidth = _instance$view$getLas.width,
|
2032
|
+
lastHeight = _instance$view$getLas.height;
|
2194
2033
|
var _instance$rootElement = instance.rootElement.getBoundingClientRect(),
|
2195
|
-
|
2196
|
-
|
2197
|
-
|
2034
|
+
width = _instance$rootElement.width,
|
2035
|
+
height = _instance$rootElement.height;
|
2198
2036
|
var isSizeChanged = width !== lastWidth || height !== lastHeight;
|
2199
2037
|
var isResizeBlocked = instance.runHooks('beforeRefreshDimensions', {
|
2200
2038
|
width: lastWidth,
|
@@ -2203,16 +2041,13 @@ export default function Core(rootElement, userSettings) {
|
|
2203
2041
|
width: width,
|
2204
2042
|
height: height
|
2205
2043
|
}, isSizeChanged) === false;
|
2206
|
-
|
2207
2044
|
if (isResizeBlocked) {
|
2208
2045
|
return;
|
2209
2046
|
}
|
2210
|
-
|
2211
2047
|
if (isSizeChanged || instance.view._wt.wtOverlays.scrollableElement === instance.rootWindow) {
|
2212
2048
|
instance.view.setLastSize(width, height);
|
2213
2049
|
instance.render();
|
2214
2050
|
}
|
2215
|
-
|
2216
2051
|
instance.runHooks('afterRefreshDimensions', {
|
2217
2052
|
width: lastWidth,
|
2218
2053
|
height: lastHeight
|
@@ -2221,6 +2056,7 @@ export default function Core(rootElement, userSettings) {
|
|
2221
2056
|
height: height
|
2222
2057
|
}, isSizeChanged);
|
2223
2058
|
};
|
2059
|
+
|
2224
2060
|
/**
|
2225
2061
|
* The `updateData()` method replaces Handsontable's [`data`](@/api/options.md#data) with a new dataset.
|
2226
2062
|
*
|
@@ -2244,11 +2080,8 @@ export default function Core(rootElement, userSettings) {
|
|
2244
2080
|
* @fires Hooks#afterUpdateData
|
2245
2081
|
* @fires Hooks#afterChange
|
2246
2082
|
*/
|
2247
|
-
|
2248
|
-
|
2249
2083
|
this.updateData = function (data, source) {
|
2250
2084
|
var _this3 = this;
|
2251
|
-
|
2252
2085
|
replaceData(data, function (newDataMap) {
|
2253
2086
|
datamap = newDataMap;
|
2254
2087
|
}, function (newDataMap) {
|
@@ -2265,6 +2098,7 @@ export default function Core(rootElement, userSettings) {
|
|
2265
2098
|
firstRun: firstRun
|
2266
2099
|
});
|
2267
2100
|
};
|
2101
|
+
|
2268
2102
|
/**
|
2269
2103
|
* The `loadData()` method replaces Handsontable's [`data`](@/api/options.md#data) with a new dataset.
|
2270
2104
|
*
|
@@ -2287,8 +2121,6 @@ export default function Core(rootElement, userSettings) {
|
|
2287
2121
|
* @fires Hooks#afterLoadData
|
2288
2122
|
* @fires Hooks#afterChange
|
2289
2123
|
*/
|
2290
|
-
|
2291
|
-
|
2292
2124
|
this.loadData = function (data, source) {
|
2293
2125
|
replaceData(data, function (newDataMap) {
|
2294
2126
|
datamap = newDataMap;
|
@@ -2296,7 +2128,6 @@ export default function Core(rootElement, userSettings) {
|
|
2296
2128
|
metaManager.clearCellsCache();
|
2297
2129
|
instance.initIndexMappers();
|
2298
2130
|
grid.adjustRowsAndCols();
|
2299
|
-
|
2300
2131
|
if (firstRun) {
|
2301
2132
|
firstRun = [null, 'loadData'];
|
2302
2133
|
}
|
@@ -2309,57 +2140,58 @@ export default function Core(rootElement, userSettings) {
|
|
2309
2140
|
firstRun: firstRun
|
2310
2141
|
});
|
2311
2142
|
};
|
2143
|
+
|
2312
2144
|
/**
|
2313
2145
|
* Gets the initial column count, calculated based on the `columns` setting.
|
2314
2146
|
*
|
2315
2147
|
* @private
|
2316
2148
|
* @returns {number} The calculated number of columns.
|
2317
2149
|
*/
|
2318
|
-
|
2319
|
-
|
2320
2150
|
this.getInitialColumnCount = function () {
|
2321
2151
|
var columnsSettings = tableMeta.columns;
|
2322
|
-
var finalNrOfColumns = 0;
|
2323
|
-
// narrow down or expand displayed dataset in that case.
|
2152
|
+
var finalNrOfColumns = 0;
|
2324
2153
|
|
2154
|
+
// We will check number of columns when the `columns` property was defined as an array. Columns option may
|
2155
|
+
// narrow down or expand displayed dataset in that case.
|
2325
2156
|
if (Array.isArray(columnsSettings)) {
|
2326
2157
|
finalNrOfColumns = columnsSettings.length;
|
2327
2158
|
} else if (isFunction(columnsSettings)) {
|
2328
2159
|
if (instance.dataType === 'array') {
|
2329
2160
|
var nrOfSourceColumns = this.countSourceCols();
|
2330
|
-
|
2331
2161
|
for (var columnIndex = 0; columnIndex < nrOfSourceColumns; columnIndex += 1) {
|
2332
2162
|
if (columnsSettings(columnIndex)) {
|
2333
2163
|
finalNrOfColumns += 1;
|
2334
2164
|
}
|
2335
|
-
}
|
2165
|
+
}
|
2336
2166
|
|
2167
|
+
// Extended dataset by the `columns` property? Moved code right from the refactored `countCols` method.
|
2337
2168
|
} else if (instance.dataType === 'object' || instance.dataType === 'function') {
|
2338
2169
|
finalNrOfColumns = datamap.colToPropCache.length;
|
2339
|
-
}
|
2170
|
+
}
|
2340
2171
|
|
2172
|
+
// In some cases we need to check columns length from the schema, i.e. `data` may be empty.
|
2341
2173
|
} else if (isDefined(tableMeta.dataSchema)) {
|
2342
|
-
var schema = datamap.getSchema();
|
2174
|
+
var schema = datamap.getSchema();
|
2343
2175
|
|
2176
|
+
// Schema may be defined as an array of objects. Each object will define column.
|
2344
2177
|
finalNrOfColumns = Array.isArray(schema) ? schema.length : deepObjectSize(schema);
|
2345
2178
|
} else {
|
2346
2179
|
// We init index mappers by length of source data to provide indexes also for skipped indexes.
|
2347
2180
|
finalNrOfColumns = this.countSourceCols();
|
2348
2181
|
}
|
2349
|
-
|
2350
2182
|
return finalNrOfColumns;
|
2351
2183
|
};
|
2184
|
+
|
2352
2185
|
/**
|
2353
2186
|
* Init index mapper which manage indexes assigned to the data.
|
2354
2187
|
*
|
2355
2188
|
* @private
|
2356
2189
|
*/
|
2357
|
-
|
2358
|
-
|
2359
2190
|
this.initIndexMappers = function () {
|
2360
2191
|
this.columnIndexMapper.initToLength(this.getInitialColumnCount());
|
2361
2192
|
this.rowIndexMapper.initToLength(this.countSourceRows());
|
2362
2193
|
};
|
2194
|
+
|
2363
2195
|
/**
|
2364
2196
|
* Returns the current data object (the same one that was passed by `data` configuration option or `loadData` method,
|
2365
2197
|
* unless some modifications have been applied (i.e. Sequence of rows/columns was changed, some row/column was skipped).
|
@@ -2384,15 +2216,13 @@ export default function Core(rootElement, userSettings) {
|
|
2384
2216
|
* hot.getData(2, 1, 3, 3);
|
2385
2217
|
* ```
|
2386
2218
|
*/
|
2387
|
-
|
2388
|
-
|
2389
2219
|
this.getData = function (row, column, row2, column2) {
|
2390
2220
|
if (isUndefined(row)) {
|
2391
2221
|
return datamap.getAll();
|
2392
2222
|
}
|
2393
|
-
|
2394
2223
|
return datamap.getRange(instance._createCellCoords(row, column), instance._createCellCoords(row2, column2), datamap.DESTINATION_RENDERER);
|
2395
2224
|
};
|
2225
|
+
|
2396
2226
|
/**
|
2397
2227
|
* Returns a string value of the selected range. Each column is separated by tab, each row is separated by a new
|
2398
2228
|
* line character.
|
@@ -2405,11 +2235,10 @@ export default function Core(rootElement, userSettings) {
|
|
2405
2235
|
* @param {number} endCol To visual column index.
|
2406
2236
|
* @returns {string}
|
2407
2237
|
*/
|
2408
|
-
|
2409
|
-
|
2410
2238
|
this.getCopyableText = function (startRow, startCol, endRow, endCol) {
|
2411
2239
|
return datamap.getCopyableText(instance._createCellCoords(startRow, startCol), instance._createCellCoords(endRow, endCol));
|
2412
2240
|
};
|
2241
|
+
|
2413
2242
|
/**
|
2414
2243
|
* Returns the data's copyable value at specified `row` and `column` index.
|
2415
2244
|
*
|
@@ -2419,11 +2248,10 @@ export default function Core(rootElement, userSettings) {
|
|
2419
2248
|
* @param {number} column Visual column index.
|
2420
2249
|
* @returns {string}
|
2421
2250
|
*/
|
2422
|
-
|
2423
|
-
|
2424
2251
|
this.getCopyableData = function (row, column) {
|
2425
2252
|
return datamap.getCopyable(row, datamap.colToProp(column));
|
2426
2253
|
};
|
2254
|
+
|
2427
2255
|
/**
|
2428
2256
|
* Returns schema provided by constructor settings. If it doesn't exist then it returns the schema based on the data
|
2429
2257
|
* structure in the first row.
|
@@ -2432,11 +2260,10 @@ export default function Core(rootElement, userSettings) {
|
|
2432
2260
|
* @function getSchema
|
2433
2261
|
* @returns {object} Schema object.
|
2434
2262
|
*/
|
2435
|
-
|
2436
|
-
|
2437
2263
|
this.getSchema = function () {
|
2438
2264
|
return datamap.getSchema();
|
2439
2265
|
};
|
2266
|
+
|
2440
2267
|
/**
|
2441
2268
|
* Use it if you need to change configuration after initialization. The `settings` argument is an object containing the changed
|
2442
2269
|
* settings, declared the same way as in the initial settings object.
|
@@ -2465,37 +2292,32 @@ export default function Core(rootElement, userSettings) {
|
|
2465
2292
|
* @fires Hooks#afterCellMetaReset
|
2466
2293
|
* @fires Hooks#afterUpdateSettings
|
2467
2294
|
*/
|
2468
|
-
|
2469
|
-
|
2470
2295
|
this.updateSettings = function (settings) {
|
2471
2296
|
var init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
2472
2297
|
var dataUpdateFunction = (firstRun ? instance.loadData : instance.updateData).bind(this);
|
2473
2298
|
var columnsAsFunc = false;
|
2474
2299
|
var i;
|
2475
2300
|
var j;
|
2476
|
-
|
2477
2301
|
if (isDefined(settings.rows)) {
|
2478
2302
|
throw new Error('The "rows" setting is no longer supported. Do you mean startRows, minRows or maxRows?');
|
2479
2303
|
}
|
2480
|
-
|
2481
2304
|
if (isDefined(settings.cols)) {
|
2482
2305
|
throw new Error('The "cols" setting is no longer supported. Do you mean startCols, minCols or maxCols?');
|
2483
2306
|
}
|
2484
|
-
|
2485
2307
|
if (isDefined(settings.ganttChart)) {
|
2486
2308
|
throw new Error('Since 8.0.0 the "ganttChart" setting is no longer supported.');
|
2487
|
-
}
|
2488
|
-
|
2309
|
+
}
|
2489
2310
|
|
2311
|
+
// eslint-disable-next-line no-restricted-syntax
|
2490
2312
|
for (i in settings) {
|
2491
|
-
if (i === 'data') {
|
2313
|
+
if (i === 'data') {
|
2314
|
+
// Do nothing. loadData will be triggered later
|
2492
2315
|
} else if (i === 'language') {
|
2493
2316
|
setLanguage(settings.language);
|
2494
2317
|
} else if (i === 'className') {
|
2495
2318
|
setClassName('className', settings.className);
|
2496
2319
|
} else if (i === 'tableClassName' && instance.table) {
|
2497
2320
|
setClassName('tableClassName', settings.tableClassName);
|
2498
|
-
|
2499
2321
|
instance.view._wt.wtOverlays.syncOverlayTableClassNames();
|
2500
2322
|
} else if (Hooks.getSingleton().isRegistered(i) || Hooks.getSingleton().isDeprecated(i)) {
|
2501
2323
|
if (isFunction(settings[i]) || Array.isArray(settings[i])) {
|
@@ -2506,76 +2328,65 @@ export default function Core(rootElement, userSettings) {
|
|
2506
2328
|
// Update settings
|
2507
2329
|
globalMeta[i] = settings[i];
|
2508
2330
|
}
|
2509
|
-
}
|
2510
|
-
|
2331
|
+
}
|
2511
2332
|
|
2333
|
+
// Load data or create data map
|
2512
2334
|
if (settings.data === void 0 && tableMeta.data === void 0) {
|
2513
2335
|
dataUpdateFunction(null, 'updateSettings'); // data source created just now
|
2514
2336
|
} else if (settings.data !== void 0) {
|
2515
2337
|
dataUpdateFunction(settings.data, 'updateSettings'); // data source given as option
|
2516
2338
|
} else if (settings.columns !== void 0) {
|
2517
|
-
datamap.createMap();
|
2339
|
+
datamap.createMap();
|
2518
2340
|
|
2341
|
+
// The `column` property has changed - dataset may be expanded or narrowed down. The `loadData` do the same.
|
2519
2342
|
instance.initIndexMappers();
|
2520
2343
|
}
|
2521
|
-
|
2522
2344
|
var clen = instance.countCols();
|
2523
|
-
var columnSetting = tableMeta.columns;
|
2345
|
+
var columnSetting = tableMeta.columns;
|
2524
2346
|
|
2347
|
+
// Init columns constructors configuration
|
2525
2348
|
if (columnSetting && isFunction(columnSetting)) {
|
2526
2349
|
columnsAsFunc = true;
|
2527
|
-
}
|
2528
|
-
|
2350
|
+
}
|
2529
2351
|
|
2352
|
+
// Clear cell meta cache
|
2530
2353
|
if (settings.cell !== void 0 || settings.cells !== void 0 || settings.columns !== void 0) {
|
2531
2354
|
metaManager.clearCache();
|
2532
2355
|
}
|
2533
|
-
|
2534
2356
|
if (clen > 0) {
|
2535
2357
|
for (i = 0, j = 0; i < clen; i++) {
|
2536
2358
|
// Use settings provided by user
|
2537
2359
|
if (columnSetting) {
|
2538
2360
|
var column = columnsAsFunc ? columnSetting(i) : columnSetting[j];
|
2539
|
-
|
2540
2361
|
if (column) {
|
2541
2362
|
metaManager.updateColumnMeta(j, column);
|
2542
2363
|
}
|
2543
2364
|
}
|
2544
|
-
|
2545
2365
|
j += 1;
|
2546
2366
|
}
|
2547
2367
|
}
|
2548
|
-
|
2549
2368
|
if (isDefined(settings.cell)) {
|
2550
2369
|
objectEach(settings.cell, function (cell) {
|
2551
2370
|
instance.setCellMetaObject(cell.row, cell.col, cell);
|
2552
2371
|
});
|
2553
2372
|
}
|
2554
|
-
|
2555
2373
|
instance.runHooks('afterCellMetaReset');
|
2556
2374
|
var currentHeight = instance.rootElement.style.height;
|
2557
|
-
|
2558
2375
|
if (currentHeight !== '') {
|
2559
2376
|
currentHeight = parseInt(instance.rootElement.style.height, 10);
|
2560
2377
|
}
|
2561
|
-
|
2562
2378
|
var height = settings.height;
|
2563
|
-
|
2564
2379
|
if (isFunction(height)) {
|
2565
2380
|
height = height();
|
2566
2381
|
}
|
2567
|
-
|
2568
2382
|
if (init) {
|
2569
2383
|
var initialStyle = instance.rootElement.getAttribute('style');
|
2570
|
-
|
2571
2384
|
if (initialStyle) {
|
2572
2385
|
instance.rootElement.setAttribute('data-initialstyle', instance.rootElement.getAttribute('style'));
|
2573
2386
|
}
|
2574
2387
|
}
|
2575
|
-
|
2576
2388
|
if (height === null) {
|
2577
2389
|
var _initialStyle = instance.rootElement.getAttribute('data-initialstyle');
|
2578
|
-
|
2579
2390
|
if (_initialStyle && (_initialStyle.indexOf('height') > -1 || _initialStyle.indexOf('overflow') > -1)) {
|
2580
2391
|
instance.rootElement.setAttribute('style', _initialStyle);
|
2581
2392
|
} else {
|
@@ -2586,45 +2397,33 @@ export default function Core(rootElement, userSettings) {
|
|
2586
2397
|
instance.rootElement.style.height = isNaN(height) ? "".concat(height) : "".concat(height, "px");
|
2587
2398
|
instance.rootElement.style.overflow = 'hidden';
|
2588
2399
|
}
|
2589
|
-
|
2590
2400
|
if (typeof settings.width !== 'undefined') {
|
2591
2401
|
var width = settings.width;
|
2592
|
-
|
2593
2402
|
if (isFunction(width)) {
|
2594
2403
|
width = width();
|
2595
2404
|
}
|
2596
|
-
|
2597
2405
|
instance.rootElement.style.width = isNaN(width) ? "".concat(width) : "".concat(width, "px");
|
2598
2406
|
}
|
2599
|
-
|
2600
2407
|
if (!init) {
|
2601
2408
|
if (instance.view) {
|
2602
2409
|
instance.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked();
|
2603
|
-
|
2604
2410
|
instance.view._wt.exportSettingsAsClassNames();
|
2605
2411
|
}
|
2606
|
-
|
2607
2412
|
instance.runHooks('afterUpdateSettings', settings);
|
2608
2413
|
}
|
2609
|
-
|
2610
2414
|
grid.adjustRowsAndCols();
|
2611
|
-
|
2612
2415
|
if (instance.view && !firstRun) {
|
2613
2416
|
instance.forceFullRender = true; // used when data was changed
|
2614
|
-
|
2615
2417
|
editorManager.lockEditor();
|
2616
|
-
|
2617
2418
|
instance._refreshBorders(null);
|
2618
|
-
|
2619
2419
|
instance.view._wt.wtOverlays.adjustElementsSize();
|
2620
|
-
|
2621
2420
|
editorManager.unlockEditor();
|
2622
2421
|
}
|
2623
|
-
|
2624
2422
|
if (!init && instance.view && (currentHeight === '' || height === '' || height === void 0) && currentHeight !== height) {
|
2625
2423
|
instance.view._wt.wtOverlays.updateMainScrollableElements();
|
2626
2424
|
}
|
2627
2425
|
};
|
2426
|
+
|
2628
2427
|
/**
|
2629
2428
|
* Get value from the selected cell.
|
2630
2429
|
*
|
@@ -2632,11 +2431,8 @@ export default function Core(rootElement, userSettings) {
|
|
2632
2431
|
* @function getValue
|
2633
2432
|
* @returns {*} Value of selected cell.
|
2634
2433
|
*/
|
2635
|
-
|
2636
|
-
|
2637
2434
|
this.getValue = function () {
|
2638
2435
|
var sel = instance.getSelectedLast();
|
2639
|
-
|
2640
2436
|
if (tableMeta.getValue) {
|
2641
2437
|
if (isFunction(tableMeta.getValue)) {
|
2642
2438
|
return tableMeta.getValue.call(instance);
|
@@ -2647,6 +2443,7 @@ export default function Core(rootElement, userSettings) {
|
|
2647
2443
|
return instance.getDataAtCell(sel[0], sel[1]);
|
2648
2444
|
}
|
2649
2445
|
};
|
2446
|
+
|
2650
2447
|
/**
|
2651
2448
|
* Returns the object settings.
|
2652
2449
|
*
|
@@ -2654,58 +2451,94 @@ export default function Core(rootElement, userSettings) {
|
|
2654
2451
|
* @function getSettings
|
2655
2452
|
* @returns {TableMeta} Object containing the current table settings.
|
2656
2453
|
*/
|
2657
|
-
|
2658
|
-
|
2659
2454
|
this.getSettings = function () {
|
2660
2455
|
return tableMeta;
|
2661
2456
|
};
|
2457
|
+
|
2662
2458
|
/**
|
2663
2459
|
* Clears the data from the table (the table settings remain intact).
|
2664
2460
|
*
|
2665
2461
|
* @memberof Core#
|
2666
2462
|
* @function clear
|
2667
2463
|
*/
|
2668
|
-
|
2669
|
-
|
2670
2464
|
this.clear = function () {
|
2671
2465
|
this.selectAll();
|
2672
2466
|
this.emptySelectedCells();
|
2673
2467
|
};
|
2468
|
+
|
2674
2469
|
/**
|
2675
|
-
*
|
2676
|
-
*
|
2470
|
+
* The `alter()` method lets you alter the grid's structure
|
2471
|
+
* by adding or removing rows and columns at specified positions.
|
2472
|
+
*
|
2473
|
+
* ::: tip
|
2474
|
+
* The `alter()` method works only when your [`data`](@/api/options.md#data)
|
2475
|
+
* is an [array of arrays](@/guides/getting-started/binding-to-data.md#array-of-arrays).
|
2476
|
+
* :::
|
2477
|
+
*
|
2478
|
+
* ```js
|
2479
|
+
* // above row 10 (by visual index), insert 1 new row
|
2480
|
+
* hot.alter('insert_row_above', 10);
|
2481
|
+
* ```
|
2482
|
+
*
|
2483
|
+
* | Action | With `index` | Without `index` |
|
2484
|
+
* | -------------------- | ------------ | --------------- |
|
2485
|
+
* | `'insert_row_above'` | Inserts rows above the `index` row. | Inserts rows above the first row. |
|
2486
|
+
* | `'insert_row_below'` | Inserts rows below the `index` row. | Inserts rows below the last row. |
|
2487
|
+
* | `'remove_row'` | Removes rows, starting from the `index` row. | Removes rows, starting from the last row. |
|
2488
|
+
* | `'insert_col_start'` | Inserts columns before the `index` column. | Inserts columns before the first column. |
|
2489
|
+
* | `'insert_col_end'` | Inserts columns after the `index` column. | Inserts columns after the last column. |
|
2490
|
+
* | `'remove_col'` | Removes columns, starting from the `index` column. | Removes columns, starting from the last column. |
|
2491
|
+
* | `'insert_row'` (<b>Deprecated</b>) | Inserts rows above the `index` row. | Inserts rows below the last row. |
|
2492
|
+
* | `'insert_col'` (<b>Deprecated</b>) | Inserts columns before the `index` column. | Inserts columns after the last column. |
|
2493
|
+
*
|
2494
|
+
* The behavior of `'insert_col_start'`, `'insert_col_end'`, and `'insert_col'` depends on your [`layoutDirection`](@/api/options.md#layoutdirection).
|
2677
2495
|
*
|
2678
2496
|
* @memberof Core#
|
2679
2497
|
* @function alter
|
2680
|
-
* @param {string} action
|
2681
|
-
*
|
2682
|
-
* <li> `'
|
2683
|
-
* <li> `'
|
2684
|
-
* <li> `'remove_row'` </li>
|
2498
|
+
* @param {string} action Available operations:
|
2499
|
+
* <ul>
|
2500
|
+
* <li> `'insert_row_above'` </li>
|
2501
|
+
* <li> `'insert_row_below'` </li>
|
2502
|
+
* <li> `'remove_row'` </li> </li>
|
2503
|
+
* <li> `'insert_col_start'` </li>
|
2504
|
+
* <li> `'insert_col_end'` </li>
|
2685
2505
|
* <li> `'remove_col'` </li>
|
2686
|
-
* </
|
2687
|
-
*
|
2688
|
-
*
|
2689
|
-
* @param {number} [
|
2506
|
+
* <li> `'insert_row'` (<b>Deprecated</b>) </li>
|
2507
|
+
* <li> `'insert_col'` (<b>Deprecated</b>) </li>
|
2508
|
+
* </ul>
|
2509
|
+
* @param {number|number[]} [index] A visual index of the row/column before or after which the new row/column will be
|
2510
|
+
* inserted or removed. Can also be an array of arrays, in format `[[index, amount],...]`.
|
2511
|
+
* @param {number} [amount] The amount of rows or columns to be inserted or removed (default: `1`).
|
2690
2512
|
* @param {string} [source] Source indicator.
|
2691
|
-
* @param {boolean} [keepEmptyRows]
|
2513
|
+
* @param {boolean} [keepEmptyRows] If set to `true`: prevents removing empty rows.
|
2692
2514
|
* @example
|
2693
2515
|
* ```js
|
2694
|
-
* //
|
2695
|
-
* hot.alter('
|
2696
|
-
*
|
2697
|
-
*
|
2698
|
-
*
|
2516
|
+
* // above row 10 (by visual index), insert 1 new row
|
2517
|
+
* hot.alter('insert_row_above', 10);
|
2518
|
+
*
|
2519
|
+
* // below row 10 (by visual index), insert 3 new rows
|
2520
|
+
* hot.alter('insert_row_below', 10, 3);
|
2521
|
+
*
|
2522
|
+
* // in the LTR layout direction: to the left of column 10 (by visual index), insert 3 new columns
|
2523
|
+
* // in the RTL layout direction: to the right of column 10 (by visual index), insert 3 new columns
|
2524
|
+
* hot.alter('insert_col_start', 10, 3);
|
2525
|
+
*
|
2526
|
+
* // in the LTR layout direction: to the right of column 10 (by visual index), insert 1 new column
|
2527
|
+
* // in the RTL layout direction: to the left of column 10 (by visual index), insert 1 new column
|
2528
|
+
* hot.alter('insert_col_end', 10);
|
2529
|
+
*
|
2530
|
+
* // remove 2 rows, starting from row 10 (by visual index)
|
2699
2531
|
* hot.alter('remove_row', 10, 2);
|
2700
|
-
*
|
2532
|
+
*
|
2533
|
+
* // remove 3 rows, starting from row 1 (by visual index)
|
2534
|
+
* // remove 2 rows, starting from row 5 (by visual index)
|
2701
2535
|
* hot.alter('remove_row', [[1, 3], [5, 2]]);
|
2702
2536
|
* ```
|
2703
2537
|
*/
|
2704
|
-
|
2705
|
-
|
2706
2538
|
this.alter = function (action, index, amount, source, keepEmptyRows) {
|
2707
2539
|
grid.alter(action, index, amount, source, keepEmptyRows);
|
2708
2540
|
};
|
2541
|
+
|
2709
2542
|
/**
|
2710
2543
|
* Returns a TD element for the given `row` and `column` arguments, if it is rendered on screen.
|
2711
2544
|
* Returns `null` if the TD is not rendered on screen (probably because that part of the table is not visible).
|
@@ -2718,36 +2551,29 @@ export default function Core(rootElement, userSettings) {
|
|
2718
2551
|
* if the wanted cell is in the range of fixed rows, it will return a TD element from the `top` overlay.
|
2719
2552
|
* @returns {HTMLTableCellElement|null} The cell's TD element.
|
2720
2553
|
*/
|
2721
|
-
|
2722
|
-
|
2723
2554
|
this.getCell = function (row, column) {
|
2724
2555
|
var topmost = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
2725
2556
|
var renderableColumnIndex = column; // Handling also column headers.
|
2726
|
-
|
2727
2557
|
var renderableRowIndex = row; // Handling also row headers.
|
2728
2558
|
|
2729
2559
|
if (column >= 0) {
|
2730
2560
|
if (this.columnIndexMapper.isHidden(this.toPhysicalColumn(column))) {
|
2731
2561
|
return null;
|
2732
2562
|
}
|
2733
|
-
|
2734
2563
|
renderableColumnIndex = this.columnIndexMapper.getRenderableFromVisualIndex(column);
|
2735
2564
|
}
|
2736
|
-
|
2737
2565
|
if (row >= 0) {
|
2738
2566
|
if (this.rowIndexMapper.isHidden(this.toPhysicalRow(row))) {
|
2739
2567
|
return null;
|
2740
2568
|
}
|
2741
|
-
|
2742
2569
|
renderableRowIndex = this.rowIndexMapper.getRenderableFromVisualIndex(row);
|
2743
2570
|
}
|
2744
|
-
|
2745
2571
|
if (renderableRowIndex === null || renderableColumnIndex === null) {
|
2746
2572
|
return null;
|
2747
2573
|
}
|
2748
|
-
|
2749
2574
|
return instance.view.getCellAtCoords(instance._createCellCoords(renderableRowIndex, renderableColumnIndex), topmost);
|
2750
2575
|
};
|
2576
|
+
|
2751
2577
|
/**
|
2752
2578
|
* Returns the coordinates of the cell, provided as a HTML table cell element.
|
2753
2579
|
*
|
@@ -2761,30 +2587,24 @@ export default function Core(rootElement, userSettings) {
|
|
2761
2587
|
* // it returns CellCoords object instance with props row: 1 and col: 1.
|
2762
2588
|
* ```
|
2763
2589
|
*/
|
2764
|
-
|
2765
|
-
|
2766
2590
|
this.getCoords = function (element) {
|
2767
2591
|
var renderableCoords = this.view._wt.wtTable.getCoords(element);
|
2768
|
-
|
2769
2592
|
if (renderableCoords === null) {
|
2770
2593
|
return null;
|
2771
2594
|
}
|
2772
|
-
|
2773
2595
|
var renderableRow = renderableCoords.row,
|
2774
|
-
|
2596
|
+
renderableColumn = renderableCoords.col;
|
2775
2597
|
var visualRow = renderableRow;
|
2776
2598
|
var visualColumn = renderableColumn;
|
2777
|
-
|
2778
2599
|
if (renderableRow >= 0) {
|
2779
2600
|
visualRow = this.rowIndexMapper.getVisualFromRenderableIndex(renderableRow);
|
2780
2601
|
}
|
2781
|
-
|
2782
2602
|
if (renderableColumn >= 0) {
|
2783
2603
|
visualColumn = this.columnIndexMapper.getVisualFromRenderableIndex(renderableColumn);
|
2784
2604
|
}
|
2785
|
-
|
2786
2605
|
return instance._createCellCoords(visualRow, visualColumn);
|
2787
2606
|
};
|
2607
|
+
|
2788
2608
|
/**
|
2789
2609
|
* Returns the property name that corresponds with the given column index.
|
2790
2610
|
* If the data source is an array of arrays, it returns the columns index.
|
@@ -2794,11 +2614,10 @@ export default function Core(rootElement, userSettings) {
|
|
2794
2614
|
* @param {number} column Visual column index.
|
2795
2615
|
* @returns {string|number} Column property or physical column index.
|
2796
2616
|
*/
|
2797
|
-
|
2798
|
-
|
2799
2617
|
this.colToProp = function (column) {
|
2800
2618
|
return datamap.colToProp(column);
|
2801
2619
|
};
|
2620
|
+
|
2802
2621
|
/**
|
2803
2622
|
* Returns column index that corresponds with the given property.
|
2804
2623
|
*
|
@@ -2807,11 +2626,10 @@ export default function Core(rootElement, userSettings) {
|
|
2807
2626
|
* @param {string|number} prop Property name or physical column index.
|
2808
2627
|
* @returns {number} Visual column index.
|
2809
2628
|
*/
|
2810
|
-
|
2811
|
-
|
2812
2629
|
this.propToCol = function (prop) {
|
2813
2630
|
return datamap.propToCol(prop);
|
2814
2631
|
};
|
2632
|
+
|
2815
2633
|
/**
|
2816
2634
|
* Translate physical row index into visual.
|
2817
2635
|
*
|
@@ -2823,11 +2641,10 @@ export default function Core(rootElement, userSettings) {
|
|
2823
2641
|
* @param {number} row Physical row index.
|
2824
2642
|
* @returns {number} Returns visual row index.
|
2825
2643
|
*/
|
2826
|
-
|
2827
|
-
|
2828
2644
|
this.toVisualRow = function (row) {
|
2829
2645
|
return _this.rowIndexMapper.getVisualFromPhysicalIndex(row);
|
2830
2646
|
};
|
2647
|
+
|
2831
2648
|
/**
|
2832
2649
|
* Translate physical column index into visual.
|
2833
2650
|
*
|
@@ -2839,11 +2656,10 @@ export default function Core(rootElement, userSettings) {
|
|
2839
2656
|
* @param {number} column Physical column index.
|
2840
2657
|
* @returns {number} Returns visual column index.
|
2841
2658
|
*/
|
2842
|
-
|
2843
|
-
|
2844
2659
|
this.toVisualColumn = function (column) {
|
2845
2660
|
return _this.columnIndexMapper.getVisualFromPhysicalIndex(column);
|
2846
2661
|
};
|
2662
|
+
|
2847
2663
|
/**
|
2848
2664
|
* Translate visual row index into physical.
|
2849
2665
|
*
|
@@ -2855,11 +2671,10 @@ export default function Core(rootElement, userSettings) {
|
|
2855
2671
|
* @param {number} row Visual row index.
|
2856
2672
|
* @returns {number} Returns physical row index.
|
2857
2673
|
*/
|
2858
|
-
|
2859
|
-
|
2860
2674
|
this.toPhysicalRow = function (row) {
|
2861
2675
|
return _this.rowIndexMapper.getPhysicalFromVisualIndex(row);
|
2862
2676
|
};
|
2677
|
+
|
2863
2678
|
/**
|
2864
2679
|
* Translate visual column index into physical.
|
2865
2680
|
*
|
@@ -2871,11 +2686,10 @@ export default function Core(rootElement, userSettings) {
|
|
2871
2686
|
* @param {number} column Visual column index.
|
2872
2687
|
* @returns {number} Returns physical column index.
|
2873
2688
|
*/
|
2874
|
-
|
2875
|
-
|
2876
2689
|
this.toPhysicalColumn = function (column) {
|
2877
2690
|
return _this.columnIndexMapper.getPhysicalFromVisualIndex(column);
|
2878
2691
|
};
|
2692
|
+
|
2879
2693
|
/**
|
2880
2694
|
* @description
|
2881
2695
|
* Returns the cell value at `row`, `column`.
|
@@ -2888,11 +2702,10 @@ export default function Core(rootElement, userSettings) {
|
|
2888
2702
|
* @param {number} column Visual column index.
|
2889
2703
|
* @returns {*} Data at cell.
|
2890
2704
|
*/
|
2891
|
-
|
2892
|
-
|
2893
2705
|
this.getDataAtCell = function (row, column) {
|
2894
2706
|
return datamap.get(row, datamap.colToProp(column));
|
2895
2707
|
};
|
2708
|
+
|
2896
2709
|
/**
|
2897
2710
|
* Returns value at visual `row` and `prop` indexes.
|
2898
2711
|
*
|
@@ -2904,11 +2717,10 @@ export default function Core(rootElement, userSettings) {
|
|
2904
2717
|
* @param {string} prop Property name.
|
2905
2718
|
* @returns {*} Cell value.
|
2906
2719
|
*/
|
2907
|
-
|
2908
|
-
|
2909
2720
|
this.getDataAtRowProp = function (row, prop) {
|
2910
2721
|
return datamap.get(row, prop);
|
2911
2722
|
};
|
2723
|
+
|
2912
2724
|
/**
|
2913
2725
|
* @description
|
2914
2726
|
* Returns array of column values from the data source.
|
@@ -2920,13 +2732,11 @@ export default function Core(rootElement, userSettings) {
|
|
2920
2732
|
* @param {number} column Visual column index.
|
2921
2733
|
* @returns {Array} Array of cell values.
|
2922
2734
|
*/
|
2923
|
-
|
2924
|
-
|
2925
2735
|
this.getDataAtCol = function (column) {
|
2926
2736
|
var _ref13;
|
2927
|
-
|
2928
2737
|
return (_ref13 = []).concat.apply(_ref13, _toConsumableArray(datamap.getRange(instance._createCellCoords(0, column), instance._createCellCoords(tableMeta.data.length - 1, column), datamap.DESTINATION_RENDERER)));
|
2929
2738
|
};
|
2739
|
+
|
2930
2740
|
/**
|
2931
2741
|
* Given the object property name (e.g. `'first.name'` or `'0'`), returns an array of column's values from the table data.
|
2932
2742
|
* You can also provide a column index as the first argument.
|
@@ -2937,14 +2747,12 @@ export default function Core(rootElement, userSettings) {
|
|
2937
2747
|
* @returns {Array} Array of cell values.
|
2938
2748
|
*/
|
2939
2749
|
// TODO: Getting data from `datamap` should work on visual indexes.
|
2940
|
-
|
2941
|
-
|
2942
2750
|
this.getDataAtProp = function (prop) {
|
2943
2751
|
var _ref14;
|
2944
|
-
|
2945
2752
|
var range = datamap.getRange(instance._createCellCoords(0, datamap.propToCol(prop)), instance._createCellCoords(tableMeta.data.length - 1, datamap.propToCol(prop)), datamap.DESTINATION_RENDERER);
|
2946
2753
|
return (_ref14 = []).concat.apply(_ref14, _toConsumableArray(range));
|
2947
2754
|
};
|
2755
|
+
|
2948
2756
|
/**
|
2949
2757
|
* Returns a clone of the source data object.
|
2950
2758
|
* Optionally you can provide a cell range by using the `row`, `column`, `row2`, `column2` arguments, to get only a
|
@@ -2961,19 +2769,16 @@ export default function Core(rootElement, userSettings) {
|
|
2961
2769
|
* @param {number} [column2] To physical column index (or visual index, if data type is an array of objects).
|
2962
2770
|
* @returns {Array[]|object[]} The table data.
|
2963
2771
|
*/
|
2964
|
-
|
2965
|
-
|
2966
2772
|
this.getSourceData = function (row, column, row2, column2) {
|
2967
2773
|
var data;
|
2968
|
-
|
2969
2774
|
if (row === void 0) {
|
2970
2775
|
data = dataSource.getData();
|
2971
2776
|
} else {
|
2972
2777
|
data = dataSource.getByRange(instance._createCellCoords(row, column), instance._createCellCoords(row2, column2));
|
2973
2778
|
}
|
2974
|
-
|
2975
2779
|
return data;
|
2976
2780
|
};
|
2781
|
+
|
2977
2782
|
/**
|
2978
2783
|
* Returns the source data object as an arrays of arrays format even when source data was provided in another format.
|
2979
2784
|
* Optionally you can provide a cell range by using the `row`, `column`, `row2`, `column2` arguments, to get only a
|
@@ -2990,19 +2795,16 @@ export default function Core(rootElement, userSettings) {
|
|
2990
2795
|
* @param {number} [column2] To physical column index (or visual index, if data type is an array of objects).
|
2991
2796
|
* @returns {Array} An array of arrays.
|
2992
2797
|
*/
|
2993
|
-
|
2994
|
-
|
2995
2798
|
this.getSourceDataArray = function (row, column, row2, column2) {
|
2996
2799
|
var data;
|
2997
|
-
|
2998
2800
|
if (row === void 0) {
|
2999
2801
|
data = dataSource.getData(true);
|
3000
2802
|
} else {
|
3001
2803
|
data = dataSource.getByRange(instance._createCellCoords(row, column), instance._createCellCoords(row2, column2), true);
|
3002
2804
|
}
|
3003
|
-
|
3004
2805
|
return data;
|
3005
2806
|
};
|
2807
|
+
|
3006
2808
|
/**
|
3007
2809
|
* Returns an array of column values from the data source.
|
3008
2810
|
*
|
@@ -3012,13 +2814,11 @@ export default function Core(rootElement, userSettings) {
|
|
3012
2814
|
* @returns {Array} Array of the column's cell values.
|
3013
2815
|
*/
|
3014
2816
|
// TODO: Getting data from `sourceData` should work always on physical indexes.
|
3015
|
-
|
3016
|
-
|
3017
2817
|
this.getSourceDataAtCol = function (column) {
|
3018
2818
|
return dataSource.getAtColumn(column);
|
3019
2819
|
};
|
3020
|
-
/* eslint-disable jsdoc/require-param */
|
3021
2820
|
|
2821
|
+
/* eslint-disable jsdoc/require-param */
|
3022
2822
|
/**
|
3023
2823
|
* Set the provided value in the source data set at the provided coordinates.
|
3024
2824
|
*
|
@@ -3029,47 +2829,39 @@ export default function Core(rootElement, userSettings) {
|
|
3029
2829
|
* @param {*} value The value to be set at the provided coordinates.
|
3030
2830
|
* @param {string} [source] Source of the change as a string.
|
3031
2831
|
*/
|
3032
|
-
|
3033
2832
|
/* eslint-enable jsdoc/require-param */
|
3034
|
-
|
3035
|
-
|
3036
2833
|
this.setSourceDataAtCell = function (row, column, value, source) {
|
3037
2834
|
var input = setDataInputToArray(row, column, value);
|
3038
2835
|
var isThereAnySetSourceListener = this.hasHook('afterSetSourceDataAtCell');
|
3039
2836
|
var changesForHook = [];
|
3040
|
-
|
3041
2837
|
if (isThereAnySetSourceListener) {
|
3042
2838
|
arrayEach(input, function (_ref15) {
|
3043
2839
|
var _ref16 = _slicedToArray(_ref15, 3),
|
3044
|
-
|
3045
|
-
|
3046
|
-
|
3047
|
-
|
3048
|
-
|
2840
|
+
changeRow = _ref16[0],
|
2841
|
+
changeProp = _ref16[1],
|
2842
|
+
changeValue = _ref16[2];
|
2843
|
+
changesForHook.push([changeRow, changeProp, dataSource.getAtCell(changeRow, changeProp),
|
2844
|
+
// The previous value.
|
3049
2845
|
changeValue]);
|
3050
2846
|
});
|
3051
2847
|
}
|
3052
|
-
|
3053
2848
|
arrayEach(input, function (_ref17) {
|
3054
2849
|
var _ref18 = _slicedToArray(_ref17, 3),
|
3055
|
-
|
3056
|
-
|
3057
|
-
|
3058
|
-
|
2850
|
+
changeRow = _ref18[0],
|
2851
|
+
changeProp = _ref18[1],
|
2852
|
+
changeValue = _ref18[2];
|
3059
2853
|
dataSource.setAtCell(changeRow, changeProp, changeValue);
|
3060
2854
|
});
|
3061
|
-
|
3062
2855
|
if (isThereAnySetSourceListener) {
|
3063
2856
|
this.runHooks('afterSetSourceDataAtCell', changesForHook, source);
|
3064
2857
|
}
|
3065
|
-
|
3066
2858
|
this.render();
|
3067
2859
|
var activeEditor = instance.getActiveEditor();
|
3068
|
-
|
3069
2860
|
if (activeEditor && isDefined(activeEditor.refreshValue)) {
|
3070
2861
|
activeEditor.refreshValue();
|
3071
2862
|
}
|
3072
2863
|
};
|
2864
|
+
|
3073
2865
|
/**
|
3074
2866
|
* Returns a single row of the data (array or object, depending on what data format you use).
|
3075
2867
|
*
|
@@ -3081,11 +2873,10 @@ export default function Core(rootElement, userSettings) {
|
|
3081
2873
|
* @param {number} row Physical row index.
|
3082
2874
|
* @returns {Array|object} Single row of data.
|
3083
2875
|
*/
|
3084
|
-
|
3085
|
-
|
3086
2876
|
this.getSourceDataAtRow = function (row) {
|
3087
2877
|
return dataSource.getAtRow(row);
|
3088
2878
|
};
|
2879
|
+
|
3089
2880
|
/**
|
3090
2881
|
* Returns a single value from the data source.
|
3091
2882
|
*
|
@@ -3096,11 +2887,10 @@ export default function Core(rootElement, userSettings) {
|
|
3096
2887
|
* @returns {*} Cell data.
|
3097
2888
|
*/
|
3098
2889
|
// TODO: Getting data from `sourceData` should work always on physical indexes.
|
3099
|
-
|
3100
|
-
|
3101
2890
|
this.getSourceDataAtCell = function (row, column) {
|
3102
2891
|
return dataSource.getAtCell(row, column);
|
3103
2892
|
};
|
2893
|
+
|
3104
2894
|
/**
|
3105
2895
|
* @description
|
3106
2896
|
* Returns a single row of the data.
|
@@ -3112,12 +2902,11 @@ export default function Core(rootElement, userSettings) {
|
|
3112
2902
|
* @param {number} row Visual row index.
|
3113
2903
|
* @returns {Array} Array of row's cell data.
|
3114
2904
|
*/
|
3115
|
-
|
3116
|
-
|
3117
2905
|
this.getDataAtRow = function (row) {
|
3118
2906
|
var data = datamap.getRange(instance._createCellCoords(row, 0), instance._createCellCoords(row, this.countCols() - 1), datamap.DESTINATION_RENDERER);
|
3119
2907
|
return data[0] || [];
|
3120
2908
|
};
|
2909
|
+
|
3121
2910
|
/**
|
3122
2911
|
* @description
|
3123
2912
|
* Returns a data type defined in the Handsontable settings under the `type` key ({@link Options#type}).
|
@@ -3133,41 +2922,32 @@ export default function Core(rootElement, userSettings) {
|
|
3133
2922
|
* @param {number} columnTo To visual column index.
|
3134
2923
|
* @returns {string} Cell type (e.q: `'mixed'`, `'text'`, `'numeric'`, `'autocomplete'`).
|
3135
2924
|
*/
|
3136
|
-
|
3137
|
-
|
3138
2925
|
this.getDataType = function (rowFrom, columnFrom, rowTo, columnTo) {
|
3139
2926
|
var _this4 = this;
|
3140
|
-
|
3141
2927
|
var coords = rowFrom === void 0 ? [0, 0, this.countRows(), this.countCols()] : [rowFrom, columnFrom, rowTo, columnTo];
|
3142
2928
|
var rowStart = coords[0],
|
3143
|
-
|
2929
|
+
columnStart = coords[1];
|
3144
2930
|
var rowEnd = coords[2],
|
3145
|
-
|
2931
|
+
columnEnd = coords[3];
|
3146
2932
|
var previousType = null;
|
3147
2933
|
var currentType = null;
|
3148
|
-
|
3149
2934
|
if (rowEnd === void 0) {
|
3150
2935
|
rowEnd = rowStart;
|
3151
2936
|
}
|
3152
|
-
|
3153
2937
|
if (columnEnd === void 0) {
|
3154
2938
|
columnEnd = columnStart;
|
3155
2939
|
}
|
3156
|
-
|
3157
2940
|
var type = 'mixed';
|
3158
2941
|
rangeEach(Math.max(Math.min(rowStart, rowEnd), 0), Math.max(rowStart, rowEnd), function (row) {
|
3159
2942
|
var isTypeEqual = true;
|
3160
2943
|
rangeEach(Math.max(Math.min(columnStart, columnEnd), 0), Math.max(columnStart, columnEnd), function (column) {
|
3161
2944
|
var cellType = _this4.getCellMeta(row, column);
|
3162
|
-
|
3163
2945
|
currentType = cellType.type;
|
3164
|
-
|
3165
2946
|
if (previousType) {
|
3166
2947
|
isTypeEqual = previousType === currentType;
|
3167
2948
|
} else {
|
3168
2949
|
previousType = currentType;
|
3169
2950
|
}
|
3170
|
-
|
3171
2951
|
return isTypeEqual;
|
3172
2952
|
});
|
3173
2953
|
type = isTypeEqual ? currentType : 'mixed';
|
@@ -3175,6 +2955,7 @@ export default function Core(rootElement, userSettings) {
|
|
3175
2955
|
});
|
3176
2956
|
return type;
|
3177
2957
|
};
|
2958
|
+
|
3178
2959
|
/**
|
3179
2960
|
* Remove a property defined by the `key` argument from the cell meta object for the provided `row` and `column` coordinates.
|
3180
2961
|
*
|
@@ -3186,22 +2967,19 @@ export default function Core(rootElement, userSettings) {
|
|
3186
2967
|
* @fires Hooks#beforeRemoveCellMeta
|
3187
2968
|
* @fires Hooks#afterRemoveCellMeta
|
3188
2969
|
*/
|
3189
|
-
|
3190
|
-
|
3191
2970
|
this.removeCellMeta = function (row, column, key) {
|
3192
2971
|
var _ref19 = [this.toPhysicalRow(row), this.toPhysicalColumn(column)],
|
3193
|
-
|
3194
|
-
|
2972
|
+
physicalRow = _ref19[0],
|
2973
|
+
physicalColumn = _ref19[1];
|
3195
2974
|
var cachedValue = metaManager.getCellMetaKeyValue(physicalRow, physicalColumn, key);
|
3196
2975
|
var hookResult = instance.runHooks('beforeRemoveCellMeta', row, column, key, cachedValue);
|
3197
|
-
|
3198
2976
|
if (hookResult !== false) {
|
3199
2977
|
metaManager.removeCellMeta(physicalRow, physicalColumn, key);
|
3200
2978
|
instance.runHooks('afterRemoveCellMeta', row, column, key, cachedValue);
|
3201
2979
|
}
|
3202
|
-
|
3203
2980
|
cachedValue = null;
|
3204
2981
|
};
|
2982
|
+
|
3205
2983
|
/**
|
3206
2984
|
* Removes or adds one or more rows of the cell meta objects to the cell meta collections.
|
3207
2985
|
*
|
@@ -3212,25 +2990,18 @@ export default function Core(rootElement, userSettings) {
|
|
3212
2990
|
* @param {number} [deleteAmount=0] The number of items to be removed. If set to 0, no cell meta objects will be removed.
|
3213
2991
|
* @param {...object} [cellMetaRows] The new cell meta row objects to be added to the cell meta collection.
|
3214
2992
|
*/
|
3215
|
-
|
3216
|
-
|
3217
2993
|
this.spliceCellsMeta = function (visualIndex) {
|
3218
2994
|
var _this5 = this;
|
3219
|
-
|
3220
2995
|
var deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
3221
|
-
|
3222
2996
|
for (var _len3 = arguments.length, cellMetaRows = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
3223
2997
|
cellMetaRows[_key3 - 2] = arguments[_key3];
|
3224
2998
|
}
|
3225
|
-
|
3226
2999
|
if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
|
3227
3000
|
throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
|
3228
3001
|
}
|
3229
|
-
|
3230
3002
|
if (deleteAmount > 0) {
|
3231
3003
|
metaManager.removeRow(this.toPhysicalRow(visualIndex), deleteAmount);
|
3232
3004
|
}
|
3233
|
-
|
3234
3005
|
if (cellMetaRows.length > 0) {
|
3235
3006
|
arrayEach(cellMetaRows.reverse(), function (cellMetaRow) {
|
3236
3007
|
metaManager.createRow(_this5.toPhysicalRow(visualIndex));
|
@@ -3239,9 +3010,9 @@ export default function Core(rootElement, userSettings) {
|
|
3239
3010
|
});
|
3240
3011
|
});
|
3241
3012
|
}
|
3242
|
-
|
3243
3013
|
instance.render();
|
3244
3014
|
};
|
3015
|
+
|
3245
3016
|
/**
|
3246
3017
|
* Set cell meta data object defined by `prop` to the corresponding params `row` and `column`.
|
3247
3018
|
*
|
@@ -3251,17 +3022,15 @@ export default function Core(rootElement, userSettings) {
|
|
3251
3022
|
* @param {number} column Visual column index.
|
3252
3023
|
* @param {object} prop Meta object.
|
3253
3024
|
*/
|
3254
|
-
|
3255
|
-
|
3256
3025
|
this.setCellMetaObject = function (row, column, prop) {
|
3257
3026
|
var _this6 = this;
|
3258
|
-
|
3259
3027
|
if (_typeof(prop) === 'object') {
|
3260
3028
|
objectEach(prop, function (value, key) {
|
3261
3029
|
_this6.setCellMeta(row, column, key, value);
|
3262
3030
|
});
|
3263
3031
|
}
|
3264
3032
|
};
|
3033
|
+
|
3265
3034
|
/**
|
3266
3035
|
* Sets a property defined by the `key` property to the meta object of a cell corresponding to params `row` and `column`.
|
3267
3036
|
*
|
@@ -3274,29 +3043,23 @@ export default function Core(rootElement, userSettings) {
|
|
3274
3043
|
* @fires Hooks#beforeSetCellMeta
|
3275
3044
|
* @fires Hooks#afterSetCellMeta
|
3276
3045
|
*/
|
3277
|
-
|
3278
|
-
|
3279
3046
|
this.setCellMeta = function (row, column, key, value) {
|
3280
3047
|
var allowSetCellMeta = instance.runHooks('beforeSetCellMeta', row, column, key, value);
|
3281
|
-
|
3282
3048
|
if (allowSetCellMeta === false) {
|
3283
3049
|
return;
|
3284
3050
|
}
|
3285
|
-
|
3286
3051
|
var physicalRow = row;
|
3287
3052
|
var physicalColumn = column;
|
3288
|
-
|
3289
3053
|
if (row < this.countRows()) {
|
3290
3054
|
physicalRow = this.toPhysicalRow(row);
|
3291
3055
|
}
|
3292
|
-
|
3293
3056
|
if (column < this.countCols()) {
|
3294
3057
|
physicalColumn = this.toPhysicalColumn(column);
|
3295
3058
|
}
|
3296
|
-
|
3297
3059
|
metaManager.setCellMeta(physicalRow, physicalColumn, key, value);
|
3298
3060
|
instance.runHooks('afterSetCellMeta', row, column, key, value);
|
3299
3061
|
};
|
3062
|
+
|
3300
3063
|
/**
|
3301
3064
|
* Get all the cells meta settings at least once generated in the table (in order of cell initialization).
|
3302
3065
|
*
|
@@ -3304,11 +3067,10 @@ export default function Core(rootElement, userSettings) {
|
|
3304
3067
|
* @function getCellsMeta
|
3305
3068
|
* @returns {Array} Returns an array of ColumnSettings object instances.
|
3306
3069
|
*/
|
3307
|
-
|
3308
|
-
|
3309
3070
|
this.getCellsMeta = function () {
|
3310
3071
|
return metaManager.getCellsMeta();
|
3311
3072
|
};
|
3073
|
+
|
3312
3074
|
/**
|
3313
3075
|
* Returns the cell properties object for the given `row` and `column` coordinates.
|
3314
3076
|
*
|
@@ -3320,25 +3082,21 @@ export default function Core(rootElement, userSettings) {
|
|
3320
3082
|
* @fires Hooks#beforeGetCellMeta
|
3321
3083
|
* @fires Hooks#afterGetCellMeta
|
3322
3084
|
*/
|
3323
|
-
|
3324
|
-
|
3325
3085
|
this.getCellMeta = function (row, column) {
|
3326
3086
|
var physicalRow = this.toPhysicalRow(row);
|
3327
3087
|
var physicalColumn = this.toPhysicalColumn(column);
|
3328
|
-
|
3329
3088
|
if (physicalRow === null) {
|
3330
3089
|
physicalRow = row;
|
3331
3090
|
}
|
3332
|
-
|
3333
3091
|
if (physicalColumn === null) {
|
3334
3092
|
physicalColumn = column;
|
3335
3093
|
}
|
3336
|
-
|
3337
3094
|
return metaManager.getCellMeta(physicalRow, physicalColumn, {
|
3338
3095
|
visualRow: row,
|
3339
3096
|
visualColumn: column
|
3340
3097
|
});
|
3341
3098
|
};
|
3099
|
+
|
3342
3100
|
/**
|
3343
3101
|
* Returns an array of cell meta objects for specified physical row index.
|
3344
3102
|
*
|
@@ -3347,11 +3105,10 @@ export default function Core(rootElement, userSettings) {
|
|
3347
3105
|
* @param {number} row Physical row index.
|
3348
3106
|
* @returns {Array}
|
3349
3107
|
*/
|
3350
|
-
|
3351
|
-
|
3352
3108
|
this.getCellMetaAtRow = function (row) {
|
3353
3109
|
return metaManager.getCellsMetaAtRow(row);
|
3354
3110
|
};
|
3111
|
+
|
3355
3112
|
/**
|
3356
3113
|
* Checks if the data format and config allows user to modify the column structure.
|
3357
3114
|
*
|
@@ -3359,13 +3116,11 @@ export default function Core(rootElement, userSettings) {
|
|
3359
3116
|
* @function isColumnModificationAllowed
|
3360
3117
|
* @returns {boolean}
|
3361
3118
|
*/
|
3362
|
-
|
3363
|
-
|
3364
3119
|
this.isColumnModificationAllowed = function () {
|
3365
3120
|
return !(instance.dataType === 'object' || tableMeta.columns);
|
3366
3121
|
};
|
3367
|
-
|
3368
3122
|
var rendererLookup = cellMethodLookupFactory('renderer');
|
3123
|
+
|
3369
3124
|
/**
|
3370
3125
|
* Returns the cell renderer function by given `row` and `column` arguments.
|
3371
3126
|
*
|
@@ -3382,10 +3137,10 @@ export default function Core(rootElement, userSettings) {
|
|
3382
3137
|
* hot.getCellRenderer(hot.getCellMeta(1, 1));
|
3383
3138
|
* ```
|
3384
3139
|
*/
|
3385
|
-
|
3386
3140
|
this.getCellRenderer = function (row, column) {
|
3387
3141
|
return getRenderer(rendererLookup.call(this, row, column));
|
3388
3142
|
};
|
3143
|
+
|
3389
3144
|
/**
|
3390
3145
|
* Returns the cell editor class by the provided `row` and `column` arguments.
|
3391
3146
|
*
|
@@ -3402,10 +3157,9 @@ export default function Core(rootElement, userSettings) {
|
|
3402
3157
|
* hot.getCellEditor(hot.getCellMeta(1, 1));
|
3403
3158
|
* ```
|
3404
3159
|
*/
|
3405
|
-
|
3406
|
-
|
3407
3160
|
this.getCellEditor = cellMethodLookupFactory('editor');
|
3408
3161
|
var validatorLookup = cellMethodLookupFactory('validator');
|
3162
|
+
|
3409
3163
|
/**
|
3410
3164
|
* Returns the cell validator by `row` and `column`.
|
3411
3165
|
*
|
@@ -3422,16 +3176,14 @@ export default function Core(rootElement, userSettings) {
|
|
3422
3176
|
* hot.getCellValidator(hot.getCellMeta(1, 1));
|
3423
3177
|
* ```
|
3424
3178
|
*/
|
3425
|
-
|
3426
3179
|
this.getCellValidator = function (row, column) {
|
3427
3180
|
var validator = validatorLookup.call(this, row, column);
|
3428
|
-
|
3429
3181
|
if (typeof validator === 'string') {
|
3430
3182
|
validator = getValidator(validator);
|
3431
3183
|
}
|
3432
|
-
|
3433
3184
|
return validator;
|
3434
3185
|
};
|
3186
|
+
|
3435
3187
|
/**
|
3436
3188
|
* Validates all cells using their validator functions and calls callback when finished.
|
3437
3189
|
*
|
@@ -3450,11 +3202,10 @@ export default function Core(rootElement, userSettings) {
|
|
3450
3202
|
* })
|
3451
3203
|
* ```
|
3452
3204
|
*/
|
3453
|
-
|
3454
|
-
|
3455
3205
|
this.validateCells = function (callback) {
|
3456
3206
|
this._validateCells(callback);
|
3457
3207
|
};
|
3208
|
+
|
3458
3209
|
/**
|
3459
3210
|
* Validates rows using their validator functions and calls callback when finished.
|
3460
3211
|
*
|
@@ -3474,15 +3225,13 @@ export default function Core(rootElement, userSettings) {
|
|
3474
3225
|
* })
|
3475
3226
|
* ```
|
3476
3227
|
*/
|
3477
|
-
|
3478
|
-
|
3479
3228
|
this.validateRows = function (rows, callback) {
|
3480
3229
|
if (!Array.isArray(rows)) {
|
3481
3230
|
throw new Error('validateRows parameter `rows` must be an array');
|
3482
3231
|
}
|
3483
|
-
|
3484
3232
|
this._validateCells(callback, rows);
|
3485
3233
|
};
|
3234
|
+
|
3486
3235
|
/**
|
3487
3236
|
* Validates columns using their validator functions and calls callback when finished.
|
3488
3237
|
*
|
@@ -3502,15 +3251,13 @@ export default function Core(rootElement, userSettings) {
|
|
3502
3251
|
* })
|
3503
3252
|
* ```
|
3504
3253
|
*/
|
3505
|
-
|
3506
|
-
|
3507
3254
|
this.validateColumns = function (columns, callback) {
|
3508
3255
|
if (!Array.isArray(columns)) {
|
3509
3256
|
throw new Error('validateColumns parameter `columns` must be an array');
|
3510
3257
|
}
|
3511
|
-
|
3512
3258
|
this._validateCells(callback, undefined, columns);
|
3513
3259
|
};
|
3260
|
+
|
3514
3261
|
/**
|
3515
3262
|
* Validates all cells using their validator functions and calls callback when finished.
|
3516
3263
|
*
|
@@ -3524,52 +3271,41 @@ export default function Core(rootElement, userSettings) {
|
|
3524
3271
|
* @param {Function} [callback] The callback function.
|
3525
3272
|
* @param {Array} [rows] An array of validation target visual row indexes.
|
3526
3273
|
* @param {Array} [columns] An array of validation target visual column indexes.
|
3527
|
-
*/
|
3528
|
-
|
3529
|
-
|
3274
|
+
*/
|
3530
3275
|
this._validateCells = function (callback, rows, columns) {
|
3531
3276
|
var waitingForValidator = new ValidatorsQueue();
|
3532
|
-
|
3533
3277
|
if (callback) {
|
3534
3278
|
waitingForValidator.onQueueEmpty = callback;
|
3535
3279
|
}
|
3536
|
-
|
3537
3280
|
var i = instance.countRows() - 1;
|
3538
|
-
|
3539
3281
|
while (i >= 0) {
|
3540
3282
|
if (rows !== undefined && rows.indexOf(i) === -1) {
|
3541
3283
|
i -= 1;
|
3542
3284
|
continue;
|
3543
3285
|
}
|
3544
|
-
|
3545
3286
|
var j = instance.countCols() - 1;
|
3546
|
-
|
3547
3287
|
while (j >= 0) {
|
3548
3288
|
if (columns !== undefined && columns.indexOf(j) === -1) {
|
3549
3289
|
j -= 1;
|
3550
3290
|
continue;
|
3551
3291
|
}
|
3552
|
-
|
3553
3292
|
waitingForValidator.addValidatorToQueue();
|
3554
3293
|
instance.validateCell(instance.getDataAtCell(i, j), instance.getCellMeta(i, j), function (result) {
|
3555
3294
|
if (typeof result !== 'boolean') {
|
3556
3295
|
throw new Error('Validation error: result is not boolean');
|
3557
3296
|
}
|
3558
|
-
|
3559
3297
|
if (result === false) {
|
3560
3298
|
waitingForValidator.valid = false;
|
3561
3299
|
}
|
3562
|
-
|
3563
3300
|
waitingForValidator.removeValidatorFormQueue();
|
3564
3301
|
}, 'validateCells');
|
3565
3302
|
j -= 1;
|
3566
3303
|
}
|
3567
|
-
|
3568
3304
|
i -= 1;
|
3569
3305
|
}
|
3570
|
-
|
3571
3306
|
waitingForValidator.checkIfQueueIsEmpty();
|
3572
3307
|
};
|
3308
|
+
|
3573
3309
|
/**
|
3574
3310
|
* Returns an array of row headers' values (if they are enabled). If param `row` was given, it returns the header of the given row as a string.
|
3575
3311
|
*
|
@@ -3579,16 +3315,12 @@ export default function Core(rootElement, userSettings) {
|
|
3579
3315
|
* @fires Hooks#modifyRowHeader
|
3580
3316
|
* @returns {Array|string|number} Array of header values / single header value.
|
3581
3317
|
*/
|
3582
|
-
|
3583
|
-
|
3584
3318
|
this.getRowHeader = function (row) {
|
3585
3319
|
var rowHeader = tableMeta.rowHeaders;
|
3586
3320
|
var physicalRow = row;
|
3587
|
-
|
3588
3321
|
if (physicalRow !== void 0) {
|
3589
3322
|
physicalRow = instance.runHooks('modifyRowHeader', physicalRow);
|
3590
3323
|
}
|
3591
|
-
|
3592
3324
|
if (physicalRow === void 0) {
|
3593
3325
|
rowHeader = [];
|
3594
3326
|
rangeEach(instance.countRows() - 1, function (i) {
|
@@ -3601,9 +3333,9 @@ export default function Core(rootElement, userSettings) {
|
|
3601
3333
|
} else if (rowHeader && typeof rowHeader !== 'string' && typeof rowHeader !== 'number') {
|
3602
3334
|
rowHeader = physicalRow + 1;
|
3603
3335
|
}
|
3604
|
-
|
3605
3336
|
return rowHeader;
|
3606
3337
|
};
|
3338
|
+
|
3607
3339
|
/**
|
3608
3340
|
* Returns information about if this table is configured to display row headers.
|
3609
3341
|
*
|
@@ -3611,11 +3343,10 @@ export default function Core(rootElement, userSettings) {
|
|
3611
3343
|
* @function hasRowHeaders
|
3612
3344
|
* @returns {boolean} `true` if the instance has the row headers enabled, `false` otherwise.
|
3613
3345
|
*/
|
3614
|
-
|
3615
|
-
|
3616
3346
|
this.hasRowHeaders = function () {
|
3617
3347
|
return !!tableMeta.rowHeaders;
|
3618
3348
|
};
|
3349
|
+
|
3619
3350
|
/**
|
3620
3351
|
* Returns information about if this table is configured to display column headers.
|
3621
3352
|
*
|
@@ -3623,22 +3354,19 @@ export default function Core(rootElement, userSettings) {
|
|
3623
3354
|
* @function hasColHeaders
|
3624
3355
|
* @returns {boolean} `true` if the instance has the column headers enabled, `false` otherwise.
|
3625
3356
|
*/
|
3626
|
-
|
3627
|
-
|
3628
3357
|
this.hasColHeaders = function () {
|
3629
3358
|
if (tableMeta.colHeaders !== void 0 && tableMeta.colHeaders !== null) {
|
3630
3359
|
// Polymer has empty value = null
|
3631
3360
|
return !!tableMeta.colHeaders;
|
3632
3361
|
}
|
3633
|
-
|
3634
3362
|
for (var i = 0, ilen = instance.countCols(); i < ilen; i++) {
|
3635
3363
|
if (instance.getColHeader(i)) {
|
3636
3364
|
return true;
|
3637
3365
|
}
|
3638
3366
|
}
|
3639
|
-
|
3640
3367
|
return false;
|
3641
3368
|
};
|
3369
|
+
|
3642
3370
|
/**
|
3643
3371
|
* Returns an array of column headers (in string format, if they are enabled). If param `column` is given, it
|
3644
3372
|
* returns the header at the given column.
|
@@ -3649,39 +3377,30 @@ export default function Core(rootElement, userSettings) {
|
|
3649
3377
|
* @fires Hooks#modifyColHeader
|
3650
3378
|
* @returns {Array|string|number} The column header(s).
|
3651
3379
|
*/
|
3652
|
-
|
3653
|
-
|
3654
3380
|
this.getColHeader = function (column) {
|
3655
3381
|
var columnIndex = instance.runHooks('modifyColHeader', column);
|
3656
3382
|
var result = tableMeta.colHeaders;
|
3657
|
-
|
3658
3383
|
if (columnIndex === void 0) {
|
3659
3384
|
var out = [];
|
3660
3385
|
var ilen = instance.countCols();
|
3661
|
-
|
3662
3386
|
for (var i = 0; i < ilen; i++) {
|
3663
3387
|
out.push(instance.getColHeader(i));
|
3664
3388
|
}
|
3665
|
-
|
3666
3389
|
result = out;
|
3667
3390
|
} else {
|
3668
3391
|
var translateVisualIndexToColumns = function translateVisualIndexToColumns(visualColumnIndex) {
|
3669
3392
|
var arr = [];
|
3670
3393
|
var columnsLen = instance.countCols();
|
3671
3394
|
var index = 0;
|
3672
|
-
|
3673
3395
|
for (; index < columnsLen; index++) {
|
3674
3396
|
if (isFunction(tableMeta.columns) && tableMeta.columns(index)) {
|
3675
3397
|
arr.push(index);
|
3676
3398
|
}
|
3677
3399
|
}
|
3678
|
-
|
3679
3400
|
return arr[visualColumnIndex];
|
3680
3401
|
};
|
3681
|
-
|
3682
3402
|
var physicalColumn = instance.toPhysicalColumn(columnIndex);
|
3683
3403
|
var prop = translateVisualIndexToColumns(physicalColumn);
|
3684
|
-
|
3685
3404
|
if (tableMeta.colHeaders === false) {
|
3686
3405
|
result = null;
|
3687
3406
|
} else if (tableMeta.columns && isFunction(tableMeta.columns) && tableMeta.columns(prop) && tableMeta.columns(prop).title) {
|
@@ -3699,6 +3418,7 @@ export default function Core(rootElement, userSettings) {
|
|
3699
3418
|
|
3700
3419
|
return result;
|
3701
3420
|
};
|
3421
|
+
|
3702
3422
|
/**
|
3703
3423
|
* Return column width from settings (no guessing). Private use intended.
|
3704
3424
|
*
|
@@ -3708,42 +3428,36 @@ export default function Core(rootElement, userSettings) {
|
|
3708
3428
|
* @param {number} col Visual col index.
|
3709
3429
|
* @returns {number}
|
3710
3430
|
*/
|
3711
|
-
|
3712
|
-
|
3713
3431
|
this._getColWidthFromSettings = function (col) {
|
3714
|
-
var width;
|
3432
|
+
var width;
|
3715
3433
|
|
3434
|
+
// We currently don't support cell meta objects for headers (negative values)
|
3716
3435
|
if (col >= 0) {
|
3717
3436
|
var cellProperties = instance.getCellMeta(0, col);
|
3718
3437
|
width = cellProperties.width;
|
3719
3438
|
}
|
3720
|
-
|
3721
3439
|
if (width === void 0 || width === tableMeta.width) {
|
3722
3440
|
width = tableMeta.colWidths;
|
3723
3441
|
}
|
3724
|
-
|
3725
3442
|
if (width !== void 0 && width !== null) {
|
3726
3443
|
switch (_typeof(width)) {
|
3727
3444
|
case 'object':
|
3728
3445
|
// array
|
3729
3446
|
width = width[col];
|
3730
3447
|
break;
|
3731
|
-
|
3732
3448
|
case 'function':
|
3733
3449
|
width = width(col);
|
3734
3450
|
break;
|
3735
|
-
|
3736
3451
|
default:
|
3737
3452
|
break;
|
3738
3453
|
}
|
3739
|
-
|
3740
3454
|
if (typeof width === 'string') {
|
3741
3455
|
width = parseInt(width, 10);
|
3742
3456
|
}
|
3743
3457
|
}
|
3744
|
-
|
3745
3458
|
return width;
|
3746
3459
|
};
|
3460
|
+
|
3747
3461
|
/**
|
3748
3462
|
* Returns the width of the requested column.
|
3749
3463
|
*
|
@@ -3753,19 +3467,15 @@ export default function Core(rootElement, userSettings) {
|
|
3753
3467
|
* @returns {number} Column width.
|
3754
3468
|
* @fires Hooks#modifyColWidth
|
3755
3469
|
*/
|
3756
|
-
|
3757
|
-
|
3758
3470
|
this.getColWidth = function (column) {
|
3759
3471
|
var width = instance._getColWidthFromSettings(column);
|
3760
|
-
|
3761
3472
|
width = instance.runHooks('modifyColWidth', width, column);
|
3762
|
-
|
3763
3473
|
if (width === void 0) {
|
3764
3474
|
width = ViewportColumnsCalculator.DEFAULT_WIDTH;
|
3765
3475
|
}
|
3766
|
-
|
3767
3476
|
return width;
|
3768
3477
|
};
|
3478
|
+
|
3769
3479
|
/**
|
3770
3480
|
* Return row height from settings (no guessing). Private use intended.
|
3771
3481
|
*
|
@@ -3775,8 +3485,6 @@ export default function Core(rootElement, userSettings) {
|
|
3775
3485
|
* @param {number} row Visual row index.
|
3776
3486
|
* @returns {number}
|
3777
3487
|
*/
|
3778
|
-
|
3779
|
-
|
3780
3488
|
this._getRowHeightFromSettings = function (row) {
|
3781
3489
|
// let cellProperties = instance.getCellMeta(row, 0);
|
3782
3490
|
// let height = cellProperties.height;
|
@@ -3785,29 +3493,25 @@ export default function Core(rootElement, userSettings) {
|
|
3785
3493
|
// height = cellProperties.rowHeights;
|
3786
3494
|
// }
|
3787
3495
|
var height = tableMeta.rowHeights;
|
3788
|
-
|
3789
3496
|
if (height !== void 0 && height !== null) {
|
3790
3497
|
switch (_typeof(height)) {
|
3791
3498
|
case 'object':
|
3792
3499
|
// array
|
3793
3500
|
height = height[row];
|
3794
3501
|
break;
|
3795
|
-
|
3796
3502
|
case 'function':
|
3797
3503
|
height = height(row);
|
3798
3504
|
break;
|
3799
|
-
|
3800
3505
|
default:
|
3801
3506
|
break;
|
3802
3507
|
}
|
3803
|
-
|
3804
3508
|
if (typeof height === 'string') {
|
3805
3509
|
height = parseInt(height, 10);
|
3806
3510
|
}
|
3807
3511
|
}
|
3808
|
-
|
3809
3512
|
return height;
|
3810
3513
|
};
|
3514
|
+
|
3811
3515
|
/**
|
3812
3516
|
* Returns the row height.
|
3813
3517
|
*
|
@@ -3819,14 +3523,12 @@ export default function Core(rootElement, userSettings) {
|
|
3819
3523
|
* @returns {number} The given row's height.
|
3820
3524
|
* @fires Hooks#modifyRowHeight
|
3821
3525
|
*/
|
3822
|
-
|
3823
|
-
|
3824
3526
|
this.getRowHeight = function (row) {
|
3825
3527
|
var height = instance._getRowHeightFromSettings(row);
|
3826
|
-
|
3827
3528
|
height = instance.runHooks('modifyRowHeight', height, row);
|
3828
3529
|
return height;
|
3829
3530
|
};
|
3531
|
+
|
3830
3532
|
/**
|
3831
3533
|
* Returns the total number of rows in the data source.
|
3832
3534
|
*
|
@@ -3834,11 +3536,10 @@ export default function Core(rootElement, userSettings) {
|
|
3834
3536
|
* @function countSourceRows
|
3835
3537
|
* @returns {number} Total number of rows.
|
3836
3538
|
*/
|
3837
|
-
|
3838
|
-
|
3839
3539
|
this.countSourceRows = function () {
|
3840
3540
|
return dataSource.countRows();
|
3841
3541
|
};
|
3542
|
+
|
3842
3543
|
/**
|
3843
3544
|
* Returns the total number of columns in the data source.
|
3844
3545
|
*
|
@@ -3846,11 +3547,10 @@ export default function Core(rootElement, userSettings) {
|
|
3846
3547
|
* @function countSourceCols
|
3847
3548
|
* @returns {number} Total number of columns.
|
3848
3549
|
*/
|
3849
|
-
|
3850
|
-
|
3851
3550
|
this.countSourceCols = function () {
|
3852
3551
|
return dataSource.countFirstRowKeys();
|
3853
3552
|
};
|
3553
|
+
|
3854
3554
|
/**
|
3855
3555
|
* Returns the total number of visual rows in the table.
|
3856
3556
|
*
|
@@ -3858,11 +3558,10 @@ export default function Core(rootElement, userSettings) {
|
|
3858
3558
|
* @function countRows
|
3859
3559
|
* @returns {number} Total number of rows.
|
3860
3560
|
*/
|
3861
|
-
|
3862
|
-
|
3863
3561
|
this.countRows = function () {
|
3864
3562
|
return datamap.getLength();
|
3865
3563
|
};
|
3564
|
+
|
3866
3565
|
/**
|
3867
3566
|
* Returns the total number of visible columns in the table.
|
3868
3567
|
*
|
@@ -3870,13 +3569,12 @@ export default function Core(rootElement, userSettings) {
|
|
3870
3569
|
* @function countCols
|
3871
3570
|
* @returns {number} Total number of columns.
|
3872
3571
|
*/
|
3873
|
-
|
3874
|
-
|
3875
3572
|
this.countCols = function () {
|
3876
3573
|
var maxCols = tableMeta.maxCols;
|
3877
3574
|
var dataLen = this.columnIndexMapper.getNotTrimmedIndexesLength();
|
3878
3575
|
return Math.min(maxCols, dataLen);
|
3879
3576
|
};
|
3577
|
+
|
3880
3578
|
/**
|
3881
3579
|
* Returns the number of rendered rows including rows that are partially or fully rendered
|
3882
3580
|
* outside the table viewport.
|
@@ -3885,11 +3583,10 @@ export default function Core(rootElement, userSettings) {
|
|
3885
3583
|
* @function countRenderedRows
|
3886
3584
|
* @returns {number} Returns -1 if table is not visible.
|
3887
3585
|
*/
|
3888
|
-
|
3889
|
-
|
3890
3586
|
this.countRenderedRows = function () {
|
3891
3587
|
return instance.view._wt.drawn ? instance.view._wt.wtTable.getRenderedRowsCount() : -1;
|
3892
3588
|
};
|
3589
|
+
|
3893
3590
|
/**
|
3894
3591
|
* Returns the number of rendered rows that are only visible in the table viewport.
|
3895
3592
|
* The rows that are partially visible are not counted.
|
@@ -3898,11 +3595,10 @@ export default function Core(rootElement, userSettings) {
|
|
3898
3595
|
* @function countVisibleRows
|
3899
3596
|
* @returns {number} Number of visible rows or -1.
|
3900
3597
|
*/
|
3901
|
-
|
3902
|
-
|
3903
3598
|
this.countVisibleRows = function () {
|
3904
3599
|
return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleRowsCount() : -1;
|
3905
3600
|
};
|
3601
|
+
|
3906
3602
|
/**
|
3907
3603
|
* Returns the number of rendered rows including columns that are partially or fully rendered
|
3908
3604
|
* outside the table viewport.
|
@@ -3911,11 +3607,10 @@ export default function Core(rootElement, userSettings) {
|
|
3911
3607
|
* @function countRenderedCols
|
3912
3608
|
* @returns {number} Returns -1 if table is not visible.
|
3913
3609
|
*/
|
3914
|
-
|
3915
|
-
|
3916
3610
|
this.countRenderedCols = function () {
|
3917
3611
|
return instance.view._wt.drawn ? instance.view._wt.wtTable.getRenderedColumnsCount() : -1;
|
3918
3612
|
};
|
3613
|
+
|
3919
3614
|
/**
|
3920
3615
|
* Returns the number of rendered columns that are only visible in the table viewport.
|
3921
3616
|
* The columns that are partially visible are not counted.
|
@@ -3924,11 +3619,10 @@ export default function Core(rootElement, userSettings) {
|
|
3924
3619
|
* @function countVisibleCols
|
3925
3620
|
* @returns {number} Number of visible columns or -1.
|
3926
3621
|
*/
|
3927
|
-
|
3928
|
-
|
3929
3622
|
this.countVisibleCols = function () {
|
3930
3623
|
return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleColumnsCount() : -1;
|
3931
3624
|
};
|
3625
|
+
|
3932
3626
|
/**
|
3933
3627
|
* Returns the number of empty rows. If the optional ending parameter is `true`, returns the
|
3934
3628
|
* number of empty rows at the bottom of the table.
|
@@ -3938,8 +3632,6 @@ export default function Core(rootElement, userSettings) {
|
|
3938
3632
|
* @param {boolean} [ending=false] If `true`, will only count empty rows at the end of the data source.
|
3939
3633
|
* @returns {number} Count empty rows.
|
3940
3634
|
*/
|
3941
|
-
|
3942
|
-
|
3943
3635
|
this.countEmptyRows = function () {
|
3944
3636
|
var ending = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
3945
3637
|
var emptyRows = 0;
|
@@ -3952,6 +3644,7 @@ export default function Core(rootElement, userSettings) {
|
|
3952
3644
|
});
|
3953
3645
|
return emptyRows;
|
3954
3646
|
};
|
3647
|
+
|
3955
3648
|
/**
|
3956
3649
|
* Returns the number of empty columns. If the optional ending parameter is `true`, returns the number of empty
|
3957
3650
|
* columns at right hand edge of the table.
|
@@ -3961,15 +3654,8 @@ export default function Core(rootElement, userSettings) {
|
|
3961
3654
|
* @param {boolean} [ending=false] If `true`, will only count empty columns at the end of the data source row.
|
3962
3655
|
* @returns {number} Count empty cols.
|
3963
3656
|
*/
|
3964
|
-
|
3965
|
-
|
3966
3657
|
this.countEmptyCols = function () {
|
3967
3658
|
var ending = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
3968
|
-
|
3969
|
-
if (instance.countRows() < 1) {
|
3970
|
-
return 0;
|
3971
|
-
}
|
3972
|
-
|
3973
3659
|
var emptyColumns = 0;
|
3974
3660
|
rangeEachReverse(instance.countCols() - 1, function (visualIndex) {
|
3975
3661
|
if (instance.isEmptyCol(visualIndex)) {
|
@@ -3980,6 +3666,7 @@ export default function Core(rootElement, userSettings) {
|
|
3980
3666
|
});
|
3981
3667
|
return emptyColumns;
|
3982
3668
|
};
|
3669
|
+
|
3983
3670
|
/**
|
3984
3671
|
* Check if all cells in the row declared by the `row` argument are empty.
|
3985
3672
|
*
|
@@ -3988,11 +3675,10 @@ export default function Core(rootElement, userSettings) {
|
|
3988
3675
|
* @param {number} row Visual row index.
|
3989
3676
|
* @returns {boolean} `true` if the row at the given `row` is empty, `false` otherwise.
|
3990
3677
|
*/
|
3991
|
-
|
3992
|
-
|
3993
3678
|
this.isEmptyRow = function (row) {
|
3994
3679
|
return tableMeta.isEmptyRow.call(instance, row);
|
3995
3680
|
};
|
3681
|
+
|
3996
3682
|
/**
|
3997
3683
|
* Check if all cells in the the column declared by the `column` argument are empty.
|
3998
3684
|
*
|
@@ -4001,11 +3687,10 @@ export default function Core(rootElement, userSettings) {
|
|
4001
3687
|
* @param {number} column Column index.
|
4002
3688
|
* @returns {boolean} `true` if the column at the given `col` is empty, `false` otherwise.
|
4003
3689
|
*/
|
4004
|
-
|
4005
|
-
|
4006
3690
|
this.isEmptyCol = function (column) {
|
4007
3691
|
return tableMeta.isEmptyCol.call(instance, column);
|
4008
3692
|
};
|
3693
|
+
|
4009
3694
|
/**
|
4010
3695
|
* Select cell specified by `row` and `column` values or a range of cells finishing at `endRow`, `endCol`. If the table
|
4011
3696
|
* was configured to support data column properties that properties can be used to making a selection.
|
@@ -4037,18 +3722,15 @@ export default function Core(rootElement, userSettings) {
|
|
4037
3722
|
* @param {boolean} [changeListener=true] If `false`, Handsontable will not change keyboard events listener to himself.
|
4038
3723
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
4039
3724
|
*/
|
4040
|
-
|
4041
|
-
|
4042
3725
|
this.selectCell = function (row, column, endRow, endColumn) {
|
4043
3726
|
var scrollToCell = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
4044
3727
|
var changeListener = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
|
4045
|
-
|
4046
3728
|
if (isUndefined(row) || isUndefined(column)) {
|
4047
3729
|
return false;
|
4048
3730
|
}
|
4049
|
-
|
4050
3731
|
return this.selectCells([[row, column, endRow, endColumn]], scrollToCell, changeListener);
|
4051
3732
|
};
|
3733
|
+
|
4052
3734
|
/**
|
4053
3735
|
* Make multiple, non-contiguous selection specified by `row` and `column` values or a range of cells
|
4054
3736
|
* finishing at `endRow`, `endColumn`. The method supports two input formats which are the same as that
|
@@ -4082,26 +3764,21 @@ export default function Core(rootElement, userSettings) {
|
|
4082
3764
|
* @param {boolean} [changeListener=true] If `false`, Handsontable will not change keyboard events listener to himself.
|
4083
3765
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
4084
3766
|
*/
|
4085
|
-
|
4086
|
-
|
4087
3767
|
this.selectCells = function () {
|
4088
3768
|
var coords = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [[]];
|
4089
3769
|
var scrollToCell = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
4090
3770
|
var changeListener = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
4091
|
-
|
4092
3771
|
if (scrollToCell === false) {
|
4093
3772
|
preventScrollingToCell = true;
|
4094
3773
|
}
|
4095
|
-
|
4096
3774
|
var wasSelected = selection.selectCells(coords);
|
4097
|
-
|
4098
3775
|
if (wasSelected && changeListener) {
|
4099
3776
|
instance.listen();
|
4100
3777
|
}
|
4101
|
-
|
4102
3778
|
preventScrollingToCell = false;
|
4103
3779
|
return wasSelected;
|
4104
3780
|
};
|
3781
|
+
|
4105
3782
|
/**
|
4106
3783
|
* Select column specified by `startColumn` visual index, column property or a range of columns finishing at `endColumn`.
|
4107
3784
|
*
|
@@ -4125,12 +3802,11 @@ export default function Core(rootElement, userSettings) {
|
|
4125
3802
|
* is not defined the column defined by `startColumn` will be selected.
|
4126
3803
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
4127
3804
|
*/
|
4128
|
-
|
4129
|
-
|
4130
3805
|
this.selectColumns = function (startColumn) {
|
4131
3806
|
var endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
|
4132
3807
|
return selection.selectColumns(startColumn, endColumn);
|
4133
3808
|
};
|
3809
|
+
|
4134
3810
|
/**
|
4135
3811
|
* Select row specified by `startRow` visual index or a range of rows finishing at `endRow`.
|
4136
3812
|
*
|
@@ -4150,23 +3826,21 @@ export default function Core(rootElement, userSettings) {
|
|
4150
3826
|
* is not defined the row defined by `startRow` will be selected.
|
4151
3827
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
4152
3828
|
*/
|
4153
|
-
|
4154
|
-
|
4155
3829
|
this.selectRows = function (startRow) {
|
4156
3830
|
var endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
|
4157
3831
|
return selection.selectRows(startRow, endRow);
|
4158
3832
|
};
|
3833
|
+
|
4159
3834
|
/**
|
4160
3835
|
* Deselects the current cell selection on the table.
|
4161
3836
|
*
|
4162
3837
|
* @memberof Core#
|
4163
3838
|
* @function deselectCell
|
4164
3839
|
*/
|
4165
|
-
|
4166
|
-
|
4167
3840
|
this.deselectCell = function () {
|
4168
3841
|
selection.deselect();
|
4169
3842
|
};
|
3843
|
+
|
4170
3844
|
/**
|
4171
3845
|
* Select the whole table. The previous selection will be overwritten.
|
4172
3846
|
*
|
@@ -4176,8 +3850,6 @@ export default function Core(rootElement, userSettings) {
|
|
4176
3850
|
* @param {boolean} [includeHeaders=true] `true` If the selection should include the row, column and corner headers,
|
4177
3851
|
* `false` otherwise.
|
4178
3852
|
*/
|
4179
|
-
|
4180
|
-
|
4181
3853
|
this.selectAll = function () {
|
4182
3854
|
var includeHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
4183
3855
|
var includeRowHeaders = includeHeaders && this.hasRowHeaders();
|
@@ -4186,11 +3858,11 @@ export default function Core(rootElement, userSettings) {
|
|
4186
3858
|
selection.selectAll(includeRowHeaders, includeColumnHeaders);
|
4187
3859
|
preventScrollingToCell = false;
|
4188
3860
|
};
|
4189
|
-
|
4190
3861
|
var getIndexToScroll = function getIndexToScroll(indexMapper, visualIndex) {
|
4191
3862
|
// Looking for a visual index on the right and then (when not found) on the left.
|
4192
3863
|
return indexMapper.getNearestNotHiddenIndex(visualIndex, 1, true);
|
4193
3864
|
};
|
3865
|
+
|
4194
3866
|
/**
|
4195
3867
|
* Scroll viewport to coordinates specified by the `row` and `column` arguments.
|
4196
3868
|
*
|
@@ -4208,8 +3880,6 @@ export default function Core(rootElement, userSettings) {
|
|
4208
3880
|
* may be rendered when they are in the viewport (we don't consider hidden indexes as they aren't rendered).
|
4209
3881
|
* @returns {boolean} `true` if scroll was successful, `false` otherwise.
|
4210
3882
|
*/
|
4211
|
-
|
4212
|
-
|
4213
3883
|
this.scrollViewportTo = function (row, column) {
|
4214
3884
|
var snapToBottom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
4215
3885
|
var snapToRight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
@@ -4218,40 +3888,31 @@ export default function Core(rootElement, userSettings) {
|
|
4218
3888
|
var snapToLeft = !snapToRight;
|
4219
3889
|
var renderableRow = row;
|
4220
3890
|
var renderableColumn = column;
|
4221
|
-
|
4222
3891
|
if (considerHiddenIndexes) {
|
4223
3892
|
var _isRowInteger = Number.isInteger(row);
|
4224
|
-
|
4225
3893
|
var _isColumnInteger = Number.isInteger(column);
|
4226
|
-
|
4227
3894
|
var visualRowToScroll = _isRowInteger ? getIndexToScroll(this.rowIndexMapper, row) : void 0;
|
4228
3895
|
var visualColumnToScroll = _isColumnInteger ? getIndexToScroll(this.columnIndexMapper, column) : void 0;
|
4229
|
-
|
4230
3896
|
if (visualRowToScroll === null || visualColumnToScroll === null) {
|
4231
3897
|
return false;
|
4232
3898
|
}
|
4233
|
-
|
4234
3899
|
renderableRow = _isRowInteger ? instance.rowIndexMapper.getRenderableFromVisualIndex(visualRowToScroll) : void 0;
|
4235
3900
|
renderableColumn = _isColumnInteger ? instance.columnIndexMapper.getRenderableFromVisualIndex(visualColumnToScroll) : void 0;
|
4236
3901
|
}
|
4237
|
-
|
4238
3902
|
var isRowInteger = Number.isInteger(renderableRow);
|
4239
3903
|
var isColumnInteger = Number.isInteger(renderableColumn);
|
4240
|
-
|
4241
3904
|
if (isRowInteger && isColumnInteger) {
|
4242
3905
|
return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), snapToTop, snapToRight, snapToBottom, snapToLeft);
|
4243
3906
|
}
|
4244
|
-
|
4245
3907
|
if (isRowInteger && isColumnInteger === false) {
|
4246
3908
|
return instance.view.scrollViewportVertically(renderableRow, snapToTop, snapToBottom);
|
4247
3909
|
}
|
4248
|
-
|
4249
3910
|
if (isColumnInteger && isRowInteger === false) {
|
4250
3911
|
return instance.view.scrollViewportHorizontally(renderableColumn, snapToRight, snapToLeft);
|
4251
3912
|
}
|
4252
|
-
|
4253
3913
|
return false;
|
4254
3914
|
};
|
3915
|
+
|
4255
3916
|
/**
|
4256
3917
|
* Removes the table from the DOM and destroys the instance of the Handsontable.
|
4257
3918
|
*
|
@@ -4259,50 +3920,39 @@ export default function Core(rootElement, userSettings) {
|
|
4259
3920
|
* @function destroy
|
4260
3921
|
* @fires Hooks#afterDestroy
|
4261
3922
|
*/
|
4262
|
-
|
4263
|
-
|
4264
3923
|
this.destroy = function () {
|
4265
3924
|
instance._clearTimeouts();
|
4266
|
-
|
4267
3925
|
instance._clearImmediates();
|
4268
|
-
|
4269
3926
|
if (instance.view) {
|
4270
3927
|
// in case HT is destroyed before initialization has finished
|
4271
3928
|
instance.view.destroy();
|
4272
3929
|
}
|
4273
|
-
|
4274
3930
|
if (dataSource) {
|
4275
3931
|
dataSource.destroy();
|
4276
3932
|
}
|
4277
|
-
|
4278
3933
|
dataSource = null;
|
4279
3934
|
this.getShortcutManager().destroy();
|
4280
3935
|
metaManager.clearCache();
|
4281
|
-
|
4282
3936
|
if (isRootInstance(instance)) {
|
4283
3937
|
var licenseInfo = this.rootDocument.querySelector('#hot-display-license-info');
|
4284
|
-
|
4285
3938
|
if (licenseInfo) {
|
4286
3939
|
licenseInfo.parentNode.removeChild(licenseInfo);
|
4287
3940
|
}
|
4288
3941
|
}
|
4289
|
-
|
4290
3942
|
empty(instance.rootElement);
|
4291
3943
|
eventManager.destroy();
|
4292
|
-
|
4293
3944
|
if (editorManager) {
|
4294
3945
|
editorManager.destroy();
|
4295
|
-
}
|
4296
|
-
// unregistration of plugin's maps. Some unregistered maps reset the cache.
|
4297
|
-
|
3946
|
+
}
|
4298
3947
|
|
3948
|
+
// The plugin's `destroy` method is called as a consequence and it should handle
|
3949
|
+
// unregistration of plugin's maps. Some unregistered maps reset the cache.
|
4299
3950
|
instance.batchExecution(function () {
|
4300
3951
|
instance.rowIndexMapper.unregisterAll();
|
4301
3952
|
instance.columnIndexMapper.unregisterAll();
|
4302
3953
|
pluginsRegistry.getItems().forEach(function (_ref20) {
|
4303
3954
|
var _ref21 = _slicedToArray(_ref20, 2),
|
4304
|
-
|
4305
|
-
|
3955
|
+
plugin = _ref21[1];
|
4306
3956
|
plugin.destroy();
|
4307
3957
|
});
|
4308
3958
|
pluginsRegistry.clear();
|
@@ -4319,13 +3969,13 @@ export default function Core(rootElement, userSettings) {
|
|
4319
3969
|
obj[key] = null;
|
4320
3970
|
}
|
4321
3971
|
});
|
4322
|
-
instance.isDestroyed = true;
|
4323
|
-
// it should not be necessary but this prevents a memory leak side effects that show itself in Jasmine tests
|
3972
|
+
instance.isDestroyed = true;
|
4324
3973
|
|
3974
|
+
// replace private properties with null (restores memory)
|
3975
|
+
// it should not be necessary but this prevents a memory leak side effects that show itself in Jasmine tests
|
4325
3976
|
if (datamap) {
|
4326
3977
|
datamap.destroy();
|
4327
3978
|
}
|
4328
|
-
|
4329
3979
|
instance.rowIndexMapper = null;
|
4330
3980
|
instance.columnIndexMapper = null;
|
4331
3981
|
datamap = null;
|
@@ -4334,6 +3984,7 @@ export default function Core(rootElement, userSettings) {
|
|
4334
3984
|
editorManager = null;
|
4335
3985
|
instance = null;
|
4336
3986
|
};
|
3987
|
+
|
4337
3988
|
/**
|
4338
3989
|
* Replacement for all methods after the Handsontable was destroyed.
|
4339
3990
|
*
|
@@ -4341,13 +3992,12 @@ export default function Core(rootElement, userSettings) {
|
|
4341
3992
|
* @param {string} method The method name.
|
4342
3993
|
* @returns {Function}
|
4343
3994
|
*/
|
4344
|
-
|
4345
|
-
|
4346
3995
|
function postMortem(method) {
|
4347
3996
|
return function () {
|
4348
3997
|
throw new Error("The \"".concat(method, "\" method cannot be called because this Handsontable instance has been destroyed"));
|
4349
3998
|
};
|
4350
3999
|
}
|
4000
|
+
|
4351
4001
|
/**
|
4352
4002
|
* Returns the active editor class instance.
|
4353
4003
|
*
|
@@ -4355,11 +4005,10 @@ export default function Core(rootElement, userSettings) {
|
|
4355
4005
|
* @function getActiveEditor
|
4356
4006
|
* @returns {BaseEditor} The active editor instance.
|
4357
4007
|
*/
|
4358
|
-
|
4359
|
-
|
4360
4008
|
this.getActiveEditor = function () {
|
4361
4009
|
return editorManager.getActiveEditor();
|
4362
4010
|
};
|
4011
|
+
|
4363
4012
|
/**
|
4364
4013
|
* Returns plugin instance by provided its name.
|
4365
4014
|
*
|
@@ -4368,17 +4017,16 @@ export default function Core(rootElement, userSettings) {
|
|
4368
4017
|
* @param {string} pluginName The plugin name.
|
4369
4018
|
* @returns {BasePlugin|undefined} The plugin instance or undefined if there is no plugin.
|
4370
4019
|
*/
|
4371
|
-
|
4372
|
-
|
4373
4020
|
this.getPlugin = function (pluginName) {
|
4374
|
-
var unifiedPluginName = toUpperCaseFirst(pluginName);
|
4021
|
+
var unifiedPluginName = toUpperCaseFirst(pluginName);
|
4375
4022
|
|
4023
|
+
// Workaround for the UndoRedo plugin which, currently doesn't follow the plugin architecture.
|
4376
4024
|
if (unifiedPluginName === 'UndoRedo') {
|
4377
4025
|
return this.undoRedo;
|
4378
4026
|
}
|
4379
|
-
|
4380
4027
|
return pluginsRegistry.getItem(unifiedPluginName);
|
4381
4028
|
};
|
4029
|
+
|
4382
4030
|
/**
|
4383
4031
|
* Returns name of the passed plugin.
|
4384
4032
|
*
|
@@ -4387,16 +4035,14 @@ export default function Core(rootElement, userSettings) {
|
|
4387
4035
|
* @param {BasePlugin} plugin The plugin instance.
|
4388
4036
|
* @returns {string}
|
4389
4037
|
*/
|
4390
|
-
|
4391
|
-
|
4392
4038
|
this.getPluginName = function (plugin) {
|
4393
4039
|
// Workaround for the UndoRedo plugin which, currently doesn't follow the plugin architecture.
|
4394
4040
|
if (plugin === this.undoRedo) {
|
4395
4041
|
return this.undoRedo.constructor.PLUGIN_KEY;
|
4396
4042
|
}
|
4397
|
-
|
4398
4043
|
return pluginsRegistry.getId(plugin);
|
4399
4044
|
};
|
4045
|
+
|
4400
4046
|
/**
|
4401
4047
|
* Returns the Handsontable instance.
|
4402
4048
|
*
|
@@ -4404,11 +4050,10 @@ export default function Core(rootElement, userSettings) {
|
|
4404
4050
|
* @function getInstance
|
4405
4051
|
* @returns {Handsontable} The Handsontable instance.
|
4406
4052
|
*/
|
4407
|
-
|
4408
|
-
|
4409
4053
|
this.getInstance = function () {
|
4410
4054
|
return instance;
|
4411
4055
|
};
|
4056
|
+
|
4412
4057
|
/**
|
4413
4058
|
* Adds listener to the specified hook name (only for this Handsontable instance).
|
4414
4059
|
*
|
@@ -4422,11 +4067,10 @@ export default function Core(rootElement, userSettings) {
|
|
4422
4067
|
* hot.addHook('beforeInit', myCallback);
|
4423
4068
|
* ```
|
4424
4069
|
*/
|
4425
|
-
|
4426
|
-
|
4427
4070
|
this.addHook = function (key, callback) {
|
4428
4071
|
Hooks.getSingleton().add(key, callback, instance);
|
4429
4072
|
};
|
4073
|
+
|
4430
4074
|
/**
|
4431
4075
|
* Check if for a specified hook name there are added listeners (only for this Handsontable instance). All available
|
4432
4076
|
* hooks you will find {@link Hooks}.
|
@@ -4442,11 +4086,10 @@ export default function Core(rootElement, userSettings) {
|
|
4442
4086
|
* const hasBeforeInitListeners = hot.hasHook('beforeInit');
|
4443
4087
|
* ```
|
4444
4088
|
*/
|
4445
|
-
|
4446
|
-
|
4447
4089
|
this.hasHook = function (key) {
|
4448
4090
|
return Hooks.getSingleton().has(key, instance) || Hooks.getSingleton().has(key);
|
4449
4091
|
};
|
4092
|
+
|
4450
4093
|
/**
|
4451
4094
|
* Adds listener to specified hook name (only for this Handsontable instance). After the listener is triggered,
|
4452
4095
|
* it will be automatically removed.
|
@@ -4461,11 +4104,10 @@ export default function Core(rootElement, userSettings) {
|
|
4461
4104
|
* hot.addHookOnce('beforeInit', myCallback);
|
4462
4105
|
* ```
|
4463
4106
|
*/
|
4464
|
-
|
4465
|
-
|
4466
4107
|
this.addHookOnce = function (key, callback) {
|
4467
4108
|
Hooks.getSingleton().once(key, callback, instance);
|
4468
4109
|
};
|
4110
|
+
|
4469
4111
|
/**
|
4470
4112
|
* Removes the hook listener previously registered with {@link Core#addHook}.
|
4471
4113
|
*
|
@@ -4480,11 +4122,10 @@ export default function Core(rootElement, userSettings) {
|
|
4480
4122
|
* hot.removeHook('beforeInit', myCallback);
|
4481
4123
|
* ```
|
4482
4124
|
*/
|
4483
|
-
|
4484
|
-
|
4485
4125
|
this.removeHook = function (key, callback) {
|
4486
4126
|
Hooks.getSingleton().remove(key, callback, instance);
|
4487
4127
|
};
|
4128
|
+
|
4488
4129
|
/**
|
4489
4130
|
* Run the callbacks for the hook provided in the `key` argument using the parameters given in the other arguments.
|
4490
4131
|
*
|
@@ -4508,11 +4149,10 @@ export default function Core(rootElement, userSettings) {
|
|
4508
4149
|
* hot.runHooks('customAction', 10, 'foo');
|
4509
4150
|
* ```
|
4510
4151
|
*/
|
4511
|
-
|
4512
|
-
|
4513
4152
|
this.runHooks = function (key, p1, p2, p3, p4, p5, p6) {
|
4514
4153
|
return Hooks.getSingleton().run(instance, key, p1, p2, p3, p4, p5, p6);
|
4515
4154
|
};
|
4155
|
+
|
4516
4156
|
/**
|
4517
4157
|
* Get language phrase for specified dictionary key.
|
4518
4158
|
*
|
@@ -4523,11 +4163,10 @@ export default function Core(rootElement, userSettings) {
|
|
4523
4163
|
* @param {*} extraArguments Arguments which will be handled by formatters.
|
4524
4164
|
* @returns {string}
|
4525
4165
|
*/
|
4526
|
-
|
4527
|
-
|
4528
4166
|
this.getTranslatedPhrase = function (dictionaryKey, extraArguments) {
|
4529
4167
|
return getTranslatedPhrase(tableMeta.language, dictionaryKey, extraArguments);
|
4530
4168
|
};
|
4169
|
+
|
4531
4170
|
/**
|
4532
4171
|
* Converts instance into outerHTML of HTMLTableElement.
|
4533
4172
|
*
|
@@ -4536,11 +4175,10 @@ export default function Core(rootElement, userSettings) {
|
|
4536
4175
|
* @since 7.1.0
|
4537
4176
|
* @returns {string}
|
4538
4177
|
*/
|
4539
|
-
|
4540
|
-
|
4541
4178
|
this.toHTML = function () {
|
4542
4179
|
return instanceToHTML(_this);
|
4543
4180
|
};
|
4181
|
+
|
4544
4182
|
/**
|
4545
4183
|
* Converts instance into HTMLTableElement.
|
4546
4184
|
*
|
@@ -4549,16 +4187,13 @@ export default function Core(rootElement, userSettings) {
|
|
4549
4187
|
* @since 7.1.0
|
4550
4188
|
* @returns {HTMLTableElement}
|
4551
4189
|
*/
|
4552
|
-
|
4553
|
-
|
4554
4190
|
this.toTableElement = function () {
|
4555
4191
|
var tempElement = _this.rootDocument.createElement('div');
|
4556
|
-
|
4557
4192
|
tempElement.insertAdjacentHTML('afterbegin', instanceToHTML(_this));
|
4558
4193
|
return tempElement.firstElementChild;
|
4559
4194
|
};
|
4560
|
-
|
4561
4195
|
this.timeouts = [];
|
4196
|
+
|
4562
4197
|
/**
|
4563
4198
|
* Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called.
|
4564
4199
|
*
|
@@ -4567,53 +4202,48 @@ export default function Core(rootElement, userSettings) {
|
|
4567
4202
|
* @param {number} [delay=0] If first argument is passed as a function this argument set delay of the execution of that function.
|
4568
4203
|
* @private
|
4569
4204
|
*/
|
4570
|
-
|
4571
4205
|
this._registerTimeout = function (handle) {
|
4572
4206
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
4573
4207
|
var handleFunc = handle;
|
4574
|
-
|
4575
4208
|
if (typeof handleFunc === 'function') {
|
4576
4209
|
handleFunc = setTimeout(handleFunc, delay);
|
4577
4210
|
}
|
4578
|
-
|
4579
4211
|
this.timeouts.push(handleFunc);
|
4580
4212
|
};
|
4213
|
+
|
4581
4214
|
/**
|
4582
4215
|
* Clears all known timeouts.
|
4583
4216
|
*
|
4584
4217
|
* @private
|
4585
4218
|
*/
|
4586
|
-
|
4587
|
-
|
4588
4219
|
this._clearTimeouts = function () {
|
4589
4220
|
arrayEach(this.timeouts, function (handler) {
|
4590
4221
|
clearTimeout(handler);
|
4591
4222
|
});
|
4592
4223
|
};
|
4593
|
-
|
4594
4224
|
this.immediates = [];
|
4225
|
+
|
4595
4226
|
/**
|
4596
4227
|
* Execute function execution to the next event loop cycle. Purpose of this method is to clear all known timeouts when `destroy` method is called.
|
4597
4228
|
*
|
4598
4229
|
* @param {Function} callback Function to be delayed in execution.
|
4599
4230
|
* @private
|
4600
4231
|
*/
|
4601
|
-
|
4602
4232
|
this._registerImmediate = function (callback) {
|
4603
4233
|
this.immediates.push(setImmediate(callback));
|
4604
4234
|
};
|
4235
|
+
|
4605
4236
|
/**
|
4606
4237
|
* Clears all known timeouts.
|
4607
4238
|
*
|
4608
4239
|
* @private
|
4609
4240
|
*/
|
4610
|
-
|
4611
|
-
|
4612
4241
|
this._clearImmediates = function () {
|
4613
4242
|
arrayEach(this.immediates, function (handler) {
|
4614
4243
|
clearImmediate(handler);
|
4615
4244
|
});
|
4616
4245
|
};
|
4246
|
+
|
4617
4247
|
/**
|
4618
4248
|
* Refresh selection borders. This is temporary method relic after selection rewrite.
|
4619
4249
|
*
|
@@ -4621,18 +4251,16 @@ export default function Core(rootElement, userSettings) {
|
|
4621
4251
|
* @param {boolean} [revertOriginal=false] If `true`, the previous value will be restored. Otherwise, the edited value will be saved.
|
4622
4252
|
* @param {boolean} [prepareEditorIfNeeded=true] If `true` the editor under the selected cell will be prepared to open.
|
4623
4253
|
*/
|
4624
|
-
|
4625
|
-
|
4626
4254
|
this._refreshBorders = function () {
|
4627
4255
|
var revertOriginal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
4628
4256
|
var prepareEditorIfNeeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
4629
4257
|
editorManager.destroyEditor(revertOriginal);
|
4630
4258
|
instance.view.render();
|
4631
|
-
|
4632
4259
|
if (prepareEditorIfNeeded && selection.isSelected()) {
|
4633
4260
|
editorManager.prepareEditor();
|
4634
4261
|
}
|
4635
4262
|
};
|
4263
|
+
|
4636
4264
|
/**
|
4637
4265
|
* Check if currently it is RTL direction.
|
4638
4266
|
*
|
@@ -4641,11 +4269,10 @@ export default function Core(rootElement, userSettings) {
|
|
4641
4269
|
* @function isRtl
|
4642
4270
|
* @returns {boolean} True if RTL.
|
4643
4271
|
*/
|
4644
|
-
|
4645
|
-
|
4646
4272
|
this.isRtl = function () {
|
4647
4273
|
return instance.rootWindow.getComputedStyle(instance.rootElement).direction === 'rtl';
|
4648
4274
|
};
|
4275
|
+
|
4649
4276
|
/**
|
4650
4277
|
* Check if currently it is LTR direction.
|
4651
4278
|
*
|
@@ -4654,11 +4281,10 @@ export default function Core(rootElement, userSettings) {
|
|
4654
4281
|
* @function isLtr
|
4655
4282
|
* @returns {boolean} True if LTR.
|
4656
4283
|
*/
|
4657
|
-
|
4658
|
-
|
4659
4284
|
this.isLtr = function () {
|
4660
4285
|
return !instance.isRtl();
|
4661
4286
|
};
|
4287
|
+
|
4662
4288
|
/**
|
4663
4289
|
* Returns 1 for LTR; -1 for RTL. Useful for calculations.
|
4664
4290
|
*
|
@@ -4667,12 +4293,9 @@ export default function Core(rootElement, userSettings) {
|
|
4667
4293
|
* @function getDirectionFactor
|
4668
4294
|
* @returns {number} Returns 1 for LTR; -1 for RTL.
|
4669
4295
|
*/
|
4670
|
-
|
4671
|
-
|
4672
4296
|
this.getDirectionFactor = function () {
|
4673
4297
|
return instance.isLtr() ? 1 : -1;
|
4674
4298
|
};
|
4675
|
-
|
4676
4299
|
var shortcutManager = createShortcutManager({
|
4677
4300
|
handleEvent: function handleEvent(event) {
|
4678
4301
|
var isListening = instance.isListening();
|
@@ -4687,11 +4310,11 @@ export default function Core(rootElement, userSettings) {
|
|
4687
4310
|
// Handsontable could be destroyed after performing action (executing a callback).
|
4688
4311
|
return;
|
4689
4312
|
}
|
4690
|
-
|
4691
4313
|
instance.runHooks('afterDocumentKeyDown', event);
|
4692
4314
|
},
|
4693
4315
|
ownerWindow: this.rootWindow
|
4694
4316
|
});
|
4317
|
+
|
4695
4318
|
/**
|
4696
4319
|
* Returns instance of a manager responsible for handling shortcuts stored in some contexts. It run actions after
|
4697
4320
|
* pressing key combination in active Handsontable instance.
|
@@ -4701,11 +4324,9 @@ export default function Core(rootElement, userSettings) {
|
|
4701
4324
|
* @function getShortcutManager
|
4702
4325
|
* @returns {ShortcutManager} Instance of {@link ShortcutManager}
|
4703
4326
|
*/
|
4704
|
-
|
4705
4327
|
this.getShortcutManager = function () {
|
4706
4328
|
return shortcutManager;
|
4707
4329
|
};
|
4708
|
-
|
4709
4330
|
var gridContext = shortcutManager.addContext('grid');
|
4710
4331
|
var gridConfig = {
|
4711
4332
|
runOnlyIf: function runOnlyIf() {
|
@@ -4724,24 +4345,21 @@ export default function Core(rootElement, userSettings) {
|
|
4724
4345
|
callback: function callback() {
|
4725
4346
|
var selectedRange = instance.getSelectedRange();
|
4726
4347
|
var _selectedRange$highli = selectedRange[selectedRange.length - 1].highlight,
|
4727
|
-
|
4728
|
-
|
4348
|
+
highlightRow = _selectedRange$highli.row,
|
4349
|
+
highlightColumn = _selectedRange$highli.col;
|
4729
4350
|
var valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
|
4730
4351
|
var cellValues = new Map();
|
4731
|
-
|
4732
4352
|
for (var i = 0; i < selectedRange.length; i++) {
|
4733
4353
|
selectedRange[i].forAll(function (row, column) {
|
4734
4354
|
if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
|
4735
4355
|
var _instance$getCellMeta = instance.getCellMeta(row, column),
|
4736
|
-
|
4737
|
-
|
4356
|
+
readOnly = _instance$getCellMeta.readOnly;
|
4738
4357
|
if (!readOnly) {
|
4739
4358
|
cellValues.set("".concat(row, "x").concat(column), [row, column, valueToPopulate]);
|
4740
4359
|
}
|
4741
4360
|
}
|
4742
4361
|
});
|
4743
4362
|
}
|
4744
|
-
|
4745
4363
|
instance.setDataAtCell(Array.from(cellValues.values()));
|
4746
4364
|
},
|
4747
4365
|
runOnlyIf: function runOnlyIf() {
|
@@ -4768,9 +4386,8 @@ export default function Core(rootElement, userSettings) {
|
|
4768
4386
|
captureCtrl: true,
|
4769
4387
|
callback: function callback() {
|
4770
4388
|
var _instance$getSelected = instance.getSelectedRangeLast(),
|
4771
|
-
|
4772
|
-
|
4773
|
-
|
4389
|
+
from = _instance$getSelected.from,
|
4390
|
+
to = _instance$getSelected.to;
|
4774
4391
|
var row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
|
4775
4392
|
selection.setRangeStart(from.clone());
|
4776
4393
|
selection.setRangeEnd(instance._createCellCoords(row, to.col));
|
@@ -4799,9 +4416,8 @@ export default function Core(rootElement, userSettings) {
|
|
4799
4416
|
captureCtrl: true,
|
4800
4417
|
callback: function callback() {
|
4801
4418
|
var _instance$getSelected2 = instance.getSelectedRangeLast(),
|
4802
|
-
|
4803
|
-
|
4804
|
-
|
4419
|
+
from = _instance$getSelected2.from,
|
4420
|
+
to = _instance$getSelected2.to;
|
4805
4421
|
var row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
|
4806
4422
|
selection.setRangeStart(from.clone());
|
4807
4423
|
selection.setRangeEnd(instance._createCellCoords(row, to.col));
|
@@ -4819,11 +4435,8 @@ export default function Core(rootElement, userSettings) {
|
|
4819
4435
|
captureCtrl: true,
|
4820
4436
|
callback: function callback() {
|
4821
4437
|
var _instance$columnIndex;
|
4822
|
-
|
4823
4438
|
var row = instance.getSelectedRangeLast().highlight.row;
|
4824
|
-
|
4825
4439
|
var column = (_instance$columnIndex = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
|
4826
|
-
|
4827
4440
|
selection.setRangeStart(instance._createCellCoords(row, column));
|
4828
4441
|
}
|
4829
4442
|
}, {
|
@@ -4836,13 +4449,10 @@ export default function Core(rootElement, userSettings) {
|
|
4836
4449
|
captureCtrl: true,
|
4837
4450
|
callback: function callback() {
|
4838
4451
|
var _instance$columnIndex2;
|
4839
|
-
|
4840
4452
|
var _instance$getSelected3 = instance.getSelectedRangeLast(),
|
4841
|
-
|
4842
|
-
|
4843
|
-
|
4453
|
+
from = _instance$getSelected3.from,
|
4454
|
+
to = _instance$getSelected3.to;
|
4844
4455
|
var column = (_instance$columnIndex2 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex2, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
|
4845
|
-
|
4846
4456
|
selection.setRangeStart(from.clone());
|
4847
4457
|
selection.setRangeEnd(instance._createCellCoords(to.row, column));
|
4848
4458
|
},
|
@@ -4859,11 +4469,8 @@ export default function Core(rootElement, userSettings) {
|
|
4859
4469
|
captureCtrl: true,
|
4860
4470
|
callback: function callback() {
|
4861
4471
|
var _instance$columnIndex3;
|
4862
|
-
|
4863
4472
|
var row = instance.getSelectedRangeLast().highlight.row;
|
4864
|
-
|
4865
4473
|
var column = (_instance$columnIndex3 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex3, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
|
4866
|
-
|
4867
4474
|
selection.setRangeStart(instance._createCellCoords(row, column));
|
4868
4475
|
}
|
4869
4476
|
}, {
|
@@ -4876,13 +4483,10 @@ export default function Core(rootElement, userSettings) {
|
|
4876
4483
|
captureCtrl: true,
|
4877
4484
|
callback: function callback() {
|
4878
4485
|
var _instance$columnIndex4;
|
4879
|
-
|
4880
4486
|
var _instance$getSelected4 = instance.getSelectedRangeLast(),
|
4881
|
-
|
4882
|
-
|
4883
|
-
|
4487
|
+
from = _instance$getSelected4.from,
|
4488
|
+
to = _instance$getSelected4.to;
|
4884
4489
|
var column = (_instance$columnIndex4 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex4, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
|
4885
|
-
|
4886
4490
|
selection.setRangeStart(from.clone());
|
4887
4491
|
selection.setRangeEnd(instance._createCellCoords(to.row, column));
|
4888
4492
|
},
|
@@ -4954,14 +4558,11 @@ export default function Core(rootElement, userSettings) {
|
|
4954
4558
|
keys: [['PageUp', 'Shift']],
|
4955
4559
|
callback: function callback() {
|
4956
4560
|
var _instance$getSelected5 = instance.getSelectedRangeLast(),
|
4957
|
-
|
4958
|
-
|
4561
|
+
to = _instance$getSelected5.to;
|
4959
4562
|
var nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
|
4960
4563
|
var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
|
4961
|
-
|
4962
4564
|
if (row !== null) {
|
4963
4565
|
var coords = instance._createCellCoords(row, to.col);
|
4964
|
-
|
4965
4566
|
var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
|
4966
4567
|
var nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
|
4967
4568
|
selection.setRangeEnd(coords);
|
@@ -4977,14 +4578,11 @@ export default function Core(rootElement, userSettings) {
|
|
4977
4578
|
keys: [['PageDown', 'Shift']],
|
4978
4579
|
callback: function callback() {
|
4979
4580
|
var _instance$getSelected6 = instance.getSelectedRangeLast(),
|
4980
|
-
|
4981
|
-
|
4581
|
+
to = _instance$getSelected6.to;
|
4982
4582
|
var nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
|
4983
4583
|
var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
|
4984
|
-
|
4985
4584
|
if (row !== null) {
|
4986
4585
|
var coords = instance._createCellCoords(row, to.col);
|
4987
|
-
|
4988
4586
|
var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
|
4989
4587
|
var nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
|
4990
4588
|
selection.setRangeEnd(coords);
|