material 0.7.0 → 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.
- package/README.md +1 -5
- package/dist/demo-bundle.js +2281 -2
- package/dist/demo-bundle.js.map +7 -1
- package/dist/demo.js +13 -13
- package/esbuild.js +22 -0
- package/esbuild.watch.js +25 -0
- package/form.js +27 -0
- package/index.js +59 -58
- package/list.js +35 -0
- package/package.json +8 -17
- package/src/appbar.js +7 -204
- package/src/badge.js +27 -0
- package/src/button.js +127 -177
- package/src/calendar.js +53 -55
- package/src/card.js +1 -3
- package/src/checkbox.js +5 -55
- package/src/component.js +0 -2
- package/src/container.js +0 -2
- package/src/datehour.js +38 -0
- package/src/dialog.js +104 -151
- package/src/divider.js +1 -3
- package/src/drawer.js +1 -19
- package/src/element/attribute.js +7 -10
- package/src/element/build.js +6 -7
- package/src/element/create.js +3 -6
- package/src/element/event.js +2 -2
- package/src/element/insert.js +6 -17
- package/src/element/observer.js +22 -0
- package/src/element/offset.js +2 -2
- package/src/element/style.js +12 -12
- package/src/element.js +2 -2
- package/src/field/email.js +9 -44
- package/src/field/image.js +17 -51
- package/src/{control/file.js → file.js} +15 -45
- package/src/form/build.js +7 -7
- package/src/form/controller.js +8 -8
- package/src/form/create.js +1 -1
- package/src/form/data.js +9 -9
- package/src/form/delete.js +1 -1
- package/src/form/render.js +9 -9
- package/src/form/set.js +1 -1
- package/src/form/submit.js +6 -6
- package/src/form/update.js +3 -3
- package/src/form/verify.js +6 -6
- package/src/form.js +9 -11
- package/src/icon.js +4 -6
- package/src/image.js +39 -106
- package/src/item.js +1 -3
- package/src/layout.js +14 -14
- package/src/{control/link.js → link.js} +13 -32
- package/src/list/build.js +10 -10
- package/src/list/click.js +3 -3
- package/src/list/collection.js +1 -1
- package/src/list/filter.js +11 -11
- package/src/list/image.js +3 -3
- package/src/list/render.js +15 -15
- package/src/list/request.js +8 -8
- package/src/list/search.js +12 -12
- package/src/list/select.js +18 -18
- package/src/list/status.js +1 -1
- package/src/list/update.js +6 -6
- package/src/list/virtual.js +20 -20
- package/src/list/virtual.new.js +5 -5
- package/src/list.js +29 -217
- package/src/loading.js +73 -0
- package/src/map/build.js +2 -2
- package/src/map/countries.js +8 -8
- package/src/map/display.js +13 -13
- package/src/map/focus.js +7 -7
- package/src/map/select.js +2 -2
- package/src/map/set.js +3 -3
- package/src/map/viewport.js +11 -11
- package/src/menu.js +59 -115
- package/src/mixin/control.js +3 -3
- package/src/mixin/controller.js +5 -5
- package/src/mixin/create.js +1 -1
- package/src/mixin/display.js +1 -2
- package/src/mixin/events.js +4 -16
- package/src/mixin/focus.js +1 -1
- package/src/mixin/icon.js +2 -2
- package/src/mixin/init.js +2 -2
- package/src/mixin/insert.js +7 -29
- package/src/mixin/label.js +2 -2
- package/src/mixin/settings.js +5 -5
- package/src/module/attach.js +35 -49
- package/src/{control/module → module}/attributes.js +4 -4
- package/src/module/build.js +12 -12
- package/src/module/classify.js +4 -4
- package/src/module/controller.js +5 -32
- package/src/module/css.js +12 -84
- package/src/module/dataset.js +1 -1
- package/src/module/dom.js +8 -3
- package/src/module/dot.js +4 -4
- package/src/module/emitter.js +1 -1
- package/src/module/event.js +2 -2
- package/src/module/events.js +29 -35
- package/src/module/extract.js +10 -10
- package/src/module/last.js +18 -0
- package/src/module/mediator.js +1 -13
- package/src/module/object.js +4 -4
- package/src/module/observer.js +43 -16
- package/src/module/remove.js +10 -10
- package/src/module/ripple.js +19 -24
- package/src/module/scrollbar.js +10 -14
- package/src/module/smoothscroll.js +5 -9
- package/src/module/utils.js +14 -23
- package/src/module/viewport.js +5 -5
- package/src/navigation.js +19 -0
- package/src/progress.js +1 -11
- package/src/search.js +66 -0
- package/src/select.js +58 -273
- package/src/{control/selecter.js → selecter.js} +42 -42
- package/src/selector.js +3 -3
- package/src/skin/material/component/navigation.sass +9 -0
- package/src/skin/material/control/button.sass +10 -0
- package/src/slider.js +1 -3
- package/src/snackbar.js +72 -50
- package/src/switch.js +111 -103
- package/src/{control/switcher.js → switcher.js} +28 -31
- package/src/tabs.js +4 -5
- package/src/tabview.js +26 -46
- package/src/text.js +25 -74
- package/src/textfield.js +97 -234
- package/src/toolbar.js +12 -12
- package/src/tooltip.js +7 -7
- package/src/tree.js +10 -66
- package/src/view/build.js +2 -2
- package/src/view/dataset.js +1 -1
- package/src/view.js +9 -74
- package/rollup.config.js +0 -34
- package/src/banner.js +0 -231
- package/src/control/button.js +0 -239
- package/src/control/button.new.js +0 -190
- package/src/control/datehour.js +0 -65
- package/src/control/dialog.js +0 -175
- package/src/control/image.js +0 -92
- package/src/control/list.js +0 -67
- package/src/control/loading.js +0 -128
- package/src/control/menu.js +0 -85
- package/src/control/module/addclass.js +0 -16
- package/src/control/search.js +0 -98
- package/src/control/select.js +0 -130
- package/src/control/snackbar.js +0 -91
- package/src/control/switch.js +0 -272
- package/src/control/text.js +0 -70
- package/src/control/textfield.js +0 -177
- package/src/element/ripple.js +0 -90
- package/src/tabs/setup.js +0 -0
package/src/form/verify.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
verify () {
|
|
3
|
-
|
|
3
|
+
const list = this.options.require
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
let ok = true
|
|
6
6
|
|
|
7
|
-
for (
|
|
8
|
-
|
|
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
|
-
field.
|
|
11
|
+
field.element.classList.add('textfield-error')
|
|
12
12
|
ok = false
|
|
13
13
|
} else {
|
|
14
|
-
field.
|
|
14
|
+
field.element.classList.remove('textfield-error')
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
package/src/form.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
1
|
import insert from './element/insert'
|
|
4
|
-
import css from './module/css'
|
|
2
|
+
import * as css from './module/css'
|
|
5
3
|
import emitter from './module/emitter'
|
|
6
4
|
import attach from './module/attach'
|
|
7
5
|
import controller from './mixin/controller'
|
|
@@ -70,7 +68,7 @@ class Form {
|
|
|
70
68
|
* @return {Object} This class instance
|
|
71
69
|
*/
|
|
72
70
|
build () {
|
|
73
|
-
|
|
71
|
+
const tag = this.options.tag || 'div'
|
|
74
72
|
|
|
75
73
|
this.element = document.createElement(tag)
|
|
76
74
|
css.add(this.element, this.options.prefix + '-' + this.options.class)
|
|
@@ -101,8 +99,8 @@ class Form {
|
|
|
101
99
|
|
|
102
100
|
this.key = this.key || {}
|
|
103
101
|
|
|
104
|
-
for (
|
|
105
|
-
|
|
102
|
+
for (let i = 0; i < controls.length; i++) {
|
|
103
|
+
const control = controls[i]
|
|
106
104
|
// control.setAttribute('data-key', control.name);
|
|
107
105
|
|
|
108
106
|
this.key[control.name] = control
|
|
@@ -128,9 +126,9 @@ class Form {
|
|
|
128
126
|
* @return {?} [description]
|
|
129
127
|
*/
|
|
130
128
|
initControl (key, section) {
|
|
131
|
-
|
|
129
|
+
const name = key.name || 'undefined'
|
|
132
130
|
|
|
133
|
-
|
|
131
|
+
const control = this.render(key)
|
|
134
132
|
|
|
135
133
|
if (control) {
|
|
136
134
|
this.key[name] = control
|
|
@@ -181,15 +179,15 @@ class Form {
|
|
|
181
179
|
*/
|
|
182
180
|
parseInfo (obj, name, i) {
|
|
183
181
|
// console.log('parseInfo', obj, name, 'level ' + i);
|
|
184
|
-
|
|
182
|
+
let level = i || 0
|
|
185
183
|
level = level + 1
|
|
186
|
-
|
|
184
|
+
let key
|
|
187
185
|
|
|
188
186
|
if (obj instanceof Object) {
|
|
189
187
|
for (key in obj) {
|
|
190
188
|
if (obj.hasOwnProperty(key)) {
|
|
191
189
|
// recursive call to scan property
|
|
192
|
-
|
|
190
|
+
let n = null
|
|
193
191
|
if (name) {
|
|
194
192
|
n = name + '.' + key
|
|
195
193
|
} else {
|
package/src/icon.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
1
|
import insert from './mixin/insert'
|
|
4
|
-
import css from './module/css'
|
|
2
|
+
import * as css from './module/css'
|
|
5
3
|
|
|
6
4
|
var defaults = {
|
|
7
5
|
prefix: 'material',
|
|
@@ -56,10 +54,10 @@ class Icon {
|
|
|
56
54
|
this.element = this.element || {}
|
|
57
55
|
|
|
58
56
|
this.element = document.createElement(tag)
|
|
59
|
-
|
|
57
|
+
{ add }.add(this.element, this.options.prefix + '-' + this.options.class)
|
|
60
58
|
|
|
61
|
-
if (options.
|
|
62
|
-
//
|
|
59
|
+
if (options.{ add }) { { add }.add(this.element, options.{ add }) }
|
|
60
|
+
// { add }.add(this.element, this.options.class + '-adjust');
|
|
63
61
|
|
|
64
62
|
if (this.options.container) {
|
|
65
63
|
this.insert(this.options.container)
|
package/src/image.js
CHANGED
|
@@ -1,124 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
import build from './module/build'
|
|
2
2
|
|
|
3
|
-
// import insert from './mixin/insert'
|
|
4
|
-
import css from './module/css'
|
|
5
|
-
import insert from './element/insert'
|
|
6
|
-
import control from './mixin/control'
|
|
7
|
-
|
|
8
|
-
var defaults = {
|
|
9
|
-
prefix: 'material',
|
|
10
|
-
class: 'image',
|
|
11
|
-
tag: 'div'
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The item class is used for example as item list
|
|
16
|
-
*
|
|
17
|
-
* @class
|
|
18
|
-
* @extends {Component}
|
|
19
|
-
* @return {Object} The class instance
|
|
20
|
-
* @example new Item(object);
|
|
21
|
-
*/
|
|
22
3
|
class Image {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
4
|
+
static defaults = {
|
|
5
|
+
class: 'image',
|
|
6
|
+
tag: 'div',
|
|
7
|
+
format: 'thumb'
|
|
8
|
+
}
|
|
9
|
+
|
|
27
10
|
constructor (options) {
|
|
28
11
|
this.init(options)
|
|
29
12
|
this.build()
|
|
30
|
-
|
|
31
|
-
return this
|
|
32
13
|
}
|
|
33
14
|
|
|
34
|
-
/**
|
|
35
|
-
* [init description]
|
|
36
|
-
* @param {?} options [description]
|
|
37
|
-
* @return {?} [description]
|
|
38
|
-
*/
|
|
39
15
|
init (options) {
|
|
40
|
-
this.options =
|
|
41
|
-
Object.assign(this,
|
|
16
|
+
this.options = { ...Image.defaults, ...options }
|
|
17
|
+
Object.assign(this, build)
|
|
42
18
|
}
|
|
43
19
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
this.info = document.createElement('span')
|
|
66
|
-
css.add(this.info, this.options.class + '-info')
|
|
67
|
-
|
|
68
|
-
insert(this.info, this.element)
|
|
69
|
-
|
|
70
|
-
this.label(text, this.info)
|
|
71
|
-
|
|
72
|
-
// this.label = this.element.label
|
|
73
|
-
|
|
74
|
-
this.icon(this.options.icon, this.info, 'bottom')
|
|
75
|
-
|
|
76
|
-
// if (text) {
|
|
77
|
-
// this.label = document.createElement('span')
|
|
78
|
-
// this.label.innerText = text
|
|
79
|
-
// css.add(this.label, this.options.class + '-label')
|
|
80
|
-
// insert(this.label, this.element)
|
|
81
|
-
// }
|
|
82
|
-
|
|
83
|
-
css.add(this.element, this.options.prefix + '-' + this.options.class)
|
|
84
|
-
|
|
85
|
-
if (options.css) { css.add(this.element, options.css) }
|
|
86
|
-
// css.add(this.element, this.options.class + '-adjust');
|
|
87
|
-
|
|
88
|
-
if (this.options.container) {
|
|
89
|
-
this.insert(this.options.container)
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* [insert description]
|
|
95
|
-
* @param {?} container [description]
|
|
96
|
-
* @param {?} context [description]
|
|
97
|
-
* @return {?} [description]
|
|
98
|
-
*/
|
|
99
|
-
insert (container, context) {
|
|
100
|
-
insert(this.element, container, context)
|
|
101
|
-
|
|
102
|
-
return this
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Get or set text value of the element
|
|
107
|
-
* @param {string} value The text to set
|
|
108
|
-
* @returns {*}
|
|
109
|
-
*/
|
|
110
|
-
set (value) {
|
|
111
|
-
if (value) {
|
|
112
|
-
if (this.element.innerText) {
|
|
113
|
-
this.element.innerText = value
|
|
20
|
+
set (src) {
|
|
21
|
+
// console.log('set', src)
|
|
22
|
+
if (!src) {
|
|
23
|
+
this.element.style.backgroundImage = ''
|
|
24
|
+
} else {
|
|
25
|
+
let url = null
|
|
26
|
+
|
|
27
|
+
if (src.format) {
|
|
28
|
+
let format = this.sanitize(src.format)
|
|
29
|
+
|
|
30
|
+
if (format.length > 0) {
|
|
31
|
+
const index = format.indexOf(this.options.format)
|
|
32
|
+
if (index === -1) {
|
|
33
|
+
format = src.format[0] + '/'
|
|
34
|
+
} else {
|
|
35
|
+
format = this.options.format + '/'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
url = src.url + format
|
|
114
40
|
} else {
|
|
115
|
-
|
|
41
|
+
url = src.url
|
|
116
42
|
}
|
|
117
43
|
|
|
118
|
-
|
|
44
|
+
this.element.style.backgroundImage = 'url(' + url + src.filename + ')'
|
|
119
45
|
}
|
|
46
|
+
}
|
|
120
47
|
|
|
121
|
-
|
|
48
|
+
sanitize (formats) {
|
|
49
|
+
const a = []
|
|
50
|
+
for (let i = 0; i < formats.length; i++) {
|
|
51
|
+
const format = formats[i].replace(/\/$/, '')
|
|
52
|
+
a.push(format)
|
|
53
|
+
}
|
|
54
|
+
return a
|
|
122
55
|
}
|
|
123
56
|
}
|
|
124
57
|
|
package/src/item.js
CHANGED
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 (
|
|
19
|
+
for (let i = 0; i < schema.length; i++) {
|
|
20
20
|
// console.log('index', i, typeof schema[i])
|
|
21
21
|
var name
|
|
22
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
84
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
131
|
+
const field = {}
|
|
132
132
|
|
|
133
|
-
for (
|
|
133
|
+
for (const property in object) {
|
|
134
134
|
if (object.hasOwnProperty(property)) {
|
|
135
|
-
|
|
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])
|
|
@@ -1,36 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const defaults = {
|
|
4
|
-
class: 'link',
|
|
5
|
-
tag: 'a'
|
|
6
|
-
}
|
|
1
|
+
import build from './module/build'
|
|
7
2
|
|
|
8
3
|
class Link {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*/
|
|
14
|
-
constructor (options) {
|
|
15
|
-
this.options = Object.assign({}, defaults, options || {})
|
|
4
|
+
static defaults = {
|
|
5
|
+
class: 'link',
|
|
6
|
+
tag: 'a'
|
|
7
|
+
}
|
|
16
8
|
|
|
9
|
+
constructor (options) {
|
|
10
|
+
this.init(options)
|
|
17
11
|
this.build()
|
|
18
|
-
|
|
19
|
-
return this
|
|
12
|
+
this.setup()
|
|
20
13
|
}
|
|
21
14
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
build () {
|
|
27
|
-
this.element = document.createElement(this.options.tag)
|
|
28
|
-
this.element.classList.add(this.options.class)
|
|
29
|
-
|
|
30
|
-
if (this.options.class !== 'link') {
|
|
31
|
-
this.element.classList.add('link')
|
|
32
|
-
}
|
|
15
|
+
init (options) {
|
|
16
|
+
this.options = { ...Link.defaults, ...options }
|
|
17
|
+
Object.assign(this, build)
|
|
18
|
+
}
|
|
33
19
|
|
|
20
|
+
setup () {
|
|
34
21
|
if (this.options.link) {
|
|
35
22
|
this.set(this.options.link)
|
|
36
23
|
}
|
|
@@ -39,15 +26,9 @@ class Link {
|
|
|
39
26
|
this.element.target = this.options.target
|
|
40
27
|
}
|
|
41
28
|
|
|
42
|
-
if (this.options.container) {
|
|
43
|
-
this.options.container.appendChild(this.element)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
29
|
if (this.options.text) {
|
|
47
30
|
this.element.innerHTML = this.options.text
|
|
48
31
|
}
|
|
49
|
-
|
|
50
|
-
return this
|
|
51
32
|
}
|
|
52
33
|
|
|
53
34
|
set (link) {
|
package/src/list/build.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import scrollbar from '../module/scrollbar'
|
|
2
|
-
import dataset from '../
|
|
2
|
+
import dataset from '../module/dataset'
|
|
3
3
|
|
|
4
4
|
import Layout from '../layout'
|
|
5
5
|
import Virtual from './virtual'
|
|
6
|
-
import Loading from '../
|
|
6
|
+
import Loading from '../loading'
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
build (data) {
|
|
@@ -40,12 +40,12 @@ export default {
|
|
|
40
40
|
this.options.container.appendChild(this.element)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
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
|
|
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
|
-
|
|
56
|
+
const list = c.split(' ')
|
|
57
57
|
|
|
58
|
-
for (
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
111
|
-
|
|
110
|
+
// console.log('!!!!size', size)
|
|
111
|
+
// this.size = size
|
|
112
112
|
// })
|
|
113
113
|
//
|
|
114
114
|
},
|
package/src/list/click.js
CHANGED
package/src/list/collection.js
CHANGED
|
@@ -150,7 +150,7 @@ class Collection {
|
|
|
150
150
|
route = this.addParams(route, this.params())
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
if (this.ui.filter && this.ui.filter.
|
|
153
|
+
if (this.ui.filter && this.ui.filter.element.classList.contains('selected')) {
|
|
154
154
|
route = this.addParams(route, this.getFilter())
|
|
155
155
|
}
|
|
156
156
|
|
package/src/list/filter.js
CHANGED
|
@@ -3,7 +3,7 @@ export default {
|
|
|
3
3
|
initFilter () {
|
|
4
4
|
this.filter = this.extractFilter(this.ui)
|
|
5
5
|
|
|
6
|
-
for (
|
|
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
|
|
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
|
-
|
|
26
|
-
for (
|
|
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
|
|
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
|
|
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 (
|
|
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
|
-
|
|
98
|
+
const filter = {}
|
|
99
99
|
|
|
100
|
-
for (
|
|
100
|
+
for (const property in object) {
|
|
101
101
|
if (object.hasOwnProperty(property)) {
|
|
102
|
-
|
|
102
|
+
const str = property.split(/\./)
|
|
103
103
|
|
|
104
104
|
if (str[0] === 'filter' && str[1] !== undefined) {
|
|
105
|
-
|
|
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
|
-
|
|
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
|
-
|
|
11
|
+
const r = Math.floor(Math.random() * 100000) + 1
|
|
12
12
|
|
|
13
13
|
if (info.image.filename) {
|
|
14
|
-
|
|
14
|
+
const image = info.image.url + format + info.image.filename
|
|
15
15
|
layout.get('image').style.backgroundImage = 'url("' + image + '?' + r + '")'
|
|
16
16
|
}
|
|
17
17
|
}
|