@budibase/bbui 2.2.12-alpha.62 → 2.2.12-alpha.63
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": "2.2.12-alpha.
|
|
4
|
+
"version": "2.2.12-alpha.63",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"svelte": "src/index.js",
|
|
7
7
|
"module": "dist/bbui.es.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@adobe/spectrum-css-workflow-icons": "1.2.1",
|
|
41
|
-
"@budibase/string-templates": "2.2.12-alpha.
|
|
41
|
+
"@budibase/string-templates": "2.2.12-alpha.63",
|
|
42
42
|
"@spectrum-css/accordion": "3.0.24",
|
|
43
43
|
"@spectrum-css/actionbutton": "1.0.1",
|
|
44
44
|
"@spectrum-css/actiongroup": "1.0.1",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"resolutions": {
|
|
90
90
|
"loader-utils": "1.4.1"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "f884c90740b9573adae97d020127f24c4a7b5cbf"
|
|
93
93
|
}
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
}
|
|
87
87
|
.is-selected:not(.spectrum-ActionButton--emphasized):not(.spectrum-ActionButton--quiet) {
|
|
88
88
|
background: var(--spectrum-global-color-gray-300);
|
|
89
|
-
border-color: var(--spectrum-global-color-gray-
|
|
89
|
+
border-color: var(--spectrum-global-color-gray-500);
|
|
90
90
|
}
|
|
91
91
|
.noPadding {
|
|
92
92
|
padding: 0;
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
export default function positionDropdown(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export default function positionDropdown(element, opts) {
|
|
2
|
+
let resizeObserver
|
|
3
|
+
let latestOpts = opts
|
|
4
|
+
|
|
5
|
+
// We need a static reference to this function so that we can properly
|
|
6
|
+
// clean up the scroll listener.
|
|
7
|
+
const scrollUpdate = () => {
|
|
8
|
+
updatePosition(latestOpts)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Updates the position of the dropdown
|
|
12
|
+
const updatePosition = opts => {
|
|
13
|
+
const { anchor, align, maxWidth, useAnchorWidth, offset = 5 } = opts
|
|
6
14
|
if (!anchor) {
|
|
7
15
|
return
|
|
8
16
|
}
|
|
17
|
+
|
|
18
|
+
// Compute bounds
|
|
9
19
|
const anchorBounds = anchor.getBoundingClientRect()
|
|
10
20
|
const elementBounds = element.getBoundingClientRect()
|
|
11
21
|
let styles = {
|
|
@@ -51,26 +61,47 @@ export default function positionDropdown(
|
|
|
51
61
|
})
|
|
52
62
|
}
|
|
53
63
|
|
|
64
|
+
// The actual svelte action callback which creates observers on the relevant
|
|
65
|
+
// DOM elements
|
|
66
|
+
const update = newOpts => {
|
|
67
|
+
latestOpts = newOpts
|
|
68
|
+
|
|
69
|
+
// Cleanup old state
|
|
70
|
+
if (resizeObserver) {
|
|
71
|
+
resizeObserver.disconnect()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Do nothing if no anchor
|
|
75
|
+
const { anchor } = newOpts
|
|
76
|
+
if (!anchor) {
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Observe both anchor and element and resize the popover as appropriate
|
|
81
|
+
resizeObserver = new ResizeObserver(() => updatePosition(newOpts))
|
|
82
|
+
resizeObserver.observe(anchor)
|
|
83
|
+
resizeObserver.observe(element)
|
|
84
|
+
resizeObserver.observe(document.body)
|
|
85
|
+
}
|
|
86
|
+
|
|
54
87
|
// Apply initial styles which don't need to change
|
|
55
88
|
element.style.position = "absolute"
|
|
56
89
|
element.style.zIndex = "9999"
|
|
57
90
|
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
entries.forEach(update)
|
|
61
|
-
})
|
|
62
|
-
if (anchor) {
|
|
63
|
-
resizeObserver.observe(anchor)
|
|
64
|
-
}
|
|
65
|
-
resizeObserver.observe(element)
|
|
66
|
-
resizeObserver.observe(document.body)
|
|
91
|
+
// Set up a scroll listener
|
|
92
|
+
document.addEventListener("scroll", scrollUpdate, true)
|
|
67
93
|
|
|
68
|
-
|
|
94
|
+
// Perform initial update
|
|
95
|
+
update(opts)
|
|
69
96
|
|
|
70
97
|
return {
|
|
98
|
+
update,
|
|
71
99
|
destroy() {
|
|
72
|
-
|
|
73
|
-
|
|
100
|
+
// Cleanup
|
|
101
|
+
if (resizeObserver) {
|
|
102
|
+
resizeObserver.disconnect()
|
|
103
|
+
}
|
|
104
|
+
document.removeEventListener("scroll", scrollUpdate, true)
|
|
74
105
|
},
|
|
75
106
|
}
|
|
76
107
|
}
|
|
@@ -57,30 +57,28 @@
|
|
|
57
57
|
</script>
|
|
58
58
|
|
|
59
59
|
{#if open}
|
|
60
|
-
{
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</Portal>
|
|
83
|
-
{/key}
|
|
60
|
+
<Portal {target}>
|
|
61
|
+
<div
|
|
62
|
+
tabindex="0"
|
|
63
|
+
use:positionDropdown={{
|
|
64
|
+
anchor,
|
|
65
|
+
align,
|
|
66
|
+
maxWidth,
|
|
67
|
+
useAnchorWidth,
|
|
68
|
+
offset,
|
|
69
|
+
}}
|
|
70
|
+
use:clickOutside={{
|
|
71
|
+
callback: dismissible ? handleOutsideClick : () => {},
|
|
72
|
+
anchor,
|
|
73
|
+
}}
|
|
74
|
+
on:keydown={handleEscape}
|
|
75
|
+
class="spectrum-Popover is-open"
|
|
76
|
+
role="presentation"
|
|
77
|
+
transition:fly|local={{ y: -20, duration: 200 }}
|
|
78
|
+
>
|
|
79
|
+
<slot />
|
|
80
|
+
</div>
|
|
81
|
+
</Portal>
|
|
84
82
|
{/if}
|
|
85
83
|
|
|
86
84
|
<style>
|