material 0.8.9 → 0.9.1
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 +24 -9
- package/package.json +1 -1
- package/scripts/doccoAssistant.js +25 -0
- package/src/appbar.js +2 -4
- package/src/badge.js +6 -13
- package/src/button.js +10 -18
- package/src/calendar.js +23 -48
- package/src/card.js +2 -4
- package/src/checkbox.js +2 -7
- package/src/class/component.js +19 -0
- package/src/class/control.js +33 -0
- package/src/component.js +7 -41
- package/src/datehour.js +2 -4
- package/src/dialog.js +3 -5
- package/src/drawer.js +12 -12
- package/src/element.js +16 -20
- package/src/file.js +6 -4
- package/src/form/build.js +2 -2
- package/src/form.js +9 -22
- package/src/icon.js +6 -34
- package/src/image.js +1 -3
- package/src/item.js +3 -3
- package/src/link.js +1 -3
- package/src/list/build.js +2 -2
- package/src/list/render.js +2 -2
- package/src/list/select.js +4 -2
- package/src/list/update.js +2 -2
- package/src/list.js +12 -13
- package/src/loader.js +4 -7
- package/src/loading.js +2 -8
- package/src/map.js +27 -32
- package/src/menu.js +78 -19
- package/src/mixin/build.js +68 -0
- package/src/mixin/emitter.js +0 -2
- package/src/mixin/position.js +20 -9
- package/src/module/build.js +51 -46
- package/src/module/clone.js +15 -0
- package/src/module/dot.js +15 -9
- package/src/module/events.js +2 -0
- package/src/module/layout.js +76 -0
- package/src/module/merge.js +22 -0
- package/src/navigation.js +4 -3
- package/src/progress.js +9 -24
- package/src/search.js +3 -2
- package/src/select.js +2 -2
- package/src/selecter.js +5 -4
- package/src/selector.js +23 -41
- package/src/slider.js +33 -55
- package/src/snackbar.js +1 -1
- package/src/switch.js +1 -1
- package/src/switcher.js +1 -1
- package/src/tabs.js +12 -19
- package/src/tabview.js +1 -1
- package/src/text.js +2 -4
- package/src/textfield.js +1 -3
- package/src/toolbar.js +6 -20
- package/src/tooltip.js +14 -24
- package/src/tree.js +10 -14
- package/src/view.js +2 -2
- package/src/divider.js +0 -60
- package/src/layout.js +0 -106
package/src/tabs.js
CHANGED
|
@@ -6,27 +6,20 @@ import offset from './element/offset'
|
|
|
6
6
|
|
|
7
7
|
import List from './list'
|
|
8
8
|
import Button from './button'
|
|
9
|
-
import
|
|
9
|
+
import Element from './element'
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class: 'tabs',
|
|
14
|
-
tag: 'div',
|
|
15
|
-
indicator: {
|
|
11
|
+
class Tabs {
|
|
12
|
+
static defaults = {
|
|
16
13
|
prefix: 'material',
|
|
17
|
-
class: '
|
|
18
|
-
tag: 'div'
|
|
14
|
+
class: 'tabs',
|
|
15
|
+
tag: 'div',
|
|
16
|
+
indicator: {
|
|
17
|
+
prefix: 'material',
|
|
18
|
+
class: 'indicator',
|
|
19
|
+
tag: 'div'
|
|
20
|
+
}
|
|
19
21
|
}
|
|
20
|
-
}
|
|
21
22
|
|
|
22
|
-
class Tabs {
|
|
23
|
-
static uid = "material-tabs";
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Constructor
|
|
27
|
-
* @param {Object} options - Component options
|
|
28
|
-
* @return {Object} Class instance
|
|
29
|
-
*/
|
|
30
23
|
constructor (options) {
|
|
31
24
|
this.init(options)
|
|
32
25
|
this.build()
|
|
@@ -35,7 +28,7 @@ class Tabs {
|
|
|
35
28
|
}
|
|
36
29
|
|
|
37
30
|
init (options) {
|
|
38
|
-
this.options =
|
|
31
|
+
this.options = { ...Tabs.defaults, ...options }
|
|
39
32
|
Object.assign(this, insert, emitter)
|
|
40
33
|
}
|
|
41
34
|
|
|
@@ -58,7 +51,7 @@ class Tabs {
|
|
|
58
51
|
render: (info) => {
|
|
59
52
|
let item
|
|
60
53
|
if (info.type === 'divider') {
|
|
61
|
-
item = new
|
|
54
|
+
item = new Element({ class: 'divider' })
|
|
62
55
|
} else {
|
|
63
56
|
item = new Button({
|
|
64
57
|
name: info.name,
|
package/src/tabview.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import EventEmitter from './mixin/emitter'
|
|
2
2
|
import observer from './element/observer'
|
|
3
3
|
import events from './module/events'
|
|
4
|
-
import build from './
|
|
4
|
+
import build from './mixin/build'
|
|
5
5
|
import display from './view/display'
|
|
6
6
|
|
|
7
7
|
class TabView extends EventEmitter {
|
package/src/text.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import build from './
|
|
1
|
+
import build from './mixin/build'
|
|
2
2
|
|
|
3
3
|
class Text {
|
|
4
|
-
static uid = "material-text";
|
|
5
|
-
|
|
6
4
|
static defaults = {
|
|
7
5
|
class: 'text',
|
|
8
6
|
tag: 'span'
|
|
@@ -15,7 +13,7 @@ class Text {
|
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
init (options) {
|
|
18
|
-
this.options =
|
|
16
|
+
this.options = { ...Text.defaults, ...options }
|
|
19
17
|
Object.assign(this, build)
|
|
20
18
|
}
|
|
21
19
|
|
package/src/textfield.js
CHANGED
|
@@ -4,8 +4,6 @@ import dataset from './module/dataset'
|
|
|
4
4
|
import attributes from './module/attributes'
|
|
5
5
|
|
|
6
6
|
class Textfield {
|
|
7
|
-
static uid = "material-textfield";
|
|
8
|
-
|
|
9
7
|
static isComponent () {
|
|
10
8
|
return true
|
|
11
9
|
}
|
|
@@ -28,7 +26,7 @@ class Textfield {
|
|
|
28
26
|
}
|
|
29
27
|
|
|
30
28
|
init (options) {
|
|
31
|
-
this.options =
|
|
29
|
+
this.options = { ...Textfield.defaults, ...options }
|
|
32
30
|
Object.assign(this, emitter, dataset)
|
|
33
31
|
// console.log('options', options)
|
|
34
32
|
}
|
package/src/toolbar.js
CHANGED
|
@@ -4,40 +4,26 @@ import create from './mixin/create'
|
|
|
4
4
|
import insert from './mixin/insert'
|
|
5
5
|
import offset from './element/offset'
|
|
6
6
|
|
|
7
|
-
const defaults = {
|
|
8
|
-
prefix: 'material',
|
|
9
|
-
class: 'toolbar',
|
|
10
|
-
tag: 'div'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
7
|
class Toolbar {
|
|
14
|
-
static
|
|
8
|
+
static defaults = {
|
|
9
|
+
prefix: 'material',
|
|
10
|
+
class: 'toolbar',
|
|
11
|
+
tag: 'div'
|
|
12
|
+
}
|
|
15
13
|
|
|
16
|
-
/**
|
|
17
|
-
* Constructor
|
|
18
|
-
* @param {Object} options - Component options
|
|
19
|
-
* @return {Object} Class instance
|
|
20
|
-
*/
|
|
21
14
|
constructor (options) {
|
|
22
15
|
this.init(options)
|
|
23
16
|
this.build()
|
|
24
17
|
this.attach()
|
|
25
|
-
return this
|
|
26
18
|
}
|
|
27
19
|
|
|
28
20
|
init (options) {
|
|
29
|
-
this.options =
|
|
21
|
+
this.options = { ...Toolbar.defaults, ...options }
|
|
30
22
|
Object.assign(this, insert)
|
|
31
23
|
|
|
32
|
-
// console.log('waterfALL', this.options.waterfall)
|
|
33
|
-
|
|
34
24
|
this.waterfall = this.options.waterfall
|
|
35
25
|
}
|
|
36
26
|
|
|
37
|
-
/**
|
|
38
|
-
* Build Method
|
|
39
|
-
* @return {Object} This class instance
|
|
40
|
-
*/
|
|
41
27
|
build () {
|
|
42
28
|
this.element = create(this.options)
|
|
43
29
|
|
package/src/tooltip.js
CHANGED
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
import touch from './module/touch'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Class Tootip
|
|
5
|
-
* @class
|
|
6
|
-
* @since 0.3.16
|
|
7
|
-
* @example
|
|
8
|
-
* var div = new Tootip({
|
|
9
|
-
* tag: 'div',
|
|
10
|
-
* class: 'mydiv',
|
|
11
|
-
* })
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
const defaults = {
|
|
15
|
-
targets: '[data-tooltip]',
|
|
16
|
-
offset: {
|
|
17
|
-
top: 60
|
|
18
|
-
},
|
|
19
|
-
disabled: false
|
|
20
|
-
}
|
|
21
|
-
|
|
22
3
|
class Tooltip {
|
|
23
|
-
static
|
|
4
|
+
static defaults = {
|
|
5
|
+
targets: '[data-tooltip]',
|
|
6
|
+
offset: {
|
|
7
|
+
top: 60
|
|
8
|
+
},
|
|
9
|
+
disabled: false
|
|
10
|
+
}
|
|
24
11
|
|
|
25
12
|
/**
|
|
26
13
|
* The init method of the Button class
|
|
@@ -30,15 +17,18 @@ class Tooltip {
|
|
|
30
17
|
*/
|
|
31
18
|
constructor (options) {
|
|
32
19
|
// console.log('constructor')
|
|
33
|
-
this.options = Object.assign({}, defaults, options || {})
|
|
34
|
-
// console.log('element options', options)
|
|
35
20
|
|
|
21
|
+
this.init(options)
|
|
36
22
|
this.build()
|
|
37
|
-
this.
|
|
23
|
+
this.bindEvents()
|
|
38
24
|
|
|
39
25
|
return this
|
|
40
26
|
}
|
|
41
27
|
|
|
28
|
+
init (options) {
|
|
29
|
+
this.options = { ...Tooltip.defaults, ...options }
|
|
30
|
+
}
|
|
31
|
+
|
|
42
32
|
build () {
|
|
43
33
|
const container = this.options.container || document.body
|
|
44
34
|
|
|
@@ -57,7 +47,7 @@ class Tooltip {
|
|
|
57
47
|
container.appendChild(this.element)
|
|
58
48
|
}
|
|
59
49
|
|
|
60
|
-
|
|
50
|
+
bindEvents () {
|
|
61
51
|
// console.log('attach', this.options.targets)
|
|
62
52
|
const targets = document.querySelectorAll(this.options.targets)
|
|
63
53
|
|
package/src/tree.js
CHANGED
|
@@ -3,22 +3,18 @@ import * as css from './module/css'
|
|
|
3
3
|
import events from './module/events'
|
|
4
4
|
import insert from './mixin/insert'
|
|
5
5
|
|
|
6
|
-
const defaults = {
|
|
7
|
-
prefix: 'material',
|
|
8
|
-
class: 'tree',
|
|
9
|
-
functions: ['render', 'select'],
|
|
10
|
-
target: '.item-tree',
|
|
11
|
-
events: [
|
|
12
|
-
['root.click', 'onSelect']
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
|
|
16
6
|
class Tree {
|
|
17
|
-
static
|
|
7
|
+
static defaults = {
|
|
8
|
+
prefix: 'material',
|
|
9
|
+
class: 'tree',
|
|
10
|
+
functions: ['render', 'select'],
|
|
11
|
+
target: '.item-tree',
|
|
12
|
+
events: [
|
|
13
|
+
['root.click', 'onSelect']
|
|
14
|
+
]
|
|
15
|
+
}
|
|
18
16
|
|
|
19
17
|
constructor (options) {
|
|
20
|
-
this.options = Object.assign({}, defaults, options || {})
|
|
21
|
-
|
|
22
18
|
this.init()
|
|
23
19
|
this.build()
|
|
24
20
|
events.attach(this.options.events, this)
|
|
@@ -27,7 +23,7 @@ class Tree {
|
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
init () {
|
|
30
|
-
|
|
26
|
+
this.options = { ...Tree.defaults, ...options }
|
|
31
27
|
|
|
32
28
|
this.name = this.options.name
|
|
33
29
|
this.filters = []
|
package/src/view.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import EventEmitter from './mixin/emitter'
|
|
2
|
-
import build from './
|
|
2
|
+
import build from './mixin/build'
|
|
3
3
|
|
|
4
4
|
class View extends EventEmitter {
|
|
5
5
|
static defaults = {
|
|
@@ -15,7 +15,7 @@ class View extends EventEmitter {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
init (options) {
|
|
18
|
-
this.options =
|
|
18
|
+
this.options = { ...View.defaults, ...options }
|
|
19
19
|
Object.assign(this, build)
|
|
20
20
|
}
|
|
21
21
|
}
|
package/src/divider.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import create from './mixin/create'
|
|
2
|
-
import insert from './mixin/insert'
|
|
3
|
-
|
|
4
|
-
const defaults = {
|
|
5
|
-
prefix: 'material',
|
|
6
|
-
class: 'divider',
|
|
7
|
-
tag: 'span'
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* this class component represent an divider usually in a list
|
|
12
|
-
*
|
|
13
|
-
* @class
|
|
14
|
-
* @extends {Component}
|
|
15
|
-
* @return {Object} The class instance
|
|
16
|
-
* @example new Item(object);
|
|
17
|
-
*/
|
|
18
|
-
class Divider {
|
|
19
|
-
static uid = "material-divider";
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* init
|
|
23
|
-
* @return {Object} The class options
|
|
24
|
-
*/
|
|
25
|
-
constructor (options) {
|
|
26
|
-
this.init(options)
|
|
27
|
-
this.build()
|
|
28
|
-
|
|
29
|
-
return this
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* [init description]
|
|
34
|
-
* @param {?} options [description]
|
|
35
|
-
* @return {?} [description]
|
|
36
|
-
*/
|
|
37
|
-
init (options) {
|
|
38
|
-
this.options = Object.assign({}, defaults, options || {})
|
|
39
|
-
|
|
40
|
-
Object.assign(this, insert)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Build function for item
|
|
45
|
-
* @return {Object} This class instance
|
|
46
|
-
*/
|
|
47
|
-
build () {
|
|
48
|
-
this.element = create(this.options)
|
|
49
|
-
|
|
50
|
-
if (this.options.text) {
|
|
51
|
-
this.element.textContent = this.options.text
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (this.options.container) {
|
|
55
|
-
this.insert(this.options.container)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export default Divider
|
package/src/layout.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { is as isObject } from './module/object'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Layout class for creating and managing UI components.
|
|
5
|
-
*/
|
|
6
|
-
class Layout {
|
|
7
|
-
/**
|
|
8
|
-
* Constructs a new Layout instance.
|
|
9
|
-
*
|
|
10
|
-
* @param {Array} schema - An array defining the structure and components of the layout.
|
|
11
|
-
* @param {HTMLElement} container - The container in which the layout components are placed.
|
|
12
|
-
* @param {boolean} [enableMemoization=false] - Flag to enable memoization (not implemented in current version).
|
|
13
|
-
*/
|
|
14
|
-
constructor (schema, container) {
|
|
15
|
-
this.components = []
|
|
16
|
-
// const startTime = Date.now()
|
|
17
|
-
this.component = this.create(schema, container)
|
|
18
|
-
// const endTime = Date.now()
|
|
19
|
-
// console.log(`Execution time: ${endTime - startTime} ms`)
|
|
20
|
-
return this
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Recursively creates components based on a provided schema.
|
|
25
|
-
*
|
|
26
|
-
* @param {Array} schema - An array of components or sub-schemas.
|
|
27
|
-
* @param {HTMLElement} container - The container for the current level of components.
|
|
28
|
-
* @param {Object} [structure={}] - An accumulator object for components, keyed by name.
|
|
29
|
-
* @param {number} [level=0] - The current level of recursion.
|
|
30
|
-
* @returns {Object} The structure containing all created components.
|
|
31
|
-
*/
|
|
32
|
-
create (schema, container, structure, level) {
|
|
33
|
-
level = level || 0
|
|
34
|
-
level++
|
|
35
|
-
|
|
36
|
-
structure = structure || {}
|
|
37
|
-
let component = null
|
|
38
|
-
const fragment = document.createDocumentFragment()
|
|
39
|
-
|
|
40
|
-
for (let i = 0; i < schema.length; i++) {
|
|
41
|
-
var name
|
|
42
|
-
let options = {}
|
|
43
|
-
|
|
44
|
-
if (schema[i] instanceof Object && typeof schema[i] === 'function') {
|
|
45
|
-
if (isObject(schema[i + 1])) {
|
|
46
|
-
options = schema[i + 1]
|
|
47
|
-
} else if (isObject(schema[i + 2])) {
|
|
48
|
-
options = schema[i + 2]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (typeof schema[i + 1] === 'string') {
|
|
52
|
-
name = schema[i + 1]
|
|
53
|
-
if (!schema[i].isElement && !schema[i].isComponent) {
|
|
54
|
-
options.name = name
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
component = new schema[i](options)
|
|
59
|
-
|
|
60
|
-
const element = component.element || component
|
|
61
|
-
if (level === 1) structure.element = element
|
|
62
|
-
|
|
63
|
-
if (name) {
|
|
64
|
-
structure[name] = component
|
|
65
|
-
this.components.push([name, component])
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (component) {
|
|
69
|
-
if (component.insert) component.insert(fragment)
|
|
70
|
-
else fragment.appendChild(element)
|
|
71
|
-
|
|
72
|
-
if (component.onInserted) component.onInserted(fragment)
|
|
73
|
-
}
|
|
74
|
-
} else if (Array.isArray(schema[i])) {
|
|
75
|
-
if (!component) component = container
|
|
76
|
-
this.create(schema[i], component, structure, level)
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (container && fragment.hasChildNodes()) {
|
|
81
|
-
const wrapper = container.element || container
|
|
82
|
-
// console.log('wrapper', wrapper)
|
|
83
|
-
// console.log('fragment', fragment)
|
|
84
|
-
wrapper.appendChild(fragment)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return structure
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Retrieves a specific component or the entire component structure.
|
|
92
|
-
*
|
|
93
|
-
* This method allows accessing a component from the created layout by its name.
|
|
94
|
-
* If a name is provided, it returns the component associated with that name.
|
|
95
|
-
* If no name is provided, it returns the entire component structure.
|
|
96
|
-
*
|
|
97
|
-
* @param {string} name - The name of the component to retrieve.
|
|
98
|
-
* @returns {Object} The requested component or the entire component structure.
|
|
99
|
-
*/
|
|
100
|
-
get (name) {
|
|
101
|
-
if (name) return this.component[name]
|
|
102
|
-
else return this.component
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export default Layout
|