tabulator-tables 5.2.6 → 5.3.1
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/.eslintignore +3 -0
- package/.eslintrc.js +28 -0
- package/.github/ISSUE_TEMPLATE/bug_report.md +1 -0
- package/.github/workflows/bad-files-check.yml +39 -0
- package/.github/workflows/lint-and-test.yml +31 -0
- package/README.md +18 -6
- package/bower.json +1 -1
- package/build/Bundler.js +77 -77
- package/dist/css/tabulator.css +12 -7
- 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 +12 -7
- 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 +12 -7
- 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 +51 -46
- 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 +12 -7
- 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 +12 -7
- 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 +12 -7
- 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 +12 -7
- 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 +12 -7
- 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 +12 -7
- 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 +12 -7
- 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 +37 -37
- package/dist/js/tabulator.js +1506 -706
- 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 +4226 -3460
- 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 +4 -1
- package/src/js/builds/jquery_wrapper.js +37 -37
- package/src/js/core/ColumnManager.js +270 -232
- package/src/js/core/CoreFeature.js +16 -2
- package/src/js/core/FooterManager.js +10 -10
- package/src/js/core/Module.js +8 -8
- package/src/js/core/RowManager.js +81 -88
- package/src/js/core/Tabulator.js +89 -72
- package/src/js/core/TabulatorFull.js +1 -1
- package/src/js/core/cell/Cell.js +15 -16
- package/src/js/core/cell/CellComponent.js +2 -2
- package/src/js/core/column/Column.js +81 -68
- package/src/js/core/column/ColumnComponent.js +4 -4
- package/src/js/core/column/defaults/options.js +1 -1
- package/src/js/core/defaults/options.js +4 -2
- package/src/js/core/rendering/Renderer.js +19 -19
- package/src/js/core/rendering/renderers/BasicHorizontal.js +1 -2
- package/src/js/core/rendering/renderers/BasicVertical.js +1 -1
- package/src/js/core/rendering/renderers/VirtualDomHorizontal.js +42 -58
- package/src/js/core/rendering/renderers/VirtualDomVertical.js +31 -22
- package/src/js/core/row/Row.js +32 -8
- package/src/js/core/row/RowComponent.js +8 -4
- package/src/js/core/tools/Alert.js +44 -45
- package/src/js/core/tools/ComponentFunctionBinder.js +4 -2
- package/src/js/core/tools/DataLoader.js +3 -3
- package/src/js/core/tools/DeprecationAdvisor.js +47 -0
- package/src/js/core/tools/ExternalEventBus.js +5 -5
- package/src/js/core/tools/InteractionMonitor.js +34 -33
- package/src/js/core/tools/InternalEventBus.js +5 -5
- package/src/js/core/tools/ModuleBinder.js +6 -6
- package/src/js/core/tools/OptionsList.js +4 -4
- package/src/js/core/tools/Popup.js +215 -189
- package/src/js/modules/Accessor/Accessor.js +16 -16
- package/src/js/modules/Accessor/defaults/accessors.js +1 -1
- package/src/js/modules/Ajax/Ajax.js +7 -7
- package/src/js/modules/Ajax/defaults/loaderPromise.js +19 -19
- package/src/js/modules/Ajax/defaults/urlGenerator.js +1 -1
- package/src/js/modules/Clipboard/Clipboard.js +23 -23
- package/src/js/modules/Clipboard/defaults/pasteParsers.js +0 -2
- package/src/js/modules/ColumnCalcs/CalcComponent.js +2 -2
- package/src/js/modules/ColumnCalcs/ColumnCalcs.js +55 -51
- package/src/js/modules/ColumnCalcs/defaults/calculations.js +1 -1
- package/src/js/modules/DataTree/DataTree.js +24 -15
- package/src/js/modules/Download/Download.js +15 -8
- package/src/js/modules/Download/defaults/downloaders/csv.js +28 -28
- package/src/js/modules/Download/defaults/downloaders/html.js +2 -2
- package/src/js/modules/Download/defaults/downloaders/json.js +14 -14
- package/src/js/modules/Download/defaults/downloaders/jsonLines.js +1 -1
- package/src/js/modules/Download/defaults/downloaders/pdf.js +17 -19
- package/src/js/modules/Download/defaults/downloaders/xlsx.js +2 -2
- package/src/js/modules/Edit/Edit.js +219 -201
- package/src/js/modules/Edit/List.js +1026 -991
- package/src/js/modules/Edit/defaults/editors/autocomplete.js +3 -3
- package/src/js/modules/Edit/defaults/editors/date.js +110 -0
- package/src/js/modules/Edit/defaults/editors/datetime.js +97 -0
- package/src/js/modules/Edit/defaults/editors/input.js +7 -7
- package/src/js/modules/Edit/defaults/editors/list.js +2 -2
- package/src/js/modules/Edit/defaults/editors/number.js +12 -12
- package/src/js/modules/Edit/defaults/editors/progress.js +11 -11
- package/src/js/modules/Edit/defaults/editors/range.js +5 -5
- package/src/js/modules/Edit/defaults/editors/select.js +3 -3
- package/src/js/modules/Edit/defaults/editors/star.js +9 -9
- package/src/js/modules/Edit/defaults/editors/textarea.js +97 -92
- package/src/js/modules/Edit/defaults/editors/tickCross.js +1 -3
- package/src/js/modules/Edit/defaults/editors/time.js +98 -0
- package/src/js/modules/Edit/defaults/editors.js +8 -2
- package/src/js/modules/Edit/inputMask.js +19 -26
- package/src/js/modules/Export/Export.js +69 -65
- package/src/js/modules/Filter/Filter.js +88 -95
- package/src/js/modules/Format/Format.js +24 -26
- package/src/js/modules/Format/defaults/formatters/buttonCross.js +1 -1
- package/src/js/modules/Format/defaults/formatters/buttonTick.js +1 -1
- package/src/js/modules/Format/defaults/formatters/color.js +1 -1
- package/src/js/modules/Format/defaults/formatters/datetime.js +7 -7
- package/src/js/modules/Format/defaults/formatters/datetimediff.js +7 -7
- package/src/js/modules/Format/defaults/formatters/handle.js +1 -1
- package/src/js/modules/Format/defaults/formatters/html.js +1 -1
- package/src/js/modules/Format/defaults/formatters/image.js +9 -9
- package/src/js/modules/Format/defaults/formatters/link.js +10 -10
- package/src/js/modules/Format/defaults/formatters/lookup.js +1 -1
- package/src/js/modules/Format/defaults/formatters/money.js +1 -1
- package/src/js/modules/Format/defaults/formatters/plaintext.js +1 -1
- package/src/js/modules/Format/defaults/formatters/progress.js +41 -42
- package/src/js/modules/Format/defaults/formatters/responsiveCollapse.js +3 -3
- package/src/js/modules/Format/defaults/formatters/rowSelection.js +1 -1
- package/src/js/modules/Format/defaults/formatters/rownum.js +9 -2
- package/src/js/modules/Format/defaults/formatters/star.js +1 -1
- package/src/js/modules/Format/defaults/formatters/textarea.js +1 -1
- package/src/js/modules/Format/defaults/formatters/tickCross.js +1 -1
- package/src/js/modules/Format/defaults/formatters/traffic.js +14 -14
- package/src/js/modules/FrozenColumns/FrozenColumns.js +6 -8
- package/src/js/modules/FrozenRows/FrozenRows.js +37 -7
- package/src/js/modules/GroupRows/Group.js +7 -7
- package/src/js/modules/GroupRows/GroupComponent.js +2 -2
- package/src/js/modules/GroupRows/GroupRows.js +34 -11
- package/src/js/modules/History/History.js +2 -2
- package/src/js/modules/HtmlTableImport/HtmlTableImport.js +3 -6
- package/src/js/modules/Import/Import.js +158 -159
- package/src/js/modules/Import/defaults/importers/array.js +5 -0
- package/src/js/modules/Import/defaults/importers/csv.js +49 -49
- package/src/js/modules/Import/defaults/importers/json.js +6 -6
- package/src/js/modules/Import/defaults/importers.js +2 -0
- package/src/js/modules/Interaction/Interaction.js +41 -42
- package/src/js/modules/Keybindings/Keybindings.js +14 -14
- package/src/js/modules/Keybindings/defaults/actions.js +1 -2
- package/src/js/modules/Layout/Layout.js +4 -5
- package/src/js/modules/Layout/defaults/modes/fitColumns.js +13 -16
- package/src/js/modules/Layout/defaults/modes/fitData.js +6 -4
- package/src/js/modules/Layout/defaults/modes/fitDataGeneral.js +2 -2
- package/src/js/modules/Layout/defaults/modes/fitDataStretch.js +2 -2
- package/src/js/modules/Localize/Localize.js +7 -7
- package/src/js/modules/Menu/Menu.js +8 -11
- package/src/js/modules/MoveColumns/MoveColumns.js +3 -6
- package/src/js/modules/MoveRows/MoveRows.js +30 -36
- package/src/js/modules/Mutator/Mutator.js +9 -9
- package/src/js/modules/Page/Page.js +73 -80
- package/src/js/modules/Page/defaults/pageCounters/pages.js +2 -2
- package/src/js/modules/Page/defaults/pageCounters/rows.js +1 -1
- package/src/js/modules/Persistence/Persistence.js +40 -44
- package/src/js/modules/Persistence/defaults/readers.js +1 -1
- package/src/js/modules/Popup/Popup.js +4 -5
- package/src/js/modules/Print/Print.js +2 -2
- package/src/js/modules/ReactiveData/ReactiveData.js +178 -115
- package/src/js/modules/ResizeColumns/ResizeColumns.js +3 -3
- package/src/js/modules/ResizeRows/ResizeRows.js +1 -1
- package/src/js/modules/ResizeTable/ResizeTable.js +77 -46
- package/src/js/modules/ResponsiveLayout/ResponsiveLayout.js +3 -5
- package/src/js/modules/SelectRow/SelectRow.js +26 -28
- package/src/js/modules/Sort/Sort.js +110 -79
- package/src/js/modules/Sort/defaults/sorters/alphanum.js +1 -1
- package/src/js/modules/Sort/defaults/sorters/array.js +24 -28
- package/src/js/modules/Sort/defaults/sorters/boolean.js +1 -1
- package/src/js/modules/Sort/defaults/sorters/date.js +1 -1
- package/src/js/modules/Sort/defaults/sorters/datetime.js +13 -13
- package/src/js/modules/Sort/defaults/sorters/exists.js +1 -1
- package/src/js/modules/Sort/defaults/sorters/number.js +1 -1
- package/src/js/modules/Sort/defaults/sorters/string.js +7 -7
- package/src/js/modules/Sort/defaults/sorters/time.js +1 -1
- package/src/js/modules/Tooltip/Tooltip.js +5 -7
- package/src/js/modules/Validate/Validate.js +10 -13
- package/src/js/modules/Validate/defaults/validators.js +8 -3
- package/src/scss/tabulator.scss +28 -17
- package/src/scss/themes/bootstrap/functions4.scss +1 -1
- package/src/scss/themes/bootstrap/tabulator_bootstrap3.scss +8 -8
- package/src/scss/themes/bootstrap/tabulator_bootstrap4.scss +8 -8
- package/src/scss/themes/bootstrap/tabulator_bootstrap5.scss +25 -25
- package/src/scss/themes/bootstrap/variables5.scss +4 -4
- package/src/scss/themes/bulma/tabulator_bulma.scss +7 -7
- package/src/scss/themes/materialize/tabulator_materialize.scss +6 -6
- package/src/scss/themes/materialize/variables.scss +1 -1
- package/src/scss/themes/semanticui/tabulator_semanticui.scss +7 -7
- package/src/scss/themes/tabulator_midnight.scss +7 -7
- package/src/scss/themes/tabulator_modern.scss +14 -14
- package/src/scss/themes/tabulator_simple.scss +8 -8
- package/src/scss/themes/tabulator_site.scss +15 -15
|
@@ -4,7 +4,7 @@ import TableRegistry from './TableRegistry.js';
|
|
|
4
4
|
export default class ModuleBinder {
|
|
5
5
|
|
|
6
6
|
constructor(tabulator, modules){
|
|
7
|
-
this.
|
|
7
|
+
this.bindStaticFunctionality(tabulator);
|
|
8
8
|
this.bindModules(tabulator, coreModules, true);
|
|
9
9
|
|
|
10
10
|
if(modules){
|
|
@@ -12,7 +12,7 @@ export default class ModuleBinder {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
bindStaticFunctionality(tabulator){
|
|
16
16
|
tabulator.moduleBindings = {};
|
|
17
17
|
|
|
18
18
|
tabulator.extendModule = function(name, property, values){
|
|
@@ -41,9 +41,9 @@ export default class ModuleBinder {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
modules.forEach((mod) => {
|
|
44
|
-
tabulator.registerModuleBinding(mod)
|
|
44
|
+
tabulator.registerModuleBinding(mod);
|
|
45
45
|
});
|
|
46
|
-
}
|
|
46
|
+
};
|
|
47
47
|
|
|
48
48
|
tabulator.registerModuleBinding = function(mod){
|
|
49
49
|
tabulator.moduleBindings[mod.moduleName] = mod;
|
|
@@ -52,7 +52,7 @@ export default class ModuleBinder {
|
|
|
52
52
|
tabulator.findTable = function(query){
|
|
53
53
|
var results = TableRegistry.lookupTable(query, true);
|
|
54
54
|
return Array.isArray(results) && !results.length ? false : results;
|
|
55
|
-
}
|
|
55
|
+
};
|
|
56
56
|
|
|
57
57
|
//ensure that module are bound to instantiated function
|
|
58
58
|
tabulator.prototype.bindModules = function(){
|
|
@@ -88,7 +88,7 @@ export default class ModuleBinder {
|
|
|
88
88
|
orderedEndMods.sort((a, b) => a.moduleInitOrder > b.moduleInitOrder ? 1 : -1);
|
|
89
89
|
|
|
90
90
|
this.modulesRegular = orderedStartMods.concat(unOrderedMods.concat(orderedEndMods));
|
|
91
|
-
}
|
|
91
|
+
};
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
bindModules(tabulator, modules, core){
|
|
@@ -2,7 +2,7 @@ export default class OptionsList {
|
|
|
2
2
|
constructor(table, msgType, defaults = {}){
|
|
3
3
|
this.table = table;
|
|
4
4
|
this.msgType = msgType;
|
|
5
|
-
this.registeredDefaults = Object.assign({}, defaults)
|
|
5
|
+
this.registeredDefaults = Object.assign({}, defaults);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
register(option, value){
|
|
@@ -15,14 +15,14 @@ export default class OptionsList {
|
|
|
15
15
|
Object.assign(output, defaultOptions);
|
|
16
16
|
|
|
17
17
|
if(userOptions.debugInvalidOptions !== false || this.table.options.debugInvalidOptions){
|
|
18
|
-
for (
|
|
18
|
+
for (let key in userOptions){
|
|
19
19
|
if(!output.hasOwnProperty(key)){
|
|
20
|
-
console.warn("Invalid " + this.msgType + " option:", key)
|
|
20
|
+
console.warn("Invalid " + this.msgType + " option:", key);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
for (
|
|
25
|
+
for (let key in output){
|
|
26
26
|
if(key in userOptions){
|
|
27
27
|
output[key] = userOptions[key];
|
|
28
28
|
}else{
|
|
@@ -2,256 +2,282 @@ import CoreFeature from '../CoreFeature.js';
|
|
|
2
2
|
import Helpers from './Helpers.js';
|
|
3
3
|
|
|
4
4
|
export default class Popup extends CoreFeature{
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
constructor(table, element, parent){
|
|
6
|
+
super(table);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
this.element = element;
|
|
9
|
+
this.container = this._lookupContainer();
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
this.parent = parent;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
this.reversedX = false;
|
|
14
|
+
this.childPopup = null;
|
|
15
|
+
this.blurable = false;
|
|
16
|
+
this.blurCallback = null;
|
|
17
|
+
this.renderedCallback = null;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
this.visible = false;
|
|
20
|
+
this.hideable = true;
|
|
20
21
|
|
|
21
|
-
|
|
22
|
+
this.element.classList.add("tabulator-popup-container");
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
this.blurEvent = this.hide.bind(this, false);
|
|
25
|
+
this.escEvent = this._escapeCheck.bind(this);
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
this.destroyBinding = this.tableDestroyed;
|
|
28
|
+
this.destroyed = false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
tableDestroyed(){
|
|
32
|
+
this.destroyed = true;
|
|
33
|
+
this.hide(true);
|
|
34
|
+
}
|
|
28
35
|
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
_lookupContainer(){
|
|
37
|
+
var container = this.table.options.popupContainer;
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
if(typeof container === "string"){
|
|
40
|
+
container = document.querySelector(container);
|
|
34
41
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
if(!container){
|
|
43
|
+
console.warn("Menu Error - no container element found matching selector:", this.table.options.popupContainer , "(defaulting to document body)");
|
|
44
|
+
}
|
|
45
|
+
}else if (container === true){
|
|
46
|
+
container = this.table.element;
|
|
47
|
+
}
|
|
41
48
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
if(container && !this._checkContainerIsParent(container)){
|
|
50
|
+
container = false;
|
|
51
|
+
console.warn("Menu Error - container element does not contain this table:", this.table.options.popupContainer , "(defaulting to document body)");
|
|
52
|
+
}
|
|
46
53
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
54
|
+
if(!container){
|
|
55
|
+
container = document.body;
|
|
56
|
+
}
|
|
50
57
|
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
return container;
|
|
59
|
+
}
|
|
53
60
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
_checkContainerIsParent(container, element = this.table.element){
|
|
62
|
+
if(container === element){
|
|
63
|
+
return true;
|
|
64
|
+
}else{
|
|
65
|
+
return element.parentNode ? this._checkContainerIsParent(container, element.parentNode) : false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
61
68
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
renderCallback(callback){
|
|
70
|
+
this.renderedCallback = callback;
|
|
71
|
+
}
|
|
65
72
|
|
|
66
|
-
|
|
67
|
-
|
|
73
|
+
containerEventCoords(e){
|
|
74
|
+
var touch = !(e instanceof MouseEvent);
|
|
68
75
|
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
var x = touch ? e.touches[0].pageX : e.pageX;
|
|
77
|
+
var y = touch ? e.touches[0].pageY : e.pageY;
|
|
71
78
|
|
|
72
|
-
|
|
73
|
-
|
|
79
|
+
if(this.container !== document.body){
|
|
80
|
+
let parentOffset = Helpers.elOffset(this.container);
|
|
74
81
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
x -= parentOffset.left;
|
|
83
|
+
y -= parentOffset.top;
|
|
84
|
+
}
|
|
78
85
|
|
|
79
|
-
|
|
80
|
-
|
|
86
|
+
return {x, y};
|
|
87
|
+
}
|
|
81
88
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
elementPositionCoords(element, position = "right"){
|
|
90
|
+
var offset = Helpers.elOffset(element),
|
|
91
|
+
containerOffset, x, y;
|
|
85
92
|
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
if(this.container !== document.body){
|
|
94
|
+
containerOffset = Helpers.elOffset(this.container);
|
|
88
95
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
offset.left -= containerOffset.left;
|
|
97
|
+
offset.top -= containerOffset.top;
|
|
98
|
+
}
|
|
92
99
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
switch(position){
|
|
101
|
+
case "right":
|
|
102
|
+
x = offset.left + element.offsetWidth;
|
|
103
|
+
y = offset.top - 1;
|
|
104
|
+
break;
|
|
98
105
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
106
|
+
case "bottom":
|
|
107
|
+
x = offset.left;
|
|
108
|
+
y = offset.top + element.offsetHeight;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
104
111
|
|
|
105
|
-
|
|
106
|
-
|
|
112
|
+
return {x, y, offset};
|
|
113
|
+
}
|
|
107
114
|
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
show(origin, position){
|
|
116
|
+
var x, y, parentEl, parentOffset, coords;
|
|
117
|
+
|
|
118
|
+
if(this.destroyed || this.table.destroyed){
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
110
121
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
122
|
+
if(origin instanceof HTMLElement){
|
|
123
|
+
parentEl = origin;
|
|
124
|
+
coords = this.elementPositionCoords(origin, position);
|
|
114
125
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
126
|
+
parentOffset = coords.offset;
|
|
127
|
+
x = coords.x;
|
|
128
|
+
y = coords.y;
|
|
118
129
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
130
|
+
}else if(typeof origin === "number"){
|
|
131
|
+
parentOffset = {top:0, left:0};
|
|
132
|
+
x = origin;
|
|
133
|
+
y = position;
|
|
134
|
+
}else{
|
|
135
|
+
coords = this.containerEventCoords(origin);
|
|
125
136
|
|
|
126
|
-
|
|
127
|
-
|
|
137
|
+
x = coords.x;
|
|
138
|
+
y = coords.y;
|
|
128
139
|
|
|
129
|
-
|
|
130
|
-
|
|
140
|
+
this.reversedX = false;
|
|
141
|
+
}
|
|
131
142
|
|
|
132
|
-
|
|
133
|
-
|
|
143
|
+
this.element.style.top = y + "px";
|
|
144
|
+
this.element.style.left = x + "px";
|
|
134
145
|
|
|
135
|
-
|
|
146
|
+
this.container.appendChild(this.element);
|
|
136
147
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
148
|
+
if(typeof this.renderedCallback === "function"){
|
|
149
|
+
this.renderedCallback();
|
|
150
|
+
}
|
|
140
151
|
|
|
141
|
-
|
|
152
|
+
this._fitToScreen(x, y, parentEl, parentOffset, position);
|
|
142
153
|
|
|
143
|
-
|
|
154
|
+
this.visible = true;
|
|
155
|
+
|
|
156
|
+
this.subscribe("table-destroy", this.destroyBinding);
|
|
144
157
|
|
|
145
|
-
|
|
158
|
+
this.element.addEventListener("mousedown", (e) => {
|
|
159
|
+
e.stopPropagation();
|
|
160
|
+
});
|
|
146
161
|
|
|
147
|
-
|
|
148
|
-
|
|
162
|
+
return this;
|
|
163
|
+
}
|
|
149
164
|
|
|
150
|
-
|
|
151
|
-
|
|
165
|
+
_fitToScreen(x, y, parentEl, parentOffset, position){
|
|
166
|
+
var scrollTop = this.container === document.body ? document.documentElement.scrollTop : this.container.scrollTop;
|
|
152
167
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
168
|
+
//move menu to start on right edge if it is too close to the edge of the screen
|
|
169
|
+
if((x + this.element.offsetWidth) >= this.container.offsetWidth || this.reversedX){
|
|
170
|
+
this.element.style.left = "";
|
|
156
171
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
172
|
+
if(parentEl){
|
|
173
|
+
this.element.style.right = (this.container.offsetWidth - parentOffset.left) + "px";
|
|
174
|
+
}else{
|
|
175
|
+
this.element.style.right = (this.container.offsetWidth - x) + "px";
|
|
176
|
+
}
|
|
162
177
|
|
|
163
|
-
|
|
164
|
-
|
|
178
|
+
this.reversedX = true;
|
|
179
|
+
}
|
|
165
180
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
181
|
+
//move menu to start on bottom edge if it is too close to the edge of the screen
|
|
182
|
+
if((y + this.element.offsetHeight) > Math.max(this.container.offsetHeight, scrollTop ? this.container.scrollHeight : 0)) {
|
|
183
|
+
if(parentEl){
|
|
184
|
+
switch(position){
|
|
185
|
+
case "bottom":
|
|
186
|
+
this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight - parentEl.offsetHeight - 1) + "px";
|
|
187
|
+
break;
|
|
173
188
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
189
|
+
default:
|
|
190
|
+
this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight + parentEl.offsetHeight + 1) + "px";
|
|
191
|
+
}
|
|
177
192
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
193
|
+
}else{
|
|
194
|
+
this.element.style.top = (parseInt(this.element.style.top) - this.element.offsetHeight) + "px";
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
183
198
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
199
|
+
isVisible(){
|
|
200
|
+
return this.visible;
|
|
201
|
+
}
|
|
187
202
|
|
|
188
|
-
|
|
189
|
-
|
|
203
|
+
hideOnBlur(callback){
|
|
204
|
+
this.blurable = true;
|
|
190
205
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
206
|
+
if(this.visible){
|
|
207
|
+
setTimeout(() => {
|
|
208
|
+
this.table.rowManager.element.addEventListener("scroll", this.blurEvent);
|
|
209
|
+
this.subscribe("cell-editing", this.blurEvent);
|
|
210
|
+
document.body.addEventListener("click", this.blurEvent);
|
|
211
|
+
document.body.addEventListener("contextmenu", this.blurEvent);
|
|
212
|
+
document.body.addEventListener("mousedown", this.blurEvent);
|
|
213
|
+
window.addEventListener("resize", this.blurEvent);
|
|
214
|
+
document.body.addEventListener("keydown", this.escEvent);
|
|
215
|
+
|
|
216
|
+
}, 100);
|
|
200
217
|
|
|
201
|
-
|
|
202
|
-
|
|
218
|
+
this.blurCallback = callback;
|
|
219
|
+
}
|
|
203
220
|
|
|
204
|
-
|
|
205
|
-
|
|
221
|
+
return this;
|
|
222
|
+
}
|
|
206
223
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
224
|
+
_escapeCheck(e){
|
|
225
|
+
if(e.keyCode == 27){
|
|
226
|
+
this.hide();
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
blockHide(){
|
|
231
|
+
this.hideable = false;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
restoreHide(){
|
|
235
|
+
this.hideable = true;
|
|
236
|
+
}
|
|
212
237
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
238
|
+
hide(silent = false){
|
|
239
|
+
if(this.visible && this.hideable){
|
|
240
|
+
if(this.blurable){
|
|
241
|
+
document.body.removeEventListener("keydown", this.escEvent);
|
|
242
|
+
document.body.removeEventListener("click", this.blurEvent);
|
|
243
|
+
document.body.removeEventListener("contextmenu", this.blurEvent);
|
|
244
|
+
document.body.removeEventListener("mousedown", this.blurEvent);
|
|
245
|
+
window.removeEventListener("resize", this.blurEvent);
|
|
246
|
+
this.table.rowManager.element.removeEventListener("scroll", this.blurEvent);
|
|
247
|
+
this.unsubscribe("cell-editing", this.blurEvent);
|
|
248
|
+
}
|
|
223
249
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
250
|
+
if(this.childPopup){
|
|
251
|
+
this.childPopup.hide();
|
|
252
|
+
}
|
|
227
253
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
254
|
+
if(this.parent){
|
|
255
|
+
this.parent.childPopup = null;
|
|
256
|
+
}
|
|
231
257
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
258
|
+
if(this.element.parentNode){
|
|
259
|
+
this.element.parentNode.removeChild(this.element);
|
|
260
|
+
}
|
|
235
261
|
|
|
236
|
-
|
|
262
|
+
this.visible = false;
|
|
237
263
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
264
|
+
if(this.blurCallback && !silent){
|
|
265
|
+
this.blurCallback();
|
|
266
|
+
}
|
|
241
267
|
|
|
242
|
-
|
|
243
|
-
|
|
268
|
+
this.unsubscribe("table-destroy", this.destroyBinding);
|
|
269
|
+
}
|
|
244
270
|
|
|
245
|
-
|
|
246
|
-
|
|
271
|
+
return this;
|
|
272
|
+
}
|
|
247
273
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
274
|
+
child(element){
|
|
275
|
+
if(this.childPopup){
|
|
276
|
+
this.childPopup.hide();
|
|
277
|
+
}
|
|
252
278
|
|
|
253
|
-
|
|
279
|
+
this.childPopup = new Popup(this.table, element, this);
|
|
254
280
|
|
|
255
|
-
|
|
256
|
-
|
|
281
|
+
return this.childPopup;
|
|
282
|
+
}
|
|
257
283
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import Module from '../../core/Module.js';
|
|
2
2
|
import Helpers from '../../core/tools/Helpers.js';
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import defaultAccessors from './defaults/accessors.js';
|
|
5
5
|
|
|
6
6
|
class Accessor extends Module{
|
|
7
7
|
|
|
8
8
|
constructor(table){
|
|
9
9
|
super(table);
|
|
10
10
|
|
|
11
|
-
this.allowedTypes = ["", "data", "download", "clipboard", "print", "htmlOutput"] //list of accessor types
|
|
11
|
+
this.allowedTypes = ["", "data", "download", "clipboard", "print", "htmlOutput"]; //list of accessor types
|
|
12
12
|
|
|
13
13
|
this.registerColumnOption("accessor");
|
|
14
14
|
this.registerColumnOption("accessorParams");
|
|
@@ -47,7 +47,7 @@ class Accessor extends Module{
|
|
|
47
47
|
config[key] = {
|
|
48
48
|
accessor:accessor,
|
|
49
49
|
params: column.definition[key + "Params"] || {},
|
|
50
|
-
}
|
|
50
|
+
};
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
});
|
|
@@ -63,16 +63,16 @@ class Accessor extends Module{
|
|
|
63
63
|
//set column accessor
|
|
64
64
|
switch(typeof value){
|
|
65
65
|
case "string":
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
if(Accessor.accessors[value]){
|
|
67
|
+
accessor = Accessor.accessors[value];
|
|
68
|
+
}else{
|
|
69
|
+
console.warn("Accessor Error - No such accessor found, ignoring: ", value);
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
72
|
|
|
73
73
|
case "function":
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
accessor = value;
|
|
75
|
+
break;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
return accessor;
|
|
@@ -87,7 +87,7 @@ class Accessor extends Module{
|
|
|
87
87
|
var data = Helpers.deepClone(row.data || {});
|
|
88
88
|
|
|
89
89
|
this.table.columnManager.traverse(function(column){
|
|
90
|
-
var value, accessor, params,
|
|
90
|
+
var value, accessor, params, colComponent;
|
|
91
91
|
|
|
92
92
|
if(column.modules.accessor){
|
|
93
93
|
|
|
@@ -97,9 +97,9 @@ class Accessor extends Module{
|
|
|
97
97
|
value = column.getFieldValue(data);
|
|
98
98
|
|
|
99
99
|
if(value != "undefined"){
|
|
100
|
-
|
|
101
|
-
params = typeof accessor.params === "function" ? accessor.params(value, data, type,
|
|
102
|
-
column.setFieldValue(data, accessor.accessor(value, data, type, params,
|
|
100
|
+
colComponent = column.getComponent();
|
|
101
|
+
params = typeof accessor.params === "function" ? accessor.params(value, data, type, colComponent, rowComponent) : accessor.params;
|
|
102
|
+
column.setFieldValue(data, accessor.accessor(value, data, type, params, colComponent, rowComponent));
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
@@ -111,6 +111,6 @@ class Accessor extends Module{
|
|
|
111
111
|
|
|
112
112
|
//load defaults
|
|
113
113
|
Accessor.moduleName = "accessor";
|
|
114
|
-
Accessor.accessors =
|
|
114
|
+
Accessor.accessors = defaultAccessors;
|
|
115
115
|
|
|
116
116
|
export default Accessor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default {}
|
|
1
|
+
export default {};
|
|
@@ -95,7 +95,7 @@ class Ajax extends Module{
|
|
|
95
95
|
|
|
96
96
|
//load config object
|
|
97
97
|
generateConfig(config = {}){
|
|
98
|
-
var ajaxConfig = Object.assign({}, this.config)
|
|
98
|
+
var ajaxConfig = Object.assign({}, this.config);
|
|
99
99
|
|
|
100
100
|
if(typeof config == "string"){
|
|
101
101
|
ajaxConfig.method = config;
|
|
@@ -120,13 +120,13 @@ class Ajax extends Module{
|
|
|
120
120
|
sendRequest(url, params, config){
|
|
121
121
|
if(this.table.options.ajaxRequesting.call(this.table, url, params) !== false){
|
|
122
122
|
return this.loaderPromise(url, config, params)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
.then((data)=>{
|
|
124
|
+
if(this.table.options.ajaxResponse){
|
|
125
|
+
data = this.table.options.ajaxResponse.call(this.table, url, params, data);
|
|
126
|
+
}
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
return data;
|
|
129
|
+
});
|
|
130
130
|
}else{
|
|
131
131
|
return Promise.reject();
|
|
132
132
|
}
|