sprintify-ui 0.4.1 → 0.4.3
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/sprintify-ui.es.js +16898 -14684
- package/dist/style.css +1 -1
- package/dist/types/src/components/BaseCharacterCounter.vue.d.ts +1 -1
- package/dist/types/src/components/BaseClipboard.vue.d.ts +1 -0
- package/dist/types/src/components/BaseDisplayRelativeTime.vue.d.ts +2 -20
- package/dist/types/src/components/BaseDropdown.vue.d.ts +3 -3
- package/dist/types/src/components/BaseDropdownAutocomplete.vue.d.ts +3 -3
- package/dist/types/src/components/BaseForm.vue.d.ts +9 -0
- package/dist/types/src/components/BaseIconPicker.vue.d.ts +8 -8
- package/dist/types/src/components/BaseInputLabel.vue.d.ts +2 -3
- package/dist/types/src/components/BaseLoadingCover.vue.d.ts +2 -2
- package/dist/types/src/components/BaseMediaList.vue.d.ts +1 -2
- package/dist/types/src/components/BaseMediaListItem.vue.d.ts +1 -2
- package/dist/types/src/components/BaseModalCenter.vue.d.ts +1 -1
- package/dist/types/src/components/BaseModalSide.vue.d.ts +1 -1
- package/dist/types/src/components/BaseRichText.vue.d.ts +1 -1
- package/dist/types/src/components/BaseShortcut.vue.d.ts +1 -1
- package/package.json +3 -2
- package/src/components/BaseClipboard.stories.js +3 -2
- package/src/components/BaseClipboard.vue +37 -53
- package/src/components/BaseDisplayRelativeTime.stories.js +0 -12
- package/src/components/BaseDisplayRelativeTime.vue +17 -18
- package/src/components/BaseForm.vue +6 -2
- package/src/components/BaseInputLabel.stories.js +1 -1
- package/src/components/BaseInputLabel.vue +30 -48
- package/src/components/BaseMediaList.vue +1 -2
- package/src/components/BaseMediaListItem.vue +5 -10
|
@@ -18,7 +18,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
18
18
|
default: boolean;
|
|
19
19
|
type: BooleanConstructor;
|
|
20
20
|
};
|
|
21
|
-
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update" | "remove"
|
|
21
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update" | "remove")[], "update" | "remove", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
22
|
media: {
|
|
23
23
|
required: true;
|
|
24
24
|
type: PropType<UploadedFile | Media>;
|
|
@@ -38,7 +38,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
38
38
|
}>> & {
|
|
39
39
|
onUpdate?: ((...args: any[]) => any) | undefined;
|
|
40
40
|
onRemove?: ((...args: any[]) => any) | undefined;
|
|
41
|
-
"onSave:name"?: ((...args: any[]) => any) | undefined;
|
|
42
41
|
}, {
|
|
43
42
|
draggable: boolean;
|
|
44
43
|
disabled: boolean;
|
|
@@ -60,10 +60,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
60
60
|
}>> & {
|
|
61
61
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
62
62
|
}, {
|
|
63
|
+
maxWidth: string;
|
|
63
64
|
modelValue: boolean;
|
|
64
65
|
closeOnOutsideClick: boolean;
|
|
65
66
|
clipped: boolean;
|
|
66
|
-
maxWidth: string;
|
|
67
67
|
twBackdrop: string | string[];
|
|
68
68
|
verticalAlign: string;
|
|
69
69
|
showCloseButton: boolean;
|
|
@@ -44,10 +44,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
|
|
|
44
44
|
}>> & {
|
|
45
45
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
46
46
|
}, {
|
|
47
|
+
maxWidth: string;
|
|
47
48
|
modelValue: boolean;
|
|
48
49
|
closeOnOutsideClick: boolean;
|
|
49
50
|
clipped: boolean;
|
|
50
|
-
maxWidth: string;
|
|
51
51
|
twBackdrop: string | string[];
|
|
52
52
|
}, {}>, {
|
|
53
53
|
default?(_: {
|
|
@@ -83,10 +83,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
83
83
|
name: string;
|
|
84
84
|
disabled: boolean;
|
|
85
85
|
required: boolean;
|
|
86
|
+
theme: "" | "snow" | "bubble";
|
|
86
87
|
modelValue: string | Delta | null | undefined;
|
|
87
88
|
hasError: boolean;
|
|
88
89
|
enable: boolean;
|
|
89
90
|
toolbar: string | Record<string, any> | unknown[] | undefined;
|
|
90
|
-
theme: "" | "snow" | "bubble";
|
|
91
91
|
}, {}>;
|
|
92
92
|
export default _default;
|
|
@@ -79,8 +79,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
79
79
|
href: string | undefined;
|
|
80
80
|
action: () => Promise<void> | undefined;
|
|
81
81
|
color: string;
|
|
82
|
-
description: string;
|
|
83
82
|
contrast: "high" | "low";
|
|
83
|
+
description: string;
|
|
84
84
|
linkText: string;
|
|
85
85
|
}, {}>;
|
|
86
86
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sprintify-ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "rimraf dist && vue-tsc && vite build",
|
|
6
6
|
"build-fast": "rimraf dist && vite build",
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@headlessui/vue": "^1.7.12",
|
|
43
43
|
"color2k": "^2.0.2",
|
|
44
|
-
"tailwind-merge": "^1.12.0"
|
|
44
|
+
"tailwind-merge": "^1.12.0",
|
|
45
|
+
"vue-tippy": "^6.3.1"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@babel/core": "^7.20.12",
|
|
@@ -3,6 +3,7 @@ import BaseClipboard from './BaseClipboard.vue';
|
|
|
3
3
|
export default {
|
|
4
4
|
title: 'Components/BaseClipboard',
|
|
5
5
|
component: BaseClipboard,
|
|
6
|
+
args: {},
|
|
6
7
|
argTypes: {},
|
|
7
8
|
};
|
|
8
9
|
|
|
@@ -12,13 +13,13 @@ const Template = (args) => ({
|
|
|
12
13
|
return { args };
|
|
13
14
|
},
|
|
14
15
|
template: `
|
|
15
|
-
<BaseClipboard class="mb-3">
|
|
16
|
+
<BaseClipboard v-bind="args" class="mb-3">
|
|
16
17
|
<span class="underline text-blue-600">{{ args.value }}</span>
|
|
17
18
|
</BaseClipboard>
|
|
18
19
|
|
|
19
20
|
<br>
|
|
20
21
|
|
|
21
|
-
<BaseClipboard class="mb-3 border border-slate-200 rounded px-2 py-px">
|
|
22
|
+
<BaseClipboard v-bind="args" class="mb-3 border border-slate-200 rounded px-2 py-px">
|
|
22
23
|
<BaseIcon icon="heroicons:server" class="mr-2 text-slate-500" />
|
|
23
24
|
<span class="font-mono text-sm text-slate-600">{{ args.value }}</span>
|
|
24
25
|
</BaseClipboard>
|
|
@@ -1,50 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button
|
|
3
|
+
ref="btn"
|
|
3
4
|
type="button"
|
|
4
5
|
class="relative inline-flex items-center"
|
|
5
|
-
@click="copyText()"
|
|
6
|
-
@mouseenter="showTooltip()"
|
|
7
|
-
@mouseleave="hideTooltip()"
|
|
8
6
|
>
|
|
9
7
|
<slot />
|
|
10
|
-
<transition
|
|
11
|
-
enter-active-class="transition duration-200 ease-out"
|
|
12
|
-
enter-from-class="transform scale-90 opacity-0"
|
|
13
|
-
enter-to-class="transform scale-100 opacity-100"
|
|
14
|
-
leave-active-class="transition duration-75 ease-in"
|
|
15
|
-
leave-from-class="transform scale-100 opacity-100"
|
|
16
|
-
leave-to-class="transform scale-90 opacity-0"
|
|
17
|
-
>
|
|
18
|
-
<div
|
|
19
|
-
v-show="tooltipShown"
|
|
20
|
-
class="pointer-events-none absolute left-full z-[1] items-center"
|
|
21
|
-
>
|
|
22
|
-
<div
|
|
23
|
-
class="ml-2 whitespace-nowrap rounded bg-slate-900 bg-opacity-80 px-3 py-2 text-xs leading-tight text-white backdrop-blur"
|
|
24
|
-
>
|
|
25
|
-
<div
|
|
26
|
-
v-if="showCopied"
|
|
27
|
-
class="flex items-center"
|
|
28
|
-
>
|
|
29
|
-
<BaseIcon
|
|
30
|
-
class="mr-1 text-green-500"
|
|
31
|
-
icon="heroicons:check-circle-solid"
|
|
32
|
-
/>
|
|
33
|
-
{{ t('sui.copied') }}
|
|
34
|
-
</div>
|
|
35
|
-
<div v-else>
|
|
36
|
-
{{ t('sui.click_to_copy') }}
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</transition>
|
|
41
8
|
</button>
|
|
42
9
|
</template>
|
|
43
10
|
|
|
44
11
|
<script lang="ts" setup>
|
|
45
12
|
import { t } from '@/i18n';
|
|
13
|
+
import { useTippy } from 'vue-tippy'
|
|
14
|
+
import 'tippy.js/dist/tippy.css'
|
|
46
15
|
|
|
47
|
-
const tooltipShown = ref(false);
|
|
48
16
|
const showCopied = ref(false);
|
|
49
17
|
|
|
50
18
|
const props = defineProps({
|
|
@@ -54,6 +22,34 @@ const props = defineProps({
|
|
|
54
22
|
},
|
|
55
23
|
});
|
|
56
24
|
|
|
25
|
+
const btn = ref();
|
|
26
|
+
|
|
27
|
+
const content = computed(() => {
|
|
28
|
+
return showCopied.value ?
|
|
29
|
+
`<div class="flex items-center">
|
|
30
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 mr-1 text-green-500">
|
|
31
|
+
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
32
|
+
</svg>
|
|
33
|
+
${t('sui.copied')}
|
|
34
|
+
</div>` :
|
|
35
|
+
|
|
36
|
+
t('sui.click_to_copy')
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
useTippy(btn, {
|
|
40
|
+
content: content,
|
|
41
|
+
placement: 'auto',
|
|
42
|
+
interactive: true,
|
|
43
|
+
hideOnClick: 'toggle',
|
|
44
|
+
trigger: 'mouseenter click',
|
|
45
|
+
allowHTML: true,
|
|
46
|
+
onTrigger(instance, event) {
|
|
47
|
+
if (event.type === 'click') {
|
|
48
|
+
copyText(instance)
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
57
53
|
async function writeText(text: string) {
|
|
58
54
|
if (
|
|
59
55
|
typeof navigator === 'undefined' ||
|
|
@@ -66,31 +62,19 @@ async function writeText(text: string) {
|
|
|
66
62
|
await navigator.clipboard.writeText(text);
|
|
67
63
|
}
|
|
68
64
|
|
|
69
|
-
let timeoutId =
|
|
65
|
+
let timeoutId = undefined as undefined | number;
|
|
70
66
|
|
|
71
|
-
function
|
|
72
|
-
tooltipShown.value = true;
|
|
73
|
-
}
|
|
67
|
+
function copyText(instance: any) {
|
|
74
68
|
|
|
75
|
-
function hideTooltip() {
|
|
76
|
-
tooltipShown.value = false;
|
|
77
|
-
setTimeout(() => {
|
|
78
|
-
showCopied.value = false;
|
|
79
|
-
}, 200);
|
|
80
|
-
if (timeoutId) {
|
|
81
|
-
clearTimeout(timeoutId);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function copyText() {
|
|
86
69
|
writeText(props.value);
|
|
87
|
-
showSuccessMessage();
|
|
70
|
+
showSuccessMessage(instance);
|
|
88
71
|
}
|
|
89
72
|
|
|
90
|
-
function showSuccessMessage() {
|
|
73
|
+
function showSuccessMessage(instance: any) {
|
|
91
74
|
showCopied.value = true;
|
|
92
75
|
timeoutId = setTimeout(() => {
|
|
93
|
-
|
|
76
|
+
instance.hide();
|
|
77
|
+
clearTimeout(timeoutId);
|
|
94
78
|
setTimeout(() => {
|
|
95
79
|
showCopied.value = false;
|
|
96
80
|
}, 200);
|
|
@@ -8,16 +8,6 @@ export default {
|
|
|
8
8
|
showTooltip: {
|
|
9
9
|
control: { type: 'boolean' },
|
|
10
10
|
},
|
|
11
|
-
tooltipPosition: {
|
|
12
|
-
options: ['top', 'bottom', 'right', 'left'],
|
|
13
|
-
control: { type: 'radio' },
|
|
14
|
-
if: { arg: 'showTooltip' },
|
|
15
|
-
},
|
|
16
|
-
tooltipSize: {
|
|
17
|
-
options: ['small', 'medium', 'large'],
|
|
18
|
-
control: { type: 'radio' },
|
|
19
|
-
if: { arg: 'showTooltip' },
|
|
20
|
-
},
|
|
21
11
|
},
|
|
22
12
|
args: {
|
|
23
13
|
value: DateTime.now().minus({ minutes: 2 }).toISO(),
|
|
@@ -37,8 +27,6 @@ const Template = (args) => ({
|
|
|
37
27
|
export const Demo = Template.bind({});
|
|
38
28
|
Demo.args = {
|
|
39
29
|
showTooltip: true,
|
|
40
|
-
tooltipPosition: 'top',
|
|
41
|
-
tooltipSize: 'large',
|
|
42
30
|
};
|
|
43
31
|
|
|
44
32
|
const TemplateCustom = (args) => ({
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
3
|
:is="as"
|
|
4
|
-
:
|
|
5
|
-
:data-microtip-position="showTooltip ? tooltipPosition : undefined"
|
|
6
|
-
:data-microtip-size="showTooltip ? tooltipSize : undefined"
|
|
7
|
-
:role="showTooltip ? 'tooltip' : undefined"
|
|
4
|
+
:ref="showTooltip ? 'tooltip' : ''"
|
|
8
5
|
>
|
|
9
6
|
<slot
|
|
10
7
|
name="default"
|
|
@@ -22,7 +19,9 @@ import { t } from '@/i18n';
|
|
|
22
19
|
import { useI18nStore } from '@/stores/i18n';
|
|
23
20
|
import humanizeDuration from 'humanize-duration';
|
|
24
21
|
import { DateTime } from 'luxon';
|
|
25
|
-
import {
|
|
22
|
+
import { useTippy } from 'vue-tippy'
|
|
23
|
+
import 'tippy.js/dist/tippy.css'
|
|
24
|
+
|
|
26
25
|
const props = defineProps({
|
|
27
26
|
value: {
|
|
28
27
|
required: true,
|
|
@@ -32,14 +31,6 @@ const props = defineProps({
|
|
|
32
31
|
default: false,
|
|
33
32
|
type: Boolean,
|
|
34
33
|
},
|
|
35
|
-
tooltipPosition: {
|
|
36
|
-
default: 'top',
|
|
37
|
-
type: String as PropType<'top' | 'right' | 'left' | 'bottom'>,
|
|
38
|
-
},
|
|
39
|
-
tooltipSize: {
|
|
40
|
-
default: 'large',
|
|
41
|
-
type: String as PropType<'small' | 'medium' | 'large'>,
|
|
42
|
-
},
|
|
43
34
|
timeZone: {
|
|
44
35
|
default: 'utc',
|
|
45
36
|
type: String,
|
|
@@ -50,6 +41,19 @@ const props = defineProps({
|
|
|
50
41
|
},
|
|
51
42
|
});
|
|
52
43
|
|
|
44
|
+
const tooltip = ref();
|
|
45
|
+
|
|
46
|
+
const tooltipContent = computed(() => {
|
|
47
|
+
return DateTime.fromISO(props.value)
|
|
48
|
+
.setLocale(useI18nStore().locale)
|
|
49
|
+
.toLocaleString(DateTime.DATETIME_FULL);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
useTippy(tooltip, {
|
|
53
|
+
content: tooltipContent,
|
|
54
|
+
placement: 'auto',
|
|
55
|
+
})
|
|
56
|
+
|
|
53
57
|
const now = ref(DateTime.now().toSeconds());
|
|
54
58
|
|
|
55
59
|
function getMinutes(duration: number) {
|
|
@@ -111,11 +115,6 @@ const readableDate = computed(() => {
|
|
|
111
115
|
return t('sui.x_ago', { duration: durationHuman });
|
|
112
116
|
});
|
|
113
117
|
|
|
114
|
-
const tooltip = computed(() => {
|
|
115
|
-
return DateTime.fromISO(props.value)
|
|
116
|
-
.setLocale(useI18nStore().locale)
|
|
117
|
-
.toLocaleString(DateTime.DATETIME_FULL);
|
|
118
|
-
});
|
|
119
118
|
|
|
120
119
|
onBeforeUnmount(() => {
|
|
121
120
|
clearInterval(intervalId);
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
leave-to-class="opacity-0"
|
|
21
21
|
>
|
|
22
22
|
<slot
|
|
23
|
-
v-if="loading"
|
|
23
|
+
v-if="loading && showLoadingMask"
|
|
24
24
|
name="loading"
|
|
25
25
|
>
|
|
26
26
|
<div
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<path
|
|
38
38
|
fill="currentColor"
|
|
39
39
|
d="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z"
|
|
40
|
-
|
|
40
|
+
></path>
|
|
41
41
|
</svg>
|
|
42
42
|
</div>
|
|
43
43
|
</slot>
|
|
@@ -106,6 +106,10 @@ const props = defineProps({
|
|
|
106
106
|
default: '',
|
|
107
107
|
type: String,
|
|
108
108
|
},
|
|
109
|
+
showLoadingMask: {
|
|
110
|
+
default: true,
|
|
111
|
+
type: Boolean,
|
|
112
|
+
},
|
|
109
113
|
showNotificationOnError: {
|
|
110
114
|
default: true,
|
|
111
115
|
type: Boolean,
|
|
@@ -20,7 +20,7 @@ const Template = (args) => ({
|
|
|
20
20
|
return { args };
|
|
21
21
|
},
|
|
22
22
|
template: `
|
|
23
|
-
<form @submit.prevent=""
|
|
23
|
+
<form @submit.prevent="">
|
|
24
24
|
<BaseInputLabel v-bind="args"></BaseInputLabel>
|
|
25
25
|
<BaseInput required name="name" placeholder="Enter your first name"></BaseInput>
|
|
26
26
|
</form>
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<label :class="classes">
|
|
3
3
|
<div
|
|
4
|
-
|
|
4
|
+
:ref="help ? 'info' : ''"
|
|
5
|
+
class="relative inline-flex items-center"
|
|
5
6
|
:class="[help ? 'cursor-help' : 'cursor-default']"
|
|
6
|
-
@mouseenter="showTooltip = true"
|
|
7
|
-
@mouseleave="showTooltip = false"
|
|
8
7
|
>
|
|
9
8
|
<span> {{ label }}</span>
|
|
10
9
|
|
|
@@ -18,58 +17,41 @@
|
|
|
18
17
|
v-if="required"
|
|
19
18
|
class="ml-0.5 text-red-600"
|
|
20
19
|
> *</span>
|
|
21
|
-
|
|
22
|
-
<Transition
|
|
23
|
-
enter-active-class="transition duration-200 ease-out"
|
|
24
|
-
enter-from-class="transform scale-95 opacity-0"
|
|
25
|
-
enter-to-class="transform scale-100 opacity-100"
|
|
26
|
-
leave-active-class="transition duration-75 ease-in"
|
|
27
|
-
leave-from-class="transform scale-100 opacity-100"
|
|
28
|
-
leave-to-class="transform scale-95 opacity-0"
|
|
29
|
-
>
|
|
30
|
-
<div
|
|
31
|
-
v-if="showTooltip && help"
|
|
32
|
-
class="pointer-events-none absolute bottom-[100%] left-0 z-[1] w-auto max-w-[300px]"
|
|
33
|
-
>
|
|
34
|
-
<div
|
|
35
|
-
class="relative bottom-1 rounded-md bg-slate-700 py-1 px-2 text-xs leading-tight text-white"
|
|
36
|
-
>
|
|
37
|
-
{{ help }}
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
</Transition>
|
|
41
20
|
</div>
|
|
42
21
|
</label>
|
|
43
22
|
</template>
|
|
44
23
|
|
|
45
|
-
<script lang="ts">
|
|
46
|
-
import {
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import { PropType } from 'vue';
|
|
47
26
|
import { Icon as BaseIcon } from '@iconify/vue';
|
|
27
|
+
import { useTippy } from 'vue-tippy'
|
|
28
|
+
import 'tippy.js/dist/tippy.css'
|
|
48
29
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
default: 'mb-1 block text-sm',
|
|
62
|
-
type: String,
|
|
63
|
-
},
|
|
64
|
-
help: {
|
|
65
|
-
default: null,
|
|
66
|
-
type: [String, null] as PropType<string | null>,
|
|
67
|
-
},
|
|
30
|
+
const props = defineProps({
|
|
31
|
+
required: {
|
|
32
|
+
default: false,
|
|
33
|
+
type: Boolean,
|
|
34
|
+
},
|
|
35
|
+
label: {
|
|
36
|
+
required: true,
|
|
37
|
+
type: String,
|
|
38
|
+
},
|
|
39
|
+
classes: {
|
|
40
|
+
default: 'mb-1 block text-sm',
|
|
41
|
+
type: String,
|
|
68
42
|
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
};
|
|
43
|
+
help: {
|
|
44
|
+
default: null,
|
|
45
|
+
type: [String, null] as PropType<string | null>,
|
|
73
46
|
},
|
|
74
47
|
});
|
|
48
|
+
|
|
49
|
+
const info = ref();
|
|
50
|
+
const content = computed(() => { return props.help })
|
|
51
|
+
|
|
52
|
+
useTippy(info, {
|
|
53
|
+
content: content,
|
|
54
|
+
placement: 'auto',
|
|
55
|
+
})
|
|
56
|
+
|
|
75
57
|
</script>
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
:disabled="disabled"
|
|
17
17
|
@update="onItemUpdate(index, $event)"
|
|
18
18
|
@remove="$emit('remove', index)"
|
|
19
|
-
@save:name="$emit('save:name', index, $event)"
|
|
20
19
|
/>
|
|
21
20
|
</div>
|
|
22
21
|
</template>
|
|
@@ -50,7 +49,7 @@ const props = defineProps({
|
|
|
50
49
|
},
|
|
51
50
|
});
|
|
52
51
|
|
|
53
|
-
const emit = defineEmits(['update:modelValue', 'remove'
|
|
52
|
+
const emit = defineEmits(['update:modelValue', 'remove']);
|
|
54
53
|
|
|
55
54
|
function onItemUpdate(index: number, media: Media | UploadedFile) {
|
|
56
55
|
const modelValue = cloneDeep(props.modelValue);
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
type="text"
|
|
60
60
|
:value="name"
|
|
61
61
|
autofocus
|
|
62
|
-
@input="onNameChange"
|
|
63
62
|
@keydown.enter.prevent="saveName"
|
|
64
63
|
@keydown.escape.prevent="viewMode = 'show'"
|
|
65
64
|
>
|
|
@@ -132,7 +131,7 @@ import { t } from '@/i18n';
|
|
|
132
131
|
import { useResizeObserver } from '@vueuse/core';
|
|
133
132
|
import breakpoints from '../../config/breakpoints.json';
|
|
134
133
|
|
|
135
|
-
const emit = defineEmits(['remove', 'update'
|
|
134
|
+
const emit = defineEmits(['remove', 'update']);
|
|
136
135
|
|
|
137
136
|
const props = defineProps({
|
|
138
137
|
media: {
|
|
@@ -201,17 +200,13 @@ function editName() {
|
|
|
201
200
|
}, 100);
|
|
202
201
|
}
|
|
203
202
|
|
|
204
|
-
function
|
|
205
|
-
const target =
|
|
203
|
+
function saveName() {
|
|
204
|
+
const target = inputRef.value;
|
|
206
205
|
const media = cloneDeep(props.media);
|
|
207
|
-
media.name = (target
|
|
206
|
+
media.name = (target?.value ?? '') as string;
|
|
208
207
|
const ext = media.file_name.split('.').pop();
|
|
209
208
|
media.file_name = media.name + '.' + ext;
|
|
210
|
-
emit('update', media);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
function saveName() {
|
|
214
209
|
viewMode.value = 'show';
|
|
215
|
-
emit('
|
|
210
|
+
emit('update', media);
|
|
216
211
|
}
|
|
217
212
|
</script>
|