@budibase/bbui 3.39.30 → 3.39.32
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/bbui.mjs +170 -146
- package/package.json +2 -2
- package/src/Form/Core/File.svelte +18 -5
- package/src/Form/File.svelte +4 -1
- package/src/Tooltip/TooltipWrapper.svelte +2 -12
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/bbui",
|
|
3
3
|
"description": "A UI solution used in the different Budibase projects.",
|
|
4
|
-
"version": "3.39.
|
|
4
|
+
"version": "3.39.32",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"module": "dist/bbui.mjs",
|
|
7
7
|
"exports": {
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "2c4f06dd4992d37167f40a3057d49a9b3eb34a61"
|
|
112
112
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import ActionButton from "../../ActionButton/ActionButton.svelte"
|
|
3
3
|
import { uuid } from "../../helpers"
|
|
4
4
|
import Icon from "../../Icon/Icon.svelte"
|
|
5
|
+
import ProgressCircle from "../../ProgressCircle/ProgressCircle.svelte"
|
|
5
6
|
import { createEventDispatcher } from "svelte"
|
|
6
7
|
|
|
7
8
|
const BYTES_IN_MB = 1000000
|
|
@@ -10,6 +11,8 @@
|
|
|
10
11
|
export let statusText: string | undefined = undefined
|
|
11
12
|
export let title: string = "Upload file"
|
|
12
13
|
export let disabled: boolean = false
|
|
14
|
+
export let loading: boolean = false
|
|
15
|
+
export let hideButtonWhenSet: boolean = false
|
|
13
16
|
export let allowClear: boolean | undefined = undefined
|
|
14
17
|
export let extensions: string[] | undefined = undefined
|
|
15
18
|
export let handleFileTooLarge: ((_file: File) => void) | undefined = undefined
|
|
@@ -39,6 +42,7 @@
|
|
|
39
42
|
function handleFile(evt: Event) {
|
|
40
43
|
const target = evt.target as HTMLInputElement
|
|
41
44
|
processFile(target.files?.[0])
|
|
45
|
+
target.value = ""
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
function clearFile() {
|
|
@@ -48,7 +52,7 @@
|
|
|
48
52
|
|
|
49
53
|
<input
|
|
50
54
|
id={fieldId}
|
|
51
|
-
{disabled}
|
|
55
|
+
disabled={disabled || loading}
|
|
52
56
|
type="file"
|
|
53
57
|
accept={inputAccept}
|
|
54
58
|
bind:this={fileInput}
|
|
@@ -58,7 +62,11 @@
|
|
|
58
62
|
<!-- svelte-ignore a11y-no-static-element-interactions -->
|
|
59
63
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
60
64
|
<div class="field">
|
|
61
|
-
{#if
|
|
65
|
+
{#if loading}
|
|
66
|
+
<div class="file-view">
|
|
67
|
+
<ProgressCircle size="S" />
|
|
68
|
+
</div>
|
|
69
|
+
{:else if statusText}
|
|
62
70
|
<div class="file-view status" class:disabled>
|
|
63
71
|
<div class="filename">{statusText}</div>
|
|
64
72
|
{#if !disabled || (allowClear === true && disabled)}
|
|
@@ -89,9 +97,14 @@
|
|
|
89
97
|
{/if}
|
|
90
98
|
</div>
|
|
91
99
|
{/if}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
100
|
+
{#if !hideButtonWhenSet || !(loading || statusText || value)}
|
|
101
|
+
<ActionButton
|
|
102
|
+
disabled={disabled || loading}
|
|
103
|
+
on:click={() => fileInput?.click()}
|
|
104
|
+
>
|
|
105
|
+
{title}
|
|
106
|
+
</ActionButton>
|
|
107
|
+
{/if}
|
|
95
108
|
</div>
|
|
96
109
|
|
|
97
110
|
<style>
|
package/src/Form/File.svelte
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
export let label: string | undefined = undefined
|
|
8
8
|
export let labelPosition: LabelPosition = "above"
|
|
9
9
|
export let disabled: boolean = false
|
|
10
|
+
export let loading: boolean = false
|
|
11
|
+
export let hideButtonWhenSet: boolean = false
|
|
10
12
|
export let allowClear: boolean | undefined = undefined
|
|
11
13
|
export let handleFileTooLarge: (_file: File) => void = () => {}
|
|
12
14
|
export let previewUrl: string | undefined = undefined
|
|
@@ -20,7 +22,6 @@
|
|
|
20
22
|
|
|
21
23
|
const dispatch = createEventDispatcher()
|
|
22
24
|
const onChange = (e: CustomEvent) => {
|
|
23
|
-
value = e.detail
|
|
24
25
|
dispatch("change", e.detail)
|
|
25
26
|
}
|
|
26
27
|
</script>
|
|
@@ -28,6 +29,8 @@
|
|
|
28
29
|
<Field {helpText} {label} {labelPosition} {error} {tooltip}>
|
|
29
30
|
<CoreFile
|
|
30
31
|
{disabled}
|
|
32
|
+
{loading}
|
|
33
|
+
{hideButtonWhenSet}
|
|
31
34
|
{allowClear}
|
|
32
35
|
{title}
|
|
33
36
|
{value}
|
|
@@ -14,12 +14,8 @@
|
|
|
14
14
|
{#if tooltip}
|
|
15
15
|
<div class="icon-container">
|
|
16
16
|
<AbsTooltip text={tooltip} {position}>
|
|
17
|
-
<div
|
|
18
|
-
|
|
19
|
-
class:icon-small={size === "M" || size === "S"}
|
|
20
|
-
on:focus
|
|
21
|
-
>
|
|
22
|
-
<Icon name="info" size="S" {disabled} hoverable />
|
|
17
|
+
<div class="icon" on:focus>
|
|
18
|
+
<Icon name="info" {size} {disabled} hoverable />
|
|
23
19
|
</div>
|
|
24
20
|
</AbsTooltip>
|
|
25
21
|
</div>
|
|
@@ -38,10 +34,4 @@
|
|
|
38
34
|
margin-left: 5px;
|
|
39
35
|
margin-right: 5px;
|
|
40
36
|
}
|
|
41
|
-
.icon {
|
|
42
|
-
transform: scale(0.75);
|
|
43
|
-
}
|
|
44
|
-
.icon-small {
|
|
45
|
-
margin-bottom: -2px;
|
|
46
|
-
}
|
|
47
37
|
</style>
|