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: b9759e033d571fadd60f7ff3a2284398e363f2dfadbb6ab3db54abf8f5863d7a
4
- data.tar.gz: 037e12fb98286c223a7187fba28c8c88172e96a46cce3f5ef0d7537cadefd59c
3
+ metadata.gz: 33ea08dc8bf98acf8465442ae93d6ed62dc980c078bbe5bf80feb75113ba0154
4
+ data.tar.gz: f75502fb24fba0b328661979431a0141a58b505fad9e4e640e6b1bc3167f9c89
5
5
  SHA512:
6
- metadata.gz: 50b799c4d35bcbf22b8d765cf2c65a3fbd5513cefbd4c0c61106b99821f0e8b21615a7065d6dde23ddeebc30c84cee9e69a03799e52bec7e60f544ce37065ed2
7
- data.tar.gz: 0df9f28b53a6a310d92c7408189261c0b018fbdc62db9f5bfe59eb0f21540603105cbe59059a87177b2efc921d031943964eb8f948e3df298549ef69475aed8c
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()
@@ -14,6 +14,7 @@ export default class TimeInput {
14
14
  this.options = options
15
15
  this.tz = options.tz || DEFAULT_TIMEZONE
16
16
  this.timePattern = options.timePattern || 'HH:mm'
17
+ this._skipDomChecking = true
17
18
 
18
19
  this.init()
19
20
  }
@@ -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
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beyond-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.201
4
+ version: 0.0.206
5
5
  platform: ruby
6
6
  authors:
7
7
  - kmsheng