@coreui/vue-pro 4.2.0 → 4.3.0-beta.0
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/README.md +1 -1
- package/dist/components/calendar/CCalendar.d.ts +185 -0
- package/dist/components/calendar/index.d.ts +6 -0
- package/dist/components/date-picker/CDatePicker.d.ts +406 -0
- package/dist/components/date-picker/index.d.ts +6 -0
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +480 -0
- package/dist/components/date-range-picker/index.d.ts +6 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/multi-select/CMultiSelect.d.ts +2 -2
- package/dist/components/picker/CPicker.d.ts +11 -0
- package/dist/components/picker/index.d.ts +6 -0
- package/dist/components/popover/CPopover.d.ts +1 -1
- package/dist/components/sidebar/CSidebar.d.ts +1 -1
- package/dist/components/smart-table/CSmartTable.d.ts +1 -1
- package/dist/components/time-picker/CTimePicker.d.ts +10 -0
- package/dist/components/time-picker/CTimePickerRollCol.d.ts +27 -0
- package/dist/components/time-picker/index.d.ts +6 -0
- package/dist/components/toast/CToast.d.ts +1 -1
- package/dist/index.es.js +2849 -850
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +2858 -849
- package/dist/index.js.map +1 -1
- package/dist/utils/calendar.d.ts +21 -0
- package/dist/utils/time.d.ts +17 -0
- package/package.json +1 -1
- package/src/components/calendar/CCalendar.ts +546 -0
- package/src/components/calendar/index.ts +10 -0
- package/src/components/date-picker/CDatePicker.ts +243 -0
- package/src/components/date-picker/index.ts +10 -0
- package/src/components/date-range-picker/CDateRangePicker.ts +635 -0
- package/src/components/date-range-picker/index.ts +10 -0
- package/src/components/dropdown/CDropdownMenu.ts +4 -2
- package/src/components/dropdown/CDropdownToggle.ts +24 -9
- package/src/components/index.ts +5 -0
- package/src/components/picker/CPicker.ts +220 -0
- package/src/components/picker/index.ts +10 -0
- package/src/components/time-picker/CTimePicker.ts +410 -0
- package/src/components/time-picker/CTimePickerRollCol.ts +58 -0
- package/src/components/time-picker/index.ts +10 -0
- package/src/utils/calendar.ts +193 -0
- package/src/utils/time.ts +58 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { defineComponent, h, PropType } from 'vue'
|
|
2
|
+
|
|
3
|
+
import { CDateRangePicker } from '../date-range-picker/'
|
|
4
|
+
|
|
5
|
+
import { Color } from '../props'
|
|
6
|
+
|
|
7
|
+
const CDatePicker = defineComponent({
|
|
8
|
+
name: 'CDatePicker',
|
|
9
|
+
props: {
|
|
10
|
+
/**
|
|
11
|
+
* Default date of the component
|
|
12
|
+
*/
|
|
13
|
+
calendarDate: {
|
|
14
|
+
type: [Date, String],
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* Toggle visibility or set the content of cancel button.
|
|
18
|
+
*/
|
|
19
|
+
cancelButton: {
|
|
20
|
+
type: [Boolean, String],
|
|
21
|
+
default: 'Cancel',
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Sets the color context of the cancel button to one of CoreUI’s themed colors.
|
|
25
|
+
*
|
|
26
|
+
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
|
|
27
|
+
*/
|
|
28
|
+
cancelButtonColor: {
|
|
29
|
+
...Color,
|
|
30
|
+
default: 'primary',
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* Size the cancel button small or large.
|
|
34
|
+
*
|
|
35
|
+
* @values 'sm', 'lg'
|
|
36
|
+
*/
|
|
37
|
+
cancelButtonSize: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'sm',
|
|
40
|
+
validator: (value: string) => {
|
|
41
|
+
return ['sm', 'lg'].includes(value)
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Set the cancel button variant to an outlined button or a ghost button.
|
|
46
|
+
*
|
|
47
|
+
* @values 'ghost', 'outline'
|
|
48
|
+
*/
|
|
49
|
+
cancelButtonVariant: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'ghost',
|
|
52
|
+
validator: (value: string) => {
|
|
53
|
+
return ['ghost', 'outline'].includes(value)
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Toggle visibility of the cleaner button.
|
|
58
|
+
*/
|
|
59
|
+
cleaner: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: true,
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Toggle visibility or set the content of confirm button.
|
|
65
|
+
*/
|
|
66
|
+
confirmButton: {
|
|
67
|
+
type: [Boolean, String],
|
|
68
|
+
default: 'OK',
|
|
69
|
+
},
|
|
70
|
+
/**
|
|
71
|
+
* Sets the color context of the confirm button to one of CoreUI’s themed colors.
|
|
72
|
+
*
|
|
73
|
+
* @values 'primary', 'secondary', 'success', 'danger', 'warning', 'info', 'dark', 'light'
|
|
74
|
+
*/
|
|
75
|
+
confirmButtonColor: {
|
|
76
|
+
...Color,
|
|
77
|
+
default: 'primary',
|
|
78
|
+
},
|
|
79
|
+
/**
|
|
80
|
+
* Size the confirm button small or large.
|
|
81
|
+
*
|
|
82
|
+
* @values 'sm', 'lg'
|
|
83
|
+
*/
|
|
84
|
+
confirmButtonSize: {
|
|
85
|
+
type: String,
|
|
86
|
+
default: 'sm',
|
|
87
|
+
validator: (value: string) => {
|
|
88
|
+
return ['sm', 'lg'].includes(value)
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* Set the confirm button variant to an outlined button or a ghost button.
|
|
93
|
+
*
|
|
94
|
+
* @values 'ghost', 'outline'
|
|
95
|
+
*/
|
|
96
|
+
confirmButtonVariant: {
|
|
97
|
+
type: String,
|
|
98
|
+
validator: (value: string) => {
|
|
99
|
+
return ['ghost', 'outline'].includes(value)
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Toggle the disabled state for the component.
|
|
104
|
+
*/
|
|
105
|
+
disabled: Boolean,
|
|
106
|
+
/**
|
|
107
|
+
* Specify the list of dates that cannot be selected.
|
|
108
|
+
*/
|
|
109
|
+
disabledDates: {
|
|
110
|
+
type: Array as PropType<Date[] | Date[][]>,
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
* Initial selected date.
|
|
114
|
+
*/
|
|
115
|
+
date: {
|
|
116
|
+
type: [Date, String],
|
|
117
|
+
required: false,
|
|
118
|
+
},
|
|
119
|
+
/**
|
|
120
|
+
* Sets the day of start week.
|
|
121
|
+
* - 0 - Sunday,
|
|
122
|
+
* - 1 - Monday,
|
|
123
|
+
* - 2 - Tuesday,
|
|
124
|
+
* - 3 - Wednesday,
|
|
125
|
+
* - 4 - Thursday,
|
|
126
|
+
* - 5 - Friday,
|
|
127
|
+
* - 6 - Saturday,
|
|
128
|
+
* - 7 - Sunday
|
|
129
|
+
*/
|
|
130
|
+
firstDayOfWeek: {
|
|
131
|
+
type: Number,
|
|
132
|
+
default: 1,
|
|
133
|
+
},
|
|
134
|
+
/**
|
|
135
|
+
* Toggle visibility of footer element or set the content of footer.
|
|
136
|
+
*/
|
|
137
|
+
footer: Boolean,
|
|
138
|
+
/**
|
|
139
|
+
* Toggle visibility or set the content of the input indicator.
|
|
140
|
+
*/
|
|
141
|
+
indicator: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
default: true,
|
|
144
|
+
},
|
|
145
|
+
/**
|
|
146
|
+
* Toggle the readonly state for the component.
|
|
147
|
+
*/
|
|
148
|
+
inputReadOnly: Boolean,
|
|
149
|
+
/**
|
|
150
|
+
* Sets the default locale for components. If not set, it is inherited from the navigator.language.
|
|
151
|
+
*/
|
|
152
|
+
locale: {
|
|
153
|
+
type: String,
|
|
154
|
+
default: 'default',
|
|
155
|
+
},
|
|
156
|
+
/**
|
|
157
|
+
* Max selectable date.
|
|
158
|
+
*/
|
|
159
|
+
maxDate: {
|
|
160
|
+
type: [Date, String],
|
|
161
|
+
},
|
|
162
|
+
/**
|
|
163
|
+
* Min selectable date.
|
|
164
|
+
*/
|
|
165
|
+
minDate: {
|
|
166
|
+
type: [Date, String],
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
* Show arrows navigation.
|
|
170
|
+
*/
|
|
171
|
+
navigation: {
|
|
172
|
+
type: Boolean,
|
|
173
|
+
default: true,
|
|
174
|
+
},
|
|
175
|
+
/**
|
|
176
|
+
* Specifies a short hint that is visible in the input.
|
|
177
|
+
*/
|
|
178
|
+
placeholder: {
|
|
179
|
+
type: String,
|
|
180
|
+
default: 'Select date',
|
|
181
|
+
},
|
|
182
|
+
/**
|
|
183
|
+
* Size the component small or large.
|
|
184
|
+
*
|
|
185
|
+
* @values 'sm', 'lg'
|
|
186
|
+
*/
|
|
187
|
+
size: {
|
|
188
|
+
type: String,
|
|
189
|
+
required: false,
|
|
190
|
+
validator: (value: string) => {
|
|
191
|
+
return ['sm', 'lg'].includes(value)
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
/**
|
|
195
|
+
* Provide an additional time selection by adding select boxes to choose times.
|
|
196
|
+
*/
|
|
197
|
+
timepicker: Boolean,
|
|
198
|
+
/**
|
|
199
|
+
* Set length or format of day name.
|
|
200
|
+
*
|
|
201
|
+
* @type number | 'long' | 'narrow' | 'short'
|
|
202
|
+
*/
|
|
203
|
+
weekdayFormat: {
|
|
204
|
+
type: [Number, String],
|
|
205
|
+
default: 2,
|
|
206
|
+
validator: (value: string | number) => {
|
|
207
|
+
if (typeof value === 'string') {
|
|
208
|
+
return ['long', 'narrow', 'short'].includes(value)
|
|
209
|
+
}
|
|
210
|
+
if (typeof value === 'number') {
|
|
211
|
+
return true
|
|
212
|
+
}
|
|
213
|
+
return false
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
emit: [
|
|
218
|
+
/**
|
|
219
|
+
* Callback fired when the date changed.
|
|
220
|
+
*/
|
|
221
|
+
'date-change',
|
|
222
|
+
],
|
|
223
|
+
setup(props, { emit }) {
|
|
224
|
+
return () =>
|
|
225
|
+
h(CDateRangePicker, {
|
|
226
|
+
calendars: 1,
|
|
227
|
+
onStartDateChange: (date: Date) => emit('date-change', date),
|
|
228
|
+
range: false,
|
|
229
|
+
startDate: props.date,
|
|
230
|
+
...props,
|
|
231
|
+
// cleaner: props.cleaner,
|
|
232
|
+
// disabled: props.disabled,
|
|
233
|
+
// indicator: props.indicator,
|
|
234
|
+
// inputReadOnly: props.inputReadOnly,
|
|
235
|
+
// locale: props.locale,
|
|
236
|
+
// placeholder: props.placeholder,
|
|
237
|
+
// size: props.size,
|
|
238
|
+
// timepicker: props.timepicker,
|
|
239
|
+
})
|
|
240
|
+
},
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
export { CDatePicker }
|