vueless 0.0.462 → 0.0.463
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
CHANGED
|
@@ -21,22 +21,15 @@
|
|
|
21
21
|
|
|
22
22
|
<span v-if="!isValue" v-bind="placeholderAttrs" v-text="currentLocale.noFile" />
|
|
23
23
|
|
|
24
|
-
<UFiles
|
|
24
|
+
<UFiles
|
|
25
|
+
:size="size"
|
|
26
|
+
v-bind="fileListAttrs"
|
|
27
|
+
:file-list="fileList"
|
|
28
|
+
:removable="multiple && !disabled"
|
|
29
|
+
@remove="onClickRemoveItem"
|
|
30
|
+
>
|
|
25
31
|
<template #right="{ file }">
|
|
26
|
-
<
|
|
27
|
-
v-if="props.multiple && !disabled"
|
|
28
|
-
round
|
|
29
|
-
filled
|
|
30
|
-
square
|
|
31
|
-
no-ring
|
|
32
|
-
variant="thirdary"
|
|
33
|
-
:size="removeItemButtonSize"
|
|
34
|
-
:left-icon="config.defaults.removeItemIcon"
|
|
35
|
-
:disabled="disabled"
|
|
36
|
-
v-bind="removeItemButtonAttrs"
|
|
37
|
-
:data-test="`${dataTest}-remove-item`"
|
|
38
|
-
@click.stop.prevent="onClickRemoveItem(file.id)"
|
|
39
|
-
/>
|
|
32
|
+
<slot name="right" :file="file" />
|
|
40
33
|
</template>
|
|
41
34
|
</UFiles>
|
|
42
35
|
|
|
@@ -254,7 +247,6 @@ const {
|
|
|
254
247
|
inputAttrs,
|
|
255
248
|
fileListAttrs,
|
|
256
249
|
buttonsAttrs,
|
|
257
|
-
removeItemButtonAttrs,
|
|
258
250
|
hasSlotContent,
|
|
259
251
|
} = useAttrs(props);
|
|
260
252
|
|
|
@@ -299,16 +291,6 @@ const fileList = computed(() => {
|
|
|
299
291
|
return currentFiles.value ? [currentFiles.value] : [];
|
|
300
292
|
});
|
|
301
293
|
|
|
302
|
-
const removeItemButtonSize = computed(() => {
|
|
303
|
-
const sizes = {
|
|
304
|
-
sm: "2xs",
|
|
305
|
-
md: "xs",
|
|
306
|
-
lg: "sm",
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
return sizes[props.size];
|
|
310
|
-
});
|
|
311
|
-
|
|
312
294
|
const buttonSize = computed(() => {
|
|
313
295
|
const sizes = {
|
|
314
296
|
sm: "xs",
|
|
@@ -60,7 +60,6 @@ export default /*tw*/ {
|
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
clearButton: "{UButton}",
|
|
63
|
-
removeItemButton: "{UButton} ml-2",
|
|
64
63
|
input: "sr-only",
|
|
65
64
|
i18n: {
|
|
66
65
|
sizeError: "File size is too big.",
|
|
@@ -78,6 +77,5 @@ export default /*tw*/ {
|
|
|
78
77
|
/* icons */
|
|
79
78
|
chooseFileIcon: "attach_file",
|
|
80
79
|
clearIcon: "close",
|
|
81
|
-
removeItemIcon: "close",
|
|
82
80
|
},
|
|
83
81
|
};
|
package/ui.text-file/UFile.vue
CHANGED
|
@@ -22,7 +22,21 @@
|
|
|
22
22
|
</div>
|
|
23
23
|
</slot>
|
|
24
24
|
|
|
25
|
-
<slot name="right" :file="{ elementId, label, url, imageUrl }"
|
|
25
|
+
<slot name="right" :file="{ elementId, label, url, imageUrl }">
|
|
26
|
+
<UButton
|
|
27
|
+
v-if="removable"
|
|
28
|
+
round
|
|
29
|
+
filled
|
|
30
|
+
square
|
|
31
|
+
no-ring
|
|
32
|
+
variant="thirdary"
|
|
33
|
+
:size="removeButtonSize"
|
|
34
|
+
:icon="config.defaults.removeIcon"
|
|
35
|
+
v-bind="removeButtonAttrs"
|
|
36
|
+
:data-test="`${dataTest}-remove-item`"
|
|
37
|
+
@click.stop.prevent="onRemove"
|
|
38
|
+
/>
|
|
39
|
+
</slot>
|
|
26
40
|
</ULink>
|
|
27
41
|
</template>
|
|
28
42
|
|
|
@@ -31,6 +45,7 @@ import { computed, ref, useId } from "vue";
|
|
|
31
45
|
|
|
32
46
|
import ULink from "../ui.button-link/ULink.vue";
|
|
33
47
|
import UIcon from "../ui.image-icon/UIcon.vue";
|
|
48
|
+
import UButton from "../ui.button/UButton.vue";
|
|
34
49
|
|
|
35
50
|
import { getDefault } from "../utils/utilUI.js";
|
|
36
51
|
|
|
@@ -82,6 +97,14 @@ const props = defineProps({
|
|
|
82
97
|
default: "",
|
|
83
98
|
},
|
|
84
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Show remove button.
|
|
102
|
+
*/
|
|
103
|
+
removable: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: false,
|
|
106
|
+
},
|
|
107
|
+
|
|
85
108
|
/**
|
|
86
109
|
* Component config object.
|
|
87
110
|
*/
|
|
@@ -99,12 +122,27 @@ const props = defineProps({
|
|
|
99
122
|
},
|
|
100
123
|
});
|
|
101
124
|
|
|
125
|
+
const emit = defineEmits([
|
|
126
|
+
/**
|
|
127
|
+
* Triggers when remove button is clicked.
|
|
128
|
+
* @property {string} fileId
|
|
129
|
+
*/
|
|
130
|
+
"remove",
|
|
131
|
+
]);
|
|
132
|
+
|
|
102
133
|
const focus = ref(false);
|
|
103
134
|
|
|
104
135
|
const elementId = props.id || useId();
|
|
105
136
|
|
|
106
|
-
const {
|
|
107
|
-
|
|
137
|
+
const {
|
|
138
|
+
config,
|
|
139
|
+
fileAttrs,
|
|
140
|
+
bodyAttrs,
|
|
141
|
+
fileIconAttrs,
|
|
142
|
+
fileLabelAttrs,
|
|
143
|
+
fileImageAttrs,
|
|
144
|
+
removeButtonAttrs,
|
|
145
|
+
} = useAttrs(props);
|
|
108
146
|
|
|
109
147
|
const iconSize = computed(() => {
|
|
110
148
|
const sizes = {
|
|
@@ -116,6 +154,20 @@ const iconSize = computed(() => {
|
|
|
116
154
|
return sizes[props.size];
|
|
117
155
|
});
|
|
118
156
|
|
|
157
|
+
const removeButtonSize = computed(() => {
|
|
158
|
+
const sizes = {
|
|
159
|
+
sm: "2xs",
|
|
160
|
+
md: "xs",
|
|
161
|
+
lg: "sm",
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
return sizes[props.size];
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
function onRemove() {
|
|
168
|
+
emit("remove", props.id);
|
|
169
|
+
}
|
|
170
|
+
|
|
119
171
|
function onFocus() {
|
|
120
172
|
focus.value = true;
|
|
121
173
|
}
|
package/ui.text-file/config.js
CHANGED
|
@@ -13,9 +13,11 @@ export default /*tw*/ {
|
|
|
13
13
|
fileImage: "rounded-sm max-w-7",
|
|
14
14
|
fileIcon: "{UIcon}",
|
|
15
15
|
fileLabel: "{ULink}",
|
|
16
|
+
removeButton: "{UButton} ml-2",
|
|
16
17
|
defaults: {
|
|
17
18
|
size: "md",
|
|
18
19
|
/* icons */
|
|
19
20
|
fileIcon: "description",
|
|
21
|
+
removeIcon: "close",
|
|
20
22
|
},
|
|
21
23
|
};
|
package/ui.text-files/UFiles.vue
CHANGED
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
:url="file.url"
|
|
18
18
|
:image-url="file.imageUrl"
|
|
19
19
|
:size="size"
|
|
20
|
+
:removable="removable"
|
|
20
21
|
v-bind="itemAttrs"
|
|
21
22
|
:data-test="`${dataTest}-item`"
|
|
23
|
+
@remove="onRemoveFile"
|
|
22
24
|
>
|
|
23
25
|
<template #left="{ file: currentFile }">
|
|
24
26
|
<!-- @slot Use it to add something left.
|
|
@@ -96,6 +98,14 @@ const props = defineProps({
|
|
|
96
98
|
default: getDefault(defaultConfig, UFiles).size,
|
|
97
99
|
},
|
|
98
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Show remove button for each file
|
|
103
|
+
*/
|
|
104
|
+
removable: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: false,
|
|
107
|
+
},
|
|
108
|
+
|
|
99
109
|
/**
|
|
100
110
|
* Component config object.
|
|
101
111
|
*/
|
|
@@ -113,6 +123,14 @@ const props = defineProps({
|
|
|
113
123
|
},
|
|
114
124
|
});
|
|
115
125
|
|
|
126
|
+
const emit = defineEmits([
|
|
127
|
+
/**
|
|
128
|
+
* Triggers when remove button is clicked.
|
|
129
|
+
* @property {string} fileId
|
|
130
|
+
*/
|
|
131
|
+
"remove",
|
|
132
|
+
]);
|
|
133
|
+
|
|
116
134
|
const { filesLabelAttrs, itemsAttrs, itemAttrs } = useAttrs(props);
|
|
117
135
|
|
|
118
136
|
const formattedFileList = computed(() =>
|
|
@@ -125,4 +143,8 @@ const formattedFileList = computed(() =>
|
|
|
125
143
|
};
|
|
126
144
|
}),
|
|
127
145
|
);
|
|
146
|
+
|
|
147
|
+
function onRemoveFile(fileId) {
|
|
148
|
+
emit("remove", fileId);
|
|
149
|
+
}
|
|
128
150
|
</script>
|
package/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"framework": "vue",
|
|
3
3
|
"name": "vueless",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.463",
|
|
5
5
|
"contributions": {
|
|
6
6
|
"html": {
|
|
7
7
|
"description-markup": "markdown",
|
|
@@ -4073,6 +4073,15 @@
|
|
|
4073
4073
|
},
|
|
4074
4074
|
"default": "\"\""
|
|
4075
4075
|
},
|
|
4076
|
+
{
|
|
4077
|
+
"name": "removable",
|
|
4078
|
+
"description": "Show remove button.",
|
|
4079
|
+
"value": {
|
|
4080
|
+
"kind": "expression",
|
|
4081
|
+
"type": "boolean"
|
|
4082
|
+
},
|
|
4083
|
+
"default": "false"
|
|
4084
|
+
},
|
|
4076
4085
|
{
|
|
4077
4086
|
"name": "config",
|
|
4078
4087
|
"description": "Component config object.",
|
|
@@ -4092,6 +4101,20 @@
|
|
|
4092
4101
|
"default": "\"\""
|
|
4093
4102
|
}
|
|
4094
4103
|
],
|
|
4104
|
+
"events": [
|
|
4105
|
+
{
|
|
4106
|
+
"name": "remove",
|
|
4107
|
+
"description": "Triggers when remove button is clicked.",
|
|
4108
|
+
"properties": [
|
|
4109
|
+
{
|
|
4110
|
+
"type": [
|
|
4111
|
+
"string"
|
|
4112
|
+
],
|
|
4113
|
+
"name": "fileId"
|
|
4114
|
+
}
|
|
4115
|
+
]
|
|
4116
|
+
}
|
|
4117
|
+
],
|
|
4095
4118
|
"slots": [
|
|
4096
4119
|
{
|
|
4097
4120
|
"name": "left",
|
|
@@ -4175,6 +4198,15 @@
|
|
|
4175
4198
|
},
|
|
4176
4199
|
"default": "md"
|
|
4177
4200
|
},
|
|
4201
|
+
{
|
|
4202
|
+
"name": "removable",
|
|
4203
|
+
"description": "Show remove button for each file",
|
|
4204
|
+
"value": {
|
|
4205
|
+
"kind": "expression",
|
|
4206
|
+
"type": "boolean"
|
|
4207
|
+
},
|
|
4208
|
+
"default": "false"
|
|
4209
|
+
},
|
|
4178
4210
|
{
|
|
4179
4211
|
"name": "config",
|
|
4180
4212
|
"description": "Component config object.",
|
|
@@ -4194,6 +4226,20 @@
|
|
|
4194
4226
|
"default": "\"\""
|
|
4195
4227
|
}
|
|
4196
4228
|
],
|
|
4229
|
+
"events": [
|
|
4230
|
+
{
|
|
4231
|
+
"name": "remove",
|
|
4232
|
+
"description": "Triggers when remove button is clicked.",
|
|
4233
|
+
"properties": [
|
|
4234
|
+
{
|
|
4235
|
+
"type": [
|
|
4236
|
+
"string"
|
|
4237
|
+
],
|
|
4238
|
+
"name": "fileId"
|
|
4239
|
+
}
|
|
4240
|
+
]
|
|
4241
|
+
}
|
|
4242
|
+
],
|
|
4197
4243
|
"slots": [
|
|
4198
4244
|
{
|
|
4199
4245
|
"name": "default",
|
|
@@ -4970,6 +5016,15 @@
|
|
|
4970
5016
|
"name": "left",
|
|
4971
5017
|
"description": "Use it to add something before the placeholder."
|
|
4972
5018
|
},
|
|
5019
|
+
{
|
|
5020
|
+
"name": "right",
|
|
5021
|
+
"scoped": true,
|
|
5022
|
+
"bindings": [
|
|
5023
|
+
{
|
|
5024
|
+
"name": "file"
|
|
5025
|
+
}
|
|
5026
|
+
]
|
|
5027
|
+
},
|
|
4973
5028
|
{
|
|
4974
5029
|
"name": "bottom",
|
|
4975
5030
|
"description": "Use it to add something below the component content."
|