wave-ui 3.6.2 → 3.7.0

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": "wave-ui",
3
- "version": "3.6.2",
3
+ "version": "3.7.0",
4
4
  "description": "An emerging UI framework for Vue.js (2 & 3) with only the bright side. :sunny:",
5
5
  "author": "Antoni Andre <antoniandre.web@gmail.com>",
6
6
  "homepage": "https://antoniandre.github.io/wave-ui",
@@ -112,8 +112,9 @@ export default {
112
112
  methods: {
113
113
  onInput () {
114
114
  this.isChecked = !this.isChecked
115
- this.$emit('update:modelValue', this.isChecked)
116
- this.$emit('input', this.isChecked)
115
+ const returnValue = this.isChecked && this.returnValue !== undefined ? this.returnValue : this.isChecked
116
+ this.$emit('update:modelValue', returnValue)
117
+ this.$emit('input', returnValue)
117
118
 
118
119
  if (!this.noRipple) {
119
120
  if (this.isChecked) {
@@ -40,6 +40,9 @@ export default {
40
40
  props: {
41
41
  items: { type: Array, required: true }, // All the possible options.
42
42
  modelValue: { type: Array }, // v-model on selected option.
43
+ // If true, the returnValue set on each w-checkboxes item will be returned once the checkbox is
44
+ // checked. If false & by default, the return value of the w-checkboxes is an array of booleans.
45
+ returnValues: { type: Boolean },
43
46
  labelOnLeft: { type: Boolean },
44
47
  itemLabelKey: { type: String, default: 'label' },
45
48
  itemValueKey: { type: String, default: 'value' },
@@ -94,7 +97,7 @@ export default {
94
97
 
95
98
  toggleCheck (checkbox, isChecked) {
96
99
  checkbox._isChecked = isChecked
97
- const selection = this.checkboxItems.filter(item => item._isChecked).map(item => item.value)
100
+ const selection = this.checkboxItems.filter(item => item._isChecked).map(item => this.returnValues ? item.returnValue : item.value)
98
101
 
99
102
  this.$emit('update:modelValue', selection)
100
103
  this.$emit('input', selection)
@@ -69,6 +69,7 @@ export default {
69
69
  contentClass: { type: [String, Object, Array] },
70
70
  arrow: { type: Boolean }, // The small triangle pointing toward the activator.
71
71
  minWidth: { type: [Number, String] }, // can be like: `40`, `5em`, `activator`.
72
+ maxWidth: { type: [Number, String] }, // can be like: `40`, `5em`, `activator`.
72
73
  overlay: { type: Boolean },
73
74
  overlayClass: { type: [String, Object, Array] },
74
75
  overlayProps: { type: Object }, // Allow passing down an object of props to the w-overlay component.
@@ -124,6 +125,11 @@ export default {
124
125
  else return isNaN(this.minWidth) ? this.minWidth : (this.minWidth ? `${this.minWidth}px` : 0)
125
126
  },
126
127
 
128
+ menuMaxWidth () {
129
+ if (this.maxWidth === 'activator') return this.activatorWidth ? `${this.activatorWidth}px` : 0
130
+ else return isNaN(this.maxWidth) ? this.maxWidth : (this.maxWidth ? `${this.maxWidth}px` : 0)
131
+ },
132
+
127
133
  menuClasses () {
128
134
  return objectifyClasses(this.menuClass)
129
135
  },
@@ -168,6 +174,7 @@ export default {
168
174
  top: (this.detachableCoords.top && `${~~this.detachableCoords.top}px`) || null,
169
175
  left: (this.detachableCoords.left && `${~~this.detachableCoords.left}px`) || null,
170
176
  minWidth: (this.minWidth && this.menuMinWidth) || null,
177
+ maxWidth: (this.maxWidth && this.menuMaxWidth) || null,
171
178
  '--w-menu-bg-color': this.arrow && (this.$waveui.colors[this.bgColor] || 'rgb(var(--w-base-bg-color-rgb))')
172
179
  }
173
180
  },