@dimailn/vuetify 2.7.2-alpha28 → 2.7.2-alpha29

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.
Files changed (255) hide show
  1. package/dist/vuetify.js +1416 -304
  2. package/dist/vuetify.js.map +1 -1
  3. package/dist/vuetify.min.css +1 -1
  4. package/dist/vuetify.min.js +2 -2
  5. package/es5/components/VAlert/VAlert.js +38 -8
  6. package/es5/components/VAlert/VAlert.js.map +1 -1
  7. package/es5/components/VAutocomplete/VAutocomplete.js +1 -0
  8. package/es5/components/VAutocomplete/VAutocomplete.js.map +1 -1
  9. package/es5/components/VBadge/VBadge.js +28 -0
  10. package/es5/components/VBadge/VBadge.js.map +1 -1
  11. package/es5/components/VBanner/VBanner.js +34 -6
  12. package/es5/components/VBanner/VBanner.js.map +1 -1
  13. package/es5/components/VBottomNavigation/VBottomNavigation.js +25 -0
  14. package/es5/components/VBottomNavigation/VBottomNavigation.js.map +1 -1
  15. package/es5/components/VCarousel/VCarousel.js +28 -3
  16. package/es5/components/VCarousel/VCarousel.js.map +1 -1
  17. package/es5/components/VCheckbox/VSimpleCheckbox.js +30 -2
  18. package/es5/components/VCheckbox/VSimpleCheckbox.js.map +1 -1
  19. package/es5/components/VColorPicker/VColorPicker.js +30 -2
  20. package/es5/components/VColorPicker/VColorPicker.js.map +1 -1
  21. package/es5/components/VCombobox/VCombobox.js +1 -0
  22. package/es5/components/VCombobox/VCombobox.js.map +1 -1
  23. package/es5/components/VDataIterator/VDataFooter.js +16 -7
  24. package/es5/components/VDataIterator/VDataFooter.js.map +1 -1
  25. package/es5/components/VDataIterator/VDataIterator.js +42 -47
  26. package/es5/components/VDataIterator/VDataIterator.js.map +1 -1
  27. package/es5/components/VDataTable/RowGroup.js +46 -15
  28. package/es5/components/VDataTable/RowGroup.js.map +1 -1
  29. package/es5/components/VDataTable/VDataTable.js +10 -18
  30. package/es5/components/VDataTable/VDataTable.js.map +1 -1
  31. package/es5/components/VDataTable/VDataTableHeader.js.map +1 -1
  32. package/es5/components/VDataTable/VDataTableHeaderDesktop.js +3 -0
  33. package/es5/components/VDataTable/VDataTableHeaderDesktop.js.map +1 -1
  34. package/es5/components/VDataTable/VDataTableHeaderMobile.js +28 -37
  35. package/es5/components/VDataTable/VDataTableHeaderMobile.js.map +1 -1
  36. package/es5/components/VDataTable/VEditDialog.js +3 -4
  37. package/es5/components/VDataTable/VEditDialog.js.map +1 -1
  38. package/es5/components/VDataTable/VSimpleTable.js +1 -1
  39. package/es5/components/VDataTable/VSimpleTable.js.map +1 -1
  40. package/es5/components/VDataTable/VVirtualTable.js +5 -5
  41. package/es5/components/VDataTable/VVirtualTable.js.map +1 -1
  42. package/es5/components/VDataTable/mixins/header.js +1 -1
  43. package/es5/components/VDataTable/mixins/header.js.map +1 -1
  44. package/es5/components/VDatePicker/VDatePicker.js +21 -9
  45. package/es5/components/VDatePicker/VDatePicker.js.map +1 -1
  46. package/es5/components/VDatePicker/VDatePickerHeader.js +24 -8
  47. package/es5/components/VDatePicker/VDatePickerHeader.js.map +1 -1
  48. package/es5/components/VDatePicker/VDatePickerTitle.js +33 -8
  49. package/es5/components/VDatePicker/VDatePickerTitle.js.map +1 -1
  50. package/es5/components/VDatePicker/VDatePickerYears.js +38 -13
  51. package/es5/components/VDatePicker/VDatePickerYears.js.map +1 -1
  52. package/es5/components/VDatePicker/mixins/date-picker-table.js +33 -17
  53. package/es5/components/VDatePicker/mixins/date-picker-table.js.map +1 -1
  54. package/es5/components/VInput/VInput.js +36 -8
  55. package/es5/components/VInput/VInput.js.map +1 -1
  56. package/es5/components/VList/VListGroup.js +47 -21
  57. package/es5/components/VList/VListGroup.js.map +1 -1
  58. package/es5/components/VList/VListItem.js +29 -4
  59. package/es5/components/VList/VListItem.js.map +1 -1
  60. package/es5/components/VMenu/VMenu.js +55 -30
  61. package/es5/components/VMenu/VMenu.js.map +1 -1
  62. package/es5/components/VMessages/VMessages.js +30 -7
  63. package/es5/components/VMessages/VMessages.js.map +1 -1
  64. package/es5/components/VNavigationDrawer/VNavigationDrawer.js +36 -9
  65. package/es5/components/VNavigationDrawer/VNavigationDrawer.js.map +1 -1
  66. package/es5/components/VOverlay/VOverlay.js +28 -0
  67. package/es5/components/VOverlay/VOverlay.js.map +1 -1
  68. package/es5/components/VPagination/VPagination.js +30 -6
  69. package/es5/components/VPagination/VPagination.js.map +1 -1
  70. package/es5/components/VProgressLinear/VProgressLinear.js +28 -0
  71. package/es5/components/VProgressLinear/VProgressLinear.js.map +1 -1
  72. package/es5/components/VRadioGroup/VRadioGroup.js +28 -0
  73. package/es5/components/VRadioGroup/VRadioGroup.js.map +1 -1
  74. package/es5/components/VRating/VRating.js +45 -17
  75. package/es5/components/VRating/VRating.js.map +1 -1
  76. package/es5/components/VSelect/VSelect.js +112 -84
  77. package/es5/components/VSelect/VSelect.js.map +1 -1
  78. package/es5/components/VSelect/VSelectList.js +58 -17
  79. package/es5/components/VSelect/VSelectList.js.map +1 -1
  80. package/es5/components/VSlider/VSlider.js +42 -16
  81. package/es5/components/VSlider/VSlider.js.map +1 -1
  82. package/es5/components/VSpeedDial/VSpeedDial.js +10 -8
  83. package/es5/components/VSpeedDial/VSpeedDial.js.map +1 -1
  84. package/es5/components/VTabs/VTabs.js +45 -17
  85. package/es5/components/VTabs/VTabs.js.map +1 -1
  86. package/es5/framework.js +1 -1
  87. package/es5/mixins/validatable/index.js +24 -0
  88. package/es5/mixins/validatable/index.js.map +1 -1
  89. package/es5/util/console.js +49 -18
  90. package/es5/util/console.js.map +1 -1
  91. package/es5/util/helpers.js +5 -1
  92. package/es5/util/helpers.js.map +1 -1
  93. package/lib/components/VAlert/VAlert.js +12 -6
  94. package/lib/components/VAlert/VAlert.js.map +1 -1
  95. package/lib/components/VAutocomplete/VAutocomplete.js +1 -0
  96. package/lib/components/VAutocomplete/VAutocomplete.js.map +1 -1
  97. package/lib/components/VBadge/VBadge.js +11 -0
  98. package/lib/components/VBadge/VBadge.js.map +1 -1
  99. package/lib/components/VBanner/VBanner.js +11 -0
  100. package/lib/components/VBanner/VBanner.js.map +1 -1
  101. package/lib/components/VBottomNavigation/VBottomNavigation.js +7 -0
  102. package/lib/components/VBottomNavigation/VBottomNavigation.js.map +1 -1
  103. package/lib/components/VCarousel/VCarousel.js +7 -0
  104. package/lib/components/VCarousel/VCarousel.js.map +1 -1
  105. package/lib/components/VCheckbox/VSimpleCheckbox.js +11 -0
  106. package/lib/components/VCheckbox/VSimpleCheckbox.js.map +1 -1
  107. package/lib/components/VColorPicker/VColorPicker.js +12 -1
  108. package/lib/components/VColorPicker/VColorPicker.js.map +1 -1
  109. package/lib/components/VCombobox/VCombobox.js +1 -0
  110. package/lib/components/VCombobox/VCombobox.js.map +1 -1
  111. package/lib/components/VDataIterator/VDataFooter.js +14 -7
  112. package/lib/components/VDataIterator/VDataFooter.js.map +1 -1
  113. package/lib/components/VDataIterator/VDataIterator.js +26 -31
  114. package/lib/components/VDataIterator/VDataIterator.js.map +1 -1
  115. package/lib/components/VDataTable/RowGroup.js +30 -14
  116. package/lib/components/VDataTable/RowGroup.js.map +1 -1
  117. package/lib/components/VDataTable/VDataTable.js +8 -15
  118. package/lib/components/VDataTable/VDataTable.js.map +1 -1
  119. package/lib/components/VDataTable/VDataTableHeader.js +1 -1
  120. package/lib/components/VDataTable/VDataTableHeader.js.map +1 -1
  121. package/lib/components/VDataTable/VDataTableHeaderDesktop.js +3 -0
  122. package/lib/components/VDataTable/VDataTableHeaderDesktop.js.map +1 -1
  123. package/lib/components/VDataTable/VDataTableHeaderMobile.js +17 -25
  124. package/lib/components/VDataTable/VDataTableHeaderMobile.js.map +1 -1
  125. package/lib/components/VDataTable/VEditDialog.js +3 -4
  126. package/lib/components/VDataTable/VEditDialog.js.map +1 -1
  127. package/lib/components/VDataTable/VSimpleTable.js +1 -1
  128. package/lib/components/VDataTable/VSimpleTable.js.map +1 -1
  129. package/lib/components/VDataTable/VVirtualTable.js +1 -2
  130. package/lib/components/VDataTable/VVirtualTable.js.map +1 -1
  131. package/lib/components/VDataTable/mixins/header.js +1 -1
  132. package/lib/components/VDataTable/mixins/header.js.map +1 -1
  133. package/lib/components/VDatePicker/VDatePicker.js +7 -1
  134. package/lib/components/VDatePicker/VDatePicker.js.map +1 -1
  135. package/lib/components/VDatePicker/VDatePickerHeader.js +12 -1
  136. package/lib/components/VDatePicker/VDatePickerHeader.js.map +1 -1
  137. package/lib/components/VDatePicker/VDatePickerTitle.js +11 -0
  138. package/lib/components/VDatePicker/VDatePickerTitle.js.map +1 -1
  139. package/lib/components/VDatePicker/VDatePickerYears.js +11 -1
  140. package/lib/components/VDatePicker/VDatePickerYears.js.map +1 -1
  141. package/lib/components/VDatePicker/mixins/date-picker-table.js +12 -1
  142. package/lib/components/VDatePicker/mixins/date-picker-table.js.map +1 -1
  143. package/lib/components/VInput/VInput.js +13 -3
  144. package/lib/components/VInput/VInput.js.map +1 -1
  145. package/lib/components/VList/VListGroup.js +16 -8
  146. package/lib/components/VList/VListGroup.js.map +1 -1
  147. package/lib/components/VList/VListItem.js +8 -1
  148. package/lib/components/VList/VListItem.js.map +1 -1
  149. package/lib/components/VMenu/VMenu.js +14 -3
  150. package/lib/components/VMenu/VMenu.js.map +1 -1
  151. package/lib/components/VMessages/VMessages.js +13 -2
  152. package/lib/components/VMessages/VMessages.js.map +1 -1
  153. package/lib/components/VNavigationDrawer/VNavigationDrawer.js +11 -2
  154. package/lib/components/VNavigationDrawer/VNavigationDrawer.js.map +1 -1
  155. package/lib/components/VOverlay/VOverlay.js +11 -0
  156. package/lib/components/VOverlay/VOverlay.js.map +1 -1
  157. package/lib/components/VPagination/VPagination.js +11 -0
  158. package/lib/components/VPagination/VPagination.js.map +1 -1
  159. package/lib/components/VProgressLinear/VProgressLinear.js +11 -0
  160. package/lib/components/VProgressLinear/VProgressLinear.js.map +1 -1
  161. package/lib/components/VRadioGroup/VRadioGroup.js +11 -0
  162. package/lib/components/VRadioGroup/VRadioGroup.js.map +1 -1
  163. package/lib/components/VRating/VRating.js +11 -0
  164. package/lib/components/VRating/VRating.js.map +1 -1
  165. package/lib/components/VSelect/VSelect.js +52 -36
  166. package/lib/components/VSelect/VSelect.js.map +1 -1
  167. package/lib/components/VSelect/VSelectList.js +21 -3
  168. package/lib/components/VSelect/VSelectList.js.map +1 -1
  169. package/lib/components/VSlider/VSlider.js +11 -1
  170. package/lib/components/VSlider/VSlider.js.map +1 -1
  171. package/lib/components/VSpeedDial/VSpeedDial.js +7 -7
  172. package/lib/components/VSpeedDial/VSpeedDial.js.map +1 -1
  173. package/lib/components/VTabs/VTabs.js +11 -0
  174. package/lib/components/VTabs/VTabs.js.map +1 -1
  175. package/lib/framework.js +1 -1
  176. package/lib/mixins/validatable/index.js +7 -1
  177. package/lib/mixins/validatable/index.js.map +1 -1
  178. package/lib/util/console.js +47 -17
  179. package/lib/util/console.js.map +1 -1
  180. package/lib/util/helpers.js +5 -1
  181. package/lib/util/helpers.js.map +1 -1
  182. package/package.json +1 -1
  183. package/src/components/VAlert/VAlert.ts +17 -7
  184. package/src/components/VAlert/__tests__/VAlert.spec.ts +78 -50
  185. package/src/components/VAlert/__tests__/__snapshots__/VAlert.spec.ts.snap +16 -18
  186. package/src/components/VAutocomplete/VAutocomplete.ts +22 -0
  187. package/src/components/VAutocomplete/__tests__/VAutocomplete.spec.ts +51 -53
  188. package/src/components/VAutocomplete/__tests__/VAutocomplete2.spec.ts +77 -48
  189. package/src/components/VAutocomplete/__tests__/VAutocomplete3.spec.ts +101 -39
  190. package/src/components/VBadge/VBadge.ts +13 -0
  191. package/src/components/VBanner/VBanner.ts +13 -0
  192. package/src/components/VBottomNavigation/VBottomNavigation.ts +10 -0
  193. package/src/components/VCarousel/VCarousel.ts +11 -0
  194. package/src/components/VCheckbox/VSimpleCheckbox.ts +13 -0
  195. package/src/components/VColorPicker/VColorPicker.ts +13 -0
  196. package/src/components/VCombobox/VCombobox.ts +23 -0
  197. package/src/components/VCombobox/__tests__/VCombobox-multiple.spec.ts +118 -110
  198. package/src/components/VCombobox/__tests__/VCombobox.spec.ts +119 -93
  199. package/src/components/VDataIterator/VDataFooter.ts +14 -9
  200. package/src/components/VDataIterator/VDataIterator.ts +46 -34
  201. package/src/components/VDataIterator/__tests__/VDataFooter.spec.ts +38 -39
  202. package/src/components/VDataIterator/__tests__/VDataIterator.spec.ts +90 -122
  203. package/src/components/VDataIterator/__tests__/__snapshots__/VDataFooter.spec.ts.snap +92 -82
  204. package/src/components/VDataIterator/__tests__/__snapshots__/VDataIterator.spec.ts.snap +79 -69
  205. package/src/components/VDataTable/RowGroup.ts +33 -16
  206. package/src/components/VDataTable/VDataTable.ts +8 -15
  207. package/src/components/VDataTable/VDataTableHeader.ts +2 -2
  208. package/src/components/VDataTable/VDataTableHeaderDesktop.ts +4 -0
  209. package/src/components/VDataTable/VDataTableHeaderMobile.ts +16 -25
  210. package/src/components/VDataTable/VEditDialog.ts +3 -3
  211. package/src/components/VDataTable/VSimpleTable.ts +2 -3
  212. package/src/components/VDataTable/VVirtualTable.ts +1 -2
  213. package/src/components/VDataTable/__tests__/VDataTable.spec.ts +18 -22
  214. package/src/components/VDataTable/__tests__/VDataTableHeader.spec.ts +39 -29
  215. package/src/components/VDataTable/__tests__/VEditDialog.spec.ts +7 -2
  216. package/src/components/VDataTable/__tests__/VSimpleTable.spec.ts +11 -16
  217. package/src/components/VDataTable/__tests__/__snapshots__/VDataTable.spec.ts.snap +2543 -2086
  218. package/src/components/VDataTable/__tests__/__snapshots__/VDataTableHeader.spec.ts.snap +115 -144
  219. package/src/components/VDataTable/__tests__/__snapshots__/VEditDialog.spec.ts.snap +4 -12
  220. package/src/components/VDataTable/__tests__/__snapshots__/VSimpleTable.spec.ts.snap +22 -18
  221. package/src/components/VDataTable/mixins/__tests__/__snapshots__/header.spec.ts.snap +9 -12
  222. package/src/components/VDataTable/mixins/__tests__/header.spec.ts +15 -15
  223. package/src/components/VDataTable/mixins/header.ts +1 -1
  224. package/src/components/VDatePicker/VDatePicker.ts +11 -1
  225. package/src/components/VDatePicker/VDatePickerHeader.ts +13 -0
  226. package/src/components/VDatePicker/VDatePickerTitle.ts +12 -0
  227. package/src/components/VDatePicker/VDatePickerYears.ts +13 -0
  228. package/src/components/VDatePicker/mixins/date-picker-table.ts +13 -0
  229. package/src/components/VInput/VInput.ts +18 -5
  230. package/src/components/VList/VListGroup.ts +22 -10
  231. package/src/components/VList/VListItem.ts +10 -1
  232. package/src/components/VMenu/VMenu.ts +21 -3
  233. package/src/components/VMenu/__tests__/VMenu.spec.ts +90 -69
  234. package/src/components/VMenu/__tests__/__snapshots__/VMenu.spec.ts.snap +3 -5
  235. package/src/components/VMessages/VMessages.ts +15 -4
  236. package/src/components/VMessages/__tests__/VMessages.spec.ts +43 -5
  237. package/src/components/VMessages/__tests__/__snapshots__/VMessages.spec.ts.snap +16 -25
  238. package/src/components/VNavigationDrawer/VNavigationDrawer.ts +21 -11
  239. package/src/components/VOverlay/VOverlay.ts +12 -0
  240. package/src/components/VPagination/VPagination.ts +23 -9
  241. package/src/components/VProgressLinear/VProgressLinear.ts +13 -0
  242. package/src/components/VRadioGroup/VRadioGroup.ts +14 -0
  243. package/src/components/VRating/VRating.ts +13 -0
  244. package/src/components/VSelect/VSelect.ts +60 -43
  245. package/src/components/VSelect/VSelectList.ts +29 -8
  246. package/src/components/VSlider/VSlider.ts +14 -1
  247. package/src/components/VSpeedDial/VSpeedDial.ts +7 -8
  248. package/src/components/VSpeedDial/__tests__/VSpeedDial.spec.ts +21 -13
  249. package/src/components/VSpeedDial/__tests__/__snapshots__/VSpeedDial.spec.ts.snap +6 -6
  250. package/src/components/VTabs/VTabs.ts +14 -0
  251. package/src/mixins/validatable/index.ts +11 -1
  252. package/src/util/__tests__/console.spec.ts +124 -11
  253. package/src/util/__tests__/helpers.spec.ts +59 -31
  254. package/src/util/console.ts +43 -24
  255. package/src/util/helpers.ts +8 -4
