beyond-rails 0.0.210 → 0.0.215

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec514dd926ca28093516f6a80efb90be67b6f0f4ff68d4f887499e2edcecf994
4
- data.tar.gz: 760f05e94459b3d3ab0144beea55152c9cea9da5322683893f2199b28bdff3dc
3
+ metadata.gz: 2f68ab9a79de99e40d9e8460452b9cf7fdaa43ff92b2a553f5c1715f0f99fd6d
4
+ data.tar.gz: 2ba5dd5bb3e6ffa51fdb779d32c08e25a03a442cefa7e5803c3a1a66dd8f7f9d
5
5
  SHA512:
6
- metadata.gz: be536b16af09e0b1e4651d1b52ca571e0fa653d8b34b9b3d2408a47a26f94a594ac2328142729fd5cb0e707e24d092bd58072048435f7f23e5078c72b5163756
7
- data.tar.gz: fc650a64605dd22e174d6b8ce396aa6e6087c43016126a39c9da62bc1b67f634db22558dfeec5038e6e13088c250dfa6b1aa0da7686562aa754b157b2c9d35bc
6
+ metadata.gz: 83b82acf5fb118c6e6c26177cb0886bb90772f556b0da4ae371a18e77f3541f2427358eedfef4af09bd09bd03fa01fad89c117bd34cbce3b4893898aac5e1f17
7
+ data.tar.gz: 205e57cafe9e23882c7cf5614142d573cc5685550d718ba02b2fae32fa917111642ff75dbc2025f2b50664abfa84a74aa189657717b5580985b4c4c91754f880
@@ -1,5 +1,6 @@
1
1
  import supportDom from '../decorators/supportDom'
2
2
  import { noop } from '../utils'
3
+ import domEval from '../utils/domEval'
3
4
 
4
5
  let globalModalId = 0
5
6
 
@@ -56,6 +57,9 @@ export default class Modal {
56
57
  this.modal.style.display = 'block'
57
58
  setTimeout(() => {
58
59
  this.modal.classList.add('js-active')
60
+ if (typeof $ === 'function') {
61
+ $(this.dom).trigger('beyond.modal.show')
62
+ }
59
63
  }, 50)
60
64
  }
61
65
 
@@ -64,6 +68,9 @@ export default class Modal {
64
68
  this.modal.classList.remove('js-active')
65
69
  setTimeout(() => {
66
70
  this.modal.style.display = 'none'
71
+ if (typeof $ === 'function') {
72
+ $(this.dom).trigger('beyond.modal.hide')
73
+ }
67
74
  }, 300)
68
75
  }
69
76
 
@@ -75,11 +82,21 @@ export default class Modal {
75
82
  const div = document.createElement('div')
76
83
  div.innerHTML = html.trim()
77
84
  const dom = div.firstChild
85
+
86
+ // keep the id that is created by $.uniqModal()
87
+ const originalDomId = this.dom.id
88
+ if (originalDomId === 'beyond-uniq-modal') {
89
+ dom.id = originalDomId
90
+ }
91
+
78
92
  this.dom.parentNode.replaceChild(dom, this.dom)
79
93
 
80
94
  this.dom = dom
81
95
  this.dom._modal = this
82
96
  this.init()
97
+
98
+ Array.from(dom.querySelectorAll('script'))
99
+ .forEach(script => domEval(script.text))
83
100
  }
84
101
 
85
102
  visible() {
@@ -1,19 +1,20 @@
1
1
  import { isFunction } from '../utils'
2
- import isUndef from '../utils/isUndef'
3
2
  import createdComponents from '../consts/createdComponents'
4
3
 
5
4
  const domMap = new Map()
6
5
 
7
6
  export default function supportDom(target) {
8
7
 
8
+ const targetName = target.name
9
+
9
10
  return class extends target {
10
11
 
11
12
  init() {
12
- if (domMap.has(this.dom) && isUndef(this._skipDomChecking)) {
13
- console.warn('This dom has already been initialized.', this.dom)
13
+ if (this.classNameUsed) {
14
+ console.warn(`This dom has already been initialized by ${targetName}`, this.dom)
14
15
  return
15
16
  }
16
- this.setDomToMap()
17
+ this.setClassNameByDom(target)
17
18
 
18
19
  this._listeners = []
19
20
  this._externalListeners = []
@@ -23,18 +24,38 @@ export default function supportDom(target) {
23
24
  createdComponents.push(this)
24
25
  }
25
26
 
26
- setDomToMap() {
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) {
27
36
  const { dom } = this
28
37
  if (dom) {
29
- domMap.set(dom, true)
38
+ const classes = domMap.get(dom) || []
39
+ classes.push(targetName)
40
+ domMap.set(dom, classes)
30
41
  }
31
42
  }
32
43
 
33
- deleteDomFromMap() {
44
+ deleteClassNameByDom(target) {
34
45
  const { dom } = this
35
- if (dom) {
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) {
36
54
  domMap.delete(dom)
37
55
  }
56
+ else {
57
+ domMap.set(dom, classnames)
58
+ }
38
59
  }
39
60
 
40
61
  on(name, func) {
@@ -59,7 +80,7 @@ export default function supportDom(target) {
59
80
  }
60
81
 
61
82
  destroy() {
62
- this.deleteDomFromMap()
83
+ this.deleteClassNameByDom(target)
63
84
  this._externalListeners.length = 0
64
85
  this.removeEvents()
65
86
  if (isFunction(super.destroy)) {
@@ -0,0 +1,5 @@
1
+ export default function domEval(code) {
2
+ const script = document.createElement('script')
3
+ script.text = code
4
+ document.head.appendChild(script).parentNode.removeChild(script)
5
+ }
@@ -104,7 +104,7 @@ label.required {
104
104
  .hint.hint-danger {
105
105
  color: #e03953;
106
106
  &:before {
107
- font-family: 'icomoon';
107
+ font-family: $beyond-icon-font-name;
108
108
  margin-right: 4px;
109
109
  display: inline-block;
110
110
  transform: translateY(1px);
@@ -368,7 +368,15 @@ input[type="file"] {
368
368
  .input-group-prepend {
369
369
  margin-right: -1px;
370
370
  }
371
+ .input-group-append {
372
+ margin-left: -1px;
373
+ }
371
374
 
375
+ .input-group > .form-control:not(:last-child) {
376
+ border-top-right-radius: 0;
377
+ border-bottom-right-radius: 0;
378
+ z-index: 1;
379
+ }
372
380
  .input-group > .form-control:not(:first-child) {
373
381
  border-top-left-radius: 0;
374
382
  border-bottom-left-radius: 0;
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.210
4
+ version: 0.0.215
5
5
  platform: ruby
6
6
  authors:
7
7
  - kmsheng
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-09-24 00:00:00.000000000 Z
12
+ date: 2020-09-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sassc
@@ -173,6 +173,7 @@ files:
173
173
  - src/js/utils/dateGt.js
174
174
  - src/js/utils/dateLt.js
175
175
  - src/js/utils/docReady.js
176
+ - src/js/utils/domEval.js
176
177
  - src/js/utils/getFloatedTargetPos.js
177
178
  - src/js/utils/getKey.js
178
179
  - src/js/utils/index.js