@redseed/redseed-ui-vue3 2.25.0 → 2.25.2
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
|
@@ -9,6 +9,10 @@ defineOptions({
|
|
|
9
9
|
})
|
|
10
10
|
|
|
11
11
|
const props = defineProps({
|
|
12
|
+
hasMedia: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false,
|
|
15
|
+
},
|
|
12
16
|
removable: {
|
|
13
17
|
type: Boolean,
|
|
14
18
|
default: false,
|
|
@@ -42,23 +46,23 @@ function setState(state) {
|
|
|
42
46
|
})
|
|
43
47
|
}
|
|
44
48
|
|
|
45
|
-
function
|
|
49
|
+
function setDefault() {
|
|
46
50
|
setState('default')
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
function
|
|
53
|
+
function setUploading() {
|
|
50
54
|
setState('uploading')
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
function
|
|
57
|
+
function setProcessing() {
|
|
54
58
|
setState('processing')
|
|
55
59
|
}
|
|
56
60
|
|
|
57
|
-
function
|
|
61
|
+
function setError() {
|
|
58
62
|
setState('error')
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
function
|
|
65
|
+
function setSuccess() {
|
|
62
66
|
setState('success')
|
|
63
67
|
}
|
|
64
68
|
|
|
@@ -83,8 +87,13 @@ const uploaderStateIconClass = computed(() => [
|
|
|
83
87
|
}
|
|
84
88
|
])
|
|
85
89
|
|
|
90
|
+
const showRemoveAction = computed(() => {
|
|
91
|
+
return (props.hasMedia || stateSuccess.value)
|
|
92
|
+
&& props.removable
|
|
93
|
+
})
|
|
94
|
+
|
|
86
95
|
function removeAction() {
|
|
87
|
-
|
|
96
|
+
setDefault()
|
|
88
97
|
emit('remove')
|
|
89
98
|
}
|
|
90
99
|
</script>
|
|
@@ -110,7 +119,7 @@ function removeAction() {
|
|
|
110
119
|
<div :class="uploaderContainerClass">
|
|
111
120
|
<div :class="uploaderContentClass">
|
|
112
121
|
<div :class="uploaderStateIconClass">
|
|
113
|
-
<slot name="state-icon-default" v-if="stateDefault">
|
|
122
|
+
<slot name="state-icon-default" v-if="stateDefault && !hasMedia">
|
|
114
123
|
<PlusIcon />
|
|
115
124
|
</slot>
|
|
116
125
|
<slot name="state-icon-uploading" v-if="stateUploading">
|
|
@@ -122,7 +131,7 @@ function removeAction() {
|
|
|
122
131
|
<slot name="state-icon-error" v-if="stateError">
|
|
123
132
|
<ExclamationCircleIcon />
|
|
124
133
|
</slot>
|
|
125
|
-
<slot name="state-icon-success" v-if="stateSuccess">
|
|
134
|
+
<slot name="state-icon-success" v-if="stateSuccess || hasMedia">
|
|
126
135
|
<DocumentIcon />
|
|
127
136
|
</slot>
|
|
128
137
|
</div>
|
|
@@ -140,7 +149,9 @@ function removeAction() {
|
|
|
140
149
|
<slot name="state-text-error" v-if="stateError">
|
|
141
150
|
Something went wrong
|
|
142
151
|
</slot>
|
|
143
|
-
<slot name="state-text-success" v-if="stateSuccess"
|
|
152
|
+
<slot name="state-text-success" v-if="stateSuccess">
|
|
153
|
+
Successfully uploaded
|
|
154
|
+
</slot>
|
|
144
155
|
</div>
|
|
145
156
|
|
|
146
157
|
<div v-if="stateSuccess && $slots['state-file-size']"
|
|
@@ -153,16 +164,16 @@ function removeAction() {
|
|
|
153
164
|
class="rsui-form-field-uploader__uploader"
|
|
154
165
|
>
|
|
155
166
|
<slot name="uploader"
|
|
156
|
-
:
|
|
157
|
-
:
|
|
158
|
-
:
|
|
159
|
-
:
|
|
160
|
-
:
|
|
167
|
+
:setDefault="setDefault"
|
|
168
|
+
:setUploading="setUploading"
|
|
169
|
+
:setProcessing="setProcessing"
|
|
170
|
+
:setError="setError"
|
|
171
|
+
:setSuccess="setSuccess"
|
|
161
172
|
></slot>
|
|
162
173
|
</div>
|
|
163
174
|
|
|
164
175
|
</div>
|
|
165
|
-
<div v-if="
|
|
176
|
+
<div v-if="showRemoveAction"
|
|
166
177
|
class="rsui-form-field-uploader__action"
|
|
167
178
|
>
|
|
168
179
|
<div class="rsui-form-field-uploader__action-icon"
|
|
@@ -183,18 +194,15 @@ function removeAction() {
|
|
|
183
194
|
@apply relative select-none;
|
|
184
195
|
@apply rounded-md border border-rsui-grey-300 border-dashed;
|
|
185
196
|
@apply flex flex-nowrap justify-center items-center gap-4;
|
|
197
|
+
@apply px-4 py-2.5;
|
|
186
198
|
&--success {
|
|
187
|
-
@apply border-rsui-light border-solid
|
|
199
|
+
@apply border-rsui-light border-solid;
|
|
188
200
|
}
|
|
189
201
|
}
|
|
190
202
|
|
|
191
203
|
&__content {
|
|
192
204
|
@apply relative flex flex-nowrap justify-center items-center gap-4;
|
|
193
|
-
@apply
|
|
194
|
-
|
|
195
|
-
&--success {
|
|
196
|
-
@apply pr-0;
|
|
197
|
-
}
|
|
205
|
+
@apply text-rsui-default;
|
|
198
206
|
}
|
|
199
207
|
|
|
200
208
|
&__state-icon {
|