vhx-quartz 0.10.1 → 0.10.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.
- checksums.yaml +4 -4
- data/lib/vhx/quartz/version.rb +1 -1
- data/vendor/assets/javascripts/vhx-quartz.select.js +14 -10
- data/vendor/assets/javascripts/vhx-quartz.tag.js +15 -4
- data/vendor/assets/stylesheets/vhx-quartz.select.css +13 -7
- data/vendor/assets/stylesheets/vhx-quartz.tag.css +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: db39b7019ef57a978493c304c8b6ce1af64fc0c4
|
|
4
|
+
data.tar.gz: 225d90078555018c979b35780dc3d9794f4079ef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 464844b4d3c988e83f5bd2d864faf2cd127f5f90b929ac5631320d0e9148048ea5fa0f6c9839024168fd0299800d3487a6cd821aae36b07e6efbe3b98cfe550c
|
|
7
|
+
data.tar.gz: 3a00a545ff5cc79bb1ef4ab19fc9170078135b17c2eed93344accd332b2c0770a1431e52340f9e996d45a9f6e1d3cc26e15a7830b672bbdb3666f8e964bb997a
|
data/lib/vhx/quartz/version.rb
CHANGED
|
@@ -10,10 +10,13 @@ vhxm.components.shared.select.controller = function (opts) {
|
|
|
10
10
|
|
|
11
11
|
self.type = opts.type || 'standard';
|
|
12
12
|
self.multiselect = opts.multiselect || false;
|
|
13
|
+
self.caret_position = opts.caret_position || 'right';
|
|
13
14
|
self.model.items = opts.items;
|
|
14
15
|
|
|
15
16
|
if (opts.selected) {
|
|
16
|
-
|
|
17
|
+
opts.selected.map(function (item) {
|
|
18
|
+
self.selectItem(item, true);
|
|
19
|
+
});
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
if (opts.onSelect) {
|
|
@@ -94,7 +97,7 @@ vhxm.components.shared.select.controller = function (opts) {
|
|
|
94
97
|
self.state.isLoading(true);
|
|
95
98
|
};
|
|
96
99
|
|
|
97
|
-
self.selectItem = function (item) {
|
|
100
|
+
self.selectItem = function (item, isInit) {
|
|
98
101
|
var selected = void 0;
|
|
99
102
|
if (!self.multiselect) {
|
|
100
103
|
self.state.selected({});
|
|
@@ -104,15 +107,21 @@ vhxm.components.shared.select.controller = function (opts) {
|
|
|
104
107
|
|
|
105
108
|
if (selected[item[opts.prop_map.key]]) {
|
|
106
109
|
delete selected[item[opts.prop_map.key]];
|
|
110
|
+
self.state.onSelect(null, self.state.selected(), 'removed');
|
|
107
111
|
} else {
|
|
108
|
-
|
|
112
|
+
var obj = {
|
|
109
113
|
value: item[opts.prop_map.value],
|
|
110
114
|
label: item[opts.prop_map.label]
|
|
111
115
|
};
|
|
116
|
+
selected[item[opts.prop_map.key]] = obj;
|
|
117
|
+
self.state.onSelect(obj, self.state.selected(), 'added');
|
|
112
118
|
}
|
|
113
119
|
|
|
114
120
|
self.state.selected(selected);
|
|
115
|
-
|
|
121
|
+
|
|
122
|
+
if (!isInit) {
|
|
123
|
+
self.state.isDropdownOpen(self.multiselect ? true : false);
|
|
124
|
+
}
|
|
116
125
|
|
|
117
126
|
if (self.multiselect) {
|
|
118
127
|
self.state.highlightIndex(-1);
|
|
@@ -201,6 +210,7 @@ vhxm.components.shared.select.ui.container = {
|
|
|
201
210
|
options += opts.trigger ? '.has-trigger' : '';
|
|
202
211
|
options += opts.type === 'media' ? '.has-media' : '';
|
|
203
212
|
options += opts.inline ? '.inline' : '';
|
|
213
|
+
options += '.caret--' + ctrl.caret_position;
|
|
204
214
|
|
|
205
215
|
if (opts.trigger) {
|
|
206
216
|
opts.trigger.attrs.onclick = ctrl.handleClick;
|
|
@@ -208,12 +218,6 @@ vhxm.components.shared.select.ui.container = {
|
|
|
208
218
|
}
|
|
209
219
|
|
|
210
220
|
return m('.c-select--container.relative.form' + options, {
|
|
211
|
-
config: function config(el, isInitialized) {
|
|
212
|
-
if (opts.trigger && isInitialized) {
|
|
213
|
-
var left_pos = el.querySelector('.c-select--trigger').offsetWidth * 0.25;
|
|
214
|
-
el.querySelector('.c-select--caret').style.left = left_pos + 'px';
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
221
|
onmouseleave: function onmouseleave() {
|
|
218
222
|
ctrl.state.highlightIndex(-1);
|
|
219
223
|
},
|
|
@@ -4,10 +4,19 @@ vhxm.components.shared.tag.controller = function (opts) {
|
|
|
4
4
|
var self = this;
|
|
5
5
|
|
|
6
6
|
self.state = new vhxm.components.shared.tag.state();
|
|
7
|
+
|
|
8
|
+
if (opts.onShow) {
|
|
9
|
+
self.state.onShow = opts.onShow;
|
|
10
|
+
}
|
|
11
|
+
if (opts.onRemove) {
|
|
12
|
+
self.state.onRemove = opts.onRemove;
|
|
13
|
+
}
|
|
7
14
|
};
|
|
8
15
|
vhxm.components.shared.tag.state = function () {
|
|
9
16
|
this.isHover = m.prop(false);
|
|
10
17
|
this.isRemoveHover = m.prop(false);
|
|
18
|
+
this.onShow = function () {};
|
|
19
|
+
this.onRemove = function () {};
|
|
11
20
|
};
|
|
12
21
|
|
|
13
22
|
vhxm.components.shared.tag.ui.container = {
|
|
@@ -21,12 +30,14 @@ vhxm.components.shared.tag.ui.container = {
|
|
|
21
30
|
ctrl.state.isHover(false);
|
|
22
31
|
}
|
|
23
32
|
}, [m('button.c-tag--button' + (ctrl.state.isHover() ? '.btn-teal.is-hover' : '.btn-gray'), {
|
|
24
|
-
onclick: function onclick() {
|
|
25
|
-
|
|
33
|
+
onclick: function onclick(event) {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
ctrl.state.onShow(event);
|
|
26
36
|
}
|
|
27
37
|
}, opts.label ? opts.label : 'Tag'), m('a.c-tag--remove.icon--center.icon-x-white.icon--xxsmall' + (ctrl.state.isRemoveHover() ? '.btn-red' : '.btn-teal'), {
|
|
28
|
-
onclick: function onclick() {
|
|
29
|
-
|
|
38
|
+
onclick: function onclick(event) {
|
|
39
|
+
event.preventDefault();
|
|
40
|
+
ctrl.state.onRemove(event);
|
|
30
41
|
},
|
|
31
42
|
onmouseover: function onmouseover() {
|
|
32
43
|
ctrl.state.isRemoveHover(true);
|
|
@@ -27,6 +27,19 @@
|
|
|
27
27
|
..................................... */
|
|
28
28
|
/* helper function for margin and padding
|
|
29
29
|
......................................*/
|
|
30
|
+
.c-select--container.has-trigger .c-select--dropdown {
|
|
31
|
+
top: 35px; }
|
|
32
|
+
.c-select--container.has-search .c-select--dropdown {
|
|
33
|
+
min-height: 150px; }
|
|
34
|
+
.c-select--container.has-search .c-select--options {
|
|
35
|
+
margin-top: 80px; }
|
|
36
|
+
.c-select--container.caret--left .c-select--caret {
|
|
37
|
+
left: 22px; }
|
|
38
|
+
.c-select--container.caret--center .c-select--caret {
|
|
39
|
+
left: 50%; }
|
|
40
|
+
.c-select--container.caret--right .c-select--caret {
|
|
41
|
+
right: 22px; }
|
|
42
|
+
|
|
30
43
|
.c-select--dropdown {
|
|
31
44
|
position: absolute;
|
|
32
45
|
max-height: 282px;
|
|
@@ -34,8 +47,6 @@
|
|
|
34
47
|
left: 0;
|
|
35
48
|
z-index: 2147483600;
|
|
36
49
|
display: none; }
|
|
37
|
-
.c-select--dropdown.has-trigger {
|
|
38
|
-
top: 35px; }
|
|
39
50
|
.c-select--dropdown.is-open {
|
|
40
51
|
display: block; }
|
|
41
52
|
|
|
@@ -65,11 +76,6 @@
|
|
|
65
76
|
z-index: 2;
|
|
66
77
|
position: absolute; }
|
|
67
78
|
|
|
68
|
-
.c-select--container.has-search .c-select--dropdown {
|
|
69
|
-
min-height: 150px; }
|
|
70
|
-
.c-select--container.has-search .c-select--options {
|
|
71
|
-
margin-top: 80px; }
|
|
72
|
-
|
|
73
79
|
.c-select--options {
|
|
74
80
|
overflow-y: auto;
|
|
75
81
|
max-height: 200px; }
|