3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-08-18 03:06:23 +00:00

Merge pull request #19460 from grokability/#19458-remove-bs-tables-sticky-column

Fixed #19458 - remove sticky column, fully remove BS tables sticky column extension
This commit is contained in:
snipe
2026-08-11 13:43:05 +01:00
committed by GitHub
42 changed files with 55 additions and 139 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -348,30 +348,6 @@ div.fixed-table-scroll-outer {
background: #212529;
}
.fixed-columns,
.fixed-columns-right {
position: absolute;
top: 0;
height: 100%;
background-color: #fff;
box-sizing: border-box;
z-index: 1;
}
.fixed-columns {
left: 0;
}
.fixed-columns .fixed-table-body {
overflow: hidden !important;
}
.fixed-columns-right {
right: 0;
}
.fixed-columns-right .fixed-table-body {
overflow-x: hidden !important;
}
/*
* dragtable
*

19
public/js/dist/all.js vendored
View File

@ -75173,11 +75173,12 @@ $(function () {
$('a[href="' + $(this).attr('href') + '"]').tab('show');
});
// Bootstrap-table's fixed-columns extension computes the overlay widths
// at init time. Tables inside a hidden tab pane initialize with a
// zero-width container and the fixed left/right columns never recover
// on their own once the pane becomes visible. Force a resetView on any
// snipe-tables inside the newly-shown pane so fixed columns line up.
// Tables inside a hidden tab pane initialize with a zero-width
// container, so their column widths and any sticky-column offsets
// computed from those widths never recover on their own once the
// pane becomes visible. Force a resetView on any snipe-tables
// inside the newly-shown pane so column widths + sticky offsets
// re-measure against the now-visible container.
$('body').on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
var pane = $(e.target).attr('href');
if (!pane) return;
@ -75188,10 +75189,10 @@ $(function () {
});
});
// Same story for viewport resizes: the fixed-columns overlay caches
// widths from the initial layout and doesn't recompute when the window
// width changes. Debounce so a drag-resize doesn't fire resetView on
// every intermediate pixel.
// Same story for viewport resizes: bootstrap-table caches column
// widths from the initial layout and doesn't recompute when the
// window width changes. Debounce so a drag-resize doesn't fire
// resetView on every intermediate pixel.
var snipeTableResizeTimer;
$(window).on('resize', function () {
clearTimeout(snipeTableResizeTimer);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{
"/js/dist/all.js": "/js/dist/all.js?id=887f92c73daf3875484043cb9d406cef",
"/js/dist/all.js": "/js/dist/all.js?id=f00faad4ec2747af7dd5492bf173cf4c",
"/css/build/overrides.css": "/css/build/overrides.css?id=ce53e45204847df139bd67cb165195f2",
"/css/build/app.css": "/css/build/app.css?id=fe990b9e061d607ad3a33ddb38f0f837",
"/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=ee0ed88465dd878588ed044eefb67723",
@ -77,6 +77,6 @@
"/js/dist/bootstrap-table-locale-all.min.js": "/js/dist/bootstrap-table-locale-all.min.js?id=d300041b9e5038b45b68e036add83be4",
"/js/dist/bootstrap-table-en-US.min.js": "/js/dist/bootstrap-table-en-US.min.js?id=6d0de12d91548ba2cd80b868838ce5fa",
"/js/dist/Chart.min.js": "/js/dist/Chart.min.js?id=9b1ae20c4c7048d6e4a1b2e1aee7fb31",
"/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=82b56573f8098e439bf14ccb4530de6e",
"/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=e1531ba4cea2a4a3b966751c2870a8e0"
"/css/dist/bootstrap-table.css": "/css/dist/bootstrap-table.css?id=9def0b5d3b891ac3669b3b7aa7e805ce",
"/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=e11e0fff41162f5df87cfcb075f9e821"
}

View File

@ -667,11 +667,12 @@ $(function () {
$('a[href="' + $(this).attr('href') + '"]').tab('show');
});
// Bootstrap-table's fixed-columns extension computes the overlay widths
// at init time. Tables inside a hidden tab pane initialize with a
// zero-width container and the fixed left/right columns never recover
// on their own once the pane becomes visible. Force a resetView on any
// snipe-tables inside the newly-shown pane so fixed columns line up.
// Tables inside a hidden tab pane initialize with a zero-width
// container, so their column widths and any sticky-column offsets
// computed from those widths never recover on their own once the
// pane becomes visible. Force a resetView on any snipe-tables
// inside the newly-shown pane so column widths + sticky offsets
// re-measure against the now-visible container.
$('body').on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
var pane = $(e.target).attr('href');
if (!pane) return;
@ -682,10 +683,10 @@ $(function () {
});
});
// Same story for viewport resizes: the fixed-columns overlay caches
// widths from the initial layout and doesn't recompute when the window
// width changes. Debounce so a drag-resize doesn't fire resetView on
// every intermediate pixel.
// Same story for viewport resizes: bootstrap-table caches column
// widths from the initial layout and doesn't recompute when the
// window width changes. Debounce so a drag-resize doesn't fire
// resetView on every intermediate pixel.
var snipeTableResizeTimer;
$(window).on('resize', function () {
clearTimeout(snipeTableResizeTimer);

View File

@ -2345,14 +2345,17 @@ table rows
// -----------------------------------------------------------------------------
// CSS-sticky replacement for bootstrap-table's fixed-columns extension.
// CSS sticky columns. Bootstrap-table's fixed-columns feature was pulled
// from the bundle in favor of this — the old feature cloned the table
// body into an absolutely-positioned overlay, which drifted in height
// with long-content rows (#19197, #19458) and misplaced tooltips when
// the container reflowed without a window resize (asset show + info
// panel toggle). CSS position:sticky on the actual <td> cells can't
// drift because the cells ARE the pinned cells.
//
// Tables that pass use_sticky_css to <x-table> get one of these classes
// (snipe-table--sticky-right-N / snipe-table--sticky-left-N) instead of the
// extension's data-fixed-columns=true. The extension clones the table body
// into an absolutely-positioned overlay, which drifts in height with
// long-content rows (#19197) and misplaces tooltips when the container
// reflows without a window resize (asset show + info panel toggle).
// Tables that want pinned columns get the snipe-table--sticky-right-N
// or snipe-table--sticky-left-N class (via <x-table>'s fixed_number /
// fixed_right_number props, or applied directly on a raw table).
//
// Body cells match the zebra background so the sticky column keeps the
// alternating pattern. Header cells use --box-bg so scrolling body rows

View File

@ -24,7 +24,6 @@
:$presenter
:$fixed_right_number
:$fixed_number
use_sticky_css
show_column_search="true"
show_advanced_search="true"
buttons="accessoryButtons"

View File

@ -25,7 +25,6 @@
:presenter="\App\Presenters\AssetPresenter::dataTableLayout($status_type !== 'Deleted' ? ['deleted_at'] : [])"
:$fixed_right_number
:$fixed_number
use_sticky_css
show_column_search="true"
show_advanced_search="true"
buttons="assetButtons"

View File

@ -10,7 +10,6 @@
<x-table
:$presenter
:$fixed_right_number
use_sticky_css
show_column_search="true"
show_advanced_search="false"
buttons="companyButtons"

View File

@ -19,7 +19,6 @@
:$presenter
:$fixed_right_number
:$fixed_number
use_sticky_css
show_column_search="true"
show_advanced_search="true"
buttons="componentButtons"

View File

@ -18,7 +18,6 @@
:$presenter
:$fixed_right_number
:$fixed_number
use_sticky_css
show_column_search="true"
show_advanced_search="true"
buttons="consumableButtons"

View File

@ -10,25 +10,22 @@
'fixed_right_number' => null,
'sort_order' => 'asc',
'sort_field' => 'name',
'nosticky' => false,
'use_sticky_css' => false,
])
@aware(['name'])
{{-- When use_sticky_css is on, the bootstrap-table fixed-columns
extension is disabled (data-fixed-columns=false) and we pin the
first / last N columns via CSS position:sticky instead. Sidesteps
the clone-and-overlay approach that misplaces tooltips when the
container reflows (see /hardware/2600#maintenances + info panel
toggle) and drifts in height with long-content rows. Matching CSS
lives in overrides.less under `.snipe-table--sticky-*-N`. --}}
{{-- fixed_number / fixed_right_number pin the first / last N columns
via CSS position:sticky (snipe-table--sticky-*-N in overrides.less).
The bootstrap-table fixed-columns feature that used to handle this
was pulled from the bundle its clone-and-overlay approach
misplaced tooltips when the container reflowed and drifted in
height with long-content rows. --}}
<table
role="table"
@class([
'table', 'table-striped', 'snipe-table',
'snipe-table--sticky-right-' . $fixed_right_number => $use_sticky_css && $fixed_right_number,
'snipe-table--sticky-left-' . $fixed_number => $use_sticky_css && $fixed_number,
'snipe-table--sticky-right-' . $fixed_right_number => (bool) $fixed_right_number,
'snipe-table--sticky-left-' . $fixed_number => (bool) $fixed_number,
])
data-cookie-id-table="{{ $name }}ListingTable"
data-id-table="{{ $name }}ListingTable"
@ -51,16 +48,6 @@
data-columns="{{ $presenter }}"
@endif
data-fixed-columns="{{ (! $use_sticky_css && (($fixed_number) || ($fixed_right_number) || ($nosticky!='true'))) ? 'true' : 'false' }}"
@if ($fixed_number && ! $use_sticky_css)
data-fixed-number="{{ $fixed_number }}"
@endif
@if ($fixed_right_number && ! $use_sticky_css)
data-fixed-right-number="{{ $fixed_right_number }}"
@endif
@if ($buttons)
data-buttons="{{ $buttons }}"
@endif

View File

@ -23,7 +23,6 @@
:$presenter
:$fixed_right_number
:$fixed_number
use_sticky_css
:$show_search
:$show_column_search
:$show_advanced_search

View File

@ -17,7 +17,6 @@
<x-table
:$presenter
:$fixed_right_number
use_sticky_css
show_column_search="true"
show_advanced_search="false"
buttons="locationButtons"

View File

@ -18,7 +18,6 @@
<x-table
:fixed_right_number="$fixed_right_number"
:fixed_number="$fixed_number"
use_sticky_css
buttons="maintenanceButtons"
api_url="{{ $route ?? route('api.maintenances.index') }}"
:presenter="\App\Presenters\MaintenancesPresenter::dataTableLayout()"

View File

@ -21,7 +21,6 @@
:$presenter
:$fixed_right_number
:$fixed_number
use_sticky_css
buttons="modelButtons"
api_url="{{ $route }}"
export_filename="export-models-{{ date('Y-m-d') }}"

View File

@ -21,7 +21,6 @@
:$presenter
:$fixed_right_number
:$fixed_number
use_sticky_css
show_column_search="true"
show_advanced_search="true"
buttons="userButtons"

View File

@ -21,7 +21,6 @@
buttons="categoryButtons"
fixed_right_number="1"
fixed_number="1"
use_sticky_css
show_advanced_search="true"
api_url="{{ route('api.categories.index') }}"
:presenter="\App\Presenters\CategoryPresenter::dataTableLayout()"

View File

@ -20,7 +20,6 @@
buttons="companyButtons"
fixed_right_number="1"
fixed_number="1"
use_sticky_css
api_url="{{ route('api.companies.index') }}"
:presenter="\App\Presenters\CompanyPresenter::dataTableLayout()"
export_filename="export-companies-{{ date('Y-m-d') }}"

View File

@ -30,7 +30,6 @@
data-show-refresh="false"
data-sort-name="name"
data-advanced-search="false"
data-fixed-columns="false"
id="customFieldsetTable"
data-buttons="customFieldsetButtons"
class="table table-striped snipe-table snipe-table--sticky-right-1"
@ -115,7 +114,6 @@
data-sort-order="asc"
data-sort-name="name"
data-show-refresh="false"
data-fixed-columns="false"
id="customFieldsTable"
data-advanced-search="false"
data-buttons="customFieldButtons"

View File

@ -234,8 +234,6 @@
data-id-table="dashActivityReport"
data-sort-order="desc"
data-show-columns="false"
data-fixed-number="false"
data-fixed-right-number="false"
data-sort-name="created_at"
id="dashActivityReport"
class="table table-striped snipe-table"
@ -312,8 +310,6 @@
data-side-pagination="server"
data-sort-order="desc"
data-show-columns="false"
data-fixed-number="false"
data-fixed-right-number="false"
data-sort-field="assets_count"
id="dashCompanySummary"
class="table table-striped snipe-table"
@ -381,8 +377,6 @@
data-side-pagination="server"
data-pagination="false"
data-sort-order="desc"
data-fixed-number="false"
data-fixed-right-number="false"
data-sort-field="assets_count"
id="dashLocationSummary"
data-show-columns="false"
@ -445,8 +439,6 @@
data-pagination="false"
data-side-pagination="server"
data-show-columns="false"
data-fixed-number="false"
data-fixed-right-number="false"
data-sort-order="desc"
data-sort-field="assets_count"
id="dashCategorySummary"

View File

@ -21,7 +21,6 @@
buttons="departmentButtons"
fixed_right_number="1"
fixed_number="1"
use_sticky_css
api_url="{{ route('api.departments.index') }}"
:presenter="\App\Presenters\DepartmentPresenter::dataTableLayout()"
export_filename="export-departments-{{ date('Y-m-d') }}"

View File

@ -22,7 +22,6 @@
buttons="depreciationButtons"
fixed_right_number="1"
fixed_number="1"
use_sticky_css
api_url="{{ route('api.depreciations.index') }}"
:presenter="\App\Presenters\DepreciationPresenter::dataTableLayout()"
export_filename="export-depreciations-{{ date('Y-m-d') }}"

View File

@ -19,7 +19,6 @@
buttons="groupButtons"
fixed_right_number="1"
fixed_number="1"
use_sticky_css
api_url="{{ route('api.groups.index') }}"
:presenter="\App\Presenters\GroupPresenter::dataTableLayout()"
export_filename="export-groups-{{ date('Y-m-d') }}"

View File

@ -16,7 +16,6 @@
:presenter="\App\Presenters\PredefinedKitPresenter::dataTableLayout()"
:fixed_number="1"
:fixed_right_number="2"
use_sticky_css
buttons="kitButtons"
api_url="{{ route('api.kits.index') }}"
export_filename="export-kits-{{ date('Y-m-d') }}"

View File

@ -60,7 +60,6 @@
<x-table
fixed_right_number="1"
fixed_number="1"
use_sticky_css
api_url="{{ route('api.licenses.seats.index', [$license->id, 'status' => 'assigned']) }}"
:presenter="\App\Presenters\LicensePresenter::dataTableLayoutSeats()"
export_filename="export-{{ str_slug($license->name) }}-assigned-{{ date('Y-m-d') }}"

View File

@ -12,9 +12,9 @@
<x-box name="locations">
{{-- Convert hand-rolled <table> to the shared x-table.locations
component so sticky-column CSS (snipe-table--sticky-right-1)
and use_sticky_css are wired the same way as every other
list page. Preserves the company_id / status query-string
filtering the index has always supported. --}}
is wired the same way as every other list page. Preserves
the company_id / status query-string filtering the index
has always supported. --}}
<x-table.locations :route="route('api.locations.index', ['company_id' => e(request('company_id')), 'status' => e(request('status'))])" />
</x-box>
</x-container>

View File

@ -15,7 +15,6 @@
buttons="maintenanceTypeButtons"
fixed_right_number="1"
fixed_number="1"
use_sticky_css
api_url="{{ route('api.maintenance-types.index') }}"
:presenter="\App\Presenters\MaintenanceTypePresenter::dataTableLayout()"
export_filename="export-maintenance-types-{{ date('Y-m-d') }}"

View File

@ -34,7 +34,6 @@
buttons="manufacturerButtons"
fixed_right_number="1"
fixed_number="1"
use_sticky_css
api_url="{{ route('api.manufacturers.index') }}"
:presenter="\App\Presenters\ManufacturerPresenter::dataTableLayout()"
export_filename="export-manufacturers-{{ date('Y-m-d') }}"

View File

@ -30,7 +30,6 @@
buttons="modelButtons"
fixed_right_number="2"
fixed_number="1"
use_sticky_css
toolbar_id="modelsToolbar"
api_url="{{ route('api.models.index', ['status' => e(request('status'))]) }}"
:presenter="\App\Presenters\AssetModelPresenter::dataTableLayout()"

View File

@ -827,8 +827,6 @@
showSearchClearButton: data_with_default('show-search-clear-button', true),
sortName: data_with_default('sort-name', 'created_at'),
sortOrder: data_with_default('sort-order', 'desc'),
fixedColumns: data_with_default('fixed-columns', 'true'),
fixedRightNumber: data_with_default('fixed-right-number', '1'),
stickyHeader: true,
stickyHeaderOffsetLeft: parseInt($('body').css('padding-left'), 10),
stickyHeaderOffsetRight: parseInt($('body').css('padding-right'), 10),
@ -3387,12 +3385,12 @@
// document.ready callback runs anywhere.
// -----------------------------------------------------------------
// Tables opted into use_sticky_css (see blade/table/index.blade.php)
// pin the first / last N columns via position:sticky. Each pinned
// column needs a right/left offset equal to the cumulative outerWidth
// of the pinned columns outside it, otherwise they all stack at the
// edge. The offsets are per-column and can change on column-toggle
// and window resize, so recompute after every render + resize.
// Tables that carry a snipe-table--sticky-right-N or -left-N class
// pin those columns via position:sticky. Each pinned column needs a
// right/left offset equal to the cumulative outerWidth of the
// pinned columns outside it, otherwise they all stack at the edge.
// The offsets are per-column and can change on column-toggle and
// window resize, so recompute after every render + resize.
function updateStickyColumnOffsets(root) {
var $targets = root ? $(root).filter('.snipe-table') : $('.snipe-table');
$targets.each(function () {

View File

@ -14,7 +14,6 @@
data-id-field="name"
data-side-pagination="server"
data-sort-name="name"
data-fixed-columns="false"
data-sort-order="asc"
data-url="{{ route('api.labels.index') }}"
id="label2TemplateTable"

View File

@ -20,7 +20,6 @@
@section('content')
<x-container>
<x-box>
<table
data-columns="{{ \App\Presenters\HistoryPresenter::dataTableLayout() }}"
data-cookie-id-table="activityReport"
@ -31,7 +30,7 @@
data-sort-name="created_at"
id="activityReport"
data-url="{{ route('api.activity.index') }}"
class="table table-striped snipe-table"
class="table table-striped snipe-table snipe-table--sticky-right-1"
data-export-options='{
"fileName": "activity-report-{{ date('Y-m-d') }}",
"ignoreColumn": ["actions","image","change","checkbox","checkincheckout","icon"]

View File

@ -21,7 +21,7 @@
data-sort-order="asc"
id="auditReport"
data-url="{{ route('api.activity.index', ['action_type' => 'audit']) }}"
class="table table-striped snipe-table"
class="table table-striped snipe-table snipe-table--sticky-right-1"
data-advanced-search="false"
data-export-options='{
"fileName": "activity-report-{{ date('Y-m-d') }}",

View File

@ -12,7 +12,6 @@
<x-box>
<x-table
nosticky="true"
name="maintenanceReport"
api_url="{{ route('api.maintenances.index', ['format' => 'flat']) }}"
:presenter="\App\Presenters\MaintenancesPresenter::reportLayout()"

View File

@ -42,8 +42,6 @@
data-sort-name="created_at"
data-advanced-search="false"
id="unacceptedAssetsReport"
data-fixed-number="false"
data-fixed-right-number="false"
class="table table-striped snipe-table"
data-export-options='{
"fileName": "maintenance-report-{{ date('Y-m-d') }}",

View File

@ -22,7 +22,6 @@
buttons="statuslabelButtons"
fixed_right_number="1"
fixed_number="1"
use_sticky_css
api_url="{{ route('api.statuslabels.index') }}"
:presenter="\App\Presenters\StatusLabelPresenter::dataTableLayout()"
export_filename="export-statuslabels-{{ date('Y-m-d') }}"

View File

@ -21,7 +21,6 @@
buttons="supplierButtons"
fixed_right_number="1"
fixed_number="1"
use_sticky_css
api_url="{{ route('api.suppliers.index') }}"
:presenter="\App\Presenters\SupplierPresenter::dataTableLayout()"
export_filename="export-suppliers-{{ date('Y-m-d') }}"

View File

@ -99,7 +99,6 @@ mix
[
"./node_modules/bootstrap-table/dist/bootstrap-table.css",
"./node_modules/bootstrap-table/dist/extensions/sticky-header/bootstrap-table-sticky-header.css",
"./node_modules/bootstrap-table/dist/extensions/fixed-columns/bootstrap-table-fixed-columns.css",
"./resources/assets/css/dragtable.css",
],
"public/css/dist/bootstrap-table.css"
@ -118,7 +117,6 @@ mix
'./node_modules/bootstrap-table/dist/extensions/export/bootstrap-table-export.js',
'./node_modules/bootstrap-table/dist/extensions/cookie/bootstrap-table-cookie.js',
'./node_modules/bootstrap-table/dist/extensions/sticky-header/bootstrap-table-sticky-header.js',
'./node_modules/bootstrap-table/dist/extensions/fixed-columns/bootstrap-table-fixed-columns.min.js',
'./node_modules/bootstrap-table/dist/extensions/addrbar/bootstrap-table-addrbar.js',
'./node_modules/bootstrap-table/dist/extensions/print/bootstrap-table-print.min.js',
'./node_modules/bootstrap-table/dist/extensions/custom-view/bootstrap-table-custom-view.js',