@budibase/bbui 3.13.12 → 3.13.13
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 +5868 -5861
- package/package.json +2 -2
- package/src/Form/Core/Multiselect.svelte +22 -9
- package/src/Form/Core/Picker.svelte +1 -2
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.13.
|
|
4
|
+
"version": "3.13.13",
|
|
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": "
|
|
109
|
+
"gitHead": "12d0bfb1846c841fb2043159bfadc99b4424ae09"
|
|
110
110
|
}
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
<script lang="ts">
|
|
6
6
|
import Picker from "./Picker.svelte"
|
|
7
|
+
import type { Primitive } from "@budibase/types"
|
|
7
8
|
import { createEventDispatcher } from "svelte"
|
|
8
9
|
|
|
9
|
-
export let value:
|
|
10
|
+
export let value: Primitive[] = []
|
|
10
11
|
export let id: string | undefined = undefined
|
|
11
12
|
export let placeholder: string | null = null
|
|
12
13
|
export let disabled: boolean = false
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
$: toggleOption = makeToggleOption(selectedLookupMap, arrayValue)
|
|
37
38
|
|
|
38
39
|
const getFieldText = (
|
|
39
|
-
value:
|
|
40
|
+
value: Primitive[],
|
|
40
41
|
map: Record<string, any> | null,
|
|
41
42
|
placeholder: string | null
|
|
42
43
|
) => {
|
|
@@ -44,19 +45,25 @@
|
|
|
44
45
|
if (!map) {
|
|
45
46
|
return ""
|
|
46
47
|
}
|
|
47
|
-
const vals = value
|
|
48
|
+
const vals = value
|
|
49
|
+
.map(v => {
|
|
50
|
+
const str = typeof v === "string" ? v : v.toString()
|
|
51
|
+
return map[str] || v
|
|
52
|
+
})
|
|
53
|
+
.join(", ")
|
|
48
54
|
return `(${value.length}) ${vals}`
|
|
49
55
|
} else {
|
|
50
56
|
return placeholder || "Choose some options"
|
|
51
57
|
}
|
|
52
58
|
}
|
|
53
59
|
|
|
54
|
-
const getSelectedLookupMap = (value:
|
|
60
|
+
const getSelectedLookupMap = (value: Primitive[]) => {
|
|
55
61
|
const map: Record<string, boolean> = {}
|
|
56
62
|
if (Array.isArray(value) && value.length > 0) {
|
|
57
|
-
value.forEach(
|
|
58
|
-
if (
|
|
59
|
-
|
|
63
|
+
value.forEach(v => {
|
|
64
|
+
if (v) {
|
|
65
|
+
const str = typeof v === "string" ? v : v.toString()
|
|
66
|
+
map[str] = true
|
|
60
67
|
}
|
|
61
68
|
})
|
|
62
69
|
}
|
|
@@ -78,10 +85,16 @@
|
|
|
78
85
|
return map
|
|
79
86
|
}
|
|
80
87
|
|
|
81
|
-
const makeToggleOption = (
|
|
88
|
+
const makeToggleOption = (
|
|
89
|
+
map: Record<string, boolean>,
|
|
90
|
+
value: Primitive[]
|
|
91
|
+
) => {
|
|
82
92
|
return (optionValue: string) => {
|
|
83
93
|
if (map[optionValue]) {
|
|
84
|
-
|
|
94
|
+
// comparison needs to take into account different types, always compare them as strings
|
|
95
|
+
const filtered = value.filter(
|
|
96
|
+
option => option.toString() !== optionValue.toString()
|
|
97
|
+
)
|
|
85
98
|
dispatch("change", filtered)
|
|
86
99
|
} else {
|
|
87
100
|
dispatch("change", [...value, optionValue])
|
|
@@ -316,7 +316,6 @@
|
|
|
316
316
|
/* Icon and colour alignment */
|
|
317
317
|
.check {
|
|
318
318
|
display: none;
|
|
319
|
-
margin-right: -8px;
|
|
320
319
|
padding-left: 8px;
|
|
321
320
|
}
|
|
322
321
|
li.is-selected .check {
|
|
@@ -335,7 +334,7 @@
|
|
|
335
334
|
}
|
|
336
335
|
.popover-content.auto-width .spectrum-Menu-itemLabel {
|
|
337
336
|
white-space: nowrap;
|
|
338
|
-
overflow:
|
|
337
|
+
overflow: hidden;
|
|
339
338
|
text-overflow: ellipsis;
|
|
340
339
|
}
|
|
341
340
|
.popover-content:not(.auto-width) .spectrum-Menu-itemLabel {
|