@coreui/vue-pro 4.8.2 → 4.9.0-beta.1
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/accordion/CAccordion.d.ts +1 -1
- package/dist/components/accordion/CAccordionBody.d.ts +1 -1
- package/dist/components/accordion/CAccordionButton.d.ts +1 -1
- package/dist/components/accordion/CAccordionHeader.d.ts +1 -1
- package/dist/components/accordion/CAccordionItem.d.ts +1 -1
- package/dist/components/alert/CAlert.d.ts +1 -1
- package/dist/components/alert/CAlertHeading.d.ts +1 -1
- package/dist/components/alert/CAlertLink.d.ts +1 -1
- package/dist/components/avatar/CAvatar.d.ts +1 -1
- package/dist/components/backdrop/CBackdrop.d.ts +1 -1
- package/dist/components/badge/CBadge.d.ts +1 -1
- package/dist/components/breadcrumb/CBreadcrumb.d.ts +1 -1
- package/dist/components/breadcrumb/CBreadcrumbItem.d.ts +1 -1
- package/dist/components/button/CButton.d.ts +1 -1
- package/dist/components/button-group/CButtonGroup.d.ts +1 -1
- package/dist/components/button-group/CButtonToolbar.d.ts +1 -1
- package/dist/components/calendar/CCalendar.d.ts +33 -1
- package/dist/components/callout/CCallout.d.ts +1 -1
- package/dist/components/card/CCard.d.ts +1 -1
- package/dist/components/card/CCardBody.d.ts +1 -1
- package/dist/components/card/CCardFooter.d.ts +1 -1
- package/dist/components/card/CCardGroup.d.ts +1 -1
- package/dist/components/card/CCardHeader.d.ts +1 -1
- package/dist/components/card/CCardImage.d.ts +1 -1
- package/dist/components/card/CCardImageOverlay.d.ts +1 -1
- package/dist/components/card/CCardLink.d.ts +1 -1
- package/dist/components/card/CCardSubtitle.d.ts +1 -1
- package/dist/components/card/CCardText.d.ts +1 -1
- package/dist/components/card/CCardTitle.d.ts +1 -1
- package/dist/components/carousel/CCarousel.d.ts +1 -1
- package/dist/components/carousel/CCarouselCaption.d.ts +1 -1
- package/dist/components/carousel/CCarouselItem.d.ts +1 -1
- package/dist/components/close-button/CCloseButton.d.ts +1 -1
- package/dist/components/collapse/CCollapse.d.ts +1 -1
- package/dist/components/date-picker/CDatePicker.d.ts +35 -3
- package/dist/components/date-range-picker/CDateRangePicker.d.ts +89 -78
- package/dist/components/date-range-picker/utils.d.ts +1 -0
- package/dist/components/dropdown/CDropdown.d.ts +2 -2
- package/dist/components/dropdown/CDropdownDivider.d.ts +1 -1
- package/dist/components/dropdown/CDropdownHeader.d.ts +1 -1
- package/dist/components/dropdown/CDropdownItem.d.ts +1 -1
- package/dist/components/dropdown/CDropdownMenu.d.ts +1 -1
- package/dist/components/dropdown/CDropdownToggle.d.ts +1 -1
- package/dist/components/element-cover/CElementCover.d.ts +1 -1
- package/dist/components/footer/CFooter.d.ts +1 -1
- package/dist/components/form/CForm.d.ts +1 -1
- package/dist/components/form/CFormCheck.d.ts +10 -2
- package/dist/components/form/CFormControl.d.ts +2 -2
- package/dist/components/form/CFormControlValidation.d.ts +1 -1
- package/dist/components/form/CFormControlWrapper.d.ts +1 -1
- package/dist/components/form/CFormFeedback.d.ts +1 -1
- package/dist/components/form/CFormFloating.d.ts +1 -1
- package/dist/components/form/CFormInput.d.ts +12 -12
- package/dist/components/form/CFormLabel.d.ts +1 -1
- package/dist/components/form/CFormRange.d.ts +1 -1
- package/dist/components/form/CFormSelect.d.ts +1 -1
- package/dist/components/form/CFormSwitch.d.ts +1 -1
- package/dist/components/form/CFormText.d.ts +1 -1
- package/dist/components/form/CFormTextarea.d.ts +3 -3
- package/dist/components/form/CInputGroup.d.ts +1 -1
- package/dist/components/form/CInputGroupText.d.ts +1 -1
- package/dist/components/grid/CCol.d.ts +1 -1
- package/dist/components/grid/CContainer.d.ts +1 -1
- package/dist/components/grid/CRow.d.ts +1 -1
- package/dist/components/header/CHeader.d.ts +1 -1
- package/dist/components/header/CHeaderBrand.d.ts +1 -1
- package/dist/components/header/CHeaderDivider.d.ts +1 -1
- package/dist/components/header/CHeaderNav.d.ts +1 -1
- package/dist/components/header/CHeaderText.d.ts +1 -1
- package/dist/components/header/CHeaderToggler.d.ts +1 -1
- package/dist/components/image/CImage.d.ts +1 -1
- package/dist/components/link/CLink.d.ts +1 -1
- package/dist/components/list-group/CListGroup.d.ts +1 -1
- package/dist/components/list-group/CListGroupItem.d.ts +1 -1
- package/dist/components/loading-button/CLoadingButton.d.ts +1 -1
- package/dist/components/modal/CModal.d.ts +1 -1
- package/dist/components/modal/CModalBody.d.ts +1 -1
- package/dist/components/modal/CModalFooter.d.ts +1 -1
- package/dist/components/modal/CModalHeader.d.ts +1 -1
- package/dist/components/modal/CModalTitle.d.ts +1 -1
- package/dist/components/multi-select/CMultiSelect.d.ts +73 -59
- package/dist/components/multi-select/CMultiSelectNativeSelect.d.ts +9 -33
- package/dist/components/multi-select/CMultiSelectOptions.d.ts +12 -41
- package/dist/components/multi-select/CMultiSelectSelection.d.ts +6 -59
- package/dist/components/multi-select/types.d.ts +8 -3
- package/dist/components/multi-select/utils.d.ts +9 -4
- package/dist/components/nav/CNav.d.ts +1 -1
- package/dist/components/nav/CNavGroup.d.ts +1 -1
- package/dist/components/nav/CNavGroupItems.d.ts +1 -1
- package/dist/components/nav/CNavItem.d.ts +1 -1
- package/dist/components/nav/CNavLink.d.ts +1 -1
- package/dist/components/nav/CNavTitle.d.ts +1 -1
- package/dist/components/navbar/CNavbar.d.ts +1 -1
- package/dist/components/navbar/CNavbarBrand.d.ts +1 -1
- package/dist/components/navbar/CNavbarNav.d.ts +1 -1
- package/dist/components/navbar/CNavbarText.d.ts +1 -1
- package/dist/components/navbar/CNavbarToggler.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvas.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvasBody.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvasHeader.d.ts +1 -1
- package/dist/components/offcanvas/COffcanvasTitle.d.ts +1 -1
- package/dist/components/pagination/CPagination.d.ts +1 -1
- package/dist/components/pagination/CPaginationItem.d.ts +1 -1
- package/dist/components/picker/CPicker.d.ts +57 -7
- package/dist/components/placeholder/CPlaceholder.d.ts +1 -1
- package/dist/components/popover/CPopover.d.ts +2 -2
- package/dist/components/progress/CProgress.d.ts +1 -1
- package/dist/components/progress/CProgressBar.d.ts +1 -1
- package/dist/components/sidebar/CSidebar.d.ts +1 -1
- package/dist/components/sidebar/CSidebarBrand.d.ts +1 -1
- package/dist/components/sidebar/CSidebarFooter.d.ts +1 -1
- package/dist/components/sidebar/CSidebarHeader.d.ts +1 -1
- package/dist/components/sidebar/CSidebarNav.d.ts +1 -1
- package/dist/components/sidebar/CSidebarToggler.d.ts +1 -1
- package/dist/components/smart-pagination/CSmartPagination.d.ts +1 -1
- package/dist/components/smart-table/CSmartTable.d.ts +20 -56
- package/dist/components/smart-table/CSmartTableBody.d.ts +1 -1
- package/dist/components/smart-table/CSmartTableCleaner.d.ts +1 -1
- package/dist/components/smart-table/CSmartTableFilter.d.ts +1 -1
- package/dist/components/smart-table/CSmartTableHead.d.ts +10 -1
- package/dist/components/smart-table/CSmartTableItemsPerPageSelector.d.ts +1 -1
- package/dist/components/smart-table/types.d.ts +12 -0
- package/dist/components/smart-table/utils.d.ts +12 -2
- package/dist/components/spinner/CSpinner.d.ts +1 -1
- package/dist/components/table/CTable.d.ts +1 -1
- package/dist/components/table/CTableBody.d.ts +1 -1
- package/dist/components/table/CTableCaption.d.ts +1 -1
- package/dist/components/table/CTableDataCell.d.ts +1 -1
- package/dist/components/table/CTableFoot.d.ts +1 -1
- package/dist/components/table/CTableHead.d.ts +1 -1
- package/dist/components/table/CTableHeaderCell.d.ts +1 -1
- package/dist/components/table/CTableRow.d.ts +1 -1
- package/dist/components/tabs/CTabContent.d.ts +1 -1
- package/dist/components/tabs/CTabPane.d.ts +1 -1
- package/dist/components/time-picker/CTimePicker.d.ts +1 -1
- package/dist/components/time-picker/CTimePickerRollCol.d.ts +1 -1
- package/dist/components/toast/CToast.d.ts +1 -1
- package/dist/components/toast/CToastBody.d.ts +1 -1
- package/dist/components/toast/CToastClose.d.ts +1 -1
- package/dist/components/toast/CToastHeader.d.ts +1 -1
- package/dist/components/toast/CToaster.d.ts +1 -1
- package/dist/components/tooltip/CTooltip.d.ts +2 -2
- package/dist/components/virtual-scroller/CVirtualScroller.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsA.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsB.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsC.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsD.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsE.d.ts +1 -1
- package/dist/components/widgets/CWidgetStatsF.d.ts +1 -1
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/useColorModes.d.ts +5 -0
- package/dist/directives/index.d.ts +1 -1
- package/dist/directives/v-c-visible.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.es.js +4224 -4159
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +4226 -4160
- package/dist/index.js.map +1 -1
- package/dist/utils/getUID.d.ts +2 -0
- package/dist/utils/index.d.ts +4 -1
- package/dist/utils/isObjectInArray.d.ts +2 -0
- package/dist/utils/isRTL.d.ts +2 -0
- package/package.json +11 -11
- package/src/components/accordion/CAccordionItem.ts +2 -2
- package/src/components/backdrop/CBackdrop.ts +1 -1
- package/src/components/calendar/CCalendar.ts +111 -49
- package/src/components/carousel/CCarousel.ts +7 -7
- package/src/components/date-picker/CDatePicker.ts +16 -1
- package/src/components/date-range-picker/CDateRangePicker.ts +179 -128
- package/src/components/date-range-picker/utils.ts +49 -0
- package/src/components/dropdown/CDropdown.ts +34 -31
- package/src/components/dropdown/CDropdownMenu.ts +1 -1
- package/src/components/dropdown/CDropdownToggle.ts +1 -1
- package/src/components/element-cover/CElementCover.ts +1 -0
- package/src/components/form/CFormCheck.ts +10 -4
- package/src/components/form/CFormInput.ts +2 -2
- package/src/components/form/CFormLabel.ts +1 -1
- package/src/components/form/CFormSelect.ts +1 -1
- package/src/components/grid/CCol.ts +1 -1
- package/src/components/grid/CContainer.ts +1 -1
- package/src/components/header/CHeader.ts +1 -1
- package/src/components/modal/CModal.ts +1 -0
- package/src/components/multi-select/CMultiSelect.ts +337 -144
- package/src/components/multi-select/CMultiSelectNativeSelect.ts +8 -15
- package/src/components/multi-select/CMultiSelectOptions.ts +32 -39
- package/src/components/multi-select/CMultiSelectSelection.ts +24 -40
- package/src/components/multi-select/types.ts +10 -4
- package/src/components/multi-select/utils.ts +71 -37
- package/src/components/nav/CNavGroup.ts +4 -0
- package/src/components/navbar/CNavbar.ts +1 -1
- package/src/components/navbar/CNavbarBrand.ts +1 -1
- package/src/components/offcanvas/COffcanvas.ts +3 -2
- package/src/components/pagination/CPaginationItem.ts +1 -1
- package/src/components/picker/CPicker.ts +106 -157
- package/src/components/popover/CPopover.ts +18 -2
- package/src/components/props.ts +2 -6
- package/src/components/sidebar/CSidebar.ts +3 -2
- package/src/components/smart-table/CSmartTable.ts +45 -52
- package/src/components/smart-table/CSmartTableBody.ts +5 -3
- package/src/components/smart-table/CSmartTableHead.ts +41 -14
- package/src/components/smart-table/types.ts +13 -0
- package/src/components/smart-table/utils.ts +119 -21
- package/src/components/spinner/CSpinner.ts +4 -2
- package/src/components/table/CTable.ts +19 -18
- package/src/components/table/types.ts +19 -19
- package/src/components/time-picker/CTimePicker.ts +216 -125
- package/src/components/toast/CToast.ts +1 -1
- package/src/components/tooltip/CTooltip.ts +19 -3
- package/src/components/virtual-scroller/CVirtualScroller.ts +10 -8
- package/src/components/widgets/CWidgetStatsA.ts +1 -1
- package/src/components/widgets/CWidgetStatsB.ts +1 -1
- package/src/components/widgets/CWidgetStatsC.ts +1 -1
- package/src/components/widgets/CWidgetStatsE.ts +1 -1
- package/src/components/widgets/CWidgetStatsF.ts +1 -1
- package/src/composables/index.ts +3 -0
- package/src/composables/useColorModes.ts +57 -0
- package/src/directives/index.ts +1 -1
- package/src/directives/v-c-popover.ts +9 -13
- package/src/directives/v-c-tooltip.ts +8 -12
- package/src/directives/v-c-visible.ts +1 -1
- package/src/index.ts +8 -29
- package/src/utils/getUID.ts +9 -0
- package/src/utils/index.ts +4 -1
- package/src/utils/isObjectInArray.ts +14 -0
- package/src/utils/isRTL.ts +13 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent, h, ref, watch } from 'vue'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { CButton } from '../button'
|
|
4
4
|
import { CFormControlWrapper } from '../form/CFormControlWrapper'
|
|
5
5
|
import { CPicker } from '../picker'
|
|
6
6
|
|
|
@@ -133,25 +133,19 @@ const CTimePicker = defineComponent({
|
|
|
133
133
|
*
|
|
134
134
|
* @since 4.6.0
|
|
135
135
|
*/
|
|
136
|
-
feedback:
|
|
137
|
-
type: String,
|
|
138
|
-
},
|
|
136
|
+
feedback: String,
|
|
139
137
|
/**
|
|
140
138
|
* Provide valuable, actionable feedback.
|
|
141
139
|
*
|
|
142
140
|
* @since 4.6.0
|
|
143
141
|
*/
|
|
144
|
-
feedbackInvalid:
|
|
145
|
-
type: String,
|
|
146
|
-
},
|
|
142
|
+
feedbackInvalid: String,
|
|
147
143
|
/**
|
|
148
144
|
* Provide valuable, actionable invalid feedback when using standard HTML form validation which applied two CSS pseudo-classes, `:invalid` and `:valid`.
|
|
149
145
|
*
|
|
150
146
|
* @since 4.6.0
|
|
151
147
|
*/
|
|
152
|
-
feedbackValid:
|
|
153
|
-
type: String,
|
|
154
|
-
},
|
|
148
|
+
feedbackValid: String,
|
|
155
149
|
/**
|
|
156
150
|
* The id global attribute defines an identifier (ID) that must be unique in the whole document.
|
|
157
151
|
*/
|
|
@@ -172,15 +166,16 @@ const CTimePicker = defineComponent({
|
|
|
172
166
|
*
|
|
173
167
|
* @since 4.6.0
|
|
174
168
|
*/
|
|
175
|
-
invalid:
|
|
169
|
+
invalid: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
default: undefined,
|
|
172
|
+
},
|
|
176
173
|
/**
|
|
177
174
|
* Add a caption for a component.
|
|
178
175
|
*
|
|
179
176
|
* @since 4.6.0
|
|
180
177
|
*/
|
|
181
|
-
label:
|
|
182
|
-
type: String,
|
|
183
|
-
},
|
|
178
|
+
label: String,
|
|
184
179
|
/**
|
|
185
180
|
* Sets the default locale for components. If not set, it is inherited from the navigator.language.
|
|
186
181
|
*/
|
|
@@ -195,6 +190,12 @@ const CTimePicker = defineComponent({
|
|
|
195
190
|
type: String,
|
|
196
191
|
default: 'Select time',
|
|
197
192
|
},
|
|
193
|
+
/**
|
|
194
|
+
* When present, it specifies that must be filled out before submitting the form.
|
|
195
|
+
*
|
|
196
|
+
* @since 4.9.0
|
|
197
|
+
*/
|
|
198
|
+
required: Boolean,
|
|
198
199
|
/**
|
|
199
200
|
* Show seconds.
|
|
200
201
|
*
|
|
@@ -221,15 +222,11 @@ const CTimePicker = defineComponent({
|
|
|
221
222
|
*
|
|
222
223
|
* @since 4.6.0
|
|
223
224
|
*/
|
|
224
|
-
text:
|
|
225
|
-
type: String,
|
|
226
|
-
},
|
|
225
|
+
text: String,
|
|
227
226
|
/**
|
|
228
227
|
* Initial selected time.
|
|
229
228
|
*/
|
|
230
|
-
time:
|
|
231
|
-
type: [Date, String],
|
|
232
|
-
},
|
|
229
|
+
time: [Date, String],
|
|
233
230
|
/**
|
|
234
231
|
* Display validation feedback in a styled tooltip.
|
|
235
232
|
*
|
|
@@ -241,7 +238,10 @@ const CTimePicker = defineComponent({
|
|
|
241
238
|
*
|
|
242
239
|
* @since 4.6.0
|
|
243
240
|
*/
|
|
244
|
-
valid:
|
|
241
|
+
valid: {
|
|
242
|
+
type: Boolean,
|
|
243
|
+
default: undefined,
|
|
244
|
+
},
|
|
245
245
|
/**
|
|
246
246
|
* Set the time picker variant to a roll or select.
|
|
247
247
|
*
|
|
@@ -280,6 +280,9 @@ const CTimePicker = defineComponent({
|
|
|
280
280
|
'update:time',
|
|
281
281
|
],
|
|
282
282
|
setup(props, { emit, attrs, slots }) {
|
|
283
|
+
const formRef = ref()
|
|
284
|
+
const inputRef = ref()
|
|
285
|
+
|
|
283
286
|
const date = ref<Date | null>(convertTimeToDate(props.time))
|
|
284
287
|
const ampm = ref<'am' | 'pm'>(date.value ? getAmPm(new Date(date.value), props.locale) : 'am')
|
|
285
288
|
const initialDate = ref<Date | null>(null)
|
|
@@ -290,6 +293,7 @@ const CTimePicker = defineComponent({
|
|
|
290
293
|
listOfSeconds: [],
|
|
291
294
|
hour12: false,
|
|
292
295
|
})
|
|
296
|
+
const isValid = ref(props.valid || (props.invalid && false))
|
|
293
297
|
|
|
294
298
|
watch(
|
|
295
299
|
() => props.time,
|
|
@@ -298,11 +302,38 @@ const CTimePicker = defineComponent({
|
|
|
298
302
|
},
|
|
299
303
|
)
|
|
300
304
|
|
|
301
|
-
watch(
|
|
302
|
-
|
|
305
|
+
watch(
|
|
306
|
+
() => [props.valid, props.invalid],
|
|
307
|
+
() => {
|
|
308
|
+
isValid.value = props.valid || (props.invalid && false)
|
|
309
|
+
},
|
|
310
|
+
)
|
|
303
311
|
|
|
304
|
-
|
|
305
|
-
|
|
312
|
+
watch(
|
|
313
|
+
date,
|
|
314
|
+
() => {
|
|
315
|
+
localizedTimePartials.value = getLocalizedTimePartials(props.locale, props.ampm)
|
|
316
|
+
|
|
317
|
+
if (date.value) {
|
|
318
|
+
ampm.value = getAmPm(new Date(date.value), props.locale)
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
{ immediate: true },
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
watch(inputRef, () => {
|
|
325
|
+
if (inputRef.value && inputRef.value.form) {
|
|
326
|
+
formRef.value = inputRef.value.form
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
watch([formRef, date], () => {
|
|
331
|
+
if (formRef.value) {
|
|
332
|
+
formRef.value.addEventListener('submit', (event: Event) => {
|
|
333
|
+
setTimeout(() => handleFormValidation(event.target as HTMLFormElement))
|
|
334
|
+
})
|
|
335
|
+
|
|
336
|
+
handleFormValidation(formRef.value)
|
|
306
337
|
}
|
|
307
338
|
})
|
|
308
339
|
|
|
@@ -313,6 +344,18 @@ const CTimePicker = defineComponent({
|
|
|
313
344
|
emit('update:time', null)
|
|
314
345
|
}
|
|
315
346
|
|
|
347
|
+
const handleFormValidation = (form: HTMLFormElement) => {
|
|
348
|
+
if (!form.classList.contains('was-validated')) {
|
|
349
|
+
return
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
if (date.value) {
|
|
353
|
+
isValid.value = true
|
|
354
|
+
return
|
|
355
|
+
}
|
|
356
|
+
isValid.value = false
|
|
357
|
+
}
|
|
358
|
+
|
|
316
359
|
const handleTimeChange = (set: 'hours' | 'minutes' | 'seconds' | 'toggle', value: string) => {
|
|
317
360
|
const _date = date.value || new Date('1970-01-01')
|
|
318
361
|
|
|
@@ -328,18 +371,18 @@ const CTimePicker = defineComponent({
|
|
|
328
371
|
|
|
329
372
|
if (set === 'hours') {
|
|
330
373
|
if (localizedTimePartials.value && localizedTimePartials.value.hour12) {
|
|
331
|
-
_date.setHours(convert12hTo24h(ampm.value, parseInt(value)))
|
|
374
|
+
_date.setHours(convert12hTo24h(ampm.value, Number.parseInt(value)))
|
|
332
375
|
} else {
|
|
333
|
-
_date.setHours(parseInt(value))
|
|
376
|
+
_date.setHours(Number.parseInt(value))
|
|
334
377
|
}
|
|
335
378
|
}
|
|
336
379
|
|
|
337
380
|
if (set === 'minutes') {
|
|
338
|
-
_date.setMinutes(parseInt(value))
|
|
381
|
+
_date.setMinutes(Number.parseInt(value))
|
|
339
382
|
}
|
|
340
383
|
|
|
341
384
|
if (set === 'seconds') {
|
|
342
|
-
_date.setSeconds(parseInt(value))
|
|
385
|
+
_date.setSeconds(Number.parseInt(value))
|
|
343
386
|
}
|
|
344
387
|
|
|
345
388
|
date.value = new Date(_date)
|
|
@@ -348,17 +391,20 @@ const CTimePicker = defineComponent({
|
|
|
348
391
|
}
|
|
349
392
|
|
|
350
393
|
const InputGroup = () =>
|
|
351
|
-
h(
|
|
352
|
-
h(
|
|
394
|
+
h('div', { class: 'time-picker-input-group' }, [
|
|
395
|
+
h('input', {
|
|
353
396
|
autocomplete: 'off',
|
|
397
|
+
class: 'time-picker-input',
|
|
354
398
|
disabled: props.disabled,
|
|
355
|
-
onInput: (event) => {
|
|
356
|
-
if (isValidTime(event.target.value)) {
|
|
357
|
-
date.value = convertTimeToDate(event.target.value)
|
|
399
|
+
onInput: (event: Event) => {
|
|
400
|
+
if (isValidTime((event.target as HTMLInputElement).value)) {
|
|
401
|
+
date.value = convertTimeToDate((event.target as HTMLInputElement).value)
|
|
358
402
|
}
|
|
359
403
|
},
|
|
360
404
|
placeholder: props.placeholder,
|
|
361
405
|
readonly: props.inputReadOnly,
|
|
406
|
+
ref: inputRef,
|
|
407
|
+
required: props.required,
|
|
362
408
|
value: date.value
|
|
363
409
|
? date.value.toLocaleTimeString(props.locale, {
|
|
364
410
|
hour12: localizedTimePartials.value && localizedTimePartials.value.hour12,
|
|
@@ -366,90 +412,108 @@ const CTimePicker = defineComponent({
|
|
|
366
412
|
})
|
|
367
413
|
: '',
|
|
368
414
|
}),
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
},
|
|
377
|
-
slots.indicator
|
|
378
|
-
? slots.indicator()
|
|
379
|
-
: h('span', { class: 'picker-input-group-icon time-picker-input-icon' }),
|
|
380
|
-
),
|
|
381
|
-
props.cleaner &&
|
|
382
|
-
h(
|
|
383
|
-
'span',
|
|
384
|
-
{
|
|
385
|
-
class: 'picker-input-group-cleaner',
|
|
386
|
-
onClick: (event: Event) => handleClear(event),
|
|
387
|
-
role: 'button',
|
|
388
|
-
},
|
|
389
|
-
slots.cleaner
|
|
390
|
-
? slots.cleaner()
|
|
391
|
-
: h('span', { class: 'picker-input-group-icon time-picker-cleaner-icon' }),
|
|
392
|
-
),
|
|
393
|
-
]),
|
|
415
|
+
props.indicator && h('div', { class: 'time-picker-indicator' }),
|
|
416
|
+
props.cleaner &&
|
|
417
|
+
date.value &&
|
|
418
|
+
h('div', {
|
|
419
|
+
class: 'time-picker-cleaner',
|
|
420
|
+
onClick: (event: Event) => handleClear(event),
|
|
421
|
+
}),
|
|
394
422
|
])
|
|
395
423
|
|
|
396
424
|
const TimePickerSelect = () => [
|
|
397
425
|
h('span', { class: 'time-picker-inline-icon' }),
|
|
398
|
-
h(
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
localizedTimePartials.value.listOfHours?.map((option) => {
|
|
403
|
-
return {
|
|
404
|
-
value: option.value.toString(),
|
|
405
|
-
label: option.label,
|
|
406
|
-
}
|
|
407
|
-
}),
|
|
408
|
-
onChange: (event) => handleTimeChange('hours', event.target.value),
|
|
409
|
-
...(date.value && { value: getSelectedHour(date.value, props.locale) }),
|
|
410
|
-
}),
|
|
411
|
-
':',
|
|
412
|
-
h(CFormSelect, {
|
|
413
|
-
disabled: props.disabled,
|
|
414
|
-
options:
|
|
415
|
-
localizedTimePartials.value &&
|
|
416
|
-
localizedTimePartials.value.listOfMinutes.map((option) => {
|
|
417
|
-
return {
|
|
418
|
-
value: option.value.toString(),
|
|
419
|
-
label: option.label,
|
|
420
|
-
}
|
|
421
|
-
}),
|
|
422
|
-
onChange: (event: Event) =>
|
|
423
|
-
handleTimeChange('minutes', (event.target as HTMLSelectElement).value),
|
|
424
|
-
...(date.value && { value: getSelectedMinutes(date.value) }),
|
|
425
|
-
}),
|
|
426
|
-
props.seconds && ':',
|
|
427
|
-
props.seconds &&
|
|
428
|
-
h(CFormSelect, {
|
|
426
|
+
h(
|
|
427
|
+
'select',
|
|
428
|
+
{
|
|
429
|
+
class: 'time-picker-inline-select',
|
|
429
430
|
disabled: props.disabled,
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
431
|
+
onChange: (event: Event) =>
|
|
432
|
+
handleTimeChange('hours', (event.target as HTMLSelectElement).value),
|
|
433
|
+
...(date.value && { value: getSelectedHour(date.value, props.locale) }),
|
|
434
|
+
},
|
|
435
|
+
localizedTimePartials.value &&
|
|
436
|
+
localizedTimePartials.value.listOfHours.map((option) =>
|
|
437
|
+
h(
|
|
438
|
+
'option',
|
|
439
|
+
{
|
|
434
440
|
value: option.value.toString(),
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
441
|
+
},
|
|
442
|
+
option.label,
|
|
443
|
+
),
|
|
444
|
+
),
|
|
445
|
+
),
|
|
446
|
+
':',
|
|
447
|
+
h(
|
|
448
|
+
'select',
|
|
449
|
+
{
|
|
450
|
+
class: 'time-picker-inline-select',
|
|
451
|
+
disabled: props.disabled,
|
|
438
452
|
onChange: (event: Event) =>
|
|
439
|
-
handleTimeChange('
|
|
440
|
-
...(date.value && { value:
|
|
441
|
-
}
|
|
453
|
+
handleTimeChange('minutes', (event.target as HTMLSelectElement).value),
|
|
454
|
+
...(date.value && { value: getSelectedMinutes(date.value) }),
|
|
455
|
+
},
|
|
456
|
+
localizedTimePartials.value &&
|
|
457
|
+
localizedTimePartials.value.listOfMinutes?.map((option) =>
|
|
458
|
+
h(
|
|
459
|
+
'option',
|
|
460
|
+
{
|
|
461
|
+
value: option.value.toString(),
|
|
462
|
+
},
|
|
463
|
+
option.label,
|
|
464
|
+
),
|
|
465
|
+
),
|
|
466
|
+
),
|
|
467
|
+
props.seconds && ':',
|
|
468
|
+
props.seconds &&
|
|
469
|
+
h(
|
|
470
|
+
'select',
|
|
471
|
+
{
|
|
472
|
+
class: 'time-picker-inline-select',
|
|
473
|
+
disabled: props.disabled,
|
|
474
|
+
onChange: (event: Event) =>
|
|
475
|
+
handleTimeChange('seconds', (event.target as HTMLSelectElement).value),
|
|
476
|
+
...(date.value && { value: getSelectedSeconds(date.value) }),
|
|
477
|
+
},
|
|
478
|
+
localizedTimePartials.value &&
|
|
479
|
+
localizedTimePartials.value.listOfSeconds?.map((option) =>
|
|
480
|
+
h(
|
|
481
|
+
'option',
|
|
482
|
+
{
|
|
483
|
+
value: option.value.toString(),
|
|
484
|
+
},
|
|
485
|
+
option.label,
|
|
486
|
+
),
|
|
487
|
+
),
|
|
488
|
+
),
|
|
442
489
|
localizedTimePartials.value &&
|
|
443
490
|
localizedTimePartials.value.hour12 &&
|
|
444
|
-
h(
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
491
|
+
h(
|
|
492
|
+
'select',
|
|
493
|
+
{
|
|
494
|
+
class: 'time-picker-inline-select',
|
|
495
|
+
disabled: props.disabled,
|
|
496
|
+
onChange: (event: Event) =>
|
|
497
|
+
handleTimeChange('toggle', (event.target as HTMLSelectElement).value),
|
|
498
|
+
value: ampm.value,
|
|
499
|
+
},
|
|
500
|
+
[
|
|
501
|
+
h(
|
|
502
|
+
'option',
|
|
503
|
+
{
|
|
504
|
+
value: 'am',
|
|
505
|
+
},
|
|
506
|
+
'AM',
|
|
507
|
+
),
|
|
508
|
+
h(
|
|
509
|
+
'option',
|
|
510
|
+
{
|
|
511
|
+
value: 'pm',
|
|
512
|
+
},
|
|
513
|
+
'PM',
|
|
514
|
+
),
|
|
449
515
|
],
|
|
450
|
-
|
|
451
|
-
value: ampm.value,
|
|
452
|
-
}),
|
|
516
|
+
),
|
|
453
517
|
]
|
|
454
518
|
|
|
455
519
|
const TimePickerRoll = () => [
|
|
@@ -490,35 +554,30 @@ const CTimePicker = defineComponent({
|
|
|
490
554
|
feedbackInvalid: props.feedbackInvalid,
|
|
491
555
|
feedbackValid: props.feedbackValid,
|
|
492
556
|
id: props.id,
|
|
493
|
-
invalid:
|
|
557
|
+
invalid: isValid.value === false ? true : false,
|
|
494
558
|
label: props.label,
|
|
495
559
|
text: props.text,
|
|
496
560
|
tooltipFeedback: props.tooltipFeedback,
|
|
497
|
-
valid:
|
|
561
|
+
valid: isValid.value,
|
|
498
562
|
},
|
|
499
563
|
{
|
|
500
564
|
default: () =>
|
|
501
565
|
h(
|
|
502
566
|
CPicker,
|
|
503
567
|
{
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
568
|
+
class: [
|
|
569
|
+
'time-picker',
|
|
570
|
+
{
|
|
571
|
+
[`time-picker-${props.size}`]: props.size,
|
|
572
|
+
disabled: props.disabled,
|
|
573
|
+
'is-invalid': isValid.value === false ? true : false,
|
|
574
|
+
'is-valid': isValid.value,
|
|
575
|
+
},
|
|
576
|
+
],
|
|
513
577
|
container: props.container,
|
|
514
578
|
disabled: props.disabled,
|
|
579
|
+
dropdownClassNames: 'time-picker-dropdown',
|
|
515
580
|
footer: true,
|
|
516
|
-
onCancel: () => {
|
|
517
|
-
if (initialDate.value) {
|
|
518
|
-
date.value = new Date(initialDate.value)
|
|
519
|
-
}
|
|
520
|
-
visible.value = false
|
|
521
|
-
},
|
|
522
581
|
onHide: () => {
|
|
523
582
|
visible.value = false
|
|
524
583
|
emit('hide')
|
|
@@ -554,6 +613,38 @@ const CTimePicker = defineComponent({
|
|
|
554
613
|
},
|
|
555
614
|
props.variant === 'select' ? TimePickerSelect() : TimePickerRoll(),
|
|
556
615
|
),
|
|
616
|
+
footer: () =>
|
|
617
|
+
h('div', { class: 'time-picker-footer' }, [
|
|
618
|
+
props.cancelButton &&
|
|
619
|
+
h(
|
|
620
|
+
CButton,
|
|
621
|
+
{
|
|
622
|
+
color: props.cancelButtonColor,
|
|
623
|
+
onClick: () => {
|
|
624
|
+
if (initialDate.value) {
|
|
625
|
+
date.value = new Date(initialDate.value)
|
|
626
|
+
}
|
|
627
|
+
visible.value = false
|
|
628
|
+
},
|
|
629
|
+
size: props.cancelButtonSize,
|
|
630
|
+
variant: props.cancelButtonVariant,
|
|
631
|
+
},
|
|
632
|
+
() => props.cancelButton,
|
|
633
|
+
),
|
|
634
|
+
props.confirmButton &&
|
|
635
|
+
h(
|
|
636
|
+
CButton,
|
|
637
|
+
{
|
|
638
|
+
color: props.confirmButtonColor,
|
|
639
|
+
onClick: () => {
|
|
640
|
+
visible.value = false
|
|
641
|
+
},
|
|
642
|
+
size: props.confirmButtonSize,
|
|
643
|
+
variant: props.confirmButtonVariant,
|
|
644
|
+
},
|
|
645
|
+
() => props.confirmButton,
|
|
646
|
+
),
|
|
647
|
+
]),
|
|
557
648
|
},
|
|
558
649
|
),
|
|
559
650
|
},
|
|
@@ -2,6 +2,21 @@ import { defineComponent, h, PropType, ref, RendererElement, Teleport, Transitio
|
|
|
2
2
|
import { createPopper, Placement } from '@popperjs/core'
|
|
3
3
|
|
|
4
4
|
import { executeAfterTransition } from '../../utils/transition'
|
|
5
|
+
import { isRTL } from '../../utils'
|
|
6
|
+
|
|
7
|
+
const getPlacement = (placement: string, element: HTMLDivElement | null): Placement => {
|
|
8
|
+
switch (placement) {
|
|
9
|
+
case 'right': {
|
|
10
|
+
return isRTL(element) ? 'left' : 'right'
|
|
11
|
+
}
|
|
12
|
+
case 'left': {
|
|
13
|
+
return isRTL(element) ? 'right' : 'left'
|
|
14
|
+
}
|
|
15
|
+
default: {
|
|
16
|
+
return placement as Placement
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
5
20
|
|
|
6
21
|
const CTooltip = defineComponent({
|
|
7
22
|
name: 'CTooltip',
|
|
@@ -15,7 +30,7 @@ const CTooltip = defineComponent({
|
|
|
15
30
|
*/
|
|
16
31
|
offset: {
|
|
17
32
|
type: Array,
|
|
18
|
-
default: () => [0,
|
|
33
|
+
default: () => [0, 6],
|
|
19
34
|
},
|
|
20
35
|
/**
|
|
21
36
|
* Describes the placement of your component after Popper.js has applied all the modifiers that may have flipped or altered the originally provided placement property.
|
|
@@ -60,7 +75,7 @@ const CTooltip = defineComponent({
|
|
|
60
75
|
*/
|
|
61
76
|
'show',
|
|
62
77
|
],
|
|
63
|
-
setup(props, { slots, emit }) {
|
|
78
|
+
setup(props, { attrs, slots, emit }) {
|
|
64
79
|
const togglerRef = ref()
|
|
65
80
|
const tooltipRef = ref()
|
|
66
81
|
const popper = ref()
|
|
@@ -90,7 +105,7 @@ const CTooltip = defineComponent({
|
|
|
90
105
|
const initPopper = () => {
|
|
91
106
|
if (togglerRef.value) {
|
|
92
107
|
popper.value = createPopper(togglerRef.value, tooltipRef.value, {
|
|
93
|
-
placement: props.placement,
|
|
108
|
+
placement: getPlacement(props.placement, togglerRef.value),
|
|
94
109
|
modifiers: [
|
|
95
110
|
{
|
|
96
111
|
name: 'offset',
|
|
@@ -130,6 +145,7 @@ const CTooltip = defineComponent({
|
|
|
130
145
|
class: 'tooltip fade bs-tooltip-auto',
|
|
131
146
|
ref: tooltipRef,
|
|
132
147
|
role: 'tooltip',
|
|
148
|
+
...attrs,
|
|
133
149
|
},
|
|
134
150
|
[
|
|
135
151
|
h('div', { class: 'tooltip-arrow', 'data-popper-arrow': '' }),
|
|
@@ -27,12 +27,16 @@ const CVirtualScroller = defineComponent({
|
|
|
27
27
|
)
|
|
28
28
|
|
|
29
29
|
const viewportHeight = computed(
|
|
30
|
-
() =>
|
|
30
|
+
() =>
|
|
31
|
+
Math.min(props.visibleItems, itemsNumber.value) * itemHeight.value +
|
|
32
|
+
2 * viewportPadding.value,
|
|
31
33
|
)
|
|
32
34
|
|
|
33
35
|
onMounted(() => {
|
|
34
36
|
if (virtualScrollRef.value) {
|
|
35
|
-
viewportPadding.value = parseFloat(
|
|
37
|
+
viewportPadding.value = Number.parseFloat(
|
|
38
|
+
getComputedStyle(virtualScrollRef.value).paddingTop,
|
|
39
|
+
)
|
|
36
40
|
// It's necessary to calculate heights of items
|
|
37
41
|
virtualScrollRef.value.dispatchEvent(new CustomEvent('scroll'))
|
|
38
42
|
}
|
|
@@ -49,16 +53,14 @@ const CVirtualScroller = defineComponent({
|
|
|
49
53
|
? slots.default()[0].children
|
|
50
54
|
: slots.default()
|
|
51
55
|
: []
|
|
52
|
-
itemsNumber.value = children && children.length ? children.length : 0
|
|
56
|
+
itemsNumber.value = children && children.length > 0 ? children.length : 0
|
|
53
57
|
return h(
|
|
54
58
|
'div',
|
|
55
59
|
{
|
|
56
60
|
class: ['virtual-scroller'],
|
|
57
61
|
onScroll: (event: any) => handleScroll((event.target as HTMLDivElement).scrollTop),
|
|
58
62
|
style: {
|
|
59
|
-
height: `${
|
|
60
|
-
maxHeight.value > viewportHeight.value ? viewportHeight.value : maxHeight.value
|
|
61
|
-
}px`,
|
|
63
|
+
height: `${viewportHeight.value}px`,
|
|
62
64
|
overflowY: 'auto',
|
|
63
65
|
},
|
|
64
66
|
ref: virtualScrollRef,
|
|
@@ -95,8 +97,8 @@ const CVirtualScroller = defineComponent({
|
|
|
95
97
|
if (node && (node as HTMLElement).offsetHeight) {
|
|
96
98
|
itemHeight.value =
|
|
97
99
|
(node as HTMLElement).offsetHeight +
|
|
98
|
-
parseFloat(getComputedStyle(node as HTMLElement).marginTop) +
|
|
99
|
-
parseFloat(getComputedStyle(node as HTMLElement).marginBottom)
|
|
100
|
+
Number.parseFloat(getComputedStyle(node as HTMLElement).marginTop) +
|
|
101
|
+
Number.parseFloat(getComputedStyle(node as HTMLElement).marginBottom)
|
|
100
102
|
}
|
|
101
103
|
},
|
|
102
104
|
}),
|