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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 954d84fa066952eb4c4f79c1b3c67ad5b3993ffb
4
- data.tar.gz: 83562c33164cb3d6d7777d5499a2c266966a5d83
3
+ metadata.gz: db39b7019ef57a978493c304c8b6ce1af64fc0c4
4
+ data.tar.gz: 225d90078555018c979b35780dc3d9794f4079ef
5
5
  SHA512:
6
- metadata.gz: 083ab461afbaf291de96631ca1840046209cbca5ef40450b04cb58ba4e726a96ab5852ac38c55602c562c615945bb3573ecddf7ab1f69799a77caa561ebd3006
7
- data.tar.gz: f4d9e1c902223234ea9efe5fe68b6d50195152b73f2703a7785007ef386470f67856c6e77fed7fab47c18b09f5e9ebe64a73d72426abc7b078698f84fa7eb2a6
6
+ metadata.gz: 464844b4d3c988e83f5bd2d864faf2cd127f5f90b929ac5631320d0e9148048ea5fa0f6c9839024168fd0299800d3487a6cd821aae36b07e6efbe3b98cfe550c
7
+ data.tar.gz: 3a00a545ff5cc79bb1ef4ab19fc9170078135b17c2eed93344accd332b2c0770a1431e52340f9e996d45a9f6e1d3cc26e15a7830b672bbdb3666f8e964bb997a
@@ -1,5 +1,5 @@
1
1
  module Vhx
2
2
  module Quartz
3
- VERSION = "0.10.1"
3
+ VERSION = "0.10.2"
4
4
  end
5
5
  end
@@ -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
- self.state.selected(opts.selected);
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
- selected[item[opts.prop_map.key]] = {
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
- self.state.isDropdownOpen(self.multiselect ? true : false);
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
- ctrl.state.onShow();
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
- ctrl.state.onRemove();
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; }
@@ -1,3 +1,5 @@
1
+ .c-tag.is-hover, .c-tag:hover {
2
+ z-index: 2; }
1
3
  .c-tag .c-tag--button {
2
4
  z-index: 1; }
3
5
  .c-tag .icon-x-white {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vhx-quartz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Robertson, Courtney Burton, Steven Bone, David Gonzalez