@shwfed/config 3.0.17 → 3.0.19
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/dist/module.json +1 -1
- package/dist/runtime/components/app.vue +4 -1
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/config.d.vue.ts +6 -6
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/config.vue.d.ts +6 -6
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/runtime.d.vue.ts +6 -6
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/runtime.vue.d.ts +6 -6
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-22/com.shwfed.form.field.textarea/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.date/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.d.vue.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetime/config.vue.d.ts +4 -4
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +6 -6
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +6 -6
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.time/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-28/com.shwfed.form.field.numberrange/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.month/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.d.vue.ts +4 -4
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue.d.ts +4 -4
- package/dist/runtime/components/modal.vue +2 -1
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue +22 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/schema.js +2 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue +22 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/schema.d.ts +1 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/schema.js +2 -0
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/utils/shared.d.ts +1 -0
- package/dist/runtime/components/table/utils/shared.js +11 -8
- package/dist/runtime/components/ui/date-picker/DatePicker.d.vue.ts +4 -10
- package/dist/runtime/components/ui/date-picker/DatePicker.vue +57 -40
- package/dist/runtime/components/ui/date-picker/DatePicker.vue.d.ts +4 -10
- package/dist/runtime/components/ui/date-picker/DatePickerInput.d.vue.ts +2 -0
- package/dist/runtime/components/ui/date-picker/DatePickerInput.vue +2 -1
- package/dist/runtime/components/ui/date-picker/DatePickerInput.vue.d.ts +2 -0
- package/dist/runtime/components/ui/date-picker/DatePickerPanels.d.vue.ts +23 -0
- package/dist/runtime/components/ui/date-picker/DatePickerPanels.vue +56 -0
- package/dist/runtime/components/ui/date-picker/DatePickerPanels.vue.d.ts +23 -0
- package/dist/runtime/components/ui/date-picker/DatePickerTimeInput.d.vue.ts +2 -2
- package/dist/runtime/components/ui/date-picker/DatePickerTimeInput.vue.d.ts +2 -2
- package/dist/runtime/components/ui/date-picker/index.d.ts +2 -2
- package/dist/runtime/components/ui/date-picker/types.d.ts +6 -0
- package/dist/runtime/components/ui/date-range-picker/DateRangePicker.d.vue.ts +2 -8
- package/dist/runtime/components/ui/date-range-picker/DateRangePicker.vue +59 -43
- package/dist/runtime/components/ui/date-range-picker/DateRangePicker.vue.d.ts +2 -8
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerInput.d.vue.ts +2 -0
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerInput.vue +3 -2
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerInput.vue.d.ts +2 -0
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerPanels.d.vue.ts +23 -0
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerPanels.vue +60 -0
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerPanels.vue.d.ts +23 -0
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.d.vue.ts +2 -2
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.vue.d.ts +2 -2
- package/dist/runtime/components/ui/date-range-picker/index.d.ts +2 -2
- package/dist/runtime/components/ui/date-range-picker/types.d.ts +6 -0
- package/dist/runtime/components/ui/input-group/InputGroupNumberField.vue +1 -1
- package/dist/runtime/components/ui/sidebar/SidebarProvider.vue +3 -2
- package/dist/runtime/composables/useIsMobile.d.ts +15 -0
- package/dist/runtime/composables/useIsMobile.js +12 -0
- package/package.json +1 -1
|
@@ -3,15 +3,13 @@ import { CalendarDate, CalendarDateTime, Time } from "@internationalized/date";
|
|
|
3
3
|
import { useVModel } from "@vueuse/core";
|
|
4
4
|
import { format as formatDate, isValid, parse as parseDate } from "date-fns";
|
|
5
5
|
import { computed, ref, shallowRef, useTemplateRef, watch } from "vue";
|
|
6
|
+
import { useIsMobile } from "../../../composables/useIsMobile";
|
|
6
7
|
import { cn } from "../../../utils/cn";
|
|
7
|
-
import
|
|
8
|
+
import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from "../drawer";
|
|
8
9
|
import { Popover, PopoverAnchor, PopoverContent } from "../popover";
|
|
9
|
-
import DateRangePickerDatePanel from "./DateRangePickerDatePanel.vue";
|
|
10
|
-
import DateRangePickerDateTimePanel from "./DateRangePickerDateTimePanel.vue";
|
|
11
10
|
import DateRangePickerInput from "./DateRangePickerInput.vue";
|
|
12
|
-
import
|
|
11
|
+
import DateRangePickerPanels from "./DateRangePickerPanels.vue";
|
|
13
12
|
import DateRangePickerTimeInput from "./DateRangePickerTimeInput.vue";
|
|
14
|
-
import DateRangePickerYearPanel from "./DateRangePickerYearPanel.vue";
|
|
15
13
|
import { DATE_RANGE_PICKER_DEFAULT_FORMATS } from "./types";
|
|
16
14
|
defineOptions({ name: "UiDateRangePicker", inheritAttrs: false });
|
|
17
15
|
const props = defineProps({
|
|
@@ -184,6 +182,24 @@ function onPanelUpdate(value, closeOnComplete) {
|
|
|
184
182
|
}
|
|
185
183
|
const open = ref(false);
|
|
186
184
|
const anchorEl = useTemplateRef("anchor-el");
|
|
185
|
+
const isMobile = useIsMobile();
|
|
186
|
+
const interactive = computed(() => !props.disabled && !props.readonly);
|
|
187
|
+
const numberOfMonths = computed(() => isMobile.value ? 1 : props.numberOfMonths);
|
|
188
|
+
const panelProps = computed(() => ({
|
|
189
|
+
type: props.type,
|
|
190
|
+
modelValue: rangeValue.value,
|
|
191
|
+
disabledDate: props.disabledDate,
|
|
192
|
+
numberOfMonths: numberOfMonths.value,
|
|
193
|
+
timeGranularity: props.timeGranularity,
|
|
194
|
+
hourCycle: props.hourCycle,
|
|
195
|
+
rangeSeparatorIcon: props.rangeSeparatorIcon,
|
|
196
|
+
shortcuts: props.shortcuts
|
|
197
|
+
}));
|
|
198
|
+
function onAnchorClick() {
|
|
199
|
+
if (isMobile.value && interactive.value && props.type !== "timerange") {
|
|
200
|
+
open.value = true;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
187
203
|
watch(open, (isOpen) => {
|
|
188
204
|
if (!isOpen) inProgressRange.value = void 0;
|
|
189
205
|
});
|
|
@@ -199,7 +215,7 @@ function onInteractOutside(event) {
|
|
|
199
215
|
}
|
|
200
216
|
}
|
|
201
217
|
function onInputFocus(event, side) {
|
|
202
|
-
if (!
|
|
218
|
+
if (!isMobile.value && interactive.value) {
|
|
203
219
|
open.value = true;
|
|
204
220
|
}
|
|
205
221
|
emits("focus", event, side);
|
|
@@ -214,6 +230,7 @@ function onInputBlur(event, side) {
|
|
|
214
230
|
ref="anchor-el"
|
|
215
231
|
data-slot="date-range-picker"
|
|
216
232
|
:class="cn('w-full', props.class)"
|
|
233
|
+
@click="onAnchorClick"
|
|
217
234
|
>
|
|
218
235
|
<DateRangePickerTimeInput
|
|
219
236
|
v-if="props.type === 'timerange'"
|
|
@@ -233,9 +250,14 @@ function onInputBlur(event, side) {
|
|
|
233
250
|
@update:end-value="setEndTime"
|
|
234
251
|
@clear="clearAll"
|
|
235
252
|
/>
|
|
253
|
+
<!-- The popover root stays mounted on mobile so the inputs are declared
|
|
254
|
+
once; it is simply never opened there, and the drawer below takes over. -->
|
|
236
255
|
<Popover
|
|
237
256
|
v-else
|
|
238
|
-
|
|
257
|
+
:open="!isMobile && open"
|
|
258
|
+
@update:open="(value) => {
|
|
259
|
+
if (!isMobile) open = value;
|
|
260
|
+
}"
|
|
239
261
|
>
|
|
240
262
|
<PopoverAnchor as-child>
|
|
241
263
|
<DateRangePickerInput
|
|
@@ -251,6 +273,7 @@ function onInputBlur(event, side) {
|
|
|
251
273
|
:clearable="props.clearable"
|
|
252
274
|
:disabled="props.disabled"
|
|
253
275
|
:readonly="props.readonly"
|
|
276
|
+
:typeable="!isMobile"
|
|
254
277
|
:open="open"
|
|
255
278
|
:size="props.size"
|
|
256
279
|
:class="props.inputClass"
|
|
@@ -261,49 +284,42 @@ function onInputBlur(event, side) {
|
|
|
261
284
|
/>
|
|
262
285
|
</PopoverAnchor>
|
|
263
286
|
<PopoverContent
|
|
287
|
+
v-if="!isMobile"
|
|
264
288
|
align="start"
|
|
265
289
|
:class="cn('w-auto p-0', props.popoverClass)"
|
|
266
290
|
:style="{ minWidth: 'var(--reka-popover-trigger-width)' }"
|
|
267
291
|
@open-auto-focus="(event) => event.preventDefault()"
|
|
268
292
|
@interact-outside="onInteractOutside"
|
|
269
293
|
>
|
|
270
|
-
<
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
:number-of-months="props.numberOfMonths"
|
|
276
|
-
@update:model-value="(v) => onPanelUpdate(v, true)"
|
|
277
|
-
/>
|
|
278
|
-
<DateRangePickerMonthPanel
|
|
279
|
-
v-else-if="props.type === 'monthrange'"
|
|
280
|
-
:model-value="rangeValue"
|
|
281
|
-
:is-date-disabled="props.disabledDate"
|
|
282
|
-
@update:model-value="(v) => onPanelUpdate(v, true)"
|
|
283
|
-
/>
|
|
284
|
-
<DateRangePickerYearPanel
|
|
285
|
-
v-else-if="props.type === 'yearrange'"
|
|
286
|
-
:model-value="rangeValue"
|
|
287
|
-
:is-date-disabled="props.disabledDate"
|
|
288
|
-
@update:model-value="(v) => onPanelUpdate(v, true)"
|
|
289
|
-
/>
|
|
290
|
-
<DateRangePickerDateTimePanel
|
|
291
|
-
v-else-if="props.type === 'datetimerange'"
|
|
292
|
-
:model-value="rangeValue"
|
|
293
|
-
:is-date-disabled="props.disabledDate"
|
|
294
|
-
:granularity="props.timeGranularity"
|
|
295
|
-
:hour-cycle="props.hourCycle"
|
|
296
|
-
:number-of-months="props.numberOfMonths"
|
|
297
|
-
:range-separator-icon="props.rangeSeparatorIcon"
|
|
298
|
-
@update:model-value="(v) => onPanelUpdate(v, false)"
|
|
299
|
-
/>
|
|
300
|
-
<PickerShortcuts
|
|
301
|
-
v-if="props.shortcuts && props.shortcuts.length > 0"
|
|
302
|
-
:items="props.shortcuts"
|
|
303
|
-
@select="applyShortcut"
|
|
304
|
-
/>
|
|
305
|
-
</div>
|
|
294
|
+
<DateRangePickerPanels
|
|
295
|
+
v-bind="panelProps"
|
|
296
|
+
@update="onPanelUpdate"
|
|
297
|
+
@shortcut="applyShortcut"
|
|
298
|
+
/>
|
|
306
299
|
</PopoverContent>
|
|
307
300
|
</Popover>
|
|
301
|
+
|
|
302
|
+
<Drawer
|
|
303
|
+
v-if="isMobile && props.type !== 'timerange'"
|
|
304
|
+
v-model:open="open"
|
|
305
|
+
>
|
|
306
|
+
<DrawerContent
|
|
307
|
+
:show-close-button="false"
|
|
308
|
+
:class="cn('p-0 pt-4 gap-0', props.popoverClass)"
|
|
309
|
+
>
|
|
310
|
+
<DrawerTitle class="sr-only">
|
|
311
|
+
{{ props.startPlaceholder || "\u9009\u62E9\u65E5\u671F\u8303\u56F4" }}
|
|
312
|
+
</DrawerTitle>
|
|
313
|
+
<DrawerDescription class="sr-only" />
|
|
314
|
+
<!-- No cross-axis centering here: the calendar sizes itself with
|
|
315
|
+
`w-full` and `flex-1` cells, and `items-center` would collapse its
|
|
316
|
+
container to fit-content and undo that. -->
|
|
317
|
+
<DateRangePickerPanels
|
|
318
|
+
v-bind="panelProps"
|
|
319
|
+
@update="onPanelUpdate"
|
|
320
|
+
@shortcut="applyShortcut"
|
|
321
|
+
/>
|
|
322
|
+
</DrawerContent>
|
|
323
|
+
</Drawer>
|
|
308
324
|
</div>
|
|
309
325
|
</template>
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import type { DateValue } from 'reka-ui';
|
|
2
2
|
import type { HTMLAttributes } from 'vue';
|
|
3
|
-
import type {
|
|
4
|
-
import type { DateRangePickerType } from './types.js';
|
|
5
|
-
type RangeShortcutValue = [string, string] | (() => [string, string]);
|
|
6
|
-
export interface DateRangePickerShortcut {
|
|
7
|
-
name: LocaleValue;
|
|
8
|
-
value: RangeShortcutValue;
|
|
9
|
-
}
|
|
3
|
+
import type { DateRangePickerShortcut, DateRangePickerType } from './types.js';
|
|
10
4
|
type __VLS_Props = {
|
|
11
5
|
modelValue?: [string, string];
|
|
12
6
|
defaultValue?: [string, string];
|
|
@@ -47,8 +41,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
47
41
|
size: "sm" | "md" | "lg";
|
|
48
42
|
type: DateRangePickerType;
|
|
49
43
|
numberOfMonths: number;
|
|
50
|
-
hourCycle: 12 | 24;
|
|
51
44
|
clearable: boolean;
|
|
45
|
+
hourCycle: 12 | 24;
|
|
52
46
|
timeGranularity: "hour" | "minute" | "second";
|
|
53
47
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
54
48
|
declare const _default: typeof __VLS_export;
|
|
@@ -11,6 +11,7 @@ type __VLS_Props = {
|
|
|
11
11
|
clearable?: boolean;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
readonly?: boolean;
|
|
14
|
+
typeable?: boolean;
|
|
14
15
|
open?: boolean;
|
|
15
16
|
size?: 'sm' | 'md' | 'lg';
|
|
16
17
|
class?: HTMLAttributes['class'];
|
|
@@ -28,6 +29,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
28
29
|
}>, {
|
|
29
30
|
size: "sm" | "md" | "lg";
|
|
30
31
|
clearable: boolean;
|
|
32
|
+
typeable: boolean;
|
|
31
33
|
clearIcon: string;
|
|
32
34
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
35
|
declare const _default: typeof __VLS_export;
|
|
@@ -17,6 +17,7 @@ const props = defineProps({
|
|
|
17
17
|
clearable: { type: Boolean, required: false, default: true },
|
|
18
18
|
disabled: { type: Boolean, required: false },
|
|
19
19
|
readonly: { type: Boolean, required: false },
|
|
20
|
+
typeable: { type: Boolean, required: false, default: true },
|
|
20
21
|
open: { type: Boolean, required: false },
|
|
21
22
|
size: { type: String, required: false, default: "md" },
|
|
22
23
|
class: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true }
|
|
@@ -125,7 +126,7 @@ const hasValue = computed(() => props.startValue !== void 0 || props.endValue !=
|
|
|
125
126
|
data-side="start"
|
|
126
127
|
:placeholder="props.startPlaceholder"
|
|
127
128
|
:disabled="props.disabled"
|
|
128
|
-
:readonly="props.readonly"
|
|
129
|
+
:readonly="props.readonly || !props.typeable"
|
|
129
130
|
:class="cn(
|
|
130
131
|
'text-zinc-700 placeholder:text-zinc-300 min-w-0 flex-1 bg-transparent px-1 outline-none disabled:cursor-not-allowed text-center',
|
|
131
132
|
inputTextClass,
|
|
@@ -147,7 +148,7 @@ const hasValue = computed(() => props.startValue !== void 0 || props.endValue !=
|
|
|
147
148
|
data-side="end"
|
|
148
149
|
:placeholder="props.endPlaceholder"
|
|
149
150
|
:disabled="props.disabled"
|
|
150
|
-
:readonly="props.readonly"
|
|
151
|
+
:readonly="props.readonly || !props.typeable"
|
|
151
152
|
:class="cn(
|
|
152
153
|
'text-zinc-700 placeholder:text-zinc-300 min-w-0 flex-1 bg-transparent px-1 outline-none disabled:cursor-not-allowed text-center',
|
|
153
154
|
inputTextClass,
|
|
@@ -11,6 +11,7 @@ type __VLS_Props = {
|
|
|
11
11
|
clearable?: boolean;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
readonly?: boolean;
|
|
14
|
+
typeable?: boolean;
|
|
14
15
|
open?: boolean;
|
|
15
16
|
size?: 'sm' | 'md' | 'lg';
|
|
16
17
|
class?: HTMLAttributes['class'];
|
|
@@ -28,6 +29,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
28
29
|
}>, {
|
|
29
30
|
size: "sm" | "md" | "lg";
|
|
30
31
|
clearable: boolean;
|
|
32
|
+
typeable: boolean;
|
|
31
33
|
clearIcon: string;
|
|
32
34
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
35
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DateRange, DateValue } from 'reka-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import type { DateRangePickerShortcut, DateRangePickerType } from './types.js';
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
type: DateRangePickerType;
|
|
6
|
+
modelValue: DateRange;
|
|
7
|
+
disabledDate?: (d: DateValue) => boolean;
|
|
8
|
+
numberOfMonths: number;
|
|
9
|
+
timeGranularity: 'hour' | 'minute' | 'second';
|
|
10
|
+
hourCycle: 12 | 24;
|
|
11
|
+
rangeSeparatorIcon?: string;
|
|
12
|
+
shortcuts?: ReadonlyArray<DateRangePickerShortcut>;
|
|
13
|
+
class?: HTMLAttributes['class'];
|
|
14
|
+
};
|
|
15
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
shortcut: (args_0: number) => any;
|
|
17
|
+
update: (args_0: DateRange | undefined, args_1: boolean) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
|
+
onShortcut?: ((args_0: number) => any) | undefined;
|
|
20
|
+
onUpdate?: ((args_0: DateRange | undefined, args_1: boolean) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { cn } from "../../../utils/cn";
|
|
3
|
+
import PickerShortcuts from "../date-picker/PickerShortcuts.vue";
|
|
4
|
+
import DateRangePickerDatePanel from "./DateRangePickerDatePanel.vue";
|
|
5
|
+
import DateRangePickerDateTimePanel from "./DateRangePickerDateTimePanel.vue";
|
|
6
|
+
import DateRangePickerMonthPanel from "./DateRangePickerMonthPanel.vue";
|
|
7
|
+
import DateRangePickerYearPanel from "./DateRangePickerYearPanel.vue";
|
|
8
|
+
defineOptions({ name: "UiDateRangePickerPanels" });
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
type: { type: String, required: true },
|
|
11
|
+
modelValue: { type: Object, required: true },
|
|
12
|
+
disabledDate: { type: Function, required: false },
|
|
13
|
+
numberOfMonths: { type: Number, required: true },
|
|
14
|
+
timeGranularity: { type: String, required: true },
|
|
15
|
+
hourCycle: { type: Number, required: true },
|
|
16
|
+
rangeSeparatorIcon: { type: String, required: false },
|
|
17
|
+
shortcuts: { type: Array, required: false },
|
|
18
|
+
class: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true }
|
|
19
|
+
});
|
|
20
|
+
const emits = defineEmits(["update", "shortcut"]);
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div :class="cn('flex flex-col', props.class)">
|
|
25
|
+
<DateRangePickerDatePanel
|
|
26
|
+
v-if="props.type === 'daterange'"
|
|
27
|
+
:model-value="props.modelValue"
|
|
28
|
+
:is-date-disabled="props.disabledDate"
|
|
29
|
+
:number-of-months="props.numberOfMonths"
|
|
30
|
+
@update:model-value="(v) => emits('update', v, true)"
|
|
31
|
+
/>
|
|
32
|
+
<DateRangePickerMonthPanel
|
|
33
|
+
v-else-if="props.type === 'monthrange'"
|
|
34
|
+
:model-value="props.modelValue"
|
|
35
|
+
:is-date-disabled="props.disabledDate"
|
|
36
|
+
@update:model-value="(v) => emits('update', v, true)"
|
|
37
|
+
/>
|
|
38
|
+
<DateRangePickerYearPanel
|
|
39
|
+
v-else-if="props.type === 'yearrange'"
|
|
40
|
+
:model-value="props.modelValue"
|
|
41
|
+
:is-date-disabled="props.disabledDate"
|
|
42
|
+
@update:model-value="(v) => emits('update', v, true)"
|
|
43
|
+
/>
|
|
44
|
+
<DateRangePickerDateTimePanel
|
|
45
|
+
v-else-if="props.type === 'datetimerange'"
|
|
46
|
+
:model-value="props.modelValue"
|
|
47
|
+
:is-date-disabled="props.disabledDate"
|
|
48
|
+
:granularity="props.timeGranularity"
|
|
49
|
+
:hour-cycle="props.hourCycle"
|
|
50
|
+
:number-of-months="props.numberOfMonths"
|
|
51
|
+
:range-separator-icon="props.rangeSeparatorIcon"
|
|
52
|
+
@update:model-value="(v) => emits('update', v, false)"
|
|
53
|
+
/>
|
|
54
|
+
<PickerShortcuts
|
|
55
|
+
v-if="props.shortcuts && props.shortcuts.length > 0"
|
|
56
|
+
:items="props.shortcuts"
|
|
57
|
+
@select="(index) => emits('shortcut', index)"
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DateRange, DateValue } from 'reka-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
import type { DateRangePickerShortcut, DateRangePickerType } from './types.js';
|
|
4
|
+
type __VLS_Props = {
|
|
5
|
+
type: DateRangePickerType;
|
|
6
|
+
modelValue: DateRange;
|
|
7
|
+
disabledDate?: (d: DateValue) => boolean;
|
|
8
|
+
numberOfMonths: number;
|
|
9
|
+
timeGranularity: 'hour' | 'minute' | 'second';
|
|
10
|
+
hourCycle: 12 | 24;
|
|
11
|
+
rangeSeparatorIcon?: string;
|
|
12
|
+
shortcuts?: ReadonlyArray<DateRangePickerShortcut>;
|
|
13
|
+
class?: HTMLAttributes['class'];
|
|
14
|
+
};
|
|
15
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
16
|
+
shortcut: (args_0: number) => any;
|
|
17
|
+
update: (args_0: DateRange | undefined, args_1: boolean) => any;
|
|
18
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
19
|
+
onShortcut?: ((args_0: number) => any) | undefined;
|
|
20
|
+
onUpdate?: ((args_0: DateRange | undefined, args_1: boolean) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -24,10 +24,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
24
24
|
"onUpdate:endValue"?: ((args_0: Time | undefined) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
26
|
size: "sm" | "md" | "lg";
|
|
27
|
-
granularity: "hour" | "minute" | "second";
|
|
28
|
-
hourCycle: 12 | 24;
|
|
29
27
|
clearable: boolean;
|
|
30
28
|
clearIcon: string;
|
|
29
|
+
granularity: "hour" | "minute" | "second";
|
|
30
|
+
hourCycle: 12 | 24;
|
|
31
31
|
rangeSeparatorIcon: string;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
33
|
declare const _default: typeof __VLS_export;
|
|
@@ -24,10 +24,10 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
24
24
|
"onUpdate:endValue"?: ((args_0: Time | undefined) => any) | undefined;
|
|
25
25
|
}>, {
|
|
26
26
|
size: "sm" | "md" | "lg";
|
|
27
|
-
granularity: "hour" | "minute" | "second";
|
|
28
|
-
hourCycle: 12 | 24;
|
|
29
27
|
clearable: boolean;
|
|
30
28
|
clearIcon: string;
|
|
29
|
+
granularity: "hour" | "minute" | "second";
|
|
30
|
+
hourCycle: 12 | 24;
|
|
31
31
|
rangeSeparatorIcon: string;
|
|
32
32
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
33
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as DateRangePicker
|
|
1
|
+
export { default as DateRangePicker } from './DateRangePicker.vue.js';
|
|
2
2
|
export { default as DateRangePickerDatePanel } from './DateRangePickerDatePanel.vue.js';
|
|
3
3
|
export { default as DateRangePickerDateTimePanel } from './DateRangePickerDateTimePanel.vue.js';
|
|
4
4
|
export { default as DateRangePickerInput } from './DateRangePickerInput.vue.js';
|
|
@@ -6,4 +6,4 @@ export { default as DateRangePickerMonthPanel } from './DateRangePickerMonthPane
|
|
|
6
6
|
export { default as DateRangePickerTimeInput } from './DateRangePickerTimeInput.vue.js';
|
|
7
7
|
export { default as DateRangePickerYearPanel } from './DateRangePickerYearPanel.vue.js';
|
|
8
8
|
export { DATE_RANGE_PICKER_DEFAULT_FORMATS } from './types.js';
|
|
9
|
-
export type { DateRangePickerType } from './types.js';
|
|
9
|
+
export type { DateRangePickerShortcut, DateRangePickerType } from './types.js';
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import type { LocaleValue } from '../../../share/locale.js';
|
|
2
|
+
export type DateRangePickerShortcutValue = [string, string] | (() => [string, string]);
|
|
3
|
+
export interface DateRangePickerShortcut {
|
|
4
|
+
name: LocaleValue;
|
|
5
|
+
value: DateRangePickerShortcutValue;
|
|
6
|
+
}
|
|
1
7
|
export type DateRangePickerType = 'daterange' | 'datetimerange' | 'monthrange' | 'yearrange' | 'timerange';
|
|
2
8
|
export declare const DATE_RANGE_PICKER_DEFAULT_FORMATS: Record<DateRangePickerType, {
|
|
3
9
|
display: string;
|
|
@@ -48,7 +48,7 @@ const delegatedProps = reactiveOmit(props, "class", "inputClass", "invalid", "id
|
|
|
48
48
|
:data-value="typeof delegatedProps.modelValue === 'number'"
|
|
49
49
|
:aria-invalid="props.invalid ? 'true' : void 0"
|
|
50
50
|
:class="cn(
|
|
51
|
-
'flex-1 px-3 py-1 text-center rounded-none w-full text-sm text-zinc-700 border-0 bg-transparent shadow-none outline-none peer disabled:cursor-not-allowed disabled:text-zinc-600 disabled:opacity-100',
|
|
51
|
+
'flex-1 px-3 py-1 text-center rounded-none w-full text-base md:text-sm text-zinc-700 border-0 bg-transparent shadow-none outline-none peer disabled:cursor-not-allowed disabled:text-zinc-600 disabled:opacity-100',
|
|
52
52
|
props.inputClass
|
|
53
53
|
)"
|
|
54
54
|
@blur="emits('blur', $event)"
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
-
import { defaultDocument, useEventListener,
|
|
2
|
+
import { defaultDocument, useEventListener, useVModel } from "@vueuse/core";
|
|
3
3
|
import { TooltipProvider } from "reka-ui";
|
|
4
4
|
import { computed, ref } from "vue";
|
|
5
|
+
import { useIsMobile } from "../../../composables/useIsMobile";
|
|
5
6
|
import { cn } from "../../../utils/cn";
|
|
6
7
|
import { provideSidebarContext, SIDEBAR_COOKIE_MAX_AGE, SIDEBAR_COOKIE_NAME, SIDEBAR_KEYBOARD_SHORTCUT, SIDEBAR_WIDTH, SIDEBAR_WIDTH_ICON } from "./utils";
|
|
7
8
|
const props = defineProps({
|
|
@@ -10,7 +11,7 @@ const props = defineProps({
|
|
|
10
11
|
class: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true }
|
|
11
12
|
});
|
|
12
13
|
const emits = defineEmits(["update:open"]);
|
|
13
|
-
const isMobile =
|
|
14
|
+
const isMobile = useIsMobile();
|
|
14
15
|
const openMobile = ref(false);
|
|
15
16
|
const open = useVModel(props, "open", emits, {
|
|
16
17
|
defaultValue: props.defaultOpen ?? false,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* The single viewport breakpoint separating phone-shaped layouts from the rest.
|
|
4
|
+
* Anything narrower than this is "mobile"; `768px` itself is already desktop.
|
|
5
|
+
*
|
|
6
|
+
* Callers MUST route through here rather than writing their own media query —
|
|
7
|
+
* the codebase previously disagreed with itself (640px in the responsive modal,
|
|
8
|
+
* 768px in the sidebar), which made a viewport exist where one component
|
|
9
|
+
* believed it was on a phone and its neighbour did not.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MOBILE_BREAKPOINT_PX = 768;
|
|
12
|
+
export declare const DESKTOP_MEDIA_QUERY = "(min-width: 768px)";
|
|
13
|
+
export declare const MOBILE_MEDIA_QUERY = "(max-width: 767.98px)";
|
|
14
|
+
export declare function useIsMobile(): Ref<boolean>;
|
|
15
|
+
export declare function useIsDesktop(): Ref<boolean>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useMediaQuery } from "@vueuse/core";
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
export const MOBILE_BREAKPOINT_PX = 768;
|
|
4
|
+
export const DESKTOP_MEDIA_QUERY = `(min-width: ${MOBILE_BREAKPOINT_PX}px)`;
|
|
5
|
+
export const MOBILE_MEDIA_QUERY = `(max-width: ${MOBILE_BREAKPOINT_PX - 0.02}px)`;
|
|
6
|
+
export function useIsMobile() {
|
|
7
|
+
return useMediaQuery(MOBILE_MEDIA_QUERY);
|
|
8
|
+
}
|
|
9
|
+
export function useIsDesktop() {
|
|
10
|
+
const isMobile = useIsMobile();
|
|
11
|
+
return computed(() => !isMobile.value);
|
|
12
|
+
}
|