material 0.7.1 → 0.7.4

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 (155) hide show
  1. package/LICENSE +9 -18
  2. package/README.md +1 -5
  3. package/index.js +25 -48
  4. package/package.json +3 -24
  5. package/src/badge.js +1 -1
  6. package/src/button.js +50 -100
  7. package/src/calendar.js +53 -53
  8. package/src/card.js +1 -1
  9. package/src/checkbox.js +52 -104
  10. package/src/datehour.js +7 -7
  11. package/src/dialog.js +5 -5
  12. package/src/divider.js +1 -1
  13. package/src/drawer.js +1 -17
  14. package/src/element/attribute.js +7 -10
  15. package/src/element/build.js +6 -7
  16. package/src/element/create.js +3 -6
  17. package/src/element/event.js +2 -2
  18. package/src/element/insert.js +9 -20
  19. package/src/element/observer.js +22 -0
  20. package/src/element/offset.js +2 -2
  21. package/src/element/style.js +12 -12
  22. package/src/element.js +2 -2
  23. package/src/file.js +1 -1
  24. package/src/form/build.js +7 -7
  25. package/src/form/controller.js +8 -8
  26. package/src/form/create.js +1 -1
  27. package/src/form/data.js +9 -9
  28. package/src/form/delete.js +1 -1
  29. package/src/form/render.js +9 -9
  30. package/src/form/set.js +1 -1
  31. package/src/form/submit.js +6 -6
  32. package/src/form/update.js +3 -3
  33. package/src/form/verify.js +4 -4
  34. package/src/form.js +9 -9
  35. package/src/icon.js +4 -4
  36. package/src/image.js +7 -7
  37. package/src/item.js +1 -1
  38. package/src/layout.js +14 -14
  39. package/src/link.js +1 -1
  40. package/src/list/build.js +8 -8
  41. package/src/list/click.js +3 -3
  42. package/src/list/filter.js +11 -11
  43. package/src/list/image.js +3 -3
  44. package/src/list/render.js +15 -15
  45. package/src/list/request.js +7 -7
  46. package/src/list/search.js +9 -9
  47. package/src/list/select.js +18 -18
  48. package/src/list/status.js +1 -1
  49. package/src/list/update.js +6 -6
  50. package/src/list/virtual.js +20 -20
  51. package/src/list/virtual.new.js +5 -5
  52. package/src/list.js +8 -10
  53. package/src/map/build.js +2 -2
  54. package/src/map/countries.js +8 -8
  55. package/src/map/display.js +13 -13
  56. package/src/map/focus.js +7 -7
  57. package/src/map/select.js +2 -2
  58. package/src/map/set.js +3 -3
  59. package/src/map/viewport.js +11 -11
  60. package/src/menu.js +12 -12
  61. package/src/mixin/control.js +3 -3
  62. package/src/mixin/controller.js +5 -5
  63. package/src/mixin/create.js +1 -1
  64. package/src/mixin/display.js +1 -1
  65. package/src/mixin/events.js +4 -16
  66. package/src/mixin/focus.js +1 -1
  67. package/src/mixin/icon.js +2 -2
  68. package/src/mixin/init.js +2 -2
  69. package/src/mixin/insert.js +5 -5
  70. package/src/mixin/label.js +2 -2
  71. package/src/mixin/settings.js +5 -5
  72. package/src/module/attach.js +35 -49
  73. package/src/module/attributes.js +2 -2
  74. package/src/module/build.js +6 -11
  75. package/src/module/classify.js +4 -4
  76. package/src/module/controller.js +5 -32
  77. package/src/module/css.js +12 -84
  78. package/src/module/dataset.js +1 -1
  79. package/src/module/dom.js +9 -3
  80. package/src/module/dot.js +4 -4
  81. package/src/module/emitter.js +1 -1
  82. package/src/module/event.js +2 -2
  83. package/src/module/events.js +29 -35
  84. package/src/module/extract.js +10 -10
  85. package/src/module/last.js +18 -0
  86. package/src/module/mediator.js +1 -13
  87. package/src/module/object.js +4 -4
  88. package/src/module/observer.js +43 -16
  89. package/src/module/remove.js +10 -10
  90. package/src/module/request.js +33 -0
  91. package/src/module/ripple.js +19 -24
  92. package/src/module/scrollbar.js +10 -14
  93. package/src/module/smoothscroll.js +5 -9
  94. package/src/module/utils.js +14 -23
  95. package/src/module/viewport.js +5 -5
  96. package/src/navigation.js +7 -1
  97. package/src/progress.js +1 -9
  98. package/src/search.js +24 -29
  99. package/src/select.js +6 -6
  100. package/src/selecter.js +39 -39
  101. package/src/selector.js +3 -3
  102. package/src/skin/material/button/action.sass +6 -6
  103. package/src/skin/material/button/button.sass +6 -6
  104. package/src/skin/material/button/file.sass +1 -1
  105. package/src/skin/material/button/floating.sass +5 -5
  106. package/src/skin/material/button/raised.sass +5 -5
  107. package/src/skin/material/button/stroked.sass +5 -5
  108. package/src/skin/material/component/navigation.sass +13 -1
  109. package/src/skin/material/control/checkbox.sass +21 -21
  110. package/src/skin/material/module/ripple.sass +1 -1
  111. package/src/slider.js +1 -1
  112. package/src/snackbar.js +12 -9
  113. package/src/styles/M3/abstracts/variables.sass +44 -0
  114. package/src/styles/M3/components/button.sass +26 -0
  115. package/src/styles/M3/modules/ripple.sass +9 -0
  116. package/src/styles/M3/themes/classic.sass +2 -0
  117. package/src/switch.js +1 -1
  118. package/src/switcher.js +15 -15
  119. package/src/tabs.js +6 -8
  120. package/src/tabview.js +26 -46
  121. package/src/text.js +1 -1
  122. package/src/textfield.js +1 -1
  123. package/src/toolbar.js +12 -12
  124. package/src/tooltip.js +7 -7
  125. package/src/tree.js +10 -66
  126. package/src/view/build.js +2 -2
  127. package/src/view/dataset.js +1 -1
  128. package/src/view.js +9 -74
  129. package/dist/demo-bundle.js +0 -2
  130. package/dist/demo-bundle.js.map +0 -1
  131. package/dist/demo.css +0 -93
  132. package/dist/demo.css.map +0 -7
  133. package/dist/demo.html +0 -24
  134. package/dist/demo.js +0 -159
  135. package/dist/icon/accessibility.svg +0 -5
  136. package/dist/icon/apps.svg +0 -5
  137. package/dist/icon/happy.svg +0 -6
  138. package/dist/icon/link.svg +0 -5
  139. package/dist/icon/more.svg +0 -5
  140. package/dist/icon/navi.svg +0 -5
  141. package/dist/icon/phone.svg +0 -6
  142. package/dist/icon/share.svg +0 -6
  143. package/dist/icon/side.svg +0 -5
  144. package/dist/icon/star.svg +0 -7
  145. package/dist/icon/star_border.svg +0 -6
  146. package/dist/material.css +0 -2429
  147. package/dist/material.css.map +0 -7
  148. package/dist/styles/demo.sass +0 -110
  149. package/dist/styles.css +0 -23
  150. package/rollup.config.js +0 -34
  151. package/src/container.js +0 -66
  152. package/src/element/ripple.js +0 -90
  153. package/src/field/email.js +0 -59
  154. package/src/field/image.js +0 -93
  155. package/src/module/addclass.js +0 -16
