A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bootstrap-vue/bootstrap-vue/commit/030a3d8 below:

fix delegated event handlers whe… · bootstrap-vue/bootstrap-vue@030a3d8 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+23

-17

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+23

-17

lines changed Original file line number Diff line number Diff line change

@@ -205,12 +205,12 @@ export default {

205 205

// rows index within the tbody.

206 206

// See: https://github.com/bootstrap-vue/bootstrap-vue/issues/2410

207 207

const primaryKey = this.primaryKey

208 -

const hasPkValue = primaryKey && !isUndefinedOrNull(item[primaryKey])

209 -

const rowKey = hasPkValue ? toString(item[primaryKey]) : String(rowIndex)

208 +

const primaryKeyValue = toString(get(item, primaryKey)) || null

209 +

const rowKey = primaryKeyValue || String(rowIndex)

210 210 211 211

// If primary key is provided, use it to generate a unique ID on each tbody > tr

212 212

// In the format of '{tableId}__row_{primaryKeyValue}'

213 -

const rowId = hasPkValue ? this.safeId(`_row_${item[primaryKey]}`) : null

213 +

const rowId = primaryKeyValue ? this.safeId(`_row_${primaryKeyValue}`) : null

214 214 215 215

// Selectable classes and attributes

216 216

const selectableClasses = this.selectableRowClasses ? this.selectableRowClasses(rowIndex) : {}

@@ -233,8 +233,7 @@ export default {

233 233

attrs: {

234 234

id: rowId,

235 235

tabindex: hasRowClickHandler ? '0' : null,

236 -

'data-pk': rowId ? String(item[primaryKey]) : null,

237 -

// Should this be `aria-details` instead?

236 +

'data-pk': primaryKeyValue || null,

238 237

'aria-details': detailsId,

239 238

'aria-owns': detailsId,

240 239

'aria-rowindex': ariaRowIndex,

Original file line number Diff line number Diff line change

@@ -1,5 +1,5 @@

1 1

import KeyCodes from '../../../utils/key-codes'

2 -

import { arrayIncludes } from '../../../utils/array'

2 +

import { arrayIncludes, from as arrayFrom } from '../../../utils/array'

3 3

import { closest, isElement } from '../../../utils/dom'

4 4

import { props as tbodyProps, BTbody } from '../tbody'

5 5

import filterEvent from './filter-event'

@@ -23,11 +23,14 @@ export default {

23 23

// Returns all the item TR elements (excludes detail and spacer rows)

24 24

// `this.$refs.itemRows` is an array of item TR components/elements

25 25

// Rows should all be B-TR components, but we map to TR elements

26 +

// Also note that `this.$refs.itemRows` may not always be in document order

27 +

const tbody = this.$refs.tbody.$el || this.$refs.tbody

28 +

const trs = (this.$refs.itemRows || []).map(tr => tr.$el || tr)

26 29

// TODO: This may take time for tables many rows, so we may want to cache

27 30

// the result of this during each render cycle on a non-reactive

28 31

// property. We clear out the cache as each render starts, and

29 32

// populate it on first access of this method if null

30 -

return (this.$refs.itemRows || []).map(tr => tr.$el || tr)

33 +

return arrayFrom(tbody.children).filter(tr => arrayIncludes(trs, tr))

31 34

},

32 35

getTbodyTrIndex(el) {

33 36

// Returns index of a particular TBODY item TR

Original file line number Diff line number Diff line change

@@ -71,21 +71,25 @@ export const BTbody = /*#__PURE__*/ Vue.extend({

71 71

},

72 72

tbodyProps() {

73 73

return this.tbodyTransitionProps ? { ...this.tbodyTransitionProps, tag: 'tbody' } : {}

74 -

},

75 -

tbodyListeners() {

76 -

const handlers = this.tbodyTransitionHandlers || {}

77 -

return { ...this.$listeners, ...handlers }

78 74

}

79 75

},

80 76

render(h) {

77 +

const data = {

78 +

props: this.tbodyProps,

79 +

attrs: this.tbodyAttrs

80 +

}

81 +

if (this.isTransitionGroup) {

82 +

// We use native listeners if a transition group

83 +

// for any delegated events

84 +

data.on = this.tbodyTransitionHandlers || {}

85 +

data.nativeOn = this.$listeners || {}

86 +

} else {

87 +

// Otherwise we place any listeners on the tbody element

88 +

data.on = this.$listeners || {}

89 +

}

81 90

return h(

82 91

this.isTransitionGroup ? 'transition-group' : 'tbody',

83 -

{

84 -

props: this.tbodyProps,

85 -

attrs: this.tbodyAttrs,

86 -

// Pass down any listeners

87 -

on: this.tbodyListeners

88 -

},

92 +

data,

89 93

this.normalizeSlot('default', {})

90 94

)

91 95

}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4