handsontable 12.1.3 → 12.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +34 -151
- package/3rdparty/walkontable/src/border.mjs +36 -138
- 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 +63 -230
- package/3rdparty/walkontable/src/table.mjs +73 -219
- 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 +76 -1
- 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 +5 -1
- package/core.js +505 -973
- package/core.mjs +510 -920
- package/dataMap/dataMap.js +106 -210
- package/dataMap/dataMap.mjs +106 -184
- 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 +10 -61
- package/dataMap/metaManager/lazyFactoryMap.mjs +10 -45
- 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 +86 -179
- package/dataMap/metaManager/metaSchema.mjs +86 -170
- 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 +8478 -20043
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +55 -55
- package/dist/handsontable.js +7995 -19560
- 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 +36 -105
- package/editorManager.mjs +36 -85
- 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 +44 -154
- package/editors/baseEditor/baseEditor.mjs +44 -128
- 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 +20 -96
- package/editors/dateEditor/dateEditor.mjs +20 -75
- 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 -8
- package/editors/textEditor/caretPositioner.mjs +10 -18
- 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 +66 -256
- package/helpers/dom/element.mjs +73 -192
- 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 -64
- package/helpers/mixed.mjs +15 -50
- package/helpers/number.js +4 -46
- package/helpers/number.mjs +4 -23
- package/helpers/object.js +15 -68
- package/helpers/object.mjs +21 -50
- 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 -22
- package/helpers/unicode.mjs +17 -13
- 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 -3
- package/pluginHooks.js +271 -96
- package/pluginHooks.mjs +270 -83
- 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 +20 -89
- package/plugins/base/base.mjs +20 -61
- 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 +1 -7
- package/plugins/columnSorting/sortService/engine.mjs +1 -3
- 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 +52 -118
- package/plugins/columnSummary/columnSummary.mjs +52 -93
- 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 +0 -1
- 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 -36
- package/plugins/contextMenu/commandExecutor.mjs +14 -39
- package/plugins/contextMenu/contextMenu.js +21 -104
- package/plugins/contextMenu/contextMenu.mjs +21 -74
- 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 +57 -177
- package/plugins/contextMenu/menu.mjs +57 -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 +51 -185
- package/plugins/copyPaste/copyPaste.mjs +51 -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 +43 -126
- package/plugins/dropdownMenu/dropdownMenu.mjs +43 -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 +15 -94
- package/plugins/filters/component/condition.mjs +18 -67
- package/plugins/filters/component/operators.js +10 -68
- package/plugins/filters/component/operators.mjs +10 -45
- package/plugins/filters/component/value.js +16 -97
- package/plugins/filters/component/value.mjs +19 -70
- 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.js +103 -208
- package/plugins/filters/filters.mjs +103 -163
- 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 -149
- package/plugins/hiddenColumns/hiddenColumns.mjs +72 -108
- 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 -148
- package/plugins/hiddenRows/hiddenRows.mjs +70 -107
- 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 +2 -12
- package/plugins/multiColumnSorting/domHelpers.mjs +2 -5
- 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 +40 -118
- package/plugins/nestedRows/nestedRows.mjs +40 -85
- 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 -96
- package/plugins/search/search.mjs +16 -67
- 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 +59 -85
- package/plugins/trimRows/trimRows.mjs +59 -62
- 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 -21
- package/renderers/numericRenderer/numericRenderer.mjs +1 -9
- 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 +1 -13
- package/renderers/textRenderer/textRenderer.mjs +1 -5
- 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 +9 -40
- package/shortcuts/recorder.mjs +9 -31
- package/shortcuts/utils.js +5 -20
- package/shortcuts/utils.mjs +5 -6
- 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 +68 -156
- package/translations/indexMapper.mjs +68 -123
- 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/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,14 +1537,12 @@ 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.
|
@@ -1752,8 +1565,6 @@ function Core(rootElement, userSettings) {
|
|
1752
1565
|
* Useful **only** when the type of handled cells is `numeric`.
|
1753
1566
|
* @returns {object|undefined} Ending td in pasted area (only if any cell was changed).
|
1754
1567
|
*/
|
1755
|
-
|
1756
|
-
|
1757
1568
|
this.populateFromArray = function (row, column, input, endRow, endCol, source, method, direction, deltas) {
|
1758
1569
|
if (!(_typeof(input) === 'object' && _typeof(input[0]) === 'object')) {
|
1759
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
|
@@ -1762,6 +1573,7 @@ function Core(rootElement, userSettings) {
|
|
1762
1573
|
var c = typeof endRow === 'number' ? instance._createCellCoords(endRow, endCol) : null;
|
1763
1574
|
return grid.populateFromArray(instance._createCellCoords(row, column), input, c, source, method, direction, deltas);
|
1764
1575
|
};
|
1576
|
+
|
1765
1577
|
/**
|
1766
1578
|
* Adds/removes data from the column. This method works the same as Array.splice for arrays.
|
1767
1579
|
*
|
@@ -1773,17 +1585,14 @@ function Core(rootElement, userSettings) {
|
|
1773
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.
|
1774
1586
|
* @returns {Array} Returns removed portion of columns.
|
1775
1587
|
*/
|
1776
|
-
|
1777
|
-
|
1778
1588
|
this.spliceCol = function (column, index, amount) {
|
1779
1589
|
var _datamap;
|
1780
|
-
|
1781
1590
|
for (var _len = arguments.length, elements = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
1782
1591
|
elements[_key - 3] = arguments[_key];
|
1783
1592
|
}
|
1784
|
-
|
1785
1593
|
return (_datamap = datamap).spliceCol.apply(_datamap, [column, index, amount].concat(elements));
|
1786
1594
|
};
|
1595
|
+
|
1787
1596
|
/**
|
1788
1597
|
* Adds/removes data from the row. This method works the same as Array.splice for arrays.
|
1789
1598
|
*
|
@@ -1795,17 +1604,14 @@ function Core(rootElement, userSettings) {
|
|
1795
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.
|
1796
1605
|
* @returns {Array} Returns removed portion of rows.
|
1797
1606
|
*/
|
1798
|
-
|
1799
|
-
|
1800
1607
|
this.spliceRow = function (row, index, amount) {
|
1801
1608
|
var _datamap2;
|
1802
|
-
|
1803
1609
|
for (var _len2 = arguments.length, elements = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
|
1804
1610
|
elements[_key2 - 3] = arguments[_key2];
|
1805
1611
|
}
|
1806
|
-
|
1807
1612
|
return (_datamap2 = datamap).spliceRow.apply(_datamap2, [row, index, amount].concat(elements));
|
1808
1613
|
};
|
1614
|
+
|
1809
1615
|
/**
|
1810
1616
|
* Returns indexes of the currently selected cells as an array of arrays `[[startRow, startCol, endRow, endCol],...]`.
|
1811
1617
|
*
|
@@ -1819,18 +1625,17 @@ function Core(rootElement, userSettings) {
|
|
1819
1625
|
* @function getSelected
|
1820
1626
|
* @returns {Array[]|undefined} An array of arrays of the selection's coordinates.
|
1821
1627
|
*/
|
1822
|
-
|
1823
|
-
|
1824
1628
|
this.getSelected = function () {
|
1825
1629
|
// https://github.com/handsontable/handsontable/issues/44 //cjl
|
1826
1630
|
if (selection.isSelected()) {
|
1827
1631
|
return (0, _array.arrayMap)(selection.getSelectedRange(), function (_ref12) {
|
1828
1632
|
var from = _ref12.from,
|
1829
|
-
|
1633
|
+
to = _ref12.to;
|
1830
1634
|
return [from.row, from.col, to.row, to.col];
|
1831
1635
|
});
|
1832
1636
|
}
|
1833
1637
|
};
|
1638
|
+
|
1834
1639
|
/**
|
1835
1640
|
* Returns the last coordinates applied to the table as a an array `[startRow, startCol, endRow, endCol]`.
|
1836
1641
|
*
|
@@ -1839,18 +1644,15 @@ function Core(rootElement, userSettings) {
|
|
1839
1644
|
* @function getSelectedLast
|
1840
1645
|
* @returns {Array|undefined} An array of the selection's coordinates.
|
1841
1646
|
*/
|
1842
|
-
|
1843
|
-
|
1844
1647
|
this.getSelectedLast = function () {
|
1845
1648
|
var selected = this.getSelected();
|
1846
1649
|
var result;
|
1847
|
-
|
1848
1650
|
if (selected && selected.length > 0) {
|
1849
1651
|
result = selected[selected.length - 1];
|
1850
1652
|
}
|
1851
|
-
|
1852
1653
|
return result;
|
1853
1654
|
};
|
1655
|
+
|
1854
1656
|
/**
|
1855
1657
|
* Returns the current selection as an array of CellRange objects.
|
1856
1658
|
*
|
@@ -1862,14 +1664,13 @@ function Core(rootElement, userSettings) {
|
|
1862
1664
|
* @function getSelectedRange
|
1863
1665
|
* @returns {CellRange[]|undefined} Selected range object or undefined if there is no selection.
|
1864
1666
|
*/
|
1865
|
-
|
1866
|
-
|
1867
1667
|
this.getSelectedRange = function () {
|
1868
1668
|
// https://github.com/handsontable/handsontable/issues/44 //cjl
|
1869
1669
|
if (selection.isSelected()) {
|
1870
1670
|
return Array.from(selection.getSelectedRange());
|
1871
1671
|
}
|
1872
1672
|
};
|
1673
|
+
|
1873
1674
|
/**
|
1874
1675
|
* Returns the last coordinates applied to the table as a CellRange object.
|
1875
1676
|
*
|
@@ -1878,18 +1679,15 @@ function Core(rootElement, userSettings) {
|
|
1878
1679
|
* @since 0.36.0
|
1879
1680
|
* @returns {CellRange|undefined} Selected range object or undefined` if there is no selection.
|
1880
1681
|
*/
|
1881
|
-
|
1882
|
-
|
1883
1682
|
this.getSelectedRangeLast = function () {
|
1884
1683
|
var selectedRange = this.getSelectedRange();
|
1885
1684
|
var result;
|
1886
|
-
|
1887
1685
|
if (selectedRange && selectedRange.length > 0) {
|
1888
1686
|
result = selectedRange[selectedRange.length - 1];
|
1889
1687
|
}
|
1890
|
-
|
1891
1688
|
return result;
|
1892
1689
|
};
|
1690
|
+
|
1893
1691
|
/**
|
1894
1692
|
* Erases content from cells that have been selected in the table.
|
1895
1693
|
*
|
@@ -1898,15 +1696,11 @@ function Core(rootElement, userSettings) {
|
|
1898
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.
|
1899
1697
|
* @since 0.36.0
|
1900
1698
|
*/
|
1901
|
-
|
1902
|
-
|
1903
1699
|
this.emptySelectedCells = function (source) {
|
1904
1700
|
var _this2 = this;
|
1905
|
-
|
1906
1701
|
if (!selection.isSelected() || this.countRows() === 0 || this.countCols() === 0) {
|
1907
1702
|
return;
|
1908
1703
|
}
|
1909
|
-
|
1910
1704
|
var changes = [];
|
1911
1705
|
(0, _array.arrayEach)(selection.getSelectedRange(), function (cellRange) {
|
1912
1706
|
var topStart = cellRange.getTopStartCorner();
|
@@ -1919,11 +1713,11 @@ function Core(rootElement, userSettings) {
|
|
1919
1713
|
});
|
1920
1714
|
});
|
1921
1715
|
});
|
1922
|
-
|
1923
1716
|
if (changes.length > 0) {
|
1924
1717
|
this.setDataAtCell(changes, source);
|
1925
1718
|
}
|
1926
1719
|
};
|
1720
|
+
|
1927
1721
|
/**
|
1928
1722
|
* Checks if the table rendering process was suspended. See explanation in {@link Core#suspendRender}.
|
1929
1723
|
*
|
@@ -1932,11 +1726,10 @@ function Core(rootElement, userSettings) {
|
|
1932
1726
|
* @since 8.3.0
|
1933
1727
|
* @returns {boolean}
|
1934
1728
|
*/
|
1935
|
-
|
1936
|
-
|
1937
1729
|
this.isRenderSuspended = function () {
|
1938
1730
|
return this.renderSuspendedCounter > 0;
|
1939
1731
|
};
|
1732
|
+
|
1940
1733
|
/**
|
1941
1734
|
* Suspends the rendering process. It's helpful to wrap the table render
|
1942
1735
|
* cycles triggered by API calls or UI actions (or both) and call the "render"
|
@@ -1960,8 +1753,8 @@ function Core(rootElement, userSettings) {
|
|
1960
1753
|
* @example
|
1961
1754
|
* ```js
|
1962
1755
|
* hot.suspendRender();
|
1963
|
-
* hot.alter('
|
1964
|
-
* hot.alter('
|
1756
|
+
* hot.alter('insert_row_above', 5, 45);
|
1757
|
+
* hot.alter('insert_col_start', 10, 40);
|
1965
1758
|
* hot.setDataAtCell(1, 1, 'John');
|
1966
1759
|
* hot.setDataAtCell(2, 2, 'Mark');
|
1967
1760
|
* hot.setDataAtCell(3, 3, 'Ann');
|
@@ -1971,11 +1764,10 @@ function Core(rootElement, userSettings) {
|
|
1971
1764
|
* hot.resumeRender(); // It re-renders the table internally
|
1972
1765
|
* ```
|
1973
1766
|
*/
|
1974
|
-
|
1975
|
-
|
1976
1767
|
this.suspendRender = function () {
|
1977
1768
|
this.renderSuspendedCounter += 1;
|
1978
1769
|
};
|
1770
|
+
|
1979
1771
|
/**
|
1980
1772
|
* Resumes the rendering process. In combination with the {@link Core#suspendRender}
|
1981
1773
|
* method it allows aggregating the table render cycles triggered by API calls or UI
|
@@ -1995,8 +1787,8 @@ function Core(rootElement, userSettings) {
|
|
1995
1787
|
* @example
|
1996
1788
|
* ```js
|
1997
1789
|
* hot.suspendRender();
|
1998
|
-
* hot.alter('
|
1999
|
-
* hot.alter('
|
1790
|
+
* hot.alter('insert_row_above', 5, 45);
|
1791
|
+
* hot.alter('insert_col_start', 10, 40);
|
2000
1792
|
* hot.setDataAtCell(1, 1, 'John');
|
2001
1793
|
* hot.setDataAtCell(2, 2, 'Mark');
|
2002
1794
|
* hot.setDataAtCell(3, 3, 'Ann');
|
@@ -2006,12 +1798,9 @@ function Core(rootElement, userSettings) {
|
|
2006
1798
|
* hot.resumeRender(); // It re-renders the table internally
|
2007
1799
|
* ```
|
2008
1800
|
*/
|
2009
|
-
|
2010
|
-
|
2011
1801
|
this.resumeRender = function () {
|
2012
1802
|
var nextValue = this.renderSuspendedCounter - 1;
|
2013
1803
|
this.renderSuspendedCounter = Math.max(nextValue, 0);
|
2014
|
-
|
2015
1804
|
if (!this.isRenderSuspended() && nextValue === this.renderSuspendedCounter) {
|
2016
1805
|
if (this.renderCall) {
|
2017
1806
|
this.render();
|
@@ -2020,6 +1809,7 @@ function Core(rootElement, userSettings) {
|
|
2020
1809
|
}
|
2021
1810
|
}
|
2022
1811
|
};
|
1812
|
+
|
2023
1813
|
/**
|
2024
1814
|
* Rerender the table. Calling this method starts the process of recalculating, redrawing and applying the changes
|
2025
1815
|
* to the DOM. While rendering the table all cell renderers are recalled.
|
@@ -2030,8 +1820,6 @@ function Core(rootElement, userSettings) {
|
|
2030
1820
|
* @memberof Core#
|
2031
1821
|
* @function render
|
2032
1822
|
*/
|
2033
|
-
|
2034
|
-
|
2035
1823
|
this.render = function () {
|
2036
1824
|
if (this.view) {
|
2037
1825
|
this.renderCall = true;
|
@@ -2039,13 +1827,12 @@ function Core(rootElement, userSettings) {
|
|
2039
1827
|
|
2040
1828
|
if (!this.isRenderSuspended()) {
|
2041
1829
|
editorManager.lockEditor();
|
2042
|
-
|
2043
1830
|
this._refreshBorders(null);
|
2044
|
-
|
2045
1831
|
editorManager.unlockEditor();
|
2046
1832
|
}
|
2047
1833
|
}
|
2048
1834
|
};
|
1835
|
+
|
2049
1836
|
/**
|
2050
1837
|
* The method aggregates multi-line API calls into a callback and postpones the
|
2051
1838
|
* table rendering process. After the execution of the operations, the table is
|
@@ -2060,8 +1847,8 @@ function Core(rootElement, userSettings) {
|
|
2060
1847
|
* @example
|
2061
1848
|
* ```js
|
2062
1849
|
* hot.batchRender(() => {
|
2063
|
-
* hot.alter('
|
2064
|
-
* hot.alter('
|
1850
|
+
* hot.alter('insert_row_above', 5, 45);
|
1851
|
+
* hot.alter('insert_col_start', 10, 40);
|
2065
1852
|
* hot.setDataAtCell(1, 1, 'John');
|
2066
1853
|
* hot.setDataAtCell(2, 2, 'Mark');
|
2067
1854
|
* hot.setDataAtCell(3, 3, 'Ann');
|
@@ -2072,14 +1859,13 @@ function Core(rootElement, userSettings) {
|
|
2072
1859
|
* });
|
2073
1860
|
* ```
|
2074
1861
|
*/
|
2075
|
-
|
2076
|
-
|
2077
1862
|
this.batchRender = function (wrappedOperations) {
|
2078
1863
|
this.suspendRender();
|
2079
1864
|
var result = wrappedOperations();
|
2080
1865
|
this.resumeRender();
|
2081
1866
|
return result;
|
2082
1867
|
};
|
1868
|
+
|
2083
1869
|
/**
|
2084
1870
|
* Checks if the table indexes recalculation process was suspended. See explanation
|
2085
1871
|
* in {@link Core#suspendExecution}.
|
@@ -2089,11 +1875,10 @@ function Core(rootElement, userSettings) {
|
|
2089
1875
|
* @since 8.3.0
|
2090
1876
|
* @returns {boolean}
|
2091
1877
|
*/
|
2092
|
-
|
2093
|
-
|
2094
1878
|
this.isExecutionSuspended = function () {
|
2095
1879
|
return this.executionSuspendedCounter > 0;
|
2096
1880
|
};
|
1881
|
+
|
2097
1882
|
/**
|
2098
1883
|
* Suspends the execution process. It's helpful to wrap the table logic changes
|
2099
1884
|
* such as index changes into one call after which the cache is updated. As a result,
|
@@ -2116,13 +1901,12 @@ function Core(rootElement, userSettings) {
|
|
2116
1901
|
* hot.resumeExecution(); // It updates the cache internally
|
2117
1902
|
* ```
|
2118
1903
|
*/
|
2119
|
-
|
2120
|
-
|
2121
1904
|
this.suspendExecution = function () {
|
2122
1905
|
this.executionSuspendedCounter += 1;
|
2123
1906
|
this.columnIndexMapper.suspendOperations();
|
2124
1907
|
this.rowIndexMapper.suspendOperations();
|
2125
1908
|
};
|
1909
|
+
|
2126
1910
|
/**
|
2127
1911
|
* Resumes the execution process. In combination with the {@link Core#suspendExecution}
|
2128
1912
|
* method it allows aggregating the table logic changes after which the cache is
|
@@ -2149,18 +1933,16 @@ function Core(rootElement, userSettings) {
|
|
2149
1933
|
* hot.resumeExecution(); // It updates the cache internally
|
2150
1934
|
* ```
|
2151
1935
|
*/
|
2152
|
-
|
2153
|
-
|
2154
1936
|
this.resumeExecution = function () {
|
2155
1937
|
var forceFlushChanges = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
2156
1938
|
var nextValue = this.executionSuspendedCounter - 1;
|
2157
1939
|
this.executionSuspendedCounter = Math.max(nextValue, 0);
|
2158
|
-
|
2159
1940
|
if (!this.isExecutionSuspended() && nextValue === this.executionSuspendedCounter || forceFlushChanges) {
|
2160
1941
|
this.columnIndexMapper.resumeOperations();
|
2161
1942
|
this.rowIndexMapper.resumeOperations();
|
2162
1943
|
}
|
2163
1944
|
};
|
1945
|
+
|
2164
1946
|
/**
|
2165
1947
|
* The method aggregates multi-line API calls into a callback and postpones the
|
2166
1948
|
* table execution process. After the execution of the operations, the internal table
|
@@ -2187,8 +1969,6 @@ function Core(rootElement, userSettings) {
|
|
2187
1969
|
* });
|
2188
1970
|
* ```
|
2189
1971
|
*/
|
2190
|
-
|
2191
|
-
|
2192
1972
|
this.batchExecution = function (wrappedOperations) {
|
2193
1973
|
var forceFlushChanges = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
2194
1974
|
this.suspendExecution();
|
@@ -2196,6 +1976,7 @@ function Core(rootElement, userSettings) {
|
|
2196
1976
|
this.resumeExecution(forceFlushChanges);
|
2197
1977
|
return result;
|
2198
1978
|
};
|
1979
|
+
|
2199
1980
|
/**
|
2200
1981
|
* It batches the rendering process and index recalculations. The method aggregates
|
2201
1982
|
* multi-line API calls into a callback and postpones the table rendering process
|
@@ -2212,8 +1993,8 @@ function Core(rootElement, userSettings) {
|
|
2212
1993
|
* @example
|
2213
1994
|
* ```js
|
2214
1995
|
* hot.batch(() => {
|
2215
|
-
* hot.alter('
|
2216
|
-
* hot.alter('
|
1996
|
+
* hot.alter('insert_row_above', 5, 45);
|
1997
|
+
* hot.alter('insert_col_start', 10, 40);
|
2217
1998
|
* hot.setDataAtCell(1, 1, 'x');
|
2218
1999
|
* hot.setDataAtCell(2, 2, 'c');
|
2219
2000
|
* hot.setDataAtCell(3, 3, 'v');
|
@@ -2230,8 +2011,6 @@ function Core(rootElement, userSettings) {
|
|
2230
2011
|
* });
|
2231
2012
|
* ```
|
2232
2013
|
*/
|
2233
|
-
|
2234
|
-
|
2235
2014
|
this.batch = function (wrappedOperations) {
|
2236
2015
|
this.suspendRender();
|
2237
2016
|
this.suspendExecution();
|
@@ -2240,6 +2019,7 @@ function Core(rootElement, userSettings) {
|
|
2240
2019
|
this.resumeRender();
|
2241
2020
|
return result;
|
2242
2021
|
};
|
2022
|
+
|
2243
2023
|
/**
|
2244
2024
|
* Updates dimensions of the table. The method compares previous dimensions with the current ones and updates accordingly.
|
2245
2025
|
*
|
@@ -2248,21 +2028,16 @@ function Core(rootElement, userSettings) {
|
|
2248
2028
|
* @fires Hooks#beforeRefreshDimensions
|
2249
2029
|
* @fires Hooks#afterRefreshDimensions
|
2250
2030
|
*/
|
2251
|
-
|
2252
|
-
|
2253
2031
|
this.refreshDimensions = function () {
|
2254
2032
|
if (!instance.view) {
|
2255
2033
|
return;
|
2256
2034
|
}
|
2257
|
-
|
2258
2035
|
var _instance$view$getLas = instance.view.getLastSize(),
|
2259
|
-
|
2260
|
-
|
2261
|
-
|
2036
|
+
lastWidth = _instance$view$getLas.width,
|
2037
|
+
lastHeight = _instance$view$getLas.height;
|
2262
2038
|
var _instance$rootElement = instance.rootElement.getBoundingClientRect(),
|
2263
|
-
|
2264
|
-
|
2265
|
-
|
2039
|
+
width = _instance$rootElement.width,
|
2040
|
+
height = _instance$rootElement.height;
|
2266
2041
|
var isSizeChanged = width !== lastWidth || height !== lastHeight;
|
2267
2042
|
var isResizeBlocked = instance.runHooks('beforeRefreshDimensions', {
|
2268
2043
|
width: lastWidth,
|
@@ -2271,16 +2046,13 @@ function Core(rootElement, userSettings) {
|
|
2271
2046
|
width: width,
|
2272
2047
|
height: height
|
2273
2048
|
}, isSizeChanged) === false;
|
2274
|
-
|
2275
2049
|
if (isResizeBlocked) {
|
2276
2050
|
return;
|
2277
2051
|
}
|
2278
|
-
|
2279
2052
|
if (isSizeChanged || instance.view._wt.wtOverlays.scrollableElement === instance.rootWindow) {
|
2280
2053
|
instance.view.setLastSize(width, height);
|
2281
2054
|
instance.render();
|
2282
2055
|
}
|
2283
|
-
|
2284
2056
|
instance.runHooks('afterRefreshDimensions', {
|
2285
2057
|
width: lastWidth,
|
2286
2058
|
height: lastHeight
|
@@ -2289,6 +2061,7 @@ function Core(rootElement, userSettings) {
|
|
2289
2061
|
height: height
|
2290
2062
|
}, isSizeChanged);
|
2291
2063
|
};
|
2064
|
+
|
2292
2065
|
/**
|
2293
2066
|
* The `updateData()` method replaces Handsontable's [`data`](@/api/options.md#data) with a new dataset.
|
2294
2067
|
*
|
@@ -2312,11 +2085,8 @@ function Core(rootElement, userSettings) {
|
|
2312
2085
|
* @fires Hooks#afterUpdateData
|
2313
2086
|
* @fires Hooks#afterChange
|
2314
2087
|
*/
|
2315
|
-
|
2316
|
-
|
2317
2088
|
this.updateData = function (data, source) {
|
2318
2089
|
var _this3 = this;
|
2319
|
-
|
2320
2090
|
(0, _dataMap.replaceData)(data, function (newDataMap) {
|
2321
2091
|
datamap = newDataMap;
|
2322
2092
|
}, function (newDataMap) {
|
@@ -2333,6 +2103,7 @@ function Core(rootElement, userSettings) {
|
|
2333
2103
|
firstRun: firstRun
|
2334
2104
|
});
|
2335
2105
|
};
|
2106
|
+
|
2336
2107
|
/**
|
2337
2108
|
* The `loadData()` method replaces Handsontable's [`data`](@/api/options.md#data) with a new dataset.
|
2338
2109
|
*
|
@@ -2355,8 +2126,6 @@ function Core(rootElement, userSettings) {
|
|
2355
2126
|
* @fires Hooks#afterLoadData
|
2356
2127
|
* @fires Hooks#afterChange
|
2357
2128
|
*/
|
2358
|
-
|
2359
|
-
|
2360
2129
|
this.loadData = function (data, source) {
|
2361
2130
|
(0, _dataMap.replaceData)(data, function (newDataMap) {
|
2362
2131
|
datamap = newDataMap;
|
@@ -2364,7 +2133,6 @@ function Core(rootElement, userSettings) {
|
|
2364
2133
|
metaManager.clearCellsCache();
|
2365
2134
|
instance.initIndexMappers();
|
2366
2135
|
grid.adjustRowsAndCols();
|
2367
|
-
|
2368
2136
|
if (firstRun) {
|
2369
2137
|
firstRun = [null, 'loadData'];
|
2370
2138
|
}
|
@@ -2377,57 +2145,58 @@ function Core(rootElement, userSettings) {
|
|
2377
2145
|
firstRun: firstRun
|
2378
2146
|
});
|
2379
2147
|
};
|
2148
|
+
|
2380
2149
|
/**
|
2381
2150
|
* Gets the initial column count, calculated based on the `columns` setting.
|
2382
2151
|
*
|
2383
2152
|
* @private
|
2384
2153
|
* @returns {number} The calculated number of columns.
|
2385
2154
|
*/
|
2386
|
-
|
2387
|
-
|
2388
2155
|
this.getInitialColumnCount = function () {
|
2389
2156
|
var columnsSettings = tableMeta.columns;
|
2390
|
-
var finalNrOfColumns = 0;
|
2391
|
-
// narrow down or expand displayed dataset in that case.
|
2157
|
+
var finalNrOfColumns = 0;
|
2392
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.
|
2393
2161
|
if (Array.isArray(columnsSettings)) {
|
2394
2162
|
finalNrOfColumns = columnsSettings.length;
|
2395
2163
|
} else if ((0, _function.isFunction)(columnsSettings)) {
|
2396
2164
|
if (instance.dataType === 'array') {
|
2397
2165
|
var nrOfSourceColumns = this.countSourceCols();
|
2398
|
-
|
2399
2166
|
for (var columnIndex = 0; columnIndex < nrOfSourceColumns; columnIndex += 1) {
|
2400
2167
|
if (columnsSettings(columnIndex)) {
|
2401
2168
|
finalNrOfColumns += 1;
|
2402
2169
|
}
|
2403
|
-
}
|
2170
|
+
}
|
2404
2171
|
|
2172
|
+
// Extended dataset by the `columns` property? Moved code right from the refactored `countCols` method.
|
2405
2173
|
} else if (instance.dataType === 'object' || instance.dataType === 'function') {
|
2406
2174
|
finalNrOfColumns = datamap.colToPropCache.length;
|
2407
|
-
}
|
2175
|
+
}
|
2408
2176
|
|
2177
|
+
// In some cases we need to check columns length from the schema, i.e. `data` may be empty.
|
2409
2178
|
} else if ((0, _mixed.isDefined)(tableMeta.dataSchema)) {
|
2410
|
-
var schema = datamap.getSchema();
|
2179
|
+
var schema = datamap.getSchema();
|
2411
2180
|
|
2181
|
+
// Schema may be defined as an array of objects. Each object will define column.
|
2412
2182
|
finalNrOfColumns = Array.isArray(schema) ? schema.length : (0, _object.deepObjectSize)(schema);
|
2413
2183
|
} else {
|
2414
2184
|
// We init index mappers by length of source data to provide indexes also for skipped indexes.
|
2415
2185
|
finalNrOfColumns = this.countSourceCols();
|
2416
2186
|
}
|
2417
|
-
|
2418
2187
|
return finalNrOfColumns;
|
2419
2188
|
};
|
2189
|
+
|
2420
2190
|
/**
|
2421
2191
|
* Init index mapper which manage indexes assigned to the data.
|
2422
2192
|
*
|
2423
2193
|
* @private
|
2424
2194
|
*/
|
2425
|
-
|
2426
|
-
|
2427
2195
|
this.initIndexMappers = function () {
|
2428
2196
|
this.columnIndexMapper.initToLength(this.getInitialColumnCount());
|
2429
2197
|
this.rowIndexMapper.initToLength(this.countSourceRows());
|
2430
2198
|
};
|
2199
|
+
|
2431
2200
|
/**
|
2432
2201
|
* Returns the current data object (the same one that was passed by `data` configuration option or `loadData` method,
|
2433
2202
|
* unless some modifications have been applied (i.e. Sequence of rows/columns was changed, some row/column was skipped).
|
@@ -2452,15 +2221,13 @@ function Core(rootElement, userSettings) {
|
|
2452
2221
|
* hot.getData(2, 1, 3, 3);
|
2453
2222
|
* ```
|
2454
2223
|
*/
|
2455
|
-
|
2456
|
-
|
2457
2224
|
this.getData = function (row, column, row2, column2) {
|
2458
2225
|
if ((0, _mixed.isUndefined)(row)) {
|
2459
2226
|
return datamap.getAll();
|
2460
2227
|
}
|
2461
|
-
|
2462
2228
|
return datamap.getRange(instance._createCellCoords(row, column), instance._createCellCoords(row2, column2), datamap.DESTINATION_RENDERER);
|
2463
2229
|
};
|
2230
|
+
|
2464
2231
|
/**
|
2465
2232
|
* Returns a string value of the selected range. Each column is separated by tab, each row is separated by a new
|
2466
2233
|
* line character.
|
@@ -2473,11 +2240,10 @@ function Core(rootElement, userSettings) {
|
|
2473
2240
|
* @param {number} endCol To visual column index.
|
2474
2241
|
* @returns {string}
|
2475
2242
|
*/
|
2476
|
-
|
2477
|
-
|
2478
2243
|
this.getCopyableText = function (startRow, startCol, endRow, endCol) {
|
2479
2244
|
return datamap.getCopyableText(instance._createCellCoords(startRow, startCol), instance._createCellCoords(endRow, endCol));
|
2480
2245
|
};
|
2246
|
+
|
2481
2247
|
/**
|
2482
2248
|
* Returns the data's copyable value at specified `row` and `column` index.
|
2483
2249
|
*
|
@@ -2487,11 +2253,10 @@ function Core(rootElement, userSettings) {
|
|
2487
2253
|
* @param {number} column Visual column index.
|
2488
2254
|
* @returns {string}
|
2489
2255
|
*/
|
2490
|
-
|
2491
|
-
|
2492
2256
|
this.getCopyableData = function (row, column) {
|
2493
2257
|
return datamap.getCopyable(row, datamap.colToProp(column));
|
2494
2258
|
};
|
2259
|
+
|
2495
2260
|
/**
|
2496
2261
|
* Returns schema provided by constructor settings. If it doesn't exist then it returns the schema based on the data
|
2497
2262
|
* structure in the first row.
|
@@ -2500,11 +2265,10 @@ function Core(rootElement, userSettings) {
|
|
2500
2265
|
* @function getSchema
|
2501
2266
|
* @returns {object} Schema object.
|
2502
2267
|
*/
|
2503
|
-
|
2504
|
-
|
2505
2268
|
this.getSchema = function () {
|
2506
2269
|
return datamap.getSchema();
|
2507
2270
|
};
|
2271
|
+
|
2508
2272
|
/**
|
2509
2273
|
* Use it if you need to change configuration after initialization. The `settings` argument is an object containing the changed
|
2510
2274
|
* settings, declared the same way as in the initial settings object.
|
@@ -2533,37 +2297,32 @@ function Core(rootElement, userSettings) {
|
|
2533
2297
|
* @fires Hooks#afterCellMetaReset
|
2534
2298
|
* @fires Hooks#afterUpdateSettings
|
2535
2299
|
*/
|
2536
|
-
|
2537
|
-
|
2538
2300
|
this.updateSettings = function (settings) {
|
2539
2301
|
var init = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
2540
2302
|
var dataUpdateFunction = (firstRun ? instance.loadData : instance.updateData).bind(this);
|
2541
2303
|
var columnsAsFunc = false;
|
2542
2304
|
var i;
|
2543
2305
|
var j;
|
2544
|
-
|
2545
2306
|
if ((0, _mixed.isDefined)(settings.rows)) {
|
2546
2307
|
throw new Error('The "rows" setting is no longer supported. Do you mean startRows, minRows or maxRows?');
|
2547
2308
|
}
|
2548
|
-
|
2549
2309
|
if ((0, _mixed.isDefined)(settings.cols)) {
|
2550
2310
|
throw new Error('The "cols" setting is no longer supported. Do you mean startCols, minCols or maxCols?');
|
2551
2311
|
}
|
2552
|
-
|
2553
2312
|
if ((0, _mixed.isDefined)(settings.ganttChart)) {
|
2554
2313
|
throw new Error('Since 8.0.0 the "ganttChart" setting is no longer supported.');
|
2555
|
-
}
|
2556
|
-
|
2314
|
+
}
|
2557
2315
|
|
2316
|
+
// eslint-disable-next-line no-restricted-syntax
|
2558
2317
|
for (i in settings) {
|
2559
|
-
if (i === 'data') {
|
2318
|
+
if (i === 'data') {
|
2319
|
+
// Do nothing. loadData will be triggered later
|
2560
2320
|
} else if (i === 'language') {
|
2561
2321
|
setLanguage(settings.language);
|
2562
2322
|
} else if (i === 'className') {
|
2563
2323
|
setClassName('className', settings.className);
|
2564
2324
|
} else if (i === 'tableClassName' && instance.table) {
|
2565
2325
|
setClassName('tableClassName', settings.tableClassName);
|
2566
|
-
|
2567
2326
|
instance.view._wt.wtOverlays.syncOverlayTableClassNames();
|
2568
2327
|
} else if (_pluginHooks.default.getSingleton().isRegistered(i) || _pluginHooks.default.getSingleton().isDeprecated(i)) {
|
2569
2328
|
if ((0, _function.isFunction)(settings[i]) || Array.isArray(settings[i])) {
|
@@ -2574,76 +2333,65 @@ function Core(rootElement, userSettings) {
|
|
2574
2333
|
// Update settings
|
2575
2334
|
globalMeta[i] = settings[i];
|
2576
2335
|
}
|
2577
|
-
}
|
2578
|
-
|
2336
|
+
}
|
2579
2337
|
|
2338
|
+
// Load data or create data map
|
2580
2339
|
if (settings.data === void 0 && tableMeta.data === void 0) {
|
2581
2340
|
dataUpdateFunction(null, 'updateSettings'); // data source created just now
|
2582
2341
|
} else if (settings.data !== void 0) {
|
2583
2342
|
dataUpdateFunction(settings.data, 'updateSettings'); // data source given as option
|
2584
2343
|
} else if (settings.columns !== void 0) {
|
2585
|
-
datamap.createMap();
|
2344
|
+
datamap.createMap();
|
2586
2345
|
|
2346
|
+
// The `column` property has changed - dataset may be expanded or narrowed down. The `loadData` do the same.
|
2587
2347
|
instance.initIndexMappers();
|
2588
2348
|
}
|
2589
|
-
|
2590
2349
|
var clen = instance.countCols();
|
2591
|
-
var columnSetting = tableMeta.columns;
|
2350
|
+
var columnSetting = tableMeta.columns;
|
2592
2351
|
|
2352
|
+
// Init columns constructors configuration
|
2593
2353
|
if (columnSetting && (0, _function.isFunction)(columnSetting)) {
|
2594
2354
|
columnsAsFunc = true;
|
2595
|
-
}
|
2596
|
-
|
2355
|
+
}
|
2597
2356
|
|
2357
|
+
// Clear cell meta cache
|
2598
2358
|
if (settings.cell !== void 0 || settings.cells !== void 0 || settings.columns !== void 0) {
|
2599
2359
|
metaManager.clearCache();
|
2600
2360
|
}
|
2601
|
-
|
2602
2361
|
if (clen > 0) {
|
2603
2362
|
for (i = 0, j = 0; i < clen; i++) {
|
2604
2363
|
// Use settings provided by user
|
2605
2364
|
if (columnSetting) {
|
2606
2365
|
var column = columnsAsFunc ? columnSetting(i) : columnSetting[j];
|
2607
|
-
|
2608
2366
|
if (column) {
|
2609
2367
|
metaManager.updateColumnMeta(j, column);
|
2610
2368
|
}
|
2611
2369
|
}
|
2612
|
-
|
2613
2370
|
j += 1;
|
2614
2371
|
}
|
2615
2372
|
}
|
2616
|
-
|
2617
2373
|
if ((0, _mixed.isDefined)(settings.cell)) {
|
2618
2374
|
(0, _object.objectEach)(settings.cell, function (cell) {
|
2619
2375
|
instance.setCellMetaObject(cell.row, cell.col, cell);
|
2620
2376
|
});
|
2621
2377
|
}
|
2622
|
-
|
2623
2378
|
instance.runHooks('afterCellMetaReset');
|
2624
2379
|
var currentHeight = instance.rootElement.style.height;
|
2625
|
-
|
2626
2380
|
if (currentHeight !== '') {
|
2627
2381
|
currentHeight = parseInt(instance.rootElement.style.height, 10);
|
2628
2382
|
}
|
2629
|
-
|
2630
2383
|
var height = settings.height;
|
2631
|
-
|
2632
2384
|
if ((0, _function.isFunction)(height)) {
|
2633
2385
|
height = height();
|
2634
2386
|
}
|
2635
|
-
|
2636
2387
|
if (init) {
|
2637
2388
|
var initialStyle = instance.rootElement.getAttribute('style');
|
2638
|
-
|
2639
2389
|
if (initialStyle) {
|
2640
2390
|
instance.rootElement.setAttribute('data-initialstyle', instance.rootElement.getAttribute('style'));
|
2641
2391
|
}
|
2642
2392
|
}
|
2643
|
-
|
2644
2393
|
if (height === null) {
|
2645
2394
|
var _initialStyle = instance.rootElement.getAttribute('data-initialstyle');
|
2646
|
-
|
2647
2395
|
if (_initialStyle && (_initialStyle.indexOf('height') > -1 || _initialStyle.indexOf('overflow') > -1)) {
|
2648
2396
|
instance.rootElement.setAttribute('style', _initialStyle);
|
2649
2397
|
} else {
|
@@ -2654,45 +2402,33 @@ function Core(rootElement, userSettings) {
|
|
2654
2402
|
instance.rootElement.style.height = isNaN(height) ? "".concat(height) : "".concat(height, "px");
|
2655
2403
|
instance.rootElement.style.overflow = 'hidden';
|
2656
2404
|
}
|
2657
|
-
|
2658
2405
|
if (typeof settings.width !== 'undefined') {
|
2659
2406
|
var width = settings.width;
|
2660
|
-
|
2661
2407
|
if ((0, _function.isFunction)(width)) {
|
2662
2408
|
width = width();
|
2663
2409
|
}
|
2664
|
-
|
2665
2410
|
instance.rootElement.style.width = isNaN(width) ? "".concat(width) : "".concat(width, "px");
|
2666
2411
|
}
|
2667
|
-
|
2668
2412
|
if (!init) {
|
2669
2413
|
if (instance.view) {
|
2670
2414
|
instance.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked();
|
2671
|
-
|
2672
2415
|
instance.view._wt.exportSettingsAsClassNames();
|
2673
2416
|
}
|
2674
|
-
|
2675
2417
|
instance.runHooks('afterUpdateSettings', settings);
|
2676
2418
|
}
|
2677
|
-
|
2678
2419
|
grid.adjustRowsAndCols();
|
2679
|
-
|
2680
2420
|
if (instance.view && !firstRun) {
|
2681
2421
|
instance.forceFullRender = true; // used when data was changed
|
2682
|
-
|
2683
2422
|
editorManager.lockEditor();
|
2684
|
-
|
2685
2423
|
instance._refreshBorders(null);
|
2686
|
-
|
2687
2424
|
instance.view._wt.wtOverlays.adjustElementsSize();
|
2688
|
-
|
2689
2425
|
editorManager.unlockEditor();
|
2690
2426
|
}
|
2691
|
-
|
2692
2427
|
if (!init && instance.view && (currentHeight === '' || height === '' || height === void 0) && currentHeight !== height) {
|
2693
2428
|
instance.view._wt.wtOverlays.updateMainScrollableElements();
|
2694
2429
|
}
|
2695
2430
|
};
|
2431
|
+
|
2696
2432
|
/**
|
2697
2433
|
* Get value from the selected cell.
|
2698
2434
|
*
|
@@ -2700,11 +2436,8 @@ function Core(rootElement, userSettings) {
|
|
2700
2436
|
* @function getValue
|
2701
2437
|
* @returns {*} Value of selected cell.
|
2702
2438
|
*/
|
2703
|
-
|
2704
|
-
|
2705
2439
|
this.getValue = function () {
|
2706
2440
|
var sel = instance.getSelectedLast();
|
2707
|
-
|
2708
2441
|
if (tableMeta.getValue) {
|
2709
2442
|
if ((0, _function.isFunction)(tableMeta.getValue)) {
|
2710
2443
|
return tableMeta.getValue.call(instance);
|
@@ -2715,6 +2448,7 @@ function Core(rootElement, userSettings) {
|
|
2715
2448
|
return instance.getDataAtCell(sel[0], sel[1]);
|
2716
2449
|
}
|
2717
2450
|
};
|
2451
|
+
|
2718
2452
|
/**
|
2719
2453
|
* Returns the object settings.
|
2720
2454
|
*
|
@@ -2722,58 +2456,94 @@ function Core(rootElement, userSettings) {
|
|
2722
2456
|
* @function getSettings
|
2723
2457
|
* @returns {TableMeta} Object containing the current table settings.
|
2724
2458
|
*/
|
2725
|
-
|
2726
|
-
|
2727
2459
|
this.getSettings = function () {
|
2728
2460
|
return tableMeta;
|
2729
2461
|
};
|
2462
|
+
|
2730
2463
|
/**
|
2731
2464
|
* Clears the data from the table (the table settings remain intact).
|
2732
2465
|
*
|
2733
2466
|
* @memberof Core#
|
2734
2467
|
* @function clear
|
2735
2468
|
*/
|
2736
|
-
|
2737
|
-
|
2738
2469
|
this.clear = function () {
|
2739
2470
|
this.selectAll();
|
2740
2471
|
this.emptySelectedCells();
|
2741
2472
|
};
|
2473
|
+
|
2742
2474
|
/**
|
2743
|
-
*
|
2744
|
-
*
|
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).
|
2745
2500
|
*
|
2746
2501
|
* @memberof Core#
|
2747
2502
|
* @function alter
|
2748
|
-
* @param {string} action
|
2749
|
-
*
|
2750
|
-
* <li> `'
|
2751
|
-
* <li> `'
|
2752
|
-
* <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>
|
2753
2510
|
* <li> `'remove_col'` </li>
|
2754
|
-
* </
|
2755
|
-
*
|
2756
|
-
*
|
2757
|
-
* @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`).
|
2758
2517
|
* @param {string} [source] Source indicator.
|
2759
|
-
* @param {boolean} [keepEmptyRows]
|
2518
|
+
* @param {boolean} [keepEmptyRows] If set to `true`: prevents removing empty rows.
|
2760
2519
|
* @example
|
2761
2520
|
* ```js
|
2762
|
-
* //
|
2763
|
-
* hot.alter('
|
2764
|
-
*
|
2765
|
-
*
|
2766
|
-
*
|
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)
|
2767
2536
|
* hot.alter('remove_row', 10, 2);
|
2768
|
-
*
|
2537
|
+
*
|
2538
|
+
* // remove 3 rows, starting from row 1 (by visual index)
|
2539
|
+
* // remove 2 rows, starting from row 5 (by visual index)
|
2769
2540
|
* hot.alter('remove_row', [[1, 3], [5, 2]]);
|
2770
2541
|
* ```
|
2771
2542
|
*/
|
2772
|
-
|
2773
|
-
|
2774
2543
|
this.alter = function (action, index, amount, source, keepEmptyRows) {
|
2775
2544
|
grid.alter(action, index, amount, source, keepEmptyRows);
|
2776
2545
|
};
|
2546
|
+
|
2777
2547
|
/**
|
2778
2548
|
* Returns a TD element for the given `row` and `column` arguments, if it is rendered on screen.
|
2779
2549
|
* Returns `null` if the TD is not rendered on screen (probably because that part of the table is not visible).
|
@@ -2786,36 +2556,29 @@ function Core(rootElement, userSettings) {
|
|
2786
2556
|
* if the wanted cell is in the range of fixed rows, it will return a TD element from the `top` overlay.
|
2787
2557
|
* @returns {HTMLTableCellElement|null} The cell's TD element.
|
2788
2558
|
*/
|
2789
|
-
|
2790
|
-
|
2791
2559
|
this.getCell = function (row, column) {
|
2792
2560
|
var topmost = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
2793
2561
|
var renderableColumnIndex = column; // Handling also column headers.
|
2794
|
-
|
2795
2562
|
var renderableRowIndex = row; // Handling also row headers.
|
2796
2563
|
|
2797
2564
|
if (column >= 0) {
|
2798
2565
|
if (this.columnIndexMapper.isHidden(this.toPhysicalColumn(column))) {
|
2799
2566
|
return null;
|
2800
2567
|
}
|
2801
|
-
|
2802
2568
|
renderableColumnIndex = this.columnIndexMapper.getRenderableFromVisualIndex(column);
|
2803
2569
|
}
|
2804
|
-
|
2805
2570
|
if (row >= 0) {
|
2806
2571
|
if (this.rowIndexMapper.isHidden(this.toPhysicalRow(row))) {
|
2807
2572
|
return null;
|
2808
2573
|
}
|
2809
|
-
|
2810
2574
|
renderableRowIndex = this.rowIndexMapper.getRenderableFromVisualIndex(row);
|
2811
2575
|
}
|
2812
|
-
|
2813
2576
|
if (renderableRowIndex === null || renderableColumnIndex === null) {
|
2814
2577
|
return null;
|
2815
2578
|
}
|
2816
|
-
|
2817
2579
|
return instance.view.getCellAtCoords(instance._createCellCoords(renderableRowIndex, renderableColumnIndex), topmost);
|
2818
2580
|
};
|
2581
|
+
|
2819
2582
|
/**
|
2820
2583
|
* Returns the coordinates of the cell, provided as a HTML table cell element.
|
2821
2584
|
*
|
@@ -2829,30 +2592,24 @@ function Core(rootElement, userSettings) {
|
|
2829
2592
|
* // it returns CellCoords object instance with props row: 1 and col: 1.
|
2830
2593
|
* ```
|
2831
2594
|
*/
|
2832
|
-
|
2833
|
-
|
2834
2595
|
this.getCoords = function (element) {
|
2835
2596
|
var renderableCoords = this.view._wt.wtTable.getCoords(element);
|
2836
|
-
|
2837
2597
|
if (renderableCoords === null) {
|
2838
2598
|
return null;
|
2839
2599
|
}
|
2840
|
-
|
2841
2600
|
var renderableRow = renderableCoords.row,
|
2842
|
-
|
2601
|
+
renderableColumn = renderableCoords.col;
|
2843
2602
|
var visualRow = renderableRow;
|
2844
2603
|
var visualColumn = renderableColumn;
|
2845
|
-
|
2846
2604
|
if (renderableRow >= 0) {
|
2847
2605
|
visualRow = this.rowIndexMapper.getVisualFromRenderableIndex(renderableRow);
|
2848
2606
|
}
|
2849
|
-
|
2850
2607
|
if (renderableColumn >= 0) {
|
2851
2608
|
visualColumn = this.columnIndexMapper.getVisualFromRenderableIndex(renderableColumn);
|
2852
2609
|
}
|
2853
|
-
|
2854
2610
|
return instance._createCellCoords(visualRow, visualColumn);
|
2855
2611
|
};
|
2612
|
+
|
2856
2613
|
/**
|
2857
2614
|
* Returns the property name that corresponds with the given column index.
|
2858
2615
|
* If the data source is an array of arrays, it returns the columns index.
|
@@ -2862,11 +2619,10 @@ function Core(rootElement, userSettings) {
|
|
2862
2619
|
* @param {number} column Visual column index.
|
2863
2620
|
* @returns {string|number} Column property or physical column index.
|
2864
2621
|
*/
|
2865
|
-
|
2866
|
-
|
2867
2622
|
this.colToProp = function (column) {
|
2868
2623
|
return datamap.colToProp(column);
|
2869
2624
|
};
|
2625
|
+
|
2870
2626
|
/**
|
2871
2627
|
* Returns column index that corresponds with the given property.
|
2872
2628
|
*
|
@@ -2875,11 +2631,10 @@ function Core(rootElement, userSettings) {
|
|
2875
2631
|
* @param {string|number} prop Property name or physical column index.
|
2876
2632
|
* @returns {number} Visual column index.
|
2877
2633
|
*/
|
2878
|
-
|
2879
|
-
|
2880
2634
|
this.propToCol = function (prop) {
|
2881
2635
|
return datamap.propToCol(prop);
|
2882
2636
|
};
|
2637
|
+
|
2883
2638
|
/**
|
2884
2639
|
* Translate physical row index into visual.
|
2885
2640
|
*
|
@@ -2891,11 +2646,10 @@ function Core(rootElement, userSettings) {
|
|
2891
2646
|
* @param {number} row Physical row index.
|
2892
2647
|
* @returns {number} Returns visual row index.
|
2893
2648
|
*/
|
2894
|
-
|
2895
|
-
|
2896
2649
|
this.toVisualRow = function (row) {
|
2897
2650
|
return _this.rowIndexMapper.getVisualFromPhysicalIndex(row);
|
2898
2651
|
};
|
2652
|
+
|
2899
2653
|
/**
|
2900
2654
|
* Translate physical column index into visual.
|
2901
2655
|
*
|
@@ -2907,11 +2661,10 @@ function Core(rootElement, userSettings) {
|
|
2907
2661
|
* @param {number} column Physical column index.
|
2908
2662
|
* @returns {number} Returns visual column index.
|
2909
2663
|
*/
|
2910
|
-
|
2911
|
-
|
2912
2664
|
this.toVisualColumn = function (column) {
|
2913
2665
|
return _this.columnIndexMapper.getVisualFromPhysicalIndex(column);
|
2914
2666
|
};
|
2667
|
+
|
2915
2668
|
/**
|
2916
2669
|
* Translate visual row index into physical.
|
2917
2670
|
*
|
@@ -2923,11 +2676,10 @@ function Core(rootElement, userSettings) {
|
|
2923
2676
|
* @param {number} row Visual row index.
|
2924
2677
|
* @returns {number} Returns physical row index.
|
2925
2678
|
*/
|
2926
|
-
|
2927
|
-
|
2928
2679
|
this.toPhysicalRow = function (row) {
|
2929
2680
|
return _this.rowIndexMapper.getPhysicalFromVisualIndex(row);
|
2930
2681
|
};
|
2682
|
+
|
2931
2683
|
/**
|
2932
2684
|
* Translate visual column index into physical.
|
2933
2685
|
*
|
@@ -2939,11 +2691,10 @@ function Core(rootElement, userSettings) {
|
|
2939
2691
|
* @param {number} column Visual column index.
|
2940
2692
|
* @returns {number} Returns physical column index.
|
2941
2693
|
*/
|
2942
|
-
|
2943
|
-
|
2944
2694
|
this.toPhysicalColumn = function (column) {
|
2945
2695
|
return _this.columnIndexMapper.getPhysicalFromVisualIndex(column);
|
2946
2696
|
};
|
2697
|
+
|
2947
2698
|
/**
|
2948
2699
|
* @description
|
2949
2700
|
* Returns the cell value at `row`, `column`.
|
@@ -2956,11 +2707,10 @@ function Core(rootElement, userSettings) {
|
|
2956
2707
|
* @param {number} column Visual column index.
|
2957
2708
|
* @returns {*} Data at cell.
|
2958
2709
|
*/
|
2959
|
-
|
2960
|
-
|
2961
2710
|
this.getDataAtCell = function (row, column) {
|
2962
2711
|
return datamap.get(row, datamap.colToProp(column));
|
2963
2712
|
};
|
2713
|
+
|
2964
2714
|
/**
|
2965
2715
|
* Returns value at visual `row` and `prop` indexes.
|
2966
2716
|
*
|
@@ -2972,11 +2722,10 @@ function Core(rootElement, userSettings) {
|
|
2972
2722
|
* @param {string} prop Property name.
|
2973
2723
|
* @returns {*} Cell value.
|
2974
2724
|
*/
|
2975
|
-
|
2976
|
-
|
2977
2725
|
this.getDataAtRowProp = function (row, prop) {
|
2978
2726
|
return datamap.get(row, prop);
|
2979
2727
|
};
|
2728
|
+
|
2980
2729
|
/**
|
2981
2730
|
* @description
|
2982
2731
|
* Returns array of column values from the data source.
|
@@ -2988,13 +2737,11 @@ function Core(rootElement, userSettings) {
|
|
2988
2737
|
* @param {number} column Visual column index.
|
2989
2738
|
* @returns {Array} Array of cell values.
|
2990
2739
|
*/
|
2991
|
-
|
2992
|
-
|
2993
2740
|
this.getDataAtCol = function (column) {
|
2994
2741
|
var _ref13;
|
2995
|
-
|
2996
2742
|
return (_ref13 = []).concat.apply(_ref13, _toConsumableArray(datamap.getRange(instance._createCellCoords(0, column), instance._createCellCoords(tableMeta.data.length - 1, column), datamap.DESTINATION_RENDERER)));
|
2997
2743
|
};
|
2744
|
+
|
2998
2745
|
/**
|
2999
2746
|
* Given the object property name (e.g. `'first.name'` or `'0'`), returns an array of column's values from the table data.
|
3000
2747
|
* You can also provide a column index as the first argument.
|
@@ -3005,14 +2752,12 @@ function Core(rootElement, userSettings) {
|
|
3005
2752
|
* @returns {Array} Array of cell values.
|
3006
2753
|
*/
|
3007
2754
|
// TODO: Getting data from `datamap` should work on visual indexes.
|
3008
|
-
|
3009
|
-
|
3010
2755
|
this.getDataAtProp = function (prop) {
|
3011
2756
|
var _ref14;
|
3012
|
-
|
3013
2757
|
var range = datamap.getRange(instance._createCellCoords(0, datamap.propToCol(prop)), instance._createCellCoords(tableMeta.data.length - 1, datamap.propToCol(prop)), datamap.DESTINATION_RENDERER);
|
3014
2758
|
return (_ref14 = []).concat.apply(_ref14, _toConsumableArray(range));
|
3015
2759
|
};
|
2760
|
+
|
3016
2761
|
/**
|
3017
2762
|
* Returns a clone of the source data object.
|
3018
2763
|
* Optionally you can provide a cell range by using the `row`, `column`, `row2`, `column2` arguments, to get only a
|
@@ -3029,19 +2774,16 @@ function Core(rootElement, userSettings) {
|
|
3029
2774
|
* @param {number} [column2] To physical column index (or visual index, if data type is an array of objects).
|
3030
2775
|
* @returns {Array[]|object[]} The table data.
|
3031
2776
|
*/
|
3032
|
-
|
3033
|
-
|
3034
2777
|
this.getSourceData = function (row, column, row2, column2) {
|
3035
2778
|
var data;
|
3036
|
-
|
3037
2779
|
if (row === void 0) {
|
3038
2780
|
data = dataSource.getData();
|
3039
2781
|
} else {
|
3040
2782
|
data = dataSource.getByRange(instance._createCellCoords(row, column), instance._createCellCoords(row2, column2));
|
3041
2783
|
}
|
3042
|
-
|
3043
2784
|
return data;
|
3044
2785
|
};
|
2786
|
+
|
3045
2787
|
/**
|
3046
2788
|
* Returns the source data object as an arrays of arrays format even when source data was provided in another format.
|
3047
2789
|
* Optionally you can provide a cell range by using the `row`, `column`, `row2`, `column2` arguments, to get only a
|
@@ -3058,19 +2800,16 @@ function Core(rootElement, userSettings) {
|
|
3058
2800
|
* @param {number} [column2] To physical column index (or visual index, if data type is an array of objects).
|
3059
2801
|
* @returns {Array} An array of arrays.
|
3060
2802
|
*/
|
3061
|
-
|
3062
|
-
|
3063
2803
|
this.getSourceDataArray = function (row, column, row2, column2) {
|
3064
2804
|
var data;
|
3065
|
-
|
3066
2805
|
if (row === void 0) {
|
3067
2806
|
data = dataSource.getData(true);
|
3068
2807
|
} else {
|
3069
2808
|
data = dataSource.getByRange(instance._createCellCoords(row, column), instance._createCellCoords(row2, column2), true);
|
3070
2809
|
}
|
3071
|
-
|
3072
2810
|
return data;
|
3073
2811
|
};
|
2812
|
+
|
3074
2813
|
/**
|
3075
2814
|
* Returns an array of column values from the data source.
|
3076
2815
|
*
|
@@ -3080,13 +2819,11 @@ function Core(rootElement, userSettings) {
|
|
3080
2819
|
* @returns {Array} Array of the column's cell values.
|
3081
2820
|
*/
|
3082
2821
|
// TODO: Getting data from `sourceData` should work always on physical indexes.
|
3083
|
-
|
3084
|
-
|
3085
2822
|
this.getSourceDataAtCol = function (column) {
|
3086
2823
|
return dataSource.getAtColumn(column);
|
3087
2824
|
};
|
3088
|
-
/* eslint-disable jsdoc/require-param */
|
3089
2825
|
|
2826
|
+
/* eslint-disable jsdoc/require-param */
|
3090
2827
|
/**
|
3091
2828
|
* Set the provided value in the source data set at the provided coordinates.
|
3092
2829
|
*
|
@@ -3097,47 +2834,39 @@ function Core(rootElement, userSettings) {
|
|
3097
2834
|
* @param {*} value The value to be set at the provided coordinates.
|
3098
2835
|
* @param {string} [source] Source of the change as a string.
|
3099
2836
|
*/
|
3100
|
-
|
3101
2837
|
/* eslint-enable jsdoc/require-param */
|
3102
|
-
|
3103
|
-
|
3104
2838
|
this.setSourceDataAtCell = function (row, column, value, source) {
|
3105
2839
|
var input = setDataInputToArray(row, column, value);
|
3106
2840
|
var isThereAnySetSourceListener = this.hasHook('afterSetSourceDataAtCell');
|
3107
2841
|
var changesForHook = [];
|
3108
|
-
|
3109
2842
|
if (isThereAnySetSourceListener) {
|
3110
2843
|
(0, _array.arrayEach)(input, function (_ref15) {
|
3111
2844
|
var _ref16 = _slicedToArray(_ref15, 3),
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
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.
|
3117
2850
|
changeValue]);
|
3118
2851
|
});
|
3119
2852
|
}
|
3120
|
-
|
3121
2853
|
(0, _array.arrayEach)(input, function (_ref17) {
|
3122
2854
|
var _ref18 = _slicedToArray(_ref17, 3),
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
2855
|
+
changeRow = _ref18[0],
|
2856
|
+
changeProp = _ref18[1],
|
2857
|
+
changeValue = _ref18[2];
|
3127
2858
|
dataSource.setAtCell(changeRow, changeProp, changeValue);
|
3128
2859
|
});
|
3129
|
-
|
3130
2860
|
if (isThereAnySetSourceListener) {
|
3131
2861
|
this.runHooks('afterSetSourceDataAtCell', changesForHook, source);
|
3132
2862
|
}
|
3133
|
-
|
3134
2863
|
this.render();
|
3135
2864
|
var activeEditor = instance.getActiveEditor();
|
3136
|
-
|
3137
2865
|
if (activeEditor && (0, _mixed.isDefined)(activeEditor.refreshValue)) {
|
3138
2866
|
activeEditor.refreshValue();
|
3139
2867
|
}
|
3140
2868
|
};
|
2869
|
+
|
3141
2870
|
/**
|
3142
2871
|
* Returns a single row of the data (array or object, depending on what data format you use).
|
3143
2872
|
*
|
@@ -3149,11 +2878,10 @@ function Core(rootElement, userSettings) {
|
|
3149
2878
|
* @param {number} row Physical row index.
|
3150
2879
|
* @returns {Array|object} Single row of data.
|
3151
2880
|
*/
|
3152
|
-
|
3153
|
-
|
3154
2881
|
this.getSourceDataAtRow = function (row) {
|
3155
2882
|
return dataSource.getAtRow(row);
|
3156
2883
|
};
|
2884
|
+
|
3157
2885
|
/**
|
3158
2886
|
* Returns a single value from the data source.
|
3159
2887
|
*
|
@@ -3164,11 +2892,10 @@ function Core(rootElement, userSettings) {
|
|
3164
2892
|
* @returns {*} Cell data.
|
3165
2893
|
*/
|
3166
2894
|
// TODO: Getting data from `sourceData` should work always on physical indexes.
|
3167
|
-
|
3168
|
-
|
3169
2895
|
this.getSourceDataAtCell = function (row, column) {
|
3170
2896
|
return dataSource.getAtCell(row, column);
|
3171
2897
|
};
|
2898
|
+
|
3172
2899
|
/**
|
3173
2900
|
* @description
|
3174
2901
|
* Returns a single row of the data.
|
@@ -3180,12 +2907,11 @@ function Core(rootElement, userSettings) {
|
|
3180
2907
|
* @param {number} row Visual row index.
|
3181
2908
|
* @returns {Array} Array of row's cell data.
|
3182
2909
|
*/
|
3183
|
-
|
3184
|
-
|
3185
2910
|
this.getDataAtRow = function (row) {
|
3186
2911
|
var data = datamap.getRange(instance._createCellCoords(row, 0), instance._createCellCoords(row, this.countCols() - 1), datamap.DESTINATION_RENDERER);
|
3187
2912
|
return data[0] || [];
|
3188
2913
|
};
|
2914
|
+
|
3189
2915
|
/**
|
3190
2916
|
* @description
|
3191
2917
|
* Returns a data type defined in the Handsontable settings under the `type` key ({@link Options#type}).
|
@@ -3201,41 +2927,32 @@ function Core(rootElement, userSettings) {
|
|
3201
2927
|
* @param {number} columnTo To visual column index.
|
3202
2928
|
* @returns {string} Cell type (e.q: `'mixed'`, `'text'`, `'numeric'`, `'autocomplete'`).
|
3203
2929
|
*/
|
3204
|
-
|
3205
|
-
|
3206
2930
|
this.getDataType = function (rowFrom, columnFrom, rowTo, columnTo) {
|
3207
2931
|
var _this4 = this;
|
3208
|
-
|
3209
2932
|
var coords = rowFrom === void 0 ? [0, 0, this.countRows(), this.countCols()] : [rowFrom, columnFrom, rowTo, columnTo];
|
3210
2933
|
var rowStart = coords[0],
|
3211
|
-
|
2934
|
+
columnStart = coords[1];
|
3212
2935
|
var rowEnd = coords[2],
|
3213
|
-
|
2936
|
+
columnEnd = coords[3];
|
3214
2937
|
var previousType = null;
|
3215
2938
|
var currentType = null;
|
3216
|
-
|
3217
2939
|
if (rowEnd === void 0) {
|
3218
2940
|
rowEnd = rowStart;
|
3219
2941
|
}
|
3220
|
-
|
3221
2942
|
if (columnEnd === void 0) {
|
3222
2943
|
columnEnd = columnStart;
|
3223
2944
|
}
|
3224
|
-
|
3225
2945
|
var type = 'mixed';
|
3226
2946
|
(0, _number.rangeEach)(Math.max(Math.min(rowStart, rowEnd), 0), Math.max(rowStart, rowEnd), function (row) {
|
3227
2947
|
var isTypeEqual = true;
|
3228
2948
|
(0, _number.rangeEach)(Math.max(Math.min(columnStart, columnEnd), 0), Math.max(columnStart, columnEnd), function (column) {
|
3229
2949
|
var cellType = _this4.getCellMeta(row, column);
|
3230
|
-
|
3231
2950
|
currentType = cellType.type;
|
3232
|
-
|
3233
2951
|
if (previousType) {
|
3234
2952
|
isTypeEqual = previousType === currentType;
|
3235
2953
|
} else {
|
3236
2954
|
previousType = currentType;
|
3237
2955
|
}
|
3238
|
-
|
3239
2956
|
return isTypeEqual;
|
3240
2957
|
});
|
3241
2958
|
type = isTypeEqual ? currentType : 'mixed';
|
@@ -3243,6 +2960,7 @@ function Core(rootElement, userSettings) {
|
|
3243
2960
|
});
|
3244
2961
|
return type;
|
3245
2962
|
};
|
2963
|
+
|
3246
2964
|
/**
|
3247
2965
|
* Remove a property defined by the `key` argument from the cell meta object for the provided `row` and `column` coordinates.
|
3248
2966
|
*
|
@@ -3254,22 +2972,19 @@ function Core(rootElement, userSettings) {
|
|
3254
2972
|
* @fires Hooks#beforeRemoveCellMeta
|
3255
2973
|
* @fires Hooks#afterRemoveCellMeta
|
3256
2974
|
*/
|
3257
|
-
|
3258
|
-
|
3259
2975
|
this.removeCellMeta = function (row, column, key) {
|
3260
2976
|
var _ref19 = [this.toPhysicalRow(row), this.toPhysicalColumn(column)],
|
3261
|
-
|
3262
|
-
|
2977
|
+
physicalRow = _ref19[0],
|
2978
|
+
physicalColumn = _ref19[1];
|
3263
2979
|
var cachedValue = metaManager.getCellMetaKeyValue(physicalRow, physicalColumn, key);
|
3264
2980
|
var hookResult = instance.runHooks('beforeRemoveCellMeta', row, column, key, cachedValue);
|
3265
|
-
|
3266
2981
|
if (hookResult !== false) {
|
3267
2982
|
metaManager.removeCellMeta(physicalRow, physicalColumn, key);
|
3268
2983
|
instance.runHooks('afterRemoveCellMeta', row, column, key, cachedValue);
|
3269
2984
|
}
|
3270
|
-
|
3271
2985
|
cachedValue = null;
|
3272
2986
|
};
|
2987
|
+
|
3273
2988
|
/**
|
3274
2989
|
* Removes or adds one or more rows of the cell meta objects to the cell meta collections.
|
3275
2990
|
*
|
@@ -3280,25 +2995,18 @@ function Core(rootElement, userSettings) {
|
|
3280
2995
|
* @param {number} [deleteAmount=0] The number of items to be removed. If set to 0, no cell meta objects will be removed.
|
3281
2996
|
* @param {...object} [cellMetaRows] The new cell meta row objects to be added to the cell meta collection.
|
3282
2997
|
*/
|
3283
|
-
|
3284
|
-
|
3285
2998
|
this.spliceCellsMeta = function (visualIndex) {
|
3286
2999
|
var _this5 = this;
|
3287
|
-
|
3288
3000
|
var deleteAmount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
3289
|
-
|
3290
3001
|
for (var _len3 = arguments.length, cellMetaRows = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
|
3291
3002
|
cellMetaRows[_key3 - 2] = arguments[_key3];
|
3292
3003
|
}
|
3293
|
-
|
3294
3004
|
if (cellMetaRows.length > 0 && !Array.isArray(cellMetaRows[0])) {
|
3295
3005
|
throw new Error('The 3rd argument (cellMetaRows) has to be passed as an array of cell meta objects array.');
|
3296
3006
|
}
|
3297
|
-
|
3298
3007
|
if (deleteAmount > 0) {
|
3299
3008
|
metaManager.removeRow(this.toPhysicalRow(visualIndex), deleteAmount);
|
3300
3009
|
}
|
3301
|
-
|
3302
3010
|
if (cellMetaRows.length > 0) {
|
3303
3011
|
(0, _array.arrayEach)(cellMetaRows.reverse(), function (cellMetaRow) {
|
3304
3012
|
metaManager.createRow(_this5.toPhysicalRow(visualIndex));
|
@@ -3307,9 +3015,9 @@ function Core(rootElement, userSettings) {
|
|
3307
3015
|
});
|
3308
3016
|
});
|
3309
3017
|
}
|
3310
|
-
|
3311
3018
|
instance.render();
|
3312
3019
|
};
|
3020
|
+
|
3313
3021
|
/**
|
3314
3022
|
* Set cell meta data object defined by `prop` to the corresponding params `row` and `column`.
|
3315
3023
|
*
|
@@ -3319,17 +3027,15 @@ function Core(rootElement, userSettings) {
|
|
3319
3027
|
* @param {number} column Visual column index.
|
3320
3028
|
* @param {object} prop Meta object.
|
3321
3029
|
*/
|
3322
|
-
|
3323
|
-
|
3324
3030
|
this.setCellMetaObject = function (row, column, prop) {
|
3325
3031
|
var _this6 = this;
|
3326
|
-
|
3327
3032
|
if (_typeof(prop) === 'object') {
|
3328
3033
|
(0, _object.objectEach)(prop, function (value, key) {
|
3329
3034
|
_this6.setCellMeta(row, column, key, value);
|
3330
3035
|
});
|
3331
3036
|
}
|
3332
3037
|
};
|
3038
|
+
|
3333
3039
|
/**
|
3334
3040
|
* Sets a property defined by the `key` property to the meta object of a cell corresponding to params `row` and `column`.
|
3335
3041
|
*
|
@@ -3342,29 +3048,23 @@ function Core(rootElement, userSettings) {
|
|
3342
3048
|
* @fires Hooks#beforeSetCellMeta
|
3343
3049
|
* @fires Hooks#afterSetCellMeta
|
3344
3050
|
*/
|
3345
|
-
|
3346
|
-
|
3347
3051
|
this.setCellMeta = function (row, column, key, value) {
|
3348
3052
|
var allowSetCellMeta = instance.runHooks('beforeSetCellMeta', row, column, key, value);
|
3349
|
-
|
3350
3053
|
if (allowSetCellMeta === false) {
|
3351
3054
|
return;
|
3352
3055
|
}
|
3353
|
-
|
3354
3056
|
var physicalRow = row;
|
3355
3057
|
var physicalColumn = column;
|
3356
|
-
|
3357
3058
|
if (row < this.countRows()) {
|
3358
3059
|
physicalRow = this.toPhysicalRow(row);
|
3359
3060
|
}
|
3360
|
-
|
3361
3061
|
if (column < this.countCols()) {
|
3362
3062
|
physicalColumn = this.toPhysicalColumn(column);
|
3363
3063
|
}
|
3364
|
-
|
3365
3064
|
metaManager.setCellMeta(physicalRow, physicalColumn, key, value);
|
3366
3065
|
instance.runHooks('afterSetCellMeta', row, column, key, value);
|
3367
3066
|
};
|
3067
|
+
|
3368
3068
|
/**
|
3369
3069
|
* Get all the cells meta settings at least once generated in the table (in order of cell initialization).
|
3370
3070
|
*
|
@@ -3372,11 +3072,10 @@ function Core(rootElement, userSettings) {
|
|
3372
3072
|
* @function getCellsMeta
|
3373
3073
|
* @returns {Array} Returns an array of ColumnSettings object instances.
|
3374
3074
|
*/
|
3375
|
-
|
3376
|
-
|
3377
3075
|
this.getCellsMeta = function () {
|
3378
3076
|
return metaManager.getCellsMeta();
|
3379
3077
|
};
|
3078
|
+
|
3380
3079
|
/**
|
3381
3080
|
* Returns the cell properties object for the given `row` and `column` coordinates.
|
3382
3081
|
*
|
@@ -3388,25 +3087,21 @@ function Core(rootElement, userSettings) {
|
|
3388
3087
|
* @fires Hooks#beforeGetCellMeta
|
3389
3088
|
* @fires Hooks#afterGetCellMeta
|
3390
3089
|
*/
|
3391
|
-
|
3392
|
-
|
3393
3090
|
this.getCellMeta = function (row, column) {
|
3394
3091
|
var physicalRow = this.toPhysicalRow(row);
|
3395
3092
|
var physicalColumn = this.toPhysicalColumn(column);
|
3396
|
-
|
3397
3093
|
if (physicalRow === null) {
|
3398
3094
|
physicalRow = row;
|
3399
3095
|
}
|
3400
|
-
|
3401
3096
|
if (physicalColumn === null) {
|
3402
3097
|
physicalColumn = column;
|
3403
3098
|
}
|
3404
|
-
|
3405
3099
|
return metaManager.getCellMeta(physicalRow, physicalColumn, {
|
3406
3100
|
visualRow: row,
|
3407
3101
|
visualColumn: column
|
3408
3102
|
});
|
3409
3103
|
};
|
3104
|
+
|
3410
3105
|
/**
|
3411
3106
|
* Returns an array of cell meta objects for specified physical row index.
|
3412
3107
|
*
|
@@ -3415,11 +3110,10 @@ function Core(rootElement, userSettings) {
|
|
3415
3110
|
* @param {number} row Physical row index.
|
3416
3111
|
* @returns {Array}
|
3417
3112
|
*/
|
3418
|
-
|
3419
|
-
|
3420
3113
|
this.getCellMetaAtRow = function (row) {
|
3421
3114
|
return metaManager.getCellsMetaAtRow(row);
|
3422
3115
|
};
|
3116
|
+
|
3423
3117
|
/**
|
3424
3118
|
* Checks if the data format and config allows user to modify the column structure.
|
3425
3119
|
*
|
@@ -3427,13 +3121,11 @@ function Core(rootElement, userSettings) {
|
|
3427
3121
|
* @function isColumnModificationAllowed
|
3428
3122
|
* @returns {boolean}
|
3429
3123
|
*/
|
3430
|
-
|
3431
|
-
|
3432
3124
|
this.isColumnModificationAllowed = function () {
|
3433
3125
|
return !(instance.dataType === 'object' || tableMeta.columns);
|
3434
3126
|
};
|
3435
|
-
|
3436
3127
|
var rendererLookup = (0, _data.cellMethodLookupFactory)('renderer');
|
3128
|
+
|
3437
3129
|
/**
|
3438
3130
|
* Returns the cell renderer function by given `row` and `column` arguments.
|
3439
3131
|
*
|
@@ -3450,10 +3142,10 @@ function Core(rootElement, userSettings) {
|
|
3450
3142
|
* hot.getCellRenderer(hot.getCellMeta(1, 1));
|
3451
3143
|
* ```
|
3452
3144
|
*/
|
3453
|
-
|
3454
3145
|
this.getCellRenderer = function (row, column) {
|
3455
3146
|
return (0, _registry2.getRenderer)(rendererLookup.call(this, row, column));
|
3456
3147
|
};
|
3148
|
+
|
3457
3149
|
/**
|
3458
3150
|
* Returns the cell editor class by the provided `row` and `column` arguments.
|
3459
3151
|
*
|
@@ -3470,10 +3162,9 @@ function Core(rootElement, userSettings) {
|
|
3470
3162
|
* hot.getCellEditor(hot.getCellMeta(1, 1));
|
3471
3163
|
* ```
|
3472
3164
|
*/
|
3473
|
-
|
3474
|
-
|
3475
3165
|
this.getCellEditor = (0, _data.cellMethodLookupFactory)('editor');
|
3476
3166
|
var validatorLookup = (0, _data.cellMethodLookupFactory)('validator');
|
3167
|
+
|
3477
3168
|
/**
|
3478
3169
|
* Returns the cell validator by `row` and `column`.
|
3479
3170
|
*
|
@@ -3490,16 +3181,14 @@ function Core(rootElement, userSettings) {
|
|
3490
3181
|
* hot.getCellValidator(hot.getCellMeta(1, 1));
|
3491
3182
|
* ```
|
3492
3183
|
*/
|
3493
|
-
|
3494
3184
|
this.getCellValidator = function (row, column) {
|
3495
3185
|
var validator = validatorLookup.call(this, row, column);
|
3496
|
-
|
3497
3186
|
if (typeof validator === 'string') {
|
3498
3187
|
validator = (0, _registry3.getValidator)(validator);
|
3499
3188
|
}
|
3500
|
-
|
3501
3189
|
return validator;
|
3502
3190
|
};
|
3191
|
+
|
3503
3192
|
/**
|
3504
3193
|
* Validates all cells using their validator functions and calls callback when finished.
|
3505
3194
|
*
|
@@ -3518,11 +3207,10 @@ function Core(rootElement, userSettings) {
|
|
3518
3207
|
* })
|
3519
3208
|
* ```
|
3520
3209
|
*/
|
3521
|
-
|
3522
|
-
|
3523
3210
|
this.validateCells = function (callback) {
|
3524
3211
|
this._validateCells(callback);
|
3525
3212
|
};
|
3213
|
+
|
3526
3214
|
/**
|
3527
3215
|
* Validates rows using their validator functions and calls callback when finished.
|
3528
3216
|
*
|
@@ -3542,15 +3230,13 @@ function Core(rootElement, userSettings) {
|
|
3542
3230
|
* })
|
3543
3231
|
* ```
|
3544
3232
|
*/
|
3545
|
-
|
3546
|
-
|
3547
3233
|
this.validateRows = function (rows, callback) {
|
3548
3234
|
if (!Array.isArray(rows)) {
|
3549
3235
|
throw new Error('validateRows parameter `rows` must be an array');
|
3550
3236
|
}
|
3551
|
-
|
3552
3237
|
this._validateCells(callback, rows);
|
3553
3238
|
};
|
3239
|
+
|
3554
3240
|
/**
|
3555
3241
|
* Validates columns using their validator functions and calls callback when finished.
|
3556
3242
|
*
|
@@ -3570,15 +3256,13 @@ function Core(rootElement, userSettings) {
|
|
3570
3256
|
* })
|
3571
3257
|
* ```
|
3572
3258
|
*/
|
3573
|
-
|
3574
|
-
|
3575
3259
|
this.validateColumns = function (columns, callback) {
|
3576
3260
|
if (!Array.isArray(columns)) {
|
3577
3261
|
throw new Error('validateColumns parameter `columns` must be an array');
|
3578
3262
|
}
|
3579
|
-
|
3580
3263
|
this._validateCells(callback, undefined, columns);
|
3581
3264
|
};
|
3265
|
+
|
3582
3266
|
/**
|
3583
3267
|
* Validates all cells using their validator functions and calls callback when finished.
|
3584
3268
|
*
|
@@ -3593,51 +3277,40 @@ function Core(rootElement, userSettings) {
|
|
3593
3277
|
* @param {Array} [rows] An array of validation target visual row indexes.
|
3594
3278
|
* @param {Array} [columns] An array of validation target visual column indexes.
|
3595
3279
|
*/
|
3596
|
-
|
3597
|
-
|
3598
3280
|
this._validateCells = function (callback, rows, columns) {
|
3599
3281
|
var waitingForValidator = new ValidatorsQueue();
|
3600
|
-
|
3601
3282
|
if (callback) {
|
3602
3283
|
waitingForValidator.onQueueEmpty = callback;
|
3603
3284
|
}
|
3604
|
-
|
3605
3285
|
var i = instance.countRows() - 1;
|
3606
|
-
|
3607
3286
|
while (i >= 0) {
|
3608
3287
|
if (rows !== undefined && rows.indexOf(i) === -1) {
|
3609
3288
|
i -= 1;
|
3610
3289
|
continue;
|
3611
3290
|
}
|
3612
|
-
|
3613
3291
|
var j = instance.countCols() - 1;
|
3614
|
-
|
3615
3292
|
while (j >= 0) {
|
3616
3293
|
if (columns !== undefined && columns.indexOf(j) === -1) {
|
3617
3294
|
j -= 1;
|
3618
3295
|
continue;
|
3619
3296
|
}
|
3620
|
-
|
3621
3297
|
waitingForValidator.addValidatorToQueue();
|
3622
3298
|
instance.validateCell(instance.getDataAtCell(i, j), instance.getCellMeta(i, j), function (result) {
|
3623
3299
|
if (typeof result !== 'boolean') {
|
3624
3300
|
throw new Error('Validation error: result is not boolean');
|
3625
3301
|
}
|
3626
|
-
|
3627
3302
|
if (result === false) {
|
3628
3303
|
waitingForValidator.valid = false;
|
3629
3304
|
}
|
3630
|
-
|
3631
3305
|
waitingForValidator.removeValidatorFormQueue();
|
3632
3306
|
}, 'validateCells');
|
3633
3307
|
j -= 1;
|
3634
3308
|
}
|
3635
|
-
|
3636
3309
|
i -= 1;
|
3637
3310
|
}
|
3638
|
-
|
3639
3311
|
waitingForValidator.checkIfQueueIsEmpty();
|
3640
3312
|
};
|
3313
|
+
|
3641
3314
|
/**
|
3642
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.
|
3643
3316
|
*
|
@@ -3647,16 +3320,12 @@ function Core(rootElement, userSettings) {
|
|
3647
3320
|
* @fires Hooks#modifyRowHeader
|
3648
3321
|
* @returns {Array|string|number} Array of header values / single header value.
|
3649
3322
|
*/
|
3650
|
-
|
3651
|
-
|
3652
3323
|
this.getRowHeader = function (row) {
|
3653
3324
|
var rowHeader = tableMeta.rowHeaders;
|
3654
3325
|
var physicalRow = row;
|
3655
|
-
|
3656
3326
|
if (physicalRow !== void 0) {
|
3657
3327
|
physicalRow = instance.runHooks('modifyRowHeader', physicalRow);
|
3658
3328
|
}
|
3659
|
-
|
3660
3329
|
if (physicalRow === void 0) {
|
3661
3330
|
rowHeader = [];
|
3662
3331
|
(0, _number.rangeEach)(instance.countRows() - 1, function (i) {
|
@@ -3669,9 +3338,9 @@ function Core(rootElement, userSettings) {
|
|
3669
3338
|
} else if (rowHeader && typeof rowHeader !== 'string' && typeof rowHeader !== 'number') {
|
3670
3339
|
rowHeader = physicalRow + 1;
|
3671
3340
|
}
|
3672
|
-
|
3673
3341
|
return rowHeader;
|
3674
3342
|
};
|
3343
|
+
|
3675
3344
|
/**
|
3676
3345
|
* Returns information about if this table is configured to display row headers.
|
3677
3346
|
*
|
@@ -3679,11 +3348,10 @@ function Core(rootElement, userSettings) {
|
|
3679
3348
|
* @function hasRowHeaders
|
3680
3349
|
* @returns {boolean} `true` if the instance has the row headers enabled, `false` otherwise.
|
3681
3350
|
*/
|
3682
|
-
|
3683
|
-
|
3684
3351
|
this.hasRowHeaders = function () {
|
3685
3352
|
return !!tableMeta.rowHeaders;
|
3686
3353
|
};
|
3354
|
+
|
3687
3355
|
/**
|
3688
3356
|
* Returns information about if this table is configured to display column headers.
|
3689
3357
|
*
|
@@ -3691,22 +3359,19 @@ function Core(rootElement, userSettings) {
|
|
3691
3359
|
* @function hasColHeaders
|
3692
3360
|
* @returns {boolean} `true` if the instance has the column headers enabled, `false` otherwise.
|
3693
3361
|
*/
|
3694
|
-
|
3695
|
-
|
3696
3362
|
this.hasColHeaders = function () {
|
3697
3363
|
if (tableMeta.colHeaders !== void 0 && tableMeta.colHeaders !== null) {
|
3698
3364
|
// Polymer has empty value = null
|
3699
3365
|
return !!tableMeta.colHeaders;
|
3700
3366
|
}
|
3701
|
-
|
3702
3367
|
for (var i = 0, ilen = instance.countCols(); i < ilen; i++) {
|
3703
3368
|
if (instance.getColHeader(i)) {
|
3704
3369
|
return true;
|
3705
3370
|
}
|
3706
3371
|
}
|
3707
|
-
|
3708
3372
|
return false;
|
3709
3373
|
};
|
3374
|
+
|
3710
3375
|
/**
|
3711
3376
|
* Returns an array of column headers (in string format, if they are enabled). If param `column` is given, it
|
3712
3377
|
* returns the header at the given column.
|
@@ -3717,39 +3382,30 @@ function Core(rootElement, userSettings) {
|
|
3717
3382
|
* @fires Hooks#modifyColHeader
|
3718
3383
|
* @returns {Array|string|number} The column header(s).
|
3719
3384
|
*/
|
3720
|
-
|
3721
|
-
|
3722
3385
|
this.getColHeader = function (column) {
|
3723
3386
|
var columnIndex = instance.runHooks('modifyColHeader', column);
|
3724
3387
|
var result = tableMeta.colHeaders;
|
3725
|
-
|
3726
3388
|
if (columnIndex === void 0) {
|
3727
3389
|
var out = [];
|
3728
3390
|
var ilen = instance.countCols();
|
3729
|
-
|
3730
3391
|
for (var i = 0; i < ilen; i++) {
|
3731
3392
|
out.push(instance.getColHeader(i));
|
3732
3393
|
}
|
3733
|
-
|
3734
3394
|
result = out;
|
3735
3395
|
} else {
|
3736
3396
|
var translateVisualIndexToColumns = function translateVisualIndexToColumns(visualColumnIndex) {
|
3737
3397
|
var arr = [];
|
3738
3398
|
var columnsLen = instance.countCols();
|
3739
3399
|
var index = 0;
|
3740
|
-
|
3741
3400
|
for (; index < columnsLen; index++) {
|
3742
3401
|
if ((0, _function.isFunction)(tableMeta.columns) && tableMeta.columns(index)) {
|
3743
3402
|
arr.push(index);
|
3744
3403
|
}
|
3745
3404
|
}
|
3746
|
-
|
3747
3405
|
return arr[visualColumnIndex];
|
3748
3406
|
};
|
3749
|
-
|
3750
3407
|
var physicalColumn = instance.toPhysicalColumn(columnIndex);
|
3751
3408
|
var prop = translateVisualIndexToColumns(physicalColumn);
|
3752
|
-
|
3753
3409
|
if (tableMeta.colHeaders === false) {
|
3754
3410
|
result = null;
|
3755
3411
|
} else if (tableMeta.columns && (0, _function.isFunction)(tableMeta.columns) && tableMeta.columns(prop) && tableMeta.columns(prop).title) {
|
@@ -3767,6 +3423,7 @@ function Core(rootElement, userSettings) {
|
|
3767
3423
|
|
3768
3424
|
return result;
|
3769
3425
|
};
|
3426
|
+
|
3770
3427
|
/**
|
3771
3428
|
* Return column width from settings (no guessing). Private use intended.
|
3772
3429
|
*
|
@@ -3776,42 +3433,36 @@ function Core(rootElement, userSettings) {
|
|
3776
3433
|
* @param {number} col Visual col index.
|
3777
3434
|
* @returns {number}
|
3778
3435
|
*/
|
3779
|
-
|
3780
|
-
|
3781
3436
|
this._getColWidthFromSettings = function (col) {
|
3782
|
-
var width;
|
3437
|
+
var width;
|
3783
3438
|
|
3439
|
+
// We currently don't support cell meta objects for headers (negative values)
|
3784
3440
|
if (col >= 0) {
|
3785
3441
|
var cellProperties = instance.getCellMeta(0, col);
|
3786
3442
|
width = cellProperties.width;
|
3787
3443
|
}
|
3788
|
-
|
3789
3444
|
if (width === void 0 || width === tableMeta.width) {
|
3790
3445
|
width = tableMeta.colWidths;
|
3791
3446
|
}
|
3792
|
-
|
3793
3447
|
if (width !== void 0 && width !== null) {
|
3794
3448
|
switch (_typeof(width)) {
|
3795
3449
|
case 'object':
|
3796
3450
|
// array
|
3797
3451
|
width = width[col];
|
3798
3452
|
break;
|
3799
|
-
|
3800
3453
|
case 'function':
|
3801
3454
|
width = width(col);
|
3802
3455
|
break;
|
3803
|
-
|
3804
3456
|
default:
|
3805
3457
|
break;
|
3806
3458
|
}
|
3807
|
-
|
3808
3459
|
if (typeof width === 'string') {
|
3809
3460
|
width = parseInt(width, 10);
|
3810
3461
|
}
|
3811
3462
|
}
|
3812
|
-
|
3813
3463
|
return width;
|
3814
3464
|
};
|
3465
|
+
|
3815
3466
|
/**
|
3816
3467
|
* Returns the width of the requested column.
|
3817
3468
|
*
|
@@ -3821,19 +3472,15 @@ function Core(rootElement, userSettings) {
|
|
3821
3472
|
* @returns {number} Column width.
|
3822
3473
|
* @fires Hooks#modifyColWidth
|
3823
3474
|
*/
|
3824
|
-
|
3825
|
-
|
3826
3475
|
this.getColWidth = function (column) {
|
3827
3476
|
var width = instance._getColWidthFromSettings(column);
|
3828
|
-
|
3829
3477
|
width = instance.runHooks('modifyColWidth', width, column);
|
3830
|
-
|
3831
3478
|
if (width === void 0) {
|
3832
3479
|
width = _src.ViewportColumnsCalculator.DEFAULT_WIDTH;
|
3833
3480
|
}
|
3834
|
-
|
3835
3481
|
return width;
|
3836
3482
|
};
|
3483
|
+
|
3837
3484
|
/**
|
3838
3485
|
* Return row height from settings (no guessing). Private use intended.
|
3839
3486
|
*
|
@@ -3843,8 +3490,6 @@ function Core(rootElement, userSettings) {
|
|
3843
3490
|
* @param {number} row Visual row index.
|
3844
3491
|
* @returns {number}
|
3845
3492
|
*/
|
3846
|
-
|
3847
|
-
|
3848
3493
|
this._getRowHeightFromSettings = function (row) {
|
3849
3494
|
// let cellProperties = instance.getCellMeta(row, 0);
|
3850
3495
|
// let height = cellProperties.height;
|
@@ -3853,29 +3498,25 @@ function Core(rootElement, userSettings) {
|
|
3853
3498
|
// height = cellProperties.rowHeights;
|
3854
3499
|
// }
|
3855
3500
|
var height = tableMeta.rowHeights;
|
3856
|
-
|
3857
3501
|
if (height !== void 0 && height !== null) {
|
3858
3502
|
switch (_typeof(height)) {
|
3859
3503
|
case 'object':
|
3860
3504
|
// array
|
3861
3505
|
height = height[row];
|
3862
3506
|
break;
|
3863
|
-
|
3864
3507
|
case 'function':
|
3865
3508
|
height = height(row);
|
3866
3509
|
break;
|
3867
|
-
|
3868
3510
|
default:
|
3869
3511
|
break;
|
3870
3512
|
}
|
3871
|
-
|
3872
3513
|
if (typeof height === 'string') {
|
3873
3514
|
height = parseInt(height, 10);
|
3874
3515
|
}
|
3875
3516
|
}
|
3876
|
-
|
3877
3517
|
return height;
|
3878
3518
|
};
|
3519
|
+
|
3879
3520
|
/**
|
3880
3521
|
* Returns the row height.
|
3881
3522
|
*
|
@@ -3887,14 +3528,12 @@ function Core(rootElement, userSettings) {
|
|
3887
3528
|
* @returns {number} The given row's height.
|
3888
3529
|
* @fires Hooks#modifyRowHeight
|
3889
3530
|
*/
|
3890
|
-
|
3891
|
-
|
3892
3531
|
this.getRowHeight = function (row) {
|
3893
3532
|
var height = instance._getRowHeightFromSettings(row);
|
3894
|
-
|
3895
3533
|
height = instance.runHooks('modifyRowHeight', height, row);
|
3896
3534
|
return height;
|
3897
3535
|
};
|
3536
|
+
|
3898
3537
|
/**
|
3899
3538
|
* Returns the total number of rows in the data source.
|
3900
3539
|
*
|
@@ -3902,11 +3541,10 @@ function Core(rootElement, userSettings) {
|
|
3902
3541
|
* @function countSourceRows
|
3903
3542
|
* @returns {number} Total number of rows.
|
3904
3543
|
*/
|
3905
|
-
|
3906
|
-
|
3907
3544
|
this.countSourceRows = function () {
|
3908
3545
|
return dataSource.countRows();
|
3909
3546
|
};
|
3547
|
+
|
3910
3548
|
/**
|
3911
3549
|
* Returns the total number of columns in the data source.
|
3912
3550
|
*
|
@@ -3914,11 +3552,10 @@ function Core(rootElement, userSettings) {
|
|
3914
3552
|
* @function countSourceCols
|
3915
3553
|
* @returns {number} Total number of columns.
|
3916
3554
|
*/
|
3917
|
-
|
3918
|
-
|
3919
3555
|
this.countSourceCols = function () {
|
3920
3556
|
return dataSource.countFirstRowKeys();
|
3921
3557
|
};
|
3558
|
+
|
3922
3559
|
/**
|
3923
3560
|
* Returns the total number of visual rows in the table.
|
3924
3561
|
*
|
@@ -3926,11 +3563,10 @@ function Core(rootElement, userSettings) {
|
|
3926
3563
|
* @function countRows
|
3927
3564
|
* @returns {number} Total number of rows.
|
3928
3565
|
*/
|
3929
|
-
|
3930
|
-
|
3931
3566
|
this.countRows = function () {
|
3932
3567
|
return datamap.getLength();
|
3933
3568
|
};
|
3569
|
+
|
3934
3570
|
/**
|
3935
3571
|
* Returns the total number of visible columns in the table.
|
3936
3572
|
*
|
@@ -3938,13 +3574,12 @@ function Core(rootElement, userSettings) {
|
|
3938
3574
|
* @function countCols
|
3939
3575
|
* @returns {number} Total number of columns.
|
3940
3576
|
*/
|
3941
|
-
|
3942
|
-
|
3943
3577
|
this.countCols = function () {
|
3944
3578
|
var maxCols = tableMeta.maxCols;
|
3945
3579
|
var dataLen = this.columnIndexMapper.getNotTrimmedIndexesLength();
|
3946
3580
|
return Math.min(maxCols, dataLen);
|
3947
3581
|
};
|
3582
|
+
|
3948
3583
|
/**
|
3949
3584
|
* Returns the number of rendered rows including rows that are partially or fully rendered
|
3950
3585
|
* outside the table viewport.
|
@@ -3953,11 +3588,10 @@ function Core(rootElement, userSettings) {
|
|
3953
3588
|
* @function countRenderedRows
|
3954
3589
|
* @returns {number} Returns -1 if table is not visible.
|
3955
3590
|
*/
|
3956
|
-
|
3957
|
-
|
3958
3591
|
this.countRenderedRows = function () {
|
3959
3592
|
return instance.view._wt.drawn ? instance.view._wt.wtTable.getRenderedRowsCount() : -1;
|
3960
3593
|
};
|
3594
|
+
|
3961
3595
|
/**
|
3962
3596
|
* Returns the number of rendered rows that are only visible in the table viewport.
|
3963
3597
|
* The rows that are partially visible are not counted.
|
@@ -3966,11 +3600,10 @@ function Core(rootElement, userSettings) {
|
|
3966
3600
|
* @function countVisibleRows
|
3967
3601
|
* @returns {number} Number of visible rows or -1.
|
3968
3602
|
*/
|
3969
|
-
|
3970
|
-
|
3971
3603
|
this.countVisibleRows = function () {
|
3972
3604
|
return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleRowsCount() : -1;
|
3973
3605
|
};
|
3606
|
+
|
3974
3607
|
/**
|
3975
3608
|
* Returns the number of rendered rows including columns that are partially or fully rendered
|
3976
3609
|
* outside the table viewport.
|
@@ -3979,11 +3612,10 @@ function Core(rootElement, userSettings) {
|
|
3979
3612
|
* @function countRenderedCols
|
3980
3613
|
* @returns {number} Returns -1 if table is not visible.
|
3981
3614
|
*/
|
3982
|
-
|
3983
|
-
|
3984
3615
|
this.countRenderedCols = function () {
|
3985
3616
|
return instance.view._wt.drawn ? instance.view._wt.wtTable.getRenderedColumnsCount() : -1;
|
3986
3617
|
};
|
3618
|
+
|
3987
3619
|
/**
|
3988
3620
|
* Returns the number of rendered columns that are only visible in the table viewport.
|
3989
3621
|
* The columns that are partially visible are not counted.
|
@@ -3992,11 +3624,10 @@ function Core(rootElement, userSettings) {
|
|
3992
3624
|
* @function countVisibleCols
|
3993
3625
|
* @returns {number} Number of visible columns or -1.
|
3994
3626
|
*/
|
3995
|
-
|
3996
|
-
|
3997
3627
|
this.countVisibleCols = function () {
|
3998
3628
|
return instance.view._wt.drawn ? instance.view._wt.wtTable.getVisibleColumnsCount() : -1;
|
3999
3629
|
};
|
3630
|
+
|
4000
3631
|
/**
|
4001
3632
|
* Returns the number of empty rows. If the optional ending parameter is `true`, returns the
|
4002
3633
|
* number of empty rows at the bottom of the table.
|
@@ -4006,8 +3637,6 @@ function Core(rootElement, userSettings) {
|
|
4006
3637
|
* @param {boolean} [ending=false] If `true`, will only count empty rows at the end of the data source.
|
4007
3638
|
* @returns {number} Count empty rows.
|
4008
3639
|
*/
|
4009
|
-
|
4010
|
-
|
4011
3640
|
this.countEmptyRows = function () {
|
4012
3641
|
var ending = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
4013
3642
|
var emptyRows = 0;
|
@@ -4020,6 +3649,7 @@ function Core(rootElement, userSettings) {
|
|
4020
3649
|
});
|
4021
3650
|
return emptyRows;
|
4022
3651
|
};
|
3652
|
+
|
4023
3653
|
/**
|
4024
3654
|
* Returns the number of empty columns. If the optional ending parameter is `true`, returns the number of empty
|
4025
3655
|
* columns at right hand edge of the table.
|
@@ -4029,15 +3659,8 @@ function Core(rootElement, userSettings) {
|
|
4029
3659
|
* @param {boolean} [ending=false] If `true`, will only count empty columns at the end of the data source row.
|
4030
3660
|
* @returns {number} Count empty cols.
|
4031
3661
|
*/
|
4032
|
-
|
4033
|
-
|
4034
3662
|
this.countEmptyCols = function () {
|
4035
3663
|
var ending = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
4036
|
-
|
4037
|
-
if (instance.countRows() < 1) {
|
4038
|
-
return 0;
|
4039
|
-
}
|
4040
|
-
|
4041
3664
|
var emptyColumns = 0;
|
4042
3665
|
(0, _number.rangeEachReverse)(instance.countCols() - 1, function (visualIndex) {
|
4043
3666
|
if (instance.isEmptyCol(visualIndex)) {
|
@@ -4048,6 +3671,7 @@ function Core(rootElement, userSettings) {
|
|
4048
3671
|
});
|
4049
3672
|
return emptyColumns;
|
4050
3673
|
};
|
3674
|
+
|
4051
3675
|
/**
|
4052
3676
|
* Check if all cells in the row declared by the `row` argument are empty.
|
4053
3677
|
*
|
@@ -4056,11 +3680,10 @@ function Core(rootElement, userSettings) {
|
|
4056
3680
|
* @param {number} row Visual row index.
|
4057
3681
|
* @returns {boolean} `true` if the row at the given `row` is empty, `false` otherwise.
|
4058
3682
|
*/
|
4059
|
-
|
4060
|
-
|
4061
3683
|
this.isEmptyRow = function (row) {
|
4062
3684
|
return tableMeta.isEmptyRow.call(instance, row);
|
4063
3685
|
};
|
3686
|
+
|
4064
3687
|
/**
|
4065
3688
|
* Check if all cells in the the column declared by the `column` argument are empty.
|
4066
3689
|
*
|
@@ -4069,11 +3692,10 @@ function Core(rootElement, userSettings) {
|
|
4069
3692
|
* @param {number} column Column index.
|
4070
3693
|
* @returns {boolean} `true` if the column at the given `col` is empty, `false` otherwise.
|
4071
3694
|
*/
|
4072
|
-
|
4073
|
-
|
4074
3695
|
this.isEmptyCol = function (column) {
|
4075
3696
|
return tableMeta.isEmptyCol.call(instance, column);
|
4076
3697
|
};
|
3698
|
+
|
4077
3699
|
/**
|
4078
3700
|
* Select cell specified by `row` and `column` values or a range of cells finishing at `endRow`, `endCol`. If the table
|
4079
3701
|
* was configured to support data column properties that properties can be used to making a selection.
|
@@ -4105,18 +3727,15 @@ function Core(rootElement, userSettings) {
|
|
4105
3727
|
* @param {boolean} [changeListener=true] If `false`, Handsontable will not change keyboard events listener to himself.
|
4106
3728
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
4107
3729
|
*/
|
4108
|
-
|
4109
|
-
|
4110
3730
|
this.selectCell = function (row, column, endRow, endColumn) {
|
4111
3731
|
var scrollToCell = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
|
4112
3732
|
var changeListener = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true;
|
4113
|
-
|
4114
3733
|
if ((0, _mixed.isUndefined)(row) || (0, _mixed.isUndefined)(column)) {
|
4115
3734
|
return false;
|
4116
3735
|
}
|
4117
|
-
|
4118
3736
|
return this.selectCells([[row, column, endRow, endColumn]], scrollToCell, changeListener);
|
4119
3737
|
};
|
3738
|
+
|
4120
3739
|
/**
|
4121
3740
|
* Make multiple, non-contiguous selection specified by `row` and `column` values or a range of cells
|
4122
3741
|
* finishing at `endRow`, `endColumn`. The method supports two input formats which are the same as that
|
@@ -4150,26 +3769,21 @@ function Core(rootElement, userSettings) {
|
|
4150
3769
|
* @param {boolean} [changeListener=true] If `false`, Handsontable will not change keyboard events listener to himself.
|
4151
3770
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
4152
3771
|
*/
|
4153
|
-
|
4154
|
-
|
4155
3772
|
this.selectCells = function () {
|
4156
3773
|
var coords = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [[]];
|
4157
3774
|
var scrollToCell = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
4158
3775
|
var changeListener = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
4159
|
-
|
4160
3776
|
if (scrollToCell === false) {
|
4161
3777
|
preventScrollingToCell = true;
|
4162
3778
|
}
|
4163
|
-
|
4164
3779
|
var wasSelected = selection.selectCells(coords);
|
4165
|
-
|
4166
3780
|
if (wasSelected && changeListener) {
|
4167
3781
|
instance.listen();
|
4168
3782
|
}
|
4169
|
-
|
4170
3783
|
preventScrollingToCell = false;
|
4171
3784
|
return wasSelected;
|
4172
3785
|
};
|
3786
|
+
|
4173
3787
|
/**
|
4174
3788
|
* Select column specified by `startColumn` visual index, column property or a range of columns finishing at `endColumn`.
|
4175
3789
|
*
|
@@ -4193,12 +3807,11 @@ function Core(rootElement, userSettings) {
|
|
4193
3807
|
* is not defined the column defined by `startColumn` will be selected.
|
4194
3808
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
4195
3809
|
*/
|
4196
|
-
|
4197
|
-
|
4198
3810
|
this.selectColumns = function (startColumn) {
|
4199
3811
|
var endColumn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startColumn;
|
4200
3812
|
return selection.selectColumns(startColumn, endColumn);
|
4201
3813
|
};
|
3814
|
+
|
4202
3815
|
/**
|
4203
3816
|
* Select row specified by `startRow` visual index or a range of rows finishing at `endRow`.
|
4204
3817
|
*
|
@@ -4218,23 +3831,21 @@ function Core(rootElement, userSettings) {
|
|
4218
3831
|
* is not defined the row defined by `startRow` will be selected.
|
4219
3832
|
* @returns {boolean} `true` if selection was successful, `false` otherwise.
|
4220
3833
|
*/
|
4221
|
-
|
4222
|
-
|
4223
3834
|
this.selectRows = function (startRow) {
|
4224
3835
|
var endRow = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startRow;
|
4225
3836
|
return selection.selectRows(startRow, endRow);
|
4226
3837
|
};
|
3838
|
+
|
4227
3839
|
/**
|
4228
3840
|
* Deselects the current cell selection on the table.
|
4229
3841
|
*
|
4230
3842
|
* @memberof Core#
|
4231
3843
|
* @function deselectCell
|
4232
3844
|
*/
|
4233
|
-
|
4234
|
-
|
4235
3845
|
this.deselectCell = function () {
|
4236
3846
|
selection.deselect();
|
4237
3847
|
};
|
3848
|
+
|
4238
3849
|
/**
|
4239
3850
|
* Select the whole table. The previous selection will be overwritten.
|
4240
3851
|
*
|
@@ -4244,8 +3855,6 @@ function Core(rootElement, userSettings) {
|
|
4244
3855
|
* @param {boolean} [includeHeaders=true] `true` If the selection should include the row, column and corner headers,
|
4245
3856
|
* `false` otherwise.
|
4246
3857
|
*/
|
4247
|
-
|
4248
|
-
|
4249
3858
|
this.selectAll = function () {
|
4250
3859
|
var includeHeaders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
4251
3860
|
var includeRowHeaders = includeHeaders && this.hasRowHeaders();
|
@@ -4254,11 +3863,11 @@ function Core(rootElement, userSettings) {
|
|
4254
3863
|
selection.selectAll(includeRowHeaders, includeColumnHeaders);
|
4255
3864
|
preventScrollingToCell = false;
|
4256
3865
|
};
|
4257
|
-
|
4258
3866
|
var getIndexToScroll = function getIndexToScroll(indexMapper, visualIndex) {
|
4259
3867
|
// Looking for a visual index on the right and then (when not found) on the left.
|
4260
3868
|
return indexMapper.getNearestNotHiddenIndex(visualIndex, 1, true);
|
4261
3869
|
};
|
3870
|
+
|
4262
3871
|
/**
|
4263
3872
|
* Scroll viewport to coordinates specified by the `row` and `column` arguments.
|
4264
3873
|
*
|
@@ -4276,8 +3885,6 @@ function Core(rootElement, userSettings) {
|
|
4276
3885
|
* may be rendered when they are in the viewport (we don't consider hidden indexes as they aren't rendered).
|
4277
3886
|
* @returns {boolean} `true` if scroll was successful, `false` otherwise.
|
4278
3887
|
*/
|
4279
|
-
|
4280
|
-
|
4281
3888
|
this.scrollViewportTo = function (row, column) {
|
4282
3889
|
var snapToBottom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
4283
3890
|
var snapToRight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
@@ -4286,40 +3893,31 @@ function Core(rootElement, userSettings) {
|
|
4286
3893
|
var snapToLeft = !snapToRight;
|
4287
3894
|
var renderableRow = row;
|
4288
3895
|
var renderableColumn = column;
|
4289
|
-
|
4290
3896
|
if (considerHiddenIndexes) {
|
4291
3897
|
var _isRowInteger = Number.isInteger(row);
|
4292
|
-
|
4293
3898
|
var _isColumnInteger = Number.isInteger(column);
|
4294
|
-
|
4295
3899
|
var visualRowToScroll = _isRowInteger ? getIndexToScroll(this.rowIndexMapper, row) : void 0;
|
4296
3900
|
var visualColumnToScroll = _isColumnInteger ? getIndexToScroll(this.columnIndexMapper, column) : void 0;
|
4297
|
-
|
4298
3901
|
if (visualRowToScroll === null || visualColumnToScroll === null) {
|
4299
3902
|
return false;
|
4300
3903
|
}
|
4301
|
-
|
4302
3904
|
renderableRow = _isRowInteger ? instance.rowIndexMapper.getRenderableFromVisualIndex(visualRowToScroll) : void 0;
|
4303
3905
|
renderableColumn = _isColumnInteger ? instance.columnIndexMapper.getRenderableFromVisualIndex(visualColumnToScroll) : void 0;
|
4304
3906
|
}
|
4305
|
-
|
4306
3907
|
var isRowInteger = Number.isInteger(renderableRow);
|
4307
3908
|
var isColumnInteger = Number.isInteger(renderableColumn);
|
4308
|
-
|
4309
3909
|
if (isRowInteger && isColumnInteger) {
|
4310
3910
|
return instance.view.scrollViewport(instance._createCellCoords(renderableRow, renderableColumn), snapToTop, snapToRight, snapToBottom, snapToLeft);
|
4311
3911
|
}
|
4312
|
-
|
4313
3912
|
if (isRowInteger && isColumnInteger === false) {
|
4314
3913
|
return instance.view.scrollViewportVertically(renderableRow, snapToTop, snapToBottom);
|
4315
3914
|
}
|
4316
|
-
|
4317
3915
|
if (isColumnInteger && isRowInteger === false) {
|
4318
3916
|
return instance.view.scrollViewportHorizontally(renderableColumn, snapToRight, snapToLeft);
|
4319
3917
|
}
|
4320
|
-
|
4321
3918
|
return false;
|
4322
3919
|
};
|
3920
|
+
|
4323
3921
|
/**
|
4324
3922
|
* Removes the table from the DOM and destroys the instance of the Handsontable.
|
4325
3923
|
*
|
@@ -4327,58 +3925,45 @@ function Core(rootElement, userSettings) {
|
|
4327
3925
|
* @function destroy
|
4328
3926
|
* @fires Hooks#afterDestroy
|
4329
3927
|
*/
|
4330
|
-
|
4331
|
-
|
4332
3928
|
this.destroy = function () {
|
4333
3929
|
instance._clearTimeouts();
|
4334
|
-
|
4335
3930
|
instance._clearImmediates();
|
4336
|
-
|
4337
3931
|
if (instance.view) {
|
4338
3932
|
// in case HT is destroyed before initialization has finished
|
4339
3933
|
instance.view.destroy();
|
4340
3934
|
}
|
4341
|
-
|
4342
3935
|
if (dataSource) {
|
4343
3936
|
dataSource.destroy();
|
4344
3937
|
}
|
4345
|
-
|
4346
3938
|
dataSource = null;
|
4347
3939
|
this.getShortcutManager().destroy();
|
4348
3940
|
metaManager.clearCache();
|
4349
|
-
|
4350
3941
|
if ((0, _rootInstance.isRootInstance)(instance)) {
|
4351
3942
|
var licenseInfo = this.rootDocument.querySelector('#hot-display-license-info');
|
4352
|
-
|
4353
3943
|
if (licenseInfo) {
|
4354
3944
|
licenseInfo.parentNode.removeChild(licenseInfo);
|
4355
3945
|
}
|
4356
3946
|
}
|
4357
|
-
|
4358
3947
|
(0, _element.empty)(instance.rootElement);
|
4359
3948
|
eventManager.destroy();
|
4360
|
-
|
4361
3949
|
if (editorManager) {
|
4362
3950
|
editorManager.destroy();
|
4363
|
-
}
|
4364
|
-
// unregistration of plugin's maps. Some unregistered maps reset the cache.
|
4365
|
-
|
3951
|
+
}
|
4366
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.
|
4367
3955
|
instance.batchExecution(function () {
|
4368
3956
|
instance.rowIndexMapper.unregisterAll();
|
4369
3957
|
instance.columnIndexMapper.unregisterAll();
|
4370
3958
|
pluginsRegistry.getItems().forEach(function (_ref20) {
|
4371
3959
|
var _ref21 = _slicedToArray(_ref20, 2),
|
4372
|
-
|
4373
|
-
|
3960
|
+
plugin = _ref21[1];
|
4374
3961
|
plugin.destroy();
|
4375
3962
|
});
|
4376
3963
|
pluginsRegistry.clear();
|
4377
3964
|
instance.runHooks('afterDestroy');
|
4378
3965
|
}, true);
|
4379
|
-
|
4380
3966
|
_pluginHooks.default.getSingleton().destroy(instance);
|
4381
|
-
|
4382
3967
|
(0, _object.objectEach)(instance, function (property, key, obj) {
|
4383
3968
|
// replace instance methods with post mortem
|
4384
3969
|
if ((0, _function.isFunction)(property)) {
|
@@ -4389,13 +3974,13 @@ function Core(rootElement, userSettings) {
|
|
4389
3974
|
obj[key] = null;
|
4390
3975
|
}
|
4391
3976
|
});
|
4392
|
-
instance.isDestroyed = true;
|
4393
|
-
// it should not be necessary but this prevents a memory leak side effects that show itself in Jasmine tests
|
3977
|
+
instance.isDestroyed = true;
|
4394
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
|
4395
3981
|
if (datamap) {
|
4396
3982
|
datamap.destroy();
|
4397
3983
|
}
|
4398
|
-
|
4399
3984
|
instance.rowIndexMapper = null;
|
4400
3985
|
instance.columnIndexMapper = null;
|
4401
3986
|
datamap = null;
|
@@ -4404,6 +3989,7 @@ function Core(rootElement, userSettings) {
|
|
4404
3989
|
editorManager = null;
|
4405
3990
|
instance = null;
|
4406
3991
|
};
|
3992
|
+
|
4407
3993
|
/**
|
4408
3994
|
* Replacement for all methods after the Handsontable was destroyed.
|
4409
3995
|
*
|
@@ -4411,13 +3997,12 @@ function Core(rootElement, userSettings) {
|
|
4411
3997
|
* @param {string} method The method name.
|
4412
3998
|
* @returns {Function}
|
4413
3999
|
*/
|
4414
|
-
|
4415
|
-
|
4416
4000
|
function postMortem(method) {
|
4417
4001
|
return function () {
|
4418
4002
|
throw new Error("The \"".concat(method, "\" method cannot be called because this Handsontable instance has been destroyed"));
|
4419
4003
|
};
|
4420
4004
|
}
|
4005
|
+
|
4421
4006
|
/**
|
4422
4007
|
* Returns the active editor class instance.
|
4423
4008
|
*
|
@@ -4425,11 +4010,10 @@ function Core(rootElement, userSettings) {
|
|
4425
4010
|
* @function getActiveEditor
|
4426
4011
|
* @returns {BaseEditor} The active editor instance.
|
4427
4012
|
*/
|
4428
|
-
|
4429
|
-
|
4430
4013
|
this.getActiveEditor = function () {
|
4431
4014
|
return editorManager.getActiveEditor();
|
4432
4015
|
};
|
4016
|
+
|
4433
4017
|
/**
|
4434
4018
|
* Returns plugin instance by provided its name.
|
4435
4019
|
*
|
@@ -4438,17 +4022,16 @@ function Core(rootElement, userSettings) {
|
|
4438
4022
|
* @param {string} pluginName The plugin name.
|
4439
4023
|
* @returns {BasePlugin|undefined} The plugin instance or undefined if there is no plugin.
|
4440
4024
|
*/
|
4441
|
-
|
4442
|
-
|
4443
4025
|
this.getPlugin = function (pluginName) {
|
4444
|
-
var unifiedPluginName = (0, _string.toUpperCaseFirst)(pluginName);
|
4026
|
+
var unifiedPluginName = (0, _string.toUpperCaseFirst)(pluginName);
|
4445
4027
|
|
4028
|
+
// Workaround for the UndoRedo plugin which, currently doesn't follow the plugin architecture.
|
4446
4029
|
if (unifiedPluginName === 'UndoRedo') {
|
4447
4030
|
return this.undoRedo;
|
4448
4031
|
}
|
4449
|
-
|
4450
4032
|
return pluginsRegistry.getItem(unifiedPluginName);
|
4451
4033
|
};
|
4034
|
+
|
4452
4035
|
/**
|
4453
4036
|
* Returns name of the passed plugin.
|
4454
4037
|
*
|
@@ -4457,16 +4040,14 @@ function Core(rootElement, userSettings) {
|
|
4457
4040
|
* @param {BasePlugin} plugin The plugin instance.
|
4458
4041
|
* @returns {string}
|
4459
4042
|
*/
|
4460
|
-
|
4461
|
-
|
4462
4043
|
this.getPluginName = function (plugin) {
|
4463
4044
|
// Workaround for the UndoRedo plugin which, currently doesn't follow the plugin architecture.
|
4464
4045
|
if (plugin === this.undoRedo) {
|
4465
4046
|
return this.undoRedo.constructor.PLUGIN_KEY;
|
4466
4047
|
}
|
4467
|
-
|
4468
4048
|
return pluginsRegistry.getId(plugin);
|
4469
4049
|
};
|
4050
|
+
|
4470
4051
|
/**
|
4471
4052
|
* Returns the Handsontable instance.
|
4472
4053
|
*
|
@@ -4474,11 +4055,10 @@ function Core(rootElement, userSettings) {
|
|
4474
4055
|
* @function getInstance
|
4475
4056
|
* @returns {Handsontable} The Handsontable instance.
|
4476
4057
|
*/
|
4477
|
-
|
4478
|
-
|
4479
4058
|
this.getInstance = function () {
|
4480
4059
|
return instance;
|
4481
4060
|
};
|
4061
|
+
|
4482
4062
|
/**
|
4483
4063
|
* Adds listener to the specified hook name (only for this Handsontable instance).
|
4484
4064
|
*
|
@@ -4492,11 +4072,10 @@ function Core(rootElement, userSettings) {
|
|
4492
4072
|
* hot.addHook('beforeInit', myCallback);
|
4493
4073
|
* ```
|
4494
4074
|
*/
|
4495
|
-
|
4496
|
-
|
4497
4075
|
this.addHook = function (key, callback) {
|
4498
4076
|
_pluginHooks.default.getSingleton().add(key, callback, instance);
|
4499
4077
|
};
|
4078
|
+
|
4500
4079
|
/**
|
4501
4080
|
* Check if for a specified hook name there are added listeners (only for this Handsontable instance). All available
|
4502
4081
|
* hooks you will find {@link Hooks}.
|
@@ -4512,11 +4091,10 @@ function Core(rootElement, userSettings) {
|
|
4512
4091
|
* const hasBeforeInitListeners = hot.hasHook('beforeInit');
|
4513
4092
|
* ```
|
4514
4093
|
*/
|
4515
|
-
|
4516
|
-
|
4517
4094
|
this.hasHook = function (key) {
|
4518
4095
|
return _pluginHooks.default.getSingleton().has(key, instance) || _pluginHooks.default.getSingleton().has(key);
|
4519
4096
|
};
|
4097
|
+
|
4520
4098
|
/**
|
4521
4099
|
* Adds listener to specified hook name (only for this Handsontable instance). After the listener is triggered,
|
4522
4100
|
* it will be automatically removed.
|
@@ -4531,11 +4109,10 @@ function Core(rootElement, userSettings) {
|
|
4531
4109
|
* hot.addHookOnce('beforeInit', myCallback);
|
4532
4110
|
* ```
|
4533
4111
|
*/
|
4534
|
-
|
4535
|
-
|
4536
4112
|
this.addHookOnce = function (key, callback) {
|
4537
4113
|
_pluginHooks.default.getSingleton().once(key, callback, instance);
|
4538
4114
|
};
|
4115
|
+
|
4539
4116
|
/**
|
4540
4117
|
* Removes the hook listener previously registered with {@link Core#addHook}.
|
4541
4118
|
*
|
@@ -4550,11 +4127,10 @@ function Core(rootElement, userSettings) {
|
|
4550
4127
|
* hot.removeHook('beforeInit', myCallback);
|
4551
4128
|
* ```
|
4552
4129
|
*/
|
4553
|
-
|
4554
|
-
|
4555
4130
|
this.removeHook = function (key, callback) {
|
4556
4131
|
_pluginHooks.default.getSingleton().remove(key, callback, instance);
|
4557
4132
|
};
|
4133
|
+
|
4558
4134
|
/**
|
4559
4135
|
* Run the callbacks for the hook provided in the `key` argument using the parameters given in the other arguments.
|
4560
4136
|
*
|
@@ -4578,11 +4154,10 @@ function Core(rootElement, userSettings) {
|
|
4578
4154
|
* hot.runHooks('customAction', 10, 'foo');
|
4579
4155
|
* ```
|
4580
4156
|
*/
|
4581
|
-
|
4582
|
-
|
4583
4157
|
this.runHooks = function (key, p1, p2, p3, p4, p5, p6) {
|
4584
4158
|
return _pluginHooks.default.getSingleton().run(instance, key, p1, p2, p3, p4, p5, p6);
|
4585
4159
|
};
|
4160
|
+
|
4586
4161
|
/**
|
4587
4162
|
* Get language phrase for specified dictionary key.
|
4588
4163
|
*
|
@@ -4593,11 +4168,10 @@ function Core(rootElement, userSettings) {
|
|
4593
4168
|
* @param {*} extraArguments Arguments which will be handled by formatters.
|
4594
4169
|
* @returns {string}
|
4595
4170
|
*/
|
4596
|
-
|
4597
|
-
|
4598
4171
|
this.getTranslatedPhrase = function (dictionaryKey, extraArguments) {
|
4599
4172
|
return (0, _registry4.getTranslatedPhrase)(tableMeta.language, dictionaryKey, extraArguments);
|
4600
4173
|
};
|
4174
|
+
|
4601
4175
|
/**
|
4602
4176
|
* Converts instance into outerHTML of HTMLTableElement.
|
4603
4177
|
*
|
@@ -4606,11 +4180,10 @@ function Core(rootElement, userSettings) {
|
|
4606
4180
|
* @since 7.1.0
|
4607
4181
|
* @returns {string}
|
4608
4182
|
*/
|
4609
|
-
|
4610
|
-
|
4611
4183
|
this.toHTML = function () {
|
4612
4184
|
return (0, _parseTable.instanceToHTML)(_this);
|
4613
4185
|
};
|
4186
|
+
|
4614
4187
|
/**
|
4615
4188
|
* Converts instance into HTMLTableElement.
|
4616
4189
|
*
|
@@ -4619,16 +4192,13 @@ function Core(rootElement, userSettings) {
|
|
4619
4192
|
* @since 7.1.0
|
4620
4193
|
* @returns {HTMLTableElement}
|
4621
4194
|
*/
|
4622
|
-
|
4623
|
-
|
4624
4195
|
this.toTableElement = function () {
|
4625
4196
|
var tempElement = _this.rootDocument.createElement('div');
|
4626
|
-
|
4627
4197
|
tempElement.insertAdjacentHTML('afterbegin', (0, _parseTable.instanceToHTML)(_this));
|
4628
4198
|
return tempElement.firstElementChild;
|
4629
4199
|
};
|
4630
|
-
|
4631
4200
|
this.timeouts = [];
|
4201
|
+
|
4632
4202
|
/**
|
4633
4203
|
* Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called.
|
4634
4204
|
*
|
@@ -4637,53 +4207,48 @@ function Core(rootElement, userSettings) {
|
|
4637
4207
|
* @param {number} [delay=0] If first argument is passed as a function this argument set delay of the execution of that function.
|
4638
4208
|
* @private
|
4639
4209
|
*/
|
4640
|
-
|
4641
4210
|
this._registerTimeout = function (handle) {
|
4642
4211
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
4643
4212
|
var handleFunc = handle;
|
4644
|
-
|
4645
4213
|
if (typeof handleFunc === 'function') {
|
4646
4214
|
handleFunc = setTimeout(handleFunc, delay);
|
4647
4215
|
}
|
4648
|
-
|
4649
4216
|
this.timeouts.push(handleFunc);
|
4650
4217
|
};
|
4218
|
+
|
4651
4219
|
/**
|
4652
4220
|
* Clears all known timeouts.
|
4653
4221
|
*
|
4654
4222
|
* @private
|
4655
4223
|
*/
|
4656
|
-
|
4657
|
-
|
4658
4224
|
this._clearTimeouts = function () {
|
4659
4225
|
(0, _array.arrayEach)(this.timeouts, function (handler) {
|
4660
4226
|
clearTimeout(handler);
|
4661
4227
|
});
|
4662
4228
|
};
|
4663
|
-
|
4664
4229
|
this.immediates = [];
|
4230
|
+
|
4665
4231
|
/**
|
4666
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.
|
4667
4233
|
*
|
4668
4234
|
* @param {Function} callback Function to be delayed in execution.
|
4669
4235
|
* @private
|
4670
4236
|
*/
|
4671
|
-
|
4672
4237
|
this._registerImmediate = function (callback) {
|
4673
4238
|
this.immediates.push(setImmediate(callback));
|
4674
4239
|
};
|
4240
|
+
|
4675
4241
|
/**
|
4676
4242
|
* Clears all known timeouts.
|
4677
4243
|
*
|
4678
4244
|
* @private
|
4679
4245
|
*/
|
4680
|
-
|
4681
|
-
|
4682
4246
|
this._clearImmediates = function () {
|
4683
4247
|
(0, _array.arrayEach)(this.immediates, function (handler) {
|
4684
4248
|
clearImmediate(handler);
|
4685
4249
|
});
|
4686
4250
|
};
|
4251
|
+
|
4687
4252
|
/**
|
4688
4253
|
* Refresh selection borders. This is temporary method relic after selection rewrite.
|
4689
4254
|
*
|
@@ -4691,18 +4256,16 @@ function Core(rootElement, userSettings) {
|
|
4691
4256
|
* @param {boolean} [revertOriginal=false] If `true`, the previous value will be restored. Otherwise, the edited value will be saved.
|
4692
4257
|
* @param {boolean} [prepareEditorIfNeeded=true] If `true` the editor under the selected cell will be prepared to open.
|
4693
4258
|
*/
|
4694
|
-
|
4695
|
-
|
4696
4259
|
this._refreshBorders = function () {
|
4697
4260
|
var revertOriginal = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
4698
4261
|
var prepareEditorIfNeeded = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
4699
4262
|
editorManager.destroyEditor(revertOriginal);
|
4700
4263
|
instance.view.render();
|
4701
|
-
|
4702
4264
|
if (prepareEditorIfNeeded && selection.isSelected()) {
|
4703
4265
|
editorManager.prepareEditor();
|
4704
4266
|
}
|
4705
4267
|
};
|
4268
|
+
|
4706
4269
|
/**
|
4707
4270
|
* Check if currently it is RTL direction.
|
4708
4271
|
*
|
@@ -4711,11 +4274,10 @@ function Core(rootElement, userSettings) {
|
|
4711
4274
|
* @function isRtl
|
4712
4275
|
* @returns {boolean} True if RTL.
|
4713
4276
|
*/
|
4714
|
-
|
4715
|
-
|
4716
4277
|
this.isRtl = function () {
|
4717
4278
|
return instance.rootWindow.getComputedStyle(instance.rootElement).direction === 'rtl';
|
4718
4279
|
};
|
4280
|
+
|
4719
4281
|
/**
|
4720
4282
|
* Check if currently it is LTR direction.
|
4721
4283
|
*
|
@@ -4724,11 +4286,10 @@ function Core(rootElement, userSettings) {
|
|
4724
4286
|
* @function isLtr
|
4725
4287
|
* @returns {boolean} True if LTR.
|
4726
4288
|
*/
|
4727
|
-
|
4728
|
-
|
4729
4289
|
this.isLtr = function () {
|
4730
4290
|
return !instance.isRtl();
|
4731
4291
|
};
|
4292
|
+
|
4732
4293
|
/**
|
4733
4294
|
* Returns 1 for LTR; -1 for RTL. Useful for calculations.
|
4734
4295
|
*
|
@@ -4737,12 +4298,9 @@ function Core(rootElement, userSettings) {
|
|
4737
4298
|
* @function getDirectionFactor
|
4738
4299
|
* @returns {number} Returns 1 for LTR; -1 for RTL.
|
4739
4300
|
*/
|
4740
|
-
|
4741
|
-
|
4742
4301
|
this.getDirectionFactor = function () {
|
4743
4302
|
return instance.isLtr() ? 1 : -1;
|
4744
4303
|
};
|
4745
|
-
|
4746
4304
|
var shortcutManager = (0, _shortcuts.createShortcutManager)({
|
4747
4305
|
handleEvent: function handleEvent(event) {
|
4748
4306
|
var isListening = instance.isListening();
|
@@ -4757,11 +4315,11 @@ function Core(rootElement, userSettings) {
|
|
4757
4315
|
// Handsontable could be destroyed after performing action (executing a callback).
|
4758
4316
|
return;
|
4759
4317
|
}
|
4760
|
-
|
4761
4318
|
instance.runHooks('afterDocumentKeyDown', event);
|
4762
4319
|
},
|
4763
4320
|
ownerWindow: this.rootWindow
|
4764
4321
|
});
|
4322
|
+
|
4765
4323
|
/**
|
4766
4324
|
* Returns instance of a manager responsible for handling shortcuts stored in some contexts. It run actions after
|
4767
4325
|
* pressing key combination in active Handsontable instance.
|
@@ -4771,11 +4329,9 @@ function Core(rootElement, userSettings) {
|
|
4771
4329
|
* @function getShortcutManager
|
4772
4330
|
* @returns {ShortcutManager} Instance of {@link ShortcutManager}
|
4773
4331
|
*/
|
4774
|
-
|
4775
4332
|
this.getShortcutManager = function () {
|
4776
4333
|
return shortcutManager;
|
4777
4334
|
};
|
4778
|
-
|
4779
4335
|
var gridContext = shortcutManager.addContext('grid');
|
4780
4336
|
var gridConfig = {
|
4781
4337
|
runOnlyIf: function runOnlyIf() {
|
@@ -4794,24 +4350,21 @@ function Core(rootElement, userSettings) {
|
|
4794
4350
|
callback: function callback() {
|
4795
4351
|
var selectedRange = instance.getSelectedRange();
|
4796
4352
|
var _selectedRange$highli = selectedRange[selectedRange.length - 1].highlight,
|
4797
|
-
|
4798
|
-
|
4353
|
+
highlightRow = _selectedRange$highli.row,
|
4354
|
+
highlightColumn = _selectedRange$highli.col;
|
4799
4355
|
var valueToPopulate = instance.getDataAtCell(highlightRow, highlightColumn);
|
4800
4356
|
var cellValues = new Map();
|
4801
|
-
|
4802
4357
|
for (var i = 0; i < selectedRange.length; i++) {
|
4803
4358
|
selectedRange[i].forAll(function (row, column) {
|
4804
4359
|
if (row >= 0 && column >= 0 && (row !== highlightRow || column !== highlightColumn)) {
|
4805
4360
|
var _instance$getCellMeta = instance.getCellMeta(row, column),
|
4806
|
-
|
4807
|
-
|
4361
|
+
readOnly = _instance$getCellMeta.readOnly;
|
4808
4362
|
if (!readOnly) {
|
4809
4363
|
cellValues.set("".concat(row, "x").concat(column), [row, column, valueToPopulate]);
|
4810
4364
|
}
|
4811
4365
|
}
|
4812
4366
|
});
|
4813
4367
|
}
|
4814
|
-
|
4815
4368
|
instance.setDataAtCell(Array.from(cellValues.values()));
|
4816
4369
|
},
|
4817
4370
|
runOnlyIf: function runOnlyIf() {
|
@@ -4838,9 +4391,8 @@ function Core(rootElement, userSettings) {
|
|
4838
4391
|
captureCtrl: true,
|
4839
4392
|
callback: function callback() {
|
4840
4393
|
var _instance$getSelected = instance.getSelectedRangeLast(),
|
4841
|
-
|
4842
|
-
|
4843
|
-
|
4394
|
+
from = _instance$getSelected.from,
|
4395
|
+
to = _instance$getSelected.to;
|
4844
4396
|
var row = instance.rowIndexMapper.getNearestNotHiddenIndex(0, 1);
|
4845
4397
|
selection.setRangeStart(from.clone());
|
4846
4398
|
selection.setRangeEnd(instance._createCellCoords(row, to.col));
|
@@ -4869,9 +4421,8 @@ function Core(rootElement, userSettings) {
|
|
4869
4421
|
captureCtrl: true,
|
4870
4422
|
callback: function callback() {
|
4871
4423
|
var _instance$getSelected2 = instance.getSelectedRangeLast(),
|
4872
|
-
|
4873
|
-
|
4874
|
-
|
4424
|
+
from = _instance$getSelected2.from,
|
4425
|
+
to = _instance$getSelected2.to;
|
4875
4426
|
var row = instance.rowIndexMapper.getNearestNotHiddenIndex(instance.countRows() - 1, -1);
|
4876
4427
|
selection.setRangeStart(from.clone());
|
4877
4428
|
selection.setRangeEnd(instance._createCellCoords(row, to.col));
|
@@ -4889,11 +4440,8 @@ function Core(rootElement, userSettings) {
|
|
4889
4440
|
captureCtrl: true,
|
4890
4441
|
callback: function callback() {
|
4891
4442
|
var _instance$columnIndex;
|
4892
|
-
|
4893
4443
|
var row = instance.getSelectedRangeLast().highlight.row;
|
4894
|
-
|
4895
4444
|
var column = (_instance$columnIndex = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
|
4896
|
-
|
4897
4445
|
selection.setRangeStart(instance._createCellCoords(row, column));
|
4898
4446
|
}
|
4899
4447
|
}, {
|
@@ -4906,13 +4454,10 @@ function Core(rootElement, userSettings) {
|
|
4906
4454
|
captureCtrl: true,
|
4907
4455
|
callback: function callback() {
|
4908
4456
|
var _instance$columnIndex2;
|
4909
|
-
|
4910
4457
|
var _instance$getSelected3 = instance.getSelectedRangeLast(),
|
4911
|
-
|
4912
|
-
|
4913
|
-
|
4458
|
+
from = _instance$getSelected3.from,
|
4459
|
+
to = _instance$getSelected3.to;
|
4914
4460
|
var column = (_instance$columnIndex2 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex2, _toConsumableArray(instance.isRtl() ? [instance.countCols() - 1, -1] : [0, 1]));
|
4915
|
-
|
4916
4461
|
selection.setRangeStart(from.clone());
|
4917
4462
|
selection.setRangeEnd(instance._createCellCoords(to.row, column));
|
4918
4463
|
},
|
@@ -4929,11 +4474,8 @@ function Core(rootElement, userSettings) {
|
|
4929
4474
|
captureCtrl: true,
|
4930
4475
|
callback: function callback() {
|
4931
4476
|
var _instance$columnIndex3;
|
4932
|
-
|
4933
4477
|
var row = instance.getSelectedRangeLast().highlight.row;
|
4934
|
-
|
4935
4478
|
var column = (_instance$columnIndex3 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex3, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
|
4936
|
-
|
4937
4479
|
selection.setRangeStart(instance._createCellCoords(row, column));
|
4938
4480
|
}
|
4939
4481
|
}, {
|
@@ -4946,13 +4488,10 @@ function Core(rootElement, userSettings) {
|
|
4946
4488
|
captureCtrl: true,
|
4947
4489
|
callback: function callback() {
|
4948
4490
|
var _instance$columnIndex4;
|
4949
|
-
|
4950
4491
|
var _instance$getSelected4 = instance.getSelectedRangeLast(),
|
4951
|
-
|
4952
|
-
|
4953
|
-
|
4492
|
+
from = _instance$getSelected4.from,
|
4493
|
+
to = _instance$getSelected4.to;
|
4954
4494
|
var column = (_instance$columnIndex4 = instance.columnIndexMapper).getNearestNotHiddenIndex.apply(_instance$columnIndex4, _toConsumableArray(instance.isRtl() ? [0, 1] : [instance.countCols() - 1, -1]));
|
4955
|
-
|
4956
4495
|
selection.setRangeStart(from.clone());
|
4957
4496
|
selection.setRangeEnd(instance._createCellCoords(to.row, column));
|
4958
4497
|
},
|
@@ -5024,14 +4563,11 @@ function Core(rootElement, userSettings) {
|
|
5024
4563
|
keys: [['PageUp', 'Shift']],
|
5025
4564
|
callback: function callback() {
|
5026
4565
|
var _instance$getSelected5 = instance.getSelectedRangeLast(),
|
5027
|
-
|
5028
|
-
|
4566
|
+
to = _instance$getSelected5.to;
|
5029
4567
|
var nextRowIndexToSelect = Math.max(to.row - instance.countVisibleRows(), 0);
|
5030
4568
|
var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
|
5031
|
-
|
5032
4569
|
if (row !== null) {
|
5033
4570
|
var coords = instance._createCellCoords(row, to.col);
|
5034
|
-
|
5035
4571
|
var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
|
5036
4572
|
var nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
|
5037
4573
|
selection.setRangeEnd(coords);
|
@@ -5047,14 +4583,11 @@ function Core(rootElement, userSettings) {
|
|
5047
4583
|
keys: [['PageDown', 'Shift']],
|
5048
4584
|
callback: function callback() {
|
5049
4585
|
var _instance$getSelected6 = instance.getSelectedRangeLast(),
|
5050
|
-
|
5051
|
-
|
4586
|
+
to = _instance$getSelected6.to;
|
5052
4587
|
var nextRowIndexToSelect = Math.min(to.row + instance.countVisibleRows(), instance.countRows() - 1);
|
5053
4588
|
var row = instance.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
|
5054
|
-
|
5055
4589
|
if (row !== null) {
|
5056
4590
|
var coords = instance._createCellCoords(row, to.col);
|
5057
|
-
|
5058
4591
|
var scrollPadding = to.row - instance.view.getFirstFullyVisibleRow();
|
5059
4592
|
var nextVerticalScroll = Math.min(coords.row - scrollPadding, instance.countRows() - 1);
|
5060
4593
|
selection.setRangeEnd(coords);
|
@@ -5078,6 +4611,5 @@ function Core(rootElement, userSettings) {
|
|
5078
4611
|
var PluginClass = (0, _registry.getPlugin)(pluginName);
|
5079
4612
|
pluginsRegistry.addItem(pluginName, new PluginClass(_this));
|
5080
4613
|
});
|
5081
|
-
|
5082
4614
|
_pluginHooks.default.getSingleton().run(instance, 'construct');
|
5083
4615
|
}
|