package/src/layout.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { is as isObject } from './module/object'
2
- import css from './module/css'
2
+ import * as css from './module/css'
3
3
 
4
4
  class Layout {
5
5
  constructor (schema, container) {
@@ -16,10 +16,10 @@ class Layout {
16
16
  structure = structure || {}
17
17
  let component = null
18
18
 
19
- for (var i = 0; i < schema.length; i++) {
19
+ for (let i = 0; i < schema.length; i++) {
20
20
  // console.log('index', i, typeof schema[i])
21
21
  var name
22
- var options = {}
22
+ let options = {}
23
23
 
24
24
  if (schema[i] instanceof Object &&
25
25
  typeof schema[i] === 'function') {
@@ -37,7 +37,7 @@ class Layout {
37
37
  }
38
38
 
39
39
  component = new schema[i](options)
40
- var element = component.element || component
40
+ const element = component.element || component
41
41
 
42
42
  if (level === 1) {
43
43
  structure.element = element
@@ -49,7 +49,7 @@ class Layout {
49
49
  }
50
50
 
51
51
  // if (component) {
52
- // this.display(component.root, options)
52
+ // this.display(component.element, options)
53
53
  // this.style(component, options)
54
54
  // }
55
55
 
@@ -57,7 +57,7 @@ class Layout {
57
57
  if (component.insert) {
58
58
  component.insert(container)
59
59
  } else {
60
- var wrapper = container.element || container
60
+ const wrapper = container.element || container
61
61
 
62
62
  wrapper.appendChild(element)
63
63
 
@@ -68,7 +68,7 @@ class Layout {
68
68
  component._container = container
69
69
  }
70
70
  } else if (Array.isArray(schema[i])) {
71
- // console.log('------', schema[i])
71
+ // console.log('------', schema[i])
72
72
  if (component == null) {
73
73
  component = container
74
74
  }
@@ -80,8 +80,8 @@ class Layout {
80
80
  }
81
81
 
82
82
  display (element, options) {
83
- var display = options.display
84
- var direction = options.direction || 'horizontal'
83
+ const display = options.display
84
+ const direction = options.direction || 'horizontal'
85
85
 
86
86
  if (!element || !display) return
87
87
 
@@ -93,14 +93,14 @@ class Layout {
93
93
  }
94
94
 
95
95
  style (component) {
96
- var options = component.options || {}
96
+ const options = component.options || {}
97
97
 
98
98
  // console.log('component', component);
99
99
 
100
100
  if (options.flex) {
101
101
  css.add(component.element, 'flex-' + options.flex)
102
102
  } else {
103
- var size = options.size
103
+ const size = options.size
104
104
  if (options.size && options.width) {
105
105
  component.element.width = size + 'px'
106
106
  } else if (options.size && options.height) {
@@ -128,11 +128,11 @@ class Layout {
128
128
  extractInfo (object) {
129
129
  // console.log('extractField', object)
130
130
 
131
- var field = {}
131
+ const field = {}
132
132
 
133
- for (var property in object) {
133
+ for (const property in object) {
134
134
  if (object.hasOwnProperty(property)) {
135
- var infos = property.split(/\./)
135
+ const infos = property.split(/\./)
136
136
 
137
137
  if (infos[0] === 'info' && infos[1] !== undefined) {
138
138
  // console.log('field', infos[0], infos[1])
package/src/link.js CHANGED
@@ -13,7 +13,7 @@ class Link {
13
13
  }
14
14
 
15
15
  init (options) {
16
- this.options = Object.assign({}, Link.defaults, options || {})
16
+ this.options = { ...Link.defaults, ...options }
17
17
  Object.assign(this, build)
18
18
  }
19
19
 
package/src/list/build.js CHANGED
@@ -40,12 +40,12 @@ export default {
40
40
  this.options.container.appendChild(this.element)
41
41
  }
42
42
 
43
- var scrollbarOffset = scrollbar()
43
+ const scrollbarOffset = scrollbar()
44
44
 
45
45
  // console.log('scrollbarOffset', scrollbarOffset)
46
46
  if (this.ui && this.ui.body) {
47
47
  // console.log('body padding', 11 - scrollbarOffset + 'px')
48
- this.ui.body.style['marginRight'] = 11 - scrollbarOffset + 'px'
48
+ this.ui.body.style.marginRight = 11 - scrollbarOffset + 'px'
49
49
  this.ui.body.classList.add('offset' + scrollbarOffset)
50
50
  }
51
51
 
@@ -53,16 +53,16 @@ export default {
53
53
  },
54
54
 
55
55
  addClass (c) {
56
- var list = c.split(' ')
56
+ const list = c.split(' ')
57
57
 
58
- for (var i = 0; i < list.length; i++) {
58
+ for (let i = 0; i < list.length; i++) {
59
59
  this.element.classList.add(list[i])
60
60
  }
61
61
  },
62
62
 
63
63
  buildVirtual () {
64
64
  // console.log('buildVirtual', this.options.class)
65
- var height = 80
65
+ let height = 80
66
66
  this.size = this.options.list.size
67
67
  this.stop = false
68
68
 
@@ -100,15 +100,15 @@ export default {
100
100
  // console.log('progress', progress, this.count)
101
101
 
102
102
  if (this.statusDisplay) {
103
- var percent = parseInt(progress / this.count * 100)
103
+ const percent = parseInt(progress / this.count * 100)
104
104
  this.statusDisplay('count', percent + '% | ' + progress + ' / ' + this.count)
105
105
  }
106
106
 
107
107
  this.onProgress(progress)
108
108
  })
109
109
  // .on('size', (size) => {
110
- // console.log('!!!!size', size)
111
- // this.size = size
110
+ // console.log('!!!!size', size)
111
+ // this.size = size
112
112
  // })
113
113
  //
114
114
  },
package/src/list/click.js CHANGED
@@ -8,9 +8,9 @@ export default {
8
8
  return
9
9
  }
10
10
 
11
- var target = '[data-id]'
12
- var item = e.target
13
- var i = 0
11
+ const target = '[data-id]'
12
+ let item = e.target
13
+ let i = 0
14
14
 
15
15
  while (item && !item.matches(target)) {
16
16
  // console.log('item', item)
@@ -3,7 +3,7 @@ export default {
3
3
  initFilter () {
4
4
  this.filter = this.extractFilter(this.ui)
5
5
 
6
- for (var name in this.filter) {
6
+ for (const name in this.filter) {
7
7
  if (this.filter.hasOwnProperty(name)) {
8
8
  this.filter[name].on('change', () => {
9
9
  this.request()
@@ -15,15 +15,15 @@ export default {
15
15
  this.clearFilter()
16
16
  })
17
17
 
18
- this.ui['filter'].on('click', () => {
18
+ this.ui.filter.on('click', () => {
19
19
  this.toggleFilter()
20
20
  })
21
21
  },
22
22
 
23
23
  getFilter () {
24
24
  console.log('getFilter')
25
- var filter = null
26
- for (var name in this.filter) {
25
+ let filter = null
26
+ for (const name in this.filter) {
27
27
  if (this.filter.hasOwnProperty(name)) {
28
28
  console.log('--', typeof this.filter[name].get(), this.filter[name].get())
29
29
  if (this.filter[name].get() !== ''/* && this.filter[name].get() !== [] */) {
@@ -61,7 +61,7 @@ export default {
61
61
  }
62
62
 
63
63
  // console.log('showSearch')
64
- this.ui['filter'].element.classList.add('selected')
64
+ this.ui.filter.element.classList.add('selected')
65
65
  this.ui['filter-input'].classList.add('show')
66
66
 
67
67
  // this.ui['search-list'].classList.add('show')
@@ -74,7 +74,7 @@ export default {
74
74
  */
75
75
  hideFilter () {
76
76
  // console.log('hideSearch')
77
- this.ui['filter'].element.classList.remove('selected')
77
+ this.ui.filter.element.classList.remove('selected')
78
78
  this.ui['filter-input'].classList.remove('show')
79
79
  // this.ui['search-list'].classList.remove('show')
80
80
  // this.ui.body.classList.remove('hide')
@@ -83,7 +83,7 @@ export default {
83
83
  },
84
84
 
85
85
  clearFilter () {
86
- for (var name in this.filter) {
86
+ for (const name in this.filter) {
87
87
  if (this.filter.hasOwnProperty(name)) {
88
88
  this.filter[name].set('')
89
89
  }
@@ -95,14 +95,14 @@ export default {
95
95
  extractFilter (object) {
96
96
  // console.log('extractField', object)
97
97
 
98
- var filter = {}
98
+ const filter = {}
99
99
 
100
- for (var property in object) {
100
+ for (const property in object) {
101
101
  if (object.hasOwnProperty(property)) {
102
- var str = property.split(/\./)
102
+ const str = property.split(/\./)
103
103
 
104
104
  if (str[0] === 'filter' && str[1] !== undefined) {
105
- var name = property.substr(7, property.length)
105
+ const name = property.substr(7, property.length)
106
106
 
107
107
  filter[name] = object[property]
108
108
  }
package/src/list/image.js CHANGED
@@ -1,17 +1,17 @@
1
1
  export default {
2
2
  image (info, layout) {
3
3
  if (info.image) {
4
- var format = 'thumb'
4
+ let format = 'thumb'
5
5
  if (this.options.image && this.options.image.format) {
6
6
  format = this.options.image.format || format + '/'
7
7
  } else {
8
8
  format = ''
9
9
  }
10
10
 
11
- var r = Math.floor(Math.random() * 100000) + 1
11
+ const r = Math.floor(Math.random() * 100000) + 1
12
12
 
13
13
  if (info.image.filename) {
14
- var image = info.image.url + format + info.image.filename
14
+ const image = info.image.url + format + info.image.filename
15
15
  layout.get('image').style.backgroundImage = 'url("' + image + '?' + r + '")'
16
16
  }
17
17
  }
@@ -23,7 +23,7 @@ export default {
23
23
  // console.log('renderItem', info)
24
24
  info = info || {}
25
25
 
26
- var container = this.ui.body
26
+ const container = this.ui.body
27
27
 
28
28
  if (context === 'create') {
29
29
  container.scrolltop = 0
@@ -33,7 +33,7 @@ export default {
33
33
  // container = this.ui['search-list']
34
34
  // }
35
35
 
36
- var element = new Element({
36
+ const element = new Element({
37
37
  tag: 'li',
38
38
  class: 'item'
39
39
  })
@@ -47,10 +47,10 @@ export default {
47
47
  element.dataset.id = info[this.dataId]
48
48
  element.dataset.info = this.options.info
49
49
 
50
- var layout = null
50
+ let layout = null
51
51
 
52
52
  if (this.options.itemSwitch) {
53
- var item = info[this.options.itemSwitch]
53
+ const item = info[this.options.itemSwitch]
54
54
 
55
55
  if (this.options.layout.item[item]) {
56
56
  layout = new Layout(this.options.layout.item[item], element)
@@ -58,7 +58,7 @@ export default {
58
58
  layout = new Layout(this.options.layout.item.base, element)
59
59
  }
60
60
  } else {
61
- var itemName = this.options.itemName || 'item'
61
+ const itemName = this.options.itemName || 'item'
62
62
  layout = new Layout(this.options.layout[itemName], element)
63
63
  }
64
64
 
@@ -91,11 +91,11 @@ export default {
91
91
  */
92
92
  renderInfo (layout, object) {
93
93
  // console.log('renderInfo', object)
94
- var info = dot(object)
94
+ const info = dot(object)
95
95
 
96
- var f = this.extractInfo(layout.component)
96
+ const f = this.extractInfo(layout.component)
97
97
 
98
- for (var field in f) {
98
+ for (const field in f) {
99
99
  if (f.hasOwnProperty(field)) {
100
100
  if (f[field] && f[field].set) {
101
101
  f[field].set(this.objectValueByDotKey(object, field))
@@ -108,11 +108,11 @@ export default {
108
108
  },
109
109
 
110
110
  objectValueByDotKey (object, dotkey) {
111
- var keys = dotkey.split(/\./)
111
+ const keys = dotkey.split(/\./)
112
112
 
113
- var value = Object.assign({}, object)
113
+ let value = Object.assign({}, object)
114
114
 
115
- for (var i = 0; i < keys.length; i++) {
115
+ for (let i = 0; i < keys.length; i++) {
116
116
  if (value !== undefined) {
117
117
  value = value[keys[i]]
118
118
  }
@@ -124,14 +124,14 @@ export default {
124
124
  extractInfo (object) {
125
125
  // console.log('extractField', object)
126
126
 
127
- var field = {}
127
+ const field = {}
128
128
 
129
- for (var property in object) {
129
+ for (const property in object) {
130
130
  if (object.hasOwnProperty(property)) {
131
- var infos = property.split(/\./)
131
+ const infos = property.split(/\./)
132
132
 
133
133
  if (infos[0] === 'info' && infos[1] !== undefined) {
134
- var name = property.substr(5, property.length)
134
+ const name = property.substr(5, property.length)
135
135
  // console.log('field', name, property)
136
136
 
137
137
  field[name] = object[property]
@@ -16,7 +16,7 @@ export default {
16
16
  }
17
17
 
18
18
  this.data = this.data || []
19
- var signal = null
19
+ let signal = null
20
20
 
21
21
  if (this.abortController) {
22
22
  // console.log('abort')
@@ -37,7 +37,7 @@ export default {
37
37
  this.ui.body.scrolltop = 0
38
38
  }
39
39
 
40
- var route = this.buildRoute(page, size)
40
+ const route = this.buildRoute(page, size)
41
41
 
42
42
  if (more !== true && this.options.count) {
43
43
  this.requestCount(route)
@@ -45,7 +45,7 @@ export default {
45
45
 
46
46
  // console.log('route - ', this.rand, route)
47
47
 
48
- fetch(route, {signal}).then((resp) => {
48
+ fetch(route, { signal }).then((resp) => {
49
49
  return resp.json()
50
50
  }).then((data) => {
51
51
  if (this.options.debug) {
@@ -68,7 +68,7 @@ export default {
68
68
  }
69
69
 
70
70
  if (more === true) {
71
- var a = this.data.concat(data)
71
+ const a = this.data.concat(data)
72
72
  this.data = a
73
73
  this.storeData(data, more)
74
74
  this.virtual.add(this.data)
@@ -95,7 +95,7 @@ export default {
95
95
 
96
96
  requestCount (route, signal) {
97
97
  // console.log('fetchCount', route)
98
- fetch(route + '&count=1', {signal}).then((resp) => {
98
+ fetch(route + '&count=1', { signal }).then((resp) => {
99
99
  return resp.json()
100
100
  }).then((data) => {
101
101
  // console.log('data', data.count)
@@ -137,7 +137,7 @@ export default {
137
137
  page = page || 1
138
138
  size = size || this.options.list.size
139
139
 
140
- var route = this.options.route
140
+ let route = this.options.route
141
141
 
142
142
  if (path) {
143
143
  route = this.options.route[path]
@@ -174,7 +174,7 @@ export default {
174
174
  // console.log('storeData', this.dataStore)
175
175
  this.dataStore = this.dataStore || {}
176
176
 
177
- for (var i = 0; i < list.length; i++) {
177
+ for (let i = 0; i < list.length; i++) {
178
178
  this.dataList.push(list[i][this.dataId])
179
179
  this.dataStore[list[i][this.dataId]] = list[i]
180
180
  }
@@ -15,7 +15,7 @@ export default {
15
15
  }
16
16
 
17
17
  this.data = this.data || []
18
- var signal = null
18
+ let signal = null
19
19
 
20
20
  if (this.abortController) {
21
21
  this.abortController.abort()
@@ -34,7 +34,7 @@ export default {
34
34
  this.ui.body.scrolltop = 0
35
35
  }
36
36
 
37
- var route = this.buildRoute(page, size, 'search')
37
+ let route = this.buildRoute(page, size, 'search')
38
38
 
39
39
  route = this.addParams(route, 'search=' + keywords)
40
40
 
@@ -44,7 +44,7 @@ export default {
44
44
  this.requestCount(route)
45
45
  }
46
46
 
47
- fetch(route, {signal}).then((resp) => {
47
+ fetch(route, { signal }).then((resp) => {
48
48
  return resp.json()
49
49
  }).then((data) => {
50
50
  // console.log('data', data)
@@ -64,7 +64,7 @@ export default {
64
64
  }
65
65
 
66
66
  if (more === true) {
67
- var a = this.data.concat(data)
67
+ const a = this.data.concat(data)
68
68
  this.data = a
69
69
  this.storeData(data, more)
70
70
  this.virtual.add(this.data)
@@ -118,9 +118,9 @@ export default {
118
118
  }
119
119
 
120
120
  if (this.ui['search-input']) {
121
- this.ui['search-input'].input.value = ''
122
- this.ui['search-input'].element.classList.add('show')
123
- this.ui['search-input'].input.focus()
121
+ this.ui['search-input'].set()
122
+ this.ui['search-input'].show()
123
+ this.ui['search-input'].focus()
124
124
  }
125
125
 
126
126
  this.ui.body.innerHTML = ''
@@ -142,8 +142,8 @@ export default {
142
142
  this.ui.search.element.classList.remove('selected')
143
143
  }
144
144
  if (this.ui['search-input']) {
145
- this.ui['search-input'].element.classList.remove('show')
146
- this.ui['search-input'].input.value = ''
145
+ this.ui['search-input'].hide()
146
+ this.ui['search-input'].set()
147
147
  }
148
148
  // this.ui['search-list'].classList.remove('show')
149
149
  // this.ui.body.classList.remove('hide')
@@ -3,7 +3,7 @@ export default {
3
3
  // console.log('select', item.dataset.id)
4
4
  if (!item || !item.dataset.id) return
5
5
 
6
- var id = item.dataset.id
6
+ const id = item.dataset.id
7
7
 
8
8
  this.index = this.dataList.indexOf(id)
9
9
  this.info = this.dataStore[id]
@@ -12,7 +12,7 @@ export default {
12
12
  return
13
13
  }
14
14
 
15
- var selected = this.ui.body.querySelector('.selected')
15
+ const selected = this.ui.body.querySelector('.selected')
16
16
  if (selected) selected.classList.remove('selected')
17
17
 
18
18
  if (id) {
@@ -32,7 +32,7 @@ export default {
32
32
 
33
33
  unselect () {
34
34
  // console.log('unselect')
35
- var item = this.ui.body.querySelector('[data-id="' + this.id + '"]') || this.item
35
+ const item = this.ui.body.querySelector('[data-id="' + this.id + '"]') || this.item
36
36
  this.id = null
37
37
  if (item) {
38
38
  item.classList.remove('selected')
@@ -51,7 +51,7 @@ export default {
51
51
 
52
52
  getItemById (id, silent) {
53
53
  // console.log('selectItemById', id)
54
- var item = this.ui.body.querySelector('[data-id="' + id + '"]')
54
+ const item = this.ui.body.querySelector('[data-id="' + id + '"]')
55
55
 
56
56
  if (!item) {
57
57
  return null
@@ -67,7 +67,7 @@ export default {
67
67
  return false
68
68
  }
69
69
 
70
- var index = this.dataList.indexOf(id)
70
+ const index = this.dataList.indexOf(id)
71
71
  if (index < 0) {
72
72
  // console.log('can\'t selectid, not in the list')
73
73
  return false
@@ -83,16 +83,16 @@ export default {
83
83
 
84
84
  selectItemById (id, direction) {
85
85
  // console.log('selectItemById', id)
86
- var item = this.ui.body.querySelector('[data-id="' + id + '"]')
86
+ const item = this.ui.body.querySelector('[data-id="' + id + '"]')
87
87
 
88
88
  this.id = id
89
89
 
90
90
  if (!item) {
91
- var index = this.dataList.indexOf(id)
91
+ const index = this.dataList.indexOf(id)
92
92
  // console.log('not found in DOM, check in dataList', index)
93
93
  if (index > -1) {
94
- var listSize = this.options.list.size
95
- var slice = listSize * index / listSize
94
+ const listSize = this.options.list.size
95
+ const slice = listSize * index / listSize
96
96
  // console.log('getSlice', slice)
97
97
  }
98
98
 
@@ -103,7 +103,7 @@ export default {
103
103
 
104
104
  // if (this.item) this.item.classList.remove('selected')
105
105
 
106
- var selected = this.ui.body.querySelector('.selected')
106
+ const selected = this.ui.body.querySelector('.selected')
107
107
  if (selected) selected.classList.remove('selected')
108
108
 
109
109
  this.item = item
@@ -118,7 +118,7 @@ export default {
118
118
  },
119
119
 
120
120
  selectPosition (item, direction) {
121
- var offsetY = this.options.item.height
121
+ const offsetY = this.options.item.height
122
122
  direction = direction || 'down'
123
123
  // console.log('selectPosition', this.ui.body, direction)
124
124
 
@@ -126,12 +126,12 @@ export default {
126
126
 
127
127
  // console.log('coord', this.coord)
128
128
 
129
- var itemTop = item.offsetTop + this.coord.top - this.ui.body.scrollTop
129
+ const itemTop = item.offsetTop + this.coord.top - this.ui.body.scrollTop
130
130
 
131
131
  if (direction === 'down' && itemTop + this.options.item.height + offsetY - this.coord.y > this.coord.height) {
132
132
  var top = this.ui.body.scrollTop + itemTop - this.coord.height - this.coord.y + this.options.item.height + offsetY
133
133
  this.ui.body.scrollTo({
134
- top: top,
134
+ top,
135
135
  left: 0
136
136
  // behavior: 'smooth'
137
137
  })
@@ -142,7 +142,7 @@ export default {
142
142
  // console.lof('scrollTo', top, item)
143
143
  this.ui.body.scrollTo({
144
144
  left: 0,
145
- top: top
145
+ top
146
146
  // behavior: 'smooth'
147
147
  })
148
148
  }
@@ -150,9 +150,9 @@ export default {
150
150
 
151
151
  selectNext (silent) {
152
152
  // console.log('selectNext', this.id)
153
- var idx = this.dataList.indexOf(this.id)
153
+ const idx = this.dataList.indexOf(this.id)
154
154
 
155
- var id = this.dataList[idx + 1]
155
+ const id = this.dataList[idx + 1]
156
156
 
157
157
  // console.log('id', id)
158
158
 
@@ -172,9 +172,9 @@ export default {
172
172
 
173
173
  selectPrevious (silent) {
174
174
  // console.log('selectPrevious', this.id)
175
- var idx = this.dataList.indexOf(this.id)
175
+ const idx = this.dataList.indexOf(this.id)
176
176
 
177
- var id = this.dataList[idx - 1]
177
+ const id = this.dataList[idx - 1]
178
178
 
179
179
  if (id) {
180
180
  this.id = id
@@ -9,7 +9,7 @@ export default {
9
9
 
10
10
  statusCount (count) {
11
11
  // console.log('statusCount', count)
12
- var items = 'items'
12
+ let items = 'items'
13
13
  if (this.status && this.status.count && this.status.count.name) {
14
14
  items = this.status.count.name
15
15
  }
@@ -9,8 +9,8 @@ export default {
9
9
 
10
10
  getUpdatedIndex (id) {
11
11
  // console.log('getUpdatedIndex', id)
12
- var index = null
13
- for (var i = 0; i < this.data.length; i++) {
12
+ let index = null
13
+ for (let i = 0; i < this.data.length; i++) {
14
14
  // console.log('--', this.data[i][this.dataId], id)
15
15
  if (this.data[i][this.dataId] === id) {
16
16
  index = i
@@ -23,9 +23,9 @@ export default {
23
23
 
24
24
  getUpdatedInfo (id) {
25
25
  // console.log('getUpdatedInfo', id)
26
- var index = this.getUpdatedIndex(id)
26
+ const index = this.getUpdatedIndex(id)
27
27
  // console.log('index', index)
28
- var route = this.buildRoute(index + 1, 1)
28
+ const route = this.buildRoute(index + 1, 1)
29
29
  // console.log('roote', route)
30
30
  fetch(route).then((resp) => {
31
31
  return resp.json()
@@ -50,10 +50,10 @@ export default {
50
50
  this.dataStore[info[this.dataId]] = info
51
51
 
52
52
  // update item if on the screen
53
- var item = this.ui.body.querySelector('[data-id="' + info[this.dataId] + '"]')
53
+ const item = this.ui.body.querySelector('[data-id="' + info[this.dataId] + '"]')
54
54
  if (item) {
55
55
  item.innerHTML = ''
56
- var layout = new Layout(this.options.layout.item, item)
56
+ const layout = new Layout(this.options.layout.item, item)
57
57
 
58
58
  this.renderInfo(layout, info)
59
59
  }