webcake-ui-kit 1.1.20 → 1.1.21
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/package.json
CHANGED
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
@click="onHeaderClick(col)"
|
|
36
36
|
@keydown.enter.prevent="onHeaderClick(col)"
|
|
37
37
|
@keydown.space.prevent="onHeaderClick(col)"
|
|
38
|
-
v-bind="
|
|
38
|
+
v-bind="customHeaderAttrs(col, i)"
|
|
39
|
+
v-on="customHeaderListeners(col, i)"
|
|
39
40
|
>
|
|
40
41
|
<span class="ui-table__th-inner">
|
|
41
42
|
<slot name="headerCell" :column="col">{{ col.title }}</slot>
|
|
@@ -80,7 +81,8 @@
|
|
|
80
81
|
isSelected(record, rowIndex(i)) && 'ui-table__row--selected'
|
|
81
82
|
]"
|
|
82
83
|
:style="{ height: toCssSize(rowHeight) }"
|
|
83
|
-
v-bind="
|
|
84
|
+
v-bind="customRowAttrs(record, rowIndex(i))"
|
|
85
|
+
v-on="customRowListeners(record, rowIndex(i))"
|
|
84
86
|
@click="hasSelection ? onRowClick(record, rowIndex(i), $event) : undefined"
|
|
85
87
|
>
|
|
86
88
|
<td
|
|
@@ -277,6 +279,38 @@ export default {
|
|
|
277
279
|
this.teardown()
|
|
278
280
|
},
|
|
279
281
|
methods: {
|
|
282
|
+
// Split a customRow/customHeader result into plain attributes and event listeners.
|
|
283
|
+
// The public API mirrors ant-design-vue's `onClick`/`onDblclick`/... convention, which
|
|
284
|
+
// Vue 3 auto-resolves to listeners when spread via v-bind — but Vue 2 would bind them as
|
|
285
|
+
// raw DOM attributes. So we strip the `onXxx` keys into a v-on map (event name lower-cased)
|
|
286
|
+
// and leave the rest for v-bind, which works identically on both runtimes.
|
|
287
|
+
splitBindings(raw) {
|
|
288
|
+
const attrs = {}
|
|
289
|
+
const on = {}
|
|
290
|
+
if (raw) {
|
|
291
|
+
Object.keys(raw).forEach(key => {
|
|
292
|
+
const match = /^on([A-Z].*)$/.exec(key)
|
|
293
|
+
if (match) {
|
|
294
|
+
on[match[1].charAt(0).toLowerCase() + match[1].slice(1)] = raw[key]
|
|
295
|
+
} else {
|
|
296
|
+
attrs[key] = raw[key]
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
}
|
|
300
|
+
return { attrs, on }
|
|
301
|
+
},
|
|
302
|
+
customRowAttrs(record, index) {
|
|
303
|
+
return this.customRow ? this.splitBindings(this.customRow(record, index)).attrs : {}
|
|
304
|
+
},
|
|
305
|
+
customRowListeners(record, index) {
|
|
306
|
+
return this.customRow ? this.splitBindings(this.customRow(record, index)).on : {}
|
|
307
|
+
},
|
|
308
|
+
customHeaderAttrs(col, index) {
|
|
309
|
+
return this.customHeader ? this.splitBindings(this.customHeader(col, index)).attrs : {}
|
|
310
|
+
},
|
|
311
|
+
customHeaderListeners(col, index) {
|
|
312
|
+
return this.customHeader ? this.splitBindings(this.customHeader(col, index)).on : {}
|
|
313
|
+
},
|
|
280
314
|
teardown() {
|
|
281
315
|
window.removeEventListener('resize', this.onResize)
|
|
282
316
|
if (this.rafId != null) {
|