d2coreui 21.0.33 → 23.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/clipboard/clipboardUtils.d.ts +4 -3
- package/components/clipboard/clipboardUtils.js +47 -22
- package/components/clipboard/clipboardUtils.js.map +1 -1
- package/components/codemirror/SyntaxHighlighter.d.ts +21 -21
- package/components/codemirror/SyntaxHighlighter.js +45 -44
- package/components/codemirror/SyntaxHighlighter.js.map +1 -1
- package/components/collapse/expandable.d.ts +13 -12
- package/components/collapse/expandable.js +20 -20
- package/components/collapse/expandable.js.map +1 -1
- package/components/color/colorPicker.d.ts +20 -20
- package/components/color/colorPicker.js +53 -53
- package/components/color/colorPicker.js.map +1 -1
- package/components/color/colorSwatch.d.ts +13 -12
- package/components/color/colorSwatch.js +62 -62
- package/components/color/colorSwatch.js.map +1 -1
- package/components/color/colorUtils.d.ts +7 -7
- package/components/color/colorUtils.js +43 -43
- package/components/color/colorUtils.js.map +1 -1
- package/components/date/dateRangeInput.d.ts +66 -64
- package/components/date/dateRangeInput.js +292 -297
- package/components/date/dateRangeInput.js.map +1 -1
- package/components/date/dateRangeInputAdvancedPanel.d.ts +27 -26
- package/components/date/dateRangeInputAdvancedPanel.js +130 -115
- package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
- package/components/date/dateRangeInputConfirm.d.ts +31 -29
- package/components/date/dateRangeInputConfirm.js +132 -121
- package/components/date/dateRangeInputConfirm.js.map +1 -1
- package/components/date/dateTimeInput.d.ts +72 -69
- package/components/date/dateTimeInput.js +440 -412
- package/components/date/dateTimeInput.js.map +1 -1
- package/components/date/durationInput.d.ts +59 -56
- package/components/date/durationInput.js +269 -280
- package/components/date/durationInput.js.map +1 -1
- package/components/form/NiceFormItem.d.ts +14 -14
- package/components/form/NiceFormItem.js +28 -31
- package/components/form/NiceFormItem.js.map +1 -1
- package/components/grid/cell/beanAccessor.d.ts +9 -0
- package/components/grid/cell/beanAccessor.js +13 -0
- package/components/grid/cell/beanAccessor.js.map +1 -0
- package/components/grid/cell/cellEditorUtils.d.ts +4 -4
- package/components/grid/cell/cellEditorUtils.js +8 -8
- package/components/grid/cell/customEnumCellEditor.d.ts +4 -26
- package/components/grid/cell/customEnumCellEditor.js +82 -91
- package/components/grid/cell/customEnumCellEditor.js.map +1 -1
- package/components/grid/cell/dataGridCellEditorComponent.d.ts +14 -0
- package/components/grid/cell/dataGridCellEditorComponent.js +49 -0
- package/components/grid/cell/dataGridCellEditorComponent.js.map +1 -0
- package/components/grid/cell/dateCellEditor.d.ts +4 -25
- package/components/grid/cell/dateCellEditor.js +53 -72
- package/components/grid/cell/dateCellEditor.js.map +1 -1
- package/components/grid/cell/durationCellEditor.d.ts +4 -24
- package/components/grid/cell/durationCellEditor.js +74 -97
- package/components/grid/cell/durationCellEditor.js.map +1 -1
- package/components/grid/cell/hexaOctetStringCellEditor.d.ts +4 -24
- package/components/grid/cell/hexaOctetStringCellEditor.js +70 -94
- package/components/grid/cell/hexaOctetStringCellEditor.js.map +1 -1
- package/components/grid/cell/hexaValueCellEditor.d.ts +4 -24
- package/components/grid/cell/hexaValueCellEditor.js +65 -89
- package/components/grid/cell/hexaValueCellEditor.js.map +1 -1
- package/components/grid/cell/numberCellEditor.d.ts +4 -27
- package/components/grid/cell/numberCellEditor.js +73 -95
- package/components/grid/cell/numberCellEditor.js.map +1 -1
- package/components/grid/cell/rangeSelector.d.ts +78 -78
- package/components/grid/cell/rangeSelector.js +526 -518
- package/components/grid/cell/rangeSelector.js.map +1 -1
- package/components/grid/cell/simpleStatusTextCellEditor.d.ts +4 -32
- package/components/grid/cell/simpleStatusTextCellEditor.js +106 -116
- package/components/grid/cell/simpleStatusTextCellEditor.js.map +1 -1
- package/components/grid/cell/statusTextCellEditor.d.ts +4 -32
- package/components/grid/cell/statusTextCellEditor.js +136 -159
- package/components/grid/cell/statusTextCellEditor.js.map +1 -1
- package/components/grid/cell/tableDefaultRowStyleRules.d.ts +20 -20
- package/components/grid/cell/tableDefaultRowStyleRules.js +29 -18
- package/components/grid/cell/tableDefaultRowStyleRules.js.map +1 -1
- package/components/grid/cell/textCellEditor.d.ts +4 -21
- package/components/grid/cell/textCellEditor.js +63 -85
- package/components/grid/cell/textCellEditor.js.map +1 -1
- package/components/grid/cell/withAgGridHooks.d.ts +3 -0
- package/components/grid/cell/withAgGridHooks.js +15 -0
- package/components/grid/cell/withAgGridHooks.js.map +1 -0
- package/components/grid/columnUtils.d.ts +5 -5
- package/components/grid/columnUtils.js +26 -26
- package/components/grid/columnUtils.js.map +1 -1
- package/components/grid/config/columnTransfer.d.ts +21 -22
- package/components/grid/config/columnTransfer.js +205 -201
- package/components/grid/config/columnTransfer.js.map +1 -1
- package/components/grid/config/dataGridEditor.d.ts +41 -41
- package/components/grid/config/dataGridEditor.js +181 -160
- package/components/grid/config/dataGridEditor.js.map +1 -1
- package/components/grid/config/rowHeightCalculator.d.ts +8 -0
- package/components/grid/config/rowHeightCalculator.js +20 -0
- package/components/grid/config/rowHeightCalculator.js.map +1 -0
- package/components/grid/config/rowStylePicker.d.ts +27 -25
- package/components/grid/config/rowStylePicker.js +127 -109
- package/components/grid/config/rowStylePicker.js.map +1 -1
- package/components/grid/dataGrid.d.ts +218 -206
- package/components/grid/dataGrid.js +1629 -1538
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/detail/detailHeaderPanel.d.ts +13 -13
- package/components/grid/detail/detailHeaderPanel.js +25 -25
- package/components/grid/detail/detailHeaderPanel.js.map +1 -1
- package/components/grid/export/contextMenu.d.ts +18 -24
- package/components/grid/export/contextMenu.js +116 -113
- package/components/grid/export/contextMenu.js.map +1 -1
- package/components/grid/export/progressPopup.d.ts +29 -29
- package/components/grid/export/progressPopup.js +93 -93
- package/components/grid/export/progressPopup.js.map +1 -1
- package/components/grid/export/worker/clipboardExport.d.ts +1 -1
- package/components/grid/export/worker/clipboardExport.js +8 -8
- package/components/grid/export/worker/csvExport.d.ts +1 -1
- package/components/grid/export/worker/csvExport.js +8 -8
- package/components/grid/export/worker/pdfExport.d.ts +1 -1
- package/components/grid/export/worker/pdfExport.js +81 -81
- package/components/grid/export/worker/pdfExport.js.map +1 -1
- package/components/grid/export/worker/txtExport.d.ts +1 -1
- package/components/grid/export/worker/txtExport.js +19 -19
- package/components/grid/extendedDataGrid.d.ts +140 -140
- package/components/grid/extendedDataGrid.js +704 -695
- package/components/grid/extendedDataGrid.js.map +1 -1
- package/components/grid/filter/customColumnFilter.d.ts +5 -21
- package/components/grid/filter/customColumnFilter.js +11 -82
- package/components/grid/filter/customColumnFilter.js.map +1 -1
- package/components/grid/filter/dataGridColumnFilter.d.ts +17 -0
- package/components/grid/filter/dataGridColumnFilter.js +49 -0
- package/components/grid/filter/dataGridColumnFilter.js.map +1 -0
- package/components/grid/filter/dateColumnFilter.d.ts +7 -11
- package/components/grid/filter/dateColumnFilter.js +22 -56
- package/components/grid/filter/dateColumnFilter.js.map +1 -1
- package/components/grid/filter/textColumnFilter.d.ts +8 -20
- package/components/grid/filter/textColumnFilter.js +24 -76
- package/components/grid/filter/textColumnFilter.js.map +1 -1
- package/components/grid/filter/wildcardQuickFilterEngine.d.ts +7 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js +48 -0
- package/components/grid/filter/wildcardQuickFilterEngine.js.map +1 -0
- package/components/grid/header/simpleHeader.d.ts +17 -16
- package/components/grid/header/simpleHeader.js +230 -186
- package/components/grid/header/simpleHeader.js.map +1 -1
- package/components/grid/panel/dataGridPagination.d.ts +16 -16
- package/components/grid/panel/dataGridPagination.js +58 -58
- package/components/grid/panel/dataGridPagination.js.map +1 -1
- package/components/grid/panel/loadingOverlay.d.ts +6 -6
- package/components/grid/panel/loadingOverlay.js +10 -10
- package/components/grid/panel/loadingOverlay.js.map +1 -1
- package/components/grid/panel/noRecordsOverlay.d.ts +6 -6
- package/components/grid/panel/noRecordsOverlay.js +10 -10
- package/components/grid/panel/noRecordsOverlay.js.map +1 -1
- package/components/grid/panel/tablePagination.d.ts +10 -10
- package/components/grid/panel/tablePagination.js +45 -45
- package/components/grid/panel/tablePagination.js.map +1 -1
- package/components/icons/dropdownArrow.d.ts +8 -0
- package/components/icons/dropdownArrow.js +59 -0
- package/components/icons/dropdownArrow.js.map +1 -0
- package/components/icons/undoIcon.d.ts +8 -8
- package/components/icons/undoIcon.js +6 -6
- package/components/input/autoCompleteInput.d.ts +35 -35
- package/components/input/autoCompleteInput.js +122 -121
- package/components/input/autoCompleteInput.js.map +1 -1
- package/components/input/draftUtils.d.ts +4 -4
- package/components/input/draftUtils.js +48 -48
- package/components/input/draftUtils.js.map +1 -1
- package/components/input/draftail.d.ts +1 -1
- package/components/input/draftail.js +1 -1
- package/components/input/hexaFormattedInput.d.ts +16 -16
- package/components/input/hexaFormattedInput.js +54 -54
- package/components/input/hexaFormattedInput.js.map +1 -1
- package/components/input/mask/helpers.d.ts +28 -28
- package/components/input/mask/helpers.js +112 -112
- package/components/input/mask/helpers.js.map +1 -1
- package/components/input/mask/inputMaskCore.d.ts +46 -46
- package/components/input/mask/inputMaskCore.js +278 -278
- package/components/input/mask/inputMaskCore.js.map +1 -1
- package/components/input/mask/pattern.d.ts +20 -20
- package/components/input/mask/pattern.js +78 -78
- package/components/input/mask/pattern.js.map +1 -1
- package/components/input/maskedInput.d.ts +373 -351
- package/components/input/maskedInput.js +224 -224
- package/components/input/maskedInput.js.map +1 -1
- package/components/input/passwordInput.d.ts +9 -9
- package/components/input/passwordInput.js +55 -55
- package/components/input/passwordInput.js.map +1 -1
- package/components/input/simpleAutoComplete.d.ts +12 -12
- package/components/input/simpleAutoComplete.js +41 -43
- package/components/input/simpleAutoComplete.js.map +1 -1
- package/components/input/textarea/extractSpansOfClasses.d.ts +15 -15
- package/components/input/textarea/extractSpansOfClasses.js +96 -96
- package/components/input/textarea/extractSpansOfClasses.js.map +1 -1
- package/components/input/textarea/getRanges.d.ts +1 -1
- package/components/input/textarea/getRanges.js +73 -73
- package/components/input/textarea/getRanges.js.map +1 -1
- package/components/input/textarea/getType.d.ts +1 -1
- package/components/input/textarea/getType.js +26 -26
- package/components/input/textarea/getType.js.map +1 -1
- package/components/input/textarea/highlighedContents.d.ts +6 -6
- package/components/input/textarea/highlighedContents.js +10 -10
- package/components/input/textarea/mentionsWithHighlighting.d.ts +27 -27
- package/components/input/textarea/mentionsWithHighlighting.js +60 -60
- package/components/input/textarea/mentionsWithHighlighting.js.map +1 -1
- package/components/keyboard/keyboardUtils.d.ts +5 -5
- package/components/keyboard/keyboardUtils.js +32 -32
- package/components/modal/draggableModalProvider.d.ts +4 -4
- package/components/modal/draggableModalProvider.js +21 -21
- package/components/modal/draggableModalProvider.js.map +1 -1
- package/components/modal/impl/clamp.d.ts +1 -1
- package/components/modal/impl/clamp.js +1 -1
- package/components/modal/impl/clamp.js.map +1 -1
- package/components/modal/impl/draggableModal.d.ts +12 -12
- package/components/modal/impl/draggableModal.js +17 -17
- package/components/modal/impl/draggableModal.js.map +1 -1
- package/components/modal/impl/draggableModalContext.d.ts +9 -9
- package/components/modal/impl/draggableModalContext.js +2 -2
- package/components/modal/impl/draggableModalContext.js.map +1 -1
- package/components/modal/impl/draggableModalInner.d.ts +15 -13
- package/components/modal/impl/draggableModalInner.js +57 -55
- package/components/modal/impl/draggableModalInner.js.map +1 -1
- package/components/modal/impl/draggableModalReducer.d.ts +66 -62
- package/components/modal/impl/draggableModalReducer.js +77 -78
- package/components/modal/impl/draggableModalReducer.js.map +1 -1
- package/components/modal/impl/getWindowSize.d.ts +4 -4
- package/components/modal/impl/getWindowSize.js +4 -4
- package/components/modal/impl/getWindowSize.js.map +1 -1
- package/components/modal/impl/index.d.ts +3 -3
- package/components/modal/impl/index.js +3 -3
- package/components/modal/impl/index.js.map +1 -1
- package/components/modal/impl/resizeHandle.d.ts +3 -3
- package/components/modal/impl/resizeHandle.js +4 -4
- package/components/modal/impl/resizeHandle.js.map +1 -1
- package/components/modal/impl/useDrag.d.ts +5 -5
- package/components/modal/impl/useDrag.js +42 -42
- package/components/modal/impl/useDrag.js.map +1 -1
- package/components/modal/impl/usePrevious.d.ts +1 -1
- package/components/modal/impl/usePrevious.js +8 -8
- package/components/modal/impl/usePrevious.js.map +1 -1
- package/components/modal/impl/useResize.d.ts +7 -7
- package/components/modal/impl/useResize.js +46 -46
- package/components/modal/impl/useResize.js.map +1 -1
- package/components/modal/modalDialog.d.ts +49 -49
- package/components/modal/modalDialog.js +152 -152
- package/components/modal/modalDialog.js.map +1 -1
- package/components/picker/enumValuePicker.d.ts +16 -16
- package/components/picker/enumValuePicker.js +34 -34
- package/components/picker/enumValuePicker.js.map +1 -1
- package/components/platformSpecific.d.ts +10 -10
- package/components/platformSpecific.js +27 -27
- package/components/scrollTo/onlyText.d.ts +4 -4
- package/components/scrollTo/onlyText.js +30 -30
- package/components/scrollTo/onlyText.js.map +1 -1
- package/components/scrollTo/scrollTo.d.ts +41 -39
- package/components/scrollTo/scrollTo.js +264 -264
- package/components/scrollTo/scrollTo.js.map +1 -1
- package/components/style/withCss.d.ts +9 -0
- package/components/style/withCss.js +6 -0
- package/components/style/withCss.js.map +1 -0
- package/components/style/withInputNumberCss.d.ts +6 -0
- package/components/style/withInputNumberCss.js +13 -0
- package/components/style/withInputNumberCss.js.map +1 -0
- package/components/table/dragSortingTable.d.ts +13 -14
- package/components/table/dragSortingTable.js +96 -82
- package/components/table/dragSortingTable.js.map +1 -1
- package/components/text/impl/innerSize.d.ts +2 -2
- package/components/text/impl/innerSize.js +12 -12
- package/components/text/impl/series.d.ts +1 -1
- package/components/text/impl/series.js +28 -28
- package/components/text/impl/shallowEqual.d.ts +1 -1
- package/components/text/impl/shallowEqual.js +18 -18
- package/components/text/impl/shallowEqual.js.map +1 -1
- package/components/text/impl/uniqueId.d.ts +1 -1
- package/components/text/impl/uniqueId.js +4 -4
- package/components/text/impl/whilst.d.ts +1 -1
- package/components/text/impl/whilst.js +19 -19
- package/components/text/impl/whilst.js.map +1 -1
- package/components/text/textFit.d.ts +38 -38
- package/components/text/textFit.js +165 -168
- package/components/text/textFit.js.map +1 -1
- package/i18n/components.cs.json +101 -100
- package/i18n/components.sk.json +101 -100
- package/i18n/components.uk.json +101 -100
- package/i18n/componentsLocaleHolder.d.ts +3 -3
- package/i18n/componentsLocaleHolder.js +28 -28
- package/i18n/componentsLocaleHolder.js.map +1 -1
- package/package.json +71 -70
- package/style/index.less +274 -298
- package/style/modal/DraggableModal.css +43 -40
- package/style/modal/ResizeHandle.css +27 -19
- package/tsconfig.build.json +24 -24
- package/tsconfig.json +11 -11
- package/components/grid/cell/wildcardQuickFilter.d.ts +0 -11
- package/components/grid/cell/wildcardQuickFilter.js +0 -61
- package/components/grid/cell/wildcardQuickFilter.js.map +0 -1
- package/components/table/dataTable.d.ts +0 -17
- package/components/table/dataTable.js +0 -79
- package/components/table/dataTable.js.map +0 -1
- package/style/antd/antd-tree-showline.css +0 -25
- package/style/antd/full-height-tabs.scss +0 -63
- package/style/draftail/draftail-editor.css +0 -179
- package/style/table/dragSortingTable.css +0 -7
|
@@ -1,519 +1,527 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export class RangeSelector {
|
|
3
|
-
constructor(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
10
|
-
this.columnModel =
|
|
11
|
-
this.
|
|
12
|
-
this.cellNavigationService =
|
|
13
|
-
this.pinnedRowModel =
|
|
14
|
-
this.rowPositionUtils =
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.eventService.addEventListener(
|
|
30
|
-
this.eventService.addEventListener(
|
|
31
|
-
this.eventService.addEventListener(
|
|
32
|
-
this.
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
cellPositionEquals(cellA, cellB) {
|
|
60
|
-
const colsMatch = cellA.column === cellB.column;
|
|
61
|
-
const floatingMatch = cellA.rowPinned === cellB.rowPinned;
|
|
62
|
-
const indexMatch = cellA.rowIndex === cellB.rowIndex;
|
|
63
|
-
return colsMatch && floatingMatch && indexMatch;
|
|
64
|
-
}
|
|
65
|
-
onColumnVisibleChange() {
|
|
66
|
-
this.refreshLastRangeStart();
|
|
67
|
-
this.cellRanges.forEach(cellRange => {
|
|
68
|
-
const beforeCols = cellRange.columns;
|
|
69
|
-
cellRange.columns = cellRange.columns.filter(col => col.isVisible());
|
|
70
|
-
const colsInRangeChanged = !
|
|
71
|
-
if (colsInRangeChanged) {
|
|
72
|
-
this.dispatchChangedEvent(false, true, cellRange.id);
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
refreshLastRangeStart() {
|
|
77
|
-
const lastRange =
|
|
78
|
-
if (!lastRange) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
this.refreshRangeStart(lastRange);
|
|
82
|
-
}
|
|
83
|
-
isContiguousRange(cellRange) {
|
|
84
|
-
const rangeColumns = cellRange.columns;
|
|
85
|
-
if (!rangeColumns.length) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
const allColumns = this.
|
|
89
|
-
const allPositions = rangeColumns.map(c => allColumns.indexOf(c)).sort((a, b) => a - b);
|
|
90
|
-
return
|
|
91
|
-
}
|
|
92
|
-
getRangeStartRow(cellRange) {
|
|
93
|
-
if (cellRange.startRow && cellRange.endRow) {
|
|
94
|
-
return this.rowPositionUtils.before(cellRange.startRow, cellRange.endRow) ?
|
|
95
|
-
cellRange.startRow : cellRange.endRow;
|
|
96
|
-
}
|
|
97
|
-
const rowPinned = this.pinnedRowModel.getPinnedTopRowCount() > 0 ?
|
|
98
|
-
return { rowIndex: 0, rowPinned };
|
|
99
|
-
}
|
|
100
|
-
getRangeEndRow(cellRange) {
|
|
101
|
-
if (cellRange.startRow && cellRange.endRow) {
|
|
102
|
-
return this.rowPositionUtils.before(cellRange.startRow, cellRange.endRow) ?
|
|
103
|
-
cellRange.endRow : cellRange.startRow;
|
|
104
|
-
}
|
|
105
|
-
const pinnedBottomRowCount = this.pinnedRowModel.getPinnedBottomRowCount();
|
|
106
|
-
const pinnedBottom = pinnedBottomRowCount > 0;
|
|
107
|
-
if (pinnedBottom) {
|
|
108
|
-
return {
|
|
109
|
-
rowIndex: pinnedBottomRowCount - 1,
|
|
110
|
-
rowPinned:
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
rowIndex: this.rowModel.getRowCount() - 1,
|
|
115
|
-
rowPinned: null
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
setRangeToCell(cell, appendRange = false) {
|
|
119
|
-
const columns = this.calculateColumnsBetween(cell.column, cell.column);
|
|
120
|
-
if (!columns) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
this.removeAllCellRanges(true);
|
|
124
|
-
const rowForCell = {
|
|
125
|
-
rowIndex: cell.rowIndex,
|
|
126
|
-
rowPinned: cell.rowPinned
|
|
127
|
-
};
|
|
128
|
-
let cellRange;
|
|
129
|
-
for (let i = 0; i < this.cellRanges.length; i++) {
|
|
130
|
-
const range = this.cellRanges[i];
|
|
131
|
-
const matches = (range.columns && range.columns.length === 1 && range.columns[0] === cell.column) &&
|
|
132
|
-
this.rowPositionUtils.sameRow(rowForCell, range.startRow) &&
|
|
133
|
-
this.rowPositionUtils.sameRow(rowForCell, range.endRow);
|
|
134
|
-
if (matches) {
|
|
135
|
-
cellRange = range;
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
if (cellRange) {
|
|
140
|
-
const atEndOfList =
|
|
141
|
-
if (!atEndOfList) {
|
|
142
|
-
|
|
143
|
-
this.cellRanges.push(cellRange);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
cellRange = {
|
|
148
|
-
startRow: rowForCell,
|
|
149
|
-
endRow: rowForCell,
|
|
150
|
-
columns: columns,
|
|
151
|
-
startColumn: cell.column
|
|
152
|
-
};
|
|
153
|
-
this.cellRanges.push(
|
|
154
|
-
}
|
|
155
|
-
this.newestRangeStartCell = cell;
|
|
156
|
-
this.onDragStop();
|
|
157
|
-
this.dispatchChangedEvent(true, true, cellRange.id);
|
|
158
|
-
}
|
|
159
|
-
extendLatestRangeToCell(cellPosition) {
|
|
160
|
-
if (this.isEmpty() || !this.newestRangeStartCell) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const cellRange =
|
|
164
|
-
this.updateRangeEnd(cellRange, cellPosition);
|
|
165
|
-
}
|
|
166
|
-
updateRangeEnd(cellRange, cellPosition, silent) {
|
|
167
|
-
silent = !!silent;
|
|
168
|
-
const endColumn = cellPosition.column;
|
|
169
|
-
const colsToAdd = this.calculateColumnsBetween(cellRange.startColumn, endColumn);
|
|
170
|
-
if (!colsToAdd || this.isLastCellOfRange(cellRange, cellPosition)) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
cellRange.columns = colsToAdd;
|
|
174
|
-
cellRange.endRow = { rowIndex: cellPosition.rowIndex, rowPinned: cellPosition.rowPinned };
|
|
175
|
-
if (!silent) {
|
|
176
|
-
this.dispatchChangedEvent(true, true, cellRange.id);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
refreshRangeStart(cellRange) {
|
|
180
|
-
const { startColumn, columns } = cellRange;
|
|
181
|
-
const moveColInCellRange = (colToMove, moveToFront) => {
|
|
182
|
-
const otherCols = cellRange.columns.filter(col => col !== colToMove);
|
|
183
|
-
if (colToMove) {
|
|
184
|
-
cellRange.startColumn = colToMove;
|
|
185
|
-
cellRange.columns = moveToFront ? [colToMove, ...otherCols] : [...otherCols, colToMove];
|
|
186
|
-
}
|
|
187
|
-
else {
|
|
188
|
-
cellRange.columns = otherCols;
|
|
189
|
-
}
|
|
190
|
-
};
|
|
191
|
-
const { left, right } = this.getRangeEdgeColumns(cellRange);
|
|
192
|
-
const shouldMoveLeftCol = startColumn === columns[0] && startColumn !== left;
|
|
193
|
-
if (shouldMoveLeftCol) {
|
|
194
|
-
moveColInCellRange(left, true);
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
const shouldMoveRightCol = startColumn ===
|
|
198
|
-
if (shouldMoveRightCol) {
|
|
199
|
-
moveColInCellRange(right, false);
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
getRangeEdgeColumns(cellRange) {
|
|
204
|
-
const allColumns = this.
|
|
205
|
-
const allIndices = cellRange.columns
|
|
206
|
-
.map(c => allColumns.indexOf(c))
|
|
207
|
-
.filter(i => i > -1)
|
|
208
|
-
.sort((a, b) => a - b);
|
|
209
|
-
return {
|
|
210
|
-
left: allColumns[allIndices[0]],
|
|
211
|
-
right: allColumns[
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
extendLatestRangeInDirection(key) {
|
|
215
|
-
if (this.isEmpty() || !this.newestRangeStartCell) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
const lastRange =
|
|
219
|
-
const startCell = this.newestRangeStartCell;
|
|
220
|
-
const firstCol = lastRange.columns[0];
|
|
221
|
-
const lastCol =
|
|
222
|
-
const endCellIndex = lastRange.endRow.rowIndex;
|
|
223
|
-
const endCellFloating = lastRange.endRow.rowPinned;
|
|
224
|
-
const endCellColumn = startCell.column === firstCol ? lastCol : firstCol;
|
|
225
|
-
const endCell = { column: endCellColumn, rowIndex: endCellIndex, rowPinned: endCellFloating };
|
|
226
|
-
const newEndCell = this.cellNavigationService.getNextCellToFocus(key, endCell);
|
|
227
|
-
if (!newEndCell) {
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
this.setCellRange({
|
|
231
|
-
rowStartIndex: startCell.rowIndex,
|
|
232
|
-
rowStartPinned: startCell.rowPinned,
|
|
233
|
-
rowEndIndex: newEndCell.rowIndex,
|
|
234
|
-
rowEndPinned: newEndCell.rowPinned,
|
|
235
|
-
columnStart: startCell.column,
|
|
236
|
-
columnEnd: newEndCell.column
|
|
237
|
-
});
|
|
238
|
-
return newEndCell;
|
|
239
|
-
}
|
|
240
|
-
setCellRange(params) {
|
|
241
|
-
this.removeAllCellRanges(true);
|
|
242
|
-
this.addCellRange(params);
|
|
243
|
-
}
|
|
244
|
-
setCellRanges(cellRanges) {
|
|
245
|
-
if (
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
this.removeAllCellRanges(true);
|
|
249
|
-
cellRanges.forEach(newRange => {
|
|
250
|
-
if (newRange.columns && newRange.startRow) {
|
|
251
|
-
this.newestRangeStartCell = {
|
|
252
|
-
rowIndex: newRange.startRow.rowIndex,
|
|
253
|
-
rowPinned: newRange.startRow.rowPinned,
|
|
254
|
-
column: newRange.columns[0]
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
this.cellRanges.push(newRange);
|
|
258
|
-
});
|
|
259
|
-
this.dispatchChangedEvent(false, true);
|
|
260
|
-
}
|
|
261
|
-
createCellRangeFromCellRangeParams(params) {
|
|
262
|
-
let columns;
|
|
263
|
-
if (params.columns) {
|
|
264
|
-
columns = params.columns.map(c => this.columnModel.getColumnWithValidation(c)).filter(c => c);
|
|
265
|
-
}
|
|
266
|
-
else {
|
|
267
|
-
const columnStart = this.columnModel.getColumnWithValidation(params.columnStart);
|
|
268
|
-
const columnEnd = this.columnModel.getColumnWithValidation(params.columnEnd);
|
|
269
|
-
if (!columnStart || !columnEnd) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
columns = this.calculateColumnsBetween(columnStart, columnEnd);
|
|
273
|
-
}
|
|
274
|
-
if (!columns) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
const startRow = params.rowStartIndex != null ? {
|
|
278
|
-
rowIndex: params.rowStartIndex,
|
|
279
|
-
rowPinned: params.rowStartPinned
|
|
280
|
-
} : undefined;
|
|
281
|
-
const endRow = params.rowEndIndex != null ? {
|
|
282
|
-
rowIndex: params.rowEndIndex,
|
|
283
|
-
rowPinned: params.rowEndPinned
|
|
284
|
-
} : undefined;
|
|
285
|
-
return {
|
|
286
|
-
startRow: startRow,
|
|
287
|
-
endRow: endRow,
|
|
288
|
-
columns: columns,
|
|
289
|
-
startColumn: columns[0]
|
|
290
|
-
};
|
|
291
|
-
}
|
|
292
|
-
addCellRange(params) {
|
|
293
|
-
const newRange = this.createCellRangeFromCellRangeParams(params);
|
|
294
|
-
if (newRange) {
|
|
295
|
-
this.cellRanges.push(newRange);
|
|
296
|
-
this.dispatchChangedEvent(false, true, newRange.id);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
getCellRanges() {
|
|
300
|
-
return this.cellRanges;
|
|
301
|
-
}
|
|
302
|
-
isEmpty() {
|
|
303
|
-
return this.cellRanges.length === 0;
|
|
304
|
-
}
|
|
305
|
-
isMoreThanOneCell() {
|
|
306
|
-
if (this.cellRanges.length === 0) {
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
else if (this.cellRanges.length > 1) {
|
|
310
|
-
return true;
|
|
311
|
-
}
|
|
312
|
-
const range = this.cellRanges[0];
|
|
313
|
-
const startRow = this.getRangeStartRow(range);
|
|
314
|
-
const endRow = this.getRangeEndRow(range);
|
|
315
|
-
return startRow.rowPinned !== endRow.rowPinned ||
|
|
316
|
-
startRow.rowIndex !== endRow.rowIndex ||
|
|
317
|
-
range.columns.length !== 1;
|
|
318
|
-
}
|
|
319
|
-
removeAllCellRanges(silent) {
|
|
320
|
-
if (this.isEmpty()) {
|
|
321
|
-
return;
|
|
322
|
-
}
|
|
323
|
-
this.onDragStop();
|
|
324
|
-
this.cellRanges.length = 0;
|
|
325
|
-
if (!silent) {
|
|
326
|
-
this.dispatchChangedEvent(false, true);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
onBodyScroll() {
|
|
330
|
-
this.onDragging(this.lastMouseEvent);
|
|
331
|
-
}
|
|
332
|
-
isCellInAnyRange(cell) {
|
|
333
|
-
return this.getCellRangeCount(cell) > 0;
|
|
334
|
-
}
|
|
335
|
-
isCellInSpecificRange(cell, range) {
|
|
336
|
-
const columnInRange = range.columns !== null &&
|
|
337
|
-
const rowInRange = this.isRowInRange(cell.rowIndex, cell.rowPinned, range);
|
|
338
|
-
return columnInRange && rowInRange;
|
|
339
|
-
}
|
|
340
|
-
isLastCellOfRange(cellRange, cell) {
|
|
341
|
-
const { startRow, endRow } = cellRange;
|
|
342
|
-
const lastRow = this.rowPositionUtils.before(startRow, endRow) ? endRow : startRow;
|
|
343
|
-
const isLastRow = cell.rowIndex === lastRow.rowIndex && cell.rowPinned === lastRow.rowPinned;
|
|
344
|
-
const rangeFirstIndexColumn = cellRange.columns[0];
|
|
345
|
-
const rangeLastIndexColumn =
|
|
346
|
-
const lastRangeColumn = cellRange.startColumn === rangeFirstIndexColumn ? rangeLastIndexColumn : rangeFirstIndexColumn;
|
|
347
|
-
const isLastColumn = cell.column === lastRangeColumn;
|
|
348
|
-
return isLastColumn && isLastRow;
|
|
349
|
-
}
|
|
350
|
-
isBottomRightCell(cellRange, cell) {
|
|
351
|
-
const allColumns = this.
|
|
352
|
-
const allPositions = cellRange.columns.map(c => allColumns.indexOf(c)).sort((a, b) => a - b);
|
|
353
|
-
const { startRow, endRow } = cellRange;
|
|
354
|
-
const lastRow = this.rowPositionUtils.before(startRow, endRow) ? endRow : startRow;
|
|
355
|
-
const isRightColumn = allColumns.indexOf(cell.column) ===
|
|
356
|
-
const isLastRow = cell.rowIndex === lastRow.rowIndex &&
|
|
357
|
-
return isRightColumn && isLastRow;
|
|
358
|
-
}
|
|
359
|
-
getCellRangeCount(cell) {
|
|
360
|
-
if (this.isEmpty()) {
|
|
361
|
-
return 0;
|
|
362
|
-
}
|
|
363
|
-
return this.cellRanges.filter(cellRange => this.isCellInSpecificRange(cell, cellRange)).length;
|
|
364
|
-
}
|
|
365
|
-
isRowInRange(rowIndex, floating, cellRange) {
|
|
366
|
-
const firstRow = this.getRangeStartRow(cellRange);
|
|
367
|
-
const lastRow = this.getRangeEndRow(cellRange);
|
|
368
|
-
const thisRow = { rowIndex: rowIndex, rowPinned: floating };
|
|
369
|
-
const equalsFirstRow = thisRow.rowIndex === firstRow.rowIndex && thisRow.rowPinned == firstRow.rowPinned;
|
|
370
|
-
const equalsLastRow = thisRow.rowIndex === lastRow.rowIndex && thisRow.rowPinned == lastRow.rowPinned;
|
|
371
|
-
if (equalsFirstRow || equalsLastRow) {
|
|
372
|
-
return true;
|
|
373
|
-
}
|
|
374
|
-
const afterFirstRow = !this.rowPositionUtils.before(thisRow, firstRow);
|
|
375
|
-
const beforeLastRow = this.rowPositionUtils.before(thisRow, lastRow);
|
|
376
|
-
return afterFirstRow && beforeLastRow;
|
|
377
|
-
}
|
|
378
|
-
getDraggingRange() {
|
|
379
|
-
return this.draggingRange;
|
|
380
|
-
}
|
|
381
|
-
onDragStart(mouseEvent) {
|
|
382
|
-
const { shiftKey } = mouseEvent;
|
|
383
|
-
const mouseCell = this.mouseEventService.getCellPositionForEvent(mouseEvent);
|
|
384
|
-
if (
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
if (!shiftKey ||
|
|
388
|
-
this.removeAllCellRanges(true);
|
|
389
|
-
}
|
|
390
|
-
this.dragging = true;
|
|
391
|
-
this.draggingCell = mouseCell;
|
|
392
|
-
this.lastMouseEvent = mouseEvent;
|
|
393
|
-
if (!shiftKey) {
|
|
394
|
-
this.newestRangeStartCell = mouseCell;
|
|
395
|
-
}
|
|
396
|
-
if (this.cellRanges.length > 0) {
|
|
397
|
-
this.draggingRange =
|
|
398
|
-
}
|
|
399
|
-
else {
|
|
400
|
-
const mouseRowPosition = {
|
|
401
|
-
rowIndex: mouseCell.rowIndex,
|
|
402
|
-
rowPinned: mouseCell.rowPinned
|
|
403
|
-
};
|
|
404
|
-
this.draggingRange = {
|
|
405
|
-
startRow: mouseRowPosition,
|
|
406
|
-
endRow: mouseRowPosition,
|
|
407
|
-
columns: [mouseCell.column],
|
|
408
|
-
startColumn: this.newestRangeStartCell.column
|
|
409
|
-
};
|
|
410
|
-
this.cellRanges.push(this.draggingRange);
|
|
411
|
-
}
|
|
412
|
-
this.ctrlsService.getGridBodyCtrl().addScrollEventListener(this.bodyScrollListener);
|
|
413
|
-
this.dispatchChangedEvent(true, false, this.draggingRange.id);
|
|
414
|
-
}
|
|
415
|
-
onDragging(mouseEvent) {
|
|
416
|
-
if (!this.dragging || !mouseEvent) {
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
this.lastMouseEvent = mouseEvent;
|
|
420
|
-
const cellPosition = this.mouseEventService.getCellPositionForEvent(mouseEvent);
|
|
421
|
-
const isMouseAndStartInPinned = (position) => cellPosition && cellPosition.rowPinned === position && this.newestRangeStartCell.rowPinned === position;
|
|
422
|
-
const skipVerticalScroll = isMouseAndStartInPinned('top') || isMouseAndStartInPinned('bottom');
|
|
423
|
-
this.autoScrollService.check(mouseEvent, skipVerticalScroll);
|
|
424
|
-
if (!cellPosition ||
|
|
425
|
-
!this.draggingCell ||
|
|
426
|
-
this.cellPositionEquals(this.draggingCell, cellPosition)) {
|
|
427
|
-
return;
|
|
428
|
-
}
|
|
429
|
-
const columns = this.calculateColumnsBetween(this.newestRangeStartCell.column, cellPosition.column);
|
|
430
|
-
if (!columns) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
this.draggingCell = cellPosition;
|
|
434
|
-
this.draggingRange.endRow = {
|
|
435
|
-
rowIndex: cellPosition.rowIndex,
|
|
436
|
-
rowPinned: cellPosition.rowPinned
|
|
437
|
-
};
|
|
438
|
-
this.draggingRange.columns = columns;
|
|
439
|
-
this.dispatchChangedEvent(false, false, this.draggingRange.id);
|
|
440
|
-
this.focusCell(cellPosition);
|
|
441
|
-
}
|
|
442
|
-
focusCell(cellPosition) {
|
|
443
|
-
const cellFocused = this.focusService.isCellFocused(cellPosition);
|
|
444
|
-
if (!cellFocused) {
|
|
445
|
-
this.focusService.setFocusedCell(cellPosition.rowIndex, cellPosition.column, cellPosition.rowPinned, true);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
onDragStop() {
|
|
449
|
-
if (!this.dragging) {
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
const { id } = this.draggingRange;
|
|
453
|
-
this.autoScrollService.ensureCleared();
|
|
454
|
-
this.ctrlsService.getGridBodyCtrl().removeScrollEventListener(this.bodyScrollListener);
|
|
455
|
-
this.lastMouseEvent = null;
|
|
456
|
-
this.dragging = false;
|
|
457
|
-
this.draggingRange = undefined;
|
|
458
|
-
this.draggingCell = undefined;
|
|
459
|
-
this.dispatchChangedEvent(false, true, id);
|
|
460
|
-
}
|
|
461
|
-
dispatchChangedEvent(started, finished, id) {
|
|
462
|
-
this.cellRanges.map((cellRange) => {
|
|
463
|
-
let currentRow = this.getRangeStartRow(cellRange);
|
|
464
|
-
const lastRow = this.getRangeEndRow(cellRange);
|
|
465
|
-
const nodesToBeSelected = [];
|
|
466
|
-
while (true) {
|
|
467
|
-
const finishedAllRows =
|
|
468
|
-
if (finishedAllRows || !currentRow || !cellRange.columns) {
|
|
469
|
-
break;
|
|
470
|
-
}
|
|
471
|
-
const rowNode = this.
|
|
472
|
-
if (!rowNode
|
|
473
|
-
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
return
|
|
509
|
-
}
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
1
|
+
import { _areEqual, _exists, _includes, _isDomLayout, _last, _makeNull, _missing, _removeFromArray, _shallowCompare, AutoScrollService, BeanStub } from "ag-grid-community";
|
|
2
|
+
export class RangeSelector extends BeanStub {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.beanName = "RangeSelector";
|
|
6
|
+
}
|
|
7
|
+
wireBeans(beans) {
|
|
8
|
+
this.rowModel = beans.rowModel;
|
|
9
|
+
this.dragService = beans.dragService;
|
|
10
|
+
this.columnModel = beans.columnModel;
|
|
11
|
+
this.visibleColsService = beans.visibleColsService;
|
|
12
|
+
this.cellNavigationService = beans.cellNavigationService;
|
|
13
|
+
this.pinnedRowModel = beans.pinnedRowModel;
|
|
14
|
+
this.rowPositionUtils = beans.rowPositionUtils;
|
|
15
|
+
this.cellPositionUtils = beans.cellPositionUtils;
|
|
16
|
+
this.ctrlsService = beans.ctrlsService;
|
|
17
|
+
this.valueService = beans.valueService;
|
|
18
|
+
this.eventService = beans.eventService;
|
|
19
|
+
this.mouseEventService = beans.mouseEventService;
|
|
20
|
+
this.gridApi = beans.gridApi;
|
|
21
|
+
this.eGridDiv = beans.eGridDiv;
|
|
22
|
+
this.focusService = beans.focusService;
|
|
23
|
+
this.gos = beans.gos;
|
|
24
|
+
}
|
|
25
|
+
postConstruct() {
|
|
26
|
+
this.cellRanges = [];
|
|
27
|
+
this.bodyScrollListener = this.onBodyScroll.bind(this);
|
|
28
|
+
this.dragging = false;
|
|
29
|
+
this.eventService.addEventListener("newColumnsLoaded", () => this.removeAllCellRanges());
|
|
30
|
+
this.eventService.addEventListener("columnPivotModeChanged", () => this.removeAllCellRanges());
|
|
31
|
+
this.eventService.addEventListener("columnRowGroupChanged", () => this.removeAllCellRanges());
|
|
32
|
+
this.eventService.addEventListener("columnPivotChanged", () => this.removeAllCellRanges());
|
|
33
|
+
this.eventService.addEventListener("columnGroupOpened", this.refreshLastRangeStart.bind(this));
|
|
34
|
+
this.eventService.addEventListener("columnMoved", this.refreshLastRangeStart.bind(this));
|
|
35
|
+
this.eventService.addEventListener("columnPinned", this.refreshLastRangeStart.bind(this));
|
|
36
|
+
this.eventService.addEventListener("columnVisible", this.onColumnVisibleChange.bind(this));
|
|
37
|
+
this.ctrlsService.whenReady(this, () => {
|
|
38
|
+
const gridBodyCon = this.ctrlsService.getGridBodyCtrl();
|
|
39
|
+
this.autoScrollService = new AutoScrollService({
|
|
40
|
+
scrollContainer: gridBodyCon.getBodyViewportElement(),
|
|
41
|
+
scrollAxis: 'xy',
|
|
42
|
+
getVerticalPosition: () => gridBodyCon.getScrollFeature().getVScrollPosition().top,
|
|
43
|
+
setVerticalPosition: (position) => gridBodyCon.getScrollFeature().setVerticalScrollPosition(position),
|
|
44
|
+
getHorizontalPosition: () => gridBodyCon.getScrollFeature().getHScrollPosition().left,
|
|
45
|
+
setHorizontalPosition: (position) => gridBodyCon.getScrollFeature().setHorizontalScrollPosition(position),
|
|
46
|
+
shouldSkipVerticalScroll: () => !_isDomLayout(this.gos, 'normal'),
|
|
47
|
+
shouldSkipHorizontalScroll: () => !gridBodyCon.getScrollFeature().isHorizontalScrollShowing()
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
const params = {
|
|
51
|
+
eElement: this.eGridDiv,
|
|
52
|
+
onDragStart: this.onDragStart.bind(this),
|
|
53
|
+
onDragStop: this.onDragStop.bind(this),
|
|
54
|
+
onDragging: this.onDragging.bind(this)
|
|
55
|
+
};
|
|
56
|
+
this.dragService.addDragSource(params);
|
|
57
|
+
this.dragService.addDestroyFunc(() => this.dragService.removeDragSource(params));
|
|
58
|
+
}
|
|
59
|
+
cellPositionEquals(cellA, cellB) {
|
|
60
|
+
const colsMatch = cellA.column === cellB.column;
|
|
61
|
+
const floatingMatch = cellA.rowPinned === cellB.rowPinned;
|
|
62
|
+
const indexMatch = cellA.rowIndex === cellB.rowIndex;
|
|
63
|
+
return colsMatch && floatingMatch && indexMatch;
|
|
64
|
+
}
|
|
65
|
+
onColumnVisibleChange() {
|
|
66
|
+
this.refreshLastRangeStart();
|
|
67
|
+
this.cellRanges.forEach(cellRange => {
|
|
68
|
+
const beforeCols = cellRange.columns;
|
|
69
|
+
cellRange.columns = cellRange.columns.filter(col => col.isVisible());
|
|
70
|
+
const colsInRangeChanged = !_areEqual(beforeCols, cellRange.columns);
|
|
71
|
+
if (colsInRangeChanged) {
|
|
72
|
+
this.dispatchChangedEvent(false, true, cellRange.id);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
refreshLastRangeStart() {
|
|
77
|
+
const lastRange = _last(this.cellRanges);
|
|
78
|
+
if (!lastRange) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this.refreshRangeStart(lastRange);
|
|
82
|
+
}
|
|
83
|
+
isContiguousRange(cellRange) {
|
|
84
|
+
const rangeColumns = cellRange.columns;
|
|
85
|
+
if (!rangeColumns.length) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
const allColumns = this.visibleColsService.getAllCols();
|
|
89
|
+
const allPositions = rangeColumns.map(c => allColumns.indexOf(c)).sort((a, b) => a - b);
|
|
90
|
+
return _last(allPositions) - allPositions[0] + 1 === rangeColumns.length;
|
|
91
|
+
}
|
|
92
|
+
getRangeStartRow(cellRange) {
|
|
93
|
+
if (cellRange.startRow && cellRange.endRow) {
|
|
94
|
+
return this.rowPositionUtils.before(cellRange.startRow, cellRange.endRow) ?
|
|
95
|
+
cellRange.startRow : cellRange.endRow;
|
|
96
|
+
}
|
|
97
|
+
const rowPinned = this.pinnedRowModel.getPinnedTopRowCount() > 0 ? 'top' : null;
|
|
98
|
+
return { rowIndex: 0, rowPinned };
|
|
99
|
+
}
|
|
100
|
+
getRangeEndRow(cellRange) {
|
|
101
|
+
if (cellRange.startRow && cellRange.endRow) {
|
|
102
|
+
return this.rowPositionUtils.before(cellRange.startRow, cellRange.endRow) ?
|
|
103
|
+
cellRange.endRow : cellRange.startRow;
|
|
104
|
+
}
|
|
105
|
+
const pinnedBottomRowCount = this.pinnedRowModel.getPinnedBottomRowCount();
|
|
106
|
+
const pinnedBottom = pinnedBottomRowCount > 0;
|
|
107
|
+
if (pinnedBottom) {
|
|
108
|
+
return {
|
|
109
|
+
rowIndex: pinnedBottomRowCount - 1,
|
|
110
|
+
rowPinned: 'bottom'
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
rowIndex: this.rowModel.getRowCount() - 1,
|
|
115
|
+
rowPinned: null
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
setRangeToCell(cell, appendRange = false) {
|
|
119
|
+
const columns = this.calculateColumnsBetween(cell.column, cell.column);
|
|
120
|
+
if (!columns) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
this.removeAllCellRanges(true);
|
|
124
|
+
const rowForCell = {
|
|
125
|
+
rowIndex: cell.rowIndex,
|
|
126
|
+
rowPinned: cell.rowPinned
|
|
127
|
+
};
|
|
128
|
+
let cellRange;
|
|
129
|
+
for (let i = 0; i < this.cellRanges.length; i++) {
|
|
130
|
+
const range = this.cellRanges[i];
|
|
131
|
+
const matches = (range.columns && range.columns.length === 1 && range.columns[0] === cell.column) &&
|
|
132
|
+
this.rowPositionUtils.sameRow(rowForCell, range.startRow) &&
|
|
133
|
+
this.rowPositionUtils.sameRow(rowForCell, range.endRow);
|
|
134
|
+
if (matches) {
|
|
135
|
+
cellRange = range;
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
if (cellRange) {
|
|
140
|
+
const atEndOfList = _last(this.cellRanges) === cellRange;
|
|
141
|
+
if (!atEndOfList) {
|
|
142
|
+
_removeFromArray(this.cellRanges, cellRange);
|
|
143
|
+
this.cellRanges.push(cellRange);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
cellRange = {
|
|
148
|
+
startRow: rowForCell,
|
|
149
|
+
endRow: rowForCell,
|
|
150
|
+
columns: columns,
|
|
151
|
+
startColumn: cell.column
|
|
152
|
+
};
|
|
153
|
+
this.cellRanges.push(cellRange);
|
|
154
|
+
}
|
|
155
|
+
this.newestRangeStartCell = cell;
|
|
156
|
+
this.onDragStop();
|
|
157
|
+
this.dispatchChangedEvent(true, true, cellRange.id);
|
|
158
|
+
}
|
|
159
|
+
extendLatestRangeToCell(cellPosition) {
|
|
160
|
+
if (this.isEmpty() || !this.newestRangeStartCell) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const cellRange = _last(this.cellRanges);
|
|
164
|
+
this.updateRangeEnd(cellRange, cellPosition);
|
|
165
|
+
}
|
|
166
|
+
updateRangeEnd(cellRange, cellPosition, silent) {
|
|
167
|
+
silent = !!silent;
|
|
168
|
+
const endColumn = cellPosition.column;
|
|
169
|
+
const colsToAdd = this.calculateColumnsBetween(cellRange.startColumn, endColumn);
|
|
170
|
+
if (!colsToAdd || this.isLastCellOfRange(cellRange, cellPosition)) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
cellRange.columns = colsToAdd;
|
|
174
|
+
cellRange.endRow = { rowIndex: cellPosition.rowIndex, rowPinned: cellPosition.rowPinned };
|
|
175
|
+
if (!silent) {
|
|
176
|
+
this.dispatchChangedEvent(true, true, cellRange.id);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
refreshRangeStart(cellRange) {
|
|
180
|
+
const { startColumn, columns } = cellRange;
|
|
181
|
+
const moveColInCellRange = (colToMove, moveToFront) => {
|
|
182
|
+
const otherCols = cellRange.columns.filter(col => col !== colToMove);
|
|
183
|
+
if (colToMove) {
|
|
184
|
+
cellRange.startColumn = colToMove;
|
|
185
|
+
cellRange.columns = moveToFront ? [colToMove, ...otherCols] : [...otherCols, colToMove];
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
cellRange.columns = otherCols;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const { left, right } = this.getRangeEdgeColumns(cellRange);
|
|
192
|
+
const shouldMoveLeftCol = startColumn === columns[0] && startColumn !== left;
|
|
193
|
+
if (shouldMoveLeftCol) {
|
|
194
|
+
moveColInCellRange(left, true);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
const shouldMoveRightCol = startColumn === _last(columns) && startColumn === right;
|
|
198
|
+
if (shouldMoveRightCol) {
|
|
199
|
+
moveColInCellRange(right, false);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
getRangeEdgeColumns(cellRange) {
|
|
204
|
+
const allColumns = this.visibleColsService.getAllCols();
|
|
205
|
+
const allIndices = cellRange.columns
|
|
206
|
+
.map(c => allColumns.indexOf(c))
|
|
207
|
+
.filter(i => i > -1)
|
|
208
|
+
.sort((a, b) => a - b);
|
|
209
|
+
return {
|
|
210
|
+
left: allColumns[allIndices[0]],
|
|
211
|
+
right: allColumns[_last(allIndices)]
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
extendLatestRangeInDirection(key) {
|
|
215
|
+
if (this.isEmpty() || !this.newestRangeStartCell) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
const lastRange = _last(this.cellRanges);
|
|
219
|
+
const startCell = this.newestRangeStartCell;
|
|
220
|
+
const firstCol = lastRange.columns[0];
|
|
221
|
+
const lastCol = _last(lastRange.columns);
|
|
222
|
+
const endCellIndex = lastRange.endRow.rowIndex;
|
|
223
|
+
const endCellFloating = lastRange.endRow.rowPinned;
|
|
224
|
+
const endCellColumn = startCell.column === firstCol ? lastCol : firstCol;
|
|
225
|
+
const endCell = { column: endCellColumn, rowIndex: endCellIndex, rowPinned: endCellFloating };
|
|
226
|
+
const newEndCell = this.cellNavigationService.getNextCellToFocus(key, endCell);
|
|
227
|
+
if (!newEndCell) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
this.setCellRange({
|
|
231
|
+
rowStartIndex: startCell.rowIndex,
|
|
232
|
+
rowStartPinned: startCell.rowPinned,
|
|
233
|
+
rowEndIndex: newEndCell.rowIndex,
|
|
234
|
+
rowEndPinned: newEndCell.rowPinned,
|
|
235
|
+
columnStart: startCell.column,
|
|
236
|
+
columnEnd: newEndCell.column
|
|
237
|
+
});
|
|
238
|
+
return newEndCell;
|
|
239
|
+
}
|
|
240
|
+
setCellRange(params) {
|
|
241
|
+
this.removeAllCellRanges(true);
|
|
242
|
+
this.addCellRange(params);
|
|
243
|
+
}
|
|
244
|
+
setCellRanges(cellRanges) {
|
|
245
|
+
if (_shallowCompare(this.cellRanges, cellRanges)) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
this.removeAllCellRanges(true);
|
|
249
|
+
cellRanges.forEach(newRange => {
|
|
250
|
+
if (newRange.columns && newRange.startRow) {
|
|
251
|
+
this.newestRangeStartCell = {
|
|
252
|
+
rowIndex: newRange.startRow.rowIndex,
|
|
253
|
+
rowPinned: newRange.startRow.rowPinned,
|
|
254
|
+
column: newRange.columns[0]
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
this.cellRanges.push(newRange);
|
|
258
|
+
});
|
|
259
|
+
this.dispatchChangedEvent(false, true);
|
|
260
|
+
}
|
|
261
|
+
createCellRangeFromCellRangeParams(params) {
|
|
262
|
+
let columns;
|
|
263
|
+
if (params.columns) {
|
|
264
|
+
columns = params.columns.map(c => this.columnModel.getColumnWithValidation(c)).filter(c => c);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
const columnStart = this.columnModel.getColumnWithValidation(params.columnStart);
|
|
268
|
+
const columnEnd = this.columnModel.getColumnWithValidation(params.columnEnd);
|
|
269
|
+
if (!columnStart || !columnEnd) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
columns = this.calculateColumnsBetween(columnStart, columnEnd);
|
|
273
|
+
}
|
|
274
|
+
if (!columns) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const startRow = params.rowStartIndex != null ? {
|
|
278
|
+
rowIndex: params.rowStartIndex,
|
|
279
|
+
rowPinned: params.rowStartPinned
|
|
280
|
+
} : undefined;
|
|
281
|
+
const endRow = params.rowEndIndex != null ? {
|
|
282
|
+
rowIndex: params.rowEndIndex,
|
|
283
|
+
rowPinned: params.rowEndPinned
|
|
284
|
+
} : undefined;
|
|
285
|
+
return {
|
|
286
|
+
startRow: startRow,
|
|
287
|
+
endRow: endRow,
|
|
288
|
+
columns: columns,
|
|
289
|
+
startColumn: columns[0]
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
addCellRange(params) {
|
|
293
|
+
const newRange = this.createCellRangeFromCellRangeParams(params);
|
|
294
|
+
if (newRange) {
|
|
295
|
+
this.cellRanges.push(newRange);
|
|
296
|
+
this.dispatchChangedEvent(false, true, newRange.id);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
getCellRanges() {
|
|
300
|
+
return this.cellRanges;
|
|
301
|
+
}
|
|
302
|
+
isEmpty() {
|
|
303
|
+
return this.cellRanges.length === 0;
|
|
304
|
+
}
|
|
305
|
+
isMoreThanOneCell() {
|
|
306
|
+
if (this.cellRanges.length === 0) {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
else if (this.cellRanges.length > 1) {
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
const range = this.cellRanges[0];
|
|
313
|
+
const startRow = this.getRangeStartRow(range);
|
|
314
|
+
const endRow = this.getRangeEndRow(range);
|
|
315
|
+
return startRow.rowPinned !== endRow.rowPinned ||
|
|
316
|
+
startRow.rowIndex !== endRow.rowIndex ||
|
|
317
|
+
range.columns.length !== 1;
|
|
318
|
+
}
|
|
319
|
+
removeAllCellRanges(silent) {
|
|
320
|
+
if (this.isEmpty()) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
this.onDragStop();
|
|
324
|
+
this.cellRanges.length = 0;
|
|
325
|
+
if (!silent) {
|
|
326
|
+
this.dispatchChangedEvent(false, true);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
onBodyScroll() {
|
|
330
|
+
this.onDragging(this.lastMouseEvent);
|
|
331
|
+
}
|
|
332
|
+
isCellInAnyRange(cell) {
|
|
333
|
+
return this.getCellRangeCount(cell) > 0;
|
|
334
|
+
}
|
|
335
|
+
isCellInSpecificRange(cell, range) {
|
|
336
|
+
const columnInRange = range.columns !== null && _includes(range.columns, cell.column);
|
|
337
|
+
const rowInRange = this.isRowInRange(cell.rowIndex, cell.rowPinned, range);
|
|
338
|
+
return columnInRange && rowInRange;
|
|
339
|
+
}
|
|
340
|
+
isLastCellOfRange(cellRange, cell) {
|
|
341
|
+
const { startRow, endRow } = cellRange;
|
|
342
|
+
const lastRow = this.rowPositionUtils.before(startRow, endRow) ? endRow : startRow;
|
|
343
|
+
const isLastRow = cell.rowIndex === lastRow.rowIndex && cell.rowPinned === lastRow.rowPinned;
|
|
344
|
+
const rangeFirstIndexColumn = cellRange.columns[0];
|
|
345
|
+
const rangeLastIndexColumn = _last(cellRange.columns);
|
|
346
|
+
const lastRangeColumn = cellRange.startColumn === rangeFirstIndexColumn ? rangeLastIndexColumn : rangeFirstIndexColumn;
|
|
347
|
+
const isLastColumn = cell.column === lastRangeColumn;
|
|
348
|
+
return isLastColumn && isLastRow;
|
|
349
|
+
}
|
|
350
|
+
isBottomRightCell(cellRange, cell) {
|
|
351
|
+
const allColumns = this.visibleColsService.getAllCols();
|
|
352
|
+
const allPositions = cellRange.columns.map(c => allColumns.indexOf(c)).sort((a, b) => a - b);
|
|
353
|
+
const { startRow, endRow } = cellRange;
|
|
354
|
+
const lastRow = this.rowPositionUtils.before(startRow, endRow) ? endRow : startRow;
|
|
355
|
+
const isRightColumn = allColumns.indexOf(cell.column) === _last(allPositions);
|
|
356
|
+
const isLastRow = cell.rowIndex === lastRow.rowIndex && _makeNull(cell.rowPinned) === _makeNull(lastRow.rowPinned);
|
|
357
|
+
return isRightColumn && isLastRow;
|
|
358
|
+
}
|
|
359
|
+
getCellRangeCount(cell) {
|
|
360
|
+
if (this.isEmpty()) {
|
|
361
|
+
return 0;
|
|
362
|
+
}
|
|
363
|
+
return this.cellRanges.filter(cellRange => this.isCellInSpecificRange(cell, cellRange)).length;
|
|
364
|
+
}
|
|
365
|
+
isRowInRange(rowIndex, floating, cellRange) {
|
|
366
|
+
const firstRow = this.getRangeStartRow(cellRange);
|
|
367
|
+
const lastRow = this.getRangeEndRow(cellRange);
|
|
368
|
+
const thisRow = { rowIndex: rowIndex, rowPinned: floating };
|
|
369
|
+
const equalsFirstRow = thisRow.rowIndex === firstRow.rowIndex && thisRow.rowPinned == firstRow.rowPinned;
|
|
370
|
+
const equalsLastRow = thisRow.rowIndex === lastRow.rowIndex && thisRow.rowPinned == lastRow.rowPinned;
|
|
371
|
+
if (equalsFirstRow || equalsLastRow) {
|
|
372
|
+
return true;
|
|
373
|
+
}
|
|
374
|
+
const afterFirstRow = !this.rowPositionUtils.before(thisRow, firstRow);
|
|
375
|
+
const beforeLastRow = this.rowPositionUtils.before(thisRow, lastRow);
|
|
376
|
+
return afterFirstRow && beforeLastRow;
|
|
377
|
+
}
|
|
378
|
+
getDraggingRange() {
|
|
379
|
+
return this.draggingRange;
|
|
380
|
+
}
|
|
381
|
+
onDragStart(mouseEvent) {
|
|
382
|
+
const { shiftKey } = mouseEvent;
|
|
383
|
+
const mouseCell = this.mouseEventService.getCellPositionForEvent(mouseEvent);
|
|
384
|
+
if (_missing(mouseCell)) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
if (!shiftKey || _exists(_last(this.cellRanges).type)) {
|
|
388
|
+
this.removeAllCellRanges(true);
|
|
389
|
+
}
|
|
390
|
+
this.dragging = true;
|
|
391
|
+
this.draggingCell = mouseCell;
|
|
392
|
+
this.lastMouseEvent = mouseEvent;
|
|
393
|
+
if (!shiftKey) {
|
|
394
|
+
this.newestRangeStartCell = mouseCell;
|
|
395
|
+
}
|
|
396
|
+
if (this.cellRanges.length > 0) {
|
|
397
|
+
this.draggingRange = _last(this.cellRanges);
|
|
398
|
+
}
|
|
399
|
+
else {
|
|
400
|
+
const mouseRowPosition = {
|
|
401
|
+
rowIndex: mouseCell.rowIndex,
|
|
402
|
+
rowPinned: mouseCell.rowPinned
|
|
403
|
+
};
|
|
404
|
+
this.draggingRange = {
|
|
405
|
+
startRow: mouseRowPosition,
|
|
406
|
+
endRow: mouseRowPosition,
|
|
407
|
+
columns: [mouseCell.column],
|
|
408
|
+
startColumn: this.newestRangeStartCell.column
|
|
409
|
+
};
|
|
410
|
+
this.cellRanges.push(this.draggingRange);
|
|
411
|
+
}
|
|
412
|
+
this.ctrlsService.getGridBodyCtrl().addScrollEventListener(this.bodyScrollListener);
|
|
413
|
+
this.dispatchChangedEvent(true, false, this.draggingRange.id);
|
|
414
|
+
}
|
|
415
|
+
onDragging(mouseEvent) {
|
|
416
|
+
if (!this.dragging || !mouseEvent) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
this.lastMouseEvent = mouseEvent;
|
|
420
|
+
const cellPosition = this.mouseEventService.getCellPositionForEvent(mouseEvent);
|
|
421
|
+
const isMouseAndStartInPinned = (position) => cellPosition && cellPosition.rowPinned === position && this.newestRangeStartCell.rowPinned === position;
|
|
422
|
+
const skipVerticalScroll = isMouseAndStartInPinned('top') || isMouseAndStartInPinned('bottom');
|
|
423
|
+
this.autoScrollService.check(mouseEvent, skipVerticalScroll);
|
|
424
|
+
if (!cellPosition ||
|
|
425
|
+
!this.draggingCell ||
|
|
426
|
+
this.cellPositionEquals(this.draggingCell, cellPosition)) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
const columns = this.calculateColumnsBetween(this.newestRangeStartCell.column, cellPosition.column);
|
|
430
|
+
if (!columns) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
this.draggingCell = cellPosition;
|
|
434
|
+
this.draggingRange.endRow = {
|
|
435
|
+
rowIndex: cellPosition.rowIndex,
|
|
436
|
+
rowPinned: cellPosition.rowPinned
|
|
437
|
+
};
|
|
438
|
+
this.draggingRange.columns = columns;
|
|
439
|
+
this.dispatchChangedEvent(false, false, this.draggingRange.id);
|
|
440
|
+
this.focusCell(cellPosition);
|
|
441
|
+
}
|
|
442
|
+
focusCell(cellPosition) {
|
|
443
|
+
const cellFocused = this.focusService.isCellFocused(cellPosition);
|
|
444
|
+
if (!cellFocused) {
|
|
445
|
+
this.focusService.setFocusedCell(cellPosition.rowIndex, cellPosition.column, cellPosition.rowPinned, true);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
onDragStop() {
|
|
449
|
+
if (!this.dragging) {
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const { id } = this.draggingRange;
|
|
453
|
+
this.autoScrollService.ensureCleared();
|
|
454
|
+
this.ctrlsService.getGridBodyCtrl().removeScrollEventListener(this.bodyScrollListener);
|
|
455
|
+
this.lastMouseEvent = null;
|
|
456
|
+
this.dragging = false;
|
|
457
|
+
this.draggingRange = undefined;
|
|
458
|
+
this.draggingCell = undefined;
|
|
459
|
+
this.dispatchChangedEvent(false, true, id);
|
|
460
|
+
}
|
|
461
|
+
dispatchChangedEvent(started, finished, id) {
|
|
462
|
+
this.cellRanges.map((cellRange) => {
|
|
463
|
+
let currentRow = this.getRangeStartRow(cellRange);
|
|
464
|
+
const lastRow = this.getRangeEndRow(cellRange);
|
|
465
|
+
const nodesToBeSelected = [];
|
|
466
|
+
while (true) {
|
|
467
|
+
const finishedAllRows = _missing(currentRow) || !currentRow || this.rowPositionUtils.before(lastRow, currentRow);
|
|
468
|
+
if (finishedAllRows || !currentRow || !cellRange.columns) {
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
const rowNode = this.rowPositionUtils.getRowNode(currentRow);
|
|
472
|
+
if (!rowNode) {
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
if (!rowNode.isSelected()) {
|
|
476
|
+
rowNode.setSelected(true);
|
|
477
|
+
}
|
|
478
|
+
nodesToBeSelected.push(rowNode.data);
|
|
479
|
+
currentRow = this.cellNavigationService.getRowBelow(currentRow);
|
|
480
|
+
}
|
|
481
|
+
this.gridApi.getSelectedNodes().forEach((node) => {
|
|
482
|
+
if (!nodesToBeSelected.some(nodeToBeSelected => node.data === nodeToBeSelected)) {
|
|
483
|
+
node.setSelected(false);
|
|
484
|
+
}
|
|
485
|
+
});
|
|
486
|
+
});
|
|
487
|
+
const eventCellSelection = {
|
|
488
|
+
type: "cellSelectionChanged",
|
|
489
|
+
started: started,
|
|
490
|
+
finished: finished,
|
|
491
|
+
id: id,
|
|
492
|
+
};
|
|
493
|
+
this.eventService.dispatchEvent(eventCellSelection);
|
|
494
|
+
const eventRangeSelection = {
|
|
495
|
+
type: "rangeSelectionChanged",
|
|
496
|
+
started: started,
|
|
497
|
+
finished: finished,
|
|
498
|
+
id: id,
|
|
499
|
+
};
|
|
500
|
+
this.eventService.dispatchEvent(eventRangeSelection);
|
|
501
|
+
}
|
|
502
|
+
calculateColumnsBetween(columnFrom, columnTo) {
|
|
503
|
+
const allColumns = this.visibleColsService.getAllCols();
|
|
504
|
+
const isSameColumn = columnFrom === columnTo;
|
|
505
|
+
const fromIndex = allColumns.indexOf(columnFrom);
|
|
506
|
+
if (fromIndex < 0) {
|
|
507
|
+
console.warn(`ag-Grid: column ${columnFrom.getId()} is not visible`);
|
|
508
|
+
return undefined;
|
|
509
|
+
}
|
|
510
|
+
const toIndex = isSameColumn ? fromIndex : allColumns.indexOf(columnTo);
|
|
511
|
+
if (toIndex < 0) {
|
|
512
|
+
console.warn(`ag-Grid: column ${columnTo.getId()} is not visible`);
|
|
513
|
+
return undefined;
|
|
514
|
+
}
|
|
515
|
+
if (isSameColumn) {
|
|
516
|
+
return [columnFrom];
|
|
517
|
+
}
|
|
518
|
+
const firstIndex = Math.min(fromIndex, toIndex);
|
|
519
|
+
const lastIndex = firstIndex === fromIndex ? toIndex : fromIndex;
|
|
520
|
+
const columns = [];
|
|
521
|
+
for (let i = firstIndex; i <= lastIndex; i++) {
|
|
522
|
+
columns.push(allColumns[i]);
|
|
523
|
+
}
|
|
524
|
+
return columns;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
519
527
|
//# sourceMappingURL=rangeSelector.js.map
|