beyond-rails 0.0.201 → 0.0.206
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33ea08dc8bf98acf8465442ae93d6ed62dc980c078bbe5bf80feb75113ba0154
|
4
|
+
data.tar.gz: f75502fb24fba0b328661979431a0141a58b505fad9e4e640e6b1bc3167f9c89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d460950281c2df848623313dcaa112e12bf043f587f6dead55463e067a972b9caba3bb86c2e82527ee28c6e43436d6db5003e9fe6c91d85c8c2c654c2a9dca7
|
7
|
+
data.tar.gz: b5c04888cd17d6ccc9ff02e06bc087f62c0cfcd5d746df450de6483cf0d502641788d1a6b45125e95d452d04735b00417325a39ac0dc75e000307a02e570e08d
|
@@ -34,8 +34,17 @@ export default class Dropdown {
|
|
34
34
|
}
|
35
35
|
|
36
36
|
init() {
|
37
|
+
|
38
|
+
if (! this.dom) {
|
39
|
+
throw new Error('dom is missing in Dropdown class')
|
40
|
+
}
|
41
|
+
|
37
42
|
this.id = this.dom.dataset.target
|
38
43
|
this.menu = document.querySelector(`[data-dropdown-menu="${this.id}"]`)
|
44
|
+
|
45
|
+
if (! this.menu) {
|
46
|
+
throw new Error(`menu ${this.id} is missing in Dropdown class`)
|
47
|
+
}
|
39
48
|
this.place = this.menu.dataset.place || 'bottom'
|
40
49
|
this.align = this.menu.dataset.align
|
41
50
|
this.menu.remove()
|
@@ -1,11 +1,20 @@
|
|
1
1
|
import { isFunction } from '../utils'
|
2
|
+
import isUndef from '../utils/isUndef'
|
2
3
|
import createdComponents from '../consts/createdComponents'
|
3
4
|
|
5
|
+
const domMap = new Map()
|
6
|
+
|
4
7
|
export default function supportDom(target) {
|
5
8
|
|
6
9
|
return class extends target {
|
7
10
|
|
8
11
|
init() {
|
12
|
+
if (domMap.has(this.dom) && isUndef(this._skipDomChecking)) {
|
13
|
+
console.warn('This dom has already been initialized.', this.dom)
|
14
|
+
return
|
15
|
+
}
|
16
|
+
this.setDomToMap()
|
17
|
+
|
9
18
|
this._listeners = []
|
10
19
|
this._externalListeners = []
|
11
20
|
if (isFunction(super.init)) {
|
@@ -14,6 +23,20 @@ export default function supportDom(target) {
|
|
14
23
|
createdComponents.push(this)
|
15
24
|
}
|
16
25
|
|
26
|
+
setDomToMap() {
|
27
|
+
const { dom } = this
|
28
|
+
if (dom) {
|
29
|
+
domMap.set(dom, true)
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
deleteDomFromMap() {
|
34
|
+
const { dom } = this
|
35
|
+
if (dom) {
|
36
|
+
domMap.delete(dom)
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
17
40
|
on(name, func) {
|
18
41
|
this._externalListeners.push({ name, func })
|
19
42
|
}
|
@@ -36,6 +59,7 @@ export default function supportDom(target) {
|
|
36
59
|
}
|
37
60
|
|
38
61
|
destroy() {
|
62
|
+
this.deleteDomFromMap()
|
39
63
|
this._externalListeners.length = 0
|
40
64
|
this.removeEvents()
|
41
65
|
if (isFunction(super.destroy)) {
|
@@ -14,6 +14,7 @@
|
|
14
14
|
-webkit-overflow-scrolling: touch;
|
15
15
|
}
|
16
16
|
.search-dropdown-menu-item {
|
17
|
+
display: flex;
|
17
18
|
border: 3px solid transparent;
|
18
19
|
&.selected {
|
19
20
|
border: 3px solid $bg-outline;
|
@@ -23,6 +24,10 @@
|
|
23
24
|
padding: 7px 11px;
|
24
25
|
strong {
|
25
26
|
color: #6772e5;
|
27
|
+
margin-right: .7em;
|
28
|
+
}
|
29
|
+
> span {
|
30
|
+
max-width: 420px;
|
26
31
|
}
|
27
32
|
}
|
28
33
|
}
|