wave-ui 3.11.0 → 3.12.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.11.0",
3
+ "version": "3.12.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",
@@ -81,12 +81,6 @@ export default {
81
81
  return this.normalize(this.keywords)
82
82
  },
83
83
 
84
- // Keep the autocomplete matching as fast as possible by caching optimized search strings.
85
- // An array of optimized strings.
86
- normalizedSelection () {
87
- return this.selection.map(item => this.normalize(item?.searchable))
88
- },
89
-
90
84
  // Keep the autocomplete matching as fast as possible by caching optimized search strings.
91
85
  optimizedItemsForSearch () {
92
86
  return this.items.map((item, i) => ({
@@ -98,8 +92,7 @@ export default {
98
92
 
99
93
  filteredItems () {
100
94
  let items = this.optimizedItemsForSearch // Array of objects.
101
- const selection = this.normalizedSelection.join(',') // Optimized string of coma separated words.
102
- const isItemNotSelected = item => !selection.includes(item.searchable)
95
+ const isItemNotSelected = item => !this.selection.find(i => i.uid === item.uid)
103
96
 
104
97
  if (this.keywords) {
105
98
  items = items.filter(item => {
@@ -478,6 +478,7 @@ $inactive-color: #777;
478
478
  align-items: center;
479
479
  background: none;
480
480
  border: none;
481
+ border-radius: inherit; // Mostly for the browser-autofilled appearance.
481
482
  outline: none;
482
483
  padding-left: 2 * $base-increment;
483
484
  padding-right: 2 * $base-increment;
@@ -34,10 +34,11 @@ component(
34
34
  :aria-owns="`w-select-menu--${_.uid}`"
35
35
  :aria-activedescendant="`w-select-menu--${_.uid}_item-1`"
36
36
  :class="inputWrapClasses")
37
- w-icon.w-select__icon.w-select__icon--inner-left(
38
- v-if="innerIconLeft"
39
- tag="label"
40
- @click="$emit('click:inner-icon-left', $event)") {{ innerIconLeft }}
37
+ slot(name="icon-left")
38
+ w-icon.w-select__icon.w-select__icon--inner-left(
39
+ v-if="innerIconLeft"
40
+ tag="label"
41
+ @click="$emit('click:inner-icon-left', $event)") {{ innerIconLeft }}
41
42
  .w-select__selection-slot(v-if="$slots.selection")
42
43
  //- inputValue is always an array.
43
44
  slot(name="selection" :item="multiple ? inputValue : inputValue[0]")
@@ -60,10 +61,11 @@ component(
60
61
  v-if="$slots.default || label"
61
62
  :class="labelClasses")
62
63
  slot {{ label }}
63
- w-icon.w-select__icon.w-select__icon--inner-right(
64
- v-if="innerIconRight"
65
- tag="label"
66
- @click="$emit('click:inner-icon-right', $event)") {{ innerIconRight }}
64
+ slot(name="icon-right")
65
+ w-icon.w-select__icon.w-select__icon--inner-right(
66
+ v-if="innerIconRight"
67
+ tag="label"
68
+ @click="$emit('click:inner-icon-right', $event)") {{ innerIconRight }}
67
69
  w-list(
68
70
  ref="w-list"
69
71
  :model-value="inputValue"
@@ -150,6 +150,7 @@ $outline-width: 2px;
150
150
  align-items: center;
151
151
  vertical-align: middle;
152
152
  cursor: pointer;
153
+ -webkit-tap-highlight-color: transparent;
153
154
 
154
155
  @include themeable;
155
156
 
@@ -157,7 +158,6 @@ $outline-width: 2px;
157
158
  &--disabled, &--readonly {
158
159
  cursor: not-allowed;
159
160
  touch-action: initial;
160
- -webkit-tap-highlight-color: transparent;
161
161
  }
162
162
 
163
163
  // Hidden checkbox.
@@ -609,16 +609,33 @@ export default {
609
609
  })
610
610
  },
611
611
 
612
+ /**
613
+ * Updates the pagination object and fills up missing variables to always maintain the paginationConfig
614
+ * object accurate for external use (read and write).
615
+ * The following vars will always be up to date and if one changes from outside the rest of them
616
+ * will update accordingly: itemsPerPage, itemsPerPageOptions, start, end, page, total.
617
+ *
618
+ * @param {Object} config The config object defining the pagination.
619
+ * This object can have at most itemsPerPage, page, total, and it will define the start, end and
620
+ * pagesCount from the given or current itemsPerPage, page and total.
621
+ * - If a total is given for update, trust it blindly (could come from a backend), and recompute
622
+ * the rest as long as itemsPerPage is defined.
623
+ * - If a page is given for update, it will navigate to that page.
624
+ * - If an itemsPerPage is given for update, it will navigate to that page.
625
+ */
612
626
  updatePaginationConfig ({ itemsPerPage, page, total }) {
613
627
  if (total) this.paginationConfig.total = total
614
628
  if (itemsPerPage !== undefined) {
615
629
  this.paginationConfig.itemsPerPage = itemsPerPage
616
630
  itemsPerPage = itemsPerPage || this.paginationConfig.total // If `0`, take all the results.
617
631
  this.paginationConfig.page = page || this.paginationConfig.page || 1
632
+
618
633
  page = this.paginationConfig.page // Shorthand var for next lines.
619
634
  total = this.paginationConfig.total // Shorthand var for next lines.
635
+ const itemsInAllPages = itemsPerPage * page
620
636
  this.paginationConfig.start = 1
621
- this.paginationConfig.end = total >= (itemsPerPage * page) ? (itemsPerPage * page) : (total % (itemsPerPage * page))
637
+ this.paginationConfig.end = total >= itemsInAllPages ? itemsInAllPages : (total % itemsInAllPages)
638
+
622
639
  this.paginationConfig.pagesCount = Math.ceil(total / itemsPerPage)
623
640
  }
624
641
  if (page) this.goToPage(page)
@@ -17,11 +17,12 @@ component(
17
17
 
18
18
  //- Input wrapper.
19
19
  .w-textarea__textarea-wrap(:class="inputWrapClasses")
20
- w-icon.w-textarea__icon.w-textarea__icon--inner-left(
21
- v-if="innerIconLeft"
22
- tag="label"
23
- :for="`w-textarea--${_.uid}`"
24
- @click="$emit('click:inner-icon-left', $event)") {{ innerIconLeft }}
20
+ slot(name="icon-left" :input-id="`w-textarea--${_.uid}`")
21
+ w-icon.w-textarea__icon.w-textarea__icon--inner-left(
22
+ v-if="innerIconLeft"
23
+ tag="label"
24
+ :for="`w-textarea--${_.uid}`"
25
+ @click="$emit('click:inner-icon-left', $event)") {{ innerIconLeft }}
25
26
  textarea.w-textarea__textarea(
26
27
  ref="textarea"
27
28
  v-model="inputValue"
@@ -44,11 +45,12 @@ component(
44
45
  v-if="$slots.default || label"
45
46
  :class="labelClasses")
46
47
  slot {{ label }}
47
- w-icon.w-textarea__icon.w-textarea__icon--inner-right(
48
- v-if="innerIconRight"
49
- tag="label"
50
- :for="`w-textarea--${_.uid}`"
51
- @click="$emit('click:inner-icon-right', $event)") {{ innerIconRight }}
48
+ slot(name="icon-right" :input-id="`w-textarea--${_.uid}`")
49
+ w-icon.w-textarea__icon.w-textarea__icon--inner-right(
50
+ v-if="innerIconRight"
51
+ tag="label"
52
+ :for="`w-textarea--${_.uid}`"
53
+ @click="$emit('click:inner-icon-right', $event)") {{ innerIconRight }}
52
54
 
53
55
  //- Right label.
54
56
  template(v-if="labelPosition === 'right'")