@budibase/bbui 3.19.2 → 3.20.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/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.19.2",
4
+ "version": "3.20.1",
5
5
  "license": "MPL-2.0",
6
6
  "svelte": "src/index.ts",
7
7
  "module": "dist/bbui.mjs",
@@ -106,5 +106,5 @@
106
106
  }
107
107
  }
108
108
  },
109
- "gitHead": "6d89c268f83c9702e183b1372e6db79ed1e48e9d"
109
+ "gitHead": "3e59ab10d5d14b2a7843a4f637163aba471cfa72"
110
110
  }
@@ -85,6 +85,15 @@
85
85
  }
86
86
  .fullWidth {
87
87
  width: 100%;
88
+ min-width: 0;
89
+ overflow: hidden;
90
+ }
91
+ .fullWidth .spectrum-ActionButton-label {
92
+ overflow: hidden;
93
+ text-overflow: ellipsis;
94
+ white-space: nowrap;
95
+ flex: 1;
96
+ text-align: left;
88
97
  }
89
98
  .active,
90
99
  .active :global(i) {
@@ -1,30 +1,30 @@
1
- <script lang="ts">
1
+ <script lang="ts" generics="Value extends UIFile|File">
2
+ import type { UIFile } from "@budibase/types"
2
3
  import "@spectrum-css/dropzone/dist/index-vars.css"
3
- import "@spectrum-css/typography/dist/index-vars.css"
4
4
  import "@spectrum-css/illustratedmessage/dist/index-vars.css"
5
+ import "@spectrum-css/typography/dist/index-vars.css"
5
6
  import { createEventDispatcher } from "svelte"
6
7
  import { uuid } from "../../helpers"
7
8
  import Icon from "../../Icon/Icon.svelte"
8
9
  import Link from "../../Link/Link.svelte"
10
+ import ProgressCircle from "../../ProgressCircle/ProgressCircle.svelte"
9
11
  import Tag from "../../Tags/Tag.svelte"
10
12
  import Tags from "../../Tags/Tags.svelte"
11
- import ProgressCircle from "../../ProgressCircle/ProgressCircle.svelte"
12
- import type { UIFile } from "@budibase/types"
13
13
 
14
14
  const BYTES_IN_KB = 1000
15
15
  const BYTES_IN_MB = 1000000
16
16
 
17
- export let value: UIFile[] | File[] = []
17
+ export let value: Value[] = []
18
18
  export let id: string | null = null
19
19
  export let disabled: boolean = false
20
20
  export let compact: boolean = false
21
21
  export let fileSizeLimit: number = BYTES_IN_MB * 20
22
- export let processFiles: ((_files: FileList) => Promise<UIFile[]>) | null =
22
+ export let processFiles: ((_files: FileList) => Promise<Value[]>) | null =
23
23
  null
24
24
  export let deleteAttachments: ((_keys: string[]) => Promise<void>) | null =
25
25
  null
26
26
  export let handleFileTooLarge:
27
- | ((_limit: number, _currentFiles: UIFile[] | File[]) => void)
27
+ | ((_limit: number, _currentFiles: Value[]) => void)
28
28
  | null = null
29
29
  export let handleTooManyFiles: ((_maximum: number) => void) | null = null
30
30
  export let gallery: boolean = true
@@ -35,7 +35,7 @@
35
35
  export let clickText: string | null = null
36
36
  export let addText: string | null = null
37
37
 
38
- const dispatch = createEventDispatcher<{ change: UIFile[] | File[] }>()
38
+ const dispatch = createEventDispatcher<{ change: Value[] }>()
39
39
  const imageExtensions = [
40
40
  "png",
41
41
  "tiff",
@@ -102,21 +102,22 @@
102
102
  loading = true
103
103
  try {
104
104
  const processedFiles = await processFiles(fileList)
105
- const newValue = [...(value as UIFile[]), ...processedFiles]
105
+ const newValue = [...value, ...processedFiles]
106
106
  dispatch("change", newValue)
107
107
  selectedImageIdx = newValue.length - 1
108
108
  } finally {
109
109
  loading = false
110
110
  }
111
111
  } else {
112
- dispatch("change", Array.from(fileList))
112
+ // TODO: this type should be inferred correctly, but it needs a much bigger refactor around all the usages and dynamic types
113
+ dispatch("change", Array.from(fileList) as Value[])
113
114
  }
114
115
  }
115
116
 
116
117
  async function removeFile() {
117
118
  dispatch(
118
119
  "change",
119
- value.filter((_x, idx) => idx !== selectedImageIdx) as UIFile[] | File[]
120
+ value.filter((_x, idx) => idx !== selectedImageIdx)
120
121
  )
121
122
  if (deleteAttachments) {
122
123
  await deleteAttachments(
@@ -1,23 +1,23 @@
1
- <script lang="ts">
2
- import Field from "./Field.svelte"
3
- import CoreDropzone from "./Core/Dropzone.svelte"
4
- import { createEventDispatcher } from "svelte"
1
+ <script lang="ts" generics="Value extends UIFile|File">
5
2
  import type { UIFile } from "@budibase/types"
3
+ import { createEventDispatcher } from "svelte"
4
+ import CoreDropzone from "./Core/Dropzone.svelte"
5
+ import Field from "./Field.svelte"
6
6
 
7
- export let value: UIFile[] | File[] = []
7
+ export let value: Value[] = []
8
8
  export let label: string | undefined = undefined
9
9
  export let labelPosition: "above" = "above"
10
10
  export let disabled: boolean = false
11
11
  export let error: string | undefined | false = undefined
12
12
  export let fileSizeLimit: number | undefined = undefined
13
13
  export let processFiles:
14
- | ((_files: FileList) => Promise<UIFile[]>)
14
+ | ((_files: FileList) => Promise<Value[]>)
15
15
  | undefined = undefined
16
16
  export let deleteAttachments:
17
17
  | ((_keys: string[]) => Promise<void>)
18
18
  | undefined = undefined
19
19
  export let handleFileTooLarge:
20
- | ((_limit: number, _currentFiles: UIFile[] | File[]) => void)
20
+ | ((_limit: number, _currentFiles: Value[]) => void)
21
21
  | undefined = undefined
22
22
  export let handleTooManyFiles: ((_maximum: number) => void) | undefined =
23
23
  undefined
@@ -27,8 +27,8 @@
27
27
  export let compact: boolean = false
28
28
  export let helpText: string | undefined = undefined
29
29
 
30
- const dispatch = createEventDispatcher<{ change: UIFile[] | File[] }>()
31
- const onChange = (e: CustomEvent<UIFile[] | File[]>) => {
30
+ const dispatch = createEventDispatcher<{ change: Value[] }>()
31
+ const onChange = (e: CustomEvent<Value[]>) => {
32
32
  value = e.detail
33
33
  dispatch("change", e.detail)
34
34
  }