@dnax/ui 0.0.43 → 0.0.45

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.
@@ -15,11 +15,17 @@ interface Props {
15
15
  disabledDates?: (d: Date) => boolean
16
16
  /** Premier jour de la semaine : 0 = dimanche, 1 = lundi (défaut) */
17
17
  firstDayOfWeek?: number
18
+ /** Raccourci « Today » sous la grille */
19
+ todayBtn?: boolean
20
+ /** En-tête : libellé cliquable ouvrant le choix du mois (et de l'année) */
21
+ monthDropdown?: boolean
18
22
  }
19
23
 
20
24
  const props = withDefaults(defineProps<Props>(), {
21
25
  modelValue: null,
22
26
  firstDayOfWeek: 1,
27
+ todayBtn: false,
28
+ monthDropdown: false,
23
29
  })
24
30
 
25
31
  const emit = defineEmits<{ select: [date: Date] }>()
@@ -27,6 +33,8 @@ const emit = defineEmits<{ select: [date: Date] }>()
27
33
  const today = new Date()
28
34
  const viewYear = ref(props.modelValue?.getFullYear() ?? today.getFullYear())
29
35
  const viewMonth = ref(props.modelValue?.getMonth() ?? today.getMonth())
36
+ /** Choix du mois ouvert (en-tête) — remplace la grille des jours */
37
+ const monthPickerOpen = ref(false)
30
38
 
31
39
  watch(
32
40
  () => props.modelValue,
@@ -68,6 +76,13 @@ const monthLabel = computed(() =>
68
76
  ),
69
77
  )
70
78
 
