material 0.9.1 → 0.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "material",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "A lightweight implementation of Material Design Components for the web - ES6",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -5,7 +5,7 @@ import dot from '../module/dot'
5
5
 
6
6
  export default {
7
7
 
8
- render (list, option) {
8
+ render (list) {
9
9
  // console.log('render', list)
10
10
  this.virtual.set(list)
11
11
 
@@ -38,8 +38,6 @@ export default {
38
38
  class: 'item'
39
39
  })
40
40
 
41
- // console.log('---', this.id)
42
-
43
41
  if (this.id && this.id === info[this.dataId]) {
44
42
  element.classList.add('selected')
45
43
  }
@@ -53,9 +51,9 @@ export default {
53
51
  const item = info[this.options.itemSwitch]
54
52
 
55
53
  if (this.options.layout.item[item]) {
56
- layout = new Layout(this.options.layout.item[item], element)
54
+ layout = create(this.options.layout.item[item], element)
57
55
  } else {
58
- layout = new Layout(this.options.layout.item.base, element)
56
+ layout = create(this.options.layout.item.base, element)
59
57
  }
60
58
  } else {
61
59
  const itemName = this.options.itemName || 'item'
@@ -1,7 +1,5 @@
1
1
  import { is as isObject } from '../module/object'
2
2
 
3
- const components = []
4
-
5
3
  /**
6
4
  * Recursively creates components based on a provided schema.
7
5
  *
@@ -11,7 +9,8 @@ const components = []
11
9
  * @param {number} [level=0] - The current level of recursion.
12
10
  * @returns {Object} The structure containing all created components.
13
11
  */
14
- function create (schema, container, structure = {}, level = 0) {
12
+ function create (schema, container, structure = {}, level = 0, components = []) {
13
+ // console.log('layout create')
15
14
  level++
16
15
  let component
17
16
  const object = {}
@@ -53,7 +52,7 @@ function create (schema, container, structure = {}, level = 0) {
53
52
  }
54
53
  } else if (Array.isArray(schema[i])) {
55
54
  if (!component) component = container
56
- create(schema[i], component, structure, level)
55
+ create(schema[i], component, structure, level, components)
57
56
  }
58
57
  }
59
58
 
package/src/view/build.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import scrollbar from '../module/scrollbar'
2
2
  import dataset from '../module/dataset'
3
- import Layout from '../layout'
3
+ import { create } from './module/layout'
4
4
 
5
5
  export default {
6
6
  build () {
@@ -19,7 +19,7 @@ export default {
19
19
  this.container.appendChild(this.element)
20
20
 
21
21
  if (this.options.layout) {
22
- this.layout = new Layout(this.options.layout, this.element)
22
+ this.layout = create(this.options.layout, this.element)
23
23
  this.ui = this.layout.component
24
24
  }
25
25
  },