@indielayer/ui 1.12.0 → 1.12.1
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/docs/pages/component/tabs/usage.vue +1 -0
- package/docs/pages/component/upload/usage.vue +28 -18
- package/lib/components/modal/Modal.vue.js +1 -4
- package/lib/components/tab/theme/Tab.base.theme.js +2 -2
- package/lib/components/tab/theme/TabGroup.base.theme.js +1 -1
- package/lib/components/upload/Upload.vue.d.ts +13 -0
- package/lib/components/upload/Upload.vue.js +100 -94
- package/lib/index.umd.js +2 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/components/modal/Modal.vue +2 -0
- package/src/components/tab/theme/Tab.base.theme.ts +3 -2
- package/src/components/tab/theme/TabGroup.base.theme.ts +1 -1
- package/src/components/upload/Upload.vue +15 -6
- package/src/version.ts +1 -1
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.12.
|
|
1
|
+
declare const _default: "1.12.1";
|
|
2
2
|
export default _default;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -3,9 +3,10 @@ import type { TabTheme } from '../Tab.vue'
|
|
|
3
3
|
const theme: TabTheme = {
|
|
4
4
|
classes: {
|
|
5
5
|
wrapper: ({ props, data }) => {
|
|
6
|
-
const c = ['
|
|
6
|
+
const c = ['transition-colors duration-150 ease-in-out whitespace-nowrap text-center']
|
|
7
7
|
|
|
8
|
-
if (data.variant === '
|
|
8
|
+
if (data.variant === 'line') c.push('py-2')
|
|
9
|
+
if (data.variant === 'block') c.push('py-1.5 px-8')
|
|
9
10
|
|
|
10
11
|
if (props.size === 'xs') c.push('text-xs')
|
|
11
12
|
else if (props.size === 'sm') c.push('text-sm')
|
|
@@ -8,7 +8,7 @@ const theme: TabGroupTheme = {
|
|
|
8
8
|
const c = ['']
|
|
9
9
|
|
|
10
10
|
if (!props.fullWidth) c.push('!w-fit')
|
|
11
|
-
if (props.variant === 'block') c.push('rounded-
|
|
11
|
+
if (props.variant === 'block') c.push('rounded-lg')
|
|
12
12
|
if (props.variant === 'block' && !props.ghost) c.push('bg-secondary-100 dark:bg-secondary-800 p-1')
|
|
13
13
|
|
|
14
14
|
return c
|
|
@@ -25,6 +25,10 @@ const uploadProps = {
|
|
|
25
25
|
default: 'POST',
|
|
26
26
|
},
|
|
27
27
|
withCredentials: Boolean,
|
|
28
|
+
fileFormDataName: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: 'file',
|
|
31
|
+
},
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
export type UploadFile = {
|
|
@@ -65,7 +69,7 @@ const props = defineProps(uploadProps)
|
|
|
65
69
|
|
|
66
70
|
const emit = defineEmits([...useInputtable.emits(), 'upload', 'remove'])
|
|
67
71
|
|
|
68
|
-
const elRef = ref<
|
|
72
|
+
const elRef = ref<HTMLInputElement | null>(null)
|
|
69
73
|
|
|
70
74
|
const isUploadMode = computed(() => !!props.action)
|
|
71
75
|
|
|
@@ -202,7 +206,7 @@ async function uploadFileRequest(uploadFile: UploadFile) {
|
|
|
202
206
|
const xhr = new XMLHttpRequest()
|
|
203
207
|
const formData = new FormData()
|
|
204
208
|
|
|
205
|
-
formData.append(
|
|
209
|
+
formData.append(props.fileFormDataName, uploadFile.file)
|
|
206
210
|
|
|
207
211
|
xhr.open(props.method, props.action, true)
|
|
208
212
|
|
|
@@ -219,14 +223,12 @@ async function uploadFileRequest(uploadFile: UploadFile) {
|
|
|
219
223
|
const percentComplete = (event.loaded / event.total) * 100
|
|
220
224
|
|
|
221
225
|
uploadFile.progress = percentComplete
|
|
222
|
-
|
|
223
|
-
console.log(`Upload progress: ${percentComplete}%`)
|
|
224
226
|
}
|
|
225
227
|
})
|
|
226
228
|
|
|
227
229
|
// Event listener when upload is complete
|
|
228
230
|
xhr.addEventListener('load', () => {
|
|
229
|
-
if (xhr.status
|
|
231
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
230
232
|
uploadFile.completed = true
|
|
231
233
|
try {
|
|
232
234
|
uploadFile.response = JSON.parse(xhr.responseText)
|
|
@@ -267,13 +269,20 @@ async function upload() {
|
|
|
267
269
|
validate(modelValue.value)
|
|
268
270
|
}
|
|
269
271
|
|
|
272
|
+
function reset() {
|
|
273
|
+
errorInternal.value = ''
|
|
274
|
+
isFirstValidation.value = true
|
|
275
|
+
modelValue.value = []
|
|
276
|
+
|
|
277
|
+
if (elRef.value) elRef.value.value = ''
|
|
278
|
+
}
|
|
279
|
+
|
|
270
280
|
const {
|
|
271
281
|
errorInternal,
|
|
272
282
|
hideFooterInternal,
|
|
273
283
|
isInsideForm,
|
|
274
284
|
inputListeners,
|
|
275
285
|
isFirstValidation,
|
|
276
|
-
reset,
|
|
277
286
|
validate,
|
|
278
287
|
setError,
|
|
279
288
|
} = useInputtable(props, { focus, emit })
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.12.
|
|
1
|
+
export default '1.12.1'
|