79
+ /** Noms courts des 12 mois, dans la langue du navigateur (comme `monthLabel`) */
80
+ const monthNames = computed(() =>
81
+ Array.from({ length: 12 }, (_, i) =>
82
+ new Intl.DateTimeFormat(undefined, { month: "short" }).format(new Date(2000, i, 1)),
83
+ ),
84
+ )
85
+
71
86
  const prevMonth = () => {
72
87
  if (viewMonth.value === 0) {
73
88
  viewMonth.value = 11
@@ -88,6 +103,15 @@ const nextMonth = () => {
88
103
  }
89
104
  }
90
105
 
106
+ const prevYear = () => viewYear.value--
107
+ const nextYear = () => viewYear.value++
108
+
109
+ /** Choix d'un mois dans l'en-tête : on saute au mois, la grille revient */
110
+ const onPickMonth = (month: number) => {
111
+ viewMonth.value = month
112
+ monthPickerOpen.value = false
113
+ }
114
+
91
115
  const isSelected = (d: Date) => !!props.modelValue && sameDay(props.modelValue, d)
92
116
  const isToday = (d: Date) => sameDay(d, new Date())
93
117
 
@@ -101,6 +125,14 @@ const onSelectDate = (d: Date) => {
101
125
  if (isDisabled(d)) return
102
126
  emit("select", d)
103
127
  }
128
+
129
+ /** Raccourci « Today » : désactivé quand aujourd'hui est hors bornes / désactivé */
130
+ const todaySelectable = computed(() => !isDisabled(startOfDay(new Date())))
131
+
132
+ const selectToday = () => {
133
+ if (!todaySelectable.value) return
134
+ emit("select", startOfDay(new Date()))
135
+ }
104
136
  </script>
105
137
 
106
138
  <template>
@@ -114,7 +146,19 @@ const onSelectDate = (d: Date) => {
114
146
  >
115
147
  <Icon :icon="icons.chevronLeft" aria-hidden="true" />
116
148
  </button>
117
- <span class="q-date-calendar__nav-label">{{ monthLabel }}</span>
149
+ <button
150
+ v-if="monthDropdown"
151
+ type="button"
152
+ class="q-date-calendar__nav-label q-date-calendar__nav-label--button"
153
+ :class="{ 'q-date-calendar__nav-label--open': monthPickerOpen }"
154
+ :aria-expanded="monthPickerOpen"
155
+ aria-label="Choisir le mois"
156
+ @click="monthPickerOpen = !monthPickerOpen"
157
+ >
158
+ <span class="q-date-calendar__nav-text">{{ monthLabel }}</span>
159
+ <Icon :icon="icons.chevronDown" class="q-date-calendar__nav-caret" aria-hidden="true" />
160
+ </button>
161
+ <span v-else class="q-date-calendar__nav-label">{{ monthLabel }}</span>
118
162
  <button
119
163
  type="button"
120
164
  class="q-date-calendar__nav-btn"
@@ -125,29 +169,78 @@ const onSelectDate = (d: Date) => {
125
169
  </button>
126
170
  </div>
127
171
 
128
- <div class="q-date-calendar__weekdays">
129
- <span v-for="(d, i) in weekdayLabels" :key="i" class="q-date-calendar__weekday">{{ d }}</span>
130
- </div>
131
-
132
- <div class="q-date-calendar__weeks">
133
- <div v-for="(week, wi) in weeks" :key="wi" class="q-date-calendar__week">
172
+ <!-- Choix du mois / de l'année (en-tête cliquable) -->
173
+ <div v-if="monthDropdown && monthPickerOpen" class="q-date-calendar__picker">
174
+ <div class="q-date-calendar__picker-year">
175
+ <button
176
+ type="button"
177
+ class="q-date-calendar__nav-btn"
178
+ aria-label="Année précédente"
179
+ @click="prevYear"
180
+ >
181
+ <Icon :icon="icons.chevronLeft" aria-hidden="true" />
182
+ </button>
183
+ <span class="q-date-calendar__picker-year-label">{{ viewYear }}</span>
134
184
  <button
135
- v-for="(d, di) in week"
136
- :key="di"
137
185
  type="button"
138
- class="q-date-calendar__day"
139
- :class="cn(
140
- !d && 'q-date-calendar__day--empty',
141
- !!d && isToday(d) && 'q-date-calendar__day--today',
142
- !!d && isSelected(d) && 'q-date-calendar__day--selected',
143
- )"
144
- :disabled="!d || isDisabled(d)"
145
- :aria-selected="!!d && isSelected(d) ? 'true' : 'false'"
146
- @click="d && onSelectDate(d)"
186
+ class="q-date-calendar__nav-btn"
187
+ aria-label="Année suivante"
188
+ @click="nextYear"
147
189
  >
148
- {{ d ? d.getDate() : "" }}
190
+ <Icon :icon="icons.chevronRight" aria-hidden="true" />
149
191
  </button>
150
192
  </div>
193
+ <div class="q-date-calendar__picker-months">
194
+ <button
195
+ v-for="(name, index) in monthNames"
196
+ :key="name"
197
+ type="button"
198
+ class="q-date-calendar__picker-month"
199
+ :class="{ 'q-date-calendar__picker-month--current': index === viewMonth }"
200
+ :aria-current="index === viewMonth ? 'true' : undefined"
201
+ @click="onPickMonth(index)"
202
+ >
203
+ {{ name }}
204
+ </button>
205
+ </div>
206
+ </div>
207
+
208
+ <template v-else>
209
+ <div class="q-date-calendar__weekdays">
210
+ <span v-for="(d, i) in weekdayLabels" :key="i" class="q-date-calendar__weekday">{{ d }}</span>
211
+ </div>
212
+
213
+ <div class="q-date-calendar__weeks">
214
+ <div v-for="(week, wi) in weeks" :key="wi" class="q-date-calendar__week">
215
+ <button
216
+ v-for="(d, di) in week"
217
+ :key="di"
218
+ type="button"
219
+ class="q-date-calendar__day"
220
+ :class="cn(
221
+ !d && 'q-date-calendar__day--empty',
222
+ !!d && isToday(d) && 'q-date-calendar__day--today',
223
+ !!d && isSelected(d) && 'q-date-calendar__day--selected',
224
+ )"
225
+ :disabled="!d || isDisabled(d)"
226
+ :aria-selected="!!d && isSelected(d) ? 'true' : 'false'"
227
+ @click="d && onSelectDate(d)"
228
+ >
229
+ {{ d ? d.getDate() : "" }}
230
+ </button>
231
+ </div>
232
+ </div>
233
+ </template>
234
+
235
+ <div v-if="todayBtn" class="q-date-calendar__footer">
236
+ <button
237
+ type="button"
238
+ class="q-date-calendar__today"
239
+ :disabled="!todaySelectable"
240
+ @click="selectToday"
241
+ >
242
+ Today
243
+ </button>
151
244
  </div>
152
245
  </div>
153
246
  </template>
package/index.ts CHANGED
@@ -33,6 +33,7 @@ export { default as QCarousel } from "./components/QCarousel.vue"
33
33
  export { default as QCarouselContent } from "./components/QCarouselContent.vue"
34
34
  export { default as QCarouselItem } from "./components/QCarouselItem.vue"
35
35
  export { default as QCarouselNav } from "./components/QCarouselNav.vue"
36
+ export { default as QChart } from "./components/QChart.vue"
36
37
  export { default as QCheckbox } from "./components/QCheckbox.vue"
37
38
  export { default as QChip } from "./components/QChip.vue"
38
39
  export { default as QCircularProgress } from "./components/QCircularProgress.vue"
@@ -50,7 +51,6 @@ export { default as QDialogFooter } from "./components/QDialogFooter.vue"
50
51
  export { default as QDialogHeader } from "./components/QDialogHeader.vue"
51
52
  export { default as QDialogProvider } from "./components/QDialogProvider.vue"
52
53
  export { default as QDialogTrigger } from "./components/QDialogTrigger.vue"
53
- export { default as QEditorJs } from "./components/QEditorJs.vue"
54
54
  export { default as QFab } from "./components/QFab.vue"
55
55
  export { default as QFabAction } from "./components/QFabAction.vue"
56
56
  export { default as QFilePicker } from "./components/QFilePicker.vue"
@@ -74,6 +74,7 @@ export { default as QInteract } from "./components/QInteract.vue"
74
74
  export { default as QIntersection } from "./components/QIntersection.vue"
75
75
  export { default as QItem } from "./components/QItem.vue"
76
76
  export { default as QItemSection } from "./components/QItemSection.vue"
77
+ export { default as QLayout } from "./components/QLayout.vue"
77
78
  export { default as QLinearProgress } from "./components/QLinearProgress.vue"
78
79
  export { default as QList } from "./components/QList.vue"
79
80
  export { default as QLoading } from "./components/QLoading.vue"
@@ -135,7 +136,6 @@ export { default as QTiptap } from "./components/QTiptap.vue"
135
136
  export { default as QToolbar } from "./components/QToolbar.vue"
136
137
  export { default as QTooltip } from "./components/QTooltip.vue"
137
138
  export { default as QUploader } from "./components/QUploader.vue"
138
- export { default as QVideo } from "./components/QVideo.vue"
139
139
  export { default as QVirtualScroll } from "./components/QVirtualScroll.vue"
140
140
 
141
141
  export { $q, usePlugin, useQ, QPlugin, dialogStack, closeDialog, bottomSheetStack, closeBottomSheet, useDialogPluginComponent, useBottomSheetPluginComponent } from "./lib/q"
@@ -166,8 +166,30 @@ export {
166
166
  } from "./lib/overlayBack"
167
167
  export type { OverlayHandle } from "./lib/overlayBack"
168
168
  export { markOverlayClose, closeParentOverlay, vClose } from "./lib/closeOverlay"
169
+ export { placePopover } from "./lib/datePicker"
170
+ export type {
171
+ PlacePopoverOptions,
172
+ PopoverAnchor,
173
+ PopoverPlacement,
174
+ PopoverViewport,
175
+ } from "./lib/datePicker"
176
+ export { DEFAULT_LAYOUT_VIEW, parseView, qLayoutKey } from "./lib/layout"
177
+ export type { LayoutView, LayoutZone, LayoutZonePlacement, QLayoutContext } from "./lib/layout"
169
178
  export { vRipple } from "./lib/ripple"
170
179
  export type { RippleOptions, RippleValue } from "./lib/ripple"
180
+ export { chartToECharts, channelValue, pickFromEvent, tableModel, textValue } from "./lib/chart"
181
+ export type {
182
+ QChartAxis,
183
+ QChartChannel,
184
+ QChartColumn,
185
+ QChartConfig,
186
+ QChartLegend,
187
+ QChartMark,
188
+ QChartMarkType,
189
+ QChartOrientation,
190
+ QChartTable,
191
+ QChartPick,
192
+ } from "./lib/chart"
171
193
  export { vTouchPan } from "./lib/touchPan"
172
194
  export type { PanDetails, TouchPanHandler, PanDirection } from "./lib/touchPan"
173
195
  export { vTouchHold } from "./lib/touchHold"