material 0.9.2 → 0.9.4
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 +1 -1
- package/src/list/update.js +14 -0
- package/src/module/events.js +8 -2
package/package.json
CHANGED
package/src/list/update.js
CHANGED
|
@@ -7,6 +7,20 @@ export default {
|
|
|
7
7
|
this.getUpdatedInfo(info[this.dataId])
|
|
8
8
|
},
|
|
9
9
|
|
|
10
|
+
updateInfo (info) {
|
|
11
|
+
// console.log('update', info)
|
|
12
|
+
this.dataStore[info._id] = info
|
|
13
|
+
|
|
14
|
+
// update item in the list if visible
|
|
15
|
+
const item = this.ui.body.querySelector('[data-id="' + info[this.dataId] + '"]')
|
|
16
|
+
if (item) {
|
|
17
|
+
item.innerHTML = ''
|
|
18
|
+
const layout = create(this.options.layout.item, item)
|
|
19
|
+
|
|
20
|
+
this.renderInfo(layout, info)
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
|
|
10
24
|
getUpdatedIndex (id) {
|
|
11
25
|
// console.log('getUpdatedIndex', id)
|
|
12
26
|
let index = null
|
package/src/module/events.js
CHANGED
|
@@ -2,7 +2,7 @@ import extract from './extract'
|
|
|
2
2
|
import last from './last'
|
|
3
3
|
|
|
4
4
|
const events = {
|
|
5
|
-
eventHandlers: {}, //
|
|
5
|
+
eventHandlers: {}, // Use an array to store events and handlers
|
|
6
6
|
|
|
7
7
|
attach (eventsArray, context) {
|
|
8
8
|
if (!eventsArray) return
|
|
@@ -38,9 +38,15 @@ const events = {
|
|
|
38
38
|
return // Cannot bind function for eventDef
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
let isPassive = false
|
|
42
|
+
if (e.name === 'touchstart' || e.name === 'touchmove') {
|
|
43
|
+
isPassive = true
|
|
44
|
+
option = { ...option, passive: true }
|
|
45
|
+
}
|
|
46
|
+
|
|
41
47
|
if (!this.eventHandlers[uid][eventDef]) {
|
|
42
48
|
if (handler && e && e.element?.addEventListener) {
|
|
43
|
-
e.element.addEventListener(e.name, handler, option)
|
|
49
|
+
e.element.addEventListener(e.name, handler, isPassive ? { passive: true } : option)
|
|
44
50
|
this.eventHandlers[uid][eventDef] = handler
|
|
45
51
|
} else if (e && e.element?.on && handler) {
|
|
46
52
|
e.element.on(e.name, handler)
|