Skip to content

Commit d9f1905

Browse files
authored
Merge pull request #763 from devhus/main
CSS possibilities correction for BTable sort-icon (Very important for UX)
2 parents 3d6a81e + 4579948 commit d9f1905

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

packages/bootstrap-vue-3/src/components/BTable/BTable.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@
3636
:direction="sortDescBoolean ? 'desc' : 'asc'"
3737
>
3838
<span
39-
v-if="isSortable && field.sortable && field.key === sortBy"
40-
class="b-table-sort-icon text-muted small"
39+
v-if="isSortable && field.sortable"
40+
class="b-table-sort-icon"
41+
:class="{
42+
sorted: field.key === sortBy,
43+
[`sorted-${sortDescBoolean ? 'desc' : 'asc'}`]: field.key === sortBy,
44+
}"
4145
/>
4246
</slot>
4347
<div>

packages/bootstrap-vue-3/src/components/BTable/_table.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,11 @@
175175
}
176176

177177
&.b-table-sortable {
178-
&.b-table-sort-asc .b-table-sort-icon::before {
178+
&.b-table-sort-asc .sorted.b-table-sort-icon::before {
179179
content: "";
180180
}
181181

182-
&.b-table-sort-desc .b-table-sort-icon::before {
182+
&.b-table-sort-desc .sorted.b-table-sort-icon::before {
183183
content: "";
184184
}
185185
}

packages/bootstrap-vue-3/src/constants/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ declare var MozMutationObserver: any
33

44
export const HAS_WINDOW_SUPPORT = typeof window !== 'undefined'
55
export const HAS_DOCUMENT_SUPPORT = typeof document !== 'undefined'
6+
export const HAS_ELEMENT_SUPPORT = typeof Element !== 'undefined'
67
export const HAS_NAVIGATOR_SUPPORT = typeof navigator !== 'undefined'
78
export const HAS_PROMISE_SUPPORT = typeof Promise !== 'undefined'
89

packages/bootstrap-vue-3/src/utils/dom.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import {Comment, Slot, VNode} from 'vue'
2-
import {DOCUMENT} from '../constants/env'
2+
import {DOCUMENT, HAS_ELEMENT_SUPPORT} from '../constants/env'
33
import {AnimationFrame} from '../types/safeTypes'
44
import {HAS_WINDOW_SUPPORT} from './env'
55
import {toString} from './stringUtils'
66

7-
const ELEMENT_PROTO = Element.prototype
7+
const ELEMENT_PROTO = HAS_ELEMENT_SUPPORT ? Element.prototype : undefined
88

99
// See: https://developer.mozilla.org/en-US/docs/Web/API/Element/matches#Polyfill
1010
/* istanbul ignore next */
1111
export const matchesEl =
12-
ELEMENT_PROTO.matches ||
13-
(ELEMENT_PROTO as any).msMatchesSelector ||
14-
ELEMENT_PROTO.webkitMatchesSelector
12+
ELEMENT_PROTO?.matches ||
13+
(ELEMENT_PROTO as any)?.msMatchesSelector ||
14+
ELEMENT_PROTO?.webkitMatchesSelector
1515

1616
/**
1717
* @param el
@@ -214,8 +214,9 @@ export const matches = (el: Element, selector: string) =>
214214

215215
// See: https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
216216
/* istanbul ignore next */
217+
/* eslint-disable @typescript-eslint/no-this-alias */
217218
export const closestEl =
218-
ELEMENT_PROTO.closest ||
219+
ELEMENT_PROTO?.closest ||
219220
function (this: Element, sel: string) {
220221
let el = this
221222
if (!el) return null

0 commit comments

Comments
 (0)