material 0.9.6 → 0.9.8
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/index.js +3 -1
- package/package.json +1 -1
- package/src/card.js +8 -15
- package/src/checkbox.js +23 -30
- package/src/datehour.js +2 -12
- package/src/menu.js +10 -34
- package/src/mixin/position.js +4 -3
- package/src/module/build.js +10 -9
- package/src/module/extract.js +10 -6
- package/src/skin/material/icon/back.svg +1 -2
- package/src/skin/material/icon/checkbox.svg +1 -2
- package/src/skin/material/icon/forward.svg +1 -2
- package/src/skin/material/icon/pin.svg +1 -2
- package/src/text.js +3 -9
- package/src/tooltip.js +24 -48
- package/src/view.js +3 -17
- package/src/component.js +0 -38
- package/src/map/build.js +0 -103
- package/src/map/countries.js +0 -114
- package/src/map/display.js +0 -135
- package/src/map/focus.js +0 -39
- package/src/map/init.js +0 -24
- package/src/map/label.js +0 -0
- package/src/map/mode.js +0 -44
- package/src/map/mouse.js +0 -65
- package/src/map/select.js +0 -68
- package/src/map/set.js +0 -71
- package/src/map/viewport.js +0 -46
- package/src/map.js +0 -67
package/index.js
CHANGED
|
@@ -37,6 +37,7 @@ import attributes from './src/module/attributes'
|
|
|
37
37
|
import EventEmitter from './src/mixin/emitter'
|
|
38
38
|
import display from './src/mixin/display'
|
|
39
39
|
import build from './src/mixin/build'
|
|
40
|
+
import position from './src/mixin/position'
|
|
40
41
|
// modules
|
|
41
42
|
import clone from './src/module/clone'
|
|
42
43
|
import dataset from './src/module/dataset'
|
|
@@ -51,6 +52,7 @@ import observer from './src/module/observer'
|
|
|
51
52
|
import request from './src/module/request'
|
|
52
53
|
import ripple from './src/module/ripple'
|
|
53
54
|
import smoothscroll from './src/module/smoothscroll'
|
|
55
|
+
import touch from './src/module/touch'
|
|
54
56
|
|
|
55
57
|
export {
|
|
56
58
|
// classes
|
|
@@ -62,5 +64,5 @@ export {
|
|
|
62
64
|
// mixins and modules
|
|
63
65
|
EventEmitter,
|
|
64
66
|
attributes, build, clone, create, dataset, device, display, events, emitter, jsonToHTML, mediator, merge,
|
|
65
|
-
observer, request, ripple, smoothscroll
|
|
67
|
+
observer, position, request, ripple, smoothscroll, touch
|
|
66
68
|
}
|
package/package.json
CHANGED
package/src/card.js
CHANGED
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
display
|
|
4
|
+
} from '../'
|
|
5
|
+
|
|
3
6
|
import position from './mixin/position'
|
|
4
7
|
|
|
5
|
-
class Card {
|
|
8
|
+
class Card extends Component {
|
|
6
9
|
static defaults = {
|
|
7
10
|
class: 'card',
|
|
11
|
+
mixins: [display, position],
|
|
8
12
|
position: {
|
|
9
13
|
align: 'center',
|
|
10
14
|
vAlign: 'dynamic',
|
|
11
15
|
offsetX: 10,
|
|
12
16
|
offsetY: 10
|
|
13
17
|
},
|
|
14
|
-
close: true
|
|
15
|
-
layout: []
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
constructor (options) {
|
|
19
|
-
this.init(options)
|
|
20
|
-
this.build()
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
init (options) {
|
|
24
|
-
this.options = { ...Card.defaults, ...options }
|
|
25
|
-
Object.assign(this, build, display, position)
|
|
18
|
+
close: true
|
|
26
19
|
}
|
|
27
20
|
}
|
|
28
21
|
|
package/src/checkbox.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
// import control from './mixin/control'
|
|
3
|
-
import build from './mixin/build'
|
|
4
|
-
import events from './module/events'
|
|
5
|
-
import * as css from './module/css'
|
|
1
|
+
import Control from './class/control'
|
|
6
2
|
|
|
7
3
|
import icon from './skin/material/icon/checkbox.svg'
|
|
8
4
|
import Element from './element'
|
|
9
5
|
|
|
10
|
-
class Checkbox {
|
|
6
|
+
class Checkbox extends Control {
|
|
11
7
|
static defaults = {
|
|
12
8
|
class: 'checkbox',
|
|
13
9
|
layout: [
|
|
@@ -17,7 +13,7 @@ class Checkbox {
|
|
|
17
13
|
],
|
|
18
14
|
events: [
|
|
19
15
|
['ui.control.click', 'click'],
|
|
20
|
-
['ui.label.click', '
|
|
16
|
+
['ui.label.click', 'check'],
|
|
21
17
|
// for accessibility purpose
|
|
22
18
|
// ['element.input.click', 'toggle'],
|
|
23
19
|
['ui.input.focus', 'focus'],
|
|
@@ -27,20 +23,11 @@ class Checkbox {
|
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
constructor (options) {
|
|
30
|
-
|
|
31
|
-
this.build()
|
|
26
|
+
super(options)
|
|
32
27
|
this.setup()
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
init (options) {
|
|
36
|
-
this.options = { ...Checkbox.defaults, ...options }
|
|
37
|
-
Object.assign(this, build, attach)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
30
|
setup () {
|
|
41
|
-
this.element = build(this.options.build)
|
|
42
|
-
this.element = this.element.root
|
|
43
|
-
|
|
44
31
|
this.ui.control.innerHTML = icon
|
|
45
32
|
|
|
46
33
|
const text = this.options.text || this.options.label
|
|
@@ -58,7 +45,7 @@ class Checkbox {
|
|
|
58
45
|
if (this.options.disabled) {
|
|
59
46
|
this.disabled = this.options.disabled
|
|
60
47
|
this.ui.input.setAttribute('disabled', 'disabled')
|
|
61
|
-
|
|
48
|
+
this.element.classList.add('is-disabled')
|
|
62
49
|
}
|
|
63
50
|
|
|
64
51
|
if (this.options.checked) {
|
|
@@ -68,8 +55,6 @@ class Checkbox {
|
|
|
68
55
|
if (this.options.value) {
|
|
69
56
|
this.set('value', this.value)
|
|
70
57
|
}
|
|
71
|
-
|
|
72
|
-
events.attach(this.options.events, this)
|
|
73
58
|
}
|
|
74
59
|
|
|
75
60
|
set (prop, value) {
|
|
@@ -90,24 +75,32 @@ class Checkbox {
|
|
|
90
75
|
return this
|
|
91
76
|
}
|
|
92
77
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
78
|
+
get () {
|
|
79
|
+
return this.value
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
check (value) {
|
|
83
|
+
if (value === true) {
|
|
84
|
+
this.element.classList.add('is-checked')
|
|
96
85
|
this.ui.input.checked = true
|
|
97
|
-
this.
|
|
98
|
-
this.emit('change', this.
|
|
86
|
+
this.value = true
|
|
87
|
+
this.emit('change', this.value)
|
|
99
88
|
} else {
|
|
100
|
-
|
|
89
|
+
this.element.classList.remove('is-checked')
|
|
101
90
|
this.ui.input.checked = false
|
|
102
|
-
this.
|
|
103
|
-
this.emit('change', this.
|
|
91
|
+
this.value = false
|
|
92
|
+
this.emit('change', this.value)
|
|
104
93
|
}
|
|
105
94
|
return this
|
|
106
95
|
}
|
|
107
96
|
|
|
108
|
-
|
|
109
|
-
this.toggle(e)
|
|
97
|
+
onClick (e) {
|
|
110
98
|
this.ui.input.focus()
|
|
99
|
+
if (this.element.classList.add('is-checked')) {
|
|
100
|
+
this.check(false)
|
|
101
|
+
} else {
|
|
102
|
+
this.check(true)
|
|
103
|
+
}
|
|
111
104
|
|
|
112
105
|
return this
|
|
113
106
|
}
|
package/src/datehour.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Component from './class/component'
|
|
2
2
|
|
|
3
|
-
class DateHour {
|
|
3
|
+
class DateHour extends Component {
|
|
4
4
|
static defaults = {
|
|
5
5
|
class: 'date',
|
|
6
6
|
tag: 'span'
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
constructor (options) {
|
|
10
|
-
this.init(options)
|
|
11
|
-
this.build()
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
init (options) {
|
|
15
|
-
this.options = { ...DateHour.defaults, ...options }
|
|
16
|
-
Object.assign(this, build)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
9
|
set (date) {
|
|
20
10
|
// console.log('set', src)
|
|
21
11
|
const d = new Date(date)
|
package/src/menu.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import events from './module/events'
|
|
5
|
-
import display from './mixin/display'
|
|
6
|
-
import position from './mixin/position'
|
|
1
|
+
import {
|
|
2
|
+
Control, Element, display
|
|
3
|
+
} from '../index'
|
|
7
4
|
|
|
8
|
-
import
|
|
5
|
+
import position from './mixin/position'
|
|
9
6
|
|
|
10
|
-
class Menu extends
|
|
7
|
+
class Menu extends Control {
|
|
11
8
|
static defaults = {
|
|
12
9
|
class: 'menu',
|
|
10
|
+
mixins: [display, position],
|
|
11
|
+
underlay: true,
|
|
13
12
|
modal: false,
|
|
14
13
|
position: {
|
|
15
14
|
align: 'right',
|
|
@@ -28,37 +27,15 @@ class Menu extends EventEmitter {
|
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
constructor (options) {
|
|
31
|
-
super()
|
|
30
|
+
super(options)
|
|
32
31
|
|
|
33
|
-
this.init(options)
|
|
34
|
-
this.build(this.constructor)
|
|
35
|
-
this.buildUnderlay()
|
|
36
32
|
this.setup()
|
|
37
33
|
|
|
38
34
|
this.render(this.options.items)
|
|
39
|
-
|
|
40
|
-
return this
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
init (options) {
|
|
44
|
-
this.options = { ...Menu.defaults, ...options }
|
|
45
|
-
Object.assign(this, build, display, position)
|
|
46
|
-
|
|
47
|
-
this.menus = []
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
buildUnderlay () {
|
|
51
|
-
if (!this.options.parentName) {
|
|
52
|
-
this.underlay = new Element({
|
|
53
|
-
class: 'menu-underlay'
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
this.options.container.appendChild(this.underlay)
|
|
57
|
-
}
|
|
58
35
|
}
|
|
59
36
|
|
|
60
37
|
setup () {
|
|
61
|
-
|
|
38
|
+
this.menus = []
|
|
62
39
|
this.closeTimeout = null
|
|
63
40
|
|
|
64
41
|
document.addEventListener('click', this.handleDocumentClick)
|
|
@@ -100,6 +77,7 @@ class Menu extends EventEmitter {
|
|
|
100
77
|
class: 'floating',
|
|
101
78
|
target: item,
|
|
102
79
|
container: this.options.container,
|
|
80
|
+
underlay: false,
|
|
103
81
|
parentName: obj.name,
|
|
104
82
|
items: obj.items
|
|
105
83
|
}).position(item, {
|
|
@@ -132,7 +110,6 @@ class Menu extends EventEmitter {
|
|
|
132
110
|
}
|
|
133
111
|
|
|
134
112
|
destroyMenu (menu) {
|
|
135
|
-
// Trouver l'index de menuToDestroy dans this.menus
|
|
136
113
|
const index = this.menus.indexOf(menu)
|
|
137
114
|
|
|
138
115
|
// Si trouvé, supprimer le menu du tableau
|
|
@@ -140,7 +117,6 @@ class Menu extends EventEmitter {
|
|
|
140
117
|
this.menus.splice(index, 1)
|
|
141
118
|
}
|
|
142
119
|
|
|
143
|
-
// Appeler la méthode destroy sur le menuToDestroy
|
|
144
120
|
menu.destroy()
|
|
145
121
|
}
|
|
146
122
|
|
package/src/mixin/position.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
position (target, position) {
|
|
3
|
+
// console.log('position', target)
|
|
3
4
|
target = target || this.options.target
|
|
4
5
|
position = position || this.options.position
|
|
5
6
|
const { offsetX = 0, offsetY = 0, align = 'center', vAlign = 'middle' } = position
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
if (!target) return this
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
// console.log('--- target', target)
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
this.options.container = this.options.container || this.element.parentNode
|
|
12
13
|
|
|
13
14
|
const caller = target.getBoundingClientRect()
|
|
14
15
|
const screen = this.options.container.getBoundingClientRect()
|
package/src/module/build.js
CHANGED
|
@@ -8,13 +8,9 @@ import { create } from '../module/layout'
|
|
|
8
8
|
*/
|
|
9
9
|
const build = (instance) => {
|
|
10
10
|
// console.log('name', instance.constructor.defaults)
|
|
11
|
-
const { tag = 'div', class: customClass, data, base, container, layout, icon, label, show } = instance.options
|
|
11
|
+
const { tag = 'div', class: customClass, data, base, container, underlay, layout, icon, label, show } = instance.options
|
|
12
12
|
const { defaults = {} } = instance.constructor
|
|
13
13
|
|
|
14
|
-
if (instance.constructor?.defaults.class === 'length') {
|
|
15
|
-
console.log('---', instance.constructor.defaults)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
14
|
instance.element = document.createElement(tag)
|
|
19
15
|
|
|
20
16
|
if (defaults.base) css.add(instance.element, defaults.base)
|
|
@@ -36,8 +32,9 @@ const build = (instance) => {
|
|
|
36
32
|
|
|
37
33
|
instance.ui = instance.ui || {}
|
|
38
34
|
|
|
39
|
-
if (
|
|
40
|
-
if (
|
|
35
|
+
if (instance.options.underlay) buildUnderlay(instance, defaults.class)
|
|
36
|
+
if (icon && !instance.ui.icon) buildIcon(instance)
|
|
37
|
+
if (label && !instance.ui.label) buildLabel(instance)
|
|
41
38
|
|
|
42
39
|
if (show === true && instance.show) instance.show()
|
|
43
40
|
}
|
|
@@ -50,9 +47,13 @@ const setupContainer = (instance, base, container) => {
|
|
|
50
47
|
const setupLayout = (instance, layout) => {
|
|
51
48
|
instance.layout = create(layout, instance.element)
|
|
52
49
|
instance.ui = instance.layout.component
|
|
50
|
+
}
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
function buildUnderlay (instance, name) {
|
|
53
|
+
if (instance.options.underlay) {
|
|
54
|
+
instance.underlay = document.createElement('div')
|
|
55
|
+
instance.underlay.classList.add(name + '-underlay')
|
|
56
|
+
instance.options.container.appendChild(instance.underlay)
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
|
package/src/module/extract.js
CHANGED
|
@@ -19,13 +19,17 @@ function e (instance, ev) {
|
|
|
19
19
|
|
|
20
20
|
const keys = ev.split('.')
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
if (keys[0] === 'window') {
|
|
23
|
+
element = window
|
|
24
|
+
} else {
|
|
25
|
+
for (let i = 0, l = keys.length; i <= l; i++) {
|
|
26
|
+
const key = keys[i]
|
|
27
|
+
iteration = iteration || instance
|
|
28
|
+
iteration = iteration[key]
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
if (i === keys.length - 2) {
|
|
31
|
+
element = iteration
|
|
32
|
+
}
|
|
29
33
|
}
|
|
30
34
|
}
|
|
31
35
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export default `
|
|
2
1
|
<svg width="24px" class="slider-pin" height="32px" viewBox="0 0 24 32">
|
|
3
2
|
<path d="M12.4799395,31.9994146 C12.4799395,31.9994146 24,18.0312233 24,11.6159251 C24,5.2006268 18.627417,0 12,0 C5.372583,0 0,5.2006268 0,11.6159251 C0,18.0312233 12.4799395,31.9994146 12.4799395,31.9994146 Z"></path>
|
|
4
|
-
</svg
|
|
3
|
+
</svg>
|
package/src/text.js
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Component from './class/component'
|
|
2
2
|
|
|
3
|
-
class Text {
|
|
3
|
+
class Text extends Component {
|
|
4
4
|
static defaults = {
|
|
5
5
|
class: 'text',
|
|
6
6
|
tag: 'span'
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
constructor (options) {
|
|
10
|
-
|
|
11
|
-
this.build()
|
|
10
|
+
super(options)
|
|
12
11
|
this.setup()
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
init (options) {
|
|
16
|
-
this.options = { ...Text.defaults, ...options }
|
|
17
|
-
Object.assign(this, build)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
14
|
setup () {
|
|
21
15
|
if (this.options.text) {
|
|
22
16
|
this.set(this.options.text)
|
package/src/tooltip.js
CHANGED
|
@@ -1,59 +1,33 @@
|
|
|
1
|
+
import Component from './class/component'
|
|
2
|
+
import Element from './element'
|
|
3
|
+
import position from './mixin/position'
|
|
1
4
|
import touch from './module/touch'
|
|
2
5
|
|
|
3
|
-
class Tooltip {
|
|
6
|
+
class Tooltip extends Component {
|
|
4
7
|
static defaults = {
|
|
8
|
+
base: 'component',
|
|
9
|
+
class: 'tooltip',
|
|
10
|
+
tag: 'span',
|
|
11
|
+
mixins: [position],
|
|
5
12
|
targets: '[data-tooltip]',
|
|
6
13
|
offset: {
|
|
7
14
|
top: 60
|
|
8
15
|
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
constructor (options) {
|
|
19
|
-
// console.log('constructor')
|
|
20
|
-
|
|
21
|
-
this.init(options)
|
|
22
|
-
this.build()
|
|
23
|
-
this.bindEvents()
|
|
24
|
-
|
|
25
|
-
return this
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
init (options) {
|
|
29
|
-
this.options = { ...Tooltip.defaults, ...options }
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
build () {
|
|
33
|
-
const container = this.options.container || document.body
|
|
34
|
-
|
|
35
|
-
this.element = document.createElement('span')
|
|
36
|
-
this.element.classList.add('tooltip')
|
|
37
|
-
this.element.classList.add('control')
|
|
38
|
-
|
|
39
|
-
this.pointer = document.createElement('span')
|
|
40
|
-
this.pointer.classList.add('pointer')
|
|
41
|
-
this.element.appendChild(this.pointer)
|
|
42
|
-
|
|
43
|
-
this.label = document.createElement('span')
|
|
44
|
-
this.label.classList.add('label')
|
|
45
|
-
this.element.appendChild(this.label)
|
|
46
|
-
|
|
47
|
-
container.appendChild(this.element)
|
|
16
|
+
position: {
|
|
17
|
+
align: 'center',
|
|
18
|
+
vAlign: 'bottom'
|
|
19
|
+
},
|
|
20
|
+
disabled: false,
|
|
21
|
+
layout: [
|
|
22
|
+
[Element, { tag: 'span', class: 'pointer' }],
|
|
23
|
+
[Element, 'label', { tag: 'span', class: 'label' }]
|
|
24
|
+
]
|
|
48
25
|
}
|
|
49
26
|
|
|
50
|
-
|
|
51
|
-
// console.log('attach', this.options.targets)
|
|
27
|
+
bindTargets () {
|
|
52
28
|
const targets = document.querySelectorAll(this.options.targets)
|
|
53
|
-
|
|
54
29
|
for (let i = 0; i < targets.length; i++) {
|
|
55
30
|
targets[i].addEventListener('mouseover', (e) => {
|
|
56
|
-
// console.log('tooltip', touch(), this.disabled)
|
|
57
31
|
if (touch()) return
|
|
58
32
|
|
|
59
33
|
if (this.disabled === true) {
|
|
@@ -66,16 +40,18 @@ class Tooltip {
|
|
|
66
40
|
return
|
|
67
41
|
}
|
|
68
42
|
|
|
69
|
-
this.label.innerHTML = e.currentTarget.dataset.tooltip
|
|
43
|
+
this.ui.label.innerHTML = e.currentTarget.dataset.tooltip
|
|
70
44
|
const coord = this.offset(e.currentTarget)
|
|
71
45
|
|
|
72
46
|
this.show()
|
|
73
|
-
this.element.style.top = (coord.top + this.options.offset.top) + 'px'
|
|
74
|
-
this.element.style.left = coord.left - (this.element.offsetWidth / 2) + (e.currentTarget.offsetWidth / 2) + 'px'
|
|
47
|
+
// this.element.style.top = (coord.top + this.options.offset.top) + 'px'
|
|
48
|
+
// this.element.style.left = coord.left - (this.element.offsetWidth / 2) + (e.currentTarget.offsetWidth / 2) + 'px'
|
|
49
|
+
|
|
50
|
+
this.position(e.currentTarget)
|
|
75
51
|
})
|
|
76
52
|
|
|
77
53
|
targets[i].addEventListener('mouseleave', (e) => {
|
|
78
|
-
this.label.innerHTML = ''
|
|
54
|
+
this.ui.label.innerHTML = ''
|
|
79
55
|
this.hide()
|
|
80
56
|
})
|
|
81
57
|
}
|
package/src/view.js
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import build from './mixin/build'
|
|
1
|
+
import Control from './class/control'
|
|
3
2
|
|
|
4
|
-
class View extends
|
|
3
|
+
class View extends Control {
|
|
5
4
|
static defaults = {
|
|
6
|
-
class: 'view'
|
|
7
|
-
type: null
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
constructor (options) {
|
|
11
|
-
super()
|
|
12
|
-
|
|
13
|
-
this.init(options)
|
|
14
|
-
this.build()
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
init (options) {
|
|
18
|
-
this.options = { ...View.defaults, ...options }
|
|
19
|
-
Object.assign(this, build)
|
|
5
|
+
class: 'view'
|
|
20
6
|
}
|
|
21
7
|
}
|
|
22
8
|
|
package/src/component.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import create from './mixin/create'
|
|
2
|
-
import events from './mixin/events'
|
|
3
|
-
import insert from './mixin/insert'
|
|
4
|
-
|
|
5
|
-
import emitter from './module/emitter'
|
|
6
|
-
|
|
7
|
-
// Depracted
|
|
8
|
-
|
|
9
|
-
class Component {
|
|
10
|
-
static defaults = {
|
|
11
|
-
prefix: 'material',
|
|
12
|
-
class: 'component',
|
|
13
|
-
tag: 'span'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
constructor (options) {
|
|
17
|
-
this.init(options)
|
|
18
|
-
this.build()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
init (options) {
|
|
22
|
-
this.options = { ...Component.defaults, ...options }
|
|
23
|
-
|
|
24
|
-
Object.assign(this, emitter, events, insert)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
build () {
|
|
28
|
-
this.element = create(this.options)
|
|
29
|
-
|
|
30
|
-
if (this.options.container) {
|
|
31
|
-
this.insert(this.options.container)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return this
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default Component
|