tabulator-tables 5.4.2 → 5.4.4
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/.babelrc.json +3 -3
- package/.editorconfig +6 -6
- package/.eslintignore +3 -3
- package/.eslintrc.js +28 -28
- package/.github/ISSUE_TEMPLATE/bug_report.md +58 -58
- package/.github/ISSUE_TEMPLATE/documentation.md +14 -14
- package/.github/ISSUE_TEMPLATE/feature_request.md +24 -24
- package/.github/ISSUE_TEMPLATE/question.md +12 -12
- package/.github/workflows/bad-files-check.yml +39 -39
- package/.github/workflows/lint-and-test.yml +30 -30
- package/CODE_OF_CONDUCT.md +46 -46
- package/CONTRIBUTING.md +22 -22
- package/LICENSE +20 -20
- package/README.md +76 -76
- package/bower.json +40 -40
- package/build/Bundler.js +185 -185
- package/build/rollup.js +6 -6
- package/dist/css/tabulator.css +1 -5
- package/dist/css/tabulator.css.map +1 -1
- package/dist/css/tabulator.min.css +1 -1
- package/dist/css/tabulator.min.css.map +1 -1
- package/dist/css/tabulator_bootstrap3.css +1 -5
- package/dist/css/tabulator_bootstrap3.css.map +1 -1
- package/dist/css/tabulator_bootstrap3.min.css +1 -1
- package/dist/css/tabulator_bootstrap3.min.css.map +1 -1
- package/dist/css/tabulator_bootstrap4.css +1 -5
- package/dist/css/tabulator_bootstrap4.css.map +1 -1
- package/dist/css/tabulator_bootstrap4.min.css +1 -1
- package/dist/css/tabulator_bootstrap4.min.css.map +1 -1
- package/dist/css/tabulator_bootstrap5.css +1 -5
- package/dist/css/tabulator_bootstrap5.css.map +1 -1
- package/dist/css/tabulator_bootstrap5.min.css +1 -1
- package/dist/css/tabulator_bootstrap5.min.css.map +1 -1
- package/dist/css/tabulator_bulma.css +1 -5
- package/dist/css/tabulator_bulma.css.map +1 -1
- package/dist/css/tabulator_bulma.min.css +1 -1
- package/dist/css/tabulator_bulma.min.css.map +1 -1
- package/dist/css/tabulator_materialize.css +1 -5
- package/dist/css/tabulator_materialize.css.map +1 -1
- package/dist/css/tabulator_materialize.min.css +1 -1
- package/dist/css/tabulator_materialize.min.css.map +1 -1
- package/dist/css/tabulator_midnight.css +1 -5
- package/dist/css/tabulator_midnight.css.map +1 -1
- package/dist/css/tabulator_midnight.min.css +1 -1
- package/dist/css/tabulator_midnight.min.css.map +1 -1
- package/dist/css/tabulator_modern.css +1 -5
- package/dist/css/tabulator_modern.css.map +1 -1
- package/dist/css/tabulator_modern.min.css +1 -1
- package/dist/css/tabulator_modern.min.css.map +1 -1
- package/dist/css/tabulator_semanticui.css +103 -107
- package/dist/css/tabulator_semanticui.css.map +1 -1
- package/dist/css/tabulator_semanticui.min.css +1 -1
- package/dist/css/tabulator_semanticui.min.css.map +1 -1
- package/dist/css/tabulator_simple.css +1 -5
- package/dist/css/tabulator_simple.css.map +1 -1
- package/dist/css/tabulator_simple.min.css +1 -1
- package/dist/css/tabulator_simple.min.css.map +1 -1
- package/dist/css/tabulator_site.css +1 -5
- package/dist/css/tabulator_site.css.map +1 -1
- package/dist/css/tabulator_site.min.css +1 -1
- package/dist/css/tabulator_site.min.css.map +1 -1
- package/dist/js/jquery_wrapper.js +55 -55
- package/dist/js/tabulator.js +25847 -25653
- package/dist/js/tabulator.js.map +1 -1
- package/dist/js/tabulator.min.js +2 -2
- package/dist/js/tabulator.min.js.map +1 -1
- package/dist/js/tabulator_esm.js +25926 -25732
- package/dist/js/tabulator_esm.js.map +1 -1
- package/dist/js/tabulator_esm.min.js +2 -2
- package/dist/js/tabulator_esm.min.js.map +1 -1
- package/package.json +65 -65
- package/src/js/builds/esm.js +14 -14
- package/src/js/builds/jquery_wrapper.js +55 -55
- package/src/js/core/ColumnManager.js +730 -730
- package/src/js/core/CoreFeature.js +138 -138
- package/src/js/core/FooterManager.js +101 -101
- package/src/js/core/Module.js +141 -141
- package/src/js/core/RowManager.js +1112 -1082
- package/src/js/core/Tabulator.js +895 -893
- package/src/js/core/TabulatorFull.js +10 -10
- package/src/js/core/cell/Cell.js +295 -295
- package/src/js/core/cell/CellComponent.js +76 -76
- package/src/js/core/column/Column.js +949 -949
- package/src/js/core/column/ColumnComponent.js +152 -152
- package/src/js/core/column/defaults/options.js +17 -17
- package/src/js/core/defaults/options.js +65 -65
- package/src/js/core/modules/core.js +2 -2
- package/src/js/core/modules/optional.js +34 -34
- package/src/js/core/rendering/Renderer.js +203 -203
- package/src/js/core/rendering/renderers/BasicHorizontal.js +19 -19
- package/src/js/core/rendering/renderers/BasicVertical.js +79 -78
- package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +577 -577
- package/src/js/core/rendering/renderers/VirtualDomVertical.js +579 -579
- package/src/js/core/row/PseudoRow.js +44 -44
- package/src/js/core/row/Row.js +457 -457
- package/src/js/core/row/RowComponent.js +93 -93
- package/src/js/core/tools/Alert.js +61 -61
- package/src/js/core/tools/ComponentFunctionBinder.js +32 -32
- package/src/js/core/tools/DataLoader.js +119 -119
- package/src/js/core/tools/DeprecationAdvisor.js +46 -46
- package/src/js/core/tools/ExternalEventBus.js +104 -104
- package/src/js/core/tools/Helpers.js +46 -46
- package/src/js/core/tools/InteractionMonitor.js +321 -321
- package/src/js/core/tools/InternalEventBus.js +161 -161
- package/src/js/core/tools/ModuleBinder.js +104 -104
- package/src/js/core/tools/OptionsList.js +44 -40
- package/src/js/core/tools/Popup.js +304 -304
- package/src/js/core/tools/TableRegistry.js +61 -61
- package/src/js/modules/Accessor/Accessor.js +115 -115
- package/src/js/modules/Ajax/Ajax.js +143 -143
- package/src/js/modules/Ajax/defaults/config.js +2 -2
- package/src/js/modules/Ajax/defaults/contentTypeFormatters.js +44 -44
- package/src/js/modules/Ajax/defaults/loaderPromise.js +86 -86
- package/src/js/modules/Ajax/defaults/urlGenerator.js +43 -43
- package/src/js/modules/Clipboard/Clipboard.js +279 -279
- package/src/js/modules/Clipboard/defaults/pasteActions.js +10 -10
- package/src/js/modules/Clipboard/defaults/pasteParsers.js +74 -74
- package/src/js/modules/ColumnCalcs/CalcComponent.js +47 -47
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +581 -568
- package/src/js/modules/ColumnCalcs/defaults/calculations.js +85 -85
- package/src/js/modules/Comms/Comms.js +51 -51
- package/src/js/modules/DataTree/DataTree.js +603 -603
- package/src/js/modules/Download/Download.js +148 -148
- package/src/js/modules/Download/defaults/downloaders/csv.js +61 -61
- package/src/js/modules/Download/defaults/downloaders/html.js +4 -4
- package/src/js/modules/Download/defaults/downloaders/json.js +33 -33
- package/src/js/modules/Download/defaults/downloaders/jsonLines.js +31 -31
- package/src/js/modules/Download/defaults/downloaders/pdf.js +111 -111
- package/src/js/modules/Download/defaults/downloaders/xlsx.js +98 -98
- package/src/js/modules/Download/defaults/downloaders.js +14 -14
- package/src/js/modules/Edit/Edit.js +735 -736
- package/src/js/modules/Edit/List.js +1037 -1033
- package/src/js/modules/Edit/defaults/editors/autocomplete.js +11 -11
- package/src/js/modules/Edit/defaults/editors/date.js +138 -110
- package/src/js/modules/Edit/defaults/editors/datetime.js +125 -97
- package/src/js/modules/Edit/defaults/editors/input.js +76 -74
- package/src/js/modules/Edit/defaults/editors/list.js +6 -6
- package/src/js/modules/Edit/defaults/editors/number.js +109 -107
- package/src/js/modules/Edit/defaults/editors/progress.js +126 -126
- package/src/js/modules/Edit/defaults/editors/range.js +80 -78
- package/src/js/modules/Edit/defaults/editors/select.js +9 -9
- package/src/js/modules/Edit/defaults/editors/star.js +145 -145
- package/src/js/modules/Edit/defaults/editors/textarea.js +122 -120
- package/src/js/modules/Edit/defaults/editors/tickCross.js +94 -96
- package/src/js/modules/Edit/defaults/editors/time.js +126 -98
- package/src/js/modules/Edit/defaults/editors.js +28 -28
- package/src/js/modules/Edit/inputMask.js +73 -73
- package/src/js/modules/Export/Export.js +623 -617
- package/src/js/modules/Export/ExportColumn.js +10 -10
- package/src/js/modules/Export/ExportRow.js +9 -9
- package/src/js/modules/Filter/Filter.js +892 -889
- package/src/js/modules/Filter/defaults/filters.js +107 -107
- package/src/js/modules/Format/Format.js +212 -212
- package/src/js/modules/Format/defaults/formatters/buttonCross.js +2 -2
- package/src/js/modules/Format/defaults/formatters/buttonTick.js +2 -2
- package/src/js/modules/Format/defaults/formatters/color.js +3 -3
- package/src/js/modules/Format/defaults/formatters/datetime.js +36 -36
- package/src/js/modules/Format/defaults/formatters/datetimediff.js +40 -40
- package/src/js/modules/Format/defaults/formatters/handle.js +3 -3
- package/src/js/modules/Format/defaults/formatters/html.js +2 -2
- package/src/js/modules/Format/defaults/formatters/image.js +39 -39
- package/src/js/modules/Format/defaults/formatters/link.js +77 -77
- package/src/js/modules/Format/defaults/formatters/lookup.js +9 -9
- package/src/js/modules/Format/defaults/formatters/money.js +36 -36
- package/src/js/modules/Format/defaults/formatters/plaintext.js +2 -2
- package/src/js/modules/Format/defaults/formatters/progress.js +132 -132
- package/src/js/modules/Format/defaults/formatters/responsiveCollapse.js +43 -43
- package/src/js/modules/Format/defaults/formatters/rowSelection.js +59 -59
- package/src/js/modules/Format/defaults/formatters/rownum.js +9 -9
- package/src/js/modules/Format/defaults/formatters/star.js +37 -37
- package/src/js/modules/Format/defaults/formatters/textarea.js +3 -3
- package/src/js/modules/Format/defaults/formatters/tickCross.js +21 -21
- package/src/js/modules/Format/defaults/formatters/traffic.js +46 -46
- package/src/js/modules/Format/defaults/formatters.js +42 -42
- package/src/js/modules/FrozenColumns/FrozenColumns.js +299 -299
- package/src/js/modules/FrozenRows/FrozenRows.js +169 -159
- package/src/js/modules/GroupRows/Group.js +597 -595
- package/src/js/modules/GroupRows/GroupComponent.js +66 -66
- package/src/js/modules/GroupRows/GroupRows.js +639 -623
- package/src/js/modules/History/History.js +171 -171
- package/src/js/modules/History/defaults/redoers.js +24 -24
- package/src/js/modules/History/defaults/undoers.js +24 -24
- package/src/js/modules/HtmlTableImport/HtmlTableImport.js +181 -181
- package/src/js/modules/Import/Import.js +193 -193
- package/src/js/modules/Import/defaults/importers/array.js +4 -4
- package/src/js/modules/Import/defaults/importers/csv.js +62 -62
- package/src/js/modules/Import/defaults/importers/json.js +7 -7
- package/src/js/modules/Import/defaults/importers.js +8 -8
- package/src/js/modules/Interaction/Interaction.js +325 -325
- package/src/js/modules/Keybindings/Keybindings.js +172 -172
- package/src/js/modules/Keybindings/defaults/actions.js +118 -118
- package/src/js/modules/Keybindings/defaults/bindings.js +12 -12
- package/src/js/modules/Layout/Layout.js +49 -49
- package/src/js/modules/Layout/defaults/modes/fitColumns.js +171 -171
- package/src/js/modules/Layout/defaults/modes/fitData.js +9 -9
- package/src/js/modules/Layout/defaults/modes/fitDataGeneral.js +9 -9
- package/src/js/modules/Layout/defaults/modes/fitDataStretch.js +39 -39
- package/src/js/modules/Layout/defaults/modes.js +11 -11
- package/src/js/modules/Localize/Localize.js +185 -194
- package/src/js/modules/Localize/defaults/langs.js +36 -36
- package/src/js/modules/Menu/Menu.js +302 -302
- package/src/js/modules/MoveColumns/MoveColumns.js +299 -299
- package/src/js/modules/MoveRows/MoveRows.js +635 -635
- package/src/js/modules/Mutator/Mutator.js +161 -161
- package/src/js/modules/Page/Page.js +881 -881
- package/src/js/modules/Page/defaults/pageCounters/pages.js +32 -32
- package/src/js/modules/Page/defaults/pageCounters/rows.js +39 -39
- package/src/js/modules/Page/defaults/pageCounters.js +7 -7
- package/src/js/modules/Persistence/Persistence.js +458 -458
- package/src/js/modules/Persistence/defaults/readers.js +29 -29
- package/src/js/modules/Persistence/defaults/writers.js +12 -12
- package/src/js/modules/Popup/Popup.js +231 -231
- package/src/js/modules/Print/Print.js +137 -124
- package/src/js/modules/ReactiveData/ReactiveData.js +408 -408
- package/src/js/modules/ResizeColumns/ResizeColumns.js +309 -309
- package/src/js/modules/ResizeRows/ResizeRows.js +111 -111
- package/src/js/modules/ResizeTable/ResizeTable.js +159 -159
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +345 -345
- package/src/js/modules/SelectRow/SelectRow.js +446 -436
- package/src/js/modules/Sort/Sort.js +470 -470
- package/src/js/modules/Sort/defaults/sorters/alphanum.js +43 -43
- package/src/js/modules/Sort/defaults/sorters/array.js +53 -53
- package/src/js/modules/Sort/defaults/sorters/boolean.js +6 -6
- package/src/js/modules/Sort/defaults/sorters/date.js +9 -9
- package/src/js/modules/Sort/defaults/sorters/datetime.js +43 -43
- package/src/js/modules/Sort/defaults/sorters/exists.js +6 -6
- package/src/js/modules/Sort/defaults/sorters/number.js +39 -39
- package/src/js/modules/Sort/defaults/sorters/string.js +33 -33
- package/src/js/modules/Sort/defaults/sorters/time.js +9 -9
- package/src/js/modules/Sort/defaults/sorters.js +20 -20
- package/src/js/modules/Tooltip/Tooltip.js +130 -130
- package/src/js/modules/Validate/Validate.js +305 -305
- package/src/js/modules/Validate/defaults/validators.js +138 -138
- package/src/scss/tabulator.scss +1464 -1466
- package/src/scss/themes/bootstrap/functions4.scss +118 -118
- package/src/scss/themes/bootstrap/functions5.scss +302 -302
- package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +284 -284
- package/src/scss/themes/bootstrap/tabulator_bootstrap4.scss +544 -544
- package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +574 -574
- package/src/scss/themes/bootstrap/variables3.scss +870 -870
- package/src/scss/themes/bootstrap/variables4.scss +930 -930
- package/src/scss/themes/bootstrap/variables5.scss +1641 -1641
- package/src/scss/themes/bulma/tabulator_bulma.scss +252 -252
- package/src/scss/themes/bulma/variables.scss +197 -197
- package/src/scss/themes/materialize/tabulator_materialize.scss +265 -265
- package/src/scss/themes/materialize/variables.scss +70 -70
- package/src/scss/themes/semanticui/tabulator_semanticui.scss +561 -561
- package/src/scss/themes/semanticui/variables.scss +839 -839
- package/src/scss/themes/semanticui/variables_table.scss +247 -247
- package/src/scss/themes/tabulator_midnight.scss +158 -158
- package/src/scss/themes/tabulator_modern.scss +231 -231
- package/src/scss/themes/tabulator_simple.scss +102 -102
- package/src/scss/themes/tabulator_site.scss +189 -189
|
@@ -1,325 +1,325 @@
|
|
|
1
|
-
import Module from '../../core/Module.js';
|
|
2
|
-
|
|
3
|
-
import Cell from '../../core/cell/Cell.js';
|
|
4
|
-
import Column from '../../core/column/Column.js';
|
|
5
|
-
|
|
6
|
-
class Interaction extends Module{
|
|
7
|
-
|
|
8
|
-
constructor(table){
|
|
9
|
-
super(table);
|
|
10
|
-
|
|
11
|
-
this.eventMap = {
|
|
12
|
-
//row events
|
|
13
|
-
rowClick:"row-click",
|
|
14
|
-
rowDblClick:"row-dblclick",
|
|
15
|
-
rowContext:"row-contextmenu",
|
|
16
|
-
rowMouseEnter:"row-mouseenter",
|
|
17
|
-
rowMouseLeave:"row-mouseleave",
|
|
18
|
-
rowMouseOver:"row-mouseover",
|
|
19
|
-
rowMouseOut:"row-mouseout",
|
|
20
|
-
rowMouseMove:"row-mousemove",
|
|
21
|
-
rowMouseDown:"row-mousedown",
|
|
22
|
-
rowMouseUp:"row-mouseup",
|
|
23
|
-
rowTap:"row",
|
|
24
|
-
rowDblTap:"row",
|
|
25
|
-
rowTapHold:"row",
|
|
26
|
-
|
|
27
|
-
//cell events
|
|
28
|
-
cellClick:"cell-click",
|
|
29
|
-
cellDblClick:"cell-dblclick",
|
|
30
|
-
cellContext:"cell-contextmenu",
|
|
31
|
-
cellMouseEnter:"cell-mouseenter",
|
|
32
|
-
cellMouseLeave:"cell-mouseleave",
|
|
33
|
-
cellMouseOver:"cell-mouseover",
|
|
34
|
-
cellMouseOut:"cell-mouseout",
|
|
35
|
-
cellMouseMove:"cell-mousemove",
|
|
36
|
-
cellMouseDown:"cell-mousedown",
|
|
37
|
-
cellMouseUp:"cell-mouseup",
|
|
38
|
-
cellTap:"cell",
|
|
39
|
-
cellDblTap:"cell",
|
|
40
|
-
cellTapHold:"cell",
|
|
41
|
-
|
|
42
|
-
//column header events
|
|
43
|
-
headerClick:"column-click",
|
|
44
|
-
headerDblClick:"column-dblclick",
|
|
45
|
-
headerContext:"column-contextmenu",
|
|
46
|
-
headerMouseEnter:"column-mouseenter",
|
|
47
|
-
headerMouseLeave:"column-mouseleave",
|
|
48
|
-
headerMouseOver:"column-mouseover",
|
|
49
|
-
headerMouseOut:"column-mouseout",
|
|
50
|
-
headerMouseMove:"column-mousemove",
|
|
51
|
-
headerMouseDown:"column-mousedown",
|
|
52
|
-
headerMouseUp:"column-mouseup",
|
|
53
|
-
headerTap:"column",
|
|
54
|
-
headerDblTap:"column",
|
|
55
|
-
headerTapHold:"column",
|
|
56
|
-
|
|
57
|
-
//group header
|
|
58
|
-
groupClick:"group-click",
|
|
59
|
-
groupDblClick:"group-dblclick",
|
|
60
|
-
groupContext:"group-contextmenu",
|
|
61
|
-
groupMouseEnter:"group-mouseenter",
|
|
62
|
-
groupMouseLeave:"group-mouseleave",
|
|
63
|
-
groupMouseOver:"group-mouseover",
|
|
64
|
-
groupMouseOut:"group-mouseout",
|
|
65
|
-
groupMouseMove:"group-mousemove",
|
|
66
|
-
groupMouseDown:"group-mousedown",
|
|
67
|
-
groupMouseUp:"group-mouseup",
|
|
68
|
-
groupTap:"group",
|
|
69
|
-
groupDblTap:"group",
|
|
70
|
-
groupTapHold:"group",
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
this.subscribers = {};
|
|
74
|
-
|
|
75
|
-
this.touchSubscribers = {};
|
|
76
|
-
|
|
77
|
-
this.columnSubscribers = {};
|
|
78
|
-
|
|
79
|
-
this.touchWatchers = {
|
|
80
|
-
row:{
|
|
81
|
-
tap:null,
|
|
82
|
-
tapDbl:null,
|
|
83
|
-
tapHold:null,
|
|
84
|
-
},
|
|
85
|
-
cell:{
|
|
86
|
-
tap:null,
|
|
87
|
-
tapDbl:null,
|
|
88
|
-
tapHold:null,
|
|
89
|
-
},
|
|
90
|
-
column:{
|
|
91
|
-
tap:null,
|
|
92
|
-
tapDbl:null,
|
|
93
|
-
tapHold:null,
|
|
94
|
-
},
|
|
95
|
-
group:{
|
|
96
|
-
tap:null,
|
|
97
|
-
tapDbl:null,
|
|
98
|
-
tapHold:null,
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
this.registerColumnOption("headerClick");
|
|
103
|
-
this.registerColumnOption("headerDblClick");
|
|
104
|
-
this.registerColumnOption("headerContext");
|
|
105
|
-
this.registerColumnOption("headerMouseEnter");
|
|
106
|
-
this.registerColumnOption("headerMouseLeave");
|
|
107
|
-
this.registerColumnOption("headerMouseOver");
|
|
108
|
-
this.registerColumnOption("headerMouseOut");
|
|
109
|
-
this.registerColumnOption("headerMouseMove");
|
|
110
|
-
this.registerColumnOption("headerMouseDown");
|
|
111
|
-
this.registerColumnOption("headerMouseUp");
|
|
112
|
-
this.registerColumnOption("headerTap");
|
|
113
|
-
this.registerColumnOption("headerDblTap");
|
|
114
|
-
this.registerColumnOption("headerTapHold");
|
|
115
|
-
|
|
116
|
-
this.registerColumnOption("cellClick");
|
|
117
|
-
this.registerColumnOption("cellDblClick");
|
|
118
|
-
this.registerColumnOption("cellContext");
|
|
119
|
-
this.registerColumnOption("cellMouseEnter");
|
|
120
|
-
this.registerColumnOption("cellMouseLeave");
|
|
121
|
-
this.registerColumnOption("cellMouseOver");
|
|
122
|
-
this.registerColumnOption("cellMouseOut");
|
|
123
|
-
this.registerColumnOption("cellMouseMove");
|
|
124
|
-
this.registerColumnOption("cellMouseDown");
|
|
125
|
-
this.registerColumnOption("cellMouseUp");
|
|
126
|
-
this.registerColumnOption("cellTap");
|
|
127
|
-
this.registerColumnOption("cellDblTap");
|
|
128
|
-
this.registerColumnOption("cellTapHold");
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
initialize(){
|
|
133
|
-
this.initializeExternalEvents();
|
|
134
|
-
|
|
135
|
-
this.subscribe("column-init", this.initializeColumn.bind(this));
|
|
136
|
-
this.subscribe("cell-dblclick", this.cellContentsSelectionFixer.bind(this));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
cellContentsSelectionFixer(e, cell){
|
|
140
|
-
var range;
|
|
141
|
-
|
|
142
|
-
if(this.table.modExists("edit")){
|
|
143
|
-
if (this.table.modules.edit.currentCell === cell){
|
|
144
|
-
return; //prevent instant selection of editor content
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
e.preventDefault();
|
|
149
|
-
|
|
150
|
-
try{
|
|
151
|
-
if (document.selection) { // IE
|
|
152
|
-
range = document.body.createTextRange();
|
|
153
|
-
range.moveToElementText(cell.getElement());
|
|
154
|
-
range.select();
|
|
155
|
-
} else if (window.getSelection) {
|
|
156
|
-
range = document.createRange();
|
|
157
|
-
range.selectNode(cell.getElement());
|
|
158
|
-
window.getSelection().removeAllRanges();
|
|
159
|
-
window.getSelection().addRange(range);
|
|
160
|
-
}
|
|
161
|
-
}catch(e){}
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
initializeExternalEvents(){
|
|
165
|
-
for(let key in this.eventMap){
|
|
166
|
-
this.subscriptionChangeExternal(key, this.subscriptionChanged.bind(this, key));
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
subscriptionChanged(key, added){
|
|
171
|
-
if(added){
|
|
172
|
-
if(!this.subscribers[key]){
|
|
173
|
-
if(this.eventMap[key].includes("-")){
|
|
174
|
-
this.subscribers[key] = this.handle.bind(this, key);
|
|
175
|
-
this.subscribe(this.eventMap[key], this.subscribers[key]);
|
|
176
|
-
}else{
|
|
177
|
-
this.subscribeTouchEvents(key);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}else{
|
|
181
|
-
if(this.eventMap[key].includes("-")){
|
|
182
|
-
if(this.subscribers[key] && !this.columnSubscribers[key] && !this.subscribedExternal(key)){
|
|
183
|
-
this.unsubscribe(this.eventMap[key], this.subscribers[key]);
|
|
184
|
-
delete this.subscribers[key];
|
|
185
|
-
}
|
|
186
|
-
}else{
|
|
187
|
-
this.unsubscribeTouchEvents(key);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
subscribeTouchEvents(key){
|
|
194
|
-
var type = this.eventMap[key];
|
|
195
|
-
|
|
196
|
-
if(!this.touchSubscribers[type + "-touchstart"]){
|
|
197
|
-
this.touchSubscribers[type + "-touchstart"] = this.handleTouch.bind(this, type, "start");
|
|
198
|
-
this.touchSubscribers[type + "-touchend"] = this.handleTouch.bind(this, type, "end");
|
|
199
|
-
|
|
200
|
-
this.subscribe(type + "-touchstart", this.touchSubscribers[type + "-touchstart"]);
|
|
201
|
-
this.subscribe(type + "-touchend", this.touchSubscribers[type + "-touchend"]);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
this.subscribers[key] = true;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
unsubscribeTouchEvents(key){
|
|
208
|
-
var noTouch = true,
|
|
209
|
-
type = this.eventMap[key];
|
|
210
|
-
|
|
211
|
-
if(this.subscribers[key] && !this.subscribedExternal(key)){
|
|
212
|
-
delete this.subscribers[key];
|
|
213
|
-
|
|
214
|
-
for(let i in this.eventMap){
|
|
215
|
-
if(this.eventMap[i] === type){
|
|
216
|
-
if(this.subscribers[i]){
|
|
217
|
-
noTouch = false;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if(noTouch){
|
|
223
|
-
this.unsubscribe(type + "-touchstart", this.touchSubscribers[type + "-touchstart"]);
|
|
224
|
-
this.unsubscribe(type + "-touchend", this.touchSubscribers[type + "-touchend"]);
|
|
225
|
-
|
|
226
|
-
delete this.touchSubscribers[type + "-touchstart"];
|
|
227
|
-
delete this.touchSubscribers[type + "-touchend"];
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
initializeColumn(column){
|
|
233
|
-
var def = column.definition;
|
|
234
|
-
|
|
235
|
-
for(let key in this.eventMap){
|
|
236
|
-
if(def[key]){
|
|
237
|
-
this.subscriptionChanged(key, true);
|
|
238
|
-
|
|
239
|
-
if(!this.columnSubscribers[key]){
|
|
240
|
-
this.columnSubscribers[key] = [];
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
this.columnSubscribers[key].push(column);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
handle(action, e, component){
|
|
249
|
-
this.dispatchEvent(action, e, component);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
handleTouch(type, action, e, component){
|
|
253
|
-
var watchers = this.touchWatchers[type];
|
|
254
|
-
|
|
255
|
-
if(type === "column"){
|
|
256
|
-
type = "header";
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
switch(action){
|
|
260
|
-
case "start":
|
|
261
|
-
watchers.tap = true;
|
|
262
|
-
|
|
263
|
-
clearTimeout(watchers.tapHold);
|
|
264
|
-
|
|
265
|
-
watchers.tapHold = setTimeout(() => {
|
|
266
|
-
clearTimeout(watchers.tapHold);
|
|
267
|
-
watchers.tapHold = null;
|
|
268
|
-
|
|
269
|
-
watchers.tap = null;
|
|
270
|
-
clearTimeout(watchers.tapDbl);
|
|
271
|
-
watchers.tapDbl = null;
|
|
272
|
-
|
|
273
|
-
this.dispatchEvent(type + "TapHold", e, component);
|
|
274
|
-
}, 1000);
|
|
275
|
-
break;
|
|
276
|
-
|
|
277
|
-
case "end":
|
|
278
|
-
if(watchers.tap){
|
|
279
|
-
|
|
280
|
-
watchers.tap = null;
|
|
281
|
-
this.dispatchEvent(type + "Tap", e, component);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if(watchers.tapDbl){
|
|
285
|
-
clearTimeout(watchers.tapDbl);
|
|
286
|
-
watchers.tapDbl = null;
|
|
287
|
-
|
|
288
|
-
this.dispatchEvent(type + "DblTap", e, component);
|
|
289
|
-
}else{
|
|
290
|
-
watchers.tapDbl = setTimeout(() => {
|
|
291
|
-
clearTimeout(watchers.tapDbl);
|
|
292
|
-
watchers.tapDbl = null;
|
|
293
|
-
}, 300);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
clearTimeout(watchers.tapHold);
|
|
297
|
-
watchers.tapHold = null;
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
dispatchEvent(action, e, component){
|
|
303
|
-
var componentObj = component.getComponent(),
|
|
304
|
-
callback;
|
|
305
|
-
|
|
306
|
-
if(this.columnSubscribers[action]){
|
|
307
|
-
|
|
308
|
-
if(component instanceof Cell){
|
|
309
|
-
callback = component.column.definition[action];
|
|
310
|
-
}else if(component instanceof Column){
|
|
311
|
-
callback = component.definition[action];
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if(callback){
|
|
315
|
-
callback(e, componentObj);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
this.dispatchExternal(action, e, componentObj);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
Interaction.moduleName = "interaction";
|
|
324
|
-
|
|
325
|
-
export default Interaction;
|
|
1
|
+
import Module from '../../core/Module.js';
|
|
2
|
+
|
|
3
|
+
import Cell from '../../core/cell/Cell.js';
|
|
4
|
+
import Column from '../../core/column/Column.js';
|
|
5
|
+
|
|
6
|
+
class Interaction extends Module{
|
|
7
|
+
|
|
8
|
+
constructor(table){
|
|
9
|
+
super(table);
|
|
10
|
+
|
|
11
|
+
this.eventMap = {
|
|
12
|
+
//row events
|
|
13
|
+
rowClick:"row-click",
|
|
14
|
+
rowDblClick:"row-dblclick",
|
|
15
|
+
rowContext:"row-contextmenu",
|
|
16
|
+
rowMouseEnter:"row-mouseenter",
|
|
17
|
+
rowMouseLeave:"row-mouseleave",
|
|
18
|
+
rowMouseOver:"row-mouseover",
|
|
19
|
+
rowMouseOut:"row-mouseout",
|
|
20
|
+
rowMouseMove:"row-mousemove",
|
|
21
|
+
rowMouseDown:"row-mousedown",
|
|
22
|
+
rowMouseUp:"row-mouseup",
|
|
23
|
+
rowTap:"row",
|
|
24
|
+
rowDblTap:"row",
|
|
25
|
+
rowTapHold:"row",
|
|
26
|
+
|
|
27
|
+
//cell events
|
|
28
|
+
cellClick:"cell-click",
|
|
29
|
+
cellDblClick:"cell-dblclick",
|
|
30
|
+
cellContext:"cell-contextmenu",
|
|
31
|
+
cellMouseEnter:"cell-mouseenter",
|
|
32
|
+
cellMouseLeave:"cell-mouseleave",
|
|
33
|
+
cellMouseOver:"cell-mouseover",
|
|
34
|
+
cellMouseOut:"cell-mouseout",
|
|
35
|
+
cellMouseMove:"cell-mousemove",
|
|
36
|
+
cellMouseDown:"cell-mousedown",
|
|
37
|
+
cellMouseUp:"cell-mouseup",
|
|
38
|
+
cellTap:"cell",
|
|
39
|
+
cellDblTap:"cell",
|
|
40
|
+
cellTapHold:"cell",
|
|
41
|
+
|
|
42
|
+
//column header events
|
|
43
|
+
headerClick:"column-click",
|
|
44
|
+
headerDblClick:"column-dblclick",
|
|
45
|
+
headerContext:"column-contextmenu",
|
|
46
|
+
headerMouseEnter:"column-mouseenter",
|
|
47
|
+
headerMouseLeave:"column-mouseleave",
|
|
48
|
+
headerMouseOver:"column-mouseover",
|
|
49
|
+
headerMouseOut:"column-mouseout",
|
|
50
|
+
headerMouseMove:"column-mousemove",
|
|
51
|
+
headerMouseDown:"column-mousedown",
|
|
52
|
+
headerMouseUp:"column-mouseup",
|
|
53
|
+
headerTap:"column",
|
|
54
|
+
headerDblTap:"column",
|
|
55
|
+
headerTapHold:"column",
|
|
56
|
+
|
|
57
|
+
//group header
|
|
58
|
+
groupClick:"group-click",
|
|
59
|
+
groupDblClick:"group-dblclick",
|
|
60
|
+
groupContext:"group-contextmenu",
|
|
61
|
+
groupMouseEnter:"group-mouseenter",
|
|
62
|
+
groupMouseLeave:"group-mouseleave",
|
|
63
|
+
groupMouseOver:"group-mouseover",
|
|
64
|
+
groupMouseOut:"group-mouseout",
|
|
65
|
+
groupMouseMove:"group-mousemove",
|
|
66
|
+
groupMouseDown:"group-mousedown",
|
|
67
|
+
groupMouseUp:"group-mouseup",
|
|
68
|
+
groupTap:"group",
|
|
69
|
+
groupDblTap:"group",
|
|
70
|
+
groupTapHold:"group",
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
this.subscribers = {};
|
|
74
|
+
|
|
75
|
+
this.touchSubscribers = {};
|
|
76
|
+
|
|
77
|
+
this.columnSubscribers = {};
|
|
78
|
+
|
|
79
|
+
this.touchWatchers = {
|
|
80
|
+
row:{
|
|
81
|
+
tap:null,
|
|
82
|
+
tapDbl:null,
|
|
83
|
+
tapHold:null,
|
|
84
|
+
},
|
|
85
|
+
cell:{
|
|
86
|
+
tap:null,
|
|
87
|
+
tapDbl:null,
|
|
88
|
+
tapHold:null,
|
|
89
|
+
},
|
|
90
|
+
column:{
|
|
91
|
+
tap:null,
|
|
92
|
+
tapDbl:null,
|
|
93
|
+
tapHold:null,
|
|
94
|
+
},
|
|
95
|
+
group:{
|
|
96
|
+
tap:null,
|
|
97
|
+
tapDbl:null,
|
|
98
|
+
tapHold:null,
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
this.registerColumnOption("headerClick");
|
|
103
|
+
this.registerColumnOption("headerDblClick");
|
|
104
|
+
this.registerColumnOption("headerContext");
|
|
105
|
+
this.registerColumnOption("headerMouseEnter");
|
|
106
|
+
this.registerColumnOption("headerMouseLeave");
|
|
107
|
+
this.registerColumnOption("headerMouseOver");
|
|
108
|
+
this.registerColumnOption("headerMouseOut");
|
|
109
|
+
this.registerColumnOption("headerMouseMove");
|
|
110
|
+
this.registerColumnOption("headerMouseDown");
|
|
111
|
+
this.registerColumnOption("headerMouseUp");
|
|
112
|
+
this.registerColumnOption("headerTap");
|
|
113
|
+
this.registerColumnOption("headerDblTap");
|
|
114
|
+
this.registerColumnOption("headerTapHold");
|
|
115
|
+
|
|
116
|
+
this.registerColumnOption("cellClick");
|
|
117
|
+
this.registerColumnOption("cellDblClick");
|
|
118
|
+
this.registerColumnOption("cellContext");
|
|
119
|
+
this.registerColumnOption("cellMouseEnter");
|
|
120
|
+
this.registerColumnOption("cellMouseLeave");
|
|
121
|
+
this.registerColumnOption("cellMouseOver");
|
|
122
|
+
this.registerColumnOption("cellMouseOut");
|
|
123
|
+
this.registerColumnOption("cellMouseMove");
|
|
124
|
+
this.registerColumnOption("cellMouseDown");
|
|
125
|
+
this.registerColumnOption("cellMouseUp");
|
|
126
|
+
this.registerColumnOption("cellTap");
|
|
127
|
+
this.registerColumnOption("cellDblTap");
|
|
128
|
+
this.registerColumnOption("cellTapHold");
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
initialize(){
|
|
133
|
+
this.initializeExternalEvents();
|
|
134
|
+
|
|
135
|
+
this.subscribe("column-init", this.initializeColumn.bind(this));
|
|
136
|
+
this.subscribe("cell-dblclick", this.cellContentsSelectionFixer.bind(this));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
cellContentsSelectionFixer(e, cell){
|
|
140
|
+
var range;
|
|
141
|
+
|
|
142
|
+
if(this.table.modExists("edit")){
|
|
143
|
+
if (this.table.modules.edit.currentCell === cell){
|
|
144
|
+
return; //prevent instant selection of editor content
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
|
|
150
|
+
try{
|
|
151
|
+
if (document.selection) { // IE
|
|
152
|
+
range = document.body.createTextRange();
|
|
153
|
+
range.moveToElementText(cell.getElement());
|
|
154
|
+
range.select();
|
|
155
|
+
} else if (window.getSelection) {
|
|
156
|
+
range = document.createRange();
|
|
157
|
+
range.selectNode(cell.getElement());
|
|
158
|
+
window.getSelection().removeAllRanges();
|
|
159
|
+
window.getSelection().addRange(range);
|
|
160
|
+
}
|
|
161
|
+
}catch(e){}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
initializeExternalEvents(){
|
|
165
|
+
for(let key in this.eventMap){
|
|
166
|
+
this.subscriptionChangeExternal(key, this.subscriptionChanged.bind(this, key));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
subscriptionChanged(key, added){
|
|
171
|
+
if(added){
|
|
172
|
+
if(!this.subscribers[key]){
|
|
173
|
+
if(this.eventMap[key].includes("-")){
|
|
174
|
+
this.subscribers[key] = this.handle.bind(this, key);
|
|
175
|
+
this.subscribe(this.eventMap[key], this.subscribers[key]);
|
|
176
|
+
}else{
|
|
177
|
+
this.subscribeTouchEvents(key);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}else{
|
|
181
|
+
if(this.eventMap[key].includes("-")){
|
|
182
|
+
if(this.subscribers[key] && !this.columnSubscribers[key] && !this.subscribedExternal(key)){
|
|
183
|
+
this.unsubscribe(this.eventMap[key], this.subscribers[key]);
|
|
184
|
+
delete this.subscribers[key];
|
|
185
|
+
}
|
|
186
|
+
}else{
|
|
187
|
+
this.unsubscribeTouchEvents(key);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
subscribeTouchEvents(key){
|
|
194
|
+
var type = this.eventMap[key];
|
|
195
|
+
|
|
196
|
+
if(!this.touchSubscribers[type + "-touchstart"]){
|
|
197
|
+
this.touchSubscribers[type + "-touchstart"] = this.handleTouch.bind(this, type, "start");
|
|
198
|
+
this.touchSubscribers[type + "-touchend"] = this.handleTouch.bind(this, type, "end");
|
|
199
|
+
|
|
200
|
+
this.subscribe(type + "-touchstart", this.touchSubscribers[type + "-touchstart"]);
|
|
201
|
+
this.subscribe(type + "-touchend", this.touchSubscribers[type + "-touchend"]);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
this.subscribers[key] = true;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
unsubscribeTouchEvents(key){
|
|
208
|
+
var noTouch = true,
|
|
209
|
+
type = this.eventMap[key];
|
|
210
|
+
|
|
211
|
+
if(this.subscribers[key] && !this.subscribedExternal(key)){
|
|
212
|
+
delete this.subscribers[key];
|
|
213
|
+
|
|
214
|
+
for(let i in this.eventMap){
|
|
215
|
+
if(this.eventMap[i] === type){
|
|
216
|
+
if(this.subscribers[i]){
|
|
217
|
+
noTouch = false;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if(noTouch){
|
|
223
|
+
this.unsubscribe(type + "-touchstart", this.touchSubscribers[type + "-touchstart"]);
|
|
224
|
+
this.unsubscribe(type + "-touchend", this.touchSubscribers[type + "-touchend"]);
|
|
225
|
+
|
|
226
|
+
delete this.touchSubscribers[type + "-touchstart"];
|
|
227
|
+
delete this.touchSubscribers[type + "-touchend"];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
initializeColumn(column){
|
|
233
|
+
var def = column.definition;
|
|
234
|
+
|
|
235
|
+
for(let key in this.eventMap){
|
|
236
|
+
if(def[key]){
|
|
237
|
+
this.subscriptionChanged(key, true);
|
|
238
|
+
|
|
239
|
+
if(!this.columnSubscribers[key]){
|
|
240
|
+
this.columnSubscribers[key] = [];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
this.columnSubscribers[key].push(column);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
handle(action, e, component){
|
|
249
|
+
this.dispatchEvent(action, e, component);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
handleTouch(type, action, e, component){
|
|
253
|
+
var watchers = this.touchWatchers[type];
|
|
254
|
+
|
|
255
|
+
if(type === "column"){
|
|
256
|
+
type = "header";
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
switch(action){
|
|
260
|
+
case "start":
|
|
261
|
+
watchers.tap = true;
|
|
262
|
+
|
|
263
|
+
clearTimeout(watchers.tapHold);
|
|
264
|
+
|
|
265
|
+
watchers.tapHold = setTimeout(() => {
|
|
266
|
+
clearTimeout(watchers.tapHold);
|
|
267
|
+
watchers.tapHold = null;
|
|
268
|
+
|
|
269
|
+
watchers.tap = null;
|
|
270
|
+
clearTimeout(watchers.tapDbl);
|
|
271
|
+
watchers.tapDbl = null;
|
|
272
|
+
|
|
273
|
+
this.dispatchEvent(type + "TapHold", e, component);
|
|
274
|
+
}, 1000);
|
|
275
|
+
break;
|
|
276
|
+
|
|
277
|
+
case "end":
|
|
278
|
+
if(watchers.tap){
|
|
279
|
+
|
|
280
|
+
watchers.tap = null;
|
|
281
|
+
this.dispatchEvent(type + "Tap", e, component);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
if(watchers.tapDbl){
|
|
285
|
+
clearTimeout(watchers.tapDbl);
|
|
286
|
+
watchers.tapDbl = null;
|
|
287
|
+
|
|
288
|
+
this.dispatchEvent(type + "DblTap", e, component);
|
|
289
|
+
}else{
|
|
290
|
+
watchers.tapDbl = setTimeout(() => {
|
|
291
|
+
clearTimeout(watchers.tapDbl);
|
|
292
|
+
watchers.tapDbl = null;
|
|
293
|
+
}, 300);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
clearTimeout(watchers.tapHold);
|
|
297
|
+
watchers.tapHold = null;
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
dispatchEvent(action, e, component){
|
|
303
|
+
var componentObj = component.getComponent(),
|
|
304
|
+
callback;
|
|
305
|
+
|
|
306
|
+
if(this.columnSubscribers[action]){
|
|
307
|
+
|
|
308
|
+
if(component instanceof Cell){
|
|
309
|
+
callback = component.column.definition[action];
|
|
310
|
+
}else if(component instanceof Column){
|
|
311
|
+
callback = component.definition[action];
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if(callback){
|
|
315
|
+
callback(e, componentObj);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
this.dispatchExternal(action, e, componentObj);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
Interaction.moduleName = "interaction";
|
|
324
|
+
|
|
325
|
+
export default Interaction;
|