@xleddyl/443-components-vue 0.16.96 → 0.16.98
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/CATALOG.md +48 -39
- package/README.md +127 -38
- package/dist/components/core/FormField.vue +46 -2
- package/dist/components/core/FormField.vue.d.ts +2 -0
- package/dist/components/core/Root.vue +2 -0
- package/dist/components/core/Root.vue.d.ts +2 -0
- package/dist/components/core/types.d.ts +1 -0
- package/dist/components/data/FilterPills.vue +2 -1
- package/dist/components/data/Table.vue +3 -1
- package/dist/components/data/Table.vue.d.ts +1 -0
- package/dist/components/data/TileGrid.vue +1 -0
- package/dist/components/data/types.d.ts +1 -0
- package/dist/components/feedback/Alert.vue +13 -3
- package/dist/components/feedback/Alert.vue.d.ts +4 -4
- package/dist/components/forms/FileDropOverlay.vue +28 -0
- package/dist/components/forms/FileDropOverlay.vue.d.ts +410 -0
- package/dist/components/forms/PaletteSelect.vue.d.ts +2 -2
- package/dist/components/forms/SegmentedControl.vue +20 -1
- package/dist/components/forms/index.d.ts +1 -0
- package/dist/components/forms/index.mjs +1 -0
- package/dist/components/forms/types.d.ts +4 -1
- package/dist/components/layout/Accordion.vue +7 -2
- package/dist/components/layout/Accordion.vue.d.ts +2 -0
- package/dist/components/layout/Card.vue +47 -6
- package/dist/components/layout/Card.vue.d.ts +4 -0
- package/dist/components/layout/PageHeader.vue +5 -2
- package/dist/components/layout/PageHeader.vue.d.ts +4 -1
- package/dist/components/layout/ResizeHandle.vue +94 -0
- package/dist/components/layout/ResizeHandle.vue.d.ts +418 -0
- package/dist/components/layout/Stack.vue +3 -2
- package/dist/components/layout/Stack.vue.d.ts +2 -0
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.mjs +1 -0
- package/dist/components/layout/types.d.ts +4 -1
- package/dist/components/overlays/CommandList.vue +22 -4
- package/dist/components/overlays/ConfirmDialog.vue.d.ts +8 -8
- package/dist/components/overlays/ConfirmHost.vue.d.ts +8 -8
- package/dist/components/overlays/Popover.vue +64 -24
- package/dist/components/overlays/Popover.vue.d.ts +13 -4
- package/dist/components/overlays/types.d.ts +7 -1
- package/dist/components/templates/ListPage.vue +3 -2
- package/dist/components/templates/SettingsModal.vue.d.ts +2 -2
- package/dist/components/templates/SettingsSection.vue.d.ts +4 -0
- package/dist/components/templates/WorkspaceLayout.vue +296 -0
- package/dist/components/templates/WorkspaceLayout.vue.d.ts +455 -0
- package/dist/components/templates/index.d.ts +1 -0
- package/dist/components/templates/index.mjs +1 -0
- package/dist/components/templates/types.d.ts +32 -0
- package/dist/composables/core.d.ts +1 -0
- package/dist/composables/core.mjs +1 -0
- package/dist/composables/forms.d.ts +1 -0
- package/dist/composables/forms.mjs +1 -0
- package/dist/composables/useFieldHighlight.d.ts +8 -0
- package/dist/composables/useFieldHighlight.mjs +19 -0
- package/dist/composables/useFileDialog.d.ts +17 -0
- package/dist/composables/useFileDialog.mjs +40 -0
- package/dist/composables/usePreferences.d.ts +1 -0
- package/dist/composables/usePreferences.mjs +2 -1
- package/dist/internal/core/HighlightText.d.ts +12 -0
- package/dist/internal/core/HighlightText.mjs +30 -0
- package/dist/internal/core/env.d.ts +2 -0
- package/dist/internal/core/env.mjs +20 -1
- package/dist/internal/overlays/OverlayView.vue.d.ts +8 -8
- package/dist/locale/de.mjs +10 -0
- package/dist/locale/en.mjs +10 -0
- package/dist/locale/it.mjs +10 -0
- package/dist/locale/types.d.ts +10 -0
- package/dist/nuxt/runtime/layouts/auth.vue.d.ts +2 -0
- package/dist/nuxt/runtime/layouts/dashboard.vue.d.ts +2 -0
- package/dist/styles/base.css +13 -0
- package/dist/styles/core/form-field.css +13 -0
- package/dist/styles/core/root.css +23 -0
- package/dist/styles/data/table.css +17 -0
- package/dist/styles/data/thumbnail.css +5 -2
- package/dist/styles/data/tile-grid.css +2 -1
- package/dist/styles/design-tokens.css +4 -0
- package/dist/styles/feedback/alert.css +13 -0
- package/dist/styles/forced-colors.css +22 -1
- package/dist/styles/forms/file-drop-overlay.css +48 -0
- package/dist/styles/forms/segmented.css +36 -0
- package/dist/styles/forms.css +1 -0
- package/dist/styles/layout/accordion.css +8 -0
- package/dist/styles/layout/breadcrumbs.css +23 -0
- package/dist/styles/layout/card.css +19 -7
- package/dist/styles/layout/page-header.css +58 -0
- package/dist/styles/layout/resize-handle.css +52 -0
- package/dist/styles/layout/stack.css +5 -0
- package/dist/styles/layout.css +1 -0
- package/dist/styles/overlays/command.css +17 -0
- package/dist/styles/shared.css +8 -0
- package/dist/styles/templates/list-page.css +1 -21
- package/dist/styles/templates/workspace-layout.css +143 -0
- package/dist/styles/templates.css +1 -0
- package/package.json +3 -2
|
@@ -7,6 +7,7 @@ export { default as Combobox } from "./Combobox.vue";
|
|
|
7
7
|
export { default as DateInput } from "./DateInput.vue";
|
|
8
8
|
export { default as DatePicker } from "./DatePicker.vue";
|
|
9
9
|
export { default as Fieldset } from "./Fieldset.vue";
|
|
10
|
+
export { default as FileDropOverlay } from "./FileDropOverlay.vue";
|
|
10
11
|
export { default as FileInput } from "./FileInput.vue";
|
|
11
12
|
export { default as FocalPointInput } from "./FocalPointInput.vue";
|
|
12
13
|
export { default as InputAddon } from "./InputAddon.vue";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IconName } from '../../composables/useIcons';
|
|
2
|
-
import type { ColorValue } from '../core/types';
|
|
2
|
+
import type { ColorValue, Tone } from '../core/types';
|
|
3
3
|
export type ChoiceValue = string | number | boolean | null;
|
|
4
4
|
export type ChoiceOrientation = 'horizontal' | 'vertical';
|
|
5
5
|
export interface ChoiceOption<T = ChoiceValue> {
|
|
@@ -12,6 +12,9 @@ export interface ChoiceOption<T = ChoiceValue> {
|
|
|
12
12
|
export interface SegmentedOption<T = ChoiceValue> extends ChoiceOption<T> {
|
|
13
13
|
title?: string;
|
|
14
14
|
muted?: boolean;
|
|
15
|
+
dot?: boolean;
|
|
16
|
+
dotTone?: Tone;
|
|
17
|
+
dotLabel?: string;
|
|
15
18
|
}
|
|
16
19
|
export interface SelectOption<T = string | number> {
|
|
17
20
|
label: string;
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
class="k-accordion"
|
|
4
4
|
:class="[
|
|
5
5
|
`k-accordion-${variant}`,
|
|
6
|
-
{
|
|
6
|
+
{
|
|
7
|
+
'is-neutral': contentVariant === 'neutral',
|
|
8
|
+
'is-flush': !padded,
|
|
9
|
+
'is-divided': divided
|
|
10
|
+
}
|
|
7
11
|
]"
|
|
8
12
|
>
|
|
9
13
|
<div
|
|
@@ -70,7 +74,8 @@ const props = defineProps({
|
|
|
70
74
|
level: { type: Number, required: false, default: 3 },
|
|
71
75
|
variant: { type: String, required: false, default: "card" },
|
|
72
76
|
contentVariant: { type: String, required: false, default: "text" },
|
|
73
|
-
padded: { type: Boolean, required: false, default: true }
|
|
77
|
+
padded: { type: Boolean, required: false, default: true },
|
|
78
|
+
divided: { type: Boolean, required: false }
|
|
74
79
|
});
|
|
75
80
|
const model = defineModel({ type: [String, Number, Array, null], ...{ default: null } });
|
|
76
81
|
const baseId = useId();
|
|
@@ -21,6 +21,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
21
21
|
variant?: AccordionVariant;
|
|
22
22
|
contentVariant?: AccordionContentVariant;
|
|
23
23
|
padded?: boolean;
|
|
24
|
+
divided?: boolean;
|
|
24
25
|
modelValue?: Value | Value[] | null;
|
|
25
26
|
key?: PropertyKey | undefined;
|
|
26
27
|
prefix?: string | undefined | undefined;
|
|
@@ -224,6 +225,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
224
225
|
variant?: AccordionVariant;
|
|
225
226
|
contentVariant?: AccordionContentVariant;
|
|
226
227
|
padded?: boolean;
|
|
228
|
+
divided?: boolean;
|
|
227
229
|
modelValue?: Value | Value[] | null;
|
|
228
230
|
key?: PropertyKey | undefined;
|
|
229
231
|
prefix?: string | undefined | undefined;
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
'is-interactive': isInteractive,
|
|
12
12
|
'is-disabled': disabled,
|
|
13
13
|
'is-selected': selected,
|
|
14
|
-
'is-static': !animated
|
|
14
|
+
'is-static': !animated,
|
|
15
|
+
'is-fill': fill
|
|
15
16
|
}
|
|
16
17
|
]"
|
|
17
18
|
>
|
|
@@ -63,14 +64,16 @@
|
|
|
63
64
|
:aria-label="label"
|
|
64
65
|
:aria-labelledby="label ? void 0 : overlayLabelledBy"
|
|
65
66
|
/>
|
|
67
|
+
<HintTooltip v-if="reasonActive && mounted" :id="hintId" :text="disabledReason" />
|
|
66
68
|
</Polymorphic>
|
|
67
69
|
</template>
|
|
68
70
|
|
|
69
71
|
<script setup>
|
|
70
72
|
import { useLinkResolver } from "../../internal/core/link";
|
|
71
73
|
import { Polymorphic } from "../../internal/core/Polymorphic";
|
|
72
|
-
import { computed, useAttrs, useId, useSlots } from "vue";
|
|
74
|
+
import { computed, onMounted, ref, useAttrs, useId, useSlots } from "vue";
|
|
73
75
|
import { joinIds } from "../../internal/forms/control";
|
|
76
|
+
import HintTooltip from "../../internal/overlays/HintTooltip.vue";
|
|
74
77
|
import Icon from "../core/Icon.vue";
|
|
75
78
|
defineOptions({ inheritAttrs: false });
|
|
76
79
|
const props = defineProps({
|
|
@@ -85,8 +88,10 @@ const props = defineProps({
|
|
|
85
88
|
href: { type: String, required: false },
|
|
86
89
|
target: { type: String, required: false },
|
|
87
90
|
disabled: { type: Boolean, required: false },
|
|
91
|
+
disabledReason: { type: String, required: false },
|
|
88
92
|
selected: { type: Boolean, required: false, default: void 0 },
|
|
89
93
|
animated: { type: Boolean, required: false, default: true },
|
|
94
|
+
fill: { type: Boolean, required: false },
|
|
90
95
|
label: { type: String, required: false }
|
|
91
96
|
});
|
|
92
97
|
const SELECTABLE_ROLES = /* @__PURE__ */ new Set(["option", "tab", "gridcell", "row", "treeitem"]);
|
|
@@ -98,9 +103,26 @@ const hasHeader = computed(
|
|
|
98
103
|
)
|
|
99
104
|
);
|
|
100
105
|
const { resolveLink } = useLinkResolver();
|
|
101
|
-
const
|
|
106
|
+
const hintId = `${useId()}-hint`;
|
|
107
|
+
const mounted = ref(false);
|
|
108
|
+
const isButton = computed(() => props.as === "button");
|
|
109
|
+
const linkTarget = computed(() => props.to !== void 0 || props.href !== void 0);
|
|
110
|
+
const reasonActive = computed(
|
|
111
|
+
() => Boolean(props.disabled && props.disabledReason && (isButton.value || linkTarget.value))
|
|
112
|
+
);
|
|
113
|
+
const reasonAttrs = computed(() => ({
|
|
114
|
+
role: "link",
|
|
115
|
+
tabindex: 0,
|
|
116
|
+
"aria-disabled": "true",
|
|
117
|
+
"aria-describedby": mounted.value ? hintId : void 0,
|
|
118
|
+
title: mounted.value ? void 0 : props.disabledReason
|
|
119
|
+
}));
|
|
120
|
+
const link = computed(() => {
|
|
121
|
+
if (reasonActive.value && !isButton.value) return { is: "a", attrs: reasonAttrs.value };
|
|
122
|
+
return props.disabled ? null : resolveLink(props);
|
|
123
|
+
});
|
|
102
124
|
const isLink = computed(() => link.value !== null);
|
|
103
|
-
const isInteractive = computed(() => isLink.value ||
|
|
125
|
+
const isInteractive = computed(() => isLink.value || isButton.value);
|
|
104
126
|
const plain = computed(() => props.as === "button" || attrs.role === "button");
|
|
105
127
|
const hasTitle = computed(() => Boolean(props.title || slots.title));
|
|
106
128
|
const headerId = useId();
|
|
@@ -110,14 +132,33 @@ const overlayLabelledBy = computed(
|
|
|
110
132
|
);
|
|
111
133
|
const rootAttrs = computed(() => ({
|
|
112
134
|
...selectionAttrs.value,
|
|
113
|
-
...
|
|
135
|
+
...isButton.value ? buttonAttrs.value : {},
|
|
136
|
+
...reasonActive.value ? { onClickCapture: ignoreClick } : {}
|
|
114
137
|
}));
|
|
138
|
+
const buttonAttrs = computed(() => {
|
|
139
|
+
if (!reasonActive.value) return { type: "button", disabled: props.disabled || void 0 };
|
|
140
|
+
return {
|
|
141
|
+
type: "button",
|
|
142
|
+
"aria-disabled": "true",
|
|
143
|
+
"aria-describedby": mounted.value ? hintId : void 0,
|
|
144
|
+
title: mounted.value ? void 0 : props.disabledReason
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
function ignoreClick(event) {
|
|
148
|
+
const target = event.target;
|
|
149
|
+
if (target?.closest(".k-card-actions, .k-card-footer")) return;
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
event.stopImmediatePropagation();
|
|
152
|
+
}
|
|
115
153
|
const selectionAttrs = computed(() => {
|
|
116
154
|
if (props.selected === void 0) return void 0;
|
|
117
155
|
const state = props.selected ? "true" : "false";
|
|
118
156
|
const role = typeof attrs.role === "string" ? attrs.role : void 0;
|
|
119
157
|
if (role && SELECTABLE_ROLES.has(role)) return { "aria-selected": state };
|
|
120
|
-
if (
|
|
158
|
+
if (isButton.value && !role) return { "aria-pressed": state };
|
|
121
159
|
return { "data-selected": state };
|
|
122
160
|
});
|
|
161
|
+
onMounted(() => {
|
|
162
|
+
mounted.value = true;
|
|
163
|
+
});
|
|
123
164
|
</script>
|
|
@@ -31,8 +31,10 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
31
31
|
href?: string | undefined;
|
|
32
32
|
target?: string | undefined;
|
|
33
33
|
disabled?: boolean;
|
|
34
|
+
disabledReason?: string;
|
|
34
35
|
selected?: boolean;
|
|
35
36
|
animated?: boolean;
|
|
37
|
+
fill?: boolean;
|
|
36
38
|
label?: string;
|
|
37
39
|
inlist?: any;
|
|
38
40
|
download?: any;
|
|
@@ -251,8 +253,10 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
251
253
|
href?: string | undefined;
|
|
252
254
|
target?: string | undefined;
|
|
253
255
|
disabled?: boolean;
|
|
256
|
+
disabledReason?: string;
|
|
254
257
|
selected?: boolean;
|
|
255
258
|
animated?: boolean;
|
|
259
|
+
fill?: boolean;
|
|
256
260
|
label?: string;
|
|
257
261
|
inlist?: any;
|
|
258
262
|
download?: any;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<div
|
|
3
3
|
class="k-page-header"
|
|
4
4
|
:class="[
|
|
5
|
+
`k-page-header-${size}`,
|
|
5
6
|
`k-page-header-align-${align}`,
|
|
6
7
|
{ 'is-bordered': bordered, 'is-truncated': truncate }
|
|
7
8
|
]"
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
v-if="breadcrumbs?.length"
|
|
13
14
|
:items="breadcrumbs"
|
|
14
15
|
:ancestors="breadcrumbsAncestors"
|
|
16
|
+
:size="size === 'sm' ? 'sm' : 'md'"
|
|
15
17
|
>
|
|
16
18
|
<template v-if="$slots['breadcrumb-item']" #item="scope">
|
|
17
19
|
<slot name="breadcrumb-item" v-bind="scope" />
|
|
@@ -30,7 +32,7 @@
|
|
|
30
32
|
:items="trailItems"
|
|
31
33
|
:label="trailLabel"
|
|
32
34
|
:heading="level"
|
|
33
|
-
size="lg"
|
|
35
|
+
:size="size === 'sm' ? 'md' : 'lg'"
|
|
34
36
|
>
|
|
35
37
|
<template #item="{ item, current }">
|
|
36
38
|
<slot v-if="current" name="title">{{ item.label }}</slot>
|
|
@@ -80,7 +82,8 @@ const props = defineProps({
|
|
|
80
82
|
level: { type: Number, required: false, default: 1 },
|
|
81
83
|
bordered: { type: Boolean, required: false },
|
|
82
84
|
align: { type: String, required: false, default: "end" },
|
|
83
|
-
truncate: { type: Boolean, required: false }
|
|
85
|
+
truncate: { type: Boolean, required: false },
|
|
86
|
+
size: { type: String, required: false, default: "md" }
|
|
84
87
|
});
|
|
85
88
|
const trailItems = computed(() => [
|
|
86
89
|
...props.trail ?? [],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IconName } from '../../composables/useIcons';
|
|
2
|
-
import type { BreadcrumbItem, HeadingLevel } from './types';
|
|
2
|
+
import type { BreadcrumbItem, HeadingLevel, PageHeaderSize } from './types';
|
|
3
3
|
declare var __VLS_1: {}, __VLS_10: {
|
|
4
4
|
item: BreadcrumbItem;
|
|
5
5
|
index: number;
|
|
@@ -36,6 +36,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
36
36
|
bordered?: boolean;
|
|
37
37
|
align?: "start" | "center" | "end";
|
|
38
38
|
truncate?: boolean;
|
|
39
|
+
size?: PageHeaderSize;
|
|
39
40
|
innerHTML?: string | undefined | undefined;
|
|
40
41
|
class?: import("vue").ClassValue;
|
|
41
42
|
style?: import("vue").StyleValue;
|
|
@@ -239,6 +240,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
239
240
|
bordered?: boolean;
|
|
240
241
|
align?: "start" | "center" | "end";
|
|
241
242
|
truncate?: boolean;
|
|
243
|
+
size?: PageHeaderSize;
|
|
242
244
|
innerHTML?: string | undefined | undefined;
|
|
243
245
|
class?: import("vue").ClassValue;
|
|
244
246
|
style?: import("vue").StyleValue;
|
|
@@ -431,6 +433,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
431
433
|
ref_for?: boolean | undefined | undefined;
|
|
432
434
|
ref_key?: string | undefined | undefined;
|
|
433
435
|
}> & Readonly<{}>, {
|
|
436
|
+
size: PageHeaderSize;
|
|
434
437
|
align: "start" | "center" | "end";
|
|
435
438
|
level: HeadingLevel;
|
|
436
439
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="handle"
|
|
4
|
+
class="k-resize-handle"
|
|
5
|
+
:class="[`k-resize-handle-${orientation}`, { 'is-dragging': dragging }]"
|
|
6
|
+
role="separator"
|
|
7
|
+
tabindex="0"
|
|
8
|
+
:aria-orientation="orientation"
|
|
9
|
+
:aria-label="label"
|
|
10
|
+
:aria-valuenow="Math.round(model)"
|
|
11
|
+
:aria-valuemin="min"
|
|
12
|
+
:aria-valuemax="max"
|
|
13
|
+
@pointerdown="onPointerDown"
|
|
14
|
+
@pointermove="onPointerMove"
|
|
15
|
+
@pointerup="stop"
|
|
16
|
+
@pointercancel="stop"
|
|
17
|
+
@lostpointercapture="stop"
|
|
18
|
+
@keydown="onKeydown"
|
|
19
|
+
@dblclick="onReset?.()"
|
|
20
|
+
/>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script setup>
|
|
24
|
+
import { onBeforeUnmount, ref, useAttrs, useTemplateRef } from "vue";
|
|
25
|
+
import { hasNameAttrs, warnUnnamed } from "../../internal/forms/name";
|
|
26
|
+
const props = defineProps({
|
|
27
|
+
orientation: { type: String, required: false, default: "vertical" },
|
|
28
|
+
target: { type: String, required: false, default: "before" },
|
|
29
|
+
min: { type: Number, required: false, default: 0 },
|
|
30
|
+
max: { type: Number, required: false, default: void 0 },
|
|
31
|
+
step: { type: Number, required: false, default: 16 },
|
|
32
|
+
label: { type: String, required: false },
|
|
33
|
+
onReset: { type: Function, required: false }
|
|
34
|
+
});
|
|
35
|
+
const emit = defineEmits(["resizeStart", "resizeEnd"]);
|
|
36
|
+
const model = defineModel({ type: Number, ...{ required: true } });
|
|
37
|
+
const attrs = useAttrs();
|
|
38
|
+
const handle = useTemplateRef("handle");
|
|
39
|
+
const dragging = ref(false);
|
|
40
|
+
let origin = { position: 0, size: 0, pointer: -1 };
|
|
41
|
+
warnUnnamed("ResizeHandle", () => Boolean(props.label) || hasNameAttrs(attrs));
|
|
42
|
+
function clamp(size) {
|
|
43
|
+
const upper = props.max ?? Number.POSITIVE_INFINITY;
|
|
44
|
+
return Math.round(Math.min(Math.max(size, props.min), upper));
|
|
45
|
+
}
|
|
46
|
+
function set(size) {
|
|
47
|
+
const next = clamp(size);
|
|
48
|
+
if (next !== model.value) model.value = next;
|
|
49
|
+
}
|
|
50
|
+
function isReversed() {
|
|
51
|
+
const rtl = props.orientation === "vertical" && handle.value !== null && getComputedStyle(handle.value).direction === "rtl";
|
|
52
|
+
return props.target === "after" !== rtl;
|
|
53
|
+
}
|
|
54
|
+
function pointerPosition(event) {
|
|
55
|
+
return props.orientation === "vertical" ? event.clientX : event.clientY;
|
|
56
|
+
}
|
|
57
|
+
function onPointerDown(event) {
|
|
58
|
+
if (event.button !== 0) return;
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
handle.value?.focus({ preventScroll: true });
|
|
61
|
+
handle.value?.setPointerCapture(event.pointerId);
|
|
62
|
+
origin = { position: pointerPosition(event), size: model.value, pointer: event.pointerId };
|
|
63
|
+
dragging.value = true;
|
|
64
|
+
emit("resizeStart");
|
|
65
|
+
}
|
|
66
|
+
function onPointerMove(event) {
|
|
67
|
+
if (!dragging.value || event.pointerId !== origin.pointer) return;
|
|
68
|
+
const delta = pointerPosition(event) - origin.position;
|
|
69
|
+
set(origin.size + (isReversed() ? -delta : delta));
|
|
70
|
+
}
|
|
71
|
+
function stop() {
|
|
72
|
+
if (!dragging.value) return;
|
|
73
|
+
dragging.value = false;
|
|
74
|
+
if (handle.value?.hasPointerCapture(origin.pointer))
|
|
75
|
+
handle.value.releasePointerCapture(origin.pointer);
|
|
76
|
+
emit("resizeEnd", model.value);
|
|
77
|
+
}
|
|
78
|
+
function onKeydown(event) {
|
|
79
|
+
const vertical = props.orientation === "vertical";
|
|
80
|
+
const forward = vertical ? "ArrowRight" : "ArrowDown";
|
|
81
|
+
const backward = vertical ? "ArrowLeft" : "ArrowUp";
|
|
82
|
+
let next = null;
|
|
83
|
+
if (event.key === "Home") next = props.min;
|
|
84
|
+
else if (event.key === "End" && props.max !== void 0) next = props.max;
|
|
85
|
+
else if (event.key === forward || event.key === backward) {
|
|
86
|
+
const grows = event.key === forward !== isReversed();
|
|
87
|
+
next = model.value + (grows ? props.step : -props.step);
|
|
88
|
+
}
|
|
89
|
+
if (next === null) return;
|
|
90
|
+
event.preventDefault();
|
|
91
|
+
set(next);
|
|
92
|
+
}
|
|
93
|
+
onBeforeUnmount(stop);
|
|
94
|
+
</script>
|