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.
Files changed (82) hide show
  1. package/index.js +11 -2
  2. package/package.json +1 -1
  3. package/src/appbar.js +28 -28
  4. package/src/banner.js +20 -20
  5. package/src/button.js +18 -19
  6. package/src/calendar.js +8 -8
  7. package/src/card.js +4 -4
  8. package/src/checkbox.js +8 -8
  9. package/src/component.js +4 -4
  10. package/src/container.js +4 -4
  11. package/src/control/button.js +64 -92
  12. package/src/control/button.new.js +25 -25
  13. package/src/control/datehour.js +4 -4
  14. package/src/control/dialog.js +10 -10
  15. package/src/control/file.js +8 -8
  16. package/src/control/image.js +6 -6
  17. package/src/control/link.js +9 -9
  18. package/src/control/list.js +3 -3
  19. package/src/control/loading.js +10 -10
  20. package/src/control/menu.js +2 -2
  21. package/src/control/search.js +9 -9
  22. package/src/control/select.js +6 -6
  23. package/src/control/selecter.js +15 -15
  24. package/src/control/snackbar.js +7 -5
  25. package/src/control/switch.js +18 -18
  26. package/src/control/switcher.js +16 -16
  27. package/src/control/text.js +8 -8
  28. package/src/control/textfield.js +12 -12
  29. package/src/dialog.js +19 -19
  30. package/src/divider.js +4 -4
  31. package/src/drawer.js +11 -11
  32. package/src/field/email.js +5 -5
  33. package/src/field/image.js +4 -4
  34. package/src/form/build.js +7 -7
  35. package/src/form.js +6 -6
  36. package/src/icon.js +8 -8
  37. package/src/image.js +14 -14
  38. package/src/item.js +7 -7
  39. package/src/layout.js +10 -10
  40. package/src/list/add.js +1 -1
  41. package/src/list/build.js +7 -7
  42. package/src/list/display.js +10 -10
  43. package/src/list/search.js +2 -2
  44. package/src/list.js +13 -13
  45. package/src/map/build.js +6 -6
  46. package/src/map/display.js +8 -8
  47. package/src/menu.js +15 -15
  48. package/src/{component → mixin}/control.js +10 -10
  49. package/src/{component → mixin}/create.js +1 -1
  50. package/src/{module → mixin}/display.js +10 -22
  51. package/src/{component → mixin}/events.js +2 -2
  52. package/src/{component → mixin}/focus.js +2 -3
  53. package/src/{component → mixin}/insert.js +1 -1
  54. package/src/module/build.js +4 -3
  55. package/src/{component → module}/classify.js +0 -13
  56. package/src/module/dom.js +1 -57
  57. package/src/module/events.js +4 -2
  58. package/src/module/last.js +0 -0
  59. package/src/{component → module}/ripple.js +15 -42
  60. package/src/progress.js +7 -7
  61. package/src/select.js +16 -16
  62. package/src/selector.js +32 -32
  63. package/src/slider.js +32 -32
  64. package/src/snackbar.js +8 -8
  65. package/src/switch.js +9 -9
  66. package/src/tabs.js +8 -8
  67. package/src/tabview.js +8 -8
  68. package/src/text.js +5 -5
  69. package/src/textfield.js +16 -16
  70. package/src/toolbar.js +28 -28
  71. package/src/tooltip.js +11 -11
  72. package/src/tree.js +12 -16
  73. package/src/view/build.js +6 -6
  74. package/src/view/display.js +16 -16
  75. package/src/view.js +5 -5
  76. package/src/component/click.js +0 -17
  77. /package/src/{component → mixin}/controller.js +0 -0
  78. /package/src/{component → mixin}/emitter.js +0 -0
  79. /package/src/{component → mixin}/icon.js +0 -0
  80. /package/src/{component → mixin}/init.js +0 -0
  81. /package/src/{component → mixin}/label.js +0 -0
  82. /package/src/{component → mixin}/settings.js +0 -0
package/src/switch.js CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict'
2
2
 
3
3
  // import control from '../control';