@@ -19,6 +19,7 @@ import Resize from '../../directives/resize'
19
19
  import { convertToUnit, getSlot } from '../../util/helpers'
20
20
  import { ExtractVue } from './../../util/mixins'
21
21
  import mixins from '../../util/mixins'
22
+ import { breaking } from '../../util/console'
22
23
 
23
24
  // Types
24
25
  import { VNode } from 'vue/types'
@@ -122,6 +123,19 @@ export default baseMixins.extend({
122
123
  },
123
124
  },
124
125
 
126
+ created () {
127
+ const breakingProps = [
128
+ ['value', 'modelValue'],
129
+ ['onChange', 'onUpdate:modelValue'],
130
+ ['onInput', 'onUpdate:modelValue'],
131
+ ]
132
+
133
+ /* istanbul ignore next */
134
+ breakingProps.forEach(([original, replacement]) => {
135
+ if (this.$attrs.hasOwnProperty(original)) breaking(original, replacement, this)
136
+ })
137
+ },
138
+
125
139
  watch: {
126
140
  alignWithTitle: 'callSlider',
127
141
  centered: 'callSlider',
@@ -5,7 +5,7 @@ import { inject as RegistrableInject } from '../registrable'
5
5
 
6
6
  // Utilities
7
7
  import { deepEqual } from '../../util/helpers'
8
- import { consoleError } from '../../util/console'
8
+ import { consoleError, breaking } from '../../util/console'
9
9
  import { defineComponent, PropType } from 'vue'
10
10
 
11
11
  // Types
@@ -222,6 +222,16 @@ export default defineComponent({
222
222
  },
223
223
 
224
224
  created () {
225
+ const breakingProps = [
226
+ ['value', 'modelValue'],
227
+ ['onInput', 'onUpdate:modelValue'],
228
+ ]
229
+
230
+ /* istanbul ignore next */
231
+ breakingProps.forEach(([original, replacement]) => {
232
+ if (this.$attrs.hasOwnProperty(original)) breaking(original, replacement, this)
233
+ })
234
+
225
235
  this.form && this.form.register(this)
226
236
  },
227
237
 
@@ -1,19 +1,132 @@
1
- import { consoleWarn, consoleError } from '../console'
1
+ import { consoleWarn, consoleError, consoleInfo, deprecate, breaking, removed } from '../console'
2
2
 
3
3
  describe('console', () => {
4
- it('should generate a warning', () => {
5
- consoleWarn('foo')
6
- expect('[Vuetify] foo').toHaveBeenTipped()
4
+ beforeEach(() => {
5
+ // Clear console mocks before each test
6
+ jest.clearAllMocks()
7
+ })
8
+
9
+ describe('consoleWarn', () => {
10
+ it('should generate a warning', () => {
11
+ consoleWarn('foo')
12
+ expect('[Vuetify] foo').toHaveBeenTipped()
13
+ })
14
+
15
+ it('should generate a warning with Vue 3 component', () => {
16
+ const vm = {
17
+ type: { name: 'Vue3Component' },
18
+ props: { color: 'primary', size: 'large' },
19
+ setupState: { isActive: true, count: 0 }
20
+ }
21
+ consoleWarn('Vue 3 warning', vm)
22
+ expect('[Vuetify] Vue 3 warning\n\n(found in <Vue3Component> (props: color, size, setup: isActive, count))').toHaveBeenTipped()
23
+ })
24
+
25
+ it('should not show duplicate warnings for same component instance', () => {
26
+ const vm = {
27
+ type: { name: 'TestComponent' },
28
+ props: {},
29
+ setupState: {}
30
+ }
31
+ consoleWarn('duplicate warning', vm)
32
+ consoleWarn('duplicate warning', vm) // Should not show again
33
+ expect('[Vuetify] duplicate warning\n\n(found in <TestComponent>)').toHaveBeenTipped()
34
+ })
35
+ })
36
+
37
+ describe('consoleError', () => {
38
+ it('should generate an error', () => {
39
+ consoleError('foo')
40
+ expect('[Vuetify] foo').toHaveBeenWarned()
41
+ })
42
+
43
+ it('should generate an error with Vue 3 component', () => {
44
+ const vm = {
45
+ type: { name: 'Vue3ErrorComponent' },
46
+ props: { error: true },
47
+ setupState: { hasError: true }
48
+ }
49
+ consoleError('Vue 3 error', vm)
50
+ expect('[Vuetify] Vue 3 error\n\n(found in <Vue3ErrorComponent> (props: error, setup: hasError))').toHaveBeenWarned()
51
+ })
52
+ })
53
+
54
+ describe('deprecate', () => {
55
+ it('should generate deprecation warning', () => {
56
+ deprecate('oldProp', 'newProp')
57
+ expect('[Vuetify] [UPGRADE] \'oldProp\' is deprecated, use \'newProp\' instead.').toHaveBeenTipped()
58
+ })
59
+
60
+ it('should generate deprecation warning with Vue 3 component', () => {
61
+ const vm = {
62
+ type: { name: 'DeprecatedComponent' },
63
+ props: {},
64
+ setupState: {}
65
+ }
66
+ deprecate('oldMethod', 'newMethod', vm)
67
+ expect('[Vuetify] [UPGRADE] \'oldMethod\' is deprecated, use \'newMethod\' instead.\n\n(found in <DeprecatedComponent>)').toHaveBeenTipped()
68
+ })
69
+ })
70
+
71
+ describe('breaking', () => {
72
+ it('should generate breaking change error', () => {
73
+ breaking('removedProp', 'replacementProp')
74
+ expect('[Vuetify] [BREAKING] \'removedProp\' has been removed, use \'replacementProp\' instead.').toHaveBeenWarned()
75
+ })
76
+
77
+ it('should generate breaking change error with Vue 3 component', () => {
78
+ const vm = {
79
+ type: { name: 'BreakingComponent' },
80
+ props: {},
81
+ setupState: {}
82
+ }
83
+ breaking('oldAPI', 'newAPI', vm)
84
+ expect('[Vuetify] [BREAKING] \'oldAPI\' has been removed, use \'newAPI\' instead.\n\n(found in <BreakingComponent>)').toHaveBeenWarned()
85
+ })
86
+ })
87
+
88
+ describe('removed', () => {
89
+ it('should generate removal warning', () => {
90
+ removed('unusedProp')
91
+ expect('[Vuetify] [REMOVED] \'unusedProp\' has been removed. You can safely omit it.').toHaveBeenTipped()
92
+ })
7
93
 
8
- consoleWarn('bar', { _isVue: true, $options: { name: 'baz' } })
9
- expect('[Vuetify] bar\n\n(found in <Baz>)').toHaveBeenTipped()
94
+ it('should generate removal warning with Vue 3 component', () => {
95
+ const vm = {
96
+ type: { name: 'RemovedComponent' },
97
+ props: {},
98
+ setupState: {}
99
+ }
100
+ removed('unusedMethod', vm)
101
+ expect('[Vuetify] [REMOVED] \'unusedMethod\' has been removed. You can safely omit it.\n\n(found in <RemovedComponent>)').toHaveBeenTipped()
102
+ })
10
103
  })
11
104
 
12
- it('should generate an error', () => {
13
- consoleError('foo')
14
- expect('[Vuetify] foo').toHaveBeenWarned()
105
+ describe('component name formatting', () => {
106
+ it('should handle anonymous Vue 3 components', () => {
107
+ const vm = {
108
+ type: {},
109
+ props: {},
110
+ setupState: {}
111
+ }
112
+ consoleWarn('anonymous test', vm)
113
+ expect('[Vuetify] anonymous test\n\n(found in <Anonymous>)').toHaveBeenTipped()
114
+ })
15
115
 
16
- consoleError('bar', { _isVue: true, $options: { name: 'baz' } })
17
- expect('[Vuetify] bar\n\n(found in <Baz>)').toHaveBeenWarned()
116
+ it('should handle Vue 3 root component', () => {
117
+ const vm = {
118
+ appContext: {
119
+ app: {
120
+ _instance: {
121
+ proxy: {}
122
+ }
123
+ }
124
+ }
125
+ }
126
+ // Mock the root check
127
+ vm.appContext.app._instance.proxy = vm
128
+ consoleWarn('root test', vm)
129
+ expect('[Vuetify] root test\n\n(found in <Root>)').toHaveBeenTipped()
130
+ })
18
131
  })
19
132
  })
@@ -12,6 +12,7 @@ import {
12
12
  normalizeClasses,
13
13
  } from '../helpers'
14
14
  import { mount } from '@vue/test-utils'
15
+ import { defineComponent, createApp, h } from 'vue'
15
16
 
16
17
  describe('createSimpleFunctional', () => {
17
18
  it('should render with a custom tag', () => {
@@ -22,7 +23,7 @@ describe('createSimpleFunctional', () => {
22
23
  it('should render with a user-defined tag', () => {
23
24
  const component = createSimpleFunctional('v-test', 'pre')
24
25
  const wrapper = mount(component, {
25
- propsData: { tag: 'h1' },
26
+ props: { tag: 'h1' },
26
27
  })
27
28
  expect(wrapper.html()).toMatchSnapshot()
28
29
  })
@@ -231,58 +232,85 @@ describe('helpers', () => {
231
232
 
232
233
  describe('getSlotType', () => {
233
234
  it('should detect old slots', () => {
234
- const vm = new Vue({
235
- components: {
236
- foo: { render: h => h('div') },
237
- },
235
+ const FooComponent = defineComponent({
236
+ render: () => h('div')
237
+ })
238
+
239
+ const TestComponent = defineComponent({
240
+ components: { foo: FooComponent },
238
241
  template: `<foo ref="foo"><template slot="bar">hello</template></foo>`,
239
- }).$mount()
242
+ })
240
243
 
241
- expect(getSlotType(vm.$refs.foo, 'bar')).toBe('normal')
244
+ const wrapper = mount(TestComponent)
245
+ const fooRef = wrapper.findComponent({ ref: 'foo' })
246
+
247
+ // В Vue 3 все слоты считаются scoped, даже старые
248
+ expect(getSlotType(fooRef.vm, 'bar')).toBe('scoped')
242
249
  })
243
250
 
244
251
  it('should detect old scoped slots', () => {
245
- const vm = new Vue({
246
- components: {
247
- foo: { render: h => h('div') },
248
- },
252
+ const FooComponent = defineComponent({
253
+ render: () => h('div')
254
+ })
255
+
256
+ const TestComponent = defineComponent({
257
+ components: { foo: FooComponent },
249
258
  template: `<foo ref="foo"><template slot="bar" slot-scope="data">hello</template></foo>`,
250
- }).$mount()
259
+ })
260
+
261
+ const wrapper = mount(TestComponent)
262
+ const fooRef = wrapper.findComponent({ ref: 'foo' })
251
263
 
252
- expect(getSlotType(vm.$refs.foo, 'bar')).toBe('scoped')
264
+ expect(getSlotType(fooRef.vm, 'bar')).toBe('scoped')
253
265
  })
254
266
 
255
267
  it('should detect bare v-slot', () => {
256
- const vm = new Vue({
257
- components: {
258
- foo: { render: h => h('div') },
259
- },
268
+ const FooComponent = defineComponent({
269
+ render: () => h('div')
270
+ })
271
+
272
+ const TestComponent = defineComponent({
273
+ components: { foo: FooComponent },
260
274
  template: `<foo ref="foo"><template #bar>hello</template></foo>`,
261
- }).$mount()
275
+ })
262
276
 
263
- expect(getSlotType(vm.$refs.foo, 'bar', true)).toBe('v-slot')
277
+ const wrapper = mount(TestComponent)
278
+ const fooRef = wrapper.findComponent({ ref: 'foo' })
279
+
280
+ expect(getSlotType(fooRef.vm, 'bar', true)).toBe('v-slot')
264
281
  })
265
282
 
266
283
  it('should detect bound v-slot', () => {
267
- const vm = new Vue({
268
- components: {
269
- foo: { render: h => h('div') },
270
- },
284
+ const FooComponent = defineComponent({
285
+ render: () => h('div')
286
+ })
287
+
288
+ const TestComponent = defineComponent({
289
+ components: { foo: FooComponent },
271
290
  template: `<foo ref="foo"><template #bar="data">hello</template></foo>`,
272
- }).$mount()
291
+ })
292
+
293
+ const wrapper = mount(TestComponent)
294
+ const fooRef = wrapper.findComponent({ ref: 'foo' })
273
295
 
274
- expect(getSlotType(vm.$refs.foo, 'bar', true)).toBe('scoped')
296
+ // В Vue 3 #bar="data" считается v-slot, а не scoped
297
+ expect(getSlotType(fooRef.vm, 'bar', true)).toBe('v-slot')
275
298
  })
276
299
 
277
300
  it('should count bare v-slot as scoped', () => {
278
- const vm = new Vue({
279
- components: {
280
- foo: { render: h => h('div') },
281
- },
301
+ const FooComponent = defineComponent({
302
+ render: () => h('div')
303
+ })
304
+
305
+ const TestComponent = defineComponent({
306
+ components: { foo: FooComponent },
282
307
  template: `<foo ref="foo"><template #bar>hello</template></foo>`,
283
- }).$mount()
308
+ })
309
+
310
+ const wrapper = mount(TestComponent)
311
+ const fooRef = wrapper.findComponent({ ref: 'foo' })
284
312
 
285
- expect(getSlotType(vm.$refs.foo, 'bar')).toBe('scoped')
313
+ expect(getSlotType(fooRef.vm, 'bar')).toBe('scoped')
286
314
  })
287
315
  })
288
316
 
@@ -13,7 +13,6 @@ function createMessage (message: string, vm?: any, parent?: any): string | void
13
13
  }
14
14
 
15
15
  if (vm) {
16
- // Only show each message once per instance
17
16
  vm.$_alreadyWarned = vm.$_alreadyWarned || []
18
17
  if (vm.$_alreadyWarned.includes(message)) return
19
18
  vm.$_alreadyWarned.push(message)
@@ -43,7 +42,7 @@ export function deprecate (original: string, replacement: string, vm?: any, pare
43
42
  consoleWarn(`[UPGRADE] '${original}' is deprecated, use '${replacement}' instead.`, vm, parent)
44
43
  }
45
44
  export function breaking (original: string, replacement: string, vm?: any, parent?: any) {
46
- consoleError(`[BREAKING] '${original}' has been removed, use '${replacement}' instead. For more information, see the upgrade guide https://github.com/vuetifyjs/vuetify/releases/tag/v2.0.0#user-content-upgrade-guide`, vm, parent)
45
+ consoleError(`[BREAKING] '${original}' has been removed, use '${replacement}' instead.`, vm, parent)
47
46
  }
48
47
  export function removed (original: string, vm?: any, parent?: any) {
49
48
  consoleWarn(`[REMOVED] '${original}' has been removed. You can safely omit it.`, vm, parent)
@@ -58,47 +57,67 @@ const classify = (str: string) => str
58
57
  .replace(classifyRE, c => c.toUpperCase())
59
58
  .replace(/[-_]/g, '')
60
59
 
61
- function formatComponentName (vm: any, includeFile?: boolean): string {
62
- if (vm.$root === vm) {
60
+ function formatComponentName (vm: any): string {
61
+ if (vm === vm?.appContext?.app?._instance?.proxy) {
63
62
  return '<Root>'
64
63
  }
65
- const options = typeof vm === 'function' && vm.cid != null
66
- ? vm.options
67
- : vm._isVue
68
- ? vm.$options || vm.constructor.options
69
- : vm || {}
70
- let name = options.name || options._componentTag
71
- const file = options.__file
72
- if (!name && file) {
73
- const match = file.match(/([^/\\]+)\.vue$/)
74
- name = match && match[1]
64
+
65
+ const { name } = extractComponentInfo(vm)
66
+ const additionalInfo = getAdditionalVue3Info(vm)
67
+
68
+ const componentName = name ? `<${classify(name)}>` : '<Anonymous>'
69
+ const additionalInfoStr = additionalInfo.length > 0 ? ` (${additionalInfo.join(', ')})` : ''
70
+
71
+ return componentName + additionalInfoStr
72
+ }
73
+
74
+ function extractComponentInfo (vm: any): { name?: string } {
75
+ const options = vm?.$options || vm?.vnode?.type || vm?.type || vm || {}
76
+ return { name: options.name }
77
+ }
78
+
79
+ function getAdditionalVue3Info (vm: any): string[] {
80
+ const additionalInfo: string[] = []
81
+
82
+ if (vm?.props && typeof vm.props === 'object') {
83
+ const propKeys = Object.keys(vm.props).slice(0, 3)
84
+ if (propKeys.length > 0) {
85
+ additionalInfo.push(`props: ${propKeys.join(', ')}${Object.keys(vm.props).length > 3 ? '...' : ''}`)
86
+ }
75
87
  }
76
88
 
77
- return (
78
- (name ? `<${classify(name)}>` : `<Anonymous>`) +
79
- (file && includeFile !== false ? ` at ${file}` : '')
80
- )
89
+ if (vm?.setupState && typeof vm.setupState === 'object') {
90
+ const setupKeys = Object.keys(vm.setupState).slice(0, 2)
91
+ if (setupKeys.length > 0) {
92
+ additionalInfo.push(`setup: ${setupKeys.join(', ')}${Object.keys(vm.setupState).length > 2 ? '...' : ''}`)
93
+ }
94
+ }
95
+
96
+ return additionalInfo
81
97
  }
82
98
 
83
99
  function generateComponentTrace (vm: any): string {
84
- if (vm._isVue && vm.$parent) {
100
+ if (vm?.parent || vm?.$parent) {
85
101
  const tree: any[] = []
86
102
  let currentRecursiveSequence = 0
87
- while (vm) {
103
+ let currentVm = vm
104
+
105
+ while (currentVm) {
88
106
  if (tree.length > 0) {
89
107
  const last: any = tree[tree.length - 1]
90
- if (last.constructor === vm.constructor) {
108
+ if (last.constructor === currentVm.constructor) {
91
109
  currentRecursiveSequence++
92
- vm = vm.$parent
110
+ currentVm = currentVm.parent || currentVm.$parent
93
111
  continue
94
112
  } else if (currentRecursiveSequence > 0) {
95
113
  tree[tree.length - 1] = [last, currentRecursiveSequence]
96
114
  currentRecursiveSequence = 0
97
115
  }
98
116
  }
99
- tree.push(vm)
100
- vm = vm.$parent
117
+ tree.push(currentVm)
118
+ currentVm = currentVm.parent || currentVm.$parent
101
119
  }
120
+
102
121
  return '\n\nfound in\n\n' + tree
103
122
  .map((vm, i) => `${
104
123
  i === 0 ? '---> ' : ' '.repeat(5 + i * 2)
@@ -1,4 +1,4 @@
1
- import {defineComponent, h} from 'vue'
1
+ import { defineComponent, h } from 'vue'
2
2
  import { VNode, VNodeDirective } from 'vue/types'
3
3
  import { VuetifyIcon } from 'vuetify/types/services/icons'
4
4
  import { DataTableCompareFunction, SelectItemKey, ItemGroup } from 'vuetify/types'
@@ -125,7 +125,9 @@ export function deepEqual (a: any, b: any): boolean {
125
125
  export function getObjectValueByPath (obj: any, path: string, fallback?: any): any {
126
126
  // credit: http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key#comment55278413_6491621
127
127
  if (obj == null || !path || typeof path !== 'string') return fallback
128
- if (path in obj && obj[path] !== undefined) return obj[path]
128
+ if (obj !== null && typeof obj === 'object' && !Array.isArray(obj) && path in obj && obj[path] !== undefined) {
129
+ return obj[path]
130
+ }
129
131
  path = path.replace(/\[(\w+)\]/g, '.$1') // convert indexes to properties
130
132
  path = path.replace(/^\./, '') // strip a leading dot
131
133
  return getNestedValue(obj, path.split('.'), fallback)
@@ -526,7 +528,7 @@ export function normalizeAttrs (attrs) {
526
528
 
527
529
  const obj = {}
528
530
 
529
- for(let i = 0; i < keys.length; i++) {
531
+ for (let i = 0; i < keys.length; i++) {
530
532
  obj[keys[i]] = attrs[keys[i]]
531
533
  }
532
534
 
@@ -538,7 +540,9 @@ export function normalizeAttrs (attrs) {
538
540
  * @param classes - классы в виде строки, объекта или массива
539
541
  * @returns объект с нормализованными классами
540
542
  */
541
- export function normalizeClasses (classes: string | Record<string, any> | Array<string | Record<string, any>> | undefined): Record<string, any> {
543
+ export function normalizeClasses (
544
+ classes: string | Record<string, any> | Array<string | Record<string, any>> | undefined
545
+ ): Record<string, any> {
542
546
  if (!classes) return {}
543
547
 
544
548
  if (typeof classes === 'object' && !Array.isArray(classes)) {