material 0.7.1 → 0.7.2

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 (122) hide show
  1. package/README.md +1 -5
  2. package/dist/demo-bundle.js +2281 -2
  3. package/dist/demo-bundle.js.map +7 -1
  4. package/dist/demo.js +13 -13
  5. package/esbuild.js +22 -0
  6. package/esbuild.watch.js +25 -0
  7. package/package.json +7 -20
  8. package/src/badge.js +1 -1
  9. package/src/button.js +50 -100
  10. package/src/calendar.js +53 -53
  11. package/src/card.js +1 -1
  12. package/src/checkbox.js +5 -53
  13. package/src/datehour.js +7 -7
  14. package/src/dialog.js +5 -5
  15. package/src/divider.js +1 -1
  16. package/src/drawer.js +1 -17
  17. package/src/element/attribute.js +7 -10
  18. package/src/element/build.js +6 -7
  19. package/src/element/create.js +3 -6
  20. package/src/element/event.js +2 -2
  21. package/src/element/insert.js +6 -17
  22. package/src/element/observer.js +22 -0
  23. package/src/element/offset.js +2 -2
  24. package/src/element/style.js +12 -12
  25. package/src/element.js +2 -2
  26. package/src/field/email.js +9 -44
  27. package/src/field/image.js +17 -51
  28. package/src/file.js +1 -1
  29. package/src/form/build.js +7 -7
  30. package/src/form/controller.js +8 -8
  31. package/src/form/create.js +1 -1
  32. package/src/form/data.js +9 -9
  33. package/src/form/delete.js +1 -1
  34. package/src/form/render.js +9 -9
  35. package/src/form/set.js +1 -1
  36. package/src/form/submit.js +6 -6
  37. package/src/form/update.js +3 -3
  38. package/src/form/verify.js +4 -4
  39. package/src/form.js +9 -9
  40. package/src/icon.js +4 -4
  41. package/src/image.js +7 -7
  42. package/src/item.js +1 -1
  43. package/src/layout.js +14 -14
  44. package/src/link.js +1 -1
  45. package/src/list/build.js +8 -8
  46. package/src/list/click.js +3 -3
  47. package/src/list/filter.js +11 -11
  48. package/src/list/image.js +3 -3
  49. package/src/list/render.js +15 -15
  50. package/src/list/request.js +7 -7
  51. package/src/list/search.js +9 -9
  52. package/src/list/select.js +18 -18
  53. package/src/list/status.js +1 -1
  54. package/src/list/update.js +6 -6
  55. package/src/list/virtual.js +20 -20
  56. package/src/list/virtual.new.js +5 -5
  57. package/src/list.js +8 -8
  58. package/src/map/build.js +2 -2
  59. package/src/map/countries.js +8 -8
  60. package/src/map/display.js +13 -13
  61. package/src/map/focus.js +7 -7
  62. package/src/map/select.js +2 -2
  63. package/src/map/set.js +3 -3
  64. package/src/map/viewport.js +11 -11
  65. package/src/menu.js +12 -12
  66. package/src/mixin/control.js +3 -3
  67. package/src/mixin/controller.js +5 -5
  68. package/src/mixin/create.js +1 -1
  69. package/src/mixin/display.js +1 -1
  70. package/src/mixin/events.js +4 -16
  71. package/src/mixin/focus.js +1 -1
  72. package/src/mixin/icon.js +2 -2
  73. package/src/mixin/init.js +2 -2
  74. package/src/mixin/insert.js +5 -5
  75. package/src/mixin/label.js +2 -2
  76. package/src/mixin/settings.js +5 -5
  77. package/src/module/attach.js +35 -49
  78. package/src/module/attributes.js +2 -2
  79. package/src/module/build.js +7 -10
  80. package/src/module/classify.js +4 -4
  81. package/src/module/controller.js +5 -32
  82. package/src/module/css.js +12 -84
  83. package/src/module/dataset.js +1 -1
  84. package/src/module/dom.js +8 -3
  85. package/src/module/dot.js +4 -4
  86. package/src/module/emitter.js +1 -1
  87. package/src/module/event.js +2 -2
  88. package/src/module/events.js +29 -35
  89. package/src/module/extract.js +10 -10
  90. package/src/module/last.js +18 -0
  91. package/src/module/mediator.js +1 -13
  92. package/src/module/object.js +4 -4
  93. package/src/module/observer.js +43 -16
  94. package/src/module/remove.js +10 -10
  95. package/src/module/ripple.js +19 -24
  96. package/src/module/scrollbar.js +10 -14
  97. package/src/module/smoothscroll.js +5 -9
  98. package/src/module/utils.js +14 -23
  99. package/src/module/viewport.js +5 -5
  100. package/src/progress.js +1 -9
  101. package/src/search.js +24 -29
  102. package/src/select.js +6 -6
  103. package/src/selecter.js +39 -39
  104. package/src/selector.js +3 -3
  105. package/src/skin/material/component/navigation.sass +9 -1
  106. package/src/slider.js +1 -1
  107. package/src/snackbar.js +8 -7
  108. package/src/switch.js +1 -1
  109. package/src/switcher.js +15 -15
  110. package/src/tabs.js +4 -5
  111. package/src/tabview.js +26 -46
  112. package/src/text.js +1 -1
  113. package/src/textfield.js +1 -1
  114. package/src/toolbar.js +12 -12
  115. package/src/tooltip.js +7 -7
  116. package/src/tree.js +10 -66
  117. package/src/view/build.js +2 -2
  118. package/src/view/dataset.js +1 -1
  119. package/src/view.js +9 -74
  120. package/rollup.config.js +0 -34
  121. package/src/element/ripple.js +0 -90
  122. package/src/module/addclass.js +0 -16
