beyond-rails 0.0.216 → 0.0.217
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/js/decorators/supportDom.js +0 -45
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc8e595696f351d27825c440fc48825dc0360b4a0aeeb23d8ff88f51d70e7794
|
4
|
+
data.tar.gz: f65dc6990f6962438dc867f2eb6f29f50658f8ac474b52cb13765621ffbf358a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5b3863f1fd9a07e8ccc2c086c5ca2292e9c40a2e40fbd860935dbff10378f3421d7294be5557c894affae7a5f665a63b1bf4a11de0dfc5549174b9947a58a08
|
7
|
+
data.tar.gz: f5319191d5a32812c4a18ecd28e1bce0d56fa1f16c69f72c7db633d805d1a61edc6fad8b589658f61e8bd604882704ec1e6d589e6ea9faf11ceadf0469f11ddc
|
@@ -1,21 +1,11 @@
|
|
1
1
|
import { isFunction } from '../utils'
|
2
2
|
import createdComponents from '../consts/createdComponents'
|
3
3
|
|
4
|
-
const domMap = new Map()
|
5
|
-
|
6
4
|
export default function supportDom(target) {
|
7
5
|
|
8
|
-
const targetName = target.name
|
9
|
-
|
10
6
|
return class extends target {
|
11
7
|
|
12
8
|
init() {
|
13
|
-
if (this.classNameUsed) {
|
14
|
-
console.warn(`This dom has already been initialized by ${targetName}`, this.dom)
|
15
|
-
return
|
16
|
-
}
|
17
|
-
this.setClassNameByDom(target)
|
18
|
-
|
19
9
|
this._listeners = []
|
20
10
|
this._externalListeners = []
|
21
11
|
if (isFunction(super.init)) {
|
@@ -24,40 +14,6 @@ export default function supportDom(target) {
|
|
24
14
|
createdComponents.push(this)
|
25
15
|
}
|
26
16
|
|
27
|
-
get classNameUsed() {
|
28
|
-
if (this._skipDomChecking) {
|
29
|
-
return false
|
30
|
-
}
|
31
|
-
const classnames = domMap.get(this.dom) || []
|
32
|
-
return classnames.includes(targetName)
|
33
|
-
}
|
34
|
-
|
35
|
-
setClassNameByDom(target) {
|
36
|
-
const { dom } = this
|
37
|
-
if (dom) {
|
38
|
-
const classes = domMap.get(dom) || []
|
39
|
-
classes.push(targetName)
|
40
|
-
domMap.set(dom, classes)
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
deleteClassNameByDom(target) {
|
45
|
-
const { dom } = this
|
46
|
-
if (! dom) {
|
47
|
-
return
|
48
|
-
}
|
49
|
-
const { name } = target
|
50
|
-
const classnames = (domMap.get(dom) || [])
|
51
|
-
.filter(classname => classname !== name)
|
52
|
-
|
53
|
-
if (classnames.length === 0) {
|
54
|
-
domMap.delete(dom)
|
55
|
-
}
|
56
|
-
else {
|
57
|
-
domMap.set(dom, classnames)
|
58
|
-
}
|
59
|
-
}
|
60
|
-
|
61
17
|
on(name, func) {
|
62
18
|
this._externalListeners.push({ name, func })
|
63
19
|
}
|
@@ -80,7 +36,6 @@ export default function supportDom(target) {
|
|
80
36
|
}
|
81
37
|
|
82
38
|
destroy() {
|
83
|
-
this.deleteClassNameByDom(target)
|
84
39
|
this._externalListeners.length = 0
|
85
40
|
this.removeEvents()
|
86
41
|
if (isFunction(super.destroy)) {
|