@dimailn/vuetify 2.7.2-alpha44 → 2.7.2-alpha45

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/lib/framework.js CHANGED
@@ -46,7 +46,7 @@ export default class Vuetify {
46
46
  }
47
47
  Vuetify.install = install;
48
48
  Vuetify.installed = false;
49
- Vuetify.version = "2.7.2-alpha44";
49
+ Vuetify.version = "2.7.2-alpha45";
50
50
  Vuetify.config = {
51
51
  silent: false
52
52
  };
@@ -13,6 +13,7 @@ export function prevent(e) {
13
13
 
14
14
  export default mixins(VInput, Rippleable, Comparable).extend({
15
15
  name: 'selectable',
16
+ $_emitChangeEvent: true,
16
17
  props: {
17
18
  id: String,
18
19
  value: null,
@@ -32,10 +33,6 @@ export default mixins(VInput, Rippleable, Comparable).extend({
32
33
  };
33
34
  },
34
35
 
35
- created() {
36
- this.$_emitChangeEvent = true;
37
- },
38
-
39
36
  computed: {
40
37
  computedColor() {
41
38
  if (!this.isActive) return undefined;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/mixins/selectable/index.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,MAAP,MAAmB,yBAAnB,C,CAEA;;AACA,OAAO,UAAP,MAAuB,eAAvB;AACA,OAAO,UAAP,MAAuB,eAAvB,C,CAEA;;AACA,OAAO,MAAP,MAAmB,mBAAnB;AACA,SAAS,CAAT,QAAkB,KAAlB;AAEA,OAAM,SAAU,OAAV,CAAmB,CAAnB,EAA2B;AAC/B,EAAA,CAAC,CAAC,cAAF;AACD;AAED;;AACA,eAAe,MAAM,CACnB,MADmB,EAEnB,UAFmB,EAGnB,UAHmB,CAAN,CAIb,MAJa,CAIN;AACP,EAAA,IAAI,EAAE,YADC;AAGP,EAAA,KAAK,EAAE;AACL,IAAA,EAAE,EAAE,MADC;AAEL,IAAA,KAAK,EAAE,IAFF;AAGL,IAAA,UAAU,EAAE,IAHP;AAIL,IAAA,SAAS,EAAE,IAJN;AAKL,I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KAAhB;AACD,KAnEM;;AAoEP,IAAA,OAAO,CAAE,CAAF,EAAe;AACpB,WAAK,SAAL,GAAiB,IAAjB;AACA,WAAK,KAAL,CAAW,OAAX,EAAoB,CAApB;AACD,KAvEM;;AAwEP,IAAA,MAAM,CAAE,CAAF,EAAe;AACnB,WAAK,SAAL,GAAiB,KAAjB;AACA,WAAK,KAAL,CAAW,MAAX,EAAmB,CAAnB;AACD,KA3EM;;AA4EP;AACA,IAAA,SAAS,CAAE,CAAF,EAAU,CAAI;;AA7EhB;AAvEF,CAJM,CAAf","sourcesContent":["// Components\nimport VInput from '../../components/VInput'\n\n// Mixins\nimport Rippleable from '../rippleable'\nimport Comparable from '../comparable'\n\n// Utilities\nimport mixins from '../../util/mixins'\nimport { h } from 'vue'\n\nexport function prevent (e: Event) {\n e.preventDefault()\n}\n\n/* @vue/component */\nexport default mixins(\n VInput,\n Rippleable,\n Comparable\n).extend({\n name: 'selectable',\n\n props: {\n id: String,\n value: null as any,\n falseValue: null as any,\n trueValue: null as any,\n multiple: {\n type: Boolean,\n default: null\n },\n label: String\n },\n\n data () {\n return {\n hasColor: this.modelValue,\n lazyValue: this.modelValue\n }\n },\n\n created () {\n this.$_emitChangeEvent = true\n },\n\n computed: {\n computedColor (): string | undefined {\n if (!this.isActive) return undefined\n if (this.color) return this.color\n if (this.isDark && !this.appIsDark) return 'white'\n return 'primary'\n },\n isMultiple (): boolean {\n return this.multiple === true || (this.multiple === null && Array.isArray(this.internalValue))\n },\n isActive (): boolean {\n const value = this.value\n const input = this.internalValue\n\n if (this.isMultiple) {\n if (!Array.isArray(input)) return false\n\n return input.some(item => this.valueComparator(item, value))\n }\n\n if (this.trueValue === undefined || this.falseValue === undefined) {\n return value\n ? this.valueComparator(value, input)\n : Boolean(input)\n }\n\n return this.valueComparator(input, this.trueValue)\n },\n isDirty (): boolean {\n return this.isActive\n },\n rippleState (): string | undefined {\n return !this.isDisabled && !this.validationState\n ? undefined\n : this.validationState\n }\n },\n\n watch: {\n modelValue (val) {\n this.lazyValue = val\n this.hasColor = val\n }\n },\n\n methods: {\n genLabel () {\n const label = VInput.methods.genLabel.call(this)\n\n if (!label) return label\n\n // Label shouldn't cause the input to focus\n label!.onClick = this.onClick\n\n return label\n },\n genInput (type: string, attrs: object) {\n // Allow components to override aria-checked by providing it in attrs\n const defaultAttrs = {\n 'aria-checked': this.isActive.toString(),\n disabled: this.isDisabled,\n id: this.computedId,\n role: type,\n type\n }\n\n return h('input', {\n ...Object.assign(defaultAttrs, attrs),\n value: this.value,\n checked: this.isActive,\n onBlur: this.onBlur,\n onChange: this.onChange,\n onFocus: this.onFocus,\n onKeydown: this.onKeydown,\n onClick: prevent,\n ref: 'input'\n })\n },\n onClick (e: Event) {\n e.preventDefault()\n this.onChange()\n this.$emit('click', e)\n },\n onChange () {\n if (!this.isInteractive) return\n\n const value = this.value\n let input = this.internalValue\n\n if (this.isMultiple) {\n if (!Array.isArray(input)) {\n input = []\n }\n\n const length = input.length\n\n input = input.filter((item: any) => !this.valueComparator(item, value))\n\n if (input.length === length) {\n input.push(value)\n }\n } else if (this.trueValue !== undefined && this.falseValue !== undefined) {\n input = this.valueComparator(input, this.trueValue) ? this.falseValue : this.trueValue\n } else if (value) {\n input = this.valueComparator(input, value) ? null : value\n } else {\n input = !input\n }\n\n this.validate(true, input)\n this.internalValue = input\n this.hasColor = input\n },\n onFocus (e: FocusEvent) {\n this.isFocused = true\n this.$emit('focus', e)\n },\n onBlur (e: FocusEvent) {\n this.isFocused = false\n this.$emit('blur', e)\n },\n /** @abstract */\n onKeydown (e: Event) {}\n }\n})\n"],"sourceRoot":"","file":"index.js"}
1
+ {"version":3,"sources":["../../../src/mixins/selectable/index.ts"],"names":[],"mappings":"AAAA;AACA,OAAO,MAAP,MAAmB,yBAAnB,C,CAEA;;AACA,OAAO,UAAP,MAAuB,eAAvB;AACA,OAAO,UAAP,MAAuB,eAAvB,C,CAEA;;AACA,OAAO,MAAP,MAAmB,mBAAnB;AACA,SAAS,CA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SAAjC,IAA8C,KAAK,UAAnD,GAAgE,KAAK,SAA7E;AACD,OAFM,MAEA,IAAI,KAAJ,EAAW;AAChB,QAAA,KAAK,GAAG,KAAK,eAAL,CAAqB,KAArB,EAA4B,KAA5B,IAAqC,IAArC,GAA4C,KAApD;AACD,OAFM,MAEA;AACL,QAAA,KAAK,GAAG,CAAC,KAAT;AACD;;AAED,WAAK,QAAL,CAAc,IAAd,EAAoB,KAApB;AACA,WAAK,aAAL,GAAqB,KAArB;AACA,WAAK,QAAL,GAAgB,KAAhB;AACD,KAnEM;;AAoEP,IAAA,OAAO,CAAE,CAAF,EAAe;AACpB,WAAK,SAAL,GAAiB,IAAjB;AACA,WAAK,KAAL,CAAW,OAAX,EAAoB,CAApB;AACD,KAvEM;;AAwEP,IAAA,MAAM,CAAE,CAAF,EAAe;AACnB,WAAK,SAAL,GAAiB,KAAjB;AACA,WAAK,KAAL,CAAW,MAAX,EAAmB,CAAnB;AACD,KA3EM;;AA4EP;AACA,IAAA,SAAS,CAAE,CAAF,EAAU,CAAI;;AA7EhB;AArEF,CAJM,CAAf","sourcesContent":["// Components\nimport VInput from '../../components/VInput'\n\n// Mixins\nimport Rippleable from '../rippleable'\nimport Comparable from '../comparable'\n\n// Utilities\nimport mixins from '../../util/mixins'\nimport { h } from 'vue'\n\nexport function prevent (e: Event) {\n e.preventDefault()\n}\n\n/* @vue/component */\nexport default mixins(\n VInput,\n Rippleable,\n Comparable\n).extend({\n name: 'selectable',\n\n $_emitChangeEvent: true,\n\n props: {\n id: String,\n value: null as any,\n falseValue: null as any,\n trueValue: null as any,\n multiple: {\n type: Boolean,\n default: null\n },\n label: String\n },\n\n data () {\n return {\n hasColor: this.modelValue,\n lazyValue: this.modelValue\n }\n },\n\n computed: {\n computedColor (): string | undefined {\n if (!this.isActive) return undefined\n if (this.color) return this.color\n if (this.isDark && !this.appIsDark) return 'white'\n return 'primary'\n },\n isMultiple (): boolean {\n return this.multiple === true || (this.multiple === null && Array.isArray(this.internalValue))\n },\n isActive (): boolean {\n const value = this.value\n const input = this.internalValue\n\n if (this.isMultiple) {\n if (!Array.isArray(input)) return false\n\n return input.some(item => this.valueComparator(item, value))\n }\n\n if (this.trueValue === undefined || this.falseValue === undefined) {\n return value\n ? this.valueComparator(value, input)\n : Boolean(input)\n }\n\n return this.valueComparator(input, this.trueValue)\n },\n isDirty (): boolean {\n return this.isActive\n },\n rippleState (): string | undefined {\n return !this.isDisabled && !this.validationState\n ? undefined\n : this.validationState\n }\n },\n\n watch: {\n modelValue (val) {\n this.lazyValue = val\n this.hasColor = val\n }\n },\n\n methods: {\n genLabel () {\n const label = VInput.methods.genLabel.call(this)\n\n if (!label) return label\n\n // Label shouldn't cause the input to focus\n label!.onClick = this.onClick\n\n return label\n },\n genInput (type: string, attrs: object) {\n // Allow components to override aria-checked by providing it in attrs\n const defaultAttrs = {\n 'aria-checked': this.isActive.toString(),\n disabled: this.isDisabled,\n id: this.computedId,\n role: type,\n type\n }\n\n return h('input', {\n ...Object.assign(defaultAttrs, attrs),\n value: this.value,\n checked: this.isActive,\n onBlur: this.onBlur,\n onChange: this.onChange,\n onFocus: this.onFocus,\n onKeydown: this.onKeydown,\n onClick: prevent,\n ref: 'input'\n })\n },\n onClick (e: Event) {\n e.preventDefault()\n this.onChange()\n this.$emit('click', e)\n },\n onChange () {\n if (!this.isInteractive) return\n\n const value = this.value\n let input = this.internalValue\n\n if (this.isMultiple) {\n if (!Array.isArray(input)) {\n input = []\n }\n\n const length = input.length\n\n input = input.filter((item: any) => !this.valueComparator(item, value))\n\n if (input.length === length) {\n input.push(value)\n }\n } else if (this.trueValue !== undefined && this.falseValue !== undefined) {\n input = this.valueComparator(input, this.trueValue) ? this.falseValue : this.trueValue\n } else if (value) {\n input = this.valueComparator(input, value) ? null : value\n } else {\n input = !input\n }\n\n this.validate(true, input)\n this.internalValue = input\n this.hasColor = input\n },\n onFocus (e: FocusEvent) {\n this.isFocused = true\n this.$emit('focus', e)\n },\n onBlur (e: FocusEvent) {\n this.isFocused = false\n this.$emit('blur', e)\n },\n /** @abstract */\n onKeydown (e: Event) {}\n }\n})\n"],"sourceRoot":"","file":"index.js"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dimailn/vuetify",
3
3
  "description": "Vue Material Component Framework",
4
- "version": "2.7.2-alpha44",
4
+ "version": "2.7.2-alpha45",
5
5
  "author": {
6
6
  "name": "John Leider",
7
7
  "email": "john@vuetifyjs.com"
@@ -30,6 +30,20 @@ describe('VCheckbox.ts', () => { // eslint-disable-line max-statements
30
30
  expect(wrapper.emitted('update:modelValue')![0]).toEqual([true])
31
31
  })
32
32
 
33
+ it('should emit change event when clicked', async () => {
34
+ const wrapper = mountFunction({
35
+ props: {
36
+ modelValue: false
37
+ } as any
38
+ })
39
+
40
+ const input = wrapper.find('input')
41
+
42
+ await input.trigger('click')
43
+ expect(wrapper.emitted('change')).toHaveLength(1)
44
+ expect(wrapper.emitted('change')![0]).toEqual([true])
45
+ })
46
+
33
47
  it('should return a value when toggled on with a specified value', async () => {
34
48
  const wrapper = mountFunction({
35
49
  props: {
@@ -10,7 +10,7 @@ exports[`VCheckbox.ts should apply classes to root element 1`] = `
10
10
  >
11
11
  </i>
12
12
  <input aria-checked="true"
13
- id="input-134"
13
+ id="input-140"
14
14
  role="checkbox"
15
15
  type="checkbox"
16
16
  checked
@@ -30,7 +30,7 @@ exports[`VCheckbox.ts should apply classes to root element 1`] = `
30
30
  exports[`VCheckbox.ts should be disabled 1`] = `
31
31
  <input aria-checked="false"
32
32
  disabled
33
- id="input-122"
33
+ id="input-128"
34
34
  role="checkbox"
35
35
  type="checkbox"
36
36
  >
@@ -46,7 +46,7 @@ exports[`VCheckbox.ts should be render colored checkbox 1`] = `
46
46
  >
47
47
  </i>
48
48
  <input aria-checked="false"
49
- id="input-128"
49
+ id="input-134"
50
50
  role="checkbox"
51
51
  type="checkbox"
52
52
  >
@@ -72,7 +72,7 @@ exports[`VCheckbox.ts should render themed component 1`] = `
72
72
  >
73
73
  </i>
74
74
  <input aria-checked="false"
75
- id="input-116"
75
+ id="input-122"
76
76
  role="checkbox"
77
77
  type="checkbox"
78
78
  >
@@ -98,7 +98,7 @@ exports[`VCheckbox.ts should use custom icons 1`] = `
98
98
  >
99
99
  </i>
100
100
  <input aria-checked="mixed"
101
- id="input-110"
101
+ id="input-116"
102
102
  role="checkbox"
103
103
  type="checkbox"
104
104
  value="fizz"
@@ -125,7 +125,7 @@ exports[`VCheckbox.ts should use custom icons 2`] = `
125
125
  >
126
126
  </i>
127
127
  <input aria-checked="mixed"
128
- id="input-110"
128
+ id="input-116"
129
129
  role="checkbox"
130
130
  type="checkbox"
131
131
  value="fizz"
@@ -152,7 +152,7 @@ exports[`VCheckbox.ts should use custom icons 3`] = `
152
152
  >
153
153
  </i>
154
154
  <input aria-checked="mixed"
155
- id="input-110"
155
+ id="input-116"
156
156
  role="checkbox"
157
157
  type="checkbox"
158
158
  value="fizz"
@@ -113,7 +113,7 @@ export default baseMixins.extend({
113
113
  this.lazyValue = val
114
114
  this.$emit(this.$_modelEvent, val)
115
115
 
116
- if ('$_emitChangeEvent' in this) {
116
+ if (this.$options.$_emitChangeEvent) {
117
117
  this.$emit('change', val)
118
118
  }
119
119
  }
@@ -231,4 +231,21 @@ describe('VInput.ts', () => {
231
231
  expect(wrapper.text()).toContain('validation-error')
232
232
  expect(wrapper.text()).toContain('-SLOT_OK')
233
233
  })
234
+
235
+ it('should emit change only when $_emitChangeEvent is enabled in options', async () => {
236
+ const wrapper = mountFunction()
237
+
238
+ wrapper.vm.internalValue = 'no-change'
239
+ await nextTick()
240
+
241
+ expect(wrapper.emitted('change')).toBeFalsy()
242
+
243
+ ;(wrapper.vm.$options as Record<string, any>).$_emitChangeEvent = true
244
+
245
+ wrapper.vm.internalValue = 'with-change'
246
+ await nextTick()
247
+
248
+ expect(wrapper.emitted('change')).toHaveLength(1)
249
+ expect(wrapper.emitted('change')![0]).toEqual(['with-change'])
250
+ })
234
251
  })
@@ -102,13 +102,8 @@ describe('VSelect.ts', () => {
102
102
 
103
103
  await wrapper.vm.$nextTick()
104
104
 
105
- // Проверяем, что событие change эмитится или не эмитится (в зависимости от реализации)
106
- if (wrapper.emitted('change')) {
107
- expect(wrapper.emitted('change')).toHaveLength(1)
108
- } else {
109
- // Если событие не эмитится, это тоже может быть корректным поведением
110
- expect(wrapper.emitted('change')).toBeFalsy()
111
- }
105
+ expect(wrapper.emitted('change')).toHaveLength(1)
106
+ expect(wrapper.emitted('change')![0]).toEqual([null])
112
107
  })
113
108
 
114
109
  it('should not call change when model updated externally', async () => {
@@ -120,14 +115,46 @@ describe('VSelect.ts', () => {
120
115
 
121
116
  wrapper.vm.setValue('foo')
122
117
 
123
- // Проверяем, что событие change эмитится или не эмитится (в зависимости от реализации)
124
- if (wrapper.emitted('change')) {
125
- expect(wrapper.emitted('change')).toHaveLength(1)
126
- expect(wrapper.emitted('change')[0]).toEqual(['foo'])
127
- } else {
128
- // Если событие не эмитится, это тоже может быть корректным поведением
129
- expect(wrapper.emitted('change')).toBeFalsy()
130
- }
118
+ expect(wrapper.emitted('change')).toHaveLength(1)
119
+ expect(wrapper.emitted('change')![0]).toEqual(['foo'])
120
+ })
121
+
122
+ it('should not emit duplicate change after blur when value changed internally', async () => {
123
+ const wrapper = mountFunction()
124
+
125
+ wrapper.vm.setValue('foo')
126
+ await wrapper.vm.$nextTick()
127
+
128
+ expect(wrapper.emitted('change')).toHaveLength(1)
129
+ expect(wrapper.emitted('change')![0]).toEqual(['foo'])
130
+
131
+ wrapper.vm.blur()
132
+ await wrapper.vm.$nextTick()
133
+
134
+ expect(wrapper.emitted('change')).toHaveLength(1)
135
+ })
136
+
137
+ it('should not emit duplicate change after blur when cleared', async () => {
138
+ const wrapper = mountFunction({
139
+ props: {
140
+ clearable: true,
141
+ items: ['foo'],
142
+ modelValue: 'foo'
143
+ }
144
+ })
145
+
146
+ const icon = wrapper.find('.v-input__icon > .v-icon')
147
+
148
+ icon.trigger('click')
149
+ await wrapper.vm.$nextTick()
150
+
151
+ expect(wrapper.emitted('change')).toHaveLength(1)
152
+ expect(wrapper.emitted('change')![0]).toEqual([null])
153
+
154
+ wrapper.vm.blur()
155
+ await wrapper.vm.$nextTick()
156
+
157
+ expect(wrapper.emitted('change')).toHaveLength(1)
131
158
  })
132
159
 
133
160
  // https://github.com/vuetifyjs/vuetify/issues/4713
@@ -56,6 +56,20 @@ describe('VSwitch.ts', () => {
56
56
  expect(wrapper.emitted('update:modelValue')![1]).toEqual([false])
57
57
  })
58
58
 
59
+ it('should emit change event when input is clicked', async () => {
60
+ const wrapper = mountFunction({
61
+ props: {
62
+ modelValue: false
63
+ }
64
+ })
65
+
66
+ const input = wrapper.find('input')
67
+
68
+ await input.trigger('click')
69
+ expect(wrapper.emitted('change')).toHaveLength(1)
70
+ expect(wrapper.emitted('change')![0]).toEqual([true])
71
+ })
72
+
59
73
  it('should emit change event on key events', async () => {
60
74
  const wrapper = mountFunction({
61
75
  props: {
@@ -6,7 +6,7 @@ exports[`VSwitch.ts should render element with loader and match the snapshot 1`]
6
6
  <div class="v-input__slot">
7
7
  <div class="v-input--selection-controls__input">
8
8
  <input aria-checked="false"
9
- id="input-29"
9
+ id="input-36"
10
10
  role="switch"
11
11
  type="checkbox"
12
12
  aria-disabled="false"
@@ -145,6 +145,10 @@ export default baseMixins.extend({
145
145
  set (val: any) {
146
146
  this.lazyValue = val
147
147
  this.$emit('update:modelValue', this.lazyValue)
148
+
149
+ if (this.$options.$_emitChangeEvent) {
150
+ this.$emit('change', this.lazyValue)
151
+ }
148
152
  }
149
153
  },
150
154
  isDirty (): boolean {
@@ -21,6 +21,8 @@ export default mixins(
21
21
  ).extend({
22
22
  name: 'selectable',
23
23
 
24
+ $_emitChangeEvent: true,
25
+
24
26
  props: {
25
27
  id: String,
26
28
  value: null as any,
@@ -40,10 +42,6 @@ export default mixins(
40
42
  }
41
43
  },
42
44
 
43
- created () {
44
- this.$_emitChangeEvent = true
45
- },
46
-
47
45
  computed: {
48
46
  computedColor (): string | undefined {
49
47
  if (!this.isActive) return undefined