Skip to content

Commit

Permalink
feat(api/ts): Use narrower types for component refs (closes #11483) (#…
Browse files Browse the repository at this point in the history
…11501)

* feat(api): Use Component type for component refs

* feat(api): Use Q* tsType for Component typed props
  • Loading branch information
yusufkandemir committed Dec 6, 2021
1 parent 41d70ac commit e8e0014
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 39 deletions.
2 changes: 1 addition & 1 deletion ui/build/build.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const objectTypes = {

// special type, not common
Component: {
props: [ 'desc', 'required', 'category', 'examples', 'addedIn', 'internal' ],
props: [ 'tsType', 'desc', 'required', 'category', 'examples', 'addedIn', 'internal' ],
required: [ 'desc' ],
isBoolean: [ 'internal' ]
},
Expand Down
12 changes: 6 additions & 6 deletions ui/src/components/file/QFile.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@
},

"ref": {
"type": "Object",
"desc": "Reference to the QFile component",
"__exemption": [ "examples" ]
"type": "Component",
"tsType": "QFile",
"desc": "Reference to the QFile component"
}
}
},
Expand All @@ -131,9 +131,9 @@
},

"ref": {
"type": "Object",
"desc": "Reference to the QFile component",
"__exemption": [ "examples" ]
"type": "Component",
"tsType": "QFile",
"desc": "Reference to the QFile component"
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions ui/src/components/form/QForm.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@
"desc": "Emitted after a validation was triggered and at least one of the inner Quasar components models are NOT valid",
"params": {
"ref": {
"type": "Object",
"desc": "Vue reference to the first component that triggered the validation error",
"__exemption": [ "examples" ]
"type": "Component",
"desc": "Vue reference to the first component that triggered the validation error"
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions ui/src/components/scroll-area/QScrollArea.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@
"desc": "An object containing scroll information",
"definition": {
"ref": {
"type": "Object",
"type": "Component",
"tsType": "QScrollArea",
"required": true,
"desc": "Vue reference to the QScrollArea which triggered the event",
"__exemption": [ "examples" ]
"desc": "Vue reference to the QScrollArea which triggered the event"
},

"verticalPosition": {
Expand Down Expand Up @@ -163,9 +163,8 @@
"getScrollTarget": {
"desc": "Get the scrolling DOM element target",
"returns": {
"type": "Object",
"desc": "DOM element upon which scrolling takes place",
"__exemption": [ "examples" ]
"type": "Element",
"desc": "DOM element upon which scrolling takes place"
}
},

Expand Down
19 changes: 16 additions & 3 deletions ui/src/components/select/QSelect.json
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,10 @@
"desc": "Callback to call at the end after the update has been fully processed by QSelect",
"params": {
"ref": {
"type": "Object",
"type": "Component",
"tsType": "QSelect",
"required": true,
"desc": "Vue reference to the QSelect which triggered the filtering",
"__exemption": [ "examples" ]
"desc": "Vue reference to the QSelect which triggered the filtering"
}
},
"returns": null
Expand Down Expand Up @@ -641,6 +641,19 @@
"__exemption": [ "examples" ]
}
}
},

"virtual-scroll": {
"params": {
"details": {
"definition": {
"ref": {
"tsType": "QSelect",
"desc": "Vue reference to the QSelect"
}
}
}
}
}
},

Expand Down
24 changes: 12 additions & 12 deletions ui/src/components/tree/QTree.json
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@
"reactive": true
},
"tree": {
"type": "Object",
"desc": "QTree instance",
"__exemption": [ "examples" ]
"type": "Component",
"tsType": "QTree",
"desc": "QTree instance"
},
"node": {
"type": "Object",
Expand Down Expand Up @@ -226,9 +226,9 @@
"reactive": true
},
"tree": {
"type": "Object",
"desc": "QTree instance",
"__exemption": [ "examples" ]
"type": "Component",
"tsType": "QTree",
"desc": "QTree instance"
},
"node": {
"type": "Object",
Expand Down Expand Up @@ -266,9 +266,9 @@
"reactive": true
},
"tree": {
"type": "Object",
"desc": "QTree instance",
"__exemption": [ "examples" ]
"type": "Component",
"tsType": "QTree",
"desc": "QTree instance"
},
"node": {
"type": "Object",
Expand Down Expand Up @@ -306,9 +306,9 @@
"reactive": true
},
"tree": {
"type": "Object",
"desc": "QTree instance",
"__exemption": [ "examples" ]
"type": "Component",
"tsType": "QTree",
"desc": "QTree instance"
},
"node": {
"type": "Object",
Expand Down
15 changes: 15 additions & 0 deletions ui/src/components/virtual-scroll/QVirtualScroll.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@
}
},

"events": {
"virtual-scroll": {
"params": {
"details": {
"definition": {
"ref": {
"tsType": "QVirtualScroll",
"desc": "Vue reference to the QVirtualScroll"
}
}
}
}
}
},

"slots" : {
"before": {
"desc": "Template slot for the elements that should be rendered before the list; Suggestion: thead before a table"
Expand Down
7 changes: 2 additions & 5 deletions ui/src/components/virtual-scroll/use-virtual-scroll.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,9 @@
"values": [ "increase", "decrease" ]
},
"ref": {
"type": "Object",
"type": "Component",
"required": true,
"desc": "Vue reference to the QVirtualList which triggered the event",
"__exemption": [
"examples"
]
"desc": "Vue reference to the component which triggered the event"
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions ui/src/plugins/Dialog.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,8 @@
},

"component": {
"type": "Any",
"desc": "Use custom dialog component; use along with 'componentProps' prop where possible",
"__exemption": [ "examples" ]
"type": "Component",
"desc": "Use custom dialog component; use along with 'componentProps' prop where possible"
},

"componentProps": {
Expand Down

0 comments on commit e8e0014

Please sign in to comment.