origam 2.38.1 → 2.38.2
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/CHANGELOG.md +24 -0
- package/dist/src/assets/locales/en.json +1 -1
- package/dist/src/assets/locales/fr.json +2 -2
- package/dist/src/components/Alert/OrigamAlert.vue +739 -165
- package/dist/src/components/App/OrigamApp.vue +95 -19
- package/dist/src/components/App/OrigamAppBar.vue +751 -158
- package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
- package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
- package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
- package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
- package/dist/src/components/Badge/OrigamBadge.vue +548 -135
- package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
- package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
- package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
- package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
- package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
- package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
- package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
- package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
- package/dist/src/components/Btn/OrigamBtn.vue +928 -249
- package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
- package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
- package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
- package/dist/src/components/Card/OrigamCard.vue +938 -194
- package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
- package/dist/src/components/Card/OrigamCardText.vue +536 -84
- package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
- package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
- package/dist/src/components/Chart/OrigamChart.vue +942 -452
- package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
- package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
- package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
- package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
- package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
- package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
- package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
- package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
- package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
- package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
- package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
- package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
- package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
- package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
- package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
- package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
- package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
- package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
- package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
- package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
- package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
- package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
- package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
- package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
- package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
- package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
- package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
- package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
- package/dist/src/components/Chip/OrigamChip.vue +867 -202
- package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
- package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
- package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
- package/dist/src/components/Code/OrigamCode.vue +844 -206
- package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
- package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
- package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
- package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
- package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
- package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
- package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
- package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
- package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
- package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
- package/dist/src/components/Counter/OrigamCounter.vue +588 -96
- package/dist/src/components/DataList/OrigamDataList.vue +619 -113
- package/dist/src/components/DataList/OrigamDataText.vue +295 -65
- package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
- package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
- package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
- package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
- package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
- package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
- package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
- package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
- package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
- package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
- package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
- package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
- package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
- package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
- package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
- package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
- package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
- package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
- package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
- package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
- package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
- package/dist/src/components/Divider/OrigamDivider.vue +210 -50
- package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
- package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
- package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
- package/dist/src/components/Field/OrigamField.vue +1118 -306
- package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
- package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
- package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
- package/dist/src/components/Form/OrigamForm.vue +197 -74
- package/dist/src/components/Grid/OrigamGrid.vue +707 -147
- package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
- package/dist/src/components/Grids/OrigamCol.vue +593 -110
- package/dist/src/components/Grids/OrigamContainer.vue +461 -80
- package/dist/src/components/Grids/OrigamRow.vue +573 -112
- package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
- package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
- package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
- package/dist/src/components/Icon/OrigamIcon.vue +561 -98
- package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
- package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
- package/dist/src/components/Img/OrigamImg.vue +869 -228
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
- package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
- package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
- package/dist/src/components/Input/OrigamInput.vue +747 -180
- package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
- package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
- package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
- package/dist/src/components/Label/OrigamLabel.vue +584 -95
- package/dist/src/components/Layout/OrigamLayout.vue +563 -94
- package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
- package/dist/src/components/List/OrigamList.vue +755 -170
- package/dist/src/components/List/OrigamListChildren.vue +59 -19
- package/dist/src/components/List/OrigamListGroup.vue +631 -134
- package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
- package/dist/src/components/List/OrigamListItem.vue +890 -224
- package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
- package/dist/src/components/List/OrigamListSubheader.vue +542 -93
- package/dist/src/components/Loader/OrigamLoader.vue +110 -25
- package/dist/src/components/Main/OrigamMain.vue +565 -96
- package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
- package/dist/src/components/Media/OrigamMediaController.vue +465 -182
- package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
- package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
- package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
- package/dist/src/components/Messages/OrigamMessages.vue +606 -97
- package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
- package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
- package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
- package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
- package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
- package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
- package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
- package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
- package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
- package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
- package/dist/src/components/Picker/OrigamPicker.vue +655 -108
- package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
- package/dist/src/components/Progress/OrigamProgress.vue +436 -70
- package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
- package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
- package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
- package/dist/src/components/Radio/OrigamRadio.vue +772 -132
- package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
- package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
- package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
- package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
- package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
- package/dist/src/components/Select/OrigamSelect.vue +1639 -567
- package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
- package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
- package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
- package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
- package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
- package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
- package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
- package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
- package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
- package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
- package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
- package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
- package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
- package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
- package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
- package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
- package/dist/src/components/Table/OrigamTable.vue +585 -124
- package/dist/src/components/Tabs/OrigamTab.vue +239 -73
- package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
- package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
- package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
- package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
- package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
- package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
- package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
- package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
- package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
- package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
- package/dist/src/components/Title/OrigamTitle.vue +505 -82
- package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
- package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
- package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
- package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
- package/dist/src/components/Transition/OrigamFade.vue +47 -9
- package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
- package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
- package/dist/src/components/Transition/OrigamSnack.vue +52 -10
- package/dist/src/components/Transition/OrigamTransition.vue +40 -12
- package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
- package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
- package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
- package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
- package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
- package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
- package/dist/src/components/Video/OrigamVideo.vue +1178 -331
- package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
- package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
- package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
- package/dist/src/components/Window/OrigamWindow.vue +745 -175
- package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
- package/dist/src/composables/Commons/display.composable.cjs +2 -0
- package/dist/src/composables/Commons/display.composable.js +1 -1
- package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
- package/package.json +6 -6
|
@@ -341,12 +341,7 @@
|
|
|
341
341
|
</template>
|
|
342
342
|
|
|
343
343
|
<script lang="ts" setup>
|
|
344
|
-
import {
|
|
345
|
-
computed,
|
|
346
|
-
nextTick,
|
|
347
|
-
ref,
|
|
348
|
-
watch
|
|
349
|
-
} from "vue";
|
|
344
|
+
import { computed, nextTick, ref, watch } from "vue";
|
|
350
345
|
import OrigamBtn from "../Btn/OrigamBtn.vue";
|
|
351
346
|
import OrigamBtnGroup from "../Btn/OrigamBtnGroup.vue";
|
|
352
347
|
import { CALENDAR_NAVIGATE, CALENDAR_VIEW } from "../../enums/Calendar/calendar.enum";
|
|
@@ -359,127 +354,644 @@ import { useDensity } from "../../composables/Commons/density.composable";
|
|
|
359
354
|
import { useDimension } from "../../composables/Commons/dimension.composable";
|
|
360
355
|
import { useLocale } from "../../composables/Commons/locale.composable";
|
|
361
356
|
import { useStateEffect } from "../../composables/Commons/stateEffect.composable";
|
|
362
|
-
import {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
formatDate,
|
|
373
|
-
formatTime,
|
|
374
|
-
getWeekdayNames,
|
|
375
|
-
isAfter,
|
|
376
|
-
isBefore,
|
|
377
|
-
isoWeekNumber,
|
|
378
|
-
isPast,
|
|
379
|
-
isSameDay,
|
|
380
|
-
isToday,
|
|
381
|
-
isWeekend,
|
|
382
|
-
startOfDay,
|
|
383
|
-
toDate
|
|
384
|
-
} from "../../utils/Calendar/date.util";
|
|
357
|
+
import { getForeground, isCssColor, isIntent, parseColor, tokenForegroundForIntent, tokenStylesForIntent } from "../../utils/Commons/color.util";
|
|
358
|
+
import { buildDisabledPredicate, formatDate, formatTime, getWeekdayNames, isAfter, isBefore, isoWeekNumber, isPast, isSameDay, isToday, isWeekend, startOfDay, toDate } from "../../utils/Calendar/date.util";
|
|
359
|
+
/*********************************************************
|
|
360
|
+
* Global — `<OrigamCalendar>` props + defaults.
|
|
361
|
+
*
|
|
362
|
+
* Defaults are inlined here (no `CALENDAR_DEFAULTS.*` indirection)
|
|
363
|
+
* because the Vue SFC compiler analyses `withDefaults` statically
|
|
364
|
+
* and only resolves literals — cf. CLAUDE.md "withDefaults() —
|
|
365
|
+
* inline literals only" rule.
|
|
366
|
+
********************************************************/
|
|
385
367
|
const props = defineProps({
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
368
|
+
view: {
|
|
369
|
+
type: null,
|
|
370
|
+
required: false,
|
|
371
|
+
default: "month"
|
|
372
|
+
},
|
|
373
|
+
currentDate: {
|
|
374
|
+
type: [Date, String],
|
|
375
|
+
required: false,
|
|
376
|
+
default: () => new Date()
|
|
377
|
+
},
|
|
378
|
+
events: {
|
|
379
|
+
type: Array,
|
|
380
|
+
required: false,
|
|
381
|
+
default: () => []
|
|
382
|
+
},
|
|
383
|
+
firstDayOfWeek: {
|
|
384
|
+
type: Number,
|
|
385
|
+
required: false,
|
|
386
|
+
default: 1
|
|
387
|
+
},
|
|
388
|
+
timeFormat: {
|
|
389
|
+
type: null,
|
|
390
|
+
required: false,
|
|
391
|
+
default: "24h"
|
|
392
|
+
},
|
|
393
|
+
locale: {
|
|
394
|
+
type: String,
|
|
395
|
+
required: false,
|
|
396
|
+
default: undefined
|
|
397
|
+
},
|
|
398
|
+
selectable: {
|
|
399
|
+
type: Boolean,
|
|
400
|
+
required: false,
|
|
401
|
+
default: true
|
|
402
|
+
},
|
|
403
|
+
eventColorKey: {
|
|
404
|
+
type: String,
|
|
405
|
+
required: false,
|
|
406
|
+
default: "category"
|
|
407
|
+
},
|
|
408
|
+
categoryColors: {
|
|
409
|
+
type: Object,
|
|
410
|
+
required: false,
|
|
411
|
+
default: () => ({})
|
|
412
|
+
},
|
|
413
|
+
weekendHighlight: {
|
|
414
|
+
type: Boolean,
|
|
415
|
+
required: false,
|
|
416
|
+
default: true
|
|
417
|
+
},
|
|
418
|
+
showWeekNumbers: {
|
|
419
|
+
type: Boolean,
|
|
420
|
+
required: false,
|
|
421
|
+
default: false
|
|
422
|
+
},
|
|
423
|
+
dayStartHour: {
|
|
424
|
+
type: Number,
|
|
425
|
+
required: false,
|
|
426
|
+
default: 0
|
|
427
|
+
},
|
|
428
|
+
dayEndHour: {
|
|
429
|
+
type: Number,
|
|
430
|
+
required: false,
|
|
431
|
+
default: 24
|
|
432
|
+
},
|
|
433
|
+
slotDuration: {
|
|
434
|
+
type: Number,
|
|
435
|
+
required: false,
|
|
436
|
+
default: 30
|
|
437
|
+
},
|
|
438
|
+
minDate: {
|
|
439
|
+
type: [Date, String],
|
|
440
|
+
required: false,
|
|
441
|
+
default: undefined
|
|
442
|
+
},
|
|
443
|
+
maxDate: {
|
|
444
|
+
type: [Date, String],
|
|
445
|
+
required: false,
|
|
446
|
+
default: undefined
|
|
447
|
+
},
|
|
448
|
+
disabledDates: {
|
|
449
|
+
type: [Array, Function],
|
|
450
|
+
required: false,
|
|
451
|
+
default: undefined
|
|
452
|
+
},
|
|
453
|
+
id: {
|
|
454
|
+
type: String,
|
|
455
|
+
required: false
|
|
456
|
+
},
|
|
457
|
+
class: {
|
|
458
|
+
type: [
|
|
459
|
+
String,
|
|
460
|
+
Array,
|
|
461
|
+
Object
|
|
462
|
+
],
|
|
463
|
+
required: false
|
|
464
|
+
},
|
|
465
|
+
style: {
|
|
466
|
+
type: [
|
|
467
|
+
String,
|
|
468
|
+
Array,
|
|
469
|
+
Object,
|
|
470
|
+
Boolean,
|
|
471
|
+
null
|
|
472
|
+
],
|
|
473
|
+
required: false,
|
|
474
|
+
skipCheck: true
|
|
475
|
+
},
|
|
476
|
+
color: {
|
|
477
|
+
type: [
|
|
478
|
+
String,
|
|
479
|
+
Object,
|
|
480
|
+
Boolean,
|
|
481
|
+
null
|
|
482
|
+
],
|
|
483
|
+
required: false,
|
|
484
|
+
skipCheck: true
|
|
485
|
+
},
|
|
486
|
+
bgColor: {
|
|
487
|
+
type: [
|
|
488
|
+
String,
|
|
489
|
+
Object,
|
|
490
|
+
Boolean,
|
|
491
|
+
null
|
|
492
|
+
],
|
|
493
|
+
required: false,
|
|
494
|
+
skipCheck: true
|
|
495
|
+
},
|
|
496
|
+
rounded: {
|
|
497
|
+
type: [
|
|
498
|
+
Boolean,
|
|
499
|
+
Number,
|
|
500
|
+
String,
|
|
501
|
+
null
|
|
502
|
+
],
|
|
503
|
+
required: false,
|
|
504
|
+
skipCheck: true
|
|
505
|
+
},
|
|
506
|
+
roundedTopRight: {
|
|
507
|
+
type: [
|
|
508
|
+
Boolean,
|
|
509
|
+
Number,
|
|
510
|
+
String
|
|
511
|
+
],
|
|
512
|
+
required: false
|
|
513
|
+
},
|
|
514
|
+
roundedTopLeft: {
|
|
515
|
+
type: [
|
|
516
|
+
Boolean,
|
|
517
|
+
Number,
|
|
518
|
+
String
|
|
519
|
+
],
|
|
520
|
+
required: false
|
|
521
|
+
},
|
|
522
|
+
roundedBottomLeft: {
|
|
523
|
+
type: [
|
|
524
|
+
Boolean,
|
|
525
|
+
Number,
|
|
526
|
+
String
|
|
527
|
+
],
|
|
528
|
+
required: false
|
|
529
|
+
},
|
|
530
|
+
roundedBottomRight: {
|
|
531
|
+
type: [
|
|
532
|
+
Boolean,
|
|
533
|
+
Number,
|
|
534
|
+
String
|
|
535
|
+
],
|
|
536
|
+
required: false
|
|
537
|
+
},
|
|
538
|
+
roundedStartStart: {
|
|
539
|
+
type: [
|
|
540
|
+
Boolean,
|
|
541
|
+
Number,
|
|
542
|
+
String
|
|
543
|
+
],
|
|
544
|
+
required: false
|
|
545
|
+
},
|
|
546
|
+
roundedStartEnd: {
|
|
547
|
+
type: [
|
|
548
|
+
Boolean,
|
|
549
|
+
Number,
|
|
550
|
+
String
|
|
551
|
+
],
|
|
552
|
+
required: false
|
|
553
|
+
},
|
|
554
|
+
roundedEndStart: {
|
|
555
|
+
type: [
|
|
556
|
+
Boolean,
|
|
557
|
+
Number,
|
|
558
|
+
String
|
|
559
|
+
],
|
|
560
|
+
required: false
|
|
561
|
+
},
|
|
562
|
+
roundedEndEnd: {
|
|
563
|
+
type: [
|
|
564
|
+
Boolean,
|
|
565
|
+
Number,
|
|
566
|
+
String
|
|
567
|
+
],
|
|
568
|
+
required: false
|
|
569
|
+
},
|
|
570
|
+
elevation: {
|
|
571
|
+
type: [Number, String],
|
|
572
|
+
required: false
|
|
573
|
+
},
|
|
574
|
+
border: {
|
|
575
|
+
type: [
|
|
576
|
+
Boolean,
|
|
577
|
+
Number,
|
|
578
|
+
String,
|
|
579
|
+
Array
|
|
580
|
+
],
|
|
581
|
+
required: false,
|
|
582
|
+
skipCheck: true
|
|
583
|
+
},
|
|
584
|
+
borderTop: {
|
|
585
|
+
type: [
|
|
586
|
+
Boolean,
|
|
587
|
+
Number,
|
|
588
|
+
String
|
|
589
|
+
],
|
|
590
|
+
required: false
|
|
591
|
+
},
|
|
592
|
+
borderLeft: {
|
|
593
|
+
type: [
|
|
594
|
+
Boolean,
|
|
595
|
+
Number,
|
|
596
|
+
String
|
|
597
|
+
],
|
|
598
|
+
required: false
|
|
599
|
+
},
|
|
600
|
+
borderBottom: {
|
|
601
|
+
type: [
|
|
602
|
+
Boolean,
|
|
603
|
+
Number,
|
|
604
|
+
String
|
|
605
|
+
],
|
|
606
|
+
required: false
|
|
607
|
+
},
|
|
608
|
+
borderRight: {
|
|
609
|
+
type: [
|
|
610
|
+
Boolean,
|
|
611
|
+
Number,
|
|
612
|
+
String
|
|
613
|
+
],
|
|
614
|
+
required: false
|
|
615
|
+
},
|
|
616
|
+
borderBlock: {
|
|
617
|
+
type: [
|
|
618
|
+
Boolean,
|
|
619
|
+
Number,
|
|
620
|
+
String
|
|
621
|
+
],
|
|
622
|
+
required: false
|
|
623
|
+
},
|
|
624
|
+
borderInline: {
|
|
625
|
+
type: [
|
|
626
|
+
Boolean,
|
|
627
|
+
Number,
|
|
628
|
+
String
|
|
629
|
+
],
|
|
630
|
+
required: false
|
|
631
|
+
},
|
|
632
|
+
borderInlineStart: {
|
|
633
|
+
type: [
|
|
634
|
+
Boolean,
|
|
635
|
+
Number,
|
|
636
|
+
String
|
|
637
|
+
],
|
|
638
|
+
required: false
|
|
639
|
+
},
|
|
640
|
+
borderInlineEnd: {
|
|
641
|
+
type: [
|
|
642
|
+
Boolean,
|
|
643
|
+
Number,
|
|
644
|
+
String
|
|
645
|
+
],
|
|
646
|
+
required: false
|
|
647
|
+
},
|
|
648
|
+
borderBlockStart: {
|
|
649
|
+
type: [
|
|
650
|
+
Boolean,
|
|
651
|
+
Number,
|
|
652
|
+
String
|
|
653
|
+
],
|
|
654
|
+
required: false
|
|
655
|
+
},
|
|
656
|
+
borderBlockEnd: {
|
|
657
|
+
type: [
|
|
658
|
+
Boolean,
|
|
659
|
+
Number,
|
|
660
|
+
String
|
|
661
|
+
],
|
|
662
|
+
required: false
|
|
663
|
+
},
|
|
664
|
+
borderColor: {
|
|
665
|
+
type: String,
|
|
666
|
+
required: false
|
|
667
|
+
},
|
|
668
|
+
borderStyle: {
|
|
669
|
+
type: String,
|
|
670
|
+
required: false
|
|
671
|
+
},
|
|
672
|
+
borderTopColor: {
|
|
673
|
+
type: [
|
|
674
|
+
String,
|
|
675
|
+
Object,
|
|
676
|
+
Boolean,
|
|
677
|
+
null
|
|
678
|
+
],
|
|
679
|
+
required: false,
|
|
680
|
+
skipCheck: true
|
|
681
|
+
},
|
|
682
|
+
borderRightColor: {
|
|
683
|
+
type: [
|
|
684
|
+
String,
|
|
685
|
+
Object,
|
|
686
|
+
Boolean,
|
|
687
|
+
null
|
|
688
|
+
],
|
|
689
|
+
required: false,
|
|
690
|
+
skipCheck: true
|
|
691
|
+
},
|
|
692
|
+
borderBottomColor: {
|
|
693
|
+
type: [
|
|
694
|
+
String,
|
|
695
|
+
Object,
|
|
696
|
+
Boolean,
|
|
697
|
+
null
|
|
698
|
+
],
|
|
699
|
+
required: false,
|
|
700
|
+
skipCheck: true
|
|
701
|
+
},
|
|
702
|
+
borderLeftColor: {
|
|
703
|
+
type: [
|
|
704
|
+
String,
|
|
705
|
+
Object,
|
|
706
|
+
Boolean,
|
|
707
|
+
null
|
|
708
|
+
],
|
|
709
|
+
required: false,
|
|
710
|
+
skipCheck: true
|
|
711
|
+
},
|
|
712
|
+
borderInlineStartColor: {
|
|
713
|
+
type: [
|
|
714
|
+
String,
|
|
715
|
+
Object,
|
|
716
|
+
Boolean,
|
|
717
|
+
null
|
|
718
|
+
],
|
|
719
|
+
required: false,
|
|
720
|
+
skipCheck: true
|
|
721
|
+
},
|
|
722
|
+
borderInlineEndColor: {
|
|
723
|
+
type: [
|
|
724
|
+
String,
|
|
725
|
+
Object,
|
|
726
|
+
Boolean,
|
|
727
|
+
null
|
|
728
|
+
],
|
|
729
|
+
required: false,
|
|
730
|
+
skipCheck: true
|
|
731
|
+
},
|
|
732
|
+
borderBlockStartColor: {
|
|
733
|
+
type: [
|
|
734
|
+
String,
|
|
735
|
+
Object,
|
|
736
|
+
Boolean,
|
|
737
|
+
null
|
|
738
|
+
],
|
|
739
|
+
required: false,
|
|
740
|
+
skipCheck: true
|
|
741
|
+
},
|
|
742
|
+
borderBlockEndColor: {
|
|
743
|
+
type: [
|
|
744
|
+
String,
|
|
745
|
+
Object,
|
|
746
|
+
Boolean,
|
|
747
|
+
null
|
|
748
|
+
],
|
|
749
|
+
required: false,
|
|
750
|
+
skipCheck: true
|
|
751
|
+
},
|
|
752
|
+
density: {
|
|
753
|
+
type: null,
|
|
754
|
+
required: false
|
|
755
|
+
},
|
|
756
|
+
height: {
|
|
757
|
+
type: [Number, String],
|
|
758
|
+
required: false
|
|
759
|
+
},
|
|
760
|
+
maxHeight: {
|
|
761
|
+
type: [Number, String],
|
|
762
|
+
required: false
|
|
763
|
+
},
|
|
764
|
+
maxWidth: {
|
|
765
|
+
type: [Number, String],
|
|
766
|
+
required: false
|
|
767
|
+
},
|
|
768
|
+
minHeight: {
|
|
769
|
+
type: [Number, String],
|
|
770
|
+
required: false
|
|
771
|
+
},
|
|
772
|
+
minWidth: {
|
|
773
|
+
type: [Number, String],
|
|
774
|
+
required: false
|
|
775
|
+
},
|
|
776
|
+
width: {
|
|
777
|
+
type: [Number, String],
|
|
778
|
+
required: false
|
|
779
|
+
},
|
|
780
|
+
padding: {
|
|
781
|
+
type: [
|
|
782
|
+
Boolean,
|
|
783
|
+
Number,
|
|
784
|
+
String
|
|
785
|
+
],
|
|
786
|
+
required: false
|
|
787
|
+
},
|
|
788
|
+
paddingTop: {
|
|
789
|
+
type: [
|
|
790
|
+
Boolean,
|
|
791
|
+
Number,
|
|
792
|
+
String
|
|
793
|
+
],
|
|
794
|
+
required: false
|
|
795
|
+
},
|
|
796
|
+
paddingLeft: {
|
|
797
|
+
type: [
|
|
798
|
+
Boolean,
|
|
799
|
+
Number,
|
|
800
|
+
String
|
|
801
|
+
],
|
|
802
|
+
required: false
|
|
803
|
+
},
|
|
804
|
+
paddingBottom: {
|
|
805
|
+
type: [
|
|
806
|
+
Boolean,
|
|
807
|
+
Number,
|
|
808
|
+
String
|
|
809
|
+
],
|
|
810
|
+
required: false
|
|
811
|
+
},
|
|
812
|
+
paddingRight: {
|
|
813
|
+
type: [
|
|
814
|
+
Boolean,
|
|
815
|
+
Number,
|
|
816
|
+
String
|
|
817
|
+
],
|
|
818
|
+
required: false
|
|
819
|
+
},
|
|
820
|
+
paddingBlock: {
|
|
821
|
+
type: [
|
|
822
|
+
Boolean,
|
|
823
|
+
Number,
|
|
824
|
+
String
|
|
825
|
+
],
|
|
826
|
+
required: false
|
|
827
|
+
},
|
|
828
|
+
paddingInline: {
|
|
829
|
+
type: [
|
|
830
|
+
Boolean,
|
|
831
|
+
Number,
|
|
832
|
+
String
|
|
833
|
+
],
|
|
834
|
+
required: false
|
|
835
|
+
},
|
|
836
|
+
paddingInlineStart: {
|
|
837
|
+
type: [
|
|
838
|
+
Boolean,
|
|
839
|
+
Number,
|
|
840
|
+
String
|
|
841
|
+
],
|
|
842
|
+
required: false
|
|
843
|
+
},
|
|
844
|
+
paddingInlineEnd: {
|
|
845
|
+
type: [
|
|
846
|
+
Boolean,
|
|
847
|
+
Number,
|
|
848
|
+
String
|
|
849
|
+
],
|
|
850
|
+
required: false
|
|
851
|
+
},
|
|
852
|
+
paddingBlockStart: {
|
|
853
|
+
type: [
|
|
854
|
+
Boolean,
|
|
855
|
+
Number,
|
|
856
|
+
String
|
|
857
|
+
],
|
|
858
|
+
required: false
|
|
859
|
+
},
|
|
860
|
+
paddingBlockEnd: {
|
|
861
|
+
type: [
|
|
862
|
+
Boolean,
|
|
863
|
+
Number,
|
|
864
|
+
String
|
|
865
|
+
],
|
|
866
|
+
required: false
|
|
867
|
+
},
|
|
868
|
+
margin: {
|
|
869
|
+
type: [
|
|
870
|
+
Boolean,
|
|
871
|
+
Number,
|
|
872
|
+
String
|
|
873
|
+
],
|
|
874
|
+
required: false
|
|
875
|
+
},
|
|
876
|
+
marginTop: {
|
|
877
|
+
type: [
|
|
878
|
+
Boolean,
|
|
879
|
+
Number,
|
|
880
|
+
String
|
|
881
|
+
],
|
|
882
|
+
required: false
|
|
883
|
+
},
|
|
884
|
+
marginLeft: {
|
|
885
|
+
type: [
|
|
886
|
+
Boolean,
|
|
887
|
+
Number,
|
|
888
|
+
String
|
|
889
|
+
],
|
|
890
|
+
required: false
|
|
891
|
+
},
|
|
892
|
+
marginBottom: {
|
|
893
|
+
type: [
|
|
894
|
+
Boolean,
|
|
895
|
+
Number,
|
|
896
|
+
String
|
|
897
|
+
],
|
|
898
|
+
required: false
|
|
899
|
+
},
|
|
900
|
+
marginRight: {
|
|
901
|
+
type: [
|
|
902
|
+
Boolean,
|
|
903
|
+
Number,
|
|
904
|
+
String
|
|
905
|
+
],
|
|
906
|
+
required: false
|
|
907
|
+
},
|
|
908
|
+
marginBlock: {
|
|
909
|
+
type: [
|
|
910
|
+
Boolean,
|
|
911
|
+
Number,
|
|
912
|
+
String
|
|
913
|
+
],
|
|
914
|
+
required: false
|
|
915
|
+
},
|
|
916
|
+
marginInline: {
|
|
917
|
+
type: [
|
|
918
|
+
Boolean,
|
|
919
|
+
Number,
|
|
920
|
+
String
|
|
921
|
+
],
|
|
922
|
+
required: false
|
|
923
|
+
},
|
|
924
|
+
marginInlineStart: {
|
|
925
|
+
type: [
|
|
926
|
+
Boolean,
|
|
927
|
+
Number,
|
|
928
|
+
String
|
|
929
|
+
],
|
|
930
|
+
required: false
|
|
931
|
+
},
|
|
932
|
+
marginInlineEnd: {
|
|
933
|
+
type: [
|
|
934
|
+
Boolean,
|
|
935
|
+
Number,
|
|
936
|
+
String
|
|
937
|
+
],
|
|
938
|
+
required: false
|
|
939
|
+
},
|
|
940
|
+
marginBlockStart: {
|
|
941
|
+
type: [
|
|
942
|
+
Boolean,
|
|
943
|
+
Number,
|
|
944
|
+
String
|
|
945
|
+
],
|
|
946
|
+
required: false
|
|
947
|
+
},
|
|
948
|
+
marginBlockEnd: {
|
|
949
|
+
type: [
|
|
950
|
+
Boolean,
|
|
951
|
+
Number,
|
|
952
|
+
String
|
|
953
|
+
],
|
|
954
|
+
required: false
|
|
955
|
+
}
|
|
468
956
|
});
|
|
469
|
-
const emit = defineEmits([
|
|
957
|
+
const emit = defineEmits([
|
|
958
|
+
"update:view",
|
|
959
|
+
"update:currentDate",
|
|
960
|
+
"event-click",
|
|
961
|
+
"date-click",
|
|
962
|
+
"range-select",
|
|
963
|
+
"create-event-request",
|
|
964
|
+
"view-change",
|
|
965
|
+
"navigate"
|
|
966
|
+
]);
|
|
470
967
|
defineSlots();
|
|
471
|
-
|
|
968
|
+
/*********************************************************
|
|
969
|
+
* Constants — view enumeration, default event limits, ARIA copy.
|
|
970
|
+
*
|
|
971
|
+
* Kept in-file (not in a const file) because they're internal to
|
|
972
|
+
* the SFC; the public surface that consumers extend is the
|
|
973
|
+
* `ICalendarProps`/`IEvent` interface pair.
|
|
974
|
+
********************************************************/
|
|
975
|
+
const VIEW_OPTIONS = [
|
|
976
|
+
CALENDAR_VIEW.MONTH,
|
|
977
|
+
CALENDAR_VIEW.WEEK,
|
|
978
|
+
CALENDAR_VIEW.DAY,
|
|
979
|
+
CALENDAR_VIEW.AGENDA
|
|
980
|
+
];
|
|
472
981
|
const MONTH_EVENT_LIMIT = 3;
|
|
473
982
|
const DEFAULT_SLOT_HEIGHT_PX = 32;
|
|
983
|
+
// UI chrome is localised through the DS i18n provider (`useLocale`) —
|
|
984
|
+
// keys under `origam.calendar.*` in the shipped locale messages. Dates /
|
|
985
|
+
// month / weekday names stay `Intl`-localised from the `locale` prop.
|
|
474
986
|
const { t } = useLocale();
|
|
475
987
|
const VIEW_LABEL_FALLBACK = {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
988
|
+
[CALENDAR_VIEW.MONTH]: "Month",
|
|
989
|
+
[CALENDAR_VIEW.WEEK]: "Week",
|
|
990
|
+
[CALENDAR_VIEW.DAY]: "Day",
|
|
991
|
+
[CALENDAR_VIEW.AGENDA]: "Agenda"
|
|
480
992
|
};
|
|
481
993
|
function viewLabel(view) {
|
|
482
|
-
|
|
994
|
+
return t(`origam.calendar.view.${view}`, VIEW_LABEL_FALLBACK[view]);
|
|
483
995
|
}
|
|
484
996
|
const ariaLabel = computed(() => t("origam.calendar.aria_label"));
|
|
485
997
|
const ariaToolbarLabel = computed(() => t("origam.calendar.toolbar"));
|
|
@@ -496,509 +1008,655 @@ const dayStartHour = computed(() => props.dayStartHour);
|
|
|
496
1008
|
const dayEndHour = computed(() => props.dayEndHour);
|
|
497
1009
|
const showWeekNumbers = computed(() => props.showWeekNumbers);
|
|
498
1010
|
const weekendHighlight = computed(() => props.weekendHighlight);
|
|
1011
|
+
/*********************************************************
|
|
1012
|
+
* Reactive normalisation — coerce string dates to Date once, build
|
|
1013
|
+
* the disabled-date predicate once. Anything downstream consumes
|
|
1014
|
+
* the normalised forms.
|
|
1015
|
+
********************************************************/
|
|
1016
|
+
// View + current date are UNCONTROLLED-capable: the calendar owns its
|
|
1017
|
+
// own state so a standalone `<origam-calendar>` (no v-model) stays
|
|
1018
|
+
// interactive — the toolbar switches views / navigates on click. When
|
|
1019
|
+
// the parent binds `v-model:view` / `v-model:current-date`, the watchers
|
|
1020
|
+
// sync the controlled value back in.
|
|
1021
|
+
//
|
|
1022
|
+
// ⛔ ADR-005 — the seed used to be `props.view ?? CALENDAR_VIEW.MONTH`
|
|
1023
|
+
// read directly inside `ref(...)`, which runs during `setup()` —
|
|
1024
|
+
// BEFORE the theme-props-resolver's `beforeCreate` patches `instance.props`.
|
|
1025
|
+
// A theme naming a default `view` (or `currentDate`) for every calendar
|
|
1026
|
+
// was therefore silently ignored on first render (mirrors the `useVModel`
|
|
1027
|
+
// fix, #448 / #487): the ref starts `UNSEEDED` and the prop is read lazily,
|
|
1028
|
+
// inside the `resolvedView` / `resolvedDate` computed getters, which only
|
|
1029
|
+
// evaluate at render — comfortably after `beforeCreate`.
|
|
499
1030
|
const internalView = ref(UNSEEDED);
|
|
500
1031
|
const internalDate = ref(UNSEEDED);
|
|
501
1032
|
watch(() => props.view, (next) => {
|
|
502
|
-
|
|
1033
|
+
if (next != null) internalView.value = next;
|
|
503
1034
|
});
|
|
504
1035
|
watch(() => props.currentDate, (next) => {
|
|
505
|
-
|
|
506
|
-
|
|
1036
|
+
const parsed = toDate(next);
|
|
1037
|
+
if (parsed) internalDate.value = parsed;
|
|
507
1038
|
});
|
|
508
1039
|
const resolvedView = computed(() => internalView.value !== UNSEEDED ? internalView.value : props.view ?? CALENDAR_VIEW.MONTH);
|
|
509
|
-
const resolvedDate = computed(() => internalDate.value !== UNSEEDED ? internalDate.value : toDate(props.currentDate) ??
|
|
1040
|
+
const resolvedDate = computed(() => internalDate.value !== UNSEEDED ? internalDate.value : toDate(props.currentDate) ?? new Date());
|
|
510
1041
|
const resolvedLocale = computed(() => {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
1042
|
+
if (props.locale) return props.locale;
|
|
1043
|
+
if (typeof document !== "undefined" && document.documentElement.lang) {
|
|
1044
|
+
return document.documentElement.lang;
|
|
1045
|
+
}
|
|
1046
|
+
return "en-US";
|
|
516
1047
|
});
|
|
517
1048
|
const minDate = computed(() => props.minDate ? toDate(props.minDate) : null);
|
|
518
1049
|
const maxDate = computed(() => props.maxDate ? toDate(props.maxDate) : null);
|
|
519
|
-
const disabledPredicate = computed(
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}
|
|
544
|
-
);
|
|
1050
|
+
const disabledPredicate = computed(() => buildDisabledPredicate(props.disabledDates));
|
|
1051
|
+
/*********************************************************
|
|
1052
|
+
* Composable wiring — driven by getter thunks so we never
|
|
1053
|
+
* accidentally close over a stale value.
|
|
1054
|
+
********************************************************/
|
|
1055
|
+
const calendar = useCalendar({
|
|
1056
|
+
events: () => props.events ?? [],
|
|
1057
|
+
view: () => resolvedView.value,
|
|
1058
|
+
currentDate: () => resolvedDate.value,
|
|
1059
|
+
firstDayOfWeek: () => props.firstDayOfWeek,
|
|
1060
|
+
slotDuration: () => slotDuration.value,
|
|
1061
|
+
dayStartHour: () => dayStartHour.value,
|
|
1062
|
+
dayEndHour: () => dayEndHour.value,
|
|
1063
|
+
minDate: () => minDate.value,
|
|
1064
|
+
maxDate: () => maxDate.value,
|
|
1065
|
+
locale: () => resolvedLocale.value
|
|
1066
|
+
}, (next) => {
|
|
1067
|
+
internalView.value = next;
|
|
1068
|
+
emit("update:view", next);
|
|
1069
|
+
emit("view-change", next);
|
|
1070
|
+
}, (next) => {
|
|
1071
|
+
internalDate.value = next;
|
|
1072
|
+
emit("update:currentDate", next);
|
|
1073
|
+
});
|
|
545
1074
|
function onSetView(next) {
|
|
546
|
-
|
|
1075
|
+
calendar.setView(next);
|
|
547
1076
|
}
|
|
548
1077
|
function onNavigate(direction) {
|
|
549
|
-
|
|
550
|
-
|
|
1078
|
+
calendar.navigate(direction);
|
|
1079
|
+
emit("navigate", direction);
|
|
551
1080
|
}
|
|
552
|
-
|
|
553
|
-
|
|
1081
|
+
/*********************************************************
|
|
1082
|
+
* Toolbar — rendered with `<OrigamBtn>` (never raw `<button>`).
|
|
1083
|
+
* The selected view reads as a raised, primary-tinted pill
|
|
1084
|
+
* (`variant="elevated"` + `active`) so it stands out clearly on ANY
|
|
1085
|
+
* header surface, including a painted `bgColor` band; the other views
|
|
1086
|
+
* stay flat/transparent and inherit the header foreground.
|
|
1087
|
+
********************************************************/
|
|
1088
|
+
const prevGlyph = "‹";
|
|
1089
|
+
const nextGlyph = "›";
|
|
554
1090
|
function isViewActive(view) {
|
|
555
|
-
|
|
1091
|
+
return resolvedView.value === view;
|
|
556
1092
|
}
|
|
557
1093
|
function viewBtnVariant(view) {
|
|
558
|
-
|
|
1094
|
+
return isViewActive(view) ? VARIANT.FLAT : VARIANT.TEXT;
|
|
559
1095
|
}
|
|
1096
|
+
// The active view segment follows the calendar's OWN intent — the
|
|
1097
|
+
// header's `bgColor`, else the `color` accent, else the primary
|
|
1098
|
+
// default. Never a hardcoded colour: a `success` calendar paints a
|
|
1099
|
+
// darker-success active segment, not a stray primary one.
|
|
560
1100
|
const toolbarIntent = computed(() => {
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
1101
|
+
const bg = props.bgColor;
|
|
1102
|
+
if (bg && isIntent(bg)) return bg;
|
|
1103
|
+
const fg = props.color;
|
|
1104
|
+
if (fg && isIntent(fg)) return fg;
|
|
1105
|
+
return INTENT.PRIMARY;
|
|
566
1106
|
});
|
|
567
1107
|
function viewBtnBgColor(view) {
|
|
568
|
-
|
|
1108
|
+
return isViewActive(view) ? toolbarIntent.value : undefined;
|
|
569
1109
|
}
|
|
1110
|
+
/*********************************************************
|
|
1111
|
+
* Header — view-dependent title format. Uses `Intl.DateTimeFormat`
|
|
1112
|
+
* so the user's locale drives month / weekday names.
|
|
1113
|
+
********************************************************/
|
|
570
1114
|
const headerTitle = computed(() => {
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
1115
|
+
const date = resolvedDate.value;
|
|
1116
|
+
const locale = resolvedLocale.value;
|
|
1117
|
+
switch (resolvedView.value) {
|
|
1118
|
+
case CALENDAR_VIEW.WEEK: {
|
|
1119
|
+
const range = calendar.visibleDateRange.value;
|
|
1120
|
+
const startLabel = formatDate(range.start, locale, {
|
|
1121
|
+
month: "short",
|
|
1122
|
+
day: "numeric"
|
|
1123
|
+
});
|
|
1124
|
+
const endLabel = formatDate(range.end, locale, {
|
|
1125
|
+
month: "short",
|
|
1126
|
+
day: "numeric",
|
|
1127
|
+
year: "numeric"
|
|
1128
|
+
});
|
|
1129
|
+
return `${startLabel} — ${endLabel}`;
|
|
1130
|
+
}
|
|
1131
|
+
case CALENDAR_VIEW.DAY: return formatDate(date, locale, {
|
|
1132
|
+
weekday: "long",
|
|
1133
|
+
month: "long",
|
|
1134
|
+
day: "numeric",
|
|
1135
|
+
year: "numeric"
|
|
1136
|
+
});
|
|
1137
|
+
case CALENDAR_VIEW.MONTH:
|
|
1138
|
+
case CALENDAR_VIEW.AGENDA:
|
|
1139
|
+
default: return formatDate(date, locale, {
|
|
1140
|
+
month: "long",
|
|
1141
|
+
year: "numeric"
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
592
1144
|
});
|
|
593
1145
|
const canPrev = computed(() => {
|
|
594
|
-
|
|
595
|
-
|
|
1146
|
+
if (!minDate.value) return true;
|
|
1147
|
+
return isAfter(resolvedDate.value, minDate.value);
|
|
596
1148
|
});
|
|
597
1149
|
const canNext = computed(() => {
|
|
598
|
-
|
|
599
|
-
|
|
1150
|
+
if (!maxDate.value) return true;
|
|
1151
|
+
return isBefore(resolvedDate.value, maxDate.value);
|
|
600
1152
|
});
|
|
1153
|
+
/*********************************************************
|
|
1154
|
+
* Month view bindings.
|
|
1155
|
+
********************************************************/
|
|
601
1156
|
const monthGrid = computed(() => calendar.buildMonthGrid(resolvedDate.value));
|
|
602
1157
|
const weekdayNames = computed(() => getWeekdayNames(resolvedLocale.value, props.firstDayOfWeek, "short"));
|
|
603
1158
|
function dayCellKey(date) {
|
|
604
|
-
|
|
1159
|
+
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
|
|
605
1160
|
}
|
|
606
|
-
|
|
1161
|
+
/*********************************************************
|
|
1162
|
+
* Roving tabindex (issue #390) — WAI-ARIA APG grid pattern.
|
|
1163
|
+
*
|
|
1164
|
+
* @description
|
|
1165
|
+
* Every `.origam-calendar__day-cell` used to carry `tabindex="0"`
|
|
1166
|
+
* unconditionally (35-42 tab stops per month). Only the cell matching
|
|
1167
|
+
* `resolvedDate` — the SAME value the existing arrow-key handler
|
|
1168
|
+
* already navigates — is now a tab stop; every other cell is `-1`.
|
|
1169
|
+
* `resolvedDate` is always inside the currently rendered `monthGrid`
|
|
1170
|
+
* by construction (`buildMonthGrid(resolvedDate.value)`), so exactly
|
|
1171
|
+
* one cell is always reachable by Tab.
|
|
1172
|
+
*
|
|
1173
|
+
* `dayCellRefs` is a plain Map (not a ref) populated via the `:ref`
|
|
1174
|
+
* callback on each cell — it never needs to be reactive itself, only
|
|
1175
|
+
* READ imperatively from `focusDayCell` after a keyboard move.
|
|
1176
|
+
********************************************************/
|
|
1177
|
+
const dayCellRefs = new Map();
|
|
607
1178
|
function setDayCellRef(date, el) {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
1179
|
+
const key = dayCellKey(date);
|
|
1180
|
+
if (el instanceof HTMLElement) dayCellRefs.set(key, el);
|
|
1181
|
+
else dayCellRefs.delete(key);
|
|
611
1182
|
}
|
|
612
1183
|
function isRovingTabStop(date) {
|
|
613
|
-
|
|
1184
|
+
return isSameDay(date, resolvedDate.value);
|
|
614
1185
|
}
|
|
615
1186
|
function focusDayCell(date) {
|
|
616
|
-
|
|
1187
|
+
dayCellRefs.get(dayCellKey(date))?.focus();
|
|
617
1188
|
}
|
|
618
1189
|
function isCellToday(date) {
|
|
619
|
-
|
|
1190
|
+
return isToday(date);
|
|
620
1191
|
}
|
|
621
1192
|
function isCellPast(date) {
|
|
622
|
-
|
|
1193
|
+
return isPast(startOfDay(date)) && !isCellToday(date);
|
|
623
1194
|
}
|
|
624
1195
|
function isCellWeekend(date) {
|
|
625
|
-
|
|
1196
|
+
return isWeekend(date);
|
|
626
1197
|
}
|
|
627
1198
|
function isOutsideMonth(date) {
|
|
628
|
-
|
|
1199
|
+
return date.getMonth() !== resolvedDate.value.getMonth();
|
|
629
1200
|
}
|
|
630
1201
|
function isDayDisabled(date) {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
1202
|
+
if (disabledPredicate.value(date)) return true;
|
|
1203
|
+
if (minDate.value && isBefore(startOfDay(date), startOfDay(minDate.value))) return true;
|
|
1204
|
+
if (maxDate.value && isAfter(startOfDay(date), startOfDay(maxDate.value))) return true;
|
|
1205
|
+
return false;
|
|
635
1206
|
}
|
|
636
1207
|
function dayCellClasses(date) {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
1208
|
+
return {
|
|
1209
|
+
"origam-calendar__day-cell--today": isCellToday(date),
|
|
1210
|
+
"origam-calendar__day-cell--past": isCellPast(date),
|
|
1211
|
+
"origam-calendar__day-cell--outside": isOutsideMonth(date),
|
|
1212
|
+
"origam-calendar__day-cell--weekend": isCellWeekend(date) && weekendHighlight.value,
|
|
1213
|
+
"origam-calendar__day-cell--disabled": isDayDisabled(date),
|
|
1214
|
+
"origam-calendar__day-cell--selected": isInDragSelection(date)
|
|
1215
|
+
};
|
|
645
1216
|
}
|
|
646
1217
|
function eventsOnDay(date) {
|
|
647
|
-
|
|
1218
|
+
return calendar.eventsOnDay(date);
|
|
648
1219
|
}
|
|
649
1220
|
function dayEventsCapped(date) {
|
|
650
|
-
|
|
1221
|
+
return eventsOnDay(date).slice(0, MONTH_EVENT_LIMIT);
|
|
651
1222
|
}
|
|
652
1223
|
function weekNumberOf(date) {
|
|
653
|
-
|
|
1224
|
+
return isoWeekNumber(date);
|
|
654
1225
|
}
|
|
655
1226
|
function ariaWeekNumberLabel(date) {
|
|
656
|
-
|
|
1227
|
+
return `Week ${weekNumberOf(date)}`;
|
|
657
1228
|
}
|
|
658
1229
|
function ariaDayLabel(date) {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
1230
|
+
return formatDate(date, resolvedLocale.value, {
|
|
1231
|
+
weekday: "long",
|
|
1232
|
+
month: "long",
|
|
1233
|
+
day: "numeric",
|
|
1234
|
+
year: "numeric"
|
|
1235
|
+
});
|
|
665
1236
|
}
|
|
1237
|
+
/*********************************************************
|
|
1238
|
+
* Week / day view bindings.
|
|
1239
|
+
********************************************************/
|
|
666
1240
|
const timelineDays = computed(() => {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
1241
|
+
if (resolvedView.value === CALENDAR_VIEW.DAY) return [startOfDay(resolvedDate.value)];
|
|
1242
|
+
const range = calendar.visibleDateRange.value;
|
|
1243
|
+
const out = [];
|
|
1244
|
+
let cursor = startOfDay(range.start);
|
|
1245
|
+
for (let i = 0; i < 7; i++) {
|
|
1246
|
+
out.push(cursor);
|
|
1247
|
+
cursor = calendar.helpers.addDays(cursor, 1);
|
|
1248
|
+
}
|
|
1249
|
+
return out;
|
|
676
1250
|
});
|
|
677
1251
|
const hourLabels = computed(() => {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
1252
|
+
const out = [];
|
|
1253
|
+
const date = new Date(resolvedDate.value);
|
|
1254
|
+
date.setMinutes(0, 0, 0);
|
|
1255
|
+
for (let h = dayStartHour.value; h < dayEndHour.value; h++) {
|
|
1256
|
+
date.setHours(h);
|
|
1257
|
+
out.push(formatTime(date, props.timeFormat, resolvedLocale.value));
|
|
1258
|
+
}
|
|
1259
|
+
return out;
|
|
686
1260
|
});
|
|
687
1261
|
function dayGridFor(date) {
|
|
688
|
-
|
|
1262
|
+
return calendar.buildDayGrid(date);
|
|
689
1263
|
}
|
|
690
1264
|
function eventsOnTimeline(day) {
|
|
691
|
-
|
|
1265
|
+
return eventsOnDay(day).filter((event) => !event.allDay);
|
|
692
1266
|
}
|
|
693
1267
|
function timelineEventStyle(event, day) {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
1268
|
+
const dayStartTime = new Date(day);
|
|
1269
|
+
dayStartTime.setHours(dayStartHour.value, 0, 0, 0);
|
|
1270
|
+
const pxPerMin = slotPx / slotDuration.value;
|
|
1271
|
+
const pos = calendar.positionEvent(event, dayStartTime, pxPerMin);
|
|
1272
|
+
if (!pos) return {};
|
|
1273
|
+
return {
|
|
1274
|
+
top: `${pos.top}px`,
|
|
1275
|
+
height: `${pos.height}px`,
|
|
1276
|
+
...colorStyleFor(event)
|
|
1277
|
+
};
|
|
704
1278
|
}
|
|
705
1279
|
function weekdayShort(date) {
|
|
706
|
-
|
|
1280
|
+
return formatDate(date, resolvedLocale.value, { weekday: "short" });
|
|
707
1281
|
}
|
|
708
1282
|
function eventTimeLabel(event) {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
1283
|
+
const start = toDate(event.start);
|
|
1284
|
+
if (!start) return "";
|
|
1285
|
+
return formatTime(start, props.timeFormat, resolvedLocale.value);
|
|
712
1286
|
}
|
|
1287
|
+
/*********************************************************
|
|
1288
|
+
* Agenda view bindings.
|
|
1289
|
+
********************************************************/
|
|
713
1290
|
const agendaEntries = computed(() => calendar.buildAgenda());
|
|
714
1291
|
function agendaDayHeader(date) {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
1292
|
+
return formatDate(date, resolvedLocale.value, {
|
|
1293
|
+
weekday: "long",
|
|
1294
|
+
month: "short",
|
|
1295
|
+
day: "numeric"
|
|
1296
|
+
});
|
|
720
1297
|
}
|
|
1298
|
+
/*********************************************************
|
|
1299
|
+
* Color resolution — `eventColorKey` selects the source. We map
|
|
1300
|
+
* tokenised intents to the matching CSS variable so the calendar
|
|
1301
|
+
* inherits theme-aware colours without re-implementing the
|
|
1302
|
+
* intent → color matrix.
|
|
1303
|
+
********************************************************/
|
|
721
1304
|
const INTENT_NAMES = Object.values(INTENT);
|
|
722
1305
|
function colorFor(event) {
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
1306
|
+
if (props.eventColorKey === "color" && event.color) {
|
|
1307
|
+
return resolveColor(event.color);
|
|
1308
|
+
}
|
|
1309
|
+
if (event.color) return resolveColor(event.color);
|
|
1310
|
+
const cat = event.category;
|
|
1311
|
+
if (!cat) return null;
|
|
1312
|
+
const mapped = props.categoryColors?.[cat];
|
|
1313
|
+
if (!mapped) return null;
|
|
1314
|
+
return resolveColor(mapped);
|
|
732
1315
|
}
|
|
733
1316
|
function resolveColor(value) {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
1317
|
+
if (INTENT_NAMES.includes(value)) {
|
|
1318
|
+
return `var(--origam-color__action--${value}---bg, var(--origam-color__feedback--${value}---bg, currentColor))`;
|
|
1319
|
+
}
|
|
1320
|
+
return value;
|
|
738
1321
|
}
|
|
739
1322
|
function colorStyleFor(event) {
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
1323
|
+
const c = colorFor(event);
|
|
1324
|
+
if (!c) return {};
|
|
1325
|
+
return {
|
|
1326
|
+
"background-color": c,
|
|
1327
|
+
"border-color": c
|
|
1328
|
+
};
|
|
746
1329
|
}
|
|
747
1330
|
function eventStyle(event) {
|
|
748
|
-
|
|
1331
|
+
return colorStyleFor(event);
|
|
749
1332
|
}
|
|
750
1333
|
function isEventPast(event) {
|
|
751
|
-
|
|
752
|
-
|
|
1334
|
+
const start = toDate(event.start);
|
|
1335
|
+
return start ? isPast(start) : false;
|
|
753
1336
|
}
|
|
754
1337
|
function isEventToday(event) {
|
|
755
|
-
|
|
756
|
-
|
|
1338
|
+
const start = toDate(event.start);
|
|
1339
|
+
return start ? isToday(start) : false;
|
|
757
1340
|
}
|
|
758
1341
|
function ariaEventLabel(event) {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
1342
|
+
const start = toDate(event.start);
|
|
1343
|
+
if (!start) return event.title;
|
|
1344
|
+
return `${event.title} — ${formatDate(start, resolvedLocale.value, {
|
|
1345
|
+
weekday: "short",
|
|
1346
|
+
month: "short",
|
|
1347
|
+
day: "numeric",
|
|
1348
|
+
hour: "numeric",
|
|
1349
|
+
minute: "numeric"
|
|
1350
|
+
})}`;
|
|
768
1351
|
}
|
|
1352
|
+
/*********************************************************
|
|
1353
|
+
* Click + drag-select wiring.
|
|
1354
|
+
*
|
|
1355
|
+
* Month view: `mousedown` on a cell starts a drag, `mouseenter` on
|
|
1356
|
+
* subsequent cells extends it, `mouseup` (window-level) emits the
|
|
1357
|
+
* range. We listen to `mouseup` on the document to catch drags
|
|
1358
|
+
* that end outside the calendar root.
|
|
1359
|
+
*
|
|
1360
|
+
* Week / day view: same idea but on individual slots, with a
|
|
1361
|
+
* pixel-level overlay that paints the in-progress range.
|
|
1362
|
+
********************************************************/
|
|
769
1363
|
const monthDrag = ref(null);
|
|
770
1364
|
const dragSelection = ref(null);
|
|
771
1365
|
const isMouseDown = ref(false);
|
|
772
1366
|
function onDayClick(date, _event) {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
1367
|
+
if (isDayDisabled(date)) return;
|
|
1368
|
+
if (monthDrag.value && !isSameDay(monthDrag.value.startDate, monthDrag.value.endDate)) return;
|
|
1369
|
+
emit("date-click", date);
|
|
776
1370
|
}
|
|
777
1371
|
function onCellMouseDown(date, _ev) {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
1372
|
+
if (!props.selectable) return;
|
|
1373
|
+
if (isDayDisabled(date)) return;
|
|
1374
|
+
isMouseDown.value = true;
|
|
1375
|
+
monthDrag.value = {
|
|
1376
|
+
startDate: date,
|
|
1377
|
+
endDate: date
|
|
1378
|
+
};
|
|
782
1379
|
}
|
|
783
1380
|
function onCellMouseEnter(date) {
|
|
784
|
-
|
|
785
|
-
|
|
1381
|
+
if (!isMouseDown.value || !monthDrag.value) return;
|
|
1382
|
+
monthDrag.value = {
|
|
1383
|
+
startDate: monthDrag.value.startDate,
|
|
1384
|
+
endDate: date
|
|
1385
|
+
};
|
|
786
1386
|
}
|
|
787
1387
|
function onMonthMouseUp() {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
1388
|
+
if (!monthDrag.value || !isMouseDown.value) {
|
|
1389
|
+
isMouseDown.value = false;
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
const { startDate, endDate } = monthDrag.value;
|
|
1393
|
+
isMouseDown.value = false;
|
|
1394
|
+
if (!isSameDay(startDate, endDate)) {
|
|
1395
|
+
const [from, to] = startDate.getTime() <= endDate.getTime() ? [startDate, endDate] : [endDate, startDate];
|
|
1396
|
+
emit("range-select", from, to);
|
|
1397
|
+
emit("create-event-request", from, to);
|
|
1398
|
+
}
|
|
1399
|
+
monthDrag.value = null;
|
|
800
1400
|
}
|
|
801
1401
|
function isInDragSelection(date) {
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
1402
|
+
if (!monthDrag.value) return false;
|
|
1403
|
+
const { startDate, endDate } = monthDrag.value;
|
|
1404
|
+
const [from, to] = startDate.getTime() <= endDate.getTime() ? [startDate, endDate] : [endDate, startDate];
|
|
1405
|
+
return date.getTime() >= startOfDay(from).getTime() && date.getTime() <= startOfDay(to).getTime() + 24 * 60 * 60 * 1e3 - 1;
|
|
806
1406
|
}
|
|
807
1407
|
function slotMinutesFromY(event) {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
1408
|
+
const target = event.currentTarget;
|
|
1409
|
+
const rect = target.getBoundingClientRect();
|
|
1410
|
+
const y = event.clientY - rect.top;
|
|
1411
|
+
const pxPerMin = slotPx / slotDuration.value;
|
|
1412
|
+
return Math.max(0, Math.round(y / pxPerMin));
|
|
813
1413
|
}
|
|
814
1414
|
function onSlotMouseDown(day, event) {
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
1415
|
+
if (!props.selectable) return;
|
|
1416
|
+
if (event.button !== 0) return;
|
|
1417
|
+
const minutes = slotMinutesFromY(event);
|
|
1418
|
+
const start = new Date(day);
|
|
1419
|
+
start.setHours(dayStartHour.value, 0, 0, 0);
|
|
1420
|
+
start.setMinutes(start.getMinutes() + minutes);
|
|
1421
|
+
dragSelection.value = {
|
|
1422
|
+
day,
|
|
1423
|
+
startMin: minutes,
|
|
1424
|
+
endMin: minutes + slotDuration.value
|
|
1425
|
+
};
|
|
1426
|
+
isMouseDown.value = true;
|
|
823
1427
|
}
|
|
824
1428
|
function onSlotMouseMove(day, event) {
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
1429
|
+
if (!isMouseDown.value || !dragSelection.value) return;
|
|
1430
|
+
if (!isSameDayLocal(dragSelection.value.day, day)) return;
|
|
1431
|
+
const minutes = slotMinutesFromY(event);
|
|
1432
|
+
dragSelection.value = {
|
|
1433
|
+
day: dragSelection.value.day,
|
|
1434
|
+
startMin: dragSelection.value.startMin,
|
|
1435
|
+
endMin: Math.max(minutes, dragSelection.value.startMin + slotDuration.value)
|
|
1436
|
+
};
|
|
833
1437
|
}
|
|
834
1438
|
function onSlotMouseUp(day, _event) {
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
1439
|
+
if (!isMouseDown.value || !dragSelection.value) {
|
|
1440
|
+
isMouseDown.value = false;
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
const start = new Date(day);
|
|
1444
|
+
start.setHours(dayStartHour.value, 0, 0, 0);
|
|
1445
|
+
start.setMinutes(start.getMinutes() + dragSelection.value.startMin);
|
|
1446
|
+
const end = new Date(start);
|
|
1447
|
+
end.setMinutes(start.getMinutes() + (dragSelection.value.endMin - dragSelection.value.startMin));
|
|
1448
|
+
const dragged = dragSelection.value.endMin - dragSelection.value.startMin > slotDuration.value;
|
|
1449
|
+
isMouseDown.value = false;
|
|
1450
|
+
dragSelection.value = null;
|
|
1451
|
+
if (dragged) {
|
|
1452
|
+
emit("range-select", start, end);
|
|
1453
|
+
emit("create-event-request", start, end);
|
|
1454
|
+
}
|
|
851
1455
|
}
|
|
852
1456
|
function onSlotClick(day, event) {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
1457
|
+
const minutes = slotMinutesFromY(event);
|
|
1458
|
+
const slotDate = new Date(day);
|
|
1459
|
+
slotDate.setHours(dayStartHour.value, 0, 0, 0);
|
|
1460
|
+
slotDate.setMinutes(slotDate.getMinutes() + minutes);
|
|
1461
|
+
// Only emit when this wasn't part of a drag.
|
|
1462
|
+
const wasDrag = dragSelection.value !== null;
|
|
1463
|
+
if (!wasDrag) emit("date-click", slotDate);
|
|
859
1464
|
}
|
|
860
1465
|
const dragOverlayStyle = computed(() => {
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
1466
|
+
if (!dragSelection.value) return {};
|
|
1467
|
+
const pxPerMin = slotPx / slotDuration.value;
|
|
1468
|
+
return {
|
|
1469
|
+
top: `${dragSelection.value.startMin * pxPerMin}px`,
|
|
1470
|
+
height: `${(dragSelection.value.endMin - dragSelection.value.startMin) * pxPerMin}px`
|
|
1471
|
+
};
|
|
867
1472
|
});
|
|
868
1473
|
function isSameDayLocal(a, b) {
|
|
869
|
-
|
|
1474
|
+
return isSameDay(a, b);
|
|
870
1475
|
}
|
|
1476
|
+
/*********************************************************
|
|
1477
|
+
* Global mouseup listener — attached on mount so drags that end
|
|
1478
|
+
* outside the calendar root still emit. SSR-safe because the
|
|
1479
|
+
* onMounted hook only runs client-side.
|
|
1480
|
+
********************************************************/
|
|
871
1481
|
if (typeof window !== "undefined") {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
1482
|
+
window.addEventListener("mouseup", () => {
|
|
1483
|
+
if (monthDrag.value) onMonthMouseUp();
|
|
1484
|
+
else if (dragSelection.value) {
|
|
1485
|
+
dragSelection.value = null;
|
|
1486
|
+
isMouseDown.value = false;
|
|
1487
|
+
}
|
|
1488
|
+
});
|
|
879
1489
|
}
|
|
880
1490
|
function onEventClick(event, originalEvent) {
|
|
881
|
-
|
|
1491
|
+
emit("event-click", event, originalEvent);
|
|
882
1492
|
}
|
|
1493
|
+
/*********************************************************
|
|
1494
|
+
* Keyboard navigation — arrow keys move the current date by the
|
|
1495
|
+
* unit relevant to the view. Page Up / Page Down jump month.
|
|
1496
|
+
*
|
|
1497
|
+
* @description
|
|
1498
|
+
* ⛔ issue #390 — moving `internalDate` alone changed no visible
|
|
1499
|
+
* focus: `document.activeElement` never moved because nothing ever
|
|
1500
|
+
* called `.focus()` on the new cell (measured: `ArrowRight` on a
|
|
1501
|
+
* focused cell left `activeElement` unchanged). `focusDayCell` closes
|
|
1502
|
+
* that gap — `nextTick` because the roving tabindex (`isRovingTabStop`)
|
|
1503
|
+
* must repaint to `0` on the new cell before it becomes a valid
|
|
1504
|
+
* `.focus()` target for AT / Tab semantics, even though a script-driven
|
|
1505
|
+
* `.focus()` call itself would technically still land on a `tabindex="-1"`
|
|
1506
|
+
* element.
|
|
1507
|
+
*
|
|
1508
|
+
* ⛔ issue #443 — Enter/Space on a day cell had NO keyboard equivalent
|
|
1509
|
+
* to a mouse click (`onDayClick`) at all. Gated on the event target
|
|
1510
|
+
* actually being a grid cell so it doesn't fire from Enter/Space
|
|
1511
|
+
* pressed on the toolbar buttons or an event chip that also bubble
|
|
1512
|
+
* through this ONE delegated root listener.
|
|
1513
|
+
********************************************************/
|
|
883
1514
|
function onKeydown(event) {
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1515
|
+
const target = event.target;
|
|
1516
|
+
if (target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA")) return;
|
|
1517
|
+
if (event.key === KEYBOARD_VALUES.ENTER || event.key === KEYBOARD_VALUES.EMPTY) {
|
|
1518
|
+
if (target?.getAttribute("role") !== "gridcell") return;
|
|
1519
|
+
event.preventDefault();
|
|
1520
|
+
onDayClick(resolvedDate.value, event);
|
|
1521
|
+
return;
|
|
1522
|
+
}
|
|
1523
|
+
let next = null;
|
|
1524
|
+
const current = resolvedDate.value;
|
|
1525
|
+
switch (event.key) {
|
|
1526
|
+
case "ArrowRight":
|
|
1527
|
+
next = calendar.helpers.addDays(current, 1);
|
|
1528
|
+
break;
|
|
1529
|
+
case "ArrowLeft":
|
|
1530
|
+
next = calendar.helpers.addDays(current, -1);
|
|
1531
|
+
break;
|
|
1532
|
+
case "ArrowUp":
|
|
1533
|
+
next = calendar.helpers.addDays(current, -7);
|
|
1534
|
+
break;
|
|
1535
|
+
case "ArrowDown":
|
|
1536
|
+
next = calendar.helpers.addDays(current, 7);
|
|
1537
|
+
break;
|
|
1538
|
+
case "PageUp":
|
|
1539
|
+
next = calendar.helpers.addMonths(current, -1);
|
|
1540
|
+
break;
|
|
1541
|
+
case "PageDown":
|
|
1542
|
+
next = calendar.helpers.addMonths(current, 1);
|
|
1543
|
+
break;
|
|
1544
|
+
}
|
|
1545
|
+
if (next) {
|
|
1546
|
+
event.preventDefault();
|
|
1547
|
+
internalDate.value = next;
|
|
1548
|
+
emit("update:currentDate", next);
|
|
1549
|
+
const focusTarget = next;
|
|
1550
|
+
/*********************************************************
|
|
1551
|
+
* Promesse flottante, deliberement
|
|
1552
|
+
*
|
|
1553
|
+
* @description
|
|
1554
|
+
* Le focus se pose au tick suivant et rien n'attend la promesse.
|
|
1555
|
+
* Le `void` qui marquait cette intention est retire (Sonar #771) :
|
|
1556
|
+
* la valeur de retour reste ignoree a l'identique.
|
|
1557
|
+
********************************************************/
|
|
1558
|
+
nextTick(() => focusDayCell(focusTarget));
|
|
1559
|
+
}
|
|
921
1560
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
paddingClasses,
|
|
930
|
-
paddingStyles,
|
|
931
|
-
marginClasses,
|
|
932
|
-
marginStyles
|
|
933
|
-
} = useStateEffect(props);
|
|
1561
|
+
/*********************************************************
|
|
1562
|
+
* Cross-cutting surface — same contract as every other origam
|
|
1563
|
+
* component for the non-colour axes (border / rounded / elevation /
|
|
1564
|
+
* padding / margin via `useStateEffect`, dimension via
|
|
1565
|
+
* `useDimension`, density via `useDensity`).
|
|
1566
|
+
********************************************************/
|
|
1567
|
+
const { borderClasses, borderStyles, roundedClasses, roundedStyles, elevationClasses, elevationStyles, paddingClasses, paddingStyles, marginClasses, marginStyles } = useStateEffect(props);
|
|
934
1568
|
const { dimensionStyles } = useDimension(props);
|
|
935
1569
|
const { densityClasses } = useDensity(props, "origam-calendar");
|
|
1570
|
+
// `useBorder` (via useStateEffect) emits the raw `borderColor` value,
|
|
1571
|
+
// invalid for an intent keyword — resolve intents to their token here.
|
|
936
1572
|
const borderColorStyle = computed(() => {
|
|
937
|
-
|
|
938
|
-
|
|
1573
|
+
const value = props.borderColor;
|
|
1574
|
+
return value && isIntent(value) ? [`border-color: ${tokenForegroundForIntent(value)}`] : [];
|
|
939
1575
|
});
|
|
1576
|
+
/*********************************************************
|
|
1577
|
+
* Colour surface — REGION-AWARE. `bgColor` paints ONLY the header
|
|
1578
|
+
* (the toolbar), never the root: the body (weekday row, month grid,
|
|
1579
|
+
* week / day timeline, agenda) is transparent and would otherwise let
|
|
1580
|
+
* the colour bleed through everything that isn't an opaque cell — which
|
|
1581
|
+
* is exactly what happens in the timeline views.
|
|
1582
|
+
*
|
|
1583
|
+
* - TOOLBAR (painted by `bgColor`) → its text CONTRASTS that surface.
|
|
1584
|
+
* - BODY (everything else, on the calendar's own light surface) →
|
|
1585
|
+
* text uses the `color` intent directly (coloured-on-light).
|
|
1586
|
+
********************************************************/
|
|
940
1587
|
const surfaceVars = computed(() => {
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1588
|
+
const vars = {};
|
|
1589
|
+
const bg = props.bgColor;
|
|
1590
|
+
const fg = props.color;
|
|
1591
|
+
const bgIntent = Boolean(bg) && isIntent(bg);
|
|
1592
|
+
const bgCss = Boolean(bg) && typeof bg === "string" && isCssColor(bg);
|
|
1593
|
+
const fgIntent = Boolean(fg) && isIntent(fg);
|
|
1594
|
+
const fgCss = Boolean(fg) && typeof fg === "string" && isCssColor(fg);
|
|
1595
|
+
// 1. Toolbar paint — the HEADER only. Never the root, so no view
|
|
1596
|
+
// (month / week / day / agenda) ever tints its body.
|
|
1597
|
+
if (bgIntent) {
|
|
1598
|
+
vars["--origam-calendar__toolbar---background-color"] = tokenStylesForIntent(bg, "default")["background-color"];
|
|
1599
|
+
} else if (bgCss) {
|
|
1600
|
+
vars["--origam-calendar__toolbar---background-color"] = bg;
|
|
1601
|
+
}
|
|
1602
|
+
// 2. Toolbar foreground — contrasts the painted toolbar; falls back
|
|
1603
|
+
// to the `color` accent when the toolbar isn't painted.
|
|
1604
|
+
let headerFg;
|
|
1605
|
+
if (bgIntent) {
|
|
1606
|
+
headerFg = tokenStylesForIntent(bg, "default").color;
|
|
1607
|
+
} else if (bgCss) {
|
|
1608
|
+
headerFg = getForeground(parseColor(bg));
|
|
1609
|
+
} else if (fgIntent) {
|
|
1610
|
+
headerFg = tokenForegroundForIntent(fg);
|
|
1611
|
+
} else if (fgCss) {
|
|
1612
|
+
headerFg = fg;
|
|
1613
|
+
}
|
|
1614
|
+
if (headerFg) vars["--origam-calendar__toolbar---color"] = headerFg;
|
|
1615
|
+
// 3. Body foreground — weekday labels + day cells sit on the light
|
|
1616
|
+
// body surface, so they use the `color` intent directly. Left
|
|
1617
|
+
// unset when `color` is absent so they keep their natural text.
|
|
1618
|
+
let bodyFg;
|
|
1619
|
+
if (fgIntent) bodyFg = tokenForegroundForIntent(fg);
|
|
1620
|
+
else if (fgCss) bodyFg = fg;
|
|
1621
|
+
if (bodyFg) {
|
|
1622
|
+
vars["--origam-calendar__day-cell---color"] = bodyFg;
|
|
1623
|
+
vars["--origam-calendar__weekday---color"] = bodyFg;
|
|
1624
|
+
}
|
|
1625
|
+
return vars;
|
|
972
1626
|
});
|
|
1627
|
+
/*********************************************************
|
|
1628
|
+
* Class & Style
|
|
1629
|
+
********************************************************/
|
|
973
1630
|
const rootClasses = computed(() => [
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
densityClasses.value,
|
|
984
|
-
props.class
|
|
1631
|
+
`origam-calendar--${resolvedView.value}`,
|
|
1632
|
+
{ "origam-calendar--week-numbers": showWeekNumbers.value },
|
|
1633
|
+
borderClasses.value,
|
|
1634
|
+
roundedClasses.value,
|
|
1635
|
+
elevationClasses.value,
|
|
1636
|
+
paddingClasses.value,
|
|
1637
|
+
marginClasses.value,
|
|
1638
|
+
densityClasses.value,
|
|
1639
|
+
props.class
|
|
985
1640
|
]);
|
|
986
1641
|
const rootStyles = computed(() => [
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1642
|
+
surfaceVars.value,
|
|
1643
|
+
borderStyles.value,
|
|
1644
|
+
borderColorStyle.value,
|
|
1645
|
+
roundedStyles.value,
|
|
1646
|
+
elevationStyles.value,
|
|
1647
|
+
paddingStyles.value,
|
|
1648
|
+
marginStyles.value,
|
|
1649
|
+
dimensionStyles.value,
|
|
1650
|
+
props.style
|
|
996
1651
|
]);
|
|
1652
|
+
/*********************************************************
|
|
1653
|
+
* Expose
|
|
1654
|
+
********************************************************/
|
|
997
1655
|
defineExpose({
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1656
|
+
visibleDateRange: calendar.visibleDateRange,
|
|
1657
|
+
expandedEvents: calendar.expandedEvents,
|
|
1658
|
+
navigate: onNavigate,
|
|
1659
|
+
setView: onSetView
|
|
1002
1660
|
});
|
|
1003
1661
|
</script>
|
|
1004
1662
|
|