material 0.6.2 → 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 -92
- package/src/control/button.new.js +25 -25
- package/src/control/datehour.js +4 -4
- package/src/control/dialog.js +10 -10
- 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 +3 -3
- package/src/control/loading.js +10 -10
- package/src/control/menu.js +2 -2
- 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 +7 -5
- package/src/control/switch.js +18 -18
- package/src/control/switcher.js +16 -16
- package/src/control/text.js +8 -8
- 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/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/{module → mixin}/display.js +10 -22
- 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 +4 -3
- package/src/{component → module}/classify.js +0 -13
- package/src/module/dom.js +1 -57
- package/src/module/events.js +4 -2
- 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/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 +6 -6
- 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}/emitter.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/button.js
CHANGED
|
@@ -1,121 +1,107 @@
|
|
|
1
|
-
import
|
|
2
|
-
import attach from '../module/attach'
|
|
3
|
-
|
|
4
|
-
import dataset from '../view/dataset'
|
|
5
|
-
|
|
6
|
-
const defaults = {
|
|
7
|
-
class: 'button',
|
|
8
|
-
tag: 'button',
|
|
9
|
-
styles: ['style', 'color'],
|
|
10
|
-
stopPropagation: false,
|
|
11
|
-
events: [
|
|
12
|
-
['root.click', 'click'],
|
|
13
|
-
['root.mousedown', 'mousedown'],
|
|
14
|
-
['root.mouseup', 'mouseup'],
|
|
15
|
-
['root.mouseleave', 'mouseup'],
|
|
16
|
-
['root.touchstart', 'mousedown'],
|
|
17
|
-
['root.touchend', 'mouseup']
|
|
18
|
-
]
|
|
1
|
+
import EventEmitter from '../mixin/emitter'
|
|
19
2
|
|
|
20
|
-
|
|
3
|
+
import build from '../module/build'
|
|
4
|
+
import display from '../mixin/display'
|
|
5
|
+
import bindEvents from '../module/events'
|
|
6
|
+
|
|
7
|
+
import dataset from '../module/dataset'
|
|
8
|
+
import ripple from '../module/ripple'
|
|
21
9
|
|
|
22
|
-
class Button {
|
|
10
|
+
class Button extends EventEmitter{
|
|
23
11
|
static isComponent () {
|
|
24
12
|
return true
|
|
25
13
|
}
|
|
26
14
|
|
|
15
|
+
static defaults = {
|
|
16
|
+
class: 'button',
|
|
17
|
+
tag: 'button',
|
|
18
|
+
modules: [build, bindEvents],
|
|
19
|
+
styles: ['style', 'color'],
|
|
20
|
+
ripple: false,
|
|
21
|
+
stopPropagation: false,
|
|
22
|
+
events: [
|
|
23
|
+
['element.click', 'click'],
|
|
24
|
+
['element.mousedown', 'mousedown'],
|
|
25
|
+
['element.mouseup', 'mouseup'],
|
|
26
|
+
['element.mouseleave', 'mouseup'],
|
|
27
|
+
['element.touchstart', 'mousedown'],
|
|
28
|
+
['element.touchend', 'mouseup']
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
|
|
27
32
|
/**
|
|
28
33
|
* Constructor
|
|
29
34
|
* @param {Object} options - Component options
|
|
30
35
|
* @return {Object} Class instance
|
|
31
36
|
*/
|
|
32
37
|
constructor (options) {
|
|
33
|
-
|
|
34
|
-
Object.assign(this, emitter, attach)
|
|
35
|
-
// console.log('options', options)
|
|
36
|
-
|
|
37
|
-
this.init()
|
|
38
|
-
|
|
39
|
-
return this
|
|
40
|
-
}
|
|
38
|
+
super()
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
this.init(options)
|
|
43
41
|
this.build()
|
|
44
42
|
this.setup()
|
|
45
|
-
this.
|
|
43
|
+
this.bindEvents()
|
|
46
44
|
|
|
47
45
|
if (this.options.container) {
|
|
48
46
|
this.append(this.options.container)
|
|
49
47
|
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Build Method
|
|
54
|
-
* @return {Object} This class instance
|
|
55
|
-
*/
|
|
56
|
-
build () {
|
|
57
|
-
this.root = document.createElement(this.options.tag)
|
|
58
48
|
|
|
59
|
-
|
|
49
|
+
return this
|
|
50
|
+
}
|
|
60
51
|
|
|
61
|
-
|
|
52
|
+
init (options) {
|
|
53
|
+
this.options = Object.assign({}, Button.defaults, options || {})
|
|
54
|
+
Object.assign(this, build, display, bindEvents)
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
this.root.setAttribute('class', 'button ' + this.options.class)
|
|
65
|
-
} else {
|
|
66
|
-
this.root.classList.add('button')
|
|
67
|
-
}
|
|
56
|
+
}
|
|
68
57
|
|
|
58
|
+
setup () {
|
|
69
59
|
this.styleAttributes()
|
|
70
60
|
|
|
71
61
|
this.buildIcon()
|
|
72
62
|
this.buildLabel()
|
|
73
63
|
|
|
74
64
|
if (this.options.text) {
|
|
75
|
-
this.
|
|
65
|
+
this.element.innerHTML = this.element.innerHTML + this.options.text
|
|
76
66
|
}
|
|
77
67
|
|
|
78
|
-
return this
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
setup () {
|
|
82
68
|
if (this.options.data) {
|
|
83
|
-
dataset(this.
|
|
69
|
+
dataset(this.element, this.options.data)
|
|
84
70
|
}
|
|
85
71
|
|
|
86
72
|
if (this.options.type) {
|
|
87
|
-
this.
|
|
73
|
+
this.element.setAttribute('type', this.options.type)
|
|
88
74
|
} else {
|
|
89
|
-
this.
|
|
75
|
+
this.element.setAttribute('type', 'button')
|
|
90
76
|
}
|
|
91
77
|
|
|
92
78
|
if (this.options.name) {
|
|
93
|
-
this.
|
|
79
|
+
this.element.setAttribute('name', this.options.name)
|
|
94
80
|
}
|
|
95
81
|
|
|
96
82
|
if (this.options.value) {
|
|
97
|
-
this.
|
|
83
|
+
this.element.setAttribute('value', this.options.value)
|
|
98
84
|
}
|
|
99
85
|
|
|
100
86
|
if (this.options.title) {
|
|
101
|
-
this.
|
|
87
|
+
this.element.setAttribute('title', this.options.title)
|
|
102
88
|
}
|
|
103
89
|
|
|
104
|
-
this.
|
|
90
|
+
this.element.setAttribute('aria-label', this.options.text || this.options.label || this.options.class)
|
|
105
91
|
|
|
106
92
|
if (this.options.tooltip) {
|
|
107
|
-
this.
|
|
93
|
+
this.element.setAttribute('data-tooltip', this.options.tooltip)
|
|
108
94
|
}
|
|
109
95
|
|
|
110
96
|
if (this.options.case) {
|
|
111
|
-
this.
|
|
97
|
+
this.element.classList.add(this.options.case + '-case')
|
|
112
98
|
}
|
|
113
99
|
}
|
|
114
100
|
|
|
115
101
|
append (container) {
|
|
116
102
|
container = container || this.options.container
|
|
117
103
|
if (this.options.container) {
|
|
118
|
-
container.appendChild(this.
|
|
104
|
+
container.appendChild(this.element)
|
|
119
105
|
}
|
|
120
106
|
}
|
|
121
107
|
|
|
@@ -127,7 +113,7 @@ class Button {
|
|
|
127
113
|
this.label.classList.add('label')
|
|
128
114
|
this.label.innerHTML = this.options.label
|
|
129
115
|
|
|
130
|
-
this.
|
|
116
|
+
this.element.appendChild(this.label)
|
|
131
117
|
}
|
|
132
118
|
}
|
|
133
119
|
|
|
@@ -139,25 +125,25 @@ class Button {
|
|
|
139
125
|
this.icon.classList.add('icon')
|
|
140
126
|
this.icon.innerHTML = this.options.icon
|
|
141
127
|
|
|
142
|
-
this.
|
|
128
|
+
this.element.appendChild(this.icon)
|
|
143
129
|
}
|
|
144
130
|
}
|
|
145
131
|
|
|
146
132
|
styleAttributes () {
|
|
147
133
|
if (this.options.style) {
|
|
148
|
-
this.
|
|
134
|
+
this.element.classList.add('style-' + this.options.style)
|
|
149
135
|
}
|
|
150
136
|
|
|
151
137
|
if (this.options.size) {
|
|
152
|
-
this.
|
|
138
|
+
this.element.classList.add(this.options.size + '-size')
|
|
153
139
|
}
|
|
154
140
|
|
|
155
141
|
if (this.options.color) {
|
|
156
|
-
this.
|
|
142
|
+
this.element.classList.add('color-' + this.options.color)
|
|
157
143
|
}
|
|
158
144
|
|
|
159
145
|
if (this.options.bold) {
|
|
160
|
-
this.
|
|
146
|
+
this.element.classList.add('bold')
|
|
161
147
|
}
|
|
162
148
|
}
|
|
163
149
|
|
|
@@ -168,10 +154,10 @@ class Button {
|
|
|
168
154
|
* @return {Object} The class instance
|
|
169
155
|
*/
|
|
170
156
|
set (prop, value) {
|
|
171
|
-
// console.log('set', this.
|
|
157
|
+
// console.log('set', this.element, prop, value)
|
|
172
158
|
switch (prop) {
|
|
173
159
|
case 'value':
|
|
174
|
-
this.
|
|
160
|
+
this.element.value = value
|
|
175
161
|
break
|
|
176
162
|
case 'label':
|
|
177
163
|
if (this.label) {
|
|
@@ -179,16 +165,16 @@ class Button {
|
|
|
179
165
|
}
|
|
180
166
|
break
|
|
181
167
|
case 'text':
|
|
182
|
-
this.
|
|
168
|
+
this.element.innerHTML = value
|
|
183
169
|
break
|
|
184
170
|
case 'icon':
|
|
185
|
-
if (this.
|
|
171
|
+
if (this.icon) {
|
|
186
172
|
this.icon.innerHTML = value
|
|
187
173
|
}
|
|
188
174
|
break
|
|
189
175
|
default:
|
|
190
176
|
// console.log('prop', prop)
|
|
191
|
-
this.
|
|
177
|
+
this.element.innerHTML = prop
|
|
192
178
|
}
|
|
193
179
|
|
|
194
180
|
return this
|
|
@@ -204,7 +190,7 @@ class Button {
|
|
|
204
190
|
if (this.label) {
|
|
205
191
|
this.setLabel(value)
|
|
206
192
|
} else {
|
|
207
|
-
this.
|
|
193
|
+
this.element.innerHTML = value
|
|
208
194
|
}
|
|
209
195
|
}
|
|
210
196
|
|
|
@@ -217,34 +203,20 @@ class Button {
|
|
|
217
203
|
get (prop, value) {
|
|
218
204
|
switch (prop) {
|
|
219
205
|
case 'value':
|
|
220
|
-
return this.
|
|
206
|
+
return this.element.value
|
|
221
207
|
case 'label':
|
|
222
208
|
return this.label.innerHTML
|
|
223
209
|
default:
|
|
224
|
-
return this.
|
|
210
|
+
return this.element.value
|
|
225
211
|
}
|
|
226
212
|
}
|
|
227
213
|
|
|
228
214
|
disable () {
|
|
229
|
-
this.
|
|
215
|
+
this.element.disabled = true
|
|
230
216
|
}
|
|
231
217
|
|
|
232
218
|
enable () {
|
|
233
|
-
this.
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
hide () {
|
|
237
|
-
this.root.classList.add('hide')
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
show () {
|
|
241
|
-
this.root.classList.remove('hide')
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
destroy () {
|
|
245
|
-
if (this.root && this.root.parentNode) {
|
|
246
|
-
this.root.parentNode.removeChild(this.root)
|
|
247
|
-
}
|
|
219
|
+
this.element.disabled = false
|
|
248
220
|
}
|
|
249
221
|
|
|
250
222
|
click (ev) {
|
|
@@ -256,11 +228,11 @@ class Button {
|
|
|
256
228
|
}
|
|
257
229
|
|
|
258
230
|
mousedown (ev) {
|
|
259
|
-
this.
|
|
231
|
+
this.element.classList.add('pushed')
|
|
260
232
|
}
|
|
261
233
|
|
|
262
234
|
mouseup (ev) {
|
|
263
|
-
this.
|
|
235
|
+
this.element.classList.remove('pushed')
|
|
264
236
|
}
|
|
265
237
|
}
|
|
266
238
|
|
|
@@ -41,17 +41,17 @@ class Button {
|
|
|
41
41
|
* @return {Object} This class instance
|
|
42
42
|
*/
|
|
43
43
|
build () {
|
|
44
|
-
this.
|
|
44
|
+
this.element = document.createElement(this.options.tag)
|
|
45
45
|
|
|
46
46
|
if (this.options.class !== 'button') {
|
|
47
|
-
this.
|
|
47
|
+
this.element.classList.add('button')
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
this.
|
|
50
|
+
this.element.classList.add(this.options.class)
|
|
51
51
|
this.styleAttributes()
|
|
52
52
|
|
|
53
53
|
if (this.options.text) {
|
|
54
|
-
this.
|
|
54
|
+
this.element.innerHTML = this.options.text
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if (this.options.label) {
|
|
@@ -63,33 +63,33 @@ class Button {
|
|
|
63
63
|
|
|
64
64
|
setup () {
|
|
65
65
|
if (this.options.data) {
|
|
66
|
-
dataset(this.
|
|
66
|
+
dataset(this.element, this.options.data)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (this.options.type) {
|
|
70
|
-
this.
|
|
70
|
+
this.element.setAttribute('type', this.options.type)
|
|
71
71
|
} else {
|
|
72
|
-
this.
|
|
72
|
+
this.element.setAttribute('type', 'button')
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
if (this.options.name) {
|
|
76
|
-
this.
|
|
76
|
+
this.element.setAttribute('name', this.options.name)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
this.
|
|
79
|
+
this.element.setAttribute('aria-label', this.options.text || this.options.label || this.options.class)
|
|
80
80
|
|
|
81
81
|
if (this.options.tooltip) {
|
|
82
|
-
this.
|
|
82
|
+
this.element.setAttribute('data-tooltip', this.options.tooltip)
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
if (this.options.case) {
|
|
86
|
-
this.
|
|
86
|
+
this.element.classList.add(this.options.case + '-case')
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
append (container) {
|
|
91
91
|
if (this.options.container) {
|
|
92
|
-
this.options.container.appendChild(this.
|
|
92
|
+
this.options.container.appendChild(this.element)
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -97,7 +97,7 @@ class Button {
|
|
|
97
97
|
if (this.options.label) {
|
|
98
98
|
this.label = document.createElement('label')
|
|
99
99
|
this.label.innerHTML = this.options.label
|
|
100
|
-
this.
|
|
100
|
+
this.element.appendChild(this.label)
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -105,26 +105,26 @@ class Button {
|
|
|
105
105
|
if (this.options.icon) {
|
|
106
106
|
this.label = document.createElement('label')
|
|
107
107
|
this.label.innerHTML = this.options.label
|
|
108
|
-
this.
|
|
108
|
+
this.element.appendChild(this.label)
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
styleAttributes () {
|
|
113
113
|
if (this.options.style) {
|
|
114
|
-
this.
|
|
114
|
+
this.element.classList.add('style-' + this.options.style)
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
if (this.options.color) {
|
|
118
|
-
this.
|
|
118
|
+
this.element.classList.add('color-' + this.options.color)
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
if (this.options.bold) {
|
|
122
|
-
this.
|
|
122
|
+
this.element.classList.add('bold')
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
attach () {
|
|
127
|
-
this.
|
|
127
|
+
this.element.addEventListener('click', (ev) => {
|
|
128
128
|
this.emit('click', ev)
|
|
129
129
|
})
|
|
130
130
|
}
|
|
@@ -138,7 +138,7 @@ class Button {
|
|
|
138
138
|
set (prop, value) {
|
|
139
139
|
switch (prop) {
|
|
140
140
|
case 'value':
|
|
141
|
-
this.
|
|
141
|
+
this.element.value = value
|
|
142
142
|
break
|
|
143
143
|
case 'label':
|
|
144
144
|
if (this.ui.label) {
|
|
@@ -151,7 +151,7 @@ class Button {
|
|
|
151
151
|
}
|
|
152
152
|
break
|
|
153
153
|
default:
|
|
154
|
-
this.
|
|
154
|
+
this.element.value = value
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
return this
|
|
@@ -166,24 +166,24 @@ class Button {
|
|
|
166
166
|
get (prop, value) {
|
|
167
167
|
switch (prop) {
|
|
168
168
|
case 'value':
|
|
169
|
-
return this.
|
|
169
|
+
return this.element.value
|
|
170
170
|
case 'label':
|
|
171
171
|
return this.ui.label.innerHTML
|
|
172
172
|
default:
|
|
173
|
-
return this.
|
|
173
|
+
return this.element.value
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
disable () {
|
|
178
|
-
this.
|
|
178
|
+
this.element.disabled = true
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
enable () {
|
|
182
|
-
this.
|
|
182
|
+
this.element.disabled = false
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
destroy () {
|
|
186
|
-
this.
|
|
186
|
+
this.element.parentNode.removeChild(this.element)
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
package/src/control/datehour.js
CHANGED
|
@@ -33,11 +33,11 @@ class DateHour {
|
|
|
33
33
|
* @return {Object} This class instance
|
|
34
34
|
*/
|
|
35
35
|
build () {
|
|
36
|
-
this.
|
|
37
|
-
this.
|
|
36
|
+
this.element = document.createElement(this.options.tag)
|
|
37
|
+
this.element.classList.add(this.options.class)
|
|
38
38
|
|
|
39
39
|
if (this.options.container) {
|
|
40
|
-
this.options.container.appendChild(this.
|
|
40
|
+
this.options.container.appendChild(this.element)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return this
|
|
@@ -47,7 +47,7 @@ class DateHour {
|
|
|
47
47
|
// console.log('set', src)
|
|
48
48
|
var d = new Date(date)
|
|
49
49
|
var formatted = this.format(d)
|
|
50
|
-
this.
|
|
50
|
+
this.element.innerHTML = formatted
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
format (date) {
|
package/src/control/dialog.js
CHANGED
|
@@ -57,28 +57,28 @@ class Dialog {
|
|
|
57
57
|
* @return {Object} The class instance
|
|
58
58
|
*/
|
|
59
59
|
build () {
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
60
|
+
this.element = document.createElement('div')
|
|
61
|
+
this.element.classList.add('dialog')
|
|
62
62
|
|
|
63
|
-
this.element = this.
|
|
63
|
+
this.element = this.element
|
|
64
64
|
|
|
65
65
|
if (this.options.class !== 'dialog') {
|
|
66
|
-
this.
|
|
66
|
+
this.element.classList.add(this.options.class)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (this.options.position) {
|
|
70
|
-
this.
|
|
70
|
+
this.element.classList.add('position-' + this.options.position)
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
this.surface = document.createElement('div')
|
|
74
74
|
this.surface.classList.add('surface')
|
|
75
|
-
this.
|
|
75
|
+
this.element.appendChild(this.surface)
|
|
76
76
|
|
|
77
77
|
this.layout = new Layout(this.options.layout, this.surface)
|
|
78
78
|
this.ui = this.layout.component
|
|
79
79
|
|
|
80
80
|
if (this.options.container) {
|
|
81
|
-
this.options.container.appendChild(this.
|
|
81
|
+
this.options.container.appendChild(this.element)
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
if (this.options.display === 'show') {
|
|
@@ -149,7 +149,7 @@ class Dialog {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
onClickRoot (e) {
|
|
152
|
-
console.log('onClickRoot')
|
|
152
|
+
// console.log('onClickRoot')
|
|
153
153
|
e.stopPropagation()
|
|
154
154
|
if (!this.options.modal) {
|
|
155
155
|
this.destroy()
|
|
@@ -157,11 +157,11 @@ class Dialog {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
emphase () {
|
|
160
|
-
this.
|
|
160
|
+
this.element.classList.add('emphase')
|
|
161
161
|
var it
|
|
162
162
|
it = setTimeout(() => {
|
|
163
163
|
clearTimeout(it)
|
|
164
|
-
this.
|
|
164
|
+
this.element.classList.remove('emphase')
|
|
165
165
|
}, 100)
|
|
166
166
|
}
|
|
167
167
|
|
package/src/control/file.js
CHANGED
|
@@ -28,18 +28,18 @@ class File {
|
|
|
28
28
|
* @return {Object} This class instance
|
|
29
29
|
*/
|
|
30
30
|
build () {
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
31
|
+
this.element = document.createElement('div')
|
|
32
|
+
this.element.classList.add('file')
|
|
33
33
|
|
|
34
34
|
if (this.options.class !== 'file') {
|
|
35
|
-
this.
|
|
35
|
+
this.element.classList.add(this.options.class)
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
this.buildLabel()
|
|
39
39
|
this.buildInput()
|
|
40
40
|
|
|
41
41
|
if (this.options.data) {
|
|
42
|
-
dataset(this.
|
|
42
|
+
dataset(this.element, this.options.data)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (this.options.focus) {
|
|
@@ -47,7 +47,7 @@ class File {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if (this.options.container) {
|
|
50
|
-
this.options.container.appendChild(this.
|
|
50
|
+
this.options.container.appendChild(this.element)
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
return this
|
|
@@ -58,18 +58,18 @@ class File {
|
|
|
58
58
|
this.label = document.createElement('label')
|
|
59
59
|
this.label.classList.add('label')
|
|
60
60
|
this.label.innerHTML = this.options.label
|
|
61
|
-
this.
|
|
61
|
+
this.element.appendChild(this.label)
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
buildInput () {
|
|
66
66
|
this.field = document.createElement('div')
|
|
67
67
|
this.field.classList.add('field')
|
|
68
|
-
this.
|
|
68
|
+
this.element.appendChild(this.field)
|
|
69
69
|
|
|
70
70
|
this.input = document.createElement('input')
|
|
71
71
|
this.input.setAttribute('type', 'file')
|
|
72
|
-
this.
|
|
72
|
+
this.element.appendChild(this.input)
|
|
73
73
|
|
|
74
74
|
attributes(this.input, this.options)
|
|
75
75
|
|
package/src/control/image.js
CHANGED
|
@@ -38,14 +38,14 @@ class Image {
|
|
|
38
38
|
* @return {Object} This class instance
|
|
39
39
|
*/
|
|
40
40
|
build () {
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
41
|
+
this.element = document.createElement(this.options.tag)
|
|
42
|
+
this.element.classList.add(this.options.class)
|
|
43
43
|
if (this.options.class !== 'image') {
|
|
44
|
-
this.
|
|
44
|
+
this.element.classList.add('image')
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
if (this.options.container) {
|
|
48
|
-
this.options.container.appendChild(this.
|
|
48
|
+
this.options.container.appendChild(this.element)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
return this
|
|
@@ -54,7 +54,7 @@ class Image {
|
|
|
54
54
|
set (src) {
|
|
55
55
|
// console.log('set', src)
|
|
56
56
|
if (!src) {
|
|
57
|
-
this.
|
|
57
|
+
this.element.style.backgroundImage = ''
|
|
58
58
|
} else {
|
|
59
59
|
var url = null
|
|
60
60
|
|
|
@@ -75,7 +75,7 @@ class Image {
|
|
|
75
75
|
url = src.url
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
this.
|
|
78
|
+
this.element.style.backgroundImage = 'url(' + url + src.filename + ')'
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
package/src/control/link.js
CHANGED
|
@@ -24,11 +24,11 @@ class Link {
|
|
|
24
24
|
* @return {Object} This class instance
|
|
25
25
|
*/
|
|
26
26
|
build () {
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
27
|
+
this.element = document.createElement(this.options.tag)
|
|
28
|
+
this.element.classList.add(this.options.class)
|
|
29
29
|
|
|
30
30
|
if (this.options.class !== 'link') {
|
|
31
|
-
this.
|
|
31
|
+
this.element.classList.add('link')
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (this.options.link) {
|
|
@@ -36,15 +36,15 @@ class Link {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
if (this.options.target !== 'blank') {
|
|
39
|
-
this.
|
|
39
|
+
this.element.target = this.options.target
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
if (this.options.container) {
|
|
43
|
-
this.options.container.appendChild(this.
|
|
43
|
+
this.options.container.appendChild(this.element)
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
if (this.options.text) {
|
|
47
|
-
this.
|
|
47
|
+
this.element.innerHTML = this.options.text
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
return this
|
|
@@ -55,13 +55,13 @@ class Link {
|
|
|
55
55
|
if (link === undefined) return
|
|
56
56
|
|
|
57
57
|
if (this.options.target === 'blank') {
|
|
58
|
-
this.
|
|
59
|
-
this.
|
|
58
|
+
this.element.href = '#'
|
|
59
|
+
this.element.addEventListener('click', () => {
|
|
60
60
|
window.open(link)
|
|
61
61
|
return false
|
|
62
62
|
})
|
|
63
63
|
} else {
|
|
64
|
-
this.
|
|
64
|
+
this.element.href = link
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|