vueless 0.0.341 → 0.0.342
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/package.json +2 -2
- package/ui.button/UButton.vue +7 -6
- package/ui.button-toggle-item/UToggleItem.vue +8 -7
- package/ui.container-accordion/UAccordion.vue +7 -6
- package/ui.container-modal/UModal.vue +6 -5
- package/ui.dropdown-badge/UDropdownBadge.vue +7 -6
- package/ui.dropdown-button/UDropdownButton.vue +7 -6
- package/ui.dropdown-link/UDropdownLink.vue +7 -6
- package/ui.dropdown-list/UDropdownList.vue +8 -7
- package/ui.form-checkbox/UCheckbox.vue +9 -8
- package/ui.form-color-picker/UColorPicker.vue +8 -7
- package/ui.form-date-picker/UDatePicker.vue +6 -5
- package/ui.form-date-picker-range/UDatePickerRange.vue +7 -6
- package/ui.form-input/UInput.vue +9 -8
- package/ui.form-input-file/UInputFile.vue +9 -8
- package/ui.form-input-money/UInputMoney.vue +6 -5
- package/ui.form-input-search/UInputSearch.vue +6 -5
- package/ui.form-radio/URadio.vue +8 -7
- package/ui.form-select/USelect.vue +10 -9
- package/ui.form-switch/USwitch.vue +8 -7
- package/ui.form-textarea/UTextarea.vue +11 -10
- package/ui.text-file/UFile.vue +9 -8
- package/utils/utilUI.js +1 -1
- package/web-types.json +43 -43
package/ui.form-input/UInput.vue
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ULabel
|
|
3
3
|
ref="labelComponentRef"
|
|
4
|
-
:for="
|
|
4
|
+
:for="elementId"
|
|
5
5
|
:label="label"
|
|
6
6
|
:description="description"
|
|
7
7
|
:disabled="disabled"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
centred
|
|
12
12
|
v-bind="inputLabelAttrs"
|
|
13
13
|
>
|
|
14
|
-
<label :for="
|
|
14
|
+
<label :for="elementId" v-bind="blockAttrs">
|
|
15
15
|
<span v-if="hasSlotContent($slots['left'])" ref="leftSlotWrapperRef">
|
|
16
16
|
<!-- @slot Use it to add something before the text. -->
|
|
17
17
|
<slot name="left" />
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
|
|
41
41
|
<span v-bind="inputWrapperAttrs">
|
|
42
42
|
<input
|
|
43
|
-
:id="
|
|
43
|
+
:id="elementId"
|
|
44
44
|
ref="inputRef"
|
|
45
45
|
v-model="inputValue"
|
|
46
46
|
:placeholder="placeholder"
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
/>
|
|
61
61
|
</span>
|
|
62
62
|
|
|
63
|
-
<label v-if="isTypePassword" v-bind="rightIconSlotAttrs" :for="
|
|
63
|
+
<label v-if="isTypePassword" v-bind="rightIconSlotAttrs" :for="elementId">
|
|
64
64
|
<UIcon
|
|
65
65
|
v-if="isTypePassword"
|
|
66
66
|
:name="
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
</template>
|
|
102
102
|
|
|
103
103
|
<script>
|
|
104
|
-
import {
|
|
104
|
+
import { getDefault } from "../utils/utilUI.js";
|
|
105
105
|
|
|
106
106
|
const VALIDATION_RULES_REG_EX = {
|
|
107
107
|
integer: /\d*/g,
|
|
@@ -113,7 +113,7 @@ const VALIDATION_RULES_REG_EX = {
|
|
|
113
113
|
</script>
|
|
114
114
|
|
|
115
115
|
<script setup>
|
|
116
|
-
import { ref, computed, onMounted, useSlots } from "vue";
|
|
116
|
+
import { ref, computed, onMounted, useSlots, useId } from "vue";
|
|
117
117
|
|
|
118
118
|
import { useMutationObserver } from "../composables/useMutationObserver.js";
|
|
119
119
|
|
|
@@ -304,11 +304,10 @@ const props = defineProps({
|
|
|
304
304
|
|
|
305
305
|
/**
|
|
306
306
|
* Unique element id.
|
|
307
|
-
* @ignore
|
|
308
307
|
*/
|
|
309
308
|
id: {
|
|
310
309
|
type: String,
|
|
311
|
-
default:
|
|
310
|
+
default: "",
|
|
312
311
|
},
|
|
313
312
|
|
|
314
313
|
/**
|
|
@@ -350,6 +349,8 @@ const inputPasswordClasses = computed(() => {
|
|
|
350
349
|
: "";
|
|
351
350
|
});
|
|
352
351
|
|
|
352
|
+
const elementId = props.id || useId();
|
|
353
|
+
|
|
353
354
|
const {
|
|
354
355
|
config,
|
|
355
356
|
inputAttrs,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ULabel
|
|
3
|
-
:for="
|
|
3
|
+
:for="elementId"
|
|
4
4
|
:size="size"
|
|
5
5
|
:label="label"
|
|
6
6
|
:error="error"
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
<UButton
|
|
46
46
|
filled
|
|
47
47
|
no-ring
|
|
48
|
-
:for="
|
|
48
|
+
:for="elementId"
|
|
49
49
|
tag="label"
|
|
50
50
|
variant="thirdary"
|
|
51
51
|
:size="buttonSize"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
/>
|
|
58
58
|
|
|
59
59
|
<input
|
|
60
|
-
:id="
|
|
60
|
+
:id="elementId"
|
|
61
61
|
ref="fileInputRef"
|
|
62
62
|
type="file"
|
|
63
63
|
:disabled="disabled"
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
</template>
|
|
95
95
|
|
|
96
96
|
<script setup>
|
|
97
|
-
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
|
97
|
+
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch, useId } from "vue";
|
|
98
98
|
import { merge } from "lodash-es";
|
|
99
99
|
|
|
100
100
|
import UText from "../ui.text-block/UText.vue";
|
|
@@ -102,7 +102,7 @@ import ULabel from "../ui.form-label/ULabel.vue";
|
|
|
102
102
|
import UButton from "../ui.button/UButton.vue";
|
|
103
103
|
import UFiles from "../ui.text-files/UFiles.vue";
|
|
104
104
|
|
|
105
|
-
import {
|
|
105
|
+
import { getDefault } from "../utils/utilUI.js";
|
|
106
106
|
import { getFileMbSize } from "./utilFileForm.js";
|
|
107
107
|
|
|
108
108
|
import useAttrs from "./useAttrs.js";
|
|
@@ -194,12 +194,11 @@ const props = defineProps({
|
|
|
194
194
|
},
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
|
-
*
|
|
198
|
-
* @ignore
|
|
197
|
+
* Unique element id.
|
|
199
198
|
*/
|
|
200
199
|
id: {
|
|
201
200
|
type: String,
|
|
202
|
-
default:
|
|
201
|
+
default: "",
|
|
203
202
|
},
|
|
204
203
|
/**
|
|
205
204
|
* Sets component ui config object.
|
|
@@ -237,6 +236,8 @@ const { tm } = useLocale();
|
|
|
237
236
|
const dropZoneRef = ref(null);
|
|
238
237
|
const fileInputRef = ref(null);
|
|
239
238
|
|
|
239
|
+
const elementId = props.id || useId();
|
|
240
|
+
|
|
240
241
|
const {
|
|
241
242
|
config,
|
|
242
243
|
inputLabelAttrs,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<UInput
|
|
3
|
-
:id="
|
|
3
|
+
:id="elementId"
|
|
4
4
|
ref="moneyInputRef"
|
|
5
5
|
v-model="formattedValue"
|
|
6
6
|
:size="size"
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
</template>
|
|
43
43
|
|
|
44
44
|
<script setup>
|
|
45
|
-
import { computed, ref, watch, onMounted, nextTick } from "vue";
|
|
45
|
+
import { computed, ref, watch, onMounted, nextTick, useId } from "vue";
|
|
46
46
|
|
|
47
|
-
import {
|
|
47
|
+
import { getDefault } from "../utils/utilUI.js";
|
|
48
48
|
|
|
49
49
|
import UInput from "../ui.form-input/UInput.vue";
|
|
50
50
|
import { SYMBOL_MINUS } from "../ui.text-money/constants.js";
|
|
@@ -212,11 +212,10 @@ const props = defineProps({
|
|
|
212
212
|
|
|
213
213
|
/**
|
|
214
214
|
* Unique element id.
|
|
215
|
-
* @ignore
|
|
216
215
|
*/
|
|
217
216
|
id: {
|
|
218
217
|
type: String,
|
|
219
|
-
default:
|
|
218
|
+
default: "",
|
|
220
219
|
},
|
|
221
220
|
|
|
222
221
|
/**
|
|
@@ -240,6 +239,8 @@ const emit = defineEmits(["update:modelValue", "keyup", "blur", "input"]);
|
|
|
240
239
|
|
|
241
240
|
const moneyInputRef = ref(null);
|
|
242
241
|
|
|
242
|
+
const elementId = props.id || useId();
|
|
243
|
+
|
|
243
244
|
const { inputAttrs } = useAttrs(props);
|
|
244
245
|
|
|
245
246
|
const { formattedValue, rawValue, setValue } = useFormatCurrency(`#${props.id}`, () => ({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<UInput
|
|
3
|
-
:id="
|
|
3
|
+
:id="elementId"
|
|
4
4
|
ref="searchInput"
|
|
5
5
|
v-model="search"
|
|
6
6
|
:size="size"
|
|
@@ -78,12 +78,12 @@
|
|
|
78
78
|
</template>
|
|
79
79
|
|
|
80
80
|
<script setup>
|
|
81
|
-
import { computed, ref } from "vue";
|
|
81
|
+
import { computed, ref, useId } from "vue";
|
|
82
82
|
|
|
83
83
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
84
84
|
import UInput from "../ui.form-input/UInput.vue";
|
|
85
85
|
import UButton from "../ui.button/UButton.vue";
|
|
86
|
-
import {
|
|
86
|
+
import { getDefault } from "../utils/utilUI.js";
|
|
87
87
|
import { debounce as debounceMethod } from "../utils/utilHelper.js";
|
|
88
88
|
|
|
89
89
|
import { UInputSearch } from "./constants.js";
|
|
@@ -201,11 +201,10 @@ const props = defineProps({
|
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
203
|
* Unique element id.
|
|
204
|
-
* @ignore
|
|
205
204
|
*/
|
|
206
205
|
id: {
|
|
207
206
|
type: String,
|
|
208
|
-
default:
|
|
207
|
+
default: "",
|
|
209
208
|
},
|
|
210
209
|
|
|
211
210
|
debounce: {
|
|
@@ -251,6 +250,8 @@ const emit = defineEmits([
|
|
|
251
250
|
|
|
252
251
|
const localValue = ref("");
|
|
253
252
|
|
|
253
|
+
const elementId = props.id || useId();
|
|
254
|
+
|
|
254
255
|
const { config, inputAttrs, searchIconAttrs, clearIconAttrs, buttonAttrs } = useAttrs(props);
|
|
255
256
|
|
|
256
257
|
const search = computed({
|
package/ui.form-radio/URadio.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ULabel
|
|
3
|
-
:for="
|
|
3
|
+
:for="elementId"
|
|
4
4
|
:label="label"
|
|
5
5
|
:error="error"
|
|
6
6
|
:size="radioSize"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
:data-test="`${dataTest}-label`"
|
|
12
12
|
>
|
|
13
13
|
<input
|
|
14
|
-
:id="
|
|
14
|
+
:id="elementId"
|
|
15
15
|
type="radio"
|
|
16
16
|
:value="radioValue"
|
|
17
17
|
:name="radioName"
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
31
|
<script setup>
|
|
32
|
-
import { computed, inject, onMounted, ref, watchEffect, toValue } from "vue";
|
|
32
|
+
import { computed, inject, onMounted, ref, watchEffect, toValue, useId } from "vue";
|
|
33
33
|
|
|
34
34
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
35
|
-
import {
|
|
35
|
+
import { getDefault } from "../utils/utilUI.js";
|
|
36
36
|
|
|
37
37
|
import defaultConfig from "./config.js";
|
|
38
38
|
import useAttrs from "./useAttrs.js";
|
|
@@ -139,12 +139,11 @@ const props = defineProps({
|
|
|
139
139
|
},
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
|
-
*
|
|
143
|
-
* @ignore
|
|
142
|
+
* Unique element id.
|
|
144
143
|
*/
|
|
145
144
|
id: {
|
|
146
145
|
type: String,
|
|
147
|
-
default:
|
|
146
|
+
default: "",
|
|
148
147
|
},
|
|
149
148
|
|
|
150
149
|
/**
|
|
@@ -187,6 +186,8 @@ const isChecked = computed(() => {
|
|
|
187
186
|
return JSON.stringify(currentValue) === JSON.stringify(props.value);
|
|
188
187
|
});
|
|
189
188
|
|
|
189
|
+
const elementId = props.id || useId();
|
|
190
|
+
|
|
190
191
|
const { radioAttrs, radioLabelAttrs } = useAttrs(props, { radioColor, radioSize });
|
|
191
192
|
|
|
192
193
|
const radioValue = computed(() => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ULabel
|
|
3
3
|
ref="labelComponentRef"
|
|
4
|
-
:for="
|
|
4
|
+
:for="elementId"
|
|
5
5
|
:size="size"
|
|
6
6
|
:label="label"
|
|
7
7
|
:error="error"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
ref="wrapperRef"
|
|
18
18
|
:tabindex="searchable || disabled ? -1 : 0"
|
|
19
19
|
role="combobox"
|
|
20
|
-
:aria-owns="'listbox-' +
|
|
20
|
+
:aria-owns="'listbox-' + elementId"
|
|
21
21
|
v-bind="wrapperAttrs"
|
|
22
22
|
@focus="activate"
|
|
23
23
|
@blur="deactivate"
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
<div v-bind="searchAttrs">
|
|
202
202
|
<input
|
|
203
203
|
v-show="searchable || !localValue || multiple || !isOpen"
|
|
204
|
-
:id="
|
|
204
|
+
:id="elementId"
|
|
205
205
|
ref="searchInputRef"
|
|
206
206
|
v-model="search"
|
|
207
207
|
type="text"
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
:placeholder="inputPlaceholder"
|
|
211
211
|
:value="search"
|
|
212
212
|
:disabled="disabled"
|
|
213
|
-
:aria-controls="'listbox-' +
|
|
213
|
+
:aria-controls="'listbox-' + elementId"
|
|
214
214
|
v-bind="searchInputAttrs"
|
|
215
215
|
@focus="activate"
|
|
216
216
|
@blur.prevent="deactivate"
|
|
@@ -308,13 +308,13 @@
|
|
|
308
308
|
</template>
|
|
309
309
|
|
|
310
310
|
<script setup>
|
|
311
|
-
import { ref, computed, nextTick, watch, useSlots, onMounted } from "vue";
|
|
311
|
+
import { ref, computed, nextTick, watch, useSlots, onMounted, useId } from "vue";
|
|
312
312
|
import { debounce, merge } from "lodash-es";
|
|
313
313
|
|
|
314
314
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
315
315
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
316
316
|
import UDropdownList from "../ui.dropdown-list/UDropdownList.vue";
|
|
317
|
-
import {
|
|
317
|
+
import { getDefault } from "../utils/utilUI.js";
|
|
318
318
|
import { isMac } from "../utils/utilPlatform.js";
|
|
319
319
|
|
|
320
320
|
import SelectService from "./utilSelect.js";
|
|
@@ -507,12 +507,11 @@ const props = defineProps({
|
|
|
507
507
|
},
|
|
508
508
|
|
|
509
509
|
/**
|
|
510
|
-
*
|
|
511
|
-
* @ignore
|
|
510
|
+
* Unique element id.
|
|
512
511
|
*/
|
|
513
512
|
id: {
|
|
514
513
|
type: String,
|
|
515
|
-
default:
|
|
514
|
+
default: "",
|
|
516
515
|
},
|
|
517
516
|
|
|
518
517
|
/**
|
|
@@ -608,6 +607,8 @@ const selectedLabel = computed(() => {
|
|
|
608
607
|
return isLocalValue.value ? getOptionLabel(localValue.value) : "";
|
|
609
608
|
});
|
|
610
609
|
|
|
610
|
+
const elementId = props.id || useId();
|
|
611
|
+
|
|
611
612
|
const {
|
|
612
613
|
config,
|
|
613
614
|
hasSlotContent,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ULabel
|
|
3
|
-
:for="
|
|
3
|
+
:for="elementId"
|
|
4
4
|
:size="size"
|
|
5
5
|
:label="label"
|
|
6
6
|
:description="description"
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
v-bind="switchLabelAttrs"
|
|
11
11
|
@click="onClickToggle"
|
|
12
12
|
>
|
|
13
|
-
<label :for="
|
|
13
|
+
<label :for="elementId" v-bind="wrapperAttrs">
|
|
14
14
|
<input
|
|
15
|
-
:id="
|
|
15
|
+
:id="elementId"
|
|
16
16
|
v-model="checkedValue"
|
|
17
17
|
type="checkbox"
|
|
18
18
|
:disabled="disabled"
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
</template>
|
|
39
39
|
|
|
40
40
|
<script setup>
|
|
41
|
-
import { computed } from "vue";
|
|
41
|
+
import { computed, useId } from "vue";
|
|
42
42
|
import { merge } from "lodash-es";
|
|
43
43
|
|
|
44
44
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
45
45
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
46
|
-
import {
|
|
46
|
+
import { getDefault } from "../utils/utilUI.js";
|
|
47
47
|
|
|
48
48
|
import { USwitch } from "./constants.js";
|
|
49
49
|
import defaultConfig from "./config.js";
|
|
@@ -129,11 +129,10 @@ const props = defineProps({
|
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
131
|
* Unique element id.
|
|
132
|
-
* @ignore
|
|
133
132
|
*/
|
|
134
133
|
id: {
|
|
135
134
|
type: String,
|
|
136
|
-
default:
|
|
135
|
+
default: "",
|
|
137
136
|
},
|
|
138
137
|
|
|
139
138
|
/**
|
|
@@ -171,6 +170,8 @@ const checkedValue = computed({
|
|
|
171
170
|
set: (value) => emit("update:modelValue", value),
|
|
172
171
|
});
|
|
173
172
|
|
|
173
|
+
const elementId = props.id || useId();
|
|
174
|
+
|
|
174
175
|
const {
|
|
175
176
|
config,
|
|
176
177
|
toggleIconAttrs,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ULabel
|
|
3
3
|
ref="labelComponentRef"
|
|
4
|
-
:for="
|
|
4
|
+
:for="elementId"
|
|
5
5
|
:label="label"
|
|
6
6
|
:error="error"
|
|
7
7
|
:description="description"
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
<label
|
|
15
15
|
v-if="hasSlotContent($slots['left'])"
|
|
16
16
|
ref="leftSlotWrapperRef"
|
|
17
|
-
:for="
|
|
17
|
+
:for="elementId"
|
|
18
18
|
v-bind="leftSlotAttrs"
|
|
19
19
|
>
|
|
20
20
|
<!-- @slot Use it to add something before the text. -->
|
|
21
21
|
<slot name="left" />
|
|
22
22
|
</label>
|
|
23
|
-
<label ref="textareaWrapperRef" :for="
|
|
23
|
+
<label ref="textareaWrapperRef" :for="elementId" v-bind="textareaWrapperAttrs">
|
|
24
24
|
<textarea
|
|
25
|
-
:id="
|
|
25
|
+
:id="elementId"
|
|
26
26
|
ref="textareaRef"
|
|
27
27
|
v-model="localValue"
|
|
28
28
|
:value="modelValue"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
@keydown.backspace="onBackspace"
|
|
44
44
|
/>
|
|
45
45
|
</label>
|
|
46
|
-
<label v-if="hasSlotContent($slots['right'])" :for="
|
|
46
|
+
<label v-if="hasSlotContent($slots['right'])" :for="elementId" v-bind="rightSlotAttrs">
|
|
47
47
|
<!-- @slot Use it to add something after the text. -->
|
|
48
48
|
<slot name="right" />
|
|
49
49
|
</label>
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
</template>
|
|
52
52
|
|
|
53
53
|
<script setup>
|
|
54
|
-
import { computed, onMounted, ref, watch, useSlots } from "vue";
|
|
54
|
+
import { computed, onMounted, ref, watch, useSlots, useId } from "vue";
|
|
55
55
|
|
|
56
56
|
import ULabel from "../ui.form-label/ULabel.vue";
|
|
57
|
-
import {
|
|
57
|
+
import { getDefault } from "../utils/utilUI.js";
|
|
58
58
|
|
|
59
59
|
import { UTextarea } from "./constants.js";
|
|
60
60
|
import defaultConfig from "./config.js";
|
|
@@ -171,12 +171,11 @@ const props = defineProps({
|
|
|
171
171
|
},
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
|
-
*
|
|
175
|
-
* @ignore
|
|
174
|
+
* Unique element id.
|
|
176
175
|
*/
|
|
177
176
|
id: {
|
|
178
177
|
type: String,
|
|
179
|
-
default:
|
|
178
|
+
default: "",
|
|
180
179
|
},
|
|
181
180
|
|
|
182
181
|
/**
|
|
@@ -231,6 +230,8 @@ const emit = defineEmits([
|
|
|
231
230
|
|
|
232
231
|
const slots = useSlots();
|
|
233
232
|
|
|
233
|
+
const elementId = props.id || useId();
|
|
234
|
+
|
|
234
235
|
const {
|
|
235
236
|
textareaAttrs,
|
|
236
237
|
textareaLabelAttrs,
|
package/ui.text-file/UFile.vue
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ULink :href="url" no-ring v-bind="fileAttrs" :data-test="dataTest">
|
|
3
|
-
<slot name="left" :file="{
|
|
3
|
+
<slot name="left" :file="{ elementId, label, url, imageUrl }" />
|
|
4
4
|
|
|
5
|
-
<slot :file="{
|
|
5
|
+
<slot :file="{ elementId, label, url, imageUrl }">
|
|
6
6
|
<div v-bind="bodyAttrs">
|
|
7
7
|
<img v-if="imageUrl" :alt="label" :src="imageUrl" v-bind="fileImageAttrs" />
|
|
8
8
|
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
</slot>
|
|
24
24
|
|
|
25
|
-
<slot name="right" :file="{
|
|
25
|
+
<slot name="right" :file="{ elementId, label, url, imageUrl }" />
|
|
26
26
|
</ULink>
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<script setup>
|
|
30
|
-
import { computed, ref } from "vue";
|
|
30
|
+
import { computed, ref, useId } from "vue";
|
|
31
31
|
|
|
32
32
|
import ULink from "../ui.button-link/ULink.vue";
|
|
33
33
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
34
34
|
|
|
35
|
-
import {
|
|
35
|
+
import { getDefault } from "../utils/utilUI.js";
|
|
36
36
|
|
|
37
37
|
import useAttrs from "./useAttrs.js";
|
|
38
38
|
import { UFile } from "./constants.js";
|
|
@@ -75,12 +75,11 @@ const props = defineProps({
|
|
|
75
75
|
},
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
79
|
-
* @ignore
|
|
78
|
+
* Unique element id.
|
|
80
79
|
*/
|
|
81
80
|
id: {
|
|
82
81
|
type: String,
|
|
83
|
-
default:
|
|
82
|
+
default: "",
|
|
84
83
|
},
|
|
85
84
|
|
|
86
85
|
/**
|
|
@@ -102,6 +101,8 @@ const props = defineProps({
|
|
|
102
101
|
|
|
103
102
|
const focus = ref(false);
|
|
104
103
|
|
|
104
|
+
const elementId = props.id || useId();
|
|
105
|
+
|
|
105
106
|
const { config, fileAttrs, bodyAttrs, fileIconAttrs, fileLabelAttrs, fileImageAttrs } = useAttrs(
|
|
106
107
|
props,
|
|
107
108
|
{
|