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