vgapp 1.3.9 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/modules/vgdynamictable/js/options.js +8 -4
- package/app/modules/vgdynamictable/js/vgdynamictable.js +79 -38
- package/app/modules/vgdynamictable/scss/vgdynamictable.scss +13 -10
- 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/package.json +1 -1
|
@@ -401,10 +401,14 @@ const DEFAULT_OPTIONS = {
|
|
|
401
401
|
// Отступ сверху для sticky-header (px).
|
|
402
402
|
// data-атрибуты: data-sticky-header-top-offset | data-stickyHeader-top
|
|
403
403
|
top: 0,
|
|
404
|
-
// Максимальная высота viewport таблицы.
|
|
405
|
-
// data-атрибуты: data-sticky-header-max-height | data-stickyHeader-max
|
|
406
|
-
max: 0,
|
|
407
|
-
|
|
404
|
+
// Максимальная высота viewport таблицы.
|
|
405
|
+
// data-атрибуты: data-sticky-header-max-height | data-stickyHeader-max
|
|
406
|
+
max: 0,
|
|
407
|
+
// Рендерить отдельный sticky clone вместо sticky th.
|
|
408
|
+
// По умолчанию наследует stickyHeader.enable.
|
|
409
|
+
// data-attributes: data-sticky-header-clone
|
|
410
|
+
clone: null,
|
|
411
|
+
},
|
|
408
412
|
|
|
409
413
|
search: {
|
|
410
414
|
// Canonical key for enable flag.
|
|
@@ -3026,12 +3026,34 @@ class VGDynamicTable extends BaseModule {
|
|
|
3026
3026
|
return false;
|
|
3027
3027
|
}
|
|
3028
3028
|
|
|
3029
|
-
_isCloneStickyHeaderEnabled() {
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3029
|
+
_isCloneStickyHeaderEnabled() {
|
|
3030
|
+
const sticky = this._params.stickyHeader || {};
|
|
3031
|
+
const cloneAttr = this._element.getAttribute('data-sticky-header-clone');
|
|
3032
|
+
if (cloneAttr !== null) {
|
|
3033
|
+
const normalized = String(cloneAttr).toLowerCase().trim();
|
|
3034
|
+
return normalized !== 'false' && normalized !== '0';
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
if (sticky.clone !== undefined && sticky.clone !== null) {
|
|
3038
|
+
const normalized = String(sticky.clone).toLowerCase().trim();
|
|
3039
|
+
if (normalized === 'true' || normalized === '1') {
|
|
3040
|
+
return true;
|
|
3041
|
+
}
|
|
3042
|
+
if (normalized === 'false' || normalized === '0') {
|
|
3043
|
+
return false;
|
|
3044
|
+
}
|
|
3045
|
+
return Boolean(sticky.clone);
|
|
3046
|
+
}
|
|
3047
|
+
|
|
3048
|
+
if (this._parent && this._parent.classList.contains('table-sticky')) {
|
|
3049
|
+
return true;
|
|
3050
|
+
}
|
|
3051
|
+
if (this._element && this._element.classList.contains('table-sticky')) {
|
|
3052
|
+
return true;
|
|
3053
|
+
}
|
|
3054
|
+
|
|
3055
|
+
return this._isStickyHeaderEnabled();
|
|
3056
|
+
}
|
|
3035
3057
|
|
|
3036
3058
|
_refreshStickyAndFixedLayout(options = {}) {
|
|
3037
3059
|
const immediate = Boolean(options && options.immediate);
|
|
@@ -3137,12 +3159,13 @@ class VGDynamicTable extends BaseModule {
|
|
|
3137
3159
|
};
|
|
3138
3160
|
}
|
|
3139
3161
|
|
|
3140
|
-
_getCloneStickyHeaderOffsets() {
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3162
|
+
_getCloneStickyHeaderOffsets() {
|
|
3163
|
+
const configured = this._getStickyHeaderOffsets();
|
|
3164
|
+
return {
|
|
3165
|
+
top: configured.top || this._readCssSizeVar('--vgdt-sticky-top', 0),
|
|
3166
|
+
maxHeight: configured.maxHeight || this._readCssSizeVar('--vgdt-sticky-max-height', 0),
|
|
3167
|
+
};
|
|
3168
|
+
}
|
|
3146
3169
|
|
|
3147
3170
|
_readCssSizeVar(name, fallback = 0) {
|
|
3148
3171
|
const sources = [this._parent, this._element, this._tableViewport].filter(Boolean);
|
|
@@ -3235,12 +3258,13 @@ class VGDynamicTable extends BaseModule {
|
|
|
3235
3258
|
}
|
|
3236
3259
|
if (state && state.headerWrap && state.headerWrap.parentElement) {
|
|
3237
3260
|
state.headerWrap.parentElement.removeChild(state.headerWrap);
|
|
3238
|
-
}
|
|
3239
|
-
this._cloneStickyState = null;
|
|
3240
|
-
this._parent.style.removeProperty('--vgdt-sticky-clone-height');
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
scrollTarget.
|
|
3261
|
+
}
|
|
3262
|
+
this._cloneStickyState = null;
|
|
3263
|
+
this._parent.style.removeProperty('--vgdt-sticky-clone-height');
|
|
3264
|
+
this._parent.style.removeProperty('--vgdt-sticky-top');
|
|
3265
|
+
if (scrollTarget && !this._isStickyHeaderEnabled()) {
|
|
3266
|
+
scrollTarget.classList.remove('table-sticky-scroll');
|
|
3267
|
+
scrollTarget.style.removeProperty('--vgdt-sticky-max-height');
|
|
3244
3268
|
}
|
|
3245
3269
|
this._updateLayoutResizeBinding();
|
|
3246
3270
|
return;
|
|
@@ -3252,10 +3276,11 @@ class VGDynamicTable extends BaseModule {
|
|
|
3252
3276
|
|
|
3253
3277
|
const offsets = this._getCloneStickyHeaderOffsets();
|
|
3254
3278
|
|
|
3255
|
-
if (scrollTarget) {
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
scrollTarget.
|
|
3279
|
+
if (scrollTarget) {
|
|
3280
|
+
this._parent.style.setProperty('--vgdt-sticky-top', `${offsets.top}px`);
|
|
3281
|
+
if (offsets.maxHeight > 0) {
|
|
3282
|
+
scrollTarget.classList.add('table-sticky-scroll');
|
|
3283
|
+
scrollTarget.style.setProperty('--vgdt-sticky-max-height', `${offsets.maxHeight}px`);
|
|
3259
3284
|
} else {
|
|
3260
3285
|
scrollTarget.classList.remove('table-sticky-scroll');
|
|
3261
3286
|
scrollTarget.style.removeProperty('--vgdt-sticky-max-height');
|
|
@@ -3693,17 +3718,20 @@ class VGDynamicTable extends BaseModule {
|
|
|
3693
3718
|
this._refreshStickyAndFixedLayout();
|
|
3694
3719
|
}
|
|
3695
3720
|
|
|
3696
|
-
_scrollToPaginationTop() {
|
|
3697
|
-
if (!this._isPaginationScrollToTopEnabled()) {
|
|
3698
|
-
return;
|
|
3699
|
-
}
|
|
3700
|
-
if (this._tableViewport) {
|
|
3701
|
-
this._tableViewport.scrollTop = 0;
|
|
3702
|
-
this._tableViewport.scrollLeft = 0;
|
|
3703
|
-
}
|
|
3704
|
-
if (
|
|
3705
|
-
return;
|
|
3706
|
-
}
|
|
3721
|
+
_scrollToPaginationTop() {
|
|
3722
|
+
if (!this._isPaginationScrollToTopEnabled()) {
|
|
3723
|
+
return;
|
|
3724
|
+
}
|
|
3725
|
+
if (this._tableViewport) {
|
|
3726
|
+
this._tableViewport.scrollTop = 0;
|
|
3727
|
+
this._tableViewport.scrollLeft = 0;
|
|
3728
|
+
}
|
|
3729
|
+
if (this._hasFixedHeightViewport()) {
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3732
|
+
if (typeof window === 'undefined' || !this._parent) {
|
|
3733
|
+
return;
|
|
3734
|
+
}
|
|
3707
3735
|
|
|
3708
3736
|
const targetTop = this._getPaginationScrollTopTarget();
|
|
3709
3737
|
const currentTop = window.pageYOffset || window.scrollY || 0;
|
|
@@ -3720,11 +3748,24 @@ class VGDynamicTable extends BaseModule {
|
|
|
3720
3748
|
window.scrollTo({
|
|
3721
3749
|
top: Math.max(0, Math.round(targetTop)),
|
|
3722
3750
|
behavior: prefersReducedMotion ? 'auto' : 'smooth',
|
|
3723
|
-
});
|
|
3724
|
-
}
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
if (this.
|
|
3751
|
+
});
|
|
3752
|
+
}
|
|
3753
|
+
|
|
3754
|
+
_hasFixedHeightViewport() {
|
|
3755
|
+
if (this._tableViewport && this._tableViewport.classList.contains('table-sticky-scroll')) {
|
|
3756
|
+
return true;
|
|
3757
|
+
}
|
|
3758
|
+
|
|
3759
|
+
const offsets = this._getStickyHeaderOffsets();
|
|
3760
|
+
if (offsets.maxHeight > 0) {
|
|
3761
|
+
return true;
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3764
|
+
return this._readCssSizeVar('--vgdt-sticky-max-height', 0) > 0;
|
|
3765
|
+
}
|
|
3766
|
+
|
|
3767
|
+
_getPaginationScrollTopTarget() {
|
|
3768
|
+
if (this._isPaginationScrollToWindowTopEnabled()) {
|
|
3728
3769
|
return 0;
|
|
3729
3770
|
}
|
|
3730
3771
|
const rect = this._parent.getBoundingClientRect();
|
|
@@ -155,12 +155,14 @@
|
|
|
155
155
|
&.table-sticky-head {
|
|
156
156
|
overflow: visible;
|
|
157
157
|
|
|
158
|
-
.vgdt-table-viewport > table {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
158
|
+
.vgdt-table-viewport > table {
|
|
159
|
+
overflow: visible;
|
|
160
|
+
|
|
161
|
+
thead th {
|
|
162
|
+
position: sticky;
|
|
163
|
+
top: var(--vgdt-sticky-top, 0px);
|
|
164
|
+
z-index: 3;
|
|
165
|
+
background: var(--vg-dynamic-table-header-background);
|
|
164
166
|
box-shadow: 0 1px 0 var(--vg-dynamic-table-cell-border-color);
|
|
165
167
|
}
|
|
166
168
|
|
|
@@ -258,10 +260,11 @@
|
|
|
258
260
|
overflow: auto;
|
|
259
261
|
}
|
|
260
262
|
|
|
261
|
-
.vgdt-table-viewport > table {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
.vgdt-table-viewport > table {
|
|
264
|
+
overflow: visible;
|
|
265
|
+
margin-top: calc(-1 * var(--vgdt-sticky-clone-height, 0px));
|
|
266
|
+
}
|
|
267
|
+
}
|
|
265
268
|
|
|
266
269
|
}
|
|
267
270
|
|