8000 refactor: clean-up, improvements, and shorthands in props definition · coreui/coreui-vue@e07b767 · GitHub
[go: up one dir, main page]

Skip to content

Commit e07b767

Browse files
committed
refactor: clean-up, improvements, and shorthands in props definition
1 parent 862378c commit e07b767

File tree

141 files changed

+365
-1005
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+365
-1005
lines changed

packages/coreui-vue-chartjs/src/CChart.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const CChart = defineComponent({
2929
customTooltips: {
3030
type: Boolean,
3131
default: true,
32-
required: false,
3332
},
3433
/**
3534
* The data object that is passed into the Chart.js chart (more info).
@@ -46,15 +45,12 @@ const CChart = defineComponent({
4645
height: {
4746
type: Number,
4847
default: 150,
49-
required: false,
5048
},
5149
/**
5250
* ID attribute applied to the rendered canvas.
5351
*/
5452
id: {
5553
type: String,
56-
default: undefined,
57-
required: false,
5854
},
5955
/**
6056
* The options object that is passed into the Chart.js chart.
@@ -63,8 +59,6 @@ const CChart = defineComponent({
6359
*/
6460
options: {
6561
type: Object as PropType<ChartOptions>,
66-
default: undefined,
67-
required: false,
6862
},
6963
/**
7064
* The plugins array that is passed into the Chart.js chart (more info)
@@ -73,8 +67,6 @@ const CChart = defineComponent({
7367
*/
7468
plugins: {
7569
type: Array as PropType<Plugin[]>,
76-
default: undefined,
77-
required: false,
7870
},
7971
/**
8072
* If true, will tear down and redraw chart on all updates.
@@ -88,7 +80,6 @@ const CChart = defineComponent({
8880
type: {
8981
type: String as PropType<ChartType>,
9082
default: 'bar',
91-
required: false,
9283
},
9384
/**
9485
* Width attribute applied to the rendered canvas.
@@ -98,7 +89,6 @@ const CChart = defineComponent({
9889
width: {
9990
type: Number,
10091
default: 300,
101-
required: false,
10292
},
10393
/**
10494
* Put the chart into the wrapper div element.
@@ -108,7 +98,6 @@ const CChart = defineComponent({
10898
wrapper: {
10999
type: Boolean,
110100
default: true,
111-
required: false,
112101
},
113102
},
114103
emits: [

packages/coreui-vue/src/components/accordion/CAccordion.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@ const CAccordion = defineComponent({
66
/**
77
* The active item key.
88
*/
9-
activeItemKey: {
10-
type: [Number, String],
11-
default: undefined,
12-
require: false,
13-
},
9+
activeItemKey: [Number, String],
1410
/**
1511
* Make accordion items stay open when another item is opened
1612
*/

packages/coreui-vue/src/components/accordion/CAccordionItem.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,11 @@ const CAccordionItem = defineComponent({
66
/**
77
* The item key.
88
*/
9-
itemKey: {
10-
type: [Number, String],
11-
default: undefined,
12-
require: false,
13-
},
9+
itemKey: [Number, String]
1410
},
1511
setup(props, { slots }) {
1612
const activeItemKey = inject('activeItemKey') as Ref<number | string>
1713
const alwaysOpen = inject('alwaysOpen') as boolean
18-
// eslint-disable-next-line no-unused-vars
1914
const setActiveItemKey = inject('setActiveItemKey') as (key: number | string) => void
2015

2116
const itemKey = ref(props.itemKey ? props.itemKey : Math.random().toString(36).substr(2, 9))

packages/coreui-vue/src/components/alert/CAlert.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,14 @@ export const CAlert = defineComponent({
1515
/**
1616
* Optionally add a close button to alert and allow it to self dismisss.
1717
*/
18-
dismissible: {
19-
type: Boolean,
20-
default: false,
21-
required: false,
22-
},
18+
dismissible: Boolean,
2319
/**
2420
* Set the alert variant to a solid.
2521
*
2622
* @values 'solid'
2723
*/
2824
variant: {
2925
type: String,
30-
default: undefined,
31-
required: false,
3226
validator: (value: string) => {
3327
return value === 'solid'
3428
},
@@ -39,7 +33,6 @@ export const CAlert = defineComponent({
3933
visible: {
4034
type: Boolean,
4135
default: true,
42-
required: false,
4336
},
4437
},
4538
emits: [

packages/coreui-vue/src/components/alert/CAlertHeading.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export const CAlertHeading = defineComponent({
99
component: {
1010
type: String,
1111
default: 'h4',
12-
required: false,
1312
},
1413
},
1514
setup(props, { slots }) {

packages/coreui-vue/src/components/avatar/CAvatar.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,21 @@ const CAvatar = defineComponent({
2323
*/
2424
size: {
2525
type: String,
26-
default: undefined,
27-
required: false,
2826
validator: (value: string) => {
2927
return ['sm', 'md', 'lg', 'xl'].includes(value)
3028
},
3129
},
3230
/**
3331
* The src attribute for the img element.
3432
*/
35-
src: {
36-
type: String,
37-
default: undefined,
38-
required: false,
39-
},
33+
src: String,
4034
/**
4135
* Sets the color context of the status indicator to one of CoreUI’s themed colors.
4236
*
4337
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
4438
*/
4539
status: {
4640
type: String,
47-
default: undefined,
48-
required: false,
4941
validator: (value: string) => {
5042
return [
5143
'primary',

packages/coreui-vue/src/components/backdrop/CBackdrop.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineComponent, h, RendererElement, Transition } from 'vue'
22

3-
import { executeAfterTransition } from './../../utils/transition'
3+
import { executeAfterTransition } from '../../utils/transition'
44

55
const CBackdrop = defineComponent({
66
name: 'CBackdrop',
@@ -11,7 +11,6 @@ const CBackdrop = defineComponent({
1111
visible: {
1212
type: Boolean,
1313
default: false,
14-
required: false,
1514
},
1615
},
1716
setup(props) {

packages/coreui-vue/src/components/badge/CBadge.ts

Lines changed: 0 add 10000 itions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const CBadge = defineComponent({
1616
*/
1717
component: {
1818
type: String,
19-
required: false,
2019
default: 'span',
2120
},
2221
/**
@@ -26,8 +25,6 @@ const CBadge = defineComponent({
2625
*/
2726
position: {
2827
type: String,
29-
default: undefined,
30-
required: false,
3128
validator: (value: string) => {
3229
return ['top-start', 'top-end', 'bottom-end', 'bottom-start'].includes(value)
3330
},
@@ -45,8 +42,6 @@ const CBadge = defineComponent({
4542
*/
4643
size: {
4744
type: String,
48-
default: undefined,
49-
required: false,
5045
validator: (value: string) => {
5146
return value === 'sm'
5247
},

packages/coreui-vue/src/components/breadcrumb/CBreadcrumbItem.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,11 @@ const CBreadcrumbItem = defineComponent({
66
/**
77
* Toggle the active state for the component.
88
*/
9-
active: {
10-
type: Boolean,
11-
required: false,
12-
},
9+
active: Boolean,
1310
/**
1411
* The `href` attribute for the inner link component.
1512
*/
16-
href: {
17-
type: String,
18-
default: undefined,
19-
required: false,
20-
},
13+
href: String,
2114
},
2215

2316
setup(props, { slots }) {

packages/coreui-vue/src/components/button-group/CButtonGroup.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,14 @@ const CButtonGroup = defineComponent({
1010
*/
1111
size: {
1212
type: String,
13-
default: undefined,
14-
required: false,
1513
validator: (value: string) => {
1614
return ['sm', 'lg'].includes(value)
1715
},
1816
},
1917
/**
2018
* Create a set of buttons that appear vertically stacked rather than horizontally. Split button dropdowns are not supported here.
2119
*/
22-
vertical: {
23-
type: Boolean,
24-
required: false,
25-
},
20+
vertical: Boolean,
2621
},
2722
setup(props, { slots }) {
2823
return () =>

packages/coreui-vue/src/components/button/CButton.ts

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ export const CButton = defineComponent({
77
/**
88
* Toggle the active state for the component.
99
*/
10-
active: {
11-
type: Boolean,
12-
default: false,
13-
required: false,
14-
},
10+
active: Boolean,
1511
/**
1612
* Sets the color context of the component to one of CoreUI’s themed colors.
1713
*
@@ -24,23 +20,15 @@ export const CButton = defineComponent({
2420
component: {
2521
type: String,
2622
default: 'button',
27-
required: false,
2823
},
2924
/**
3025
* Toggle the disabled state for the component.
3126
*/
32-
disabled: {
33-
type: Boolean,
34-
required: false,
35-
},
27+
disabled: Boolean,
3628
/**
3729
* The href attribute specifies the URL of the page the link goes to.
3830
*/
39-
href: {
40-
type: String,
41-
default: undefined,
42-
required: false,
43-
},
31+
href: String,
4432
/**
4533
* Select the shape of the component.
4634
*
@@ -54,8 +42,6 @@ export const CButton = defineComponent({
5442
*/
5543
size: {
5644
type: String,
57-
default: undefined,
58-
required: false,
5945
validator: (value: string) => {
6046
return ['sm', 'lg'].includes(value)
6147
},
@@ -69,7 +55,6 @@ export const CButton = defineComponent({
6955
type: {
7056
type: String,
7157
default: 'button',
72-
required: false,
7358
validator: (value: string) => {
7459
return ['button', 'submit', 'reset'].includes(value)
7560
},
@@ -81,8 +66,6 @@ export const CButton = defineComponent({
8166
*/
8267
variant: {
8368
type: String,
84-
default: undefined,
85-
required: false,
8669
validator: (value: string) => {
8770
return ['ghost', 'outline'].includes(value)
8871
},

packages/coreui-vue/src/components/card/CCardHeader.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const CCardHeader = defineComponent({
88
*/
99
component: {
1010
type: String,
11-
required: false,
1211
default: 'div',
1312
},
1413
},

packages/coreui-vue/src/components/card/CCardImage.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const CCardImage = defineComponent({
88
*/
99
component: {
1010
type: String,
11-
required: false,
1211
default: 'img',
1312
},
1413
/**
@@ -18,8 +17,6 @@ const CCardImage = defineComponent({
1817
*/
1918
orientation: {
2019
type: String,
21-
default: undefined,
22-
required: false,
2320
validator: (value: string) => {
2421
return ['top', 'bottom'].includes(value)
2522
},

packages/coreui-vue/src/components/card/CCardLink.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const CCardLink = defineComponent({
1010
href: {
1111
type: String,
1212
default: '#',
13-
required: false,
1413
},
1514
},
1615
setup(props, { slots }) {

packages/coreui-vue/src/components/card/CCardSubtitle.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const CCardSubtitle = defineComponent({
88
*/
99
component: {
1010
type: String,
11-
required: false,
1211
default: 'h6',
1312
},
1413
},

packages/coreui-vue/src/components/card/CCardText.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const CCardText = defineComponent({
88
*/
99
component: {
1010
type: String,
11-
required: false,
1211
default: 'p',
1312
},
1413
},

packages/coreui-vue/src/components/card/CCardTitle.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const CCardTitle = defineComponent({
88
*/
99
component: {
1010
type: String,
11-
required: false,
1211
default: 'h5',
1312
},
1413
},

0 commit comments

Comments
 (0)
0