@@ -0,0 +1,22 @@
1
+ const observer = {
2
+ insert: (element, cb) => {
3
+ var observer = new MutationObserver((mutations) => {
4
+ if (document.contains(element)) {
5
+ if (typeof cb === 'function' && !element.classList.contains('inserted')) {
6
+ cb()
7
+ }
8
+
9
+ observer.disconnect()
10
+ }
11
+ })
12
+
13
+ observer.observe(document, {
14
+ attributes: false,
15
+ childList: true,
16
+ characterData: false,
17
+ subtree: true
18
+ })
19
+ }
20
+ }
21
+
22
+ export default observer
@@ -7,9 +7,9 @@
7
7
  import style from './style'
8
8
 
9
9
  function offset (element, prop) {
10
- var rect = element.getBoundingClientRect()
10
+ const rect = element.getBoundingClientRect()
11
11
 
12
- var offset = {
12
+ const offset = {
13
13
  top: Math.round(rect.top),
14
14
  right: Math.round(rect.right),
15
15
  bottom: Math.round(rect.bottom),
@@ -3,10 +3,10 @@
3
3
  * @module component/style
4
4
  */
5
5
  import {
6
- _isIterable,
7
- _isLiteralObject,
8
- _isArray,
9
- _each
6
+ isIterable,
7
+ isLiteralObject,
8
+ isArray,
9
+ each
10
10
  } from '../module/utils'
11
11
 
12
12
  /**
@@ -18,14 +18,14 @@ import {
18
18
  function get (element, style) {
19
19
  // console.log('get', element, style);
20
20
  // get array of elements
21
- if (_isArray(style)) {
22
- var css = {}
23
- for (var i in list) {
21
+ if (isArray(style)) {
22
+ const css = {}
23
+ for (const i in list) {
24
24
  css[list[i]] = this.get(element, list[i])
25
25
  }
26
26
  return css
27
27
  } else {
28
- var computedStyle
28
+ let computedStyle
29
29
 
30
30
  if (typeof window.getComputedStyle === 'function') { // normal browsers
31
31
  computedStyle = window.getComputedStyle(element)
@@ -49,16 +49,16 @@ function get (element, style) {
49
49
  * @param {?} style [description]
50
50
  */
51
51
  function set (element, style) {
52
- if (_isIterable(element) && _isLiteralObject(style)) {
53
- _each(element, function (e) {
52
+ if (isIterable(element) && _isLiteralObject(style)) {
53
+ each(element, function (e) {
54
54
  set(e, style)
55
55
  })
56
56
  return element
57
57
  }
58
58
 
59
- if (_isLiteralObject(style)) {
59
+ if (isLiteralObject(style)) {
60
60
  // console.log('style', element, style);
61
- for (var i in style) {
61
+ for (const i in style) {
62
62
  element.style[i] = style[i]
63
63
  }
64
64
  return style
package/src/element.js CHANGED
@@ -6,7 +6,7 @@ class Element {
6
6
  constructor (options) {
7
7
  this.options = Object.assign({}, options || {})
8
8
  // console.log('element options', options)
9
- var element = document.createElement(this.options.tag || 'div')
9
+ const element = document.createElement(this.options.tag || 'div')
10
10
  delete this.options.tag
11
11
 
12
12
  if (options.html) element.innerHTML = this.options.html
@@ -17,7 +17,7 @@ class Element {
17
17
 
18
18
  if (options.id) element.setAttribute('id', options.id)
19
19
 
20
- for (var property in this.options) {
20
+ for (const property in this.options) {
21
21
  if (this.options.hasOwnProperty(property)) {
22
22
  element.setAttribute(property, this.options[property])
23
23
  }
@@ -1,53 +1,18 @@
1
- 'use strict'
1
+ import build from '../module/build'
2
2
 
3
- const defaults = {
4
- prefix: 'material',
5
- class: 'email'
6
- }
7
-
8
- /**
9
- * Base class for all ui components
10
- * @class
11
- * @param {Object} options - The component options
12
- * @return {Object} The class Instance
13
- */
14
-
15
- /**
16
- * Class representing a UI Container. Can add components.
17
- *
18
- * @extends Component
19
- * @return {parent} The class instance
20
- * @example new Container({
21
- * container: document.body
22
- * });
23
- */
24
3
  class EmailLink {
25
- /**
26
- * Constructor
27
- * @param {Object} options - Component options
28
- * @return {Object} Class instance
29
- */
30
- constructor (options) {
31
- this.options = Object.assign({}, defaults, options || {})
4
+ static defaults = {
5
+ class: 'email'
6
+ }
32
7
 
8
+ constructor (options) {
9
+ this.init(options)
33
10
  this.build()
34
-
35
- return this
36
11
  }
37
12
 
38
- /**
39
- * Build Method
40
- * @return {Object} This class instance
41
- */
42
- build () {
43
- this.element = document.createElement('a')
44
- this.element.classList.add('email')
45
-
46
- if (this.options.container) {
47
- this.options.container.appendChild(this.element)
48
- }
49
-
50
- return this
13
+ init (options) {
14
+ this.options = { ...Button.defaults, ...options }
15
+ Object.assign(this, build)
51
16
  }
52
17
 
53
18
  set (email) {
@@ -1,71 +1,37 @@
1
- 'use strict'
1
+ import build from '../module/build'
2
2
 
3
- const defaults = {
4
- class: 'image',
5
- format: 'thumb'
6
- }
7
-
8
- /**
9
- * Class representing an image.
10
- *
11
- * @extends Image
12
- * @return {parent} The class instance
13
- * @example new Image({
14
- * src: {
15
- * filename: 'image.png',
16
- * url: 'exmaple.com/image/'
17
- * format: ['thumbs/', 'medium/', 'large/'],
18
- * },
19
- * container: document.body
20
- * });
21
- */
22
3
  class Image {
23
4
  static isImage () {
24
5
  return true
25
6
  }
26
- /**
27
- * Constructor
28
- * @param {Object} options - Component options
29
- * @return {Object} Class instance
30
- */
31
- constructor (options) {
32
- // console.log('options', options)
33
- this.options = Object.assign({}, defaults, options || {})
34
7
 
35
- this.build()
36
-
37
- return this
8
+ static defaults = {
9
+ class: 'image',
10
+ format: 'thumb'
38
11
  }
39
12
 
40
- /**
41
- * Build Method
42
- * @return {Object} This class instance
43
- */
44
- build () {
45
- this.element = document.createElement('div')
46
- this.element.classList.add(this.options.class)
47
-
48
- if (this.options.container) {
49
- this.options.container.appendChild(this.element)
50
- }
13
+ constructor (options) {
14
+ this.init(options)
15
+ this.build()
16
+ }
51
17
 
52
- return this
18
+ init (options) {
19
+ this.options = { ...Image.defaults, ...options }
20
+ Object.assign(this, build)
53
21
  }
54
22
 
55
23
  set (src, asset) {
56
- console.log('set', src, asset)
57
-
58
24
  asset = asset || {}
59
25
 
60
26
  if (!src) return
61
27
 
62
- var url = src.url
28
+ let url = src.url
63
29
 
64
30
  if (src.format) {
65
- var format = this.sanitize(src.format)
31
+ let format = this.sanitize(src.format)
66
32
 
67
33
  if (format.length > 0) {
68
- var index = format.indexOf(this.options.format)
34
+ const index = format.indexOf(this.options.format)
69
35
  if (index === -1) {
70
36
  format = src.format[0] + '/'
71
37
  } else {
@@ -80,9 +46,9 @@ class Image {
80
46
  }
81
47
 
82
48
  sanitize (formats) {
83
- var a = []
84
- for (var i = 0; i < formats.length; i++) {
85
- var format = formats[i].replace(/\/$/, '')
49
+ const a = []
50
+ for (let i = 0; i < formats.length; i++) {
51
+ const format = formats[i].replace(/\/$/, '')
86
52
  a.push(format)
87
53
  }
88
54
 
package/src/file.js CHANGED
@@ -11,7 +11,7 @@ class File {
11
11
  }
12
12
 
13
13
  constructor (options) {
14
- this.init(options)
14
+ this.init(options)
15
15
  this.build()
16
16
  this.buildLabel()
17
17
  this.buildInput()
package/src/form/build.js CHANGED
@@ -71,11 +71,11 @@ export default {
71
71
  extractFile (object) {
72
72
  this.file = {}
73
73
 
74
- for (var property in object) {
74
+ for (const property in object) {
75
75
  if (object.hasOwnProperty(property)) {
76
- var files = property.split(/\./)
76
+ const files = property.split(/\./)
77
77
  if (files[0] === 'file' && files[1] !== undefined) {
78
- var name = property.substr(5, property.length)
78
+ const name = property.substr(5, property.length)
79
79
 
80
80
  this.file[name] = object[property]
81
81
  }
@@ -89,12 +89,12 @@ export default {
89
89
  this.field = {}
90
90
  this.fields = []
91
91
 
92
- for (var property in object) {
92
+ for (const property in object) {
93
93
  if (object.hasOwnProperty(property)) {
94
- var infos = property.split(/\./)
94
+ const infos = property.split(/\./)
95
95
 
96
96
  if (infos[0] === 'info' && infos[1] !== undefined) {
97
- var name = property.substr(5, property.length)
97
+ const name = property.substr(5, property.length)
98
98
  // console.log('field', name, property)
99
99
  this.fields.push(name)
100
100
  this.field[name] = object[property]
@@ -105,7 +105,7 @@ export default {
105
105
 
106
106
  clean () {
107
107
  // console.log('clean', this.info)
108
- for (var member in this.info) {
108
+ for (const member in this.info) {
109
109
  delete this.info[member]
110
110
  }
111
111
 
@@ -6,13 +6,13 @@ export default {
6
6
 
7
7
  this.disableControls()
8
8
 
9
- for (var field in this.field) {
9
+ for (const field in this.field) {
10
10
  if (this.field.hasOwnProperty(field)) {
11
11
  this.bindControl(this.field[field])
12
12
  }
13
13
  }
14
14
 
15
- for (var file in this.file) {
15
+ for (const file in this.file) {
16
16
  if (this.file.hasOwnProperty(file)) {
17
17
  this.bindControl(this.file[file])
18
18
  }
@@ -29,9 +29,9 @@ export default {
29
29
  },
30
30
 
31
31
  updateClassMode (mode) {
32
- var modes = ['read', 'create', 'update']
32
+ const modes = ['read', 'create', 'update']
33
33
 
34
- for (var i = 0; i < modes.length; i++) {
34
+ for (let i = 0; i < modes.length; i++) {
35
35
  this.form.classList.remove(modes[i] + '-mode')
36
36
  }
37
37
 
@@ -64,11 +64,11 @@ export default {
64
64
 
65
65
  enableControls () {
66
66
  // console.log('enableControls')
67
- var controls = this.options.controls || ['submit', 'cancel']
67
+ const controls = this.options.controls || ['submit', 'cancel']
68
68
 
69
69
  if (controls === null) return
70
70
 
71
- for (var i = 0; i < controls.length; i++) {
71
+ for (let i = 0; i < controls.length; i++) {
72
72
  if (this.ui[controls[i]] && this.ui[controls[i]].enable) {
73
73
  this.ui[controls[i]].enable()
74
74
  }
@@ -77,11 +77,11 @@ export default {
77
77
 
78
78
  disableControls () {
79
79
  // console.log('disableControls')
80
- var controls = this.options.controls || ['submit', 'cancel']
80
+ const controls = this.options.controls || ['submit', 'cancel']
81
81
 
82
82
  if (controls === null) return
83
83
 
84
- for (var i = 0; i < controls.length; i++) {
84
+ for (let i = 0; i < controls.length; i++) {
85
85
  if (this.ui[controls[i]] && this.ui[controls[i]].disable) {
86
86
  this.ui[controls[i]].disable()
87
87
  }
@@ -6,7 +6,7 @@ export default {
6
6
 
7
7
  this.clean()
8
8
 
9
- var info = this.options.create.info || { name: 'New Item' }
9
+ const info = this.options.create.info || { name: 'New Item' }
10
10
 
11
11
  console.log('info', info)
12
12
 
package/src/form/data.js CHANGED
@@ -5,7 +5,7 @@ export default {
5
5
  initData () {
6
6
  // console.log('submit', this.mode)
7
7
 
8
- var data = new FormData()
8
+ const data = new FormData()
9
9
 
10
10
  if (this.mode !== 'create') {
11
11
  this.appendSysinfo(data)
@@ -18,10 +18,10 @@ export default {
18
18
  },
19
19
 
20
20
  appendSysinfo (data) {
21
- var sys = this.options.sysinfo
22
- for (var i = 0; i < sys.length; i++) {
21
+ const sys = this.options.sysinfo
22
+ for (let i = 0; i < sys.length; i++) {
23
23
  // console.log('sys', sys[i], this.info[sys[i]])
24
- var name = sys[i]
24
+ let name = sys[i]
25
25
  if (sys[i] === '_id') name = 'id'
26
26
 
27
27
  data.append(name, this.info[sys[i]])
@@ -31,14 +31,14 @@ export default {
31
31
  },
32
32
 
33
33
  appendFields (data) {
34
- for (var field in this.field) {
34
+ for (const field in this.field) {
35
35
  // console.log('field', field)
36
36
  if (this.field.hasOwnProperty(field)) {
37
37
  // console.log('check field', field)
38
- var value = this.field[field].get()
38
+ const value = this.field[field].get()
39
39
  if (value !== null) {
40
40
  if (this.mode === 'update' && this.options.update && this.options.update.modifiedOnly) {
41
- var modified = this.isModified(field, value)
41
+ const modified = this.isModified(field, value)
42
42
  if (modified) {
43
43
  data.append(field, value)
44
44
  }
@@ -54,7 +54,7 @@ export default {
54
54
 
55
55
  appendFiles (data) {
56
56
  // console.log('appendFiles', this.file)
57
- for (var file in this.file) {
57
+ for (const file in this.file) {
58
58
  // console.log('this file', this.file, this.file[file].input)
59
59
  // console.log('file', file, this.file[file])
60
60
  if (this.file.hasOwnProperty(file) && this.file[file].input && this.file[file].input.value) {
@@ -66,7 +66,7 @@ export default {
66
66
  },
67
67
 
68
68
  isModified (field, value) {
69
- var initial = byString(this.info, field)
69
+ const initial = byString(this.info, field)
70
70
 
71
71
  if (typeof initial === 'number') {
72
72
  value = Number(value)
@@ -20,7 +20,7 @@ export default {
20
20
  this.setMode('delete')
21
21
  fetch(this.options.action, {
22
22
  headers: {
23
- 'Accept': 'application/json',
23
+ Accept: 'application/json',
24
24
  'Content-Type': 'application/json'
25
25
  },
26
26
  body: JSON.stringify({
@@ -4,9 +4,9 @@ export default {
4
4
  render (object, option) {
5
5
  // console.log('render', object)
6
6
 
7
- var info = dot(object)
7
+ const info = dot(object)
8
8
 
9
- for (var file in this.file) {
9
+ for (const file in this.file) {
10
10
  if (this.file.hasOwnProperty(file)) {
11
11
  this.file[file].reset()
12
12
  }
@@ -16,12 +16,12 @@ export default {
16
16
 
17
17
  if (!info) return
18
18
 
19
- for (var field in this.field) {
19
+ for (const field in this.field) {
20
20
  if (this.field.hasOwnProperty(field)) {
21
21
  // console.log('field type', field, this.field[field])
22
22
  if (this.field[field] &&
23
23
  this.field[field].set) {
24
- var value = this.objectValueByDotKey(object, field)
24
+ const value = this.objectValueByDotKey(object, field)
25
25
  // console.log('value', value)
26
26
  this.field[field].set(value, true)
27
27
  }
@@ -31,18 +31,18 @@ export default {
31
31
  this.emit('rendered')
32
32
 
33
33
  // won't stay here
34
- if (option === 'create' && this.field['name']) {
35
- this.focusNameOnRender(this.field['name'])
34
+ if (option === 'create' && this.field.name) {
35
+ this.focusNameOnRender(this.field.name)
36
36
  }
37
37
  },
38
38
 
39
39
  objectValueByDotKey (object, dotkey) {
40
40
  // console.log('objectValueByDotKey', object, dotkey)
41
- var keys = dotkey.split(/\./)
41
+ const keys = dotkey.split(/\./)
42
42
 
43
- var value = Object.assign({}, object)
43
+ let value = Object.assign({}, object)
44
44
 
45
- for (var i = 0; i < keys.length; i++) {
45
+ for (let i = 0; i < keys.length; i++) {
46
46
  if (value !== undefined) {
47
47
  value = value[keys[i]]
48
48
  }
package/src/form/set.js CHANGED
@@ -13,7 +13,7 @@ export default {
13
13
  // this.render(info)
14
14
  fetch(this.options.action + id, {
15
15
  headers: {
16
- 'Accept': 'application/json'
16
+ Accept: 'application/json'
17
17
  },
18
18
  method: 'GET'
19
19
  }).then((resp) => {
@@ -4,7 +4,7 @@ export default {
4
4
  ev.preventDefault()
5
5
  // console.log('submit', this.mode)
6
6
 
7
- var data = this.initData()
7
+ const data = this.initData()
8
8
 
9
9
  // console.log('data', data)
10
10
 
@@ -18,7 +18,7 @@ export default {
18
18
  },
19
19
 
20
20
  setMethod (formData) {
21
- var method = 'PUT'
21
+ let method = 'PUT'
22
22
  if (this.mode === 'create') {
23
23
  method = 'POST'
24
24
  }
@@ -26,15 +26,15 @@ export default {
26
26
  if (this.fetch) {
27
27
  // console.log('formData', formData.keys())
28
28
  this.fetch({
29
- method: method,
30
- formData: formData
29
+ method,
30
+ formData
31
31
  })
32
32
  }
33
33
 
34
34
  if (this.action) {
35
35
  this.action({
36
- method: method,
37
- formData: formData
36
+ method,
37
+ formData
38
38
  })
39
39
  }
40
40
  }
@@ -5,11 +5,11 @@ export default {
5
5
  options = options || {}
6
6
 
7
7
  // console.log('mode', this.mode)
8
- var method = options.method ||
8
+ const method = options.method ||
9
9
  this.options[this.mode].method ||
10
10
  'put'
11
11
 
12
- var action = options.action ||
12
+ const action = options.action ||
13
13
  this.options[this.mode].action ||
14
14
  this.options.action
15
15
 
@@ -18,7 +18,7 @@ export default {
18
18
  }
19
19
 
20
20
  fetch(action, {
21
- method: method,
21
+ method,
22
22
  body: data
23
23
  }).then((resp) => {
24
24
  // console.log('resp', resp)
@@ -1,11 +1,11 @@
1
1
  export default {
2
2
  verify () {
3
- var list = this.options.require
3
+ const list = this.options.require
4
4
 
5
- var ok = true
5
+ let ok = true
6
6
 
7
- for (var i = 0; i < list.length; i++) {
8
- var field = this.ui['info.' + list[i]]
7
+ for (let i = 0; i < list.length; i++) {
8
+ const field = this.ui['info.' + list[i]]
9
9
 
10
10
  if (!this.layout.get(list[i]).get()) {
11
11
  field.element.classList.add('textfield-error')
package/src/form.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import insert from './element/insert'
2
- import css from './module/css'
2
+ import * as css from './module/css'
3
3
  import emitter from './module/emitter'
4
4
  import attach from './module/attach'
5
5
  import controller from './mixin/controller'
@@ -68,7 +68,7 @@ class Form {
68
68
  * @return {Object} This class instance
69
69
  */
70
70
  build () {
71
- var tag = this.options.tag || 'div'
71
+ const tag = this.options.tag || 'div'
72
72
 
73
73
  this.element = document.createElement(tag)
74
74
  css.add(this.element, this.options.prefix + '-' + this.options.class)
@@ -99,8 +99,8 @@ class Form {
99
99
 
100
100
  this.key = this.key || {}
101
101
 
102
- for (var i = 0; i < controls.length; i++) {
103
- var control = controls[i]
102
+ for (let i = 0; i < controls.length; i++) {
103
+ const control = controls[i]
104
104
  // control.setAttribute('data-key', control.name);
105
105
 
106
106
  this.key[control.name] = control
@@ -126,9 +126,9 @@ class Form {
126
126
  * @return {?} [description]
127
127
  */
128
128
  initControl (key, section) {
129
- var name = key.name || 'undefined'
129
+ const name = key.name || 'undefined'
130
130
 
131
- var control = this.render(key)
131
+ const control = this.render(key)
132
132
 
133
133
  if (control) {
134
134
  this.key[name] = control
@@ -179,15 +179,15 @@ class Form {
179
179
  */
180
180
  parseInfo (obj, name, i) {
181
181
  // console.log('parseInfo', obj, name, 'level ' + i);
182
- var level = i || 0
182
+ let level = i || 0
183
183
  level = level + 1
184
- var key
184
+ let key
185
185
 
186
186
  if (obj instanceof Object) {
187
187
  for (key in obj) {
188
188
  if (obj.hasOwnProperty(key)) {
189
189
  // recursive call to scan property
190
- var n = null
190
+ let n = null
191
191
  if (name) {
192
192
  n = name + '.' + key
193
193
  } else {
package/src/icon.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import insert from './mixin/insert'
2
- import css from './module/css'
2
+ import * as css from './module/css'
3
3
 
4
4
  var defaults = {
5
5
  prefix: 'material',
@@ -54,10 +54,10 @@ class Icon {
54
54
  this.element = this.element || {}
55
55
 
56
56
  this.element = document.createElement(tag)
57
- css.add(this.element, this.options.prefix + '-' + this.options.class)
57
+ { add }.add(this.element, this.options.prefix + '-' + this.options.class)
58
58
 
59
- if (options.css) { css.add(this.element, options.css) }
60
- // css.add(this.element, this.options.class + '-adjust');
59
+ if (options.{ add }) { { add }.add(this.element, options.{ add }) }
60
+ // { add }.add(this.element, this.options.class + '-adjust');
61
61
 
62
62
  if (this.options.container) {
63
63
  this.insert(this.options.container)