@@ -49,10 +49,46 @@ const createWebTypesApi = () => {
49
49
const getDocUrl = ( cmp , heading = null ) => `https://www.vuetifyjs.com/api/${ cmp } ${ heading ? `#${ heading } ` : '' } `
50
50
51
51
const createTag = component => {
52
+ const createTagSlotPattern = slot => {
53
+ const patternIndex = slot . name . indexOf ( '<name>' )
54
+ if ( patternIndex < 0 ) { return { } }
55
+
56
+ let itemName
57
+ const slotPrefix = slot . name . substring ( 0 , patternIndex )
58
+ if ( slotPrefix === 'header.' ) {
59
+ // VDataTable header.<name>
60
+ itemName = 'header column'
61
+ } else if ( slotPrefix === 'item.' ) {
62
+ // VDataTable item.<name>
63
+ itemName = 'column'
64
+ } else {
65
+ // Fallback
66
+ itemName = 'item'
67
+ }
68
+
69
+ const itemsPath = itemName . replace ( ' ' , '-' ) + 's'
70
+ return {
71
+ pattern : {
72
+ items : itemsPath ,
73
+ template : [
74
+ slotPrefix ,
75
+ '#item:' + itemName ,
76
+ ] ,
77
+ } ,
78
+ [ itemsPath ] : {
79
+ name : itemName [ 0 ] . toUpperCase ( ) + itemName . substring ( 1 ) ,
80
+ pattern : {
81
+ regex : '.+' ,
82
+ } ,
83
+ 'doc-hide-pattern' : true ,
84
+ } ,
85
+ }
86
+ }
87
+
52
88
const createTagSlot = slot => {
53
89
return {
54
90
name : slot . name ,
55
- pattern : undefined ,
91
+ ... createTagSlotPattern ( slot ) ,
56
92
description : slot . description . en || '' ,
57
93
'doc-url' : getDocUrl ( component . name , 'slots' ) ,
58
94
'vue-properties' : slot . props && Object . keys ( slot . props ) . map ( key => createTypedEntity ( key , slot . props [ key ] ) ) ,
0 commit comments