@ditojs/ui 2.73.0 → 2.73.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ditojs/ui",
3
- "version": "2.73.0",
3
+ "version": "2.73.2",
4
4
  "type": "module",
5
5
  "description": "Dito.js UI is a simple UI library, built with Vue.js for use in Dito.js Admin and elsewhere",
6
6
  "repository": "https://github.com/ditojs/dito/tree/master/packages/ui",
@@ -48,5 +48,5 @@
48
48
  "@ditojs/build": "^2.73.0",
49
49
  "vite": "^7.3.1"
50
50
  },
51
- "gitHead": "0afe5ac938419c584db685cddcbd8974ee000d7e"
51
+ "gitHead": "82e7dfcbddabbb559f9c4b04596aafb37c5b5e74"
52
52
  }
@@ -35,7 +35,10 @@ export default {
35
35
 
36
36
  computed: {
37
37
  hasAffixes() {
38
- return hasSlotContent('prefix') || hasSlotContent('suffix')
38
+ return (
39
+ hasSlotContent(this.$slots.prefix) ||
40
+ hasSlotContent(this.$slots.suffix)
41
+ )
39
42
  },
40
43
 
41
44
  classes() {
@@ -46,10 +49,6 @@ export default {
46
49
  const { class: _, ...attributes } = this.$attrs
47
50
  return attributes
48
51
  }
49
- },
50
-
51
- methods: {
52
- hasSlotContent
53
52
  }
54
53
  }
55
54
  </script>
@@ -1,7 +1,7 @@
1
1
  <template lang="pug">
2
2
  .dito-input(
3
3
  :class="classes"
4
- @mousedown.prevent="onMouseDown"
4
+ @mousedown="onMouseDown"
5
5
  )
6
6
  slot(name="prefix")
7
7
  input(
@@ -18,6 +18,7 @@
18
18
  :autocomplete="autocomplete"
19
19
  :aria-label="title"
20
20
  v-bind="attributes"
21
+ @mousedown="onMouseDown"
21
22
  )
22
23
  slot(name="suffix")
23
24
  </template>
@@ -97,11 +98,18 @@ export default {
97
98
  this.input.blur()
98
99
  },
99
100
 
100
- onMouseDown() {
101
- // Focus the input when the outer container is clicked, e.g. when clicking
102
- // on affixes.
103
- if (!this.disabled && !this.readonly) {
104
- this.focus()
101
+ onMouseDown(event) {
102
+ if (event.target === this.input) {
103
+ // When directly clicking the input, do not propagate the event and
104
+ // avoid `preventDefault()` below, to keep supporting selection.
105
+ event.stopPropagation()
106
+ } else {
107
+ // When clicking outside the input, e.g. on affixes, bring the focus
108
+ // back to the input.
109
+ if (!this.disabled && !this.readonly) {
110
+ this.focus()
111
+ event.preventDefault()
112
+ }
105
113
  }
106
114
  }
107
115
  }