@m3ui-vue/m3ui-vue 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/API.md +2914 -348
- package/dist/MButton-CuNzpoxm.js +172 -0
- package/dist/MButton-CuNzpoxm.js.map +1 -0
- package/dist/MDialog-HxEL-m58.js +173 -0
- package/dist/MDialog-HxEL-m58.js.map +1 -0
- package/dist/MIconButton-DoNotQ9v.js +282 -0
- package/dist/MIconButton-DoNotQ9v.js.map +1 -0
- package/dist/MListItem-DnPtv-hY.js +824 -0
- package/dist/MListItem-DnPtv-hY.js.map +1 -0
- package/dist/MLoadingIndicator-BQMNX6Dx.js +115 -0
- package/dist/MLoadingIndicator-BQMNX6Dx.js.map +1 -0
- package/dist/MMenuItem-Bih0h4-n.js +604 -0
- package/dist/MMenuItem-Bih0h4-n.js.map +1 -0
- package/dist/MProgressBar-BCoruxA-.js +184 -0
- package/dist/MProgressBar-BCoruxA-.js.map +1 -0
- package/dist/MSeekBar-LURE1Ah7.js +435 -0
- package/dist/MSeekBar-LURE1Ah7.js.map +1 -0
- package/dist/MSegmentedButton-DL9JtJFX.js +65 -0
- package/dist/MSegmentedButton-DL9JtJFX.js.map +1 -0
- package/dist/MSlider-_J4IS2_z.js +691 -0
- package/dist/MSlider-_J4IS2_z.js.map +1 -0
- package/dist/MSpinner-BhkMYKOM.js +65 -0
- package/dist/MSpinner-BhkMYKOM.js.map +1 -0
- package/dist/MTextField-CkzwNBWS.js +296 -0
- package/dist/MTextField-CkzwNBWS.js.map +1 -0
- package/dist/MTooltip-B67ZDSGp.js +756 -0
- package/dist/MTooltip-B67ZDSGp.js.map +1 -0
- package/dist/_storageKeys-CYXsUBwK.js +18 -0
- package/dist/_storageKeys-CYXsUBwK.js.map +1 -0
- package/dist/_useEscapeStack-CjndQhqg.js +19 -0
- package/dist/_useEscapeStack-CjndQhqg.js.map +1 -0
- package/dist/api.json +1 -1
- package/dist/chart.js +1 -1
- package/dist/code-editor.js +1 -1
- package/dist/components/MAudioPlayer.vue.d.ts +115 -0
- package/dist/components/MBadge.vue.d.ts +1 -1
- package/dist/components/MBottomSheetScaffold.vue.d.ts +1 -1
- package/dist/components/MBox.vue.d.ts +1 -1
- package/dist/components/MButton.vue.d.ts +1 -1
- package/dist/components/MConfirmDialog.vue.d.ts +1 -1
- package/dist/components/MCopyButton.vue.d.ts +2 -2
- package/dist/components/MDataTable.vue.d.ts +2 -2
- package/dist/components/MDialog.vue.d.ts +2 -2
- package/dist/components/MDivider.vue.d.ts +1 -1
- package/dist/components/MDragHandle.vue.d.ts +1 -1
- package/dist/components/MDrawCanvas.vue.d.ts +148 -0
- package/dist/components/MDrawLayers.vue.d.ts +3 -0
- package/dist/components/MDrawToolbar.vue.d.ts +34 -0
- package/dist/components/MExportButton.vue.d.ts +1 -1
- package/dist/components/MFab.vue.d.ts +2 -2
- package/dist/components/MFabMenu.vue.d.ts +2 -2
- package/dist/components/MFixed.vue.d.ts +1 -1
- package/dist/components/MFlex.vue.d.ts +2 -2
- package/dist/components/MFloorPlan.vue.d.ts +160 -0
- package/dist/components/MFlow.vue.d.ts +305 -0
- package/dist/components/MFlowControls.vue.d.ts +33 -0
- package/dist/components/MFlowHandle.vue.d.ts +16 -0
- package/dist/components/MFlowMinimap.vue.d.ts +22 -0
- package/dist/components/MFlowNode.vue.d.ts +35 -0
- package/dist/components/MGantt.vue.d.ts +141 -0
- package/dist/components/MGanttControls.vue.d.ts +32 -0
- package/dist/components/MIconButton.vue.d.ts +3 -1
- package/dist/components/MImageCropper.vue.d.ts +110 -0
- package/dist/components/MInfiniteScroll.vue.d.ts +1 -1
- package/dist/components/MLightbox.vue.d.ts +2 -2
- package/dist/components/MList.vue.d.ts +1 -1
- package/dist/components/MLoadingOverlay.vue.d.ts +1 -1
- package/dist/components/MMap.vue.d.ts +1 -1
- package/dist/components/MMapControl.vue.d.ts +1 -1
- package/dist/components/MMapSearch.vue.d.ts +1 -1
- package/dist/components/MMaskField.vue.d.ts +12 -1
- package/dist/components/MMenu.vue.d.ts +1 -1
- package/dist/components/MNavigationDrawer.vue.d.ts +1 -1
- package/dist/components/MNumberField.vue.d.ts +11 -2
- package/dist/components/MPdfViewer.vue.d.ts +174 -0
- package/dist/components/MPullToRefresh.vue.d.ts +1 -1
- package/dist/components/MResourceTimeline.vue.d.ts +149 -0
- package/dist/components/MScheduler.vue.d.ts +3 -3
- package/dist/components/MScheme.vue.d.ts +1 -1
- package/dist/components/MSearchField.vue.d.ts +1 -1
- package/dist/components/MSeekBar.vue.d.ts +1 -1
- package/dist/components/MSimpleCarousel.vue.d.ts +1 -1
- package/dist/components/MSkeleton.vue.d.ts +1 -1
- package/dist/components/MSlider.vue.d.ts +4 -4
- package/dist/components/MSparkline.vue.d.ts +1 -1
- package/dist/components/MSplitter.vue.d.ts +1 -1
- package/dist/components/MStack.vue.d.ts +2 -2
- package/dist/components/MSwipeToDismiss.vue.d.ts +1 -1
- package/dist/components/MSwitch.vue.d.ts +1 -1
- package/dist/components/MTable.vue.d.ts +1 -1
- package/dist/components/MTagInput.vue.d.ts +12 -1
- package/dist/components/MTextField.vue.d.ts +13 -2
- package/dist/components/MToolbar.vue.d.ts +1 -1
- package/dist/components/MTree.vue.d.ts +2 -2
- package/dist/components/MVideoPlayer.vue.d.ts +253 -0
- package/dist/components/MVirtualTable.vue.d.ts +1 -1
- package/dist/components/MWindow.vue.d.ts +3 -3
- package/dist/components/_MFlowEdge.vue.d.ts +9 -0
- package/dist/components/_MFlowEdgeLabel.vue.d.ts +9 -0
- package/dist/components/_MFlowNodeShell.vue.d.ts +9 -0
- package/dist/components/_MPdfPage.vue.d.ts +76 -0
- package/dist/components/_MTimeBackground.vue.d.ts +14 -0
- package/dist/components/_MTimeHeader.vue.d.ts +20 -0
- package/dist/composables/_effectCanvas.d.ts +23 -0
- package/dist/composables/_flowPanel.d.ts +2 -0
- package/dist/composables/_flowSlot.d.ts +5 -0
- package/dist/composables/_ganttTime.d.ts +41 -0
- package/dist/composables/_storageKeys.d.ts +9 -0
- package/dist/composables/_useTimeAxis.d.ts +90 -0
- package/dist/composables/drawGeometry.d.ts +119 -0
- package/dist/composables/flowFormats.d.ts +79 -0
- package/dist/composables/flowLayout.d.ts +45 -0
- package/dist/composables/flowPaths.d.ts +53 -0
- package/dist/composables/ganttFormats.d.ts +52 -0
- package/dist/composables/ganttSchedule.d.ts +99 -0
- package/dist/composables/themeInitScript.d.ts +2 -0
- package/dist/composables/useConfetti.d.ts +19 -8
- package/dist/composables/useDrawing.d.ts +44 -0
- package/dist/composables/useFireworks.d.ts +37 -0
- package/dist/composables/useFlow.d.ts +266 -0
- package/dist/composables/useGantt.d.ts +87 -0
- package/dist/composables/useLocale.d.ts +163 -0
- package/dist/composables/useMediaPlayer.d.ts +101 -0
- package/dist/composables/usePdf.d.ts +119 -0
- package/dist/composables/useReactions.d.ts +32 -0
- package/dist/composables/useResourceTimeline.d.ts +70 -0
- package/dist/composables/viewportHints.d.ts +2 -0
- package/dist/directives/vSparkle.d.ts +27 -0
- package/dist/draw.d.ts +7 -0
- package/dist/draw.js +1700 -0
- package/dist/draw.js.map +1 -0
- package/dist/flow.d.ts +14 -0
- package/dist/flow.js +3542 -0
- package/dist/flow.js.map +1 -0
- package/dist/flowPaths-CUc6X373.js +161 -0
- package/dist/flowPaths-CUc6X373.js.map +1 -0
- package/dist/gantt.d.ts +12 -0
- package/dist/gantt.js +3575 -0
- package/dist/gantt.js.map +1 -0
- package/dist/index.d.ts +11 -1
- package/dist/locales/index.js +1148 -7
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +7822 -7809
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +593 -588
- package/dist/map.js.map +1 -1
- package/dist/media.d.ts +5 -0
- package/dist/media.js +1311 -0
- package/dist/media.js.map +1 -0
- package/dist/pdf.d.ts +4 -0
- package/dist/pdf.js +1871 -0
- package/dist/pdf.js.map +1 -0
- package/dist/plugin.d.ts +10 -0
- package/dist/rich-text-editor.js +28 -26
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-JYxDDeXC.js → useLocale-BpGxplLV.js} +165 -2
- package/dist/useLocale-BpGxplLV.js.map +1 -0
- package/dist/{useThemeTokens-Bv-Uv8eX.js → useThemeTokens-DQQcaWbE.js} +41 -40
- package/dist/useThemeTokens-DQQcaWbE.js.map +1 -0
- package/package.json +29 -5
- package/src/__tests__/MAudioPlayer.test.ts +75 -0
- package/src/__tests__/MDrawCanvas.test.ts +110 -0
- package/src/__tests__/MFloorPlan.test.ts +97 -0
- package/src/__tests__/MFlow.test.ts +575 -0
- package/src/__tests__/MGantt.test.ts +130 -0
- package/src/__tests__/MImageCropper.test.ts +89 -0
- package/src/__tests__/MPdfViewer.test.ts +235 -0
- package/src/__tests__/MResourceTimeline.test.ts +102 -0
- package/src/__tests__/MSlider.test.ts +36 -0
- package/src/__tests__/MVideoPlayer.test.ts +201 -0
- package/src/__tests__/drawGeometry.test.ts +58 -0
- package/src/__tests__/fieldExpose.test.ts +30 -0
- package/src/__tests__/flowFormats.test.ts +185 -0
- package/src/__tests__/flowLayout.test.ts +113 -0
- package/src/__tests__/ganttFormats.test.ts +76 -0
- package/src/__tests__/ganttSchedule.test.ts +136 -0
- package/src/__tests__/pdfMock.ts +83 -0
- package/src/__tests__/plugin.test.ts +56 -1
- package/src/__tests__/ssr.test.ts +1 -1
- package/src/__tests__/themeInitScript.test.ts +10 -0
- package/src/__tests__/useConfetti.test.ts +33 -2
- package/src/__tests__/useFireworks.test.ts +104 -0
- package/src/__tests__/useMediaPlayer.test.ts +182 -0
- package/src/__tests__/usePdf.test.ts +102 -0
- package/src/__tests__/useReactions.test.ts +51 -0
- package/src/__tests__/vSparkle.test.ts +83 -0
- package/src/components/MAudioPlayer.vue +319 -0
- package/src/components/MDrawCanvas.vue +813 -0
- package/src/components/MDrawLayers.vue +114 -0
- package/src/components/MDrawToolbar.vue +171 -0
- package/src/components/MEmojiSelector.vue +3 -2
- package/src/components/MFloorPlan.vue +581 -0
- package/src/components/MFlow.vue +2049 -0
- package/src/components/MFlowControls.vue +110 -0
- package/src/components/MFlowHandle.vue +60 -0
- package/src/components/MFlowMinimap.vue +134 -0
- package/src/components/MFlowNode.vue +98 -0
- package/src/components/MGantt.vue +1609 -0
- package/src/components/MGanttControls.vue +77 -0
- package/src/components/MIconButton.vue +3 -1
- package/src/components/MImageCropper.vue +507 -0
- package/src/components/MMap.vue +3 -2
- package/src/components/MMaskField.vue +13 -0
- package/src/components/MNumberField.vue +13 -0
- package/src/components/MPdfViewer.vue +1269 -0
- package/src/components/MResourceTimeline.vue +1020 -0
- package/src/components/MSlider.vue +22 -4
- package/src/components/MTagInput.vue +13 -0
- package/src/components/MTextField.vue +24 -4
- package/src/components/MVideoPlayer.vue +839 -0
- package/src/components/_MFlowEdge.vue +100 -0
- package/src/components/_MFlowEdgeLabel.vue +56 -0
- package/src/components/_MFlowNodeShell.vue +111 -0
- package/src/components/_MPdfPage.vue +456 -0
- package/src/components/_MTimeBackground.vue +16 -0
- package/src/components/_MTimeHeader.vue +31 -0
- package/src/composables/_colorUtils.ts +4 -2
- package/src/composables/_effectCanvas.ts +109 -0
- package/src/composables/_flowPanel.ts +13 -0
- package/src/composables/_flowSlot.ts +6 -0
- package/src/composables/_ganttTime.ts +200 -0
- package/src/composables/_ssrState.ts +2 -2
- package/src/composables/_storageKeys.ts +28 -0
- package/src/composables/_useTimeAxis.ts +224 -0
- package/src/composables/drawGeometry.ts +405 -0
- package/src/composables/flowFormats.ts +916 -0
- package/src/composables/flowLayout.ts +297 -0
- package/src/composables/flowPaths.ts +239 -0
- package/src/composables/ganttFormats.ts +366 -0
- package/src/composables/ganttSchedule.ts +403 -0
- package/src/composables/themeInitScript.ts +5 -2
- package/src/composables/useColorPalette.ts +36 -8
- package/src/composables/useConfetti.ts +84 -107
- package/src/composables/useDrawing.ts +53 -0
- package/src/composables/useFireworks.ts +360 -0
- package/src/composables/useFlow.ts +250 -0
- package/src/composables/useGantt.ts +92 -0
- package/src/composables/useLocale.ts +328 -0
- package/src/composables/useMediaPlayer.ts +406 -0
- package/src/composables/usePdf.ts +456 -0
- package/src/composables/useReactions.ts +131 -0
- package/src/composables/useResourceTimeline.ts +76 -0
- package/src/composables/useTheme.ts +21 -4
- package/src/composables/viewportHints.ts +6 -5
- package/src/directives/vSparkle.ts +180 -0
- package/src/draw.ts +25 -0
- package/src/flow.ts +26 -0
- package/src/gantt.ts +12 -0
- package/src/index.ts +11 -1
- package/src/locales/de.ts +163 -0
- package/src/locales/es.ts +163 -0
- package/src/locales/fr.ts +163 -0
- package/src/locales/ja.ts +163 -0
- package/src/locales/ko.ts +163 -0
- package/src/locales/pt.ts +163 -0
- package/src/locales/zh.ts +163 -0
- package/src/media.ts +5 -0
- package/src/pdf.ts +15 -0
- package/src/plugin.ts +21 -5
- package/dist/MMenuItem-DI351kIf.js +0 -929
- package/dist/MMenuItem-DI351kIf.js.map +0 -1
- package/dist/MSlider-BnEy5ieZ.js +0 -1500
- package/dist/MSlider-BnEy5ieZ.js.map +0 -1
- package/dist/MTextField-BBmkaIbO.js +0 -633
- package/dist/MTextField-BBmkaIbO.js.map +0 -1
- package/dist/useLocale-JYxDDeXC.js.map +0 -1
- package/dist/useThemeTokens-Bv-Uv8eX.js.map +0 -1
|
@@ -18,7 +18,7 @@ const props = withDefaults(
|
|
|
18
18
|
min?: number
|
|
19
19
|
/** Maximum value */
|
|
20
20
|
max?: number
|
|
21
|
-
/** Step increment */
|
|
21
|
+
/** Step increment: the values emitted snap to it; while dragging (without stops) the thumb still follows the pointer smoothly and settles on its step when released */
|
|
22
22
|
step?: number
|
|
23
23
|
/** Disables the slider */
|
|
24
24
|
disabled?: boolean
|
|
@@ -34,7 +34,7 @@ const props = withDefaults(
|
|
|
34
34
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
|
|
35
35
|
/** Standard, centered (from middle), or range (two thumbs) */
|
|
36
36
|
variant?: 'standard' | 'centered' | 'range'
|
|
37
|
-
/** Show stop dots at each step (max 30 visible) */
|
|
37
|
+
/** Show stop dots at each step (max 30 visible), and make a dragged thumb snap from step to step instead of following the pointer smoothly (a discrete slider) */
|
|
38
38
|
stops?: boolean
|
|
39
39
|
/** Material Symbol icon shown before the slider — hides once the fill reaches it */
|
|
40
40
|
icon?: string
|
|
@@ -105,8 +105,21 @@ function toPct(v: number) {
|
|
|
105
105
|
return range === 0 ? 0 : ((v - props.min) / range) * 100
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
// Where the pointer is along the track (0–1) while dragging. Without stops the dragged thumb follows it smoothly
|
|
109
|
+
// instead of jumping from step to step (the value emitted still snaps to `step`) and settles on its step when
|
|
110
|
+
// released; with stops it snaps as it goes, like Compose's discrete slider
|
|
111
|
+
const pointerRatio = ref<number | null>(null)
|
|
112
|
+
const freePct = computed(() => (!props.stops && dragging.value !== false && pointerRatio.value !== null ? pointerRatio.value * 100 : null))
|
|
113
|
+
const pctLo = computed(() => {
|
|
114
|
+
const f = freePct.value
|
|
115
|
+
if (f !== null && (dragging.value === 'single' || dragging.value === 0)) return isRange.value ? Math.min(f, toPct(val.value.hi)) : f
|
|
116
|
+
return toPct(val.value.lo)
|
|
117
|
+
})
|
|
118
|
+
const pctHi = computed(() => {
|
|
119
|
+
const f = freePct.value
|
|
120
|
+
if (f !== null && dragging.value === 1) return Math.max(f, toPct(val.value.lo))
|
|
121
|
+
return toPct(val.value.hi)
|
|
122
|
+
})
|
|
110
123
|
const centerPct = computed(() => toPct(0))
|
|
111
124
|
|
|
112
125
|
// Start/end anchor dots hide once the fill has actually covered their spot —
|
|
@@ -270,6 +283,8 @@ function onPointerDown(e: PointerEvent) {
|
|
|
270
283
|
dragging.value = 'single'
|
|
271
284
|
emit('update:modelValue', v)
|
|
272
285
|
}
|
|
286
|
+
// Two overlapping thumbs follow the pointer only once its direction has picked one
|
|
287
|
+
pointerRatio.value = overlapPress ? null : ratioFromEvent(e)
|
|
273
288
|
window.addEventListener('pointermove', onPointerMove)
|
|
274
289
|
window.addEventListener('pointerup', onPointerUp)
|
|
275
290
|
window.addEventListener('pointercancel', onPointerUp)
|
|
@@ -285,14 +300,17 @@ function onPointerMove(e: PointerEvent) {
|
|
|
285
300
|
dragging.value = v > val.value.lo ? 1 : 0
|
|
286
301
|
focusThumb(dragging.value)
|
|
287
302
|
}
|
|
303
|
+
pointerRatio.value = ratioFromEvent(e)
|
|
288
304
|
emit('update:modelValue', rangeValue(dragging.value as 0 | 1, v))
|
|
289
305
|
} else {
|
|
306
|
+
pointerRatio.value = ratioFromEvent(e)
|
|
290
307
|
emit('update:modelValue', v)
|
|
291
308
|
}
|
|
292
309
|
}
|
|
293
310
|
|
|
294
311
|
function onPointerUp() {
|
|
295
312
|
dragging.value = false
|
|
313
|
+
pointerRatio.value = null
|
|
296
314
|
overlapPress = false
|
|
297
315
|
window.removeEventListener('pointermove', onPointerMove)
|
|
298
316
|
window.removeEventListener('pointerup', onPointerUp)
|
|
@@ -192,6 +192,19 @@ const labelClasses = computed(() => {
|
|
|
192
192
|
: (props.error ? 'text-error' : 'text-on-surface-variant'),
|
|
193
193
|
].join(' ')
|
|
194
194
|
})
|
|
195
|
+
|
|
196
|
+
defineExpose({
|
|
197
|
+
/** The `<input>` (or `<textarea>`) element */
|
|
198
|
+
inputEl: inputEl,
|
|
199
|
+
/** Focuses the field */
|
|
200
|
+
focus: (options?: FocusOptions) => inputEl.value?.focus(options),
|
|
201
|
+
/** Takes focus away from the field */
|
|
202
|
+
blur: () => inputEl.value?.blur(),
|
|
203
|
+
/** Selects all its text */
|
|
204
|
+
select: () => inputEl.value?.select(),
|
|
205
|
+
/** Selects part of its text (e.g. a file name without its extension) */
|
|
206
|
+
setSelectionRange: (start: number, end: number, direction?: 'forward' | 'backward' | 'none') => inputEl.value?.setSelectionRange(start, end, direction),
|
|
207
|
+
})
|
|
195
208
|
</script>
|
|
196
209
|
|
|
197
210
|
<template>
|
|
@@ -76,6 +76,8 @@ const { resolvedFieldBg } = useFieldBg(fieldBgEl, () => props.fieldBg);
|
|
|
76
76
|
const { debounced: emitDebounced, cancel: cancelDebounce } = useDebounce((v: string) => emit("debounced", v), props.debounce)
|
|
77
77
|
|
|
78
78
|
const textareaEl = ref<HTMLTextAreaElement | null>(null);
|
|
79
|
+
const inputOnlyEl = ref<HTMLInputElement | null>(null);
|
|
80
|
+
const fieldEl = computed(() => textareaEl.value ?? inputOnlyEl.value);
|
|
79
81
|
useAutoGrow(() => (props.multiline && props.autoGrow ? textareaEl.value : null), {
|
|
80
82
|
minRows: () => props.rows,
|
|
81
83
|
maxRows: () => props.maxRows,
|
|
@@ -112,11 +114,15 @@ const inputClasses = computed(() => {
|
|
|
112
114
|
|
|
113
115
|
return [
|
|
114
116
|
...base,
|
|
115
|
-
|
|
117
|
+
// Multiline: the label's 24px band is a transparent top border rather than padding, so text scrolled up is
|
|
118
|
+
// clipped below the label (at the padding box) instead of running behind it; the background still fills it
|
|
119
|
+
props.multiline
|
|
120
|
+
? "rounded-t-xs bg-surface-container-highest border-b border-t-24 border-t-transparent pb-2"
|
|
121
|
+
: "rounded-t-xs bg-surface-container-highest border-b pt-6 pb-2",
|
|
116
122
|
props.error
|
|
117
|
-
? "border-error focus:border-b-2 focus:border-error"
|
|
118
|
-
: "border-on-surface-variant hover:border-on-surface focus:border-b-2 focus:border-primary",
|
|
119
|
-
"disabled:border-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]",
|
|
123
|
+
? "border-b-error focus:border-b-2 focus:border-b-error"
|
|
124
|
+
: "border-b-on-surface-variant hover:border-b-on-surface focus:border-b-2 focus:border-b-primary",
|
|
125
|
+
"disabled:border-b-on-surface/38 disabled:bg-[color-mix(in_srgb,var(--color-on-surface)_4%,var(--color-surface-container-highest))]",
|
|
120
126
|
].join(" ");
|
|
121
127
|
});
|
|
122
128
|
|
|
@@ -170,6 +176,19 @@ function onInput(event: Event) {
|
|
|
170
176
|
emit("update:modelValue", target.value);
|
|
171
177
|
if (props.debounce > 0) emitDebounced(target.value)
|
|
172
178
|
}
|
|
179
|
+
|
|
180
|
+
defineExpose({
|
|
181
|
+
/** The `<input>` (or `<textarea>`) element */
|
|
182
|
+
inputEl: fieldEl,
|
|
183
|
+
/** Focuses the field */
|
|
184
|
+
focus: (options?: FocusOptions) => fieldEl.value?.focus(options),
|
|
185
|
+
/** Takes focus away from the field */
|
|
186
|
+
blur: () => fieldEl.value?.blur(),
|
|
187
|
+
/** Selects all its text */
|
|
188
|
+
select: () => fieldEl.value?.select(),
|
|
189
|
+
/** Selects part of its text (e.g. a file name without its extension) */
|
|
190
|
+
setSelectionRange: (start: number, end: number, direction?: 'forward' | 'backward' | 'none') => fieldEl.value?.setSelectionRange(start, end, direction),
|
|
191
|
+
})
|
|
173
192
|
</script>
|
|
174
193
|
|
|
175
194
|
<template>
|
|
@@ -210,6 +229,7 @@ function onInput(event: Event) {
|
|
|
210
229
|
/>
|
|
211
230
|
<input
|
|
212
231
|
v-else
|
|
232
|
+
ref="inputOnlyEl"
|
|
213
233
|
:id="id"
|
|
214
234
|
:type="type"
|
|
215
235
|
:value="modelValue"
|