material 0.6.1 → 0.7.0
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 +11 -2
- package/package.json +1 -1
- package/src/appbar.js +28 -28
- package/src/banner.js +20 -20
- package/src/button.js +18 -19
- package/src/calendar.js +8 -8
- package/src/card.js +4 -4
- package/src/checkbox.js +8 -8
- package/src/component.js +4 -4
- package/src/container.js +4 -4
- package/src/control/button.js +64 -88
- package/src/control/button.new.js +25 -25
- package/src/control/datehour.js +4 -4
- package/src/control/dialog.js +12 -11
- package/src/control/file.js +8 -8
- package/src/control/image.js +6 -6
- package/src/control/link.js +9 -9
- package/src/control/list.js +25 -35
- package/src/control/loading.js +10 -10
- package/src/control/menu.js +85 -0
- package/src/control/search.js +9 -9
- package/src/control/select.js +6 -6
- package/src/control/selecter.js +15 -15
- package/src/control/snackbar.js +91 -0
- package/src/control/switch.js +18 -18
- package/src/control/switcher.js +16 -16
- package/src/control/text.js +11 -7
- package/src/control/textfield.js +12 -12
- package/src/dialog.js +19 -19
- package/src/divider.js +4 -4
- package/src/drawer.js +11 -11
- package/src/element.js +6 -31
- package/src/field/email.js +5 -5
- package/src/field/image.js +4 -4
- package/src/form/build.js +7 -7
- package/src/form.js +6 -6
- package/src/icon.js +8 -8
- package/src/image.js +14 -14
- package/src/item.js +7 -7
- package/src/layout.js +10 -10
- package/src/list/add.js +1 -1
- package/src/list/build.js +7 -7
- package/src/list/display.js +10 -10
- package/src/list/search.js +2 -2
- package/src/list.js +13 -13
- package/src/map/build.js +6 -6
- package/src/map/display.js +8 -8
- package/src/menu.js +15 -15
- package/src/{component → mixin}/control.js +10 -10
- package/src/{component → mixin}/create.js +1 -1
- package/src/mixin/display.js +76 -0
- package/src/mixin/emitter.js +23 -0
- package/src/{component → mixin}/events.js +2 -2
- package/src/{component → mixin}/focus.js +2 -3
- package/src/{component → mixin}/insert.js +1 -1
- package/src/module/build.js +44 -0
- package/src/{component → module}/classify.js +0 -13
- package/src/module/dataset.js +12 -0
- package/src/module/dom.js +1 -57
- package/src/module/events.js +57 -0
- package/src/module/jsontohtml.js +20 -0
- package/src/module/last.js +0 -0
- package/src/{component → module}/ripple.js +15 -42
- package/src/progress.js +7 -7
- package/src/select.js +16 -16
- package/src/selector.js +32 -32
- package/src/skin/material/control/menu.sass +29 -0
- package/src/skin/material/control/snackbar.sass +65 -0
- package/src/slider.js +32 -32
- package/src/snackbar.js +8 -8
- package/src/switch.js +9 -9
- package/src/tabs.js +8 -8
- package/src/tabview.js +8 -8
- package/src/text.js +5 -5
- package/src/textfield.js +16 -16
- package/src/toolbar.js +28 -28
- package/src/tooltip.js +11 -11
- package/src/tree.js +12 -16
- package/src/view/build.js +7 -7
- package/src/view/display.js +16 -16
- package/src/view.js +5 -5
- package/src/component/click.js +0 -17
- /package/src/{component → mixin}/controller.js +0 -0
- /package/src/{component → mixin}/icon.js +0 -0
- /package/src/{component → mixin}/init.js +0 -0
- /package/src/{component → mixin}/label.js +0 -0
- /package/src/{component → mixin}/settings.js +0 -0
package/src/control/switcher.js
CHANGED
|
@@ -30,26 +30,26 @@ class Switcher {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
build () {
|
|
33
|
-
this.
|
|
33
|
+
this.element = document.createElement(this.options.tag)
|
|
34
34
|
|
|
35
35
|
if (this.options.class !== 'button') {
|
|
36
|
-
this.
|
|
36
|
+
this.element.setAttribute('class', 'switcher ' + this.options.class)
|
|
37
37
|
} else {
|
|
38
|
-
this.
|
|
38
|
+
this.element.classList.add('switcher')
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
if (this.options.label) {
|
|
42
42
|
this.label = document.createElement('label')
|
|
43
43
|
this.label.innerHTML = this.options.label
|
|
44
|
-
this.
|
|
44
|
+
this.element.appendChild(this.label)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
this.knob = document.createElement('span')
|
|
48
48
|
this.knob.classList.add('knob')
|
|
49
|
-
this.
|
|
49
|
+
this.element.appendChild(this.knob)
|
|
50
50
|
|
|
51
51
|
if (this.options.size) {
|
|
52
|
-
this.
|
|
52
|
+
this.element.classList.add(this.options.size + '-size')
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
this.buildList(this.options.list)
|
|
@@ -59,17 +59,17 @@ class Switcher {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
if (this.options.container) {
|
|
62
|
-
this.options.container.appendChild(this.
|
|
62
|
+
this.options.container.appendChild(this.element)
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
buildList (list) {
|
|
67
67
|
this.list = document.createElement('ul')
|
|
68
|
-
this.
|
|
68
|
+
this.element.appendChild(this.list)
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
attach () {
|
|
72
|
-
this.
|
|
72
|
+
this.element.addEventListener('click', (event) => {
|
|
73
73
|
if (!event.target.dataset.switcher) return
|
|
74
74
|
this.select(event.target)
|
|
75
75
|
})
|
|
@@ -97,7 +97,7 @@ class Switcher {
|
|
|
97
97
|
|
|
98
98
|
selectByName (name) {
|
|
99
99
|
// console.log('selectByName', name)
|
|
100
|
-
var item = this.
|
|
100
|
+
var item = this.element.querySelector('[data-switcher="' + name + '"]')
|
|
101
101
|
// console.log('item', item)
|
|
102
102
|
if (item) {
|
|
103
103
|
this.select(item)
|
|
@@ -106,7 +106,7 @@ class Switcher {
|
|
|
106
106
|
|
|
107
107
|
preSelectByName (name) {
|
|
108
108
|
// console.log('selectByName', name)
|
|
109
|
-
var item = this.
|
|
109
|
+
var item = this.element.querySelector('[data-switcher="' + name + '"]')
|
|
110
110
|
// console.log('item', item)
|
|
111
111
|
this.preselect(item)
|
|
112
112
|
}
|
|
@@ -165,24 +165,24 @@ class Switcher {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
setValue (value) {
|
|
168
|
-
// console.log('value', value, this.options.list, this.
|
|
168
|
+
// console.log('value', value, this.options.list, this.element)
|
|
169
169
|
var list = this.options.list
|
|
170
170
|
if (this.options.mode === 'unique') {
|
|
171
171
|
for (var i = 0; i < list.length; i++) {
|
|
172
|
-
this.
|
|
172
|
+
this.element.querySelector('[data-switcher="' + list[i] + '"]').classList.remove('selected')
|
|
173
173
|
if (list[i] == value) {
|
|
174
174
|
this.selected = [value]
|
|
175
|
-
this.
|
|
175
|
+
this.element.querySelector('[data-switcher="' + list[i] + '"]').classList.add('selected')
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
} else {
|
|
179
179
|
value = value || []
|
|
180
180
|
this.selected = []
|
|
181
181
|
for (var i = 0; i < list.length; i++) {
|
|
182
|
-
this.
|
|
182
|
+
this.element.querySelector('[data-switcher="' + list[i] + '"]').classList.remove('selected')
|
|
183
183
|
if (value.indexOf(list[i]) !== -1) {
|
|
184
184
|
this.selected.push(list[i])
|
|
185
|
-
this.
|
|
185
|
+
this.element.querySelector('[data-switcher="' + list[i] + '"]').classList.add('selected')
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
}
|
package/src/control/text.js
CHANGED
|
@@ -26,11 +26,11 @@ class Text {
|
|
|
26
26
|
* @return {Object} This class instance
|
|
27
27
|
*/
|
|
28
28
|
build () {
|
|
29
|
-
this.
|
|
30
|
-
addClass(this.
|
|
29
|
+
this.element = document.createElement(this.options.tag)
|
|
30
|
+
addClass(this.element, this.options.class)
|
|
31
31
|
|
|
32
32
|
if (this.options.class !== 'text') {
|
|
33
|
-
this.
|
|
33
|
+
this.element.classList.add('text')
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if (this.options.text) {
|
|
@@ -38,7 +38,7 @@ class Text {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (this.options.container) {
|
|
41
|
-
this.options.container.appendChild(this.
|
|
41
|
+
this.options.container.appendChild(this.element)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
return this
|
|
@@ -50,16 +50,20 @@ class Text {
|
|
|
50
50
|
|
|
51
51
|
var label = this.options.label || ''
|
|
52
52
|
|
|
53
|
-
this.
|
|
53
|
+
if (this.options.textFirst) {
|
|
54
|
+
this.element.innerHTML = text + label
|
|
55
|
+
} else {
|
|
56
|
+
this.element.innerHTML = label + text
|
|
57
|
+
}
|
|
54
58
|
|
|
55
59
|
if (this.options.spaceAfter) {
|
|
56
|
-
this.
|
|
60
|
+
this.element.innerHTML = this.element.innerHTML + ' '
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
setText (text) {
|
|
61
65
|
// console.log('setText', text)
|
|
62
|
-
this.
|
|
66
|
+
this.element.innerHTML = text
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
|
package/src/control/textfield.js
CHANGED
|
@@ -42,11 +42,11 @@ class Text {
|
|
|
42
42
|
build () {
|
|
43
43
|
var tag = this.options.tag || 'div'
|
|
44
44
|
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
45
|
+
this.element = document.createElement(tag)
|
|
46
|
+
this.element.classList.add('textfield')
|
|
47
47
|
|
|
48
48
|
if (this.options.class !== 'textfield') {
|
|
49
|
-
this.
|
|
49
|
+
this.element.classList.add(this.options.class)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
this.buildLabel()
|
|
@@ -57,11 +57,11 @@ class Text {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
if (this.options.data) {
|
|
60
|
-
dataset(this.
|
|
60
|
+
dataset(this.element, this.options.data)
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
if (this.container) {
|
|
64
|
-
this.container.appendChild(this.
|
|
64
|
+
this.container.appendChild(this.element)
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
return this
|
|
@@ -72,7 +72,7 @@ class Text {
|
|
|
72
72
|
this.label = document.createElement('label')
|
|
73
73
|
this.label.classList.add('label')
|
|
74
74
|
this.label.innerHTML = this.options.label
|
|
75
|
-
this.
|
|
75
|
+
this.element.appendChild(this.label)
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -83,7 +83,7 @@ class Text {
|
|
|
83
83
|
}
|
|
84
84
|
this.input = document.createElement(tag)
|
|
85
85
|
this.input.classList.add('input')
|
|
86
|
-
this.
|
|
86
|
+
this.element.appendChild(this.input)
|
|
87
87
|
|
|
88
88
|
attributes(this.input, this.options)
|
|
89
89
|
|
|
@@ -99,12 +99,12 @@ class Text {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
onFocus (ev) {
|
|
102
|
-
this.
|
|
102
|
+
this.element.classList.add('focused')
|
|
103
103
|
this.emit('focus', ev)
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
onBlur (ev) {
|
|
107
|
-
this.
|
|
107
|
+
this.element.classList.remove('focused')
|
|
108
108
|
this.emit('blur', ev)
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -120,7 +120,7 @@ class Text {
|
|
|
120
120
|
* @return {Object} The class instance
|
|
121
121
|
*/
|
|
122
122
|
set (prop, value) {
|
|
123
|
-
// console.log('set', this.
|
|
123
|
+
// console.log('set', this.element, prop, value)
|
|
124
124
|
switch (prop) {
|
|
125
125
|
case 'value':
|
|
126
126
|
this.setValue(value)
|
|
@@ -162,11 +162,11 @@ class Text {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
hide () {
|
|
165
|
-
this.
|
|
165
|
+
this.element.classList.add('hide')
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
show () {
|
|
169
|
-
this.
|
|
169
|
+
this.element.classList.remove('hide')
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
get () {
|
package/src/dialog.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
// dialog related modules
|
|
4
|
-
import events from './
|
|
4
|
+
import events from './mixin/events'
|
|
5
5
|
import emitter from './module/emitter'
|
|
6
|
-
import controller from './
|
|
6
|
+
import controller from './mixin/controller'
|
|
7
7
|
import attach from './module/attach'
|
|
8
|
-
import insert from './
|
|
8
|
+
import insert from './mixin/insert'
|
|
9
9
|
import event from './element/event.js'
|
|
10
10
|
import css from './module/css'
|
|
11
11
|
|
|
@@ -34,7 +34,7 @@ class Dialog {
|
|
|
34
34
|
this.build()
|
|
35
35
|
this.attach()
|
|
36
36
|
|
|
37
|
-
this.
|
|
37
|
+
this.element.style.display = 'none'
|
|
38
38
|
|
|
39
39
|
return this
|
|
40
40
|
}
|
|
@@ -65,27 +65,27 @@ class Dialog {
|
|
|
65
65
|
* @return {Object} The class instance
|
|
66
66
|
*/
|
|
67
67
|
build () {
|
|
68
|
-
this.
|
|
68
|
+
this.element = document.createElement('div')
|
|
69
69
|
|
|
70
|
-
css.add(this.
|
|
70
|
+
css.add(this.element, 'material-dialog')
|
|
71
71
|
|
|
72
72
|
if (this.options.name) {
|
|
73
|
-
css.add(this.
|
|
73
|
+
css.add(this.element, 'dialog-' + this.options.name)
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
if (this.options.css) {
|
|
77
|
-
css.add(this.
|
|
77
|
+
css.add(this.element, this.options.css)
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (this.options.theme) {
|
|
81
|
-
css.add(this.
|
|
81
|
+
css.add(this.element, this.options.theme + '-theme')
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
this.surface = document.createElement('div')
|
|
85
85
|
|
|
86
86
|
css.add(this.surface, 'dialog-surface')
|
|
87
87
|
|
|
88
|
-
this.insertElement(this.surface, this.
|
|
88
|
+
this.insertElement(this.surface, this.element)
|
|
89
89
|
|
|
90
90
|
if (this.options.title) {
|
|
91
91
|
this.buildTitle()
|
|
@@ -176,13 +176,13 @@ class Dialog {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
close () {
|
|
179
|
-
css.add(this.
|
|
179
|
+
css.add(this.element, 'dialog-closing')
|
|
180
180
|
|
|
181
181
|
var delayMillis = 200 // 1 second
|
|
182
182
|
setTimeout(() => {
|
|
183
|
-
this.
|
|
184
|
-
css.remove(this.
|
|
185
|
-
css.remove(this.
|
|
183
|
+
this.element.style.display = 'none'
|
|
184
|
+
css.remove(this.element, 'dialog-closing')
|
|
185
|
+
css.remove(this.element, 'dialog-show')
|
|
186
186
|
}, delayMillis)
|
|
187
187
|
|
|
188
188
|
this.previousActive.focus()
|
|
@@ -193,19 +193,19 @@ class Dialog {
|
|
|
193
193
|
show () {
|
|
194
194
|
this.previousActive = document.activeElement
|
|
195
195
|
|
|
196
|
-
this.
|
|
197
|
-
// css.add(this.
|
|
196
|
+
this.element.style.display = 'flex'
|
|
197
|
+
// css.add(this.element, 'dialog-showing');
|
|
198
198
|
|
|
199
199
|
var delayMillis = 100 // 1 second
|
|
200
200
|
|
|
201
201
|
setTimeout(() => {
|
|
202
|
-
css.add(this.
|
|
203
|
-
// css.remove(this.
|
|
202
|
+
css.add(this.element, 'dialog-show')
|
|
203
|
+
// css.remove(this.element, 'dialog-showing');
|
|
204
204
|
}, delayMillis)
|
|
205
205
|
|
|
206
206
|
return this
|
|
207
207
|
|
|
208
|
-
// var button = this.
|
|
208
|
+
// var button = this.element.querySelector('button')
|
|
209
209
|
|
|
210
210
|
// if (button) button.focus()
|
|
211
211
|
}
|
package/src/divider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import create from './
|
|
4
|
-
import insert from './
|
|
3
|
+
import create from './mixin/create'
|
|
4
|
+
import insert from './mixin/insert'
|
|
5
5
|
|
|
6
6
|
var defaults = {
|
|
7
7
|
prefix: 'material',
|
|
@@ -45,10 +45,10 @@ class Divider {
|
|
|
45
45
|
* @return {Object} This class instance
|
|
46
46
|
*/
|
|
47
47
|
build () {
|
|
48
|
-
this.
|
|
48
|
+
this.element = create(this.options)
|
|
49
49
|
|
|
50
50
|
if (this.options.text) {
|
|
51
|
-
this.
|
|
51
|
+
this.element.textContent = this.options.text
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
if (this.options.container) {
|
package/src/drawer.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import init from './
|
|
3
|
+
import init from './mixin/init'
|
|
4
4
|
import insert from './element/insert'
|
|
5
|
-
import classify from './
|
|
5
|
+
import classify from './module/classify'
|
|
6
6
|
import css from './module/css'
|
|
7
|
-
import events from './
|
|
7
|
+
import events from './mixin/events'
|
|
8
8
|
import create from './element/create'
|
|
9
9
|
import emitter from './module/emitter'
|
|
10
10
|
|
|
@@ -57,14 +57,14 @@ class Drawer {
|
|
|
57
57
|
|
|
58
58
|
classify(this.wrapper, this.options)
|
|
59
59
|
|
|
60
|
-
this.
|
|
60
|
+
this.element = create('aside')
|
|
61
61
|
|
|
62
|
-
css.add(this.
|
|
62
|
+
css.add(this.element, 'drawer-panel')
|
|
63
63
|
|
|
64
|
-
insert(this.
|
|
64
|
+
insert(this.element, this.wrapper)
|
|
65
65
|
|
|
66
66
|
if (this.options.position) {
|
|
67
|
-
css.add(this.
|
|
67
|
+
css.add(this.element, 'position-' + this.options.position)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
if (this.options.fixed) {
|
|
@@ -73,9 +73,9 @@ class Drawer {
|
|
|
73
73
|
|
|
74
74
|
if (this.options.size) {
|
|
75
75
|
if (this.options.position === 'top' || this.options.position === 'bottom') {
|
|
76
|
-
this.
|
|
76
|
+
this.element.style = 'height: ' + this.options.size + 'px;'
|
|
77
77
|
} else {
|
|
78
|
-
this.
|
|
78
|
+
this.element.style = 'width: ' + this.options.size + 'px;'
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -85,7 +85,7 @@ class Drawer {
|
|
|
85
85
|
|
|
86
86
|
if (this.options.container) { insert(this.wrapper, this.options.container) }
|
|
87
87
|
|
|
88
|
-
this.emit('built', this.
|
|
88
|
+
this.emit('built', this.element)
|
|
89
89
|
|
|
90
90
|
return this
|
|
91
91
|
}
|
|
@@ -109,7 +109,7 @@ class Drawer {
|
|
|
109
109
|
*/
|
|
110
110
|
|
|
111
111
|
toggle () {
|
|
112
|
-
// console.log('toggle', this.
|
|
112
|
+
// console.log('toggle', this.element);
|
|
113
113
|
if (this.wrapper.classList.contains('show')) {
|
|
114
114
|
this.close()
|
|
115
115
|
} else {
|
package/src/element.js
CHANGED
|
@@ -1,46 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Class Element
|
|
4
|
-
* @class
|
|
5
|
-
* @since 0.0.1
|
|
6
|
-
* @example
|
|
7
|
-
* var div = new Element({
|
|
8
|
-
* tag: 'div',
|
|
9
|
-
* class: 'mydiv',
|
|
10
|
-
* })
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
1
|
class Element {
|
|
14
2
|
static isElement () {
|
|
15
3
|
return true
|
|
16
4
|
}
|
|
17
5
|
|
|
18
|
-
/**
|
|
19
|
-
* The init method of the Button class
|
|
20
|
-
* @param {Object} The element attributes
|
|
21
|
-
* @private
|
|
22
|
-
* @return {DOMElement} The dom element
|
|
23
|
-
*/
|
|
24
6
|
constructor (options) {
|
|
25
7
|
this.options = Object.assign({}, options || {})
|
|
26
8
|
// console.log('element options', options)
|
|
27
9
|
var element = document.createElement(this.options.tag || 'div')
|
|
10
|
+
delete this.options.tag
|
|
28
11
|
|
|
29
|
-
if (options.html)
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (options.text) {
|
|
34
|
-
element.textContent = this.options.text
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (options.id) {
|
|
38
|
-
element.setAttribute('id', options.id)
|
|
39
|
-
}
|
|
12
|
+
if (options.html) element.innerHTML = this.options.html
|
|
13
|
+
delete this.options.html
|
|
40
14
|
|
|
41
|
-
|
|
15
|
+
if (options.text) element.textContent = this.options.text
|
|
42
16
|
delete this.options.text
|
|
43
|
-
|
|
17
|
+
|
|
18
|
+
if (options.id) element.setAttribute('id', options.id)
|
|
44
19
|
|
|
45
20
|
for (var property in this.options) {
|
|
46
21
|
if (this.options.hasOwnProperty(property)) {
|
package/src/field/email.js
CHANGED
|
@@ -40,19 +40,19 @@ class EmailLink {
|
|
|
40
40
|
* @return {Object} This class instance
|
|
41
41
|
*/
|
|
42
42
|
build () {
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
43
|
+
this.element = document.createElement('a')
|
|
44
|
+
this.element.classList.add('email')
|
|
45
45
|
|
|
46
46
|
if (this.options.container) {
|
|
47
|
-
this.options.container.appendChild(this.
|
|
47
|
+
this.options.container.appendChild(this.element)
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
return this
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
set (email) {
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
54
|
+
this.element.innerHTML = email
|
|
55
|
+
this.element.setAttribute('href', 'mailto:' + email)
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
package/src/field/image.js
CHANGED
|
@@ -42,11 +42,11 @@ class Image {
|
|
|
42
42
|
* @return {Object} This class instance
|
|
43
43
|
*/
|
|
44
44
|
build () {
|
|
45
|
-
this.
|
|
46
|
-
this.
|
|
45
|
+
this.element = document.createElement('div')
|
|
46
|
+
this.element.classList.add(this.options.class)
|
|
47
47
|
|
|
48
48
|
if (this.options.container) {
|
|
49
|
-
this.options.container.appendChild(this.
|
|
49
|
+
this.options.container.appendChild(this.element)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
return this
|
|
@@ -76,7 +76,7 @@ class Image {
|
|
|
76
76
|
url = url + format
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
this.
|
|
79
|
+
this.element.style.backgroundImage = 'url(' + asset.url + src.path + 'thumb/' + src.filename + ')'
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
sanitize (formats) {
|
package/src/form/build.js
CHANGED
|
@@ -5,19 +5,19 @@ import Layout from '../layout'
|
|
|
5
5
|
export default {
|
|
6
6
|
build () {
|
|
7
7
|
// console.log('build', this.options.layout)
|
|
8
|
-
this.
|
|
9
|
-
this.
|
|
8
|
+
this.element = document.createElement('div')
|
|
9
|
+
this.element.classList.add('form')
|
|
10
10
|
|
|
11
11
|
if (this.options.class !== 'form') {
|
|
12
|
-
this.
|
|
12
|
+
this.element.classList.add(this.options.class)
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
if (this.options.form) {
|
|
16
|
-
this.
|
|
16
|
+
this.element.classList.add(this.options.form)
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
if (this.options.data) {
|
|
20
|
-
dataset(this.
|
|
20
|
+
dataset(this.element, this.options.data)
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
this.buildForm(this.options.form)
|
|
@@ -25,13 +25,13 @@ export default {
|
|
|
25
25
|
this.buildLayout()
|
|
26
26
|
|
|
27
27
|
if (this.options.container) {
|
|
28
|
-
this.options.container.appendChild(this.
|
|
28
|
+
this.options.container.appendChild(this.element)
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
|
|
32
32
|
buildForm (form) {
|
|
33
33
|
this.form = document.createElement('form')
|
|
34
|
-
this.
|
|
34
|
+
this.element.appendChild(this.form)
|
|
35
35
|
|
|
36
36
|
if (form && form.method) {
|
|
37
37
|
this.form.setAttribute('method', form.method)
|
package/src/form.js
CHANGED
|
@@ -4,7 +4,7 @@ import insert from './element/insert'
|
|
|
4
4
|
import css from './module/css'
|
|
5
5
|
import emitter from './module/emitter'
|
|
6
6
|
import attach from './module/attach'
|
|
7
|
-
import controller from './
|
|
7
|
+
import controller from './mixin/controller'
|
|
8
8
|
|
|
9
9
|
// import component
|
|
10
10
|
import Layout from './layout'
|
|
@@ -72,13 +72,13 @@ class Form {
|
|
|
72
72
|
build () {
|
|
73
73
|
var tag = this.options.tag || 'div'
|
|
74
74
|
|
|
75
|
-
this.
|
|
76
|
-
css.add(this.
|
|
75
|
+
this.element = document.createElement(tag)
|
|
76
|
+
css.add(this.element, this.options.prefix + '-' + this.options.class)
|
|
77
77
|
|
|
78
78
|
// complete layout options
|
|
79
|
-
this.options.root = this.
|
|
79
|
+
this.options.root = this.element
|
|
80
80
|
|
|
81
|
-
this.layout = new Layout(this.options.layout, this.
|
|
81
|
+
this.layout = new Layout(this.options.layout, this.element)
|
|
82
82
|
|
|
83
83
|
this._initControls(this.layout.controls)
|
|
84
84
|
|
|
@@ -86,7 +86,7 @@ class Form {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
insert (container, context) {
|
|
89
|
-
insert(this.
|
|
89
|
+
insert(this.element, container, context)
|
|
90
90
|
|
|
91
91
|
return this
|
|
92
92
|
}
|
package/src/icon.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import insert from './
|
|
3
|
+
import insert from './mixin/insert'
|
|
4
4
|
import css from './module/css'
|
|
5
5
|
|
|
6
6
|
var defaults = {
|
|
@@ -55,11 +55,11 @@ class Icon {
|
|
|
55
55
|
|
|
56
56
|
this.element = this.element || {}
|
|
57
57
|
|
|
58
|
-
this.
|
|
59
|
-
css.add(this.
|
|
58
|
+
this.element = document.createElement(tag)
|
|
59
|
+
css.add(this.element, this.options.prefix + '-' + this.options.class)
|
|
60
60
|
|
|
61
|
-
if (options.css) { css.add(this.
|
|
62
|
-
// css.add(this.
|
|
61
|
+
if (options.css) { css.add(this.element, options.css) }
|
|
62
|
+
// css.add(this.element, this.options.class + '-adjust');
|
|
63
63
|
|
|
64
64
|
if (this.options.container) {
|
|
65
65
|
this.insert(this.options.container)
|
|
@@ -73,10 +73,10 @@ class Icon {
|
|
|
73
73
|
*/
|
|
74
74
|
set (value) {
|
|
75
75
|
if (value) {
|
|
76
|
-
if (this.
|
|
77
|
-
this.
|
|
76
|
+
if (this.element.innerText) {
|
|
77
|
+
this.element.innerText = value
|
|
78
78
|
} else {
|
|
79
|
-
this.
|
|
79
|
+
this.element.textContent = value
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
return this
|