4
- // import control from './component/control'
4
+ // import control from './mixin/control'
5
5
  import build from './element/build'
6
6
  import emitter from './module/emitter'
7
- import insert from './component/insert'
7
+ import insert from './mixin/insert'
8
8
  import attach from './module/attach'
9
- import classify from './component/classify'
9
+ import classify from './module/classify'
10
10
 
11
11
  let defaults = {
12
12
  prefix: 'material',
@@ -77,9 +77,9 @@ class Switch {
77
77
  */
78
78
  build () {
79
79
  this.element = build(this.options.build)
80
- this.root = this.element.root
80
+ this.element = this.element.root
81
81
 
82
- classify(this.root, this.options)
82
+ classify(this.element, this.options)
83
83
 
84
84
  if (this.options.disabled) {
85
85
  this.disable()
@@ -175,7 +175,7 @@ class Switch {
175
175
  check (checked, silent) {
176
176
  // console.log('check', checked, silent)
177
177
  if (checked === true) {
178
- this.root.classList.add('is-checked')
178
+ this.element.classList.add('is-checked')
179
179
  this.element.input.checked = true
180
180
  this.checked = true
181
181
  this.value = true
@@ -183,7 +183,7 @@ class Switch {
183
183
  this.emit('change', this.checked)
184
184
  }
185
185
  } else {
186
- this.root.classList.remove('is-checked')
186
+ this.element.classList.remove('is-checked')
187
187
  this.element.input.checked = false
188
188
  this.checked = false
189
189
  this.value = false
@@ -201,7 +201,7 @@ class Switch {
201
201
  focus () {
202
202
  if (this.disabled === true) return this
203
203
 
204
- this.root.classList.add('is-focused')
204
+ this.element.classList.add('is-focused')
205
205
  if (this.element.input !== document.activeElement) { this.element.input.focus() }
206
206
  return this
207
207
  }
@@ -211,7 +211,7 @@ class Switch {
211
211
  * @return {?} [description]
212
212
  */
213
213
  blur () {
214
- this.root.classList.remove('is-focused')
214
+ this.element.classList.remove('is-focused')
215
215
  return this
216
216
  }
217
217
  }
package/src/tabs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- import create from './component/create'
4
- import insert from './component/insert'
3
+ import create from './mixin/create'
4
+ import insert from './mixin/insert'
5
5
  import emitter from './module/emitter'
6
6
 
7
7
  import offset from './element/offset'
@@ -44,11 +44,11 @@ class Tabs {
44
44
  * @return {Object} This class instance
45
45
  */
46
46
  build () {
47
- this.root = create(this.options)
47
+ this.element = create(this.options)
48
48
  this.tab = { }
49
49
  if (this.options.list) {
50
50
  this.list = new List({
51
- // root: this.root,
51
+ // root: this.element,
52
52
  tag: 'div',
53
53
  list: this.options.list,
54
54
  target: '.material-button',
@@ -75,11 +75,11 @@ class Tabs {
75
75
  this.selected = item
76
76
  this.click(item)
77
77
  }
78
- }).insert(this.root)
78
+ }).insert(this.element)
79
79
  }
80
80
 
81
81
  this.indicator = create(this.options.indicator)
82
- this.insertElement(this.indicator, this.root)
82
+ this.insertElement(this.indicator, this.element)
83
83
 
84
84
  if (this.options.container) {
85
85
  this.insert(this.options.container)
@@ -95,8 +95,8 @@ class Tabs {
95
95
  }
96
96
 
97
97
  click (item, silent) {
98
- // console.log('clickitem', item, this.root);
99
- var or = offset(this.root)
98
+ // console.log('clickitem', item, this.element);
99
+ var or = offset(this.element)
100
100
  var o = offset(item)
101
101
  this.indicator.setAttribute('style', 'width: ' + o.width + 'px; left: ' + (o.left - or.left) + 'px;')
102
102
 
package/src/tabview.js CHANGED
@@ -31,7 +31,7 @@ class TabView {
31
31
 
32
32
  var ready = false
33
33
 
34
- observer.insert(this.root, () => {
34
+ observer.insert(this.element, () => {
35
35
  // console.log('!!! inserted')
36
36
  if (!ready) {
37
37
  ready = true
@@ -46,13 +46,13 @@ class TabView {
46
46
  }
47
47
 
48
48
  build () {
49
- this.root = document.createElement(this.options.tag || 'div')
50
- this.root.classList.add('tabview')
49
+ this.element = document.createElement(this.options.tag || 'div')
50
+ this.element.classList.add('tabview')
51
51
 
52
- this.root.classList.add('view')
52
+ this.element.classList.add('view')
53
53
 
54
54
  if (this.options.class !== 'tabview') {
55
- this.root.classList.add(this.options.class)
55
+ this.element.classList.add(this.options.class)
56
56
  }
57
57
 
58
58
  this.ui = {}
@@ -63,9 +63,9 @@ class TabView {
63
63
  this.view = {}
64
64
  this.views = []
65
65
 
66
- this.ui.tabs = this.root.querySelector('[class="tabs"]')
67
- this.ui.view = this.root.querySelector('[class="views"]')
68
- this.ui.indicator = this.root.querySelector('[class="indicator"]')
66
+ this.ui.tabs = this.element.querySelector('[class="tabs"]')
67
+ this.ui.view = this.element.querySelector('[class="views"]')
68
+ this.ui.indicator = this.element.querySelector('[class="indicator"]')
69
69
 
70
70
  this.ui.buttons = this.ui.tabs.childNodes
71
71
  this.ui.views = this.ui.view.childNodes
package/src/text.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- import create from './component/create'
4
- import insert from './component/insert'
3
+ import create from './mixin/create'
4
+ import insert from './mixin/insert'
5
5
 
6
6
  var defaults = {
7
7
  prefix: 'material',
@@ -66,7 +66,7 @@ class Text {
66
66
  build () {
67
67
  this.options.tag = this.options.types[this.options.type]
68
68
 
69
- this.root = create(this.options)
69
+ this.element = create(this.options)
70
70
 
71
71
  if (this.options.text) {
72
72
  this.set(this.options.text)
@@ -85,9 +85,9 @@ class Text {
85
85
  */
86
86
  set (value) {
87
87
  if (value) {
88
- this.root.textContent = value
88
+ this.element.textContent = value
89
89
  } else {
90
- this.root.textContent = ''
90
+ this.element.textContent = ''
91
91
  }
92
92
 
93
93
  return this
package/src/textfield.js CHANGED
@@ -62,28 +62,28 @@ class Textfield {
62
62
  build () {
63
63
  // create a new div as input element
64
64
  var tag = this.options.tag || 'div'
65
- this.root = document.createElement(tag)
66
- this.root.classList.add(this.options.prefix + '-' + this.options.class)
65
+ this.element = document.createElement(tag)
66
+ this.element.classList.add(this.options.prefix + '-' + this.options.class)
67
67
 
68
68
  this.buildLabel()
69
69
  this.buildInput()
70
70
  this.buildUnderline()
71
71
 
72
72
  if (this.disabled) {
73
- css.add(this.root, 'is-disabled')
73
+ css.add(this.element, 'is-disabled')
74
74
  }
75
75
 
76
76
  // insert if container this.options is given
77
77
  if (this.options.container) {
78
78
  // console.log(this.name, opts.container);
79
- insert(this.root, this.options.container)
79
+ insert(this.element, this.options.container)
80
80
  }
81
81
  }
82
82
 
83
83
  buildLabel () {
84
84
  this.label = document.createElement('label')
85
85
  this.label.classList.add(this.options.class + '-label')
86
- this.root.appendChild(this.label)
86
+ this.element.appendChild(this.label)
87
87
 
88
88
  if (this.options.label !== false) {
89
89
  this.setLabel()
@@ -98,14 +98,14 @@ class Textfield {
98
98
  this.input = document.createElement('input')
99
99
  this.input.classList.add(this.options.class + '-input')
100
100
  this.input.setAttribute('type', 'text')
101
- this.root.appendChild(this.input)
101
+ this.element.appendChild(this.input)
102
102
 
103
103
  if (this.options.name) {
104
104
  this.input.setAttribute('name', this.options.name)
105
105
  }
106
106
 
107
107
  if (!this.options.value) {
108
- this.root.classList.add('is-empty')
108
+ this.element.classList.add('is-empty')
109
109
  }
110
110
 
111
111
  if (this.readonly) {
@@ -123,7 +123,7 @@ class Textfield {
123
123
  buildUnderline () {
124
124
  this.underline = document.createElement('span')
125
125
  this.underline.classList.add(this.options.class + '-underline')
126
- this.root.appendChild(this.underline)
126
+ this.element.appendChild(this.underline)
127
127
  }
128
128
 
129
129
  /**
@@ -176,7 +176,7 @@ class Textfield {
176
176
  this.disabled = true
177
177
 
178
178
  this.input.setAttribute('disabled', 'disabled')
179
- this.root.classList.add('is-disabled')
179
+ this.element.classList.add('is-disabled')
180
180
  return this
181
181
  }
182
182
 
@@ -184,7 +184,7 @@ class Textfield {
184
184
  this.disabled = false
185
185
 
186
186
  this.element.input.removeAttribute('disabled')
187
- this.root.classList.remove('is-disabled')
187
+ this.element.classList.remove('is-disabled')
188
188
  return this
189
189
  }
190
190
 
@@ -228,9 +228,9 @@ class Textfield {
228
228
  this.input.value = value
229
229
 
230
230
  if (value) {
231
- this.root.classList.remove('is-empty')
231
+ this.element.classList.remove('is-empty')
232
232
  } else {
233
- this.root.classList.add('is-empty')
233
+ this.element.classList.add('is-empty')
234
234
  }
235
235
 
236
236
  if (!silent) { this.emit('change', value) }
@@ -258,9 +258,9 @@ class Textfield {
258
258
  if (this.readonly) return
259
259
 
260
260
  if (this.get('value') === '') {
261
- this.root.classList.add('is-empty')
261
+ this.element.classList.add('is-empty')
262
262
  } else {
263
- this.root.classList.remove('is-empty')
263
+ this.element.classList.remove('is-empty')
264
264
  }
265
265
 
266
266
  this.emit('change', this.getValue())
@@ -274,7 +274,7 @@ class Textfield {
274
274
  if (this.disabled) return this
275
275
  if (this.readonly) return this
276
276
 
277
- this.root.classList.add('is-focused')
277
+ this.element.classList.add('is-focused')
278
278
  if (this.input !== document.activeElement) { this.input.focus() }
279
279
  return this
280
280
  }
@@ -286,7 +286,7 @@ class Textfield {
286
286
  blur () {
287
287
  if (this.readonly) return this
288
288
 
289
- this.root.classList.remove('is-focused')
289
+ this.element.classList.remove('is-focused')
290
290
 
291
291
  return this
292
292
  }
package/src/toolbar.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
 
3
- import create from './component/create'
4
- import insert from './component/insert'
3
+ import create from './mixin/create'
4
+ import insert from './mixin/insert'
5
5
  import offset from './element/offset'
6
6
 
7
7
  const defaults = {
@@ -37,21 +37,21 @@ class Toolbar {
37
37
  * @return {Object} This class instance
38
38
  */
39
39
  build () {
40
- this.root = create(this.options)
40
+ this.element = create(this.options)
41
41
 
42
42
  // console.log(this.options.height, this.options.fixed)
43
43
 
44
44
  if (this.options.height) {
45
- this.root.style.height = this.options.height + 'px'
45
+ this.element.style.height = this.options.height + 'px'
46
46
  }
47
47
 
48
48
  if (this.options.fixed) {
49
49
  // console.log('is-fixed')
50
- this.root.classList.add('is-fixed')
50
+ this.element.classList.add('is-fixed')
51
51
  }
52
52
 
53
53
  if (this.options.flexible) {
54
- this.root.classList.add('is-flexible')
54
+ this.element.classList.add('is-flexible')
55
55
  }
56
56
 
57
57
  // if (this.options.container) {
@@ -62,19 +62,19 @@ class Toolbar {
62
62
  }
63
63
 
64
64
  attach () {
65
- this.root.addEventListener('DOMNodeInserted', (e) => {
65
+ this.element.addEventListener('DOMNodeInserted', (e) => {
66
66
  var textNode = e.target
67
- if (textNode !== this.root) return
67
+ if (textNode !== this.element) return
68
68
 
69
- var size = this.size = offset(this.root, 'height')
69
+ var size = this.size = offset(this.element, 'height')
70
70
 
71
- var view = this.view = this.root.parentNode
71
+ var view = this.view = this.element.parentNode
72
72
 
73
73
  // console.log('view', view)
74
74
 
75
75
  var padding = window.getComputedStyle(view)['padding-top']
76
76
  // console.log('paddingTop', padding)
77
- // if (!padding) padding = window.getComputedStyle(this.root.parentNode, 'padding')
77
+ // if (!padding) padding = window.getComputedStyle(this.element.parentNode, 'padding')
78
78
  // console.log('padding', padding)
79
79
 
80
80
  padding = parseInt(padding, 10)
@@ -89,7 +89,7 @@ class Toolbar {
89
89
 
90
90
  if (document.body == view) {
91
91
  // console.log('toolbar container body')
92
- this.root.classList.add('toolbar-body')
92
+ this.element.classList.add('toolbar-body')
93
93
  }
94
94
 
95
95
  // view.setAttribute('style', 'padding-top: ' + ptop + 'px')
@@ -107,7 +107,7 @@ class Toolbar {
107
107
  set (prop, value) {
108
108
  switch (prop) {
109
109
  case 'minimize':
110
- this.root.setAttribute('style', 'height: 64px')
110
+ this.element.setAttribute('style', 'height: 64px')
111
111
  break
112
112
  case 'value':
113
113
  this.setValue(value)
@@ -150,9 +150,9 @@ class Toolbar {
150
150
  }
151
151
 
152
152
  if (scrollTop > 0) {
153
- this.root.classList.add('is-scrolled')
153
+ this.element.classList.add('is-scrolled')
154
154
  } else {
155
- this.root.classList.remove('is-scrolled')
155
+ this.element.classList.remove('is-scrolled')
156
156
  }
157
157
 
158
158
  // console.log('scroll', scrollTop)
@@ -167,42 +167,42 @@ class Toolbar {
167
167
  }
168
168
 
169
169
  flexible (e, scrollTop) {
170
- var size = offset(this.root, 'height')
171
- // console.log('flexible', size, this.root.offsetHeight, scrollTop)
170
+ var size = offset(this.element, 'height')
171
+ // console.log('flexible', size, this.element.offsetHeight, scrollTop)
172
172
  // if (scrollTop < this.size) {
173
173
  //
174
174
  var height = '64'
175
175
  if (size < height) {
176
- this.root.style.height = height + 'px'
176
+ this.element.style.height = height + 'px'
177
177
  } else {
178
178
  height = this.size - scrollTop
179
179
  if (height < 64) height = 64
180
- this.root.style.height = height + 'px'
180
+ this.element.style.height = height + 'px'
181
181
  }
182
182
 
183
- // console.log('scroll', this.root.style.top, scrollTop)
183
+ // console.log('scroll', this.element.style.top, scrollTop)
184
184
 
185
185
  // if (scrollTop > 50) {
186
- // this.root.style.trans = scrollTop + 'px'
186
+ // this.element.style.trans = scrollTop + 'px'
187
187
  // } else {
188
- // this.root.style.top = scrollTop + 'px'
188
+ // this.element.style.top = scrollTop + 'px'
189
189
  // }
190
190
  // }
191
- // this.root.style.top = scrollTop + 'px'
192
- // this.root.style.height = this.size - scrollTop
191
+ // this.element.style.top = scrollTop + 'px'
192
+ // this.element.style.height = this.size - scrollTop
193
193
  // } else {
194
194
  // console.log('size scroll', this.size, scrollTop)
195
195
 
196
- // this.root.style.height = this.size - scrollTop + 'px'
197
- // // this.root.style.top = scrollTop + 'px'
196
+ // this.element.style.height = this.size - scrollTop + 'px'
197
+ // // this.element.style.top = scrollTop + 'px'
198
198
  // }
199
199
  }
200
200
 
201
201
  fixed (e, scrollTop) {
202
202
  if (scrollTop > 0) {
203
- this.root.style.transform = 'translateY(' + scrollTop + 'px)'
203
+ this.element.style.transform = 'translateY(' + scrollTop + 'px)'
204
204
  } else {
205
- this.root.style.transform = 'translateY(' + scrollTop + 'px)'
205
+ this.element.style.transform = 'translateY(' + scrollTop + 'px)'
206
206
  }
207
207
  }
208
208
 
package/src/tooltip.js CHANGED
@@ -40,19 +40,19 @@ class Tooltip {
40
40
  build () {
41
41
  var container = this.options.container || document.body
42
42
 
43
- this.root = document.createElement('span')
44
- this.root.classList.add('tooltip')
45
- this.root.classList.add('control')
43
+ this.element = document.createElement('span')
44
+ this.element.classList.add('tooltip')
45
+ this.element.classList.add('control')
46
46
 
47
47
  this.pointer = document.createElement('span')
48
48
  this.pointer.classList.add('pointer')
49
- this.root.appendChild(this.pointer)
49
+ this.element.appendChild(this.pointer)
50
50
 
51
51
  this.label = document.createElement('span')
52
52
  this.label.classList.add('label')
53
- this.root.appendChild(this.label)
53
+ this.element.appendChild(this.label)
54
54
 
55
- container.appendChild(this.root)
55
+ container.appendChild(this.element)
56
56
  }
57
57
 
58
58
  attach () {
@@ -78,8 +78,8 @@ class Tooltip {
78
78
  var coord = this.offset(e.currentTarget)
79
79
 
80
80
  this.show()
81
- this.root.style.top = (coord.top + this.options.offset.top) + 'px'
82
- this.root.style.left = coord.left - (this.root.offsetWidth / 2) + (e.currentTarget.offsetWidth / 2) + 'px'
81
+ this.element.style.top = (coord.top + this.options.offset.top) + 'px'
82
+ this.element.style.left = coord.left - (this.element.offsetWidth / 2) + (e.currentTarget.offsetWidth / 2) + 'px'
83
83
  })
84
84
 
85
85
  targets[i].addEventListener('mouseleave', (e) => {
@@ -88,7 +88,7 @@ class Tooltip {
88
88
  })
89
89
  }
90
90
 
91
- this.root.addEventListener('click', (e) => {
91
+ this.element.addEventListener('click', (e) => {
92
92
  e.preventDefault()
93
93
  e.stop()
94
94
  this.hide()
@@ -103,11 +103,11 @@ class Tooltip {
103
103
  }
104
104
 
105
105
  hide () {
106
- this.root.classList.remove('show')
106
+ this.element.classList.remove('show')
107
107
  }
108
108
 
109
109
  show () {
110
- this.root.classList.add('show')
110
+ this.element.classList.add('show')
111
111
  }
112
112
 
113
113
  disable () {
package/src/tree.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- import insert from './component/insert'
3
+ import insert from './mixin/insert'
4
4
  import css from './module/css'
5
5
  import attach from './module/attach'
6
6
 
@@ -85,8 +85,8 @@ class Tree {
85
85
  // define main tag
86
86
  var tag = this.options.tag || 'div'
87
87
 
88
- this.root = document.createElement(tag)
89
- css.add(this.root, this.options.prefix + '-' + this.options.class)
88
+ this.element = document.createElement(tag)
89
+ css.add(this.element, this.options.prefix + '-' + this.options.class)
90
90
 
91
91
  if (this.options.container) {
92
92
  this.insert(this.options.container)
@@ -96,7 +96,7 @@ class Tree {
96
96
  this.buildTree(this.options.data)
97
97
  }
98
98
 
99
- // this.root.addEventListener("click", function(e) {
99
+ // this.element.addEventListener("click", function(e) {
100
100
  // // console.log("list", this, e);
101
101
  // // e.target was the clicked element
102
102
  // });
@@ -105,13 +105,12 @@ class Tree {
105
105
  }
106
106
 
107
107
  buildTree (data) {
108
- this.root.innerHTML = ''
108
+ this.element.innerHTML = ''
109
109
 
110
110
  // console.log('buildTree', data);
111
111
 
112
112
  var tree = ''
113
113
 
114
-
115
114
  function checkChildren (parentObj, level) {
116
115
  if (level) {
117
116
  level++
@@ -119,11 +118,10 @@ class Tree {
119
118
  level = 0
120
119
  }
121
120
 
122
-
123
- level++;
121
+ level++
124
122
 
125
123
  // console.log('-- ', level, parentObj);
126
- if (parentObj.path) {
124
+ if (parentObj.path) {
127
125
  var level = (parentObj.path.split('/').length - 1)
128
126
 
129
127
  if (level > 0) {
@@ -131,7 +129,7 @@ class Tree {
131
129
  }
132
130
  } else {
133
131
  if (level > 1) {
134
- tree += '<li class="item-tree" data-id="'+parentObj._id+'">' + parentObj.name
132
+ tree += '<li class="item-tree" data-id="' + parentObj._id + '">' + parentObj.name
135
133
  }
136
134
  }
137
135
 
@@ -150,13 +148,11 @@ class Tree {
150
148
  }
151
149
  }
152
150
 
153
-
154
-
155
151
  checkChildren(data)
156
152
 
157
153
  // console.log('html tree', tree);
158
154
 
159
- this.root.innerHTML = tree
155
+ this.element.innerHTML = tree
160
156
 
161
157
  return tree
162
158
  }
@@ -238,8 +234,8 @@ class Tree {
238
234
  }
239
235
 
240
236
  var where = 'bottom'
241
- this.insertElement(item.root, this.root, where)
242
- // item.insert(this.root, where);
237
+ this.insertElement(item.root, this.element, where)
238
+ // item.insert(this.element, where);
243
239
  this.items.push(item)
244
240
 
245
241
  return item
@@ -247,7 +243,7 @@ class Tree {
247
243
 
248
244
  empty () {
249
245
  // console.log('empty')
250
- this.root.innerHTML = ''
246
+ this.element.innerHTML = ''
251
247
  this.items = []
252
248
  this.item = null
253
249
  }
package/src/view/build.js CHANGED
@@ -4,22 +4,22 @@ import Layout from '../layout'
4
4
 
5
5
  export default {
6
6
  build () {
7
- this.root = document.createElement('div')
8
- this.root.classList.add('view')
7
+ this.element = document.createElement('div')
8
+ this.element.classList.add('view')
9
9
 
10
10
  if (this.options.class) {
11
11
  this.addClass(this.options.class)
12
12
  }
13
13
 
14
14
  if (this.options.data) {
15
- dataset(this.root, this.options.data)
15
+ dataset(this.element, this.options.data)
16
16
  }
17
17
 
18
18
  this.container = this.options.container || document.body
19
- this.container.appendChild(this.root)
19
+ this.container.appendChild(this.element)
20
20
 
21
21
  if (this.options.layout) {
22
- this.layout = new Layout(this.options.layout, this.root)
22
+ this.layout = new Layout(this.options.layout, this.element)
23
23
  this.ui = this.layout.component
24
24
  }
25
25
  },
@@ -28,7 +28,7 @@ export default {
28
28
  var list = c.split(' ')
29
29
 
30
30
  for (var i = 0; i < list.length; i++) {
31
- this.root.classList.add(list[i])
31
+ this.element.classList.add(list[i])
32
32
  }
33
33
  }
34
34
  }