vgapp 1.3.0 → 1.3.2
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/README.md +133 -133
- package/app/langs/en/buttons.json +17 -17
- package/app/langs/en/messages.json +36 -36
- package/app/langs/ru/buttons.json +17 -17
- package/app/langs/ru/messages.json +36 -36
- package/app/modules/base-module.js +111 -111
- package/app/modules/vgalert/js/vgalert.js +52 -29
- package/app/modules/vgalert/readme.md +105 -105
- package/app/modules/vgdynamictable/index.js +5 -5
- package/app/modules/vgdynamictable/js/editable.js +19 -19
- package/app/modules/vgdynamictable/js/filters.js +21 -21
- package/app/modules/vgdynamictable/js/fixed.js +179 -179
- package/app/modules/vgdynamictable/js/pagination.js +1 -1
- package/app/modules/vgdynamictable/js/search.js +12 -12
- package/app/modules/vgdynamictable/js/sortable.js +71 -71
- package/app/modules/vgdynamictable/js/summary-footer.js +28 -28
- package/app/modules/vgdynamictable/js/table-remote.js +79 -79
- package/app/modules/vgdynamictable/js/table-url-state.js +31 -31
- package/app/modules/vgdynamictable/js/utils/common.js +48 -48
- package/app/modules/vgdynamictable/js/vgdynamictable.js +268 -268
- package/app/modules/vgdynamictable/readme.md +250 -250
- package/app/modules/vgdynamictable/scss/_skeleton.scss +6 -6
- package/app/modules/vgdynamictable/scss/_sortable.scss +24 -24
- package/app/modules/vgdynamictable/scss/_table.scss +4 -4
- package/app/modules/vgdynamictable/scss/_variables.scss +79 -79
- package/app/modules/vgdynamictable/scss/vgdynamictable.scss +27 -27
- package/app/modules/vgfilepreview/js/i18n.js +56 -56
- package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
- package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
- package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
- package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
- package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
- package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
- package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
- package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
- package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
- package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
- package/app/modules/vgfilepreview/js/renderers/video-modal.js +272 -272
- package/app/modules/vgfilepreview/js/renderers/video.js +80 -80
- package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
- package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
- package/app/modules/vgfilepreview/js/vgfilepreview.js +7 -7
- package/app/modules/vgfilepreview/readme.md +68 -68
- package/app/modules/vgfilepreview/scss/_variables.scss +113 -113
- package/app/modules/vgfilepreview/scss/vgfilepreview.scss +464 -464
- package/app/modules/vgfiles/js/base.js +26 -26
- package/app/modules/vgfiles/js/droppable.js +260 -260
- package/app/modules/vgfiles/js/render.js +153 -153
- package/app/modules/vgfiles/js/vgfiles.js +104 -104
- package/app/modules/vgfiles/readme.md +123 -123
- package/app/modules/vgfiles/scss/_variables.scss +18 -18
- package/app/modules/vgfiles/scss/vgfiles.scss +148 -148
- package/app/modules/vgformsender/js/hideshowpass.js +16 -16
- package/app/modules/vgformsender/scss/vgformsender.scss +34 -34
- package/app/modules/vgmodal/js/vgmodal.drag.js +332 -332
- package/app/modules/vgmodal/js/vgmodal.js +188 -188
- package/app/modules/vgmodal/js/vgmodal.resize.js +27 -27
- package/app/modules/vgmodal/scss/vgmodal.scss +14 -14
- package/app/modules/vgnav/js/vgnav.js +135 -135
- package/app/modules/vgnav/readme.md +67 -67
- package/app/modules/vgnestable/README.md +307 -307
- package/app/modules/vgnestable/scss/_variables.scss +60 -60
- package/app/modules/vgnestable/scss/vgnestable.scss +163 -163
- package/app/modules/vgrangeslider/js/skins.js +222 -222
- package/app/modules/vgrangeslider/js/vgrangeslider.js +704 -704
- package/app/modules/vgrangeslider/readme.md +523 -523
- package/app/modules/vgrangeslider/scss/_variables.scss +53 -53
- package/app/modules/vgrangeslider/scss/vgrangeslider.scss +240 -240
- package/app/modules/vgselect/js/vgselect.js +39 -39
- package/app/modules/vgselect/scss/vgselect.scss +22 -22
- package/app/modules/vgspy/readme.md +28 -28
- package/app/modules/vgtoast/readme.md +18 -18
- package/app/modules/vgtoast/scss/vgtoast.scss +48 -48
- package/app/modules/vgtooltip/js/vgtooltip.js +89 -89
- package/app/modules/vgtooltip/readme.md +181 -181
- package/app/utils/js/components/ajax.js +117 -117
- package/app/utils/js/components/audio-metadata.js +240 -240
- package/app/utils/js/components/backdrop.js +17 -17
- package/app/utils/js/components/file-icon.js +109 -109
- package/app/utils/js/components/file-preview.js +304 -304
- package/app/utils/js/components/sanitize.js +150 -150
- package/app/utils/js/components/video-metadata.js +140 -140
- package/app/vgapp.js +130 -107
- package/build/vgapp.css +1 -1
- package/build/vgapp.css.map +1 -1
- package/build/vgapp.js +1 -1
- package/build/vgapp.js.map +1 -1
- package/index.js +14 -14
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import EventHandler from "../../../utils/js/dom/event";
|
|
2
|
-
import Data from "../../../utils/js/dom/data";
|
|
3
|
-
|
|
4
|
-
const TABLE_SELECTOR = '[data-vg-table]';
|
|
5
|
-
const ROW_SELECTOR = 'tbody tr:not([data-group-header="1"])';
|
|
6
|
-
const ROW_CHECK_SELECTOR = '[data-row-select]';
|
|
7
|
-
const CHECK_ALL_SELECTOR = '[data-select-all]';
|
|
8
|
-
const DEFAULT_ROW_REORDER_HANDLE_SELECTOR = '[data-row-reorder-handle]';
|
|
9
|
-
const ROW_REORDER_IGNORE_SELECTOR = 'input, button, a, select, textarea, [contenteditable="true"]';
|
|
10
|
-
const TABLE_DATA_KEY = 'vg.dynamicTable';
|
|
1
|
+
import EventHandler from "../../../utils/js/dom/event";
|
|
2
|
+
import Data from "../../../utils/js/dom/data";
|
|
3
|
+
|
|
4
|
+
const TABLE_SELECTOR = '[data-vg-table]';
|
|
5
|
+
const ROW_SELECTOR = 'tbody tr:not([data-group-header="1"])';
|
|
6
|
+
const ROW_CHECK_SELECTOR = '[data-row-select]';
|
|
7
|
+
const CHECK_ALL_SELECTOR = '[data-select-all]';
|
|
8
|
+
const DEFAULT_ROW_REORDER_HANDLE_SELECTOR = '[data-row-reorder-handle]';
|
|
9
|
+
const ROW_REORDER_IGNORE_SELECTOR = 'input, button, a, select, textarea, [contenteditable="true"]';
|
|
10
|
+
const TABLE_DATA_KEY = 'vg.dynamicTable';
|
|
11
11
|
const ACTION_CALLBACK_MAP = {
|
|
12
12
|
rowcheck: 'onRowCheck',
|
|
13
13
|
checkall: 'onCheckAll',
|
|
@@ -403,12 +403,12 @@ class Editable {
|
|
|
403
403
|
: {};
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
static _getTableInstance(table) {
|
|
407
|
-
if (!table) {
|
|
408
|
-
return null;
|
|
409
|
-
}
|
|
410
|
-
return Data.get(table, TABLE_DATA_KEY);
|
|
411
|
-
}
|
|
406
|
+
static _getTableInstance(table) {
|
|
407
|
+
if (!table) {
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
return Data.get(table, TABLE_DATA_KEY);
|
|
411
|
+
}
|
|
412
412
|
|
|
413
413
|
static _getEventPrefix(table) {
|
|
414
414
|
const instance = this._getTableInstance(table);
|
|
@@ -431,8 +431,8 @@ class Editable {
|
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
|
|
434
|
-
EventHandler.on(document, 'DOMContentLoaded', () => {
|
|
435
|
-
Editable.initAll();
|
|
436
|
-
});
|
|
434
|
+
EventHandler.on(document, 'DOMContentLoaded', () => {
|
|
435
|
+
Editable.initAll();
|
|
436
|
+
});
|
|
437
437
|
|
|
438
438
|
export default Editable;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {normalizeNonNegativeInt, safeQuerySelector} from "./utils/common";
|
|
2
|
-
|
|
3
|
-
class Filters {
|
|
1
|
+
import {normalizeNonNegativeInt, safeQuerySelector} from "./utils/common";
|
|
2
|
+
|
|
3
|
+
class Filters {
|
|
4
4
|
constructor(options = {}) {
|
|
5
5
|
this._options = Object.assign({
|
|
6
6
|
enabled: true,
|
|
@@ -19,12 +19,12 @@ class Filters {
|
|
|
19
19
|
operatorAttr: 'data-filter-operator',
|
|
20
20
|
defaultOperator: 'eq',
|
|
21
21
|
skipEmpty: true,
|
|
22
|
-
trimValues: true,
|
|
23
|
-
emitOnInit: false,
|
|
24
|
-
initialValues: {},
|
|
25
|
-
onChange: null,
|
|
26
|
-
onReset: null,
|
|
27
|
-
}, options);
|
|
22
|
+
trimValues: true,
|
|
23
|
+
emitOnInit: false,
|
|
24
|
+
initialValues: {},
|
|
25
|
+
onChange: null,
|
|
26
|
+
onReset: null,
|
|
27
|
+
}, options);
|
|
28
28
|
|
|
29
29
|
this._form = null;
|
|
30
30
|
this._timer = null;
|
|
@@ -119,7 +119,7 @@ class Filters {
|
|
|
119
119
|
if (!selector) {
|
|
120
120
|
return null;
|
|
121
121
|
}
|
|
122
|
-
return safeQuerySelector(selector);
|
|
122
|
+
return safeQuerySelector(selector);
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
_handleInput(event) {
|
|
@@ -134,8 +134,8 @@ class Filters {
|
|
|
134
134
|
this._emit();
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
|
-
clearTimeout(this._timer);
|
|
138
|
-
this._timer = setTimeout(() => this._emit(), normalizeNonNegativeInt(this._options.debounceMs, 300));
|
|
137
|
+
clearTimeout(this._timer);
|
|
138
|
+
this._timer = setTimeout(() => this._emit(), normalizeNonNegativeInt(this._options.debounceMs, 300));
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
_handleChange(event) {
|
|
@@ -169,14 +169,14 @@ class Filters {
|
|
|
169
169
|
if (!resetButton) {
|
|
170
170
|
return;
|
|
171
171
|
}
|
|
172
|
-
event.preventDefault();
|
|
173
|
-
this._reset();
|
|
174
|
-
if (typeof this._options.onReset === 'function') {
|
|
175
|
-
this._options.onReset();
|
|
176
|
-
}
|
|
177
|
-
clearTimeout(this._timer);
|
|
178
|
-
this._emit();
|
|
179
|
-
}
|
|
172
|
+
event.preventDefault();
|
|
173
|
+
this._reset();
|
|
174
|
+
if (typeof this._options.onReset === 'function') {
|
|
175
|
+
this._options.onReset();
|
|
176
|
+
}
|
|
177
|
+
clearTimeout(this._timer);
|
|
178
|
+
this._emit();
|
|
179
|
+
}
|
|
180
180
|
|
|
181
181
|
_handleSubmit(event) {
|
|
182
182
|
if (!this._isManualMode()) {
|
|
@@ -441,7 +441,7 @@ class Filters {
|
|
|
441
441
|
const tag = String(node.tagName || '').toUpperCase();
|
|
442
442
|
return tag === 'INPUT' || tag === 'SELECT' || tag === 'TEXTAREA';
|
|
443
443
|
}
|
|
444
|
-
_isManualMode() {
|
|
444
|
+
_isManualMode() {
|
|
445
445
|
const mode = String(this._options.applyMode || 'auto').toLowerCase().trim();
|
|
446
446
|
return mode === 'manual';
|
|
447
447
|
}
|
|
@@ -13,56 +13,56 @@ const fixedColumnsMethods = {
|
|
|
13
13
|
return String(raw || '').trim();
|
|
14
14
|
},
|
|
15
15
|
|
|
16
|
-
_hasFixedColumnsConfig() {
|
|
17
|
-
const attr = this._getFixedColumnsConfigRaw();
|
|
18
|
-
if (attr !== '') {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
16
|
+
_hasFixedColumnsConfig() {
|
|
17
|
+
const attr = this._getFixedColumnsConfigRaw();
|
|
18
|
+
if (attr !== '') {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
21
|
const headers = this._element && this._element.tHead
|
|
22
22
|
? Array.from(this._element.tHead.querySelectorAll('th'))
|
|
23
23
|
: [];
|
|
24
24
|
return headers.some((header) => {
|
|
25
25
|
const fixedAttr = String(header.getAttribute('data-fixed') || '').toLowerCase().trim();
|
|
26
26
|
const fixedColumnAttr = String(header.getAttribute('data-fixed-column') || '').toLowerCase().trim();
|
|
27
|
-
return fixedAttr === 'left' || fixedAttr === 'right' || fixedColumnAttr === 'left' || fixedColumnAttr === 'right';
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
_buildFixedColumnsStateMap(fixed) {
|
|
32
|
-
const state = new Map();
|
|
33
|
-
const left = Array.isArray(fixed && fixed.left) ? fixed.left : [];
|
|
34
|
-
const right = Array.isArray(fixed && fixed.right) ? fixed.right : [];
|
|
35
|
-
left.forEach((index) => {
|
|
36
|
-
if (Number.isInteger(index) && index >= 0) {
|
|
37
|
-
state.set(index, 'left');
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
right.forEach((index) => {
|
|
41
|
-
if (Number.isInteger(index) && index >= 0 && !state.has(index)) {
|
|
42
|
-
state.set(index, 'right');
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return state;
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
_collectFixedColumnsTransitions(nextState) {
|
|
49
|
-
const previousState = this._fixedColumnsLastStateMap instanceof Map
|
|
50
|
-
? this._fixedColumnsLastStateMap
|
|
51
|
-
: new Map();
|
|
52
|
-
const transitions = [];
|
|
53
|
-
nextState.forEach((side, index) => {
|
|
54
|
-
if (previousState.get(index) !== side) {
|
|
55
|
-
transitions.push({ index, side });
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
this._fixedColumnsLastStateMap = nextState;
|
|
59
|
-
return transitions;
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
_applyFixedColumnsLayout() {
|
|
63
|
-
if (!this._element) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
27
|
+
return fixedAttr === 'left' || fixedAttr === 'right' || fixedColumnAttr === 'left' || fixedColumnAttr === 'right';
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
_buildFixedColumnsStateMap(fixed) {
|
|
32
|
+
const state = new Map();
|
|
33
|
+
const left = Array.isArray(fixed && fixed.left) ? fixed.left : [];
|
|
34
|
+
const right = Array.isArray(fixed && fixed.right) ? fixed.right : [];
|
|
35
|
+
left.forEach((index) => {
|
|
36
|
+
if (Number.isInteger(index) && index >= 0) {
|
|
37
|
+
state.set(index, 'left');
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
right.forEach((index) => {
|
|
41
|
+
if (Number.isInteger(index) && index >= 0 && !state.has(index)) {
|
|
42
|
+
state.set(index, 'right');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return state;
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
_collectFixedColumnsTransitions(nextState) {
|
|
49
|
+
const previousState = this._fixedColumnsLastStateMap instanceof Map
|
|
50
|
+
? this._fixedColumnsLastStateMap
|
|
51
|
+
: new Map();
|
|
52
|
+
const transitions = [];
|
|
53
|
+
nextState.forEach((side, index) => {
|
|
54
|
+
if (previousState.get(index) !== side) {
|
|
55
|
+
transitions.push({ index, side });
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
this._fixedColumnsLastStateMap = nextState;
|
|
59
|
+
return transitions;
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
_applyFixedColumnsLayout() {
|
|
63
|
+
if (!this._element) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
66
|
const suppressFixedColumns = Boolean(this._fixedColumnsSuppressed);
|
|
67
67
|
|
|
68
68
|
const sourceHeaders = this._element.tHead ? Array.from(this._element.tHead.querySelectorAll('th')) : [];
|
|
@@ -74,40 +74,40 @@ const fixedColumnsMethods = {
|
|
|
74
74
|
? { left: [], right: [] }
|
|
75
75
|
: this._applyMobileFixedColumnsGuard(this._element, sourceFixedRaw);
|
|
76
76
|
const hasSourceFixed = sourceFixed.left.length > 0 || sourceFixed.right.length > 0;
|
|
77
|
-
this._element.classList.toggle('table-fixed-cols', hasSourceFixed);
|
|
78
|
-
if (this._parent) {
|
|
79
|
-
this._parent.classList.toggle('table-fixed-cols', hasSourceFixed);
|
|
80
|
-
}
|
|
81
|
-
const sourceFixedTransitions = this._collectFixedColumnsTransitions(
|
|
82
|
-
this._buildFixedColumnsStateMap(sourceFixed)
|
|
83
|
-
);
|
|
84
|
-
this._applyFixedColumnsToTable(this._element, sourceFixed, {
|
|
85
|
-
includeBody: true,
|
|
86
|
-
emitAction: true,
|
|
87
|
-
transitionedColumns: sourceFixedTransitions,
|
|
88
|
-
});
|
|
89
|
-
this._toggleFixedColumnsScrollBinding(hasSourceFixed);
|
|
90
|
-
|
|
91
|
-
const cloneTable = this._cloneStickyState && this._cloneStickyState.table
|
|
92
|
-
? this._cloneStickyState.table
|
|
93
|
-
: null;
|
|
77
|
+
this._element.classList.toggle('table-fixed-cols', hasSourceFixed);
|
|
78
|
+
if (this._parent) {
|
|
79
|
+
this._parent.classList.toggle('table-fixed-cols', hasSourceFixed);
|
|
80
|
+
}
|
|
81
|
+
const sourceFixedTransitions = this._collectFixedColumnsTransitions(
|
|
82
|
+
this._buildFixedColumnsStateMap(sourceFixed)
|
|
83
|
+
);
|
|
84
|
+
this._applyFixedColumnsToTable(this._element, sourceFixed, {
|
|
85
|
+
includeBody: true,
|
|
86
|
+
emitAction: true,
|
|
87
|
+
transitionedColumns: sourceFixedTransitions,
|
|
88
|
+
});
|
|
89
|
+
this._toggleFixedColumnsScrollBinding(hasSourceFixed);
|
|
90
|
+
|
|
91
|
+
const cloneTable = this._cloneStickyState && this._cloneStickyState.table
|
|
92
|
+
? this._cloneStickyState.table
|
|
93
|
+
: null;
|
|
94
94
|
if (cloneTable) {
|
|
95
95
|
const cloneHeaders = cloneTable.tHead ? Array.from(cloneTable.tHead.querySelectorAll('th')) : [];
|
|
96
96
|
const cloneFixedRaw = this._getFixedColumnsByHeaders(cloneHeaders, {
|
|
97
97
|
parseTableAttr: false,
|
|
98
98
|
fallbackByPosition: false,
|
|
99
99
|
});
|
|
100
|
-
const cloneFixed = hasSourceFixed
|
|
101
|
-
? this._applyMobileFixedColumnsGuard(cloneTable, cloneFixedRaw)
|
|
102
|
-
: { left: [], right: [] };
|
|
103
|
-
this._applyFixedColumnsToTable(cloneTable, cloneFixed, {
|
|
104
|
-
includeBody: false,
|
|
105
|
-
emitAction: false,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
this._rebuildFixedColumnsCellsCache();
|
|
109
|
-
this._syncFixedColumnsScroll({ immediate: true });
|
|
110
|
-
},
|
|
100
|
+
const cloneFixed = hasSourceFixed
|
|
101
|
+
? this._applyMobileFixedColumnsGuard(cloneTable, cloneFixedRaw)
|
|
102
|
+
: { left: [], right: [] };
|
|
103
|
+
this._applyFixedColumnsToTable(cloneTable, cloneFixed, {
|
|
104
|
+
includeBody: false,
|
|
105
|
+
emitAction: false,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
this._rebuildFixedColumnsCellsCache();
|
|
109
|
+
this._syncFixedColumnsScroll({ immediate: true });
|
|
110
|
+
},
|
|
111
111
|
|
|
112
112
|
_applyMobileFixedColumnsGuard(table, fixed) {
|
|
113
113
|
const next = {
|
|
@@ -234,19 +234,19 @@ const fixedColumnsMethods = {
|
|
|
234
234
|
return { left, right };
|
|
235
235
|
},
|
|
236
236
|
|
|
237
|
-
_applyFixedColumnsToTable(table, fixed, options = {}) {
|
|
238
|
-
if (!table) {
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
const includeBody = options.includeBody !== false;
|
|
242
|
-
const shouldEmitAction = options.emitAction !== false;
|
|
243
|
-
const transitionedColumns = Array.isArray(options.transitionedColumns)
|
|
244
|
-
? options.transitionedColumns
|
|
245
|
-
: [];
|
|
246
|
-
const sections = [];
|
|
247
|
-
if (table.tHead) {
|
|
248
|
-
sections.push(table.tHead);
|
|
249
|
-
}
|
|
237
|
+
_applyFixedColumnsToTable(table, fixed, options = {}) {
|
|
238
|
+
if (!table) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
const includeBody = options.includeBody !== false;
|
|
242
|
+
const shouldEmitAction = options.emitAction !== false;
|
|
243
|
+
const transitionedColumns = Array.isArray(options.transitionedColumns)
|
|
244
|
+
? options.transitionedColumns
|
|
245
|
+
: [];
|
|
246
|
+
const sections = [];
|
|
247
|
+
if (table.tHead) {
|
|
248
|
+
sections.push(table.tHead);
|
|
249
|
+
}
|
|
250
250
|
if (includeBody && table.tBodies && table.tBodies.length) {
|
|
251
251
|
sections.push(...Array.from(table.tBodies));
|
|
252
252
|
}
|
|
@@ -282,17 +282,17 @@ const fixedColumnsMethods = {
|
|
|
282
282
|
? viewportMetrics.effectiveWidth
|
|
283
283
|
: tableRect.width;
|
|
284
284
|
const metrics = {};
|
|
285
|
-
headerCells.forEach((cell, index) => {
|
|
286
|
-
const rect = cell.getBoundingClientRect();
|
|
287
|
-
metrics[index] = {
|
|
288
|
-
width: Math.max(0, rect.width),
|
|
289
|
-
left: Math.max(0, rect.left - tableRect.left),
|
|
290
|
-
height: Math.max(0, rect.height),
|
|
291
|
-
top: Math.max(0, rect.top - tableRect.top),
|
|
292
|
-
};
|
|
293
|
-
});
|
|
294
|
-
const leftOffsets = {};
|
|
295
|
-
let leftOffset = 0;
|
|
285
|
+
headerCells.forEach((cell, index) => {
|
|
286
|
+
const rect = cell.getBoundingClientRect();
|
|
287
|
+
metrics[index] = {
|
|
288
|
+
width: Math.max(0, rect.width),
|
|
289
|
+
left: Math.max(0, rect.left - tableRect.left),
|
|
290
|
+
height: Math.max(0, rect.height),
|
|
291
|
+
top: Math.max(0, rect.top - tableRect.top),
|
|
292
|
+
};
|
|
293
|
+
});
|
|
294
|
+
const leftOffsets = {};
|
|
295
|
+
let leftOffset = 0;
|
|
296
296
|
fixed.left.forEach((index) => {
|
|
297
297
|
const width = metrics[index] ? metrics[index].width : 0;
|
|
298
298
|
leftOffsets[index] = leftOffset;
|
|
@@ -318,10 +318,10 @@ const fixedColumnsMethods = {
|
|
|
318
318
|
if (!cell) {
|
|
319
319
|
return;
|
|
320
320
|
}
|
|
321
|
-
const metric = metrics[index] || { left: 0 };
|
|
322
|
-
const baseShift = leftOffsets[index] - metric.left;
|
|
323
|
-
cell.setAttribute('data-fixed-side', 'left');
|
|
324
|
-
cell.setAttribute('data-fixed-shift', String(baseShift));
|
|
321
|
+
const metric = metrics[index] || { left: 0 };
|
|
322
|
+
const baseShift = leftOffsets[index] - metric.left;
|
|
323
|
+
cell.setAttribute('data-fixed-side', 'left');
|
|
324
|
+
cell.setAttribute('data-fixed-shift', String(baseShift));
|
|
325
325
|
cell.style.zIndex = String(zIndex);
|
|
326
326
|
if (index === leftEdgeIndex) {
|
|
327
327
|
cell.setAttribute('data-fixed-edge', 'right');
|
|
@@ -333,83 +333,83 @@ const fixedColumnsMethods = {
|
|
|
333
333
|
if (!cell) {
|
|
334
334
|
return;
|
|
335
335
|
}
|
|
336
|
-
const metric = metrics[index] || { left: 0, width: 0 };
|
|
337
|
-
const desiredLeft = viewportWidth - rightOffsets[index] - metric.width;
|
|
338
|
-
const baseShift = desiredLeft - metric.left;
|
|
339
|
-
cell.setAttribute('data-fixed-side', 'right');
|
|
336
|
+
const metric = metrics[index] || { left: 0, width: 0 };
|
|
337
|
+
const desiredLeft = viewportWidth - rightOffsets[index] - metric.width;
|
|
338
|
+
const baseShift = desiredLeft - metric.left;
|
|
339
|
+
cell.setAttribute('data-fixed-side', 'right');
|
|
340
340
|
cell.setAttribute('data-fixed-shift', String(baseShift));
|
|
341
341
|
cell.style.zIndex = String(zIndex);
|
|
342
342
|
if (index === rightEdgeIndex) {
|
|
343
343
|
cell.setAttribute('data-fixed-edge', 'left');
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
if (!shouldEmitAction || typeof this._emitAction !== 'function' || !transitionedColumns.length) {
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
transitionedColumns.forEach((entry) => {
|
|
353
|
-
const index = Number.isInteger(entry && entry.index) ? entry.index : -1;
|
|
354
|
-
const side = entry && (entry.side === 'left' || entry.side === 'right')
|
|
355
|
-
? entry.side
|
|
356
|
-
: '';
|
|
357
|
-
const headerCell = index >= 0 && index < headerCells.length
|
|
358
|
-
? headerCells[index]
|
|
359
|
-
: null;
|
|
360
|
-
if (!headerCell || !side) {
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
const metric = metrics[index] || { left: 0, width: 0, top: 0, height: 0 };
|
|
365
|
-
const width = metric.width || 0;
|
|
366
|
-
const height = metric.height || 0;
|
|
367
|
-
const left = side === 'left'
|
|
368
|
-
? (leftOffsets[index] || 0)
|
|
369
|
-
: Math.max(0, viewportWidth - (rightOffsets[index] || 0) - width);
|
|
370
|
-
const right = side === 'right'
|
|
371
|
-
? (rightOffsets[index] || 0)
|
|
372
|
-
: Math.max(0, viewportWidth - left - width);
|
|
373
|
-
const top = metric.top || 0;
|
|
374
|
-
const bottom = Math.max(0, tableRect.height - top - height);
|
|
375
|
-
const field = String(headerCell.getAttribute('data-field') || '').trim();
|
|
376
|
-
const fallbackBaseShift = left - (metric.left || 0);
|
|
377
|
-
const attrBaseShift = Number.parseFloat(headerCell.getAttribute('data-fixed-shift') || '');
|
|
378
|
-
const baseShift = Number.isFinite(attrBaseShift) ? attrBaseShift : fallbackBaseShift;
|
|
379
|
-
const scrollLeft = this._tableViewport ? (this._tableViewport.scrollLeft || 0) : 0;
|
|
380
|
-
const fixedAtTs = Date.now();
|
|
381
|
-
|
|
382
|
-
this._emitAction('columnfixed', {
|
|
383
|
-
columnIndex: index,
|
|
384
|
-
side,
|
|
385
|
-
phase: 'fixed',
|
|
386
|
-
field,
|
|
387
|
-
column: {
|
|
388
|
-
index,
|
|
389
|
-
side,
|
|
390
|
-
field,
|
|
391
|
-
width,
|
|
392
|
-
height,
|
|
393
|
-
element: headerCell,
|
|
394
|
-
},
|
|
395
|
-
offsets: {
|
|
396
|
-
left,
|
|
397
|
-
right,
|
|
398
|
-
top,
|
|
399
|
-
bottom,
|
|
400
|
-
},
|
|
401
|
-
shift: {
|
|
402
|
-
base: baseShift,
|
|
403
|
-
current: baseShift + scrollLeft,
|
|
404
|
-
scrollLeft,
|
|
405
|
-
},
|
|
406
|
-
fixedAt: {
|
|
407
|
-
timestamp: fixedAtTs,
|
|
408
|
-
iso: new Date(fixedAtTs).toISOString(),
|
|
409
|
-
},
|
|
410
|
-
});
|
|
411
|
-
});
|
|
412
|
-
},
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
if (!shouldEmitAction || typeof this._emitAction !== 'function' || !transitionedColumns.length) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
transitionedColumns.forEach((entry) => {
|
|
353
|
+
const index = Number.isInteger(entry && entry.index) ? entry.index : -1;
|
|
354
|
+
const side = entry && (entry.side === 'left' || entry.side === 'right')
|
|
355
|
+
? entry.side
|
|
356
|
+
: '';
|
|
357
|
+
const headerCell = index >= 0 && index < headerCells.length
|
|
358
|
+
? headerCells[index]
|
|
359
|
+
: null;
|
|
360
|
+
if (!headerCell || !side) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
const metric = metrics[index] || { left: 0, width: 0, top: 0, height: 0 };
|
|
365
|
+
const width = metric.width || 0;
|
|
366
|
+
const height = metric.height || 0;
|
|
367
|
+
const left = side === 'left'
|
|
368
|
+
? (leftOffsets[index] || 0)
|
|
369
|
+
: Math.max(0, viewportWidth - (rightOffsets[index] || 0) - width);
|
|
370
|
+
const right = side === 'right'
|
|
371
|
+
? (rightOffsets[index] || 0)
|
|
372
|
+
: Math.max(0, viewportWidth - left - width);
|
|
373
|
+
const top = metric.top || 0;
|
|
374
|
+
const bottom = Math.max(0, tableRect.height - top - height);
|
|
375
|
+
const field = String(headerCell.getAttribute('data-field') || '').trim();
|
|
376
|
+
const fallbackBaseShift = left - (metric.left || 0);
|
|
377
|
+
const attrBaseShift = Number.parseFloat(headerCell.getAttribute('data-fixed-shift') || '');
|
|
378
|
+
const baseShift = Number.isFinite(attrBaseShift) ? attrBaseShift : fallbackBaseShift;
|
|
379
|
+
const scrollLeft = this._tableViewport ? (this._tableViewport.scrollLeft || 0) : 0;
|
|
380
|
+
const fixedAtTs = Date.now();
|
|
381
|
+
|
|
382
|
+
this._emitAction('columnfixed', {
|
|
383
|
+
columnIndex: index,
|
|
384
|
+
side,
|
|
385
|
+
phase: 'fixed',
|
|
386
|
+
field,
|
|
387
|
+
column: {
|
|
388
|
+
index,
|
|
389
|
+
side,
|
|
390
|
+
field,
|
|
391
|
+
width,
|
|
392
|
+
height,
|
|
393
|
+
element: headerCell,
|
|
394
|
+
},
|
|
395
|
+
offsets: {
|
|
396
|
+
left,
|
|
397
|
+
right,
|
|
398
|
+
top,
|
|
399
|
+
bottom,
|
|
400
|
+
},
|
|
401
|
+
shift: {
|
|
402
|
+
base: baseShift,
|
|
403
|
+
current: baseShift + scrollLeft,
|
|
404
|
+
scrollLeft,
|
|
405
|
+
},
|
|
406
|
+
fixedAt: {
|
|
407
|
+
timestamp: fixedAtTs,
|
|
408
|
+
iso: new Date(fixedAtTs).toISOString(),
|
|
409
|
+
},
|
|
410
|
+
});
|
|
411
|
+
});
|
|
412
|
+
},
|
|
413
413
|
|
|
414
414
|
_toggleFixedColumnsScrollBinding(enabled) {
|
|
415
415
|
if (!this._tableViewport) {
|
|
@@ -436,12 +436,12 @@ const fixedColumnsMethods = {
|
|
|
436
436
|
}
|
|
437
437
|
this._fixedColumnsSyncFrame = 0;
|
|
438
438
|
this._fixedColumnsLastScrollLeft = 0;
|
|
439
|
-
this._fixedColumnsLastAppliedScrollLeft = Number.NaN;
|
|
440
|
-
this._fixedColumnsLastShadowStateKey = '';
|
|
441
|
-
this._fixedColumnsCellsCache = [];
|
|
442
|
-
this._fixedColumnsShadowTargetsCache = [];
|
|
443
|
-
this._fixedColumnsLastStateMap = new Map();
|
|
444
|
-
},
|
|
439
|
+
this._fixedColumnsLastAppliedScrollLeft = Number.NaN;
|
|
440
|
+
this._fixedColumnsLastShadowStateKey = '';
|
|
441
|
+
this._fixedColumnsCellsCache = [];
|
|
442
|
+
this._fixedColumnsShadowTargetsCache = [];
|
|
443
|
+
this._fixedColumnsLastStateMap = new Map();
|
|
444
|
+
},
|
|
445
445
|
|
|
446
446
|
_rebuildFixedColumnsCellsCache() {
|
|
447
447
|
const tables = [this._element];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {normalizeNonNegativeInt, safeQuerySelector} from "./utils/common";
|
|
2
|
-
|
|
3
|
-
class Search {
|
|
1
|
+
import {normalizeNonNegativeInt, safeQuerySelector} from "./utils/common";
|
|
2
|
+
|
|
3
|
+
class Search {
|
|
4
4
|
constructor(options = {}) {
|
|
5
5
|
this._options = Object.assign({
|
|
6
6
|
enabled: true,
|
|
@@ -27,10 +27,10 @@ class Search {
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const input = safeQuerySelector(selector);
|
|
31
|
-
if (!input) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
30
|
+
const input = safeQuerySelector(selector);
|
|
31
|
+
if (!input) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
34
|
|
|
35
35
|
this._input = input;
|
|
36
36
|
this._input.addEventListener('input', this._boundInput);
|
|
@@ -50,10 +50,10 @@ class Search {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
_handleInput() {
|
|
53
|
-
clearTimeout(this._timer);
|
|
54
|
-
this._timer = setTimeout(() => {
|
|
55
|
-
this._emit();
|
|
56
|
-
}, normalizeNonNegativeInt(this._options.debounceMs, 300));
|
|
53
|
+
clearTimeout(this._timer);
|
|
54
|
+
this._timer = setTimeout(() => {
|
|
55
|
+
this._emit();
|
|
56
|
+
}, normalizeNonNegativeInt(this._options.debounceMs, 300));
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
_handleKeyDown(event) {
|
|
@@ -76,7 +76,7 @@ class Search {
|
|
|
76
76
|
param: String(this._options.param || 'q'),
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
}
|
|
79
|
+
}
|
|
80
80
|
|
|
81
81
|
export default Search;
|
|
82
82